• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_report_helper.php
  • Класс: \CCrmActivityReportHelper
  • Вызов: CCrmActivityReportHelper::formatResultValue
static function formatResultValue($k, &$v, &$row, &$cInfo, $total, &$customChartValue = null)
{
	// HACK: detect if 'report.view' component is rendering excel spreadsheet
	$isHtml = !(isset($_GET['EXCEL']) && $_GET['EXCEL'] === 'Y');

	$field = $cInfo['field'];
	$fieldName = isset($cInfo['fieldName']) ? $cInfo['fieldName'] : $field->GetName();
	$prcnt = isset($cInfo['prcnt']) ? $cInfo['prcnt'] : '';
	$aggr = (!empty($cInfo['aggr']) && $cInfo['aggr'] !== 'GROUP_CONCAT');

	if (!$aggr && $fieldName === 'TYPE_ID')
	{
		if ($v !== '')
		{
			// nasty... I have no choice...
			if (static::isTaskActivity((int)$row['ID'], (int)$row['TYPE_ID']))
			{
				$v = Crm\Activity\Provider\Tasks\Task::getName();
			}
			else
			{
				$v = self::getActivityTypeName($v, $isHtml);
			}
		}
	}
	elseif (!$aggr && $fieldName === 'DIRECTION')
	{
		if ($v !== '')
		{
			$v = self::getActivityDirectionName($v, 0, $isHtml);
		}
	}
	elseif (!$aggr && $fieldName === 'PRIORITY')
	{
		if ($v !== '')
		{
			$v = self::getActivityPriorityName($v, $isHtml);
		}
	}
	elseif(!$aggr && mb_strpos($fieldName, 'ASSIGNED_BY.') === 0
			|| mb_strpos($fieldName, 'AUTHOR_BY.') === 0
			|| mb_strpos($fieldName, 'EDITOR_BY.') === 0)
	{
		// unset HREF for empty value
		if (empty($v) || trim($v) === '.' || $v === ' ')
			unset($row['__HREF_'.$k]);
		if(($v == '' || trim($v) === '.') && mb_strpos($fieldName, '.WORK_POSITION') !== mb_strlen($fieldName) - 14)
		{
			$v = GetMessage('CRM_ACTIVITY_RESPONSIBLE_NOT_ASSIGNED');
		}
		if($isHtml)
		{
			$v = htmlspecialcharsbx($v);
		}
	}
	elseif ($fieldName !== 'SUBJECT') // Leave 'SUBJECT' as is for HTML display.
	{
		parent::formatResultValue($k, $v, $row, $cInfo, $total, $customChartValue);
	}
}