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

	$event = \CCalendarEvent::GetList([
		'arFilter' => [
			'ID' => $eventId,
		],
		'fetchAttendees' => true,
		'checkPermissions' => false,
	]);

	$event = $event[0] ?? false;
	if (!$event || ($event['EVENT_TYPE'] ?? null) !== Dictionary::EVENT_TYPE['shared_crm'])
	{
		return false;
	}

	$attendees = $event['ATTENDEE_LIST'] ?? [];
	foreach ($attendees as $attendee)
	{
		if (($attendee['status'] ?? null) === Dictionary::MEETING_STATUS['Yes'])
		{
			\CCalendarEvent::SetMeetingStatus([
				'eventId' => $eventId,
				'userId' => $attendee['id'] ?? 0,
				'status' => 'N'
			]);
		}
	}

	return true;
}