T1637: Fix lost exceptions on event edit

Fixes bug where exceptions could be lost when editing
non-first occurence of a recurring event.

Also fixes bug where recurrent event update could
unintentionally change start date of the main event
when non-first occurence was selected for edition.
This commit is contained in:
Aleksander Machniak 2016-12-27 08:33:05 +01:00
parent 41e32e5b5a
commit f4e5fc9d38

View file

@ -1141,11 +1141,11 @@ class kolab_driver extends calendar_driver
// use start date from master but try to be smart on time or duration changes // use start date from master but try to be smart on time or duration changes
$old_start_date = $old['start']->format('Y-m-d'); $old_start_date = $old['start']->format('Y-m-d');
$old_start_time = $old['allday'] ? '' : $old['start']->format('H:i'); $old_start_time = $old['allday'] ? '' : $old['start']->format('H:i');
$old_duration = $old['end']->format('U') - $old['start']->format('U'); $old_duration = $old['allday'] ? 0 : $old['end']->format('U') - $old['start']->format('U');
$new_start_date = $event['start']->format('Y-m-d'); $new_start_date = $event['start']->format('Y-m-d');
$new_start_time = $event['allday'] ? '' : $event['start']->format('H:i'); $new_start_time = $event['allday'] ? '' : $event['start']->format('H:i');
$new_duration = $event['end']->format('U') - $event['start']->format('U'); $new_duration = $event['allday'] ? 0 : $event['end']->format('U') - $event['start']->format('U');
$diff = $old_start_date != $new_start_date || $old_start_time != $new_start_time || $old_duration != $new_duration; $diff = $old_start_date != $new_start_date || $old_start_time != $new_start_time || $old_duration != $new_duration;
$date_shift = $old['start']->diff($event['start']); $date_shift = $old['start']->diff($event['start']);
@ -1173,6 +1173,7 @@ class kolab_driver extends calendar_driver
// when saving an instance in 'all' mode, copy recurrence exceptions over // when saving an instance in 'all' mode, copy recurrence exceptions over
if ($old['recurrence_id']) { if ($old['recurrence_id']) {
$event['recurrence']['EXCEPTIONS'] = $master['recurrence']['EXCEPTIONS']; $event['recurrence']['EXCEPTIONS'] = $master['recurrence']['EXCEPTIONS'];
$event['recurrence']['EXDATE'] = $master['recurrence']['EXDATE'];
} }
else if ($master['_instance']) { else if ($master['_instance']) {
$event['_instance'] = $master['_instance']; $event['_instance'] = $master['_instance'];