From 20833726b2b54c04dbc918d52c9f3c11cebc8b0d Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 29 Jun 2016 19:45:28 +0200 Subject: [PATCH] Fix disappearing free-busy event on refresh (#5462) The issue was caused by missing event uid. On client-side all events have had the same _id property and calendar widget couldn't properly merge changes. --- .../drivers/kolab/kolab_user_calendar.php | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/plugins/calendar/drivers/kolab/kolab_user_calendar.php b/plugins/calendar/drivers/kolab/kolab_user_calendar.php index c6263147..33be7a80 100644 --- a/plugins/calendar/drivers/kolab/kolab_user_calendar.php +++ b/plugins/calendar/drivers/kolab/kolab_user_calendar.php @@ -227,8 +227,9 @@ class kolab_user_calendar extends kolab_calendar foreach (kolab_storage::list_user_folders($this->userdata, 'event', 2) as $foldername) { $cal = new kolab_calendar($foldername, $this->cal); foreach ($cal->list_events($start, $end, $search, 1) as $event) { - $this->events[$event['id'] ?: $event['uid']] = $event; - $this->timeindex[$this->time_key($event)] = $event['id']; + $uid = $event['id'] ?: $event['uid']; + $this->events[$uid] = $event; + $this->timeindex[$this->time_key($event)] = $uid; } } @@ -332,7 +333,7 @@ class kolab_user_calendar extends kolab_calendar foreach ($fb['periods'] as $tuple) { list($from, $to, $type) = $tuple; $event = array( - 'id' => md5($this->id . $from->format('U') . '/' . $to->format('U')), + 'uid' => md5($this->id . $from->format('U') . '/' . $to->format('U')), 'calendar' => $this->id, 'changed' => $fb['created'] ?: new DateTime(), 'title' => $this->get_name() . ' ' . ($titlemap[$type] ?: $type), @@ -349,8 +350,8 @@ class kolab_user_calendar extends kolab_calendar // avoid duplicate entries $key = $this->time_key($event); if (!$this->timeindex[$key]) { - $this->events[$event['id']] = $event; - $this->timeindex[$key] = $event['id']; + $this->events[$event['uid']] = $event; + $this->timeindex[$key] = $event['uid']; $count++; } } @@ -412,15 +413,4 @@ class kolab_user_calendar extends kolab_calendar { return false; } - - /** - * Convert from Kolab_Format to internal representation - */ - private function _to_rcube_event($record) - { - $record['id'] = $record['uid']; - $record['calendar'] = $this->id; - - return kolab_driver::to_rcube_event($record); - } }