• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/delivery/restrictions/excludelocation.php
  • Класс: BitrixSaleDeliveryRestrictionsExcludeLocation
  • Вызов: ExcludeLocation::filterServicesArray
static function filterServicesArray(Shipment $shipment, array $restrictionFields)
{
	if(empty($restrictionFields))
		return array();

	$shpLocCode = self::extractParams($shipment);

	//if location not defined in shipment
	if($shpLocCode === '')
		return array_keys($restrictionFields);

	$res = LocationTable::getList(array(
		'filter' => array('=CODE' => $shpLocCode),
		'select' => array('CODE', 'LEFT_MARGIN', 'RIGHT_MARGIN')
	));

	//if location doesn't exists
	if(!$shpLocParams = $res->fetch())
		return array_keys($restrictionFields);

	$srvLocCodesCompat = static::getLocationsCompat($restrictionFields, $shpLocParams['LEFT_MARGIN'], $shpLocParams['RIGHT_MARGIN']);

	foreach($srvLocCodesCompat as $locCode => $deliveries)
	{
		foreach($deliveries as $deliveryId)
		{
			if(isset($restrictionFields[$deliveryId]))
			{
				unset($restrictionFields[$deliveryId]);
			}
		}
	}

	return array_keys($restrictionFields);
}