1
0
Fork 0
mirror of synced 2025-04-04 14:23:33 +03:00
Измненено получение трек номера
This commit is contained in:
Ivan Chaplygin 2023-10-25 14:49:44 +03:00
parent 492c20a1c4
commit cd6e8bf844

View file

@ -1180,15 +1180,6 @@ class RetailCrmHistory
if ($orderCrm) {
self::deliveryUpdate($newOrder, $optionsDelivTypes, $orderCrm['order']);
}
if (isset($order['delivery']['service']['trackNumber'])
&& RetailcrmConfigProvider::getTrackNumberStatus() === 'Y'
) {
$newOrder->setField(
'TRACKING_NUMBER',
$order['delivery']['service']['trackNumber']
);
}
}
if ($itemUpdate === true && $newOrder->getField('CANCELED') !== 'Y') {
@ -1731,28 +1722,32 @@ class RetailCrmHistory
$shipmentColl = $bitrixOrder->getShipmentCollection();
if ($delivery) {
$baseFields = [
'BASE_PRICE_DELIVERY' => $crmOrder['delivery']['cost'],
'PRICE_DELIVERY' => $crmOrder['delivery']['cost'],
'CURRENCY' => $bitrixOrder->getCurrency(),
'DELIVERY_NAME' => $delivery->getName(),
'CUSTOM_PRICE_DELIVERY' => 'Y',
];
if (isset($crmOrder['delivery']['data']['trackNumber'])
&& RetailcrmConfigProvider::getTrackNumberStatus() === 'Y'
) {
$baseFields['TRACKING_NUMBER'] = $crmOrder['delivery']['data']['trackNumber'];
}
//В коллекции всегда есть одна скрытая системная доставка, к которой относятся нераспределенные товары
//Поэтому, если есть только системная доставка, то нужно создать новую
if (!$update || $shipmentColl->count() === 1) {
$shipment = $shipmentColl->createItem($delivery);
$shipment->setFields([
'BASE_PRICE_DELIVERY' => $crmOrder['delivery']['cost'],
'PRICE_DELIVERY' => $crmOrder['delivery']['cost'],
'CURRENCY' => $bitrixOrder->getCurrency(),
'DELIVERY_NAME' => $delivery->getName(),
'CUSTOM_PRICE_DELIVERY' => 'Y'
]);
$shipment->setFields($baseFields);
} else {
$baseFields['DELIVERY_ID'] = $deliveryId;
foreach ($shipmentColl as $shipment) {
if (!$shipment->isSystem()) {
$shipment->setFields([
'BASE_PRICE_DELIVERY' => $crmOrder['delivery']['cost'],
'PRICE_DELIVERY' => $crmOrder['delivery']['cost'],
'CURRENCY' => $bitrixOrder->getCurrency(),
'DELIVERY_ID' => $deliveryId,
'DELIVERY_NAME' => $delivery->getName(),
'CUSTOM_PRICE_DELIVERY' => 'Y'
]);
$shipment->setFields($baseFields);
}
}
}