// +----------------------------------------------------------------------+ // | This source file is subject to version 2.0 of the GPL license, | // | that is bundled with this package in the file LICENSE, and is | // | available through the world-wide-web at the following url: | // | http://www.zen-cart.com/license/2_0.txt. | // | If you did not receive a copy of the zen-cart license and are unable | // | to obtain it through the world-wide-web, please send a note to | // | license@zen-cart.com so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // $Id$ // require 'includes/application_top.php'; $feedback = array(); if (!empty($_REQUEST['action'])) { if ($_REQUEST['action'] == 'delete') { // $gBitUser->verifyTicket(); $coupon = new CommerceVoucher($_REQUEST['gid']); $coupon->expunge(); bit_redirect($_SERVER['SCRIPT_NAME']); } } $gBitSmarty->assign('feedback', $feedback); $sql = "SELECT c.`coupon_id` AS `hash_key`, c.coupon_amount, c.coupon_code, c.coupon_id, c.admin_note, et.sent_firstname, et.sent_lastname, et.customer_id_sent, et.emailed_to, et.date_sent, rt.`customer_id`, rt.`redeem_date`, rt.`redeem_ip`, rt.`order_id`\n\t\tFROM " . TABLE_COUPONS . " c\n\t\t\tINNER JOIN " . TABLE_COUPON_EMAIL_TRACK . " et ON(c.coupon_id=et.coupon_id)\n\t\t\tLEFT JOIN " . TABLE_COUPON_REDEEM_TRACK . " rt ON(c.coupon_id=rt.coupon_id)\n\t\tORDER BY date_sent desc"; $couponList = array(); if ($rs = $gBitDb->query($sql)) { while ($row = $rs->fetchRow()) { $couponList[$row['hash_key']] = $row; } } $gBitSmarty->assign_by_ref('couponList', $couponList); $gBitSystem->display('bitpackage:bitcommerce/admin_gv_sent.tpl', 'Gift Vouchers Sent', array('display_mode' => 'admin'));
$_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']; if ($gCoupon->store($_REQUEST)) { $feedback['success'] = tra('Coupon Saved:') . ' ' . $gCoupon->getField('coupon_code'); } else { $feedback = $gCoupon->mFeedback;