• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/delivery/services/manager.php
  • Класс: BitrixSaleDeliveryServicesManager
  • Вызов: Manager::checkServiceRestriction
static function checkServiceRestriction($deliveryId, $checkParams, $restrictionClassName)
{
	if(empty($deliveryId))
		throw new ArgumentNullException("deliveryId");

	if(!is_array($deliveryId))
		$deliveryId = array($deliveryId);

	$dbRstrRes = ServiceRestrictionTable::getList(array(
		'filter' => array(
			'=SERVICE_ID' => $deliveryId,
			'=SERVICE_TYPE' => RestrictionsManager::SERVICE_TYPE_SHIPMENT,
			'=CLASS_NAME' => $restrictionClassName
		)
	));

	$tmp = array();
	/** @var RestrictionsBase $restriction */
	$restriction = static::getRestrictionObject($restrictionClassName);

	while($rstFields = $dbRstrRes->fetch())
	{
		$rstParams = is_array($rstFields["PARAMS"]) ? $rstFields["PARAMS"] : array();
		$tmp[$rstFields['SERVICE_ID']] = $restriction->check($checkParams, $rstParams, $rstFields['SERVICE_ID']);
	}

	if(count($deliveryId) == 1)
		return current($tmp);

	$result = array();

	foreach($deliveryId as $id)
		if(!isset($tmp[$id]) || (isset($tmp[$id]) && $tmp[$id] == true))
			$result[] = $id;

	return $result;
}