From f1c581f4e420eb8f17a45568edec76419bbb7788 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 18 Oct 2016 09:04:54 +0200 Subject: [PATCH] T1268: Fix bug where forever recurring events could not be displayed Summary: Actually it sets the internal end time interval to 100 years for all kind of events. Before it was 100 for yearly events, but only 10 for weekly. Fixes T1268. Reviewers: #roundcube_kolab_plugins_developers Maniphest Tasks: T1268 Differential Revision: https://git.kolab.org/D203 --- plugins/calendar/drivers/kolab/kolab_calendar.php | 10 ++-------- plugins/libkolab/lib/kolab_date_recurrence.php | 8 +------- plugins/libkolab/lib/kolab_storage_cache_event.php | 2 +- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/plugins/calendar/drivers/kolab/kolab_calendar.php b/plugins/calendar/drivers/kolab/kolab_calendar.php index ef54a86c..503ed6b2 100644 --- a/plugins/calendar/drivers/kolab/kolab_calendar.php +++ b/plugins/calendar/drivers/kolab/kolab_calendar.php @@ -605,14 +605,8 @@ class kolab_calendar extends kolab_storage_folder_api // determine a reasonable end date if none given if (!$end) { - switch ($event['recurrence']['FREQ']) { - case 'YEARLY': $intvl = 'P100Y'; break; - case 'MONTHLY': $intvl = 'P20Y'; break; - default: $intvl = 'P10Y'; break; - } - $end = clone $event['start']; - $end->add(new DateInterval($intvl)); + $end->add(new DateInterval('P100Y')); } // copy the recurrence rule from the master event (to be used in the UI) @@ -701,7 +695,7 @@ class kolab_calendar extends kolab_storage_folder_api break; // avoid endless recursion loops - if (++$i > 1000) + if (++$i > 100000) break; } diff --git a/plugins/libkolab/lib/kolab_date_recurrence.php b/plugins/libkolab/lib/kolab_date_recurrence.php index 64d9d0a5..2f92c07c 100644 --- a/plugins/libkolab/lib/kolab_date_recurrence.php +++ b/plugins/libkolab/lib/kolab_date_recurrence.php @@ -130,14 +130,8 @@ class kolab_date_recurrence // determine a reasonable end date if none given if (!$event['recurrence']['COUNT'] && $event['end'] instanceof DateTime) { - switch ($event['recurrence']['FREQ']) { - case 'YEARLY': $intvl = 'P100Y'; break; - case 'MONTHLY': $intvl = 'P20Y'; break; - default: $intvl = 'P10Y'; break; - } - $end_dt = clone $event['end']; - $end_dt->add(new DateInterval($intvl)); + $end_dt->add(new DateInterval('P100Y')); return $end_dt; } diff --git a/plugins/libkolab/lib/kolab_storage_cache_event.php b/plugins/libkolab/lib/kolab_storage_cache_event.php index ae9c693b..b6d8b15f 100644 --- a/plugins/libkolab/lib/kolab_storage_cache_event.php +++ b/plugins/libkolab/lib/kolab_storage_cache_event.php @@ -40,7 +40,7 @@ class kolab_storage_cache_event extends kolab_storage_cache // extend date range for recurring events if ($object['recurrence'] && $object['_formatobj']) { $recurrence = new kolab_date_recurrence($object['_formatobj']); - $dtend = $recurrence->end() ?: new DateTime('now +10 years'); + $dtend = $recurrence->end() ?: new DateTime('now +100 years'); $sql_data['dtend'] = $this->_convert_datetime($dtend); }