• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/shipmentitem.php
  • Класс: BitrixSaleShipmentItem
  • Вызов: ShipmentItem::checkCallingContext
private function checkCallingContext()
{
	/** @var ShipmentItemCollection $shipmentItemCollection */
	if (!$shipmentItemCollection = $this->getCollection())
	{
		throw new MainObjectNotFoundException('Entity "ShipmentItemCollection" not found');
	}

	/** @var Shipment $shipment */
	if (!$shipment = $shipmentItemCollection->getShipment())
	{
		throw new MainObjectNotFoundException('Entity "Shipment" not found');
	}

	/** @var ShipmentCollection $shipmentCollection */
	if (!$shipmentCollection = $shipment->getCollection())
	{
		throw new MainObjectNotFoundException('Entity "ShipmentCollection" not found');
	}

	/** @var Order $order */
	if (!$order = $shipmentCollection->getOrder())
	{
		throw new MainObjectNotFoundException('Entity "Order" not found');
	}

	if (!$order->isSaveRunning())
	{
		trigger_error("Incorrect call to the save process. Use method save() on BitrixSaleOrder entity", E_USER_WARNING);
	}
}