• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/update/crmentitycreatorstepper.php
  • Класс: BitrixSaleUpdateCrmEntityCreator
  • Вызов: CrmEntityCreator::setContactCompanyRequisites
private function setContactCompanyRequisites(): void
{
	$collection = $this->order->getContactCompanyCollection();
	if (!$collection)
	{
		return;
	}

	$entity = $collection->getPrimaryCompany();
	if ($entity === null)
	{
		$entity = $collection->getPrimaryContact();
	}

	if ($entity === null)
	{
		return;
	}

	$result = [
		"MC_REQUISITE_ID" => 0,
		"MC_BANK_DETAIL_ID" => 0
	];

	$requisiteList = $entity->getRequisiteList();
	if ($requisiteList)
	{
		$result["REQUISITE_ID"] = current($requisiteList)["ID"];
	}

	$bankRequisiteList = $entity->getBankRequisiteList();
	if ($bankRequisiteList)
	{
		$result["BANK_DETAIL_ID"] = current($bankRequisiteList)["ID"];
	}

	$this->order->setRequisiteLink($result);
}