29 $files = static::getFiles($message);
31 foreach ($files as $file)
36 if (!($icalComponent instanceof
Calendar))
41 if (empty($message[
'OPTIONS'][
'iCal']))
43 $message[
'OPTIONS'][
'iCal'] = $data;
45 MailMessageTable::update($message[
'ID'], [
46 'OPTIONS' => $message[
'OPTIONS'],
50 if (!$icalComponent->hasOneEvent())
55 if ($icalComponent->getMethod() === Dictionary::METHOD[
'reply'])
62 ($icalComponent->getMethod() === Dictionary::METHOD[
'request'])
69 IncomingInvitationRequestHandler::MEETING_STATUS_QUESTION_CODE,
85 elseif ($icalComponent->getMethod() === Dictionary::METHOD[
'cancel'])
97 Loader::includeModule(
'calendar');
98 $calendarEventId = (int)$calendarEventId;
102 if ($calendarEventId <= 0)
107 $events = EventTable::getList([
108 'select' => [
'ID',
'OWNER_ID'],
110 'PARENT_ID' => $calendarEventId,
111 '!ID' => $calendarEventId,
115 $entityValues = array_map(fn($event) => (
int)$event[
'ID'], $events);
117 $messageAccessCollection = MessageAccessTable::getList([
118 'select' => [
'MESSAGE_ID',
'ENTITY_ID'],
120 'ENTITY_TYPE' => MessageAccessTable::ENTITY_TYPE_CALENDAR_EVENT,
121 'ENTITY_ID' => $entityValues,
125 foreach ($events as $event)
127 $messageAccess = array_filter($messageAccessCollection, fn($msgAccess) => (
int)$msgAccess[
'ENTITY_ID'] === (
int)$event[
'ID']);
130 $messageId = (int)$messageAccess[0][
'MESSAGE_ID'];
131 $userParams[(int)$event[
'OWNER_ID']] = [
'messageId' => $messageId];
135 MessageAccessTable::deleteByFilter([
136 'ENTITY_TYPE' => MessageAccessTable::ENTITY_TYPE_CALENDAR_EVENT,
137 'ENTITY_ID' => $entityValues,
140 \Bitrix\Pull\Event::add(array_keys($userParams), [
141 'module_id' =>
'mail',
142 'command' =>
'unbindItem',
146 'user_params' => $userParams,