Also consider exceptions when checking if first instance is to be listed (#2625)

This commit is contained in:
Thomas Bruederli 2013-11-29 20:23:17 +01:00
parent be12aa5827
commit f1dce1f5b9

View file

@ -267,9 +267,18 @@ class kolab_calendar
$add = true;
// skip the first instance of a recurring event if listed in exdate
if ($virtual && !empty($event['recurrence']['EXDATE'])) {
if ($virtual && (!empty($event['recurrence']['EXDATE']) || !empty($event['recurrence']['EXCEPTIONS']))) {
$event_date = $event['start']->format('Ymd');
foreach ($event['recurrence']['EXDATE'] as $exdate) {
$exdates = (array)$event['recurrence']['EXDATE'];
// add dates from exceptions to list
if (is_array($event['recurrence']['EXCEPTIONS'])) {
foreach ($event['recurrence']['EXCEPTIONS'] as $exception) {
$exdates[] = clone $exception['start'];
}
}
foreach ($exdates as $exdate) {
if ($exdate->format('Ymd') == $event_date) {
$add = false;
break;