• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/calendar/helper.php
  • Класс: Bitrix\Crm\Integration\Calendar\Helper
  • Вызов: Helper::addTimelineEntry
public function addTimelineEntry(string $linkHash, string $eventType): bool
{
	if (!$this->isAvailable())
	{
		return false;
	}

	/** @var CrmDealLink $crmDealLink */
	$crmDealLink = self::getLinkFactory()->getLinkByHash($linkHash);

	if ($crmDealLink->getObjectType() !== \Bitrix\Calendar\Sharing\Link\Helper::CRM_DEAL_SHARING_TYPE)
	{
		return false;
	}

	$eventData = EventData::createFromCrmDealLink($crmDealLink, $eventType);

	if ($eventType === EventData::SHARING_ON_INVITATION_SENT && $crmDealLink->getContactId())
	{
		$contactCommunications = $this->getContactPhoneCommunications(
			$crmDealLink->getEntityId(),
			\CCrmOwnerType::Deal,
			$crmDealLink->getContactId(),
			$crmDealLink->getContactType(),
		);

		if ($contactCommunications && isset($contactCommunications['phones'][0]))
		{
			$eventData->setContactCommunication($contactCommunications['phones'][0]['valueFormatted']);
		}

		if ($crmDealLink->getChannelId())
		{
			$entity = new ItemIdentifier(\CCrmOwnerType::Deal, $crmDealLink->getEntityId());
			$repo = ChannelRepository::create($entity);
			$channel = $repo->getById(SmsManager::getSenderCode(), $crmDealLink->getChannelId());

			if ($channel)
			{
				$eventData->setChannelName($channel->getName());
			}
		}
	}

	CalendarSharingTimeline::createTimelineEntry($eventData);

	return true;
}