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

	$select = array('*');

	$registry = SaleRegistry::getInstance(static::getRegistryType());
	/** @var SaleOrder $orderClassName */
	$orderClassName = $registry->getOrderClassName();

	if ($order = $orderClassName::load($id))
	{
		/** @var SalePaymentCollection $paymentCollection */
		if ($paymentCollection = $order->getPaymentCollection())
		{
			if (count($paymentCollection) == 1)
			{
				$select = array_merge($select, array_keys(static::getAliasPaymentFields()));
			}
		}

		/** @var SaleShipmentCollection $shipmentCollection */
		if ($shipmentCollection = $order->getShipmentCollection())
		{
			if (count($shipmentCollection) == 1
				|| (count($shipmentCollection) == 2 && $shipmentCollection->isExistsSystemShipment()))
			{
				$select = array_merge($select, array_keys(static::getAliasShipmentFields()));
			}
		}
	}

	return static::setGetListParameters($compatibility, array(), array("ID" => $id), null, array(), $select);
}