1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
shipment.php
См. документацию.
1<?php
2
3
4namespace Bitrix\Sale\Exchange\Integration\Timeline;
5
6
7use Bitrix\Main\Event;
8use Bitrix\Main\Localization\Loc;
9use Bitrix\Sale\DeliveryStatus;
10use Bitrix\Sale\Exchange\Integration;
11use Bitrix\Sale\ShipmentCollection;
12
13Loc::loadMessages(__FILE__);
14
15class Shipment extends Base
16{
17 static public function statusNotify(Event $event)
18 {
20 $shipment = $event->getParameters()['ENTITY'];
21
23 $collection = $shipment->getCollection();
24 $order = $collection->getOrder();
25
26 if(static::isSync($order) == true)
27 {
28 $idOld = $shipment->getFields()->getOriginalValues()['STATUS_ID'] ?? '';
29 $nameOld = DeliveryStatus::getAllStatusesNames()[$idOld] ?? $idOld;
30 $id = $shipment->getField('STATUS_ID');
32
33 $settings = [
35 'FIELD_NAME' => 'STATUS_ID',
36 'CURRENT_VALUE' => $name,
37 'PREVIOUS_VALUE' => $nameOld,
38 'LEGEND' => Loc::getMessage('SALE_INTEGRATION_B24_TIMELINE_SHIPMENT_NUMBER').$shipment->getId().'. '.$shipment->getDeliveryName(),
39 ];
40
41 static::onReceive($order->getId(), $settings);
42 }
43 }
44 static public function allowDeliveryNotify(Event $event)
45 {
47 $shipment = $event->getParameters()['ENTITY'];
48
49 if($shipment->isAllowDelivery())
50 {
52 $collection = $shipment->getCollection();
53 $order = $collection->getOrder();
54
55 if(static::isSync($order) == true)
56 {
57 $settings = [
59 'FIELD_NAME' => 'ALLOW_DELIVERY',
60 'CURRENT_VALUE' => 'Y',
61 'LEGEND' => Loc::getMessage('SALE_INTEGRATION_B24_TIMELINE_SHIPMENT_NUMBER').$shipment->getId().'. '.$shipment->getDeliveryName(),
62 ];
63
64 static::onReceive($order->getId(), $settings);
65 }
66 }
67 }
68 static public function deductedNotify(Event $event)
69 {
71 $shipment = $event->getParameters()['ENTITY'];
72
73 if($shipment->isShipped())
74 {
76 $collection = $shipment->getCollection();
77 $order = $collection->getOrder();
78
79 if(static::
80 isSync($order) == true)
81 {
82 $settings = [
84 'FIELD_NAME' => 'DEDUCTED',
85 'CURRENT_VALUE' => 'Y',
86 'LEGEND' => Loc::getMessage('SALE_INTEGRATION_B24_TIMELINE_SHIPMENT_NUMBER').$shipment->getId().'. '.$shipment->getDeliveryName(),
87 ];
88
89 static::onReceive($order->getId(), $settings);
90 }
91 }
92 }
93}
Определения event.php:5
static getAllStatusesNames($lang=null)
Определения statusbase.php:285
$name
Определения menu_edit.php:35
$order
Определения payment.php:8
$settings
Определения product_settings.php:43
$event
Определения prolog_after.php:141