- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/discountcouponsmanagerbase.php
- Класс: BitrixSaleDiscountCouponsManagerBase
- Вызов: DiscountCouponsManagerBase::isExist
static function isExist($coupon)
{
$coupon = trim((string)$coupon);
if ($coupon === '')
return false;
self::initUseDiscount();
$couponIterator = InternalsDiscountCouponTable::getList(array(
'select' => array('ID', 'COUPON'),
'filter' => array('=COUPON' => $coupon)
));
if ($existCoupon = $couponIterator->fetch())
{
return array(
'ID' => $existCoupon['ID'],
'COUPON' => $existCoupon['COUPON'],
'MODULE' => 'sale',
'MODULE_ID' => 'sale',
);
}
else
{
if (!self::$onlySaleDiscount && !empty(self::$couponProviders))
{
foreach (self::$couponProviders as $provider)
{
$existCoupon = call_user_func_array(
$provider['isExist'],
array(
$coupon
)
);
if (!empty($existCoupon) && is_array($existCoupon))
{
if (!isset($existCoupon['ID']) || !isset($existCoupon['COUPON']))
continue;
return array(
'ID' => $existCoupon['ID'],
'COUPON' => $existCoupon['COUPON'],
'MODULE' => $provider['module'],
'MODULE_ID' => $provider['module']
);
}
}
unset($provider);
}
}
return false;
}