diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index 3ad3cc18aa..5635a700c9 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -1110,6 +1110,29 @@ class calendar_ical extends calendar_boupdate { $event['id'] = $event_info['stored_event']['id']; // CalDAV does only provide UIDs } + if (is_array($event['participants'])) + { + // if the client does not return a status, we restore the original one + foreach ($event['participants'] as $uid => $status) + { + if ($status[0] == 'X') + { + if (isset($event_info['stored_event']['participants'][$uid])) + { + if ($this->log) + { + error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. + "() Restore status for $uid\n",3,$this->logfile); + } + $event['participants'][$uid] = $event_info['stored_event']['participants'][$uid]; + } + else + { + $event['participants'][$uid] = calendar_so::combine_status('U'); + } + } + } + } if ($merge) { if ($this->log) @@ -1117,7 +1140,6 @@ class calendar_ical extends calendar_boupdate error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. "()[MERGE]\n",3,$this->logfile); } - // overwrite with server data for merge foreach ($event_info['stored_event'] as $key => $value) { @@ -1167,27 +1189,6 @@ class calendar_ical extends calendar_boupdate } else { - // if the client does not return a status, we restore the original one - foreach ($event['participants'] as $uid => $status) - { - // Is it a resource and no longer present in the event? - if ($status[0] == 'X') - { - if (isset($event_info['stored_event']['participants'][$uid])) - { - if ($this->log) - { - error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. - "() Restore status for $uid\n",3,$this->logfile); - } - $event['participants'][$uid] = $event_info['stored_event']['participants'][$uid]; - } - else - { - $event['participants'][$uid] = calendar_so::combine_status('U'); - } - } - } foreach ($event_info['stored_event']['participants'] as $uid => $status) { // Is it a resource and no longer present in the event? @@ -1284,11 +1285,11 @@ class calendar_ical extends calendar_boupdate { if ($uid == $event['owner']) { - $event['participants']['uid'] = calendar_so::combine_status('A', 1, 'CHAIR'); + $event['participants'][$uid] = calendar_so::combine_status('A', 1, 'CHAIR'); } else { - $event['participants']['uid'] = calendar_so::combine_status('U'); + $event['participants'][$uid] = calendar_so::combine_status('U'); } } }