• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/archive/process/orderarchivecollection.php
  • Класс: BitrixSaleArchiveProcessOrderArchiveCollection
  • Вызов: OrderArchiveCollection::collectShipments
private function collectShipments(array $orderIds)
{
	$shipmentItemsList = [];
	$sortedShipments = [];

	$shipments = SaleShipment::getList(
		array(
			"order" => array("ORDER_ID"),
			"filter" => array("=ORDER_ID" => $orderIds, "SYSTEM" => 'N')
		)
	);

	while ($shipment = $shipments->fetch())
	{
		$shipmentItemsList[$shipment['ID']] = $shipment;
	}

	if (!empty($shipmentItemsList))
	{
		$shipmentsItems = SaleShipmentItem::getList(
			array(
				"order" => array("ORDER_DELIVERY_ID"),
				"filter" => array("ORDER_DELIVERY_ID" => array_keys($shipmentItemsList))
			)
		);

		while ($shipmentsItem = $shipmentsItems->fetch())
		{
			$shipmentItemsList[$shipmentsItem['ORDER_DELIVERY_ID']]["SHIPMENT_ITEM"][] = $shipmentsItem;
		}
	}

	foreach ($shipmentItemsList as $item)
	{
		$sortedShipments[$item['ORDER_ID']][$item['ID']] = $item;
	}

	return $sortedShipments;
}