From 61a20467e8f9cf71ad1f00fce69289d3765564fa Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 7 Oct 2012 17:13:03 +0000 Subject: [PATCH] * Calendar/CalDAV: deleting of recurrences under Android (eg. CalDAV Sync app) did not work Android sets STATUS: CANCELLED instead of adding event to EXDATE of master, as other CalDAV clients do --- calendar/inc/class.calendar_ical.inc.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index 9b168c7543..f736dc3520 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -1491,6 +1491,19 @@ class calendar_ical extends calendar_boupdate . array2string($event)."\n",3,$this->logfile); } + // Android (any maybe others) delete recurrences by setting STATUS: CANCELLED + // as we ignore STATUS we have to delete the recurrence by calling delete + if (in_array($event_info['type'], array('SERIES-EXCEPTION', 'SERIES-EXCEPTION-PROPAGATE', 'SERIES-PSEUDO-EXCEPTION')) && + $event['status'] == 'CANCELLED') + { + if (!$this->delete($event['id'] ? $event['id'] : $cal_id, $event['recurrence'])) + { + // delete fails (because no rights), reject recurrence + $this->set_status($event['id'] ? $event['id'] : $cal_id, $this->user, 'R', $event['recurrence']); + } + continue; + } + // save event depending on the given event type switch ($event_info['type']) { @@ -2925,6 +2938,10 @@ class calendar_ical extends calendar_boupdate // fall through case 'LAST-MODIFIED': // will be written direct to the event $event['modified'] = $attributes['value']; + break; + case 'STATUS': // currently no EGroupware event column, but needed as Android uses it to delete single recurrences + $event['status'] = $attributes['value']; + break; } } // check if the entry is a birthday