// | license@zen-cart.com so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // $Id$ // define('MAX_DISPLAY_RESTRICT_ENTRIES', 5); require 'includes/application_top.php'; $restrict_array = array(); $restrict_array[] = array('id' => 'Deny', 'text' => 'Deny'); $restrict_array[] = array('id' => 'Allow', 'text' => 'Allow'); if (!empty($_REQUEST['cid'])) { $gCoupon = new CommerceVoucher($_REQUEST['cid']); $gCoupon->load(NULL, FALSE); } else { $gCoupon = new CommerceVoucher(); } if (!empty($_REQUEST['action']) && $gCoupon->isValid()) { switch ($_REQUEST['action']) { case 'switch_status': $status = $gBitDb->getOne("SELECT coupon_restrict FROM " . TABLE_COUPON_RESTRICT . " WHERE restrict_id = ?", array($_GET['info'])); $new_status = $status == 'N' ? 'Y' : 'N'; $gBitDb->query("UPDATE " . TABLE_COUPON_RESTRICT . " SET coupon_restrict = ? WHERE restrict_id = ?", array($new_status, $_GET['info'])); bit_redirect($_SERVER['SCRIPT_NAME'] . '?cid=' . $gCoupon->mCouponId); break; case 'Add': $gCoupon->storeRestriction($_REQUEST); bit_redirect($_SERVER['SCRIPT_NAME'] . '?cid=' . $gCoupon->mCouponId); break; case 'remove': if (!empty($_GET['info'])) { $gBitDb->query("delete from " . TABLE_COUPON_RESTRICT . " where restrict_id = ?", array($_GET['info'])); }
require 'includes/application_top.php'; $feedback = array(); if (!empty($_REQUEST['selected_box'])) { $_REQUEST['action'] = ''; $_REQUEST['old_action'] = ''; } $getAction = !empty($_REQUEST['action']) ? $_REQUEST['action'] : ''; if (!empty($_REQUEST['cid'])) { $gCoupon = new CommerceVoucher($_REQUEST['cid']); $gCoupon->load(NULL, FALSE); } else { $gCoupon = new CommerceVoucher(); } switch ($getAction) { case 'delete': if ($gCoupon->isValid()) { // confirm first if (isset($_REQUEST["confirm"])) { $feedback['success'] = tra('Coupon deleted:') . ' ' . $gCoupon->getField('coupon_code'); $gCoupon->expunge(); } else { // $gBitSystem->setBrowserTitle( tra('Confirm removal of') . ' ' . $gContent->getTitle()); // crossposting from Blog \''.'addblognamehere'.'\'' ); $formHash['action'] = 'delete'; $formHash['cid'] = $_REQUEST['cid']; $msgHash = array('label' => 'Delete Coupon', 'confirm_item' => $gCoupon->getField('coupon_code') . ' - ' . $gCoupon->getField('coupon_description'), 'warning' => tra('This cannot be undone!')); $gBitSystem->confirmDialog($formHash, $msgHash); } } break; case 'store': $_REQUEST['coupon_id'] = $_REQUEST['cid'];