• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/bizproc/fieldtype/crm.php
  • Класс: Bitrix\Crm\Integration\BizProc\FieldType\Crm
  • Вызов: Crm::prepareCrmUserTypeValueView
static function prepareCrmUserTypeValueView($value, $defaultTypeName = '')
{
	$parts = explode('_', $value);

	$entityTypeId = null;
	$entityId = null;

	if (count($parts) > 1)
	{
		$entityTypeId = \CCrmOwnerType::ResolveID(
			\CCrmOwnerTypeAbbr::ResolveName($parts[0] . $parts[1])
			?: \CCrmOwnerTypeAbbr::ResolveName($parts[0])
		);
		$entityId = (int)end($parts);
	}
	elseif ($defaultTypeName !== '')
	{
		$entityTypeId = \CCrmOwnerType::ResolveID($defaultTypeName);
		$entityId = (int)$value;
	}

	return
		!is_null($entityTypeId) && !is_null($entityId)
			? \CCrmOwnerType::GetCaption($entityTypeId, $entityId, false)
			: $value
	;
}