Fix saving of recurring events

This commit is contained in:
Thomas 2011-09-23 13:01:16 +02:00
parent e80490a9c7
commit 0736805de6
2 changed files with 8 additions and 6 deletions

View file

@ -341,7 +341,7 @@ class database_driver extends calendar_driver
$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;
// shifted or resized // shifted or resized
if ($diff && $event['id'] != $master['id'] && ($old_start_date == $new_start_date || $old_duration == $new_duration)) { if ($diff && ($old_start_date == $new_start_date || $old_duration == $new_duration)) {
$event['start'] = $master['start'] + ($event['start'] - $old['start']); $event['start'] = $master['start'] + ($event['start'] - $old['start']);
$event['end'] = $event['start'] + $new_duration; $event['end'] = $event['start'] + $new_duration;
} }

View file

@ -670,15 +670,17 @@ class kolab_driver extends calendar_driver
$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;
// shifted or resized // shifted or resized
if ($diff && $event['id'] != $master['id'] && ($old_start_date == $new_start_date || $old_duration == $new_duration)) { if ($diff && ($old_start_date == $new_start_date || $old_duration == $new_duration)) {
$event['start'] = $master['start'] + ($event['start'] - $old['start']); $event['start'] = $master['start'] + ($event['start'] - $old['start']);
$event['end'] = $event['start'] + $new_duration; $event['end'] = $event['start'] + $new_duration;
// remove fixed weekday, will be re-set to the new weekday in kolab_calendar::update_event() // remove fixed weekday, will be re-set to the new weekday in kolab_calendar::update_event()
if (strlen($event['recurrence']['BYDAY']) == 2) if ($old_start_date != $new_start_date) {
unset($event['recurrence']['BYDAY']); if (strlen($event['recurrence']['BYDAY']) == 2)
if ($old['recurrence']['BYMONTH'] == gmdate('n', $old['start'])) unset($event['recurrence']['BYDAY']);
unset($event['recurrence']['BYMONTH']); if ($old['recurrence']['BYMONTH'] == gmdate('n', $old['start']))
unset($event['recurrence']['BYMONTH']);
}
} }
$success = $storage->update_event($event); $success = $storage->update_event($event);