- Модуль: report
- Путь к файлу: ~/bitrix/modules/report/classes/general/report_helper.php
- Класс: CReportHelper
- Вызов: CReportHelper::getUserFieldCrmValue
static function getUserFieldCrmValue($valueKey, $ufInfo)
{
$valueKey = trim(strval($valueKey));
$value = '';
if ($valueKey <> '')
{
$prefixByType = static::getUserFieldCrmTypePrefixMap();
$maxPrefixLength = 3; // 'SSI'
$singleTypePrefix = '';
if (is_array($ufInfo['SETTINGS']))
{
$supportedTypes = array();
foreach ($ufInfo['SETTINGS'] as $type => $supported)
{
if ($supported === 'Y')
$supportedTypes[$type] = true;
}
$supportedTypes = array_keys($supportedTypes);
if (count($supportedTypes) === 1)
{
if (isset($prefixByType[mb_strtolower($supportedTypes[0])]))
$singleTypePrefix = $prefixByType[mb_strtolower($supportedTypes[0])];
}
unset($supportedTypes, $type, $supported);
}
$prefix = '';
if (($pos = mb_strpos(mb_substr($valueKey, 0, $maxPrefixLength + 1), '_')) !== false && $pos > 0)
$prefix = mb_substr($valueKey, 0, $pos);
if (empty($prefix))
$valueKey = $singleTypePrefix . '_' . $valueKey;
unset($prefix, $pos);
if (is_array(self::$ufCrmElements) && is_array(self::$ufCrmElements[$valueKey]))
{
$element = self::$ufCrmElements[$valueKey];
$item = explode('_', $valueKey);
if ($item[0] !== '' && $item[1] !== '')
{
$entityTitle = $element['title'];
$entityUrl = $element['url'];
if ($entityTitle !== '')
{
if ($entityUrl !== '')
{
$value =
''
. htmlspecialcharsbx($entityTitle) .''
;
}
else
{
$value = htmlspecialcharsbx($entityTitle);
}
}
}
}
}
return $value;
}