/** * get handlers list based on DB data * @deprecated */ public static function GetList($arSort = array("SORT" => "ASC"), $arFilter = array()) { if (self::isFieldInFilter2("SITE", $arFilter)) { $arFilter["SITE_ID"] = self::getFilterValue("SITE", $arFilter); unset($arFilter["SITE"]); } if (!isset($arFilter["SITE_ID"])) { $arFilter["SITE_ID"] = SITE_ID; } elseif ($arFilter["SITE_ID"] == "ALL") { unset($arFilter["SITE_ID"]); } if (!isset($arFilter["ACTIVE"])) { $arFilter["ACTIVE"] = "Y"; } elseif ($arFilter["ACTIVE"] == "ALL") { unset($arFilter["ACTIVE"]); } $params = array('order' => array_intersect_key($arSort, Bitrix\Sale\Delivery\Services\Table::getMap()), 'filter' => self::convertFilterOldToNew($arFilter)); $services = array(); $dbRes = \Bitrix\Sale\Delivery\Services\Table::getList($params); while ($service = $dbRes->fetch()) { $dbRstrRes = \Bitrix\Sale\Delivery\Restrictions\Table::getList(array('filter' => array("=DELIVERY_ID" => $service["ID"]))); while ($restr = $dbRstrRes->fetch()) { if (!self::checkRestrictionFilter($restr, $arFilter)) { continue 2; } if ($restr["CLASS_NAME"] == '\\Bitrix\\Sale\\Delivery\\Restrictions\\BySite') { $service["LID"] = $restr["PARAMS"]["SITE_ID"]; } } $srv = \Bitrix\Sale\Delivery\Services\Automatic::convertNewServiceToOld($service); if ($srv) { $services[] = $srv; } } $result = new \CDBResult(); $result->InitFromArray($services); return $result; }
/** * get handlers list based on DB data * @deprecated */ public static function GetList($arSort = array("SORT" => "ASC"), $arFilter = array()) { if (self::isFieldInFilter2("SITE", $arFilter)) { $arFilter["SITE_ID"] = self::getFilterValue("SITE", $arFilter); unset($arFilter["SITE"]); } if (isset($arFilter["SITE_ID"])) { if (is_string($arFilter["SITE_ID"]) && strlen($arFilter["SITE_ID"]) > 0) { if ($arFilter["SITE_ID"] == "ALL") { unset($arFilter["SITE_ID"]); } elseif (strpos($arFilter["SITE_ID"], ",") !== false) { $arFilter["SITE_ID"] = explode(",", $arFilter["SITE_ID"]); } else { $arFilter["SITE_ID"] = array($arFilter["SITE_ID"]); } } } else { $arFilter["SITE_ID"] = array(CSite::GetDefSite()); } if (!isset($arFilter["ACTIVE"])) { $arFilter["ACTIVE"] = "Y"; } elseif ($arFilter["ACTIVE"] == "ALL") { unset($arFilter["ACTIVE"]); } $params = array('order' => array_intersect_key($arSort, Bitrix\Sale\Delivery\Services\Table::getMap()), 'filter' => self::convertFilterOldToNew($arFilter)); $services = array(); $dbRes = \Bitrix\Sale\Delivery\Services\Table::getList($params); while ($service = $dbRes->fetch()) { $dbRstrRes = \Bitrix\Sale\Internals\ServiceRestrictionTable::getList(array('filter' => array("=SERVICE_ID" => $service["ID"], "=SERVICE_TYPE" => \Bitrix\Sale\Services\Base\RestrictionManager::SERVICE_TYPE_SHIPMENT))); while ($restr = $dbRstrRes->fetch()) { if (!self::checkRestrictionFilter($restr, $arFilter)) { continue 2; } if ($restr["CLASS_NAME"] == '\\Bitrix\\Sale\\Delivery\\Restrictions\\BySite' && !empty($restr["PARAMS"]["SITE_ID"])) { if (is_array($restr["PARAMS"]["SITE_ID"])) { reset($restr["PARAMS"]["SITE_ID"]); $service["LID"] = current($restr["PARAMS"]["SITE_ID"]); } elseif (is_string($restr["PARAMS"]["SITE_ID"])) { $service["LID"] = $restr["PARAMS"]["SITE_ID"]; } else { $service["LID"] = ""; } } } if (strlen($service['CODE']) > 0) { $srv = \Bitrix\Sale\Delivery\Services\Automatic::convertNewServiceToOld($service); } else { \Bitrix\Sale\Delivery\Services\Manager::getHandlersList(); if (get_parent_class($service['CLASS_NAME']) == 'Bitrix\\Sale\\Delivery\\Services\\Base') { if ($service['CLASS_NAME']::canHasProfiles()) { continue; } } $srv = \Bitrix\Sale\Delivery\Services\NewToAutomatic::convertNewServiceToOld($service); } if (empty($srv)) { continue; } if (is_array($arFilter["COMPABILITY"])) { $arProfiles = CSaleDeliveryHandler::GetHandlerCompability($arFilter["COMPABILITY"], $srv); if (!is_array($arProfiles) || count($arProfiles) <= 0) { continue; } else { $srv["PROFILES"] = $arProfiles; } } if ($srv) { $services[] = $srv; } } $result = new \CDBResult(); $result->InitFromArray($services); return $result; }