Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
order.php
1<?php
3
8
9Loc::loadMessages(__FILE__);
10
11class Order extends Base
12{
13 static public function statusNotify(Event $event)
14 {
16 $order = $event->getParameters()['ENTITY'];
17
18 if(static::isSync($order) == true)
19 {
20 if($order->isNew() == false)
21 {
22 $idOld = $order->getFields()->getOriginalValues()['STATUS_ID'] ?? '';
23 $nameOld = OrderStatus::getAllStatusesNames()[$idOld] ?? $idOld;
24 $id = $order->getField('STATUS_ID');
25 $name = OrderStatus::getAllStatusesNames()[$id] ?? $id;
26
27 $settings = [
28 'ENTITY_TYPE_ID' => Integration\CRM\EntityType::ORDER,
29 'FIELD_NAME' => 'STATUS_ID',
30 'CURRENT_VALUE' => $name,
31 'PREVIOUS_VALUE' => $nameOld
32 ];
33
34 static::onReceive($order->getId(), $settings);
35 }
36 }
37 }
38 static public function canceledNotify(Event $event)
39 {
41 $order = $event->getParameters()['ENTITY'];
42
43 if(static::isSync($order) == true)
44 {
45 if($order->isCanceled())
46 {
47 $settings = [
48 'ENTITY_TYPE_ID' => Integration\CRM\EntityType::ORDER,
49 'FIELD_NAME' => 'CANCELED',
50 'CURRENT_VALUE' => 'Y',
51 'LEGEND' => Loc::getMessage('SALE_INTEGRATION_B24_TIMELINE_ORDER_NUMBER').$order->getId(),
52 ];
53
54 static::onReceive($order->getId(), $settings);
55 }
56 }
57 }
58}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
static getAllStatusesNames($lang=null)