• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/EventHistory/TrackedObject/Item.php
  • Класс: Bitrix\Crm\Service\EventHistory\TrackedObject\Item
  • Вызов: Item::getFieldValueCaption
protected function getFieldValueCaption(string $fieldName, $fieldValue, string $actualOrCurrent = null): string
{
	if ($fieldName === \Bitrix\Crm\Item::FIELD_NAME_OPPORTUNITY)
	{
		if ($actualOrCurrent === static::ACTUAL)
		{
			$currencyId = $this->getActualValue(\Bitrix\Crm\Item::FIELD_NAME_CURRENCY_ID);
		}
		elseif ($actualOrCurrent === static::CURRENT)
		{
			$currencyId = $this->getCurrentValue(\Bitrix\Crm\Item::FIELD_NAME_CURRENCY_ID);
		}

		return Money::format((float)$fieldValue, $currencyId);
	}

	$factory = Container::getInstance()->getFactory($this->getEntityTypeId());

	$field = $factory ? $factory->getFieldsCollection()->getField($fieldName) : null;
	if ($field && $field->getType() === $field::TYPE_TEXT && $field->getValueType() === $field::VALUE_TYPE_BB)
	{
		return TextHelper::convertBbCodeToHtml($fieldValue);
	}

	return $factory ? $factory->getFieldValueCaption($fieldName, $fieldValue) : (string)$fieldValue;
}