• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar_notify.php
  • Класс: CCalendarNotify
  • Вызов: CCalendarNotify::notifySharingUser
static function notifySharingUser(int $eventId): void
{
	/** @var BitrixCalendarCoreEventEvent $event */
	$event = (new MappersEvent())->getById($eventId);
	/** @var SharingLinkEventLink $eventLink */
	$eventLink = (new SharingLinkFactory())->getEventLinkByEventId($eventId);

	if (!$eventLink)
	{
		return;
	}

	$host = CUser::GetByID($eventLink->getHostId())->Fetch();
	$email = $host['PERSONAL_MAILBOX'] ?? null;
	$phone = $host['PERSONAL_PHONE'] ?? null;
	$userContact = !empty($email) ? $email : $phone;

	$notificationService = null;
	if ($userContact && SharingSharingEventManager::isEmailCorrect($userContact))
	{
		$notificationService = (new SharingNotificationMail())
			->setEventLink($eventLink)
			->setEvent($event)
		;
	}

	if ($notificationService !== null)
	{
		$notificationService->notifyAboutMeetingStatus($userContact);
	}
}