Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/lpost.delivery/lib/ |
Upload File : |
<?php namespace Lpost\Delivery; use \Bitrix\Main\Error, \Bitrix\Sale\Delivery\CalculationResult, \Bitrix\Main\Localization\Loc, \Lpost\Delivery; Loc::loadMessages(__FILE__); class Manager extends \Bitrix\Sale\Delivery\Services\Manager { public static function getRestrictedList(\Bitrix\Sale\Shipment $shipment = null, $restrictionMode, array $skipChecks = array()) { $result = array(); if(empty($skipChecks)) { $skipChecks = array( self::SKIP_CHILDREN_PARENT_CHECK, self::SKIP_PROFILE_PARENT_CHECK ); } //Have restrictions and this restrictions successfully checked $restrictedSrvIds = Restrictions\Manager::getRestrictedIds($shipment, $restrictionMode); //Don't have any restrictions + successfully checked $services = self::getActiveList(false, array_keys($restrictedSrvIds)); foreach($services as $srvParams) { // \Bitrix\Main\Diag\Debug::dumpToFile($srvParams, 'srvParams', '/bitrix/php_interface/log.txt'); $srvParams["RESTRICTED"] = false; if(!in_array(self::SKIP_PROFILE_PARENT_CHECK, $skipChecks)) if($srvParams["CLASS_NAME"]::canHasProfiles()) continue; if(!in_array(self::SKIP_CHILDREN_PARENT_CHECK, $skipChecks)) if(is_callable($srvParams["CLASS_NAME"]."::canHasChildren") && $srvParams["CLASS_NAME"]::canHasChildren()) continue; if(isset($restrictedSrvIds[$srvParams["ID"]]) && $restrictedSrvIds[$srvParams["ID"]] == Restrictions\Manager::SEVERITY_SOFT) $srvParams["RESTRICTED"] = true; $result[$srvParams["ID"]] = $srvParams; } return $result; } public static function getLPostProfile(array $ids = []) { $profiles = []; if(!empty($ids)) { $deliveryList = parent::getActiveList(); if(!empty($deliveryList)) { foreach ($deliveryList as $deliveryItem) { if(strpos($deliveryItem['CLASS_NAME'], '\Lpost\Delivery') !== false) { if(in_array($deliveryItem['ID'], $ids)) { $profiles[] = $deliveryItem; } } } } } return !empty($profiles) ? $profiles : false; } public static function getLpostActiveDelivery() { $arDelivery = []; if($deliveryList = parent::getActiveList()) { foreach ($deliveryList as $deliveryItem) { if(strpos($deliveryItem['CLASS_NAME'], '\Lpost\Delivery') !== false) { $arDelivery[$deliveryItem['ID']] = $deliveryItem; } } } return $arDelivery ?: []; } } ?>