Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
triggerordercancel.php
1<?
2
3namespace Bitrix\Sale\Sender;
4
8
9if (!Loader::includeModule('sender'))
10{
11 return;
12}
13
14Loc::loadMessages(__FILE__);
15
17{
18 public function getName()
19 {
20 return Loc::getMessage('sender_trigger_order_cancel_name');
21 }
22
23 public function getCode()
24 {
25 return "order_cancel";
26 }
27
28 public function getEventModuleId()
29 {
30 return 'sale';
31 }
32
33 public function getEventType()
34 {
35 return "OnSaleCancelOrder";
36 }
37
39 public static function canBeTarget()
40 {
41 return false;
42 }
43
44 public function filter()
45 {
46 $eventData = $this->getParam('EVENT');
47 if($eventData[1] != 'Y')
48 return false;
49 else
50 return $this->filterConnectorData();
51 }
52
53 public function getConnector()
54 {
55 $connector = new \Bitrix\Sale\Sender\ConnectorOrder;
56 $connector->setModuleId('sale');
57
58 return $connector;
59 }
60
63 {
64 $eventData = $this->getParam('EVENT');
65 return array('ID' => $eventData[0], 'LID' => $this->getSiteId());
66 }
67
69 public function getMailEventToPrevent()
70 {
71 $eventData = $this->getParam('EVENT');
72 return array(
73 'EVENT_NAME' => 'SALE_ORDER_CANCEL',
74 'FILTER' => array('ORDER_ID' => $eventData[0])
75 );
76 }
77
82 public function getPersonalizeFields()
83 {
84 $eventData = $this->getParam('EVENT');
85 $result = ['ORDER_ID' => $eventData[0]];
86 if ((int)$eventData[0] <= 0)
87 return $result;
88
89 $registry = Sale\Registry::getInstance(Sale\Registry::REGISTRY_TYPE_ORDER);
91 $orderClass = $registry->getOrderClassName();
92
93 $order = $orderClass::load($eventData[0]);
94 if ($order)
95 {
96 $result = [
97 'ORDER_ID' => $order->getField('ACCOUNT_NUMBER'),
98 'ORDER_REAL_ID' => $order->getId()
99 ];
100 }
101 return $result;
102 }
103
107 public static function getPersonalizeList()
108 {
109 return array(
110 array(
111 'CODE' => 'ORDER_ID',
112 'NAME' => Loc::getMessage('sender_trigger_order_cancel_pers_order_id_name'),
113 'DESC' => Loc::getMessage('sender_trigger_order_cancel_pers_order_id_desc')
114 ),
115 );
116 }
117}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29