diff --git a/plugins/libkolab/lib/kolab_format_event.php b/plugins/libkolab/lib/kolab_format_event.php index 9be9bdfa..6a8c3ae0 100644 --- a/plugins/libkolab/lib/kolab_format_event.php +++ b/plugins/libkolab/lib/kolab_format_event.php @@ -163,20 +163,22 @@ class kolab_format_event extends kolab_format_xcal else if ($status == kolabformat::StatusCancelled) $object['cancelled'] = true; + // this is an exception object + if ($this->obj->recurrenceID()->isValid()) { + $object['thisandfuture'] = $this->obj->thisAndFuture(); + } // read exception event objects - if (($exceptions = $this->obj->exceptions()) && is_object($exceptions) && $exceptions->size()) { + else if (($exceptions = $this->obj->exceptions()) && is_object($exceptions) && $exceptions->size()) { + $recurrence_exceptions = array(); for ($i=0; $i < $exceptions->size(); $i++) { if (($exobj = $exceptions->get($i))) { $exception = new kolab_format_event($exobj); if ($exception->is_valid()) { - $object['recurrence']['EXCEPTIONS'][] = $this->expand_exception($exception->to_array(), $object); + $recurrence_exceptions[] = $this->expand_exception($exception->to_array(), $object); } } } - } - // this is an exception object - else if ($this->obj->recurrenceID()->isValid()) { - $object['thisandfuture'] = $this->obj->thisAndFuture(); + $object['recurrence']['EXCEPTIONS'] = $recurrence_exceptions; } return $this->data = $object;