Пример #1
0
        switch ($_REQUEST['action']) {
            case 'activate':
            case 'deactivate':
                Internals\DiscountCouponTable::disableCheckCouponsUse();
                $fields = array('ACTIVE' => $_REQUEST['action'] == 'activate' ? 'Y' : 'N');
                foreach ($listID as &$couponID) {
                    $result = Internals\DiscountCouponTable::update($couponID, $fields);
                    if (!$result->isSuccess()) {
                        $adminList->AddGroupError(implode('<br>', $result->getErrorMessages(), $couponID));
                    }
                }
                unset($couponID, $fields);
                Internals\DiscountCouponTable::enableCheckCouponsUse();
                break;
            case 'delete':
                Internals\DiscountCouponTable::setDiscountCheckList(array($discountID));
                Internals\DiscountCouponTable::disableCheckCouponsUse();
                foreach ($listID as &$couponID) {
                    $result = Internals\DiscountCouponTable::delete($couponID);
                    if (!$result->isSuccess()) {
                        $adminList->AddGroupError(implode('<br>', $result->getErrorMessages(), $couponID));
                    }
                }
                unset($couponID);
                Internals\DiscountCouponTable::enableCheckCouponsUse();
                Internals\DiscountCouponTable::updateUseCoupons();
                break;
        }
    }
    unset($listID);
}
Пример #2
0
				unset($couponID, $fields);
				Internals\DiscountCouponTable::enableCheckCouponsUse();
				break;
			case 'delete':
				if (empty($discountList))
				{
					$couponIterator = Internals\DiscountCouponTable::getList(array(
						'select' => array('ID', 'DISCOUNT_ID'),
						'filter' => array('ID' => $listID)
					));
					while ($coupon = $couponIterator->fetch())
					{
						$discountList[$coupon['DISCOUNT_ID']] = true;;
					}
				}
				Internals\DiscountCouponTable::setDiscountCheckList(array_keys($discountList));
				Internals\DiscountCouponTable::disableCheckCouponsUse();
				foreach ($listID as &$couponID)
				{
					$result = Internals\DiscountCouponTable::delete($couponID);
					if (!$result->isSuccess())
					{
						$adminList->AddGroupError(implode('<br>', $result->getErrorMessages(), $couponID));
					}
				}
				unset($couponID);
				Internals\DiscountCouponTable::enableCheckCouponsUse();
				Internals\DiscountCouponTable::updateUseCoupons();
				break;
		}
	}
Пример #3
0
                 if (!$result->isSuccess()) {
                     $adminList->AddGroupError(implode('<br>', $result->getErrorMessages()), $couponID);
                 }
                 unset($result);
             }
             unset($couponID, $fields);
             Internals\DiscountCouponTable::enableCheckCouponsUse();
             break;
         case 'delete':
             if (empty($discountList)) {
                 $couponIterator = Internals\DiscountCouponTable::getList(array('select' => array('ID', 'DISCOUNT_ID'), 'filter' => array('@ID' => $listID)));
                 while ($coupon = $couponIterator->fetch()) {
                     $discountList[$coupon['DISCOUNT_ID']] = $coupon['DISCOUNT_ID'];
                 }
             }
             Internals\DiscountCouponTable::setDiscountCheckList($discountList);
             Internals\DiscountCouponTable::disableCheckCouponsUse();
             foreach ($listID as &$couponID) {
                 $result = Internals\DiscountCouponTable::delete($couponID);
                 if (!$result->isSuccess()) {
                     $adminList->AddGroupError(implode('<br>', $result->getErrorMessages()), $couponID);
                 }
                 unset($result);
             }
             unset($couponID);
             Internals\DiscountCouponTable::enableCheckCouponsUse();
             Internals\DiscountCouponTable::updateUseCoupons();
             break;
     }
 }
 unset($discountList, $listID);