Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
triggerorderstatuschange.php
1
<?
2
3
namespace
Bitrix\Sale\Sender
;
4
5
use
Bitrix\Main\Localization\Loc
;
6
use
Bitrix\Main\Loader
;
7
8
if
(!Loader::includeModule(
'sender'
))
9
{
10
return
;
11
}
12
13
Loc::loadMessages
(__FILE__);
14
15
class
TriggerOrderStatusChange
extends
\Bitrix\Sender\TriggerConnector
16
{
17
public
function
getName
()
18
{
19
return
Loc::getMessage
(
'sender_trigger_order_status_change_name'
);
20
}
21
22
public
function
getCode
()
23
{
24
return
"order_status_change"
;
25
}
26
27
public
function
getEventModuleId
()
28
{
29
return
'sale'
;
30
}
31
32
public
function
getEventType
()
33
{
34
return
"OnSaleStatusOrderChange"
;
35
}
36
38
public
static
function
canBeTarget
()
39
{
40
return
true
;
41
}
42
43
public
function
filter
()
44
{
45
$eventData = $this->getParam(
'EVENT'
);
46
$statusId = $this->
getFieldValue
(
'STATUS_ID'
,
null
);
47
48
if
(!($eventData[
'ENTITY'
] instanceof \
Bitrix
\
Sale
\
Order
))
49
{
50
return
false
;
51
}
52
53
if
($statusId != $eventData[
'ENTITY'
]->getField(
'STATUS_ID'
))
54
{
55
return
false
;
56
}
57
58
return
$this->
filterConnectorData
();
59
}
60
61
public
function
getConnector
()
62
{
63
$connector
= new \Bitrix\Sale\Sender\ConnectorOrder;
64
$connector
->setModuleId(
'sale'
);
65
66
return
$connector
;
67
}
68
70
public
function
getProxyFieldsFromEventToConnector
()
71
{
72
$eventData = $this->getParam(
'EVENT'
);
73
return
array(
'ID'
=> $eventData[
'ENTITY'
]->
getId
(),
'LID'
=> $this->getSiteId());
74
}
75
76
80
public
function
getPersonalizeFields
()
81
{
82
$result = array(
83
'ORDER_ID'
=>
''
84
);
85
86
$eventData = $this->getParam(
'EVENT'
);
87
if
($eventData[
'ENTITY'
] instanceof \
Bitrix
\
Sale
\
Order
)
88
{
89
$result[
'ORDER_ID'
] = $eventData[
'ENTITY'
]->getField(
'ACCOUNT_NUMBER'
);
90
$result[
'ORDER_REAL_ID'
] = $eventData[
'ENTITY'
]->getId();
91
}
92
93
return
$result;
94
}
95
99
public
static
function
getPersonalizeList
()
100
{
101
return
array(
102
array(
103
'CODE'
=>
'ORDER_ID'
,
104
'NAME'
=>
Loc::getMessage
(
'sender_trigger_order_status_change_name_order_id_name'
),
105
'DESC'
=>
Loc::getMessage
(
'sender_trigger_order_status_change_name_order_id_desc'
)
106
),
107
);
108
}
109
110
public
function
getForm
()
111
{
112
$statusInput =
''
;
113
$statusDb = \Bitrix\Sale\Internals\StatusLangTable::getList(array(
114
'select'
=> array(
'STATUS_ID'
,
'NAME'
),
115
'filter'
=> array(
'=LID'
=> LANGUAGE_ID,
'=STATUS_ID'
=> \
Bitrix
\
Sale
\
OrderStatus::getAllStatuses
()),
116
'order'
=> array(
'STATUS.SORT'
)
117
));
118
while
($status = $statusDb->fetch())
119
{
120
$selected = $status[
'STATUS_ID'
] == $this->
getFieldValue
(
'STATUS_ID'
) ?
' selected'
:
''
;
121
$statusInput .=
'<option value="'
. $status[
'STATUS_ID'
] .
'"'
. $selected .
'>'
122
. htmlspecialcharsbx($status[
'NAME'
])
123
.
'</option>'
;
124
}
125
$statusInput =
'<select name="'
. $this->
getFieldName
(
'STATUS_ID'
) .
'">'
. $statusInput .
'</select>'
;
126
127
return
'
128
<table>
129
<tr>
130
<td>'
.Loc::getMessage(
'sender_trigger_order_status_change_field'
).
': </td>
131
<td>'
.$statusInput.
'</td>
132
</tr>
133
</table>
134
'
;
135
}
136
}
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Sale\Helpers\Order
Definition
order.php:10
Bitrix\Sale\Sender\TriggerOrderStatusChange
Definition
triggerorderstatuschange.php:16
Bitrix\Sale\Sender\TriggerOrderStatusChange\getEventModuleId
getEventModuleId()
Definition
triggerorderstatuschange.php:27
Bitrix\Sale\Sender\TriggerOrderStatusChange\getName
getName()
Definition
triggerorderstatuschange.php:17
Bitrix\Sale\Sender\TriggerOrderStatusChange\getPersonalizeFields
getPersonalizeFields()
Definition
triggerorderstatuschange.php:80
Bitrix\Sale\Sender\TriggerOrderStatusChange\getForm
getForm()
Definition
triggerorderstatuschange.php:110
Bitrix\Sale\Sender\TriggerOrderStatusChange\getEventType
getEventType()
Definition
triggerorderstatuschange.php:32
Bitrix\Sale\Sender\TriggerOrderStatusChange\filter
filter()
Definition
triggerorderstatuschange.php:43
Bitrix\Sale\Sender\TriggerOrderStatusChange\getConnector
getConnector()
Definition
triggerorderstatuschange.php:61
Bitrix\Sale\Sender\TriggerOrderStatusChange\getProxyFieldsFromEventToConnector
getProxyFieldsFromEventToConnector()
Definition
triggerorderstatuschange.php:70
Bitrix\Sale\Sender\TriggerOrderStatusChange\getCode
getCode()
Definition
triggerorderstatuschange.php:22
Bitrix\Sale\Sender\TriggerOrderStatusChange\getPersonalizeList
static getPersonalizeList()
Definition
triggerorderstatuschange.php:99
Bitrix\Sale\Sender\TriggerOrderStatusChange\canBeTarget
static canBeTarget()
Definition
triggerorderstatuschange.php:38
Bitrix\Sale\StatusBase\getAllStatuses
static getAllStatuses()
Definition
statusbase.php:255
Bitrix\Sender\Connector\Base\getId
getId()
Definition
base.php:206
Bitrix\Sender\Connector\Base\getFieldName
getFieldName($name)
Definition
base.php:164
Bitrix\Sender\Connector\Base\getFieldValue
getFieldValue($name, $defaultValue=null)
Definition
base.php:195
Bitrix\Sender\Trigger\TriggerConnector
Definition
triggerconnector.php:13
Bitrix\Sender\Trigger\TriggerConnector\$connector
$connector
Definition
triggerconnector.php:15
Bitrix\Sender\Trigger\TriggerConnector\filterConnectorData
filterConnectorData()
Definition
triggerconnector.php:43
Bitrix\Sale\Sender
Definition
connectororder.php:3
Bitrix
Sale
modules
sale
lib
sender
triggerorderstatuschange.php
Создано системой
1.10.0