Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
ordermarker.php
1
<?php
2
3
namespace
Bitrix\Sale\Helpers\Admin\Blocks
;
4
5
use
Bitrix\Main\Event
;
6
use
Bitrix\Sale\EntityMarker
;
7
use
Bitrix\Sale\Order
;
8
use
Bitrix\Main\EventResult
;
9
use
Bitrix\Main\Localization\Loc
;
10
use
Bitrix\Main\ArgumentNullException
;
11
use
Bitrix\Sale\Helpers\Admin\OrderEdit
;
12
13
Loc::loadMessages
(__FILE__);
14
15
class
OrderMarker
16
{
17
23
public
static
function
getView
($orderId)
24
{
25
return
static::getViewList($orderId);
26
}
27
34
public
static
function
getViewForEntity
($orderId, $entityId)
35
{
36
return
static::getViewList($orderId, $entityId);
37
}
38
45
protected
static
function
getViewList
($orderId, $entityId =
null
)
46
{
47
$markerListHtml =
''
;
48
49
$entityId = intval($entityId);
50
51
$filter = array(
52
'filter'
=> array(
53
'=ORDER_ID'
=> $orderId,
54
'!=SUCCESS'
=>
EntityMarker::ENTITY_SUCCESS_CODE_DONE
55
),
56
'select'
=> array(
'ID'
,
'ORDER_ID'
,
'MESSAGE'
,
'TYPE'
,
'ENTITY_ID'
,
'ENTITY_TYPE'
),
57
'order'
=> array(
'ID'
=>
'ASC'
)
58
);
59
60
if
(intval($entityId) > 0)
61
{
62
$filter[
'filter'
][
'=ENTITY_ID'
] = intval($entityId);
63
}
64
65
$res =
EntityMarker::getList
($filter);
66
while
($data = $res->fetch())
67
{
68
if
($data[
'ENTITY_TYPE'
] ==
EntityMarker::ENTITY_TYPE_SHIPMENT
)
69
{
70
$markerListHtml .= static::getShipmentBlockHtml($data[
'ORDER_ID'
], $data[
'ID'
], $data[
'MESSAGE'
], $data[
'ENTITY_ID'
], $data[
'TYPE'
], (intval($entityId) > 0));
71
}
72
elseif ($data[
'ENTITY_TYPE'
] ==
EntityMarker::ENTITY_TYPE_PAYMENT
)
73
{
74
$markerListHtml .= static::getPaymentBlockHtml($data[
'ORDER_ID'
], $data[
'ID'
], $data[
'MESSAGE'
], $data[
'ENTITY_ID'
], $data[
'TYPE'
], (intval($entityId) > 0));
75
}
76
else
77
{
78
$markerListHtml .= static::getOrderBlockHtml($data[
'ORDER_ID'
], $data[
'ID'
], $data[
'MESSAGE'
], $data[
'TYPE'
]);
79
}
80
}
81
82
return
$markerListHtml;
83
}
84
95
protected
static
function
getShipmentBlockHtml
($orderId, $id, $text, $entityId, $type =
null
, $forEntity =
false
)
96
{
97
if
(strval($text) ===
''
)
98
{
99
$result =
""
;
100
}
101
else
102
{
103
if
($type ===
null
|| $type !=
EntityMarker::ENTITY_MARKED_TYPE_AUTO
)
104
{
105
$type =
EntityMarker::ENTITY_MARKED_TYPE_MANUAL
;
106
}
107
108
$result =
'
109
<div class="adm-bus-orderproblem" id="sale-adm-shipment-problem-block-'
.$id.
'">
110
<div class="adm-bus-orderproblem-container">
111
<table>
112
<tr>
113
<td class="adm-bus-orderproblem-title">'
.
Loc::getMessage
(
"SALE_ORDER_MARKER_BLOCK_SHIPMENT_PROBLEM"
, array(
114
'#ENTITY_ID#'
=> $entityId
115
)).
':</td>
116
<td class="adm-bus-orderproblem-text">'
.$text.
'<br/>
117
<div class="adm-bus-orderproblem-separator"></div>
118
'
;
119
if
($type ==
EntityMarker::ENTITY_MARKED_TYPE_AUTO
)
120
{
121
$result .=
'<br/><div><span class="adm-btn adm-btn-green" onclick="BX.Sale.Admin.OrderEditPage.onMarkerFixErrorClick(\''
. $id.
'\'
, \
''
.$orderId.
'\'
, \
'sale-adm-shipment-problem-block-'
.$id.
'\'
, \
''
.$entityId.
'\'
,
'.($forEntity ? '
true
' : '
false
').'
);
">'.Loc::getMessage("
SALE_ORDER_MARKER_FIX
").'</span></div>';
122
}
123
124
$result .= '</td>
125
</tr>
126
</table>';
127
128
129
$result .= '
130
<span class="
adm-bus-orderproblem-close
" title="
'.Loc::getMessage("SALE_ORDER_MARKER_CLOSE").'
" onclick="
BX
.Sale.Admin.OrderEditPage.onMarkerCloseClick(\
''
. $id.
'\'
, \
''
.$orderId.
'\'
, \
'sale-adm-shipment-problem-block-'
.$id.
'\'
, \
''
.$entityId.
'\'
,
'.($forEntity ? '
true
' : '
false
').'
);
"></span>
131
</div>
132
</div>';
133
}
134
135
return $result;
136
}
147
protected static function getPaymentBlockHtml($orderId, $id, $text, $entityId, $type = null, $forEntity = false)
148
{
149
if(strval($text) === '')
150
{
151
$result = "
";
152
}
153
else
154
{
155
156
if ($type === null || $type != EntityMarker::ENTITY_MARKED_TYPE_AUTO)
157
{
158
$type = EntityMarker::ENTITY_MARKED_TYPE_MANUAL;
159
}
160
161
$result = '
162
<div class="
adm-bus-orderproblem
" id="
sale-adm-payment-problem-block-
'.$id.'
">
163
<div class="
adm-bus-orderproblem-container
">
164
<table>
165
<tr>
166
<td class="
adm-bus-orderproblem-title
">'.Loc::getMessage("
SALE_ORDER_MARKER_BLOCK_PAYMENT_PROBLEM
", array(
167
'#ENTITY_ID#' => $entityId
168
)).':</td>
169
<td class="
adm-bus-orderproblem-text
">'.$text. '<br/>
170
<div class="
adm-bus-orderproblem-separator
"></div>
171
';
172
$result .= '</td>
173
</tr>
174
</table>';
175
176
if ($type == EntityMarker::ENTITY_MARKED_TYPE_AUTO)
177
{
178
$result .= '<br/><div><span class="
adm-btn adm-btn-green
" onclick="
BX
.Sale.Admin.OrderEditPage.onMarkerFixErrorClick(\
''
. $id.
'\'
, \
''
.$orderId.
'\'
, \
'sale-adm-payment-problem-block-'
.$id.
'\'
, \
''
.$entityId.
'\'
,
'.($forEntity ? '
true
' : '
false
').'
);
">'.Loc::getMessage("
SALE_ORDER_MARKER_FIX
").'</span></div>';
179
}
180
181
$result .= '
182
<span class="
adm-bus-orderproblem-close
" title="
'.Loc::getMessage("SALE_ORDER_MARKER_CLOSE").'
" onclick="
BX
.Sale.Admin.OrderEditPage.onMarkerCloseClick(\
''
. $id.
'\'
, \
''
.$orderId.
'\'
, \
'sale-adm-payment-problem-block-'
.$id.
'\'
, \
''
.$entityId.
'\'
,
'.($forEntity ? '
true
' : '
false
').'
);
"></span>
183
</div>
184
</div>';
185
}
186
187
return $result;
188
}
189
198
protected static function getOrderBlockHtml($orderId, $id, $text, $type = null)
199
{
200
if(strval($text) === '')
201
{
202
$result = "
";
203
}
204
else
205
{
206
if ($type === null || $type != EntityMarker::ENTITY_MARKED_TYPE_AUTO)
207
{
208
$type = EntityMarker::ENTITY_MARKED_TYPE_MANUAL;
209
}
210
211
$result = '
212
<div class="
adm-bus-orderproblem
" id="
sale-adm-order-problem-block-
'.$id.'
">
213
<div class="
adm-bus-orderproblem-container
">
214
<table>
215
<tr>
216
<td class="
adm-bus-orderproblem-title
">'.Loc::getMessage("
SALE_ORDER_MARKER_BLOCK_ORDER_PROBLEM
").':</td>
217
<td class="
adm-bus-orderproblem-text
">'.$text. '<br/>
218
<div class="
adm-bus-orderproblem-separator
"></div>
219
';
220
if ($type == EntityMarker::ENTITY_MARKED_TYPE_AUTO)
221
{
222
$result .= '<br/><div><span class="
adm-btn adm-btn-green
" onclick="
BX
.Sale.Admin.OrderEditPage.onMarkerFixErrorClick(\
''
. $id.
'\'
, \
''
.$orderId.
'\'
, \
'sale-adm-order-problem-block-'
.$id.
'\'
);
">'.Loc::getMessage("
SALE_ORDER_MARKER_FIX
").'</span></div>';
223
}
224
$result .= '</td>
225
</tr>
226
</table>';
227
228
229
$result .= '
230
<span class="
adm-bus-orderproblem-close
" title="
'.Loc::getMessage("SALE_ORDER_MARKER_CLOSE").'
" onclick="
BX
.Sale.Admin.OrderEditPage.onMarkerCloseClick(\
''
. $id.
'\'
, \
''
.$orderId.
'\'
, \
'sale-adm-order-problem-block-'
.$id.
'\'
);
"></span>
231
</div>
232
</div>';
233
}
234
235
return $result;
236
}
237
}
Bitrix\Main\ArgumentNullException
Definition
exception.php:54
Bitrix\Main\Event
Definition
event.php:5
Bitrix\Main\EventResult
Definition
eventresult.php:5
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\EntityMarker
Definition
entitymarker.php:14
Bitrix\Sale\EntityMarker\ENTITY_SUCCESS_CODE_DONE
const ENTITY_SUCCESS_CODE_DONE
Definition
entitymarker.php:25
Bitrix\Sale\EntityMarker\ENTITY_MARKED_TYPE_MANUAL
const ENTITY_MARKED_TYPE_MANUAL
Definition
entitymarker.php:16
Bitrix\Sale\EntityMarker\getList
static getList(array $parameters=array())
Definition
entitymarker.php:905
Bitrix\Sale\EntityMarker\ENTITY_TYPE_SHIPMENT
const ENTITY_TYPE_SHIPMENT
Definition
entitymarker.php:20
Bitrix\Sale\EntityMarker\ENTITY_TYPE_PAYMENT
const ENTITY_TYPE_PAYMENT
Definition
entitymarker.php:21
Bitrix\Sale\EntityMarker\ENTITY_MARKED_TYPE_AUTO
const ENTITY_MARKED_TYPE_AUTO
Definition
entitymarker.php:15
Bitrix\Sale\Helpers\Admin\Blocks\OrderMarker
Definition
ordermarker.php:16
Bitrix\Sale\Helpers\Admin\Blocks\OrderMarker\getViewForEntity
static getViewForEntity($orderId, $entityId)
Definition
ordermarker.php:34
Bitrix\Sale\Helpers\Admin\Blocks\OrderMarker\getShipmentBlockHtml
static getShipmentBlockHtml($orderId, $id, $text, $entityId, $type=null, $forEntity=false)
Definition
ordermarker.php:95
Bitrix\Sale\Helpers\Admin\Blocks\OrderMarker\getView
static getView($orderId)
Definition
ordermarker.php:23
Bitrix\Sale\Helpers\Admin\Blocks\OrderMarker\getViewList
static getViewList($orderId, $entityId=null)
Definition
ordermarker.php:45
Bitrix\Sale\Helpers\Admin\OrderEdit
Definition
orderedit.php:51
Bitrix\Sale\Helpers\Order
Definition
order.php:10
BX
Bitrix\Sale\Helpers\Admin\Blocks
modules
sale
lib
helpers
admin
blocks
ordermarker.php
Создано системой
1.10.0