function list_DiscountsById($id) { $query = $this->con->genericQuery("select * from " . $this->table . " where _id in ({$id})"); $objReturn = array(); foreach ($query as $value) { $discount = new discount(); $discount->open($value); $objReturn[] = $discount; } return $objReturn; }
<?php require_once "../config.php"; verify_access($list_modules); $discAdd = false; $discUpd = false; $discDel = false; $newDisc = new discount(); $country = new country(); if ($_POST['action'] == 'Save') { if (isset($_POST['hdIdAct'])) { if ($_POST['hdIdAct'] == "") { $newDisc->save($company->id, $_POST['code'], $_POST['percent'], $_POST['condition_start'], $_POST['condition_end']); $discAdd = true; } else { $newDisc->open($_POST['hdIdAct']); $newDisc->save($company->id, $_POST['code'], $_POST['percent'], $_POST['condition_start'], $_POST['condition_end']); $discUpd = true; } } } if ($_POST['action'] == 'Delete') { if (isset($_POST['hdIdDE'])) { $newDisc->open($_POST['hdIdDE']); $newDisc->del(); $discDel = true; } } $list_discounts = $newDisc->list_discounts($company->id); $country->open($company->fk_country); ?>