From cb9ea0ab5d9e1b841d207c35e217d8542d7ba07d Mon Sep 17 00:00:00 2001 From: gevorgmansuryan Date: Sun, 19 Oct 2025 03:03:35 +0400 Subject: [PATCH] Issue -External Calendar & iCa --- interfaces/VCalendar.php | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/interfaces/VCalendar.php b/interfaces/VCalendar.php index d2b8c4ec..adc2d34a 100644 --- a/interfaces/VCalendar.php +++ b/interfaces/VCalendar.php @@ -245,28 +245,30 @@ private function addVEvent(CalendarEventIF $item, bool $isRecurrenceChild = fals } } - $organizer = $item->getOrganizer(); - if ($organizer instanceof User) { - $evt->add( - 'ORGANIZER;CN=' . $this->getCN($organizer), - 'mailto:' . $this->getMailto($organizer), - ); + $eventType = $item->getEventType(); + + if ($eventType instanceof CalendarEntryType && !empty($category = $eventType->name)) { + $evt->add('CATEGORIES', $category); } - if ($this->includeParticipantInfo && $item instanceof CalendarEventParticipationIF) { - foreach ($item->findParticipants()->limit(self::MAX_PARTICIPANTS_COUNT)->all() as $participant) { - /* @var $user User */ + if ($item instanceof CalendarEventParticipationIF) { + $organizer = $item->getOrganizer(); + if ($organizer instanceof User) { $evt->add( - 'ATTENDEE;CN=' . $this->getCN($participant), - 'mailto:' . $this->getMailto($participant), + 'ORGANIZER;CN=' . $this->getCN($organizer), + 'mailto:' . $this->getMailto($organizer), ); } - } - $eventType = $item->getEventType(); - - if ($eventType instanceof CalendarEntryType && !empty($category = $eventType->name)) { - $evt->add('CATEGORIES', $category); + if ($this->includeParticipantInfo) { + foreach ($item->findParticipants()->limit(self::MAX_PARTICIPANTS_COUNT)->all() as $participant) { + /* @var $user User */ + $evt->add( + 'ATTENDEE;CN=' . $this->getCN($participant), + 'mailto:' . $this->getMailto($participant), + ); + } + } } return $this;