• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/compatible/ordercompatibility.php
  • Класс: BitrixSaleCompatibleOrderCompatibility
  • Вызов: OrderCompatibility::createShipmentFromShipmentSystem
static function createShipmentFromShipmentSystem(SaleShipmentCollection $shipmentCollection)
{

	$shipment = null;

	/** @var SaleShipment $systemShipment */
	$systemShipment = $shipmentCollection->getSystemShipment();

	if ($systemShipment->getDeliveryId() > 0)
	{
		/** @var SaleShipment $shipment */
		$shipment = static::getShipmentByDeliveryId($shipmentCollection, $systemShipment->getDeliveryId());

		if (!$shipment)
		{
			if ($service = SaleDeliveryServicesManager::getObjectById($systemShipment->getDeliveryId()))
			{
				/** @var SaleShipment $shipment */
				$shipment = $shipmentCollection->createItem($service);
				$shipment->setField('DELIVERY_NAME', $service->getName());
			}
		}
	}

	return $shipment;
}