Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
ordermarker.php
1<?php
2
4
12
13Loc::loadMessages(__FILE__);
14
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,
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 {
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 ';
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}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
static getList(array $parameters=array())
static getViewForEntity($orderId, $entityId)
static getShipmentBlockHtml($orderId, $id, $text, $entityId, $type=null, $forEntity=false)
static getViewList($orderId, $entityId=null)