Пример #1
0
<?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);
?>