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
This commit is contained in:
Aleksander Machniak 2016-10-18 09:04:54 +02:00
parent baf491e2bb
commit cdfb979b22
3 changed files with 4 additions and 16 deletions

View file

@ -612,14 +612,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)
@ -708,7 +702,7 @@ class kolab_calendar extends kolab_storage_folder_api
break;
// avoid endless recursion loops
if (++$i > 1000)
if (++$i > 100000)
break;
}

View file

@ -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;
}

View file

@ -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);
}