Ejemplo n.º 1
0
$readOnly = $saleModulePermissions < 'W';
if ($saleModulePermissions < 'R') {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
Loader::includeModule('sale');
Loc::loadMessages(__FILE__);
if ($subWindow) {
    require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/iblock/classes/general/subelement.php';
}
if (!$subWindow && ($ex = $APPLICATION->GetException())) {
    require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_admin_after.php';
    ShowError($ex->GetString());
    require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_admin.php';
    die;
}
$couponTypes = Internals\DiscountCouponTable::getCouponTypes(true);
$multiCoupons = false;
$discountID = 0;
if ($subWindow) {
    $multiCoupons = isset($_REQUEST['MULTI']) && $_REQUEST['MULTI'] == 'Y';
    if (isset($_REQUEST['DISCOUNT_ID'])) {
        $discountID = (int) $_REQUEST['DISCOUNT_ID'];
    }
    $discountIterator = Internals\DiscountTable::getList(array('select' => array('ID'), 'filter' => array('=ID' => $discountID)));
    if (!($discount = $discountIterator->fetch())) {
        require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_admin_after.php';
        ShowError(Loc::getMessage('BX_SALE_DISCOUNT_COUPON_ERR_DISCOUNT_ID_ABSENT'));
        require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_admin.php';
        die;
    }
}
Ejemplo n.º 2
0
 /**
  * Clear freeze coupons.
  *
  * @param array $coupon		Coupon data.
  * @return bool
  */
 protected static function filterFreezeCoupons($coupon)
 {
     if (empty(self::$couponTypes)) {
         self::$couponTypes = Internals\DiscountCouponTable::getCouponTypes(true);
     }
     return isset($coupon['TYPE']) && isset(self::$couponTypes[$coupon['TYPE']]) && $coupon['STATUS'] != self::STATUS_FREEZE;
 }