Send cancellations of this-and-future events as iTip REPLY on master event with updated recurrence rule (#4743)

This commit is contained in:
Thomas Bruederli 2015-03-10 13:38:53 +01:00
parent 2fe963f48f
commit 10192386dd
3 changed files with 23 additions and 10 deletions

View file

@ -849,8 +849,8 @@ class calendar extends rcube_plugin
if (($event['_notify'] || $event['_decline']) && $action != 'new') {
$old = $this->driver->get_event($event);
// load main event when savemode is 'all'
if ($event['_savemode'] == 'all' && $old['recurrence_id']) {
// load main event if savemode is 'all' or if deleting 'future' events
if (($event['_savemode'] == 'all' || ($event['_savemode'] == 'future' && $action == 'remove' && !$event['_decline'])) && $old['recurrence_id']) {
$old['id'] = $old['recurrence_id'];
$old = $this->driver->get_event($old);
}
@ -926,10 +926,15 @@ class calendar extends rcube_plugin
}
// send cancellation for the main event
if ($event['_savemode'] == 'all')
if ($event['_savemode'] == 'all') {
unset($old['_instance'], $old['recurrence_date'], $old['recurrence_id']);
else if ($event['_savemode'] == 'future')
$old['thisandfuture'] = true;
}
// send an update for the main event's recurrence rule instead of a cancellation message
else if ($event['_savemode'] == 'future' && $success !== false && $success !== true) {
$event['_savemode'] = 'all'; // force event_save_success() to load master event
$action = 'edit';
$success = true;
}
// send iTIP reply that participant has declined the event
if ($success && $event['_decline']) {
@ -943,6 +948,10 @@ class calendar extends rcube_plugin
}
}
if ($event['_savemode'] == 'future' && $event['id'] != $old['id']) {
$old['thisandfuture'] = true;
}
$itip = $this->load_itip();
$itip->set_sender_email($reply_sender);
if ($organizer && $itip->send_itip_message($old, 'REPLY', $organizer, 'itipsubjectdeclined', 'itipmailbodydeclined'))

View file

@ -2606,9 +2606,9 @@ function rcube_calendar_ui(settings)
if (event.recurrence) {
var future_disabled = '', message_label = (action == 'remove' ? 'removerecurringeventwarning' : 'changerecurringeventwarning');
// disable the 'future' savemode if attendees are involved
// reason: no calendaring system supports the thisandfuture range parameter
if (action == 'remove' && _has_attendees && is_organizer(event)) {
// disable the 'future' savemode if I'm an attendee
// reason: no calendaring system supports the thisandfuture range parameter in iTip REPLY
if (action == 'remove' && _has_attendees && !_is_organizer && is_attendee(event)) {
future_disabled = ' disabled';
}

View file

@ -748,6 +748,7 @@ class kolab_driver extends calendar_driver
*/
public function remove_event($event, $force = true)
{
$ret = true;
$success = false;
$savemode = $event['_savemode'];
$decline = $event['_decline'];
@ -821,7 +822,9 @@ class kolab_driver extends calendar_driver
break;
case 'future':
if ($master['id'] != $event['id']) {
$recurrence_id_format = $master['allday'] ? 'Ymd' : 'Ymd\THis';
$master['_instance'] = $master['start']->format($recurrence_id_format);
if ($master['_instance'] != $event['_instance']) {
$_SESSION['calendar_restore_event_data'] = $master;
// set until-date on master event
@ -844,6 +847,7 @@ class kolab_driver extends calendar_driver
}
$success = $storage->update_event($master);
$ret = $master['uid'];
break;
}
@ -875,7 +879,7 @@ class kolab_driver extends calendar_driver
if ($success && $this->freebusy_trigger)
$this->rc->output->command('plugin.ping_url', array('action' => 'calendar/push-freebusy', 'source' => $storage->id));
return $success;
return $success ? $ret : false;
}
/**