Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
triggerorderpaid.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_paid_name');
21 }
22
23 public function getCode()
24 {
25 return "order_paid";
26 }
27
28 public function getEventModuleId()
29 {
30 return 'sale';
31 }
32
33 public function getEventType()
34 {
35 return "OnSalePayOrder";
36 }
37
38 public function filter()
39 {
40 $eventData = $this->getParam('EVENT');
41
42 if($eventData[1] != 'Y')
43 return false;
44 else
45 return $this->filterConnectorData();
46 }
47
48 public function getConnector()
49 {
50 $connector = new \Bitrix\Sale\Sender\ConnectorOrder;
51 $connector->setModuleId('sale');
52
53 return $connector;
54 }
55
58 {
59 $eventData = $this->getParam('EVENT');
60 return array('ID' => $eventData[0], 'LID' => $this->getSiteId());
61 }
62
64 public function getMailEventToPrevent()
65 {
66 $eventData = $this->getParam('EVENT');
67 return array(
68 'EVENT_NAME' => 'SALE_ORDER_PAID',
69 'FILTER' => array('ORDER_ID' => $eventData[0])
70 );
71 }
72
77 public function getPersonalizeFields()
78 {
79 $eventData = $this->getParam('EVENT');
80 $result = ['ORDER_ID' => $eventData[0]];
81 if ((int)$eventData[0] <= 0)
82 return $result;
83
84 $registry = Sale\Registry::getInstance(Sale\Registry::REGISTRY_TYPE_ORDER);
86 $orderClass = $registry->getOrderClassName();
87
88 $order = $orderClass::load($eventData[0]);
89 if ($order)
90 {
91 $result = [
92 'ORDER_ID' => $order->getField('ACCOUNT_NUMBER'),
93 'ORDER_REAL_ID' => $order->getId()
94 ];
95 }
96 return $result;
97 }
98
102 public static function getPersonalizeList()
103 {
104 return array(
105 array(
106 'CODE' => 'ORDER_ID',
107 'NAME' => Loc::getMessage('sender_trigger_order_paid_pers_order_id_name'),
108 'DESC' => Loc::getMessage('sender_trigger_order_paid_pers_order_id_desc')
109 )
110 );
111 }
112
113}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29