• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/sharing/sharingeventmanager.php
  • Класс: BitrixCalendarSharingSharingEventManager
  • Вызов: SharingEventManager::onSharingEventMeetingStatusChange
static function onSharingEventMeetingStatusChange(
	int $parentEventId,
	int $userId,
	string $currentMeetingStatus
)
{
	$userEvent = CCalendarEvent::GetList([
		'arFilter' => [
			'PARENT_ID' => $parentEventId,
			'OWNER_ID' => $userId,
			'IS_MEETING' => 1,
			'DELETED' => 'N'
		],
		'checkPermissions' => false,
	]);

	if (empty($userEvent))
	{
		return;
	}

	$userEvent = $userEvent[0];
	$previousMeetingStatus = $userEvent['MEETING_STATUS'];

	if (
		$currentMeetingStatus === Dictionary::MEETING_STATUS['Yes']
		&& $previousMeetingStatus === Dictionary::MEETING_STATUS['Question']
	)
	{
		self::onSharingCrmEventConfirmed(
			(int)$userEvent['PARENT_ID'],
			$userEvent['DATE_FROM'] ?? null,
			$userEvent['TZ_FROM'] ?? null,
		);
	}

	if (
		$currentMeetingStatus === Dictionary::MEETING_STATUS['No']
		&& (
			$previousMeetingStatus === Dictionary::MEETING_STATUS['Question']
			|| $previousMeetingStatus === Dictionary::MEETING_STATUS['Yes']
		)
	)
	{
		self::onSharingCrmEventDeclined((int)$userEvent['PARENT_ID']);
	}
}