14use Bitrix\Main\Entity\EntityError;
41 parent::__construct($initParams);
43 if(isset($this->config[
"MAIN"][
"SID"]) && $this->config[
"MAIN"][
"SID"] <>
'')
47 if(!isset($initedHandlers[$this->config[
"MAIN"][
"SID"]]))
49 throw new SystemException(
"Can't initialize service with code\"".$this->config[
"MAIN"][
"SID"].
"\"");
52 $this->sid = $this->code = $this->config[
"MAIN"][
"SID"];
55 if(!empty($this->handlerInitParams[
"TRACKING_CLASS_NAME"]))
56 $this->setTrackingClass($this->handlerInitParams[
"TRACKING_CLASS_NAME"]);
58 if($this->handlerInitParams ==
false)
59 throw new SystemException(
"Can't get delivery services init params. Delivery id: ".$this->
id.
", sid: ".$this->sid);
61 if($this->currency ==
'' && !empty($this->handlerInitParams[
"BASE_CURRENCY"]))
62 $this->currency = $this->handlerInitParams[
"BASE_CURRENCY"];
67 if(isset($initParams[
"CONFIG"]))
68 $this->oldConfig = $initParams[
"CONFIG"];
76 return 'BITRIX_' . (string)$this->sid;
91 static $handlers =
null;
92 static $jsData = array();
96 sortByColumn($initedHandlers, array(mb_strtoupper(
"NAME") => SORT_ASC));
98 if($handlers ===
null)
100 $handlers = array(
"" =>
"");
102 foreach($initedHandlers as $handler)
104 if (isset($handler[
"DEPRECATED"]) && $handler[
"DEPRECATED"] =
"Y")
109 if (!self::isAutomaticHandlerCompatible($handler))
114 $handlers[$handler[
"SID"]] = $handler[
"NAME"].
" [".$handler[
"SID"].
"]";
115 $jsData[$handler[
"SID"]] = array(
116 htmlspecialcharsbx($handler[
"NAME"]),
117 htmlspecialcharsbx($handler[
"DESCRIPTION"]),
118 htmlspecialcharsbx($handler[
"DESCRIPTION_INNER"])
123 if (($this->handlerInitParams[
"SID"] ??
'') ==
'' || $this->
id <=0)
128 "DESCRIPTION" =>
Loc::getMessage(
"SALE_DLVR_HANDL_AUT_HANDLER_SETTINGS_DSCR"),
133 "OPTIONS" => $handlers,
134 "ONCHANGE" =>
"var data=".\CUtil::PhpToJSObject($jsData).
"; BX.onCustomEvent('onDeliveryServiceNameChange',[{name: data[this.value][0], description: data[this.value][1]}]); BX('adm-sale-delivery-auto-description_inner_view').innerHTML=data[this.value][2]; //this.form.submit();"
136 "DESCRIPTION_INNER" => array(
137 "TYPE" =>
"DELIVERY_READ_ONLY",
139 "ID" =>
"adm-sale-delivery-auto-description_inner",
148 $handler = $this->handlerInitParams[
"SID"];
153 "DESCRIPTION" =>
Loc::getMessage(
"SALE_DLVR_HANDL_AUT_HANDLER_SETTINGS_DSCR"),
156 "TYPE" =>
"DELIVERY_READ_ONLY",
159 "VALUE_VIEW" => $handlers[$handler]
161 "DESCRIPTION_INNER" => array(
162 "TYPE" =>
"DELIVERY_READ_ONLY",
164 "VALUE" => $this->handlerInitParams[
"DESCRIPTION_INNER"]
171 $serviceCurrency = $this->currency;
173 if(\
Bitrix\Main\Loader::includeModule(
'currency'))
175 $currencyList = CurrencyManager::getCurrencyList();
177 if (isset($currencyList[$this->currency]))
178 $serviceCurrency = $currencyList[$this->currency];
180 unset($currencyList);
183 $marginTypes = array(
185 "CURRENCY" => $serviceCurrency
188 $result[
"MAIN"][
"ITEMS"][
"MARGIN_VALUE"] = array(
194 $result[
"MAIN"][
"ITEMS"][
"MARGIN_TYPE"] = array(
198 "OPTIONS" => $marginTypes
203 $configProfileIds = array_keys($this->handlerInitParams[
"PROFILES"]);
207 $configProfileIds = array();
210 if(isset($this->oldConfig[
"CONFIG_GROUPS"]))
212 $groupProfileIds = array_keys($this->oldConfig[
"CONFIG_GROUPS"]);
213 $intersect = array_intersect($groupProfileIds, $configProfileIds);
215 foreach($intersect as $pid)
216 unset($this->oldConfig[
"CONFIG_GROUPS"][$pid]);
223 if(isset(
$oldConfig[
"CONFIG_GROUPS"][
"MAIN"]))
237 $fields = parent::prepareFieldsForSaving($fields);
239 if(!isset($fields[
"CONFIG"]))
242 if(!isset($fields[
"CONFIG"][
"MAIN"][
"SID"]) || $fields[
"CONFIG"][
"MAIN"][
"SID"] ==
'')
250 $configMain = $fields[
"CONFIG"][
"MAIN"];
252 if (isset($this->handlerInitParams[
"DBSETSETTINGS"]) && is_callable($this->handlerInitParams[
"DBSETSETTINGS"]))
254 $oldSettings = $fields[
"CONFIG"];
255 unset($oldSettings[
"MAIN"]);
259 if (!$strOldSettings = call_user_func($this->handlerInitParams[
"DBSETSETTINGS"], $oldSettings))
260 throw new SystemException(
"Can't save delivery services's old settings");
264 $strOldSettings =
"";
267 $strOldSettings = serialize($strOldSettings);
268 $fields[
"CONFIG"] = array(
269 "MAIN" => $configMain
272 $fields[
"CONFIG"][
"MAIN"][
"OLD_SETTINGS"] = $strOldSettings;
274 if(isset($this->handlerInitParams[
"CURRENCY"]) && $this->handlerInitParams[
"CURRENCY"] <>
'')
275 $fields[
"CURRENCY"] = $this->handlerInitParams[
"CURRENCY"];
284 foreach($newSettings as $key => $value)
287 $result = array_merge($result, self::convertNewSettingsToOld($value));
289 $result[$key] = $value;
303 Input\Manager::getTypes();
306 foreach(
$oldConfig[
"CONFIG_GROUPS"] as $groupId => $groupName)
308 $handlerConfig = array(
309 "TITLE" => $groupName,
310 "DESCRIPTION" => $groupName,
314 foreach(
$oldConfig[
"CONFIG"] as $key => $param)
316 if($param[
"GROUP"] == $groupId)
320 if(isset($param[
"MCS_ID"]))
322 if($newParam[
"TYPE"] ==
'DELIVERY_MULTI_CONTROL_STRING')
326 $handlerConfig[
"ITEMS"][$mc->getKey()] = $mc->getParams();
330 $mc->setParams($key, $newParam);
332 elseif(!$mc->isClean())
334 $mc->addItem($key, $newParam);
338 $handlerConfig[
"ITEMS"][$key] = $newParam;
341 elseif(!$mc->isClean())
343 $handlerConfig[
"ITEMS"][$mc->getKey()] = $mc->getParams();
345 $handlerConfig[
"ITEMS"][$key] = $newParam;
349 $handlerConfig[
"ITEMS"][$key] = $newParam;
356 $handlerConfig[
"ITEMS"][$mc->getKey()] = $mc->getParams();
360 $result[$groupId] = $handlerConfig;
370 if(isset($oldParam[
"TYPE"]))
372 switch($oldParam[
"TYPE"])
376 $result[
"TYPE"] =
'STRING';
380 $result[
"TYPE"] =
'ENUM';
384 $result[
"TYPE"] =
'ENUM';
385 $result[
"MULTIELEMENT"] =
'Y';
389 $result[
"TYPE"] =
'Y/N';
393 $result[
"TYPE"] =
'DELIVERY_SECTION';
396 case 'MULTI_CONTROL_STRING':
397 $result[
"TYPE"] =
'DELIVERY_MULTI_CONTROL_STRING';
401 $result[
"TYPE"] =
'DELIVERY_READ_ONLY';
407 $result[
"TYPE"] =
'STRING';
410 if(isset($oldParam[
"TITLE"]))
411 $result[
"NAME"] = $oldParam[
"TITLE"];
413 if(isset($oldParam[
"DEFAULT"]))
414 $result[
"DEFAULT"] = $oldParam[
"DEFAULT"];
416 if(isset($oldParam[
"VALUE"]))
417 $result[
"VALUE"] = $oldParam[
"VALUE"];
419 if(isset($oldParam[
"VALUES"]))
420 $result[
"OPTIONS"] = $oldParam[
"VALUES"];
427 return \CSaleDelivery::convertOrderNewToOld($shipment);
437 return isset($handlers[
$sid]) ? $handlers[
$sid] :
false;
442 static $isHandlerInited =
false;
448 \
Bitrix\Main\
Config\Option::get(
'sale',
'delivery_handles_custom_path', BX_PERSONAL_ROOT.
'/php_interface/include/sale_delivery/'),
449 "/bitrix/modules/sale/delivery/",
452 $arLoadedHandlers = array();
454 foreach ($arPathList as $basePath)
456 if (file_exists($_SERVER[
"DOCUMENT_ROOT"].$basePath) && is_dir($_SERVER[
"DOCUMENT_ROOT"].$basePath))
458 $handle = @opendir($_SERVER[
"DOCUMENT_ROOT"].$basePath);
459 while(($filename = readdir($handle)) !==
false)
461 if($filename ==
"." || $filename ==
".." || in_array($filename, $arLoadedHandlers))
464 if (!is_dir($_SERVER[
"DOCUMENT_ROOT"].$basePath.
"/".$filename) && mb_substr($filename, 0, 9) ==
"delivery_")
466 if(\
Bitrix\Main\
IO\Path::getExtension($filename) ==
'php')
468 $arLoadedHandlers[] = $filename;
469 require_once($_SERVER[
"DOCUMENT_ROOT"].$basePath.
"/".$filename);
477 $isHandlerInited =
true;
483 static $arHandlersList = array();
485 if(isset($arHandlersList[$indexBy]) && is_array($arHandlersList[$indexBy]))
486 return $arHandlersList[$indexBy];
490 $arHandlersList[$indexBy] = array();
492 foreach(GetModuleEvents(
"sale",
"onSaleDeliveryHandlersBuildList",
true) as $arHandler)
494 $initParams = ExecuteModuleEventEx($arHandler);
497 if($indexBy <>
'' && isset($initParams[$indexBy]))
498 $arHandlersList[$indexBy][$initParams[$indexBy]] = $initParams;
500 $arHandlersList[$indexBy][] = $initParams;
503 return $arHandlersList[$indexBy];
508 if(!
$sid && !isset($service[
"CONFIG"][
"MAIN"][
"SID"]))
515 $service[
"SID"] =
$sid;
517 $service[
"SID"] = $service[
"CONFIG"][
"MAIN"][
"SID"];
519 $handlerExists = isset($handlers[$service[
"SID"]]) && is_array($handlers[$service[
"SID"]]);
521 $service[
"TAX_RATE"] = $service[
"CONFIG"][
"MAIN"][
"MARGIN_VALUE"];
522 $service[
"INSTALLED"] =
'Y';
524 $service[
"BASE_CURRENCY"] = $service[
"CURRENCY"];
525 $service[
"SETTINGS"] = $service[
"CONFIG"][
"MAIN"][
"OLD_SETTINGS"] ??
'';
526 $service[
"HANDLER"] =
'';
529 $service[
"HANDLER"] = $handlers[$service[
"SID"]][
"HANDLER"] ??
'';
532 $service[
'LOGOTIP'] = (int)($service[
'LOGOTIP'] ?? 0);
533 if ($service[
"LOGOTIP"] > 0)
535 $service[
"LOGOTIP"] = \CFile::getFileArray($service[
"LOGOTIP"]);
540 $serviceId = (int)($service[
'ID'] ?? 0);
543 $restrictions = \Bitrix\Sale\Delivery\Restrictions\Manager::getRestrictionsList($serviceId);
545 foreach($restrictions as $restriction)
547 if($restriction[
"CLASS_NAME"] ==
'\Bitrix\Sale\Delivery\Restrictions\BySite' && !empty($restriction[
"PARAMS"][
"SITE_ID"]))
549 if(is_array($restriction[
"PARAMS"][
"SITE_ID"]))
551 reset($restriction[
"PARAMS"][
"SITE_ID"]);
552 $siteId = current($restriction[
"PARAMS"][
"SITE_ID"]);
556 $siteId = $restriction[
"PARAMS"][
"SITE_ID"];
567 $service[
'CONFIG'] = [];
570 $service[
"CONFIG"] =
self::createConfig($handlers[$service[
"SID"]], $service[
"SETTINGS"], $siteId);
572 $service[
"SETTINGS"] = unserialize($service[
"SETTINGS"], [
'allowed_classes' =>
false]);
573 $service[
"PROFILES"] = array();
579 $profileId = $profile[
"CONFIG"][
"MAIN"][
"PROFILE_ID"];
580 $profileParams = array(
581 "TITLE" => $profile[
"NAME"],
582 "DESCRIPTION" => $profile[
"DESCRIPTION"],
583 "TAX_RATE" => $service[
"CONFIG"][
"MAIN"][
"MARGIN_VALUE"] ??
'',
584 "ACTIVE" => $profile[
"ACTIVE"]
587 $restrictions = Restrictions\Manager::getRestrictionsList($profile[
"ID"]);
589 foreach($restrictions as $restriction)
591 switch($restriction[
"CLASS_NAME"])
593 case '\Bitrix\Sale\Delivery\Restrictions\ByWeight':
594 $profileParams[
"RESTRICTIONS_WEIGHT"] = array($restriction[
"PARAMS"][
"MIN_WEIGHT"], $restriction[
"PARAMS"][
"MAX_WEIGHT"]);
597 case '\Bitrix\Sale\Delivery\Restrictions\ByPrice':
598 $profileParams[
"RESTRICTIONS_SUM"] = array($restriction[
"PARAMS"][
"MIN_PRICE"], $restriction[
"PARAMS"][
"MAX_PRICE"]);
601 case '\Bitrix\Sale\Delivery\Restrictions\ByDimensions':
602 $profileParams[
"RESTRICTIONS_DIMENSIONS"] = array(
603 $restriction[
"PARAMS"][
"LENGTH"],
604 $restriction[
"PARAMS"][
"WIDTH"],
605 $restriction[
"PARAMS"][
"HEIGHT"]
608 $profileParams[
"RESTRICTIONS_MAX_SIZE"] = $restriction[
"PARAMS"][
"MAX_DIMENSION"];
609 $profileParams[
"RESTRICTIONS_DIMENSIONS_SUM"] = $restriction[
"PARAMS"][
"MAX_DIMENSIONS_SUM"];
618 $service[
"PROFILES"][$profileId] = $profileParams;
622 unset($service[
"CODE"]);
626 $result = array_merge($handlers[$service[
"SID"]], $service);
641 if(!is_callable($this->handlerInitParams[
"DBGETSETTINGS"]))
644 return call_user_func($this->handlerInitParams[
"DBGETSETTINGS"], $settings);
647 public static function createConfig($initHandlerParams, $settings, $siteId =
false)
649 static $result = array();
650 $hitCacheId = md5(serialize($initHandlerParams)).
"_".md5(serialize($settings)).
"_".strval($siteId);
652 if(!isset($result[$hitCacheId]))
655 "CONFIG_GROUPS" => array(),
659 if (is_callable($initHandlerParams[
"GETCONFIG"]))
661 $conf = call_user_func($initHandlerParams[
"GETCONFIG"], $siteId);
663 if(isset($conf[
"CONFIG_GROUPS"]))
664 $config[
"CONFIG_GROUPS"] = $conf[
"CONFIG_GROUPS"];
666 if ($settings <>
'' && is_callable($initHandlerParams[
"DBGETSETTINGS"]))
668 $settings = unserialize($settings, [
'allowed_classes' =>
false]);
669 $arConfigValues = call_user_func($initHandlerParams[
"DBGETSETTINGS"], $settings);
673 $arConfigValues = array();
676 foreach ($conf[
"CONFIG"] as $key => $arConfig)
678 if (is_array($conf[
"CONFIG"][$key]))
680 $config[
"CONFIG"][$key] = $conf[
"CONFIG"][$key];
682 if(isset($arConfigValues[$key]))
683 $config[
"CONFIG"][$key][
"VALUE"] = $arConfigValues[$key];
684 elseif(isset($conf[
"CONFIG"][$key][
"DEFAULT"]))
685 $config[
"CONFIG"][$key][
"VALUE"] = $conf[
"CONFIG"][$key][
"DEFAULT"];
687 $config[
"CONFIG"][$key][
"VALUE"] =
"";
692 $result[$hitCacheId] = $config;
695 return $result[$hitCacheId];
702 if(isset($this->handlerInitParams[
"CALCULATOR"]) && is_callable($this->handlerInitParams[
"CALCULATOR"]))
703 $result = $this->handlerInitParams[
"CALCULATOR"];
712 if(isset($this->handlerInitParams[
"COMPABILITY"]) && is_callable($this->handlerInitParams[
"COMPABILITY"]))
713 $result = $this->handlerInitParams[
"COMPABILITY"];
723 static $result = array();
726 if(!empty($oldOrder[
"ITEMS"]) && is_array($oldOrder[
"ITEMS"]))
728 $maxDimensions = array();
730 foreach($oldOrder[
"ITEMS"] as $item)
732 if(is_string($item[
"DIMENSIONS"]))
733 $item[
"DIMENSIONS"] = unserialize($item[
"DIMENSIONS"], [
'allowed_classes' =>
false]);
735 if(!is_array($item[
"DIMENSIONS"]) || empty($item[
"DIMENSIONS"]))
738 $maxDimensions = \CSaleDeliveryHelper::getMaxDimensions(
740 $item[
"DIMENSIONS"][
"WIDTH"],
741 $item[
"DIMENSIONS"][
"HEIGHT"],
742 $item[
"DIMENSIONS"][
"LENGTH"]
748 if(!empty($maxDimensions))
749 $oldOrder[
"MAX_DIMENSIONS"] = $maxDimensions;
752 $hitCacheId =
$sid.
'_'.md5(serialize($oldOrder)).
'_'.md5(serialize($config[
"CONFIG"]));
754 if(!isset($result[$hitCacheId]))
756 $result[$hitCacheId] = call_user_func($compatibilityFunc, $oldOrder, $config[
"CONFIG"]);
759 return $result[$hitCacheId];
766 if($compatibilityFunc ===
false)
769 $res = $this->
getCompatibleProfiles($this->sid.
':'.$profileId, $compatibilityFunc, $config, $shipment);
770 return is_array($res) && in_array($profileId, $res);
791 public function calculateProfile($profileId, array $profileConfig, \
Bitrix\
Sale\
Shipment $shipment)
793 static $result = array();
795 $hitCacheId = $this->
id.
'_'.$profileId.
'_'.md5(serialize($profileConfig)).
'_'.md5(serialize($oldOrder));
797 if(isset($result[$hitCacheId]))
798 return clone $result[$hitCacheId];
805 $shipmentCollection = $shipment->getCollection();
807 $order = $shipmentCollection->getOrder();
808 $shipmentCurrency = $order->getCurrency();
810 if(!Loader::includeModule(
'currency'))
815 if ($calculator!==
false)
817 if ($res = call_user_func(
820 $profileConfig[
"CONFIG"],
827 if($res[
"RESULT"] ==
"OK" )
829 if(isset($res[
"TEXT"]))
830 $calcRes->setDescription($res[
"TEXT"]);
832 if(isset($res[
"VALUE"]))
833 $calcRes->setDeliveryPrice(floatval($res[
"VALUE"]));
835 if(isset($res[
"TRANSIT"]))
836 $calcRes->setPeriodDescription($res[
"TRANSIT"]);
838 if(isset($res[
"PERIOD_FROM"]))
839 $calcRes->setPeriodFrom($res[
"PERIOD_FROM"]);
841 if(isset($res[
"PERIOD_TO"]))
842 $calcRes->setPeriodTo($res[
"PERIOD_TO"]);
844 if(isset($res[
"PERIOD_TYPE"]))
845 $calcRes->setPeriodType($res[
"PERIOD_TYPE"]);
849 if(isset($res[
"TEXT"]) && $res[
"TEXT"] <>
'')
853 'DELIVERY_CALCULATION'
860 'DELIVERY_CALCULATION'
865 elseif (is_numeric($res))
867 $calcRes->setDeliveryPrice(floatval($res));
872 if ($ex = $APPLICATION->getException())
874 $calcRes->addError(
new EntityError(
876 'DELIVERY_CALCULATION'
881 $calcRes->setDeliveryPrice(0);
885 if ($calcRes->isSuccess() && $this->currency != $shipmentCurrency)
887 $calcRes->setDeliveryPrice(
888 \CCurrencyRates::convertCurrency(
889 $calcRes->getPrice(),
896 $price = $calcRes->getPrice();
898 $calcRes->setDeliveryPrice(
902 $result[$hitCacheId] = $calcRes;
903 return clone $result[$hitCacheId];
909 '\Bitrix\Sale\Delivery\Services\AutomaticProfile'
915 return $this->config;
920 if($this->config[
"MAIN"][
"MARGIN_TYPE"] ==
"%")
922 $marginPrice = $price * floatval($this->config[
"MAIN"][
"MARGIN_VALUE"]) / 100;
926 $marginPrice = floatval($this->config[
"MAIN"][
"MARGIN_VALUE"]);
928 if($marginPrice && $shipmentCurrency !=
'' && $this->currency != $shipmentCurrency)
930 if(Loader::includeModule(
'currency'))
932 $marginPrice = \CCurrencyRates::convertCurrency(
946 if(empty($this->handlerInitParams[
"PROFILES"]) || !is_array($this->handlerInitParams[
"PROFILES"]))
951 foreach($this->handlerInitParams[
"PROFILES"] as $profId => $params)
953 if(empty($params[
"TITLE"]))
957 "CODE" => $this->handlerInitParams[
"SID"].
":".$profId,
958 "PARENT_ID" => $this->
id,
959 "NAME" => $params[
"TITLE"],
960 "ACTIVE" => $this->active ?
"Y" :
"N",
961 "SORT" => $this->sort,
962 "DESCRIPTION" => isset($params[
"DESCRIPTION"]) ? $params[
"DESCRIPTION"] :
"",
963 "CLASS_NAME" =>
'\Bitrix\Sale\Delivery\Services\AutomaticProfile',
964 "CURRENCY" => $this->currency,
968 "PROFILE_ID" => $profId,
979 public static function onAfterAdd($serviceId, array $fields = array())
984 $fields[
"ID"] = $serviceId;
985 $srv =
new self($fields);
986 $profiles = $srv->getProfilesDefaultParams($fields);
988 if(!is_array($profiles))
993 foreach($profiles as $profile)
995 $res = Manager::add($profile);
996 $result = $result && $res->isSuccess();
1004 static $result =
null;
1006 if($result ===
null)
1010 foreach($this->handlerInitParams[
"PROFILES"] as $profId => $params)
1011 if(!empty($params[
"TITLE"]))
1012 $result[$profId] = $params[
"TITLE"];
1027 if(isset($this->handlerInitParams[
"GET_ADMIN_MESSAGE"]) && is_callable($this->handlerInitParams[
"GET_ADMIN_MESSAGE"]))
1028 $result = call_user_func($this->handlerInitParams[
"GET_ADMIN_MESSAGE"]);
1037 if(isset($this->handlerInitParams[
"EXEC_ADMIN_ACTION"]) && is_callable($this->handlerInitParams[
"EXEC_ADMIN_ACTION"]))
1038 $result = call_user_func($this->handlerInitParams[
"EXEC_ADMIN_ACTION"]);
1047 if(isset($this->handlerInitParams[
"GET_ADD_INFO_SHIPMENT_EDIT"]) && is_callable($this->handlerInitParams[
"GET_ADD_INFO_SHIPMENT_EDIT"]))
1049 $result = call_user_func(
1050 $this->handlerInitParams[
"GET_ADD_INFO_SHIPMENT_EDIT"],
1054 if(!is_array($result))
1055 throw new SystemException(
'GET_ADD_INFO_SHIPMENT_EDIT return value must be array!');
1065 if(isset($this->handlerInitParams[
"PROCESS_ADD_INFO_SHIPMENT_EDIT"]) && is_callable($this->handlerInitParams[
"PROCESS_ADD_INFO_SHIPMENT_EDIT"]))
1067 $result = call_user_func(
1068 $this->handlerInitParams[
"PROCESS_ADD_INFO_SHIPMENT_EDIT"],
1073 if($result && get_class($result) !=
'Bitrix\Sale\Shipment')
1074 throw new SystemException(
'PROCESS_ADD_INFO_SHIPMENT_EDIT return value myst be of type "Bitrix\Sale\Result" !');
1084 if(isset($this->handlerInitParams[
"GET_ADD_INFO_SHIPMENT_VIEW"]) && is_callable($this->handlerInitParams[
"GET_ADD_INFO_SHIPMENT_VIEW"]))
1086 $result = call_user_func(
1087 $this->handlerInitParams[
"GET_ADD_INFO_SHIPMENT_VIEW"],
1091 if(!is_array($result))
1092 throw new SystemException(
'GET_ADD_INFO_SHIPMENT_VIEW return value must be array!');
1108 if (isset($handler[
"IS_HANDLER_COMPATIBLE"])
1109 && is_callable($handler[
"IS_HANDLER_COMPATIBLE"]))
1111 $result = call_user_func($handler[
"IS_HANDLER_COMPATIBLE"]);
static loadMessages($file)
static getMessage($code, $replace=null, $language=null)
static getDefaultSiteId()
isProfileCompatible($profileId, $config, Shipment $shipment)
static convertNewSettingsToOld(array $newSettings=array())
static convertOldConfigToNew($oldConfig)
static convertNewOrderToOld(\Bitrix\Sale\Shipment $shipment)
static getHandlerInitParams($sid)
static createConfig($initHandlerParams, $settings, $siteId=false)
static getRegisteredHandlers($indexBy="")
static convertOldConfigParamToNew(array $oldParam)
static getClassDescription()
__construct(array $initParams)
static getCompatibleProfiles($sid, $compatibilityFunc, array $config, Shipment $shipment)
static getChildrenClassNames()
prepareFieldsForSaving(array $fields)
getOldDbSettings($settings)
getProfilesDefaultParams(array $fields=array())
getMarginPrice($price, $shipmentCurrency='')
static onAfterAdd($serviceId, array $fields=array())
getAdditionalInfoShipmentEdit(Shipment $shipment)
processAdditionalInfoShipmentEdit(Shipment $shipment, array $requestData)
static isAutomaticHandlerCompatible($handler)
static convertNewServiceToOld($service, $sid=false)
getAdditionalInfoShipmentView(Shipment $shipment)
static getByParentId($parentId)