• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/delivery/restrictions/bylocation.php
  • Класс: BitrixSaleDeliveryRestrictionsByLocation
  • Вызов: ByLocation::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);

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

	foreach($srvLocCodesCompat as $locCode => $deliveries)
		foreach($deliveries as $deliveryId)
			if(!in_array($deliveryId, $result))
				$result[] = $deliveryId;

	return $result;
}