• Модуль: catalogmobile
  • Путь к файлу: ~/bitrix/modules/catalogmobile/lib/EntityEditor/RealizationDocumentProvider.php
  • Класс: BitrixCatalogMobileEntityEditorRealizationDocumentProvider
  • Вызов: RealizationDocumentProvider::getOwnerEntity
private function getOwnerEntity(): ?BitrixCrmItem
{
	static $item = null;

	if ($item)
	{
		return $item;
	}

	$ownerTypeId = $this->context['ownerTypeId'];
	$ownerId = $this->context['ownerId'];

	$isOwnerContext = $ownerTypeId && $ownerId;
	if (!$isOwnerContext)
	{
		$entityBinding = $this->order->getEntityBinding();
		if ($entityBinding)
		{
			$ownerTypeId = $entityBinding->getOwnerTypeId();
			$ownerId = $entityBinding->getOwnerId();
		}
	}

	if ($ownerTypeId && $ownerId)
	{
		$factory = BitrixCrmServiceContainer::getInstance()->getFactory($ownerTypeId);
		if ($factory)
		{
			$item = $factory->getItem($ownerId);
			if ($item)
			{
				return $item;
			}
		}
	}

	return null;
}