From b3786a5bf23d7ae61f95ae3093c780d38e61a5cf Mon Sep 17 00:00:00 2001 From: Stefan Meyer Date: Mon, 12 Aug 2024 10:50:24 +0200 Subject: [PATCH] Merge pull request #7895 from chlulei/8_import_ical_exclusions implements import of iCal exclusions --- .../Calendar/classes/iCal/class.ilICalParser.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Services/Calendar/classes/iCal/class.ilICalParser.php b/Services/Calendar/classes/iCal/class.ilICalParser.php index 2c48b30047e8..d8a7ed200c61 100644 --- a/Services/Calendar/classes/iCal/class.ilICalParser.php +++ b/Services/Calendar/classes/iCal/class.ilICalParser.php @@ -1,7 +1,5 @@ @@ -393,6 +392,17 @@ protected function writeEvent(): void } $entry->save(); + // Search exclusions + // Only possible after entry is saved, otherwise the id is not available + foreach ($this->getContainer()->getItemsByName('EXDATE', false) as $item) { + if (is_a($item, 'ilICalProperty')) { + $rec_exclusion = new ilCalendarRecurrenceExclusion(); + $rec_exclusion->setEntryId($entry->getEntryId()); + $rec_exclusion->setDate(new ilDate($item->getValue(), IL_CAL_DATE)); + $rec_exclusion->save(); + } + } + $ass = new ilCalendarCategoryAssignments($entry->getEntryId()); $ass->addAssignment($this->category->getCategoryID());