1
0
mirror of synced 2024-11-25 14:56:09 +03:00

Fixed bug with incorrect value of delivery service received by order history

This commit is contained in:
Konstantin 2019-04-18 09:43:44 +03:00
parent dbccb53eb4
commit e28ce27b89

View File

@ -994,10 +994,15 @@ class RetailCrmHistory
if (isset($orderCrm['delivery']['service']['code'])) { if (isset($orderCrm['delivery']['service']['code'])) {
$deliveryCode = \Bitrix\Sale\Delivery\Services\Manager::getCodeById($deliveryId); $deliveryCode = \Bitrix\Sale\Delivery\Services\Manager::getCodeById($deliveryId);
$serviceCode = $orderCrm['delivery']['service']['code'];
$services = \Bitrix\Sale\Delivery\Services\Manager::getService($deliveryId)->getProfilesList();
if (!array_key_exists($serviceCode, $services)) {
$serviceCode = strtoupper($serviceCode);
$serviceCode = str_replace(array('-'), "_", $serviceCode);
}
if ($deliveryCode) { if ($deliveryCode) {
try { try {
$deliveryService = \Bitrix\Sale\Delivery\Services\Manager::getObjectByCode($deliveryCode . ':' . $orderCrm['delivery']['service']['code']); $deliveryService = \Bitrix\Sale\Delivery\Services\Manager::getObjectByCode($deliveryCode . ':' . $serviceCode);
} catch (Bitrix\Main\SystemException $systemException) { } catch (Bitrix\Main\SystemException $systemException) {
RCrmActions::eventLog('RetailCrmHistory::deliveryEdit', '\Bitrix\Sale\Delivery\Services\Manager::getObjectByCode', $systemException->getMessage()); RCrmActions::eventLog('RetailCrmHistory::deliveryEdit', '\Bitrix\Sale\Delivery\Services\Manager::getObjectByCode', $systemException->getMessage());
} }