Lead::loadEntityValues

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Lead
  4. loadEntityValues
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/bizproc/document/valuecollection/lead.php
  • Класс: Bitrix\Crm\Integration\BizProc\Document\ValueCollection\Lead
  • Вызов: Lead::loadEntityValues
protected function loadEntityValues(): void
{
	if (isset($this->document['ID']))
	{
		return;
	}

	$result = \CCrmLead::GetListEx(
		[],
		[
			'ID' => $this->id,
			'CHECK_PERMISSIONS' => 'N',
		],
		false,
		false,
		['*', 'UF_*']
	);


	$this->document = array_merge($this->document, $result->fetch() ?: []);

	if ($this->document['COMPANY_ID'] <= 0)
	{
		$this->document['COMPANY_ID'] = null;
	}

	if ($this->document['CONTACT_ID'] <= 0)
	{
		$this->document['CONTACT_ID'] = null;
	}

	$this->appendDefaultUserPrefixes();
	$this->appendCustomerFields();

	if ($this->document['COMPANY_ID'] > 0)
	{
		unset($this->document['COMPANY_TITLE']);
	}

	$this->document['FULL_ADDRESS'] = Crm\Format\AddressFormatter::getSingleInstance()->formatTextComma(
		Crm\LeadAddress::mapEntityFields($this->document)
	);

	$statuses = \CCrmStatus::GetStatusList('STATUS');
	$statusId = $this->document['STATUS_ID'] ?? '';
	$this->document['STATUS_ID_PRINTABLE'] = $statusId && isset($statuses[$statusId]) ? $statuses[$statusId] : '';

	$this->loadFmValues();
	$this->loadUserFieldValues();

	$this->document = Crm\Entity\CommentsHelper::prepareFieldsFromBizProc($this->typeId, $this->id, $this->document);
}

Добавить комментарий