• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Timeline/Item/Activity/Call.php
  • Класс: Bitrix\Crm\Service\Timeline\Item\Activity\Call
  • Вызов: Call::buildAdditionalInfoBlock
private function buildAdditionalInfoBlock(): ?ContentBlock
{
	$callInfo = $this->fetchInfo();
	if (empty($callInfo))
	{
		return null;
	}

	$callInfoBlockIsEmpty = true;
	$block = new LineOfTextBlocks();

	// 1st element - phone number
	$portalNumber = $callInfo['PORTAL_LINE']['FULL_NAME'] ?? $callInfo['PORTAL_NUMBER'];
	$formattedValue = PhoneNumber\Parser::getInstance()->parse($portalNumber)->format();
	if (!empty($formattedValue))
	{
		$block
			->addContentBlock(
				'info1',
				ContentBlockFactory::createTitle(
					Loc::getMessage(
						$this->fetchDirection() === CCrmActivityDirection::Incoming
							? 'CRM_TIMELINE_BLOCK_CALL_ADDITIONAL_INFO_1'
							: 'CRM_TIMELINE_BLOCK_CALL_ADDITIONAL_INFO_1_OUT'
					)
				)->setColor(Text::COLOR_BASE_50)

			)
			->addContentBlock('phoneNumber', ContentBlockFactory::createTitle($formattedValue))
		;

		$callInfoBlockIsEmpty = false;
	}

	// 2nd element - call duration
	$duration = (int)$callInfo['DURATION'];
	if ($duration > 0)
	{
		if (!$callInfoBlockIsEmpty)
		{
			// add delimiter before first block
			$block
				->addContentBlock(
					'delimiter',
					ContentBlockFactory::createTitle(
						html_entity_decode(self::BLOCK_DELIMITER)
					)->setColor(Text::COLOR_BASE_50)
				)
			;
		}

		$block
			->addContentBlock(
				'info2',
				ContentBlockFactory::createTitle(
					Loc::getMessage('CRM_TIMELINE_BLOCK_CALL_ADDITIONAL_INFO_2')
				)->setColor(Text::COLOR_BASE_50)
			)
			->addContentBlock(
				'duration',
				ContentBlockFactory::createTitle(
					Duration::format($duration)
				)->setColor(Text::COLOR_BASE_50)
			)
		;

		$callInfoBlockIsEmpty = false;
	}

	return $callInfoBlockIsEmpty ? null : $block;
}