1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
helper.php
См. документацию.
1<?
2namespace Bitrix\Sale\Delivery\Requests;
3
4use Bitrix\Sale\Delivery\Services;
5use Bitrix\Sale\Internals;
6use Bitrix\Sale\Repository\ShipmentRepository;
7use Bitrix\Sale\Shipment;
8use Bitrix\Sale;
9
10
16class Helper
17{
25 public static function getShipmentEditLink($shipmentId, $text = '', $orderId = 0, $languageId = LANGUAGE_ID)
26 {
27 if($text == '')
28 $text = strval($shipmentId);
29
30 if(intval($orderId) <= 0)
31 {
32 $res = Internals\ShipmentTable::getList(array(
33 'filter' => array(
34 '=ID' => $shipmentId
35 ),
36 'select' => array('ID', 'ORDER_ID')
37 ));
38
39 if($row = $res->fetch())
40 $orderId = $row['ORDER_ID'];
41 }
42
43 return '<a href="/bitrix/admin/sale_order_shipment_edit.php'.
44 '?order_id='.intval($orderId).
45 '&shipment_id='.intval($shipmentId).
46 '&lang='.htmlspecialcharsbx($languageId).
47 '">'.
49 '</a>';
50 }
51
58 public static function getDeliveryEditLink($deliveryId, $deliveryName = '', $languageId = LANGUAGE_ID)
59 {
60 if($deliveryName == '')
61 {
62 $delivery = Services\Manager::getObjectById($deliveryId);
63 $deliveryName = !!$delivery ? $delivery->getNameWithParent().' ['.intval($deliveryId).']' : intval($deliveryId);
64 }
65
66 return '<a href="/bitrix/admin/sale_delivery_service_edit.php'.
67 '?ID='.intval($deliveryId).
68 '&lang='.htmlspecialcharsbx($languageId).
69 '">'.
70 htmlspecialcharsbx($deliveryName).
71 '</a>';
72 }
73
80 public static function getRequestViewLink($requestId, $text = '', $languageId = LANGUAGE_ID)
81 {
82 if($text == '')
83 $text = strval($requestId);
84
85 return '<a href="/bitrix/admin/sale_delivery_request_view.php'.
86 '?ID='.intval($requestId).
87 '&lang='.htmlspecialcharsbx($languageId).
88 '">'.
90 '</a>';
91 }
92
99 public static function getShipmentsByIds(array $shipmentIds)
100 {
101 if(empty($shipmentIds))
102 return array();
103
106 $orderClass = $registry->getOrderClassName();
107
108 $result = array();
109
110 $res = Internals\ShipmentTable::getList(array(
111 'filter' => array(
112 '=ID' => $shipmentIds
113 ),
114 'select' => array('ID', 'ORDER_ID')
115 ));
116
117 while($shp = $res->fetch())
118 {
119 $order = $orderClass::load($shp['ORDER_ID']);
120
121 foreach($order->getShipmentCollection() as $shipment)
122 {
123 if($shp['ID'] != $shipment->getId())
124 continue;
125
126 if(!in_array($shp['ID'], $shipmentIds))
127 continue;
128
129 $result[$shp['ID']] = $shipment;
130 break;
131 }
132 }
133
134 return $result;
135 }
136
141 public static function getShipmentsByRequestId(int $requestId): ?array
142 {
143 $deliveryRequest = RequestTable::getByPrimary(
144 $requestId,
145 [
146 'select' => ['*', 'SHIPMENTS']
147 ]
148 )->fetchObject();
149
150 if (is_null($deliveryRequest))
151 {
152 return null;
153 }
154
155 $result = [];
156
157 foreach ($deliveryRequest->getShipments() as $requestShipment)
158 {
159 $shipment = ShipmentRepository::getInstance()->getById(
160 $requestShipment->getShipmentId()
161 );
162
163 $result[] = $shipment;
164 }
165
166 return $result;
167 }
168}
static getDeliveryEditLink($deliveryId, $deliveryName='', $languageId=LANGUAGE_ID)
Определения helper.php:58
static getShipmentsByRequestId(int $requestId)
Определения helper.php:141
static getShipmentEditLink($shipmentId, $text='', $orderId=0, $languageId=LANGUAGE_ID)
Определения helper.php:25
static getRequestViewLink($requestId, $text='', $languageId=LANGUAGE_ID)
Определения helper.php:80
static getObjectById($deliveryId)
Определения manager.php:438
static getInstance($type)
Определения registry.php:183
const REGISTRY_TYPE_ORDER
Определения registry.php:16
$orderId
Определения payment.php:5
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$result
Определения get_property_values.php:14
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
$order
Определения payment.php:8
$text
Определения template_pdf.php:79