From ee8b9e1ddc719a46233971b6b74c7812764c4b1f Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Thu, 26 Sep 2013 09:43:29 +0200 Subject: [PATCH] Support DURATION properties for events (#1916) --- plugins/libkolab/lib/kolab_format_event.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/libkolab/lib/kolab_format_event.php b/plugins/libkolab/lib/kolab_format_event.php index f3d0470b..e5ea3ef3 100644 --- a/plugins/libkolab/lib/kolab_format_event.php +++ b/plugins/libkolab/lib/kolab_format_event.php @@ -138,6 +138,17 @@ class kolab_format_event extends kolab_format_xcal 'attendees' => array(), ); + // derive event end from duration (#1916) + if (!$object['end'] && $object['start'] && ($duration = $this->obj->duration()) && $duration->isValid()) { + $interval = new DateInterval('PT0S'); + $interval->d = $duration->weeks() * 7 + $duration->days(); + $interval->h = $duration->hours(); + $interval->i = $duration->minutes(); + $interval->s = $duration->seconds(); + $object['end'] = clone $object['start']; + $object['end']->add($interval); + } + // organizer is part of the attendees list in Roundcube if ($object['organizer']) { $object['organizer']['role'] = 'ORGANIZER';