CAllCrmContact::PrepareFormattedName

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmContact
  4. PrepareFormattedName
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_contact.php
  • Класс: \CAllCrmContact
  • Вызов: CAllCrmContact::PrepareFormattedName
static function PrepareFormattedName(array $arFields, $nameTemplate = '', $enabledEmptyNameStub = true)
{
	if(!is_string($nameTemplate) || $nameTemplate === '')
	{
		$nameTemplate = \Bitrix\Crm\Format\PersonNameFormatter::getFormat();
	}

	static $honorificList = null;
	if($honorificList === null)
	{
		$honorificList = CCrmStatus::GetStatusList('HONORIFIC');
	}
	$honorific = '';
	$honorificID = isset($arFields['HONORIFIC']) ? $arFields['HONORIFIC'] : '';
	if($honorificID !== '' && isset($honorificList[$honorificID]))
	{
		$honorific = $honorificList[$honorificID];
	}

	return CUser::FormatName(
		$nameTemplate,
		array(
			'LOGIN' => '',
			'TITLE' => $honorific,
			'NAME' => isset($arFields['NAME']) ? $arFields['NAME'] : '',
			'SECOND_NAME' => isset($arFields['SECOND_NAME']) ? $arFields['SECOND_NAME'] : '',
			'LAST_NAME' => isset($arFields['LAST_NAME']) ? $arFields['LAST_NAME'] : ''
		),
		false,
		false,
		$enabledEmptyNameStub
	);
}

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