• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/documentgenerator/dataprovider/company.php
  • Класс: Bitrix\Crm\Integration\DocumentGenerator\DataProvider\Company
  • Вызов: Company::fetchData
protected function fetchData()
{
	parent::fetchData();
	// a hack to load address from requisites.
	$isOutmodedAddressesEnabled = ((new \Bitrix\Crm\Settings\CompanySettings())->areOutmodedRequisitesEnabled());
	if(empty($this->data['ADDRESS']))
	{
		unset($this->data['ADDRESS']);
		if($isOutmodedAddressesEnabled)
		{
			$address = CompanyAddress::getByOwner(CompanyAddress::Primary, $this->getCrmOwnerType(), $this->source);
			if($address)
			{
				$this->data['ADDRESS'] = new \Bitrix\Crm\Integration\DocumentGenerator\Value\Address($address);
			}
		}
	}
	if(empty($this->data['ADDRESS_LEGAL']))
	{
		unset($this->data['ADDRESS_LEGAL']);
		if($isOutmodedAddressesEnabled)
		{
			$address = CompanyAddress::getByOwner(CompanyAddress::Registered, $this->getCrmOwnerType(), $this->source);
			if($address)
			{
				$this->data['ADDRESS_LEGAL'] = new \Bitrix\Crm\Integration\DocumentGenerator\Value\Address($address);
			}
		}
	}
	if(!$this->revenue)
	{
		$this->revenue = $this->data['REVENUE'] ?? 0;
		unset($this->data['REVENUE']);
	}
}