summaryrefslogtreecommitdiff
path: root/plugins/calendar
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-02-20 08:25:24 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2015-02-20 08:25:24 (GMT)
commit515a7d9ef6dcdc1c1de2488745a511bdac256896 (patch)
tree0c9a3bba0fa6eec74fd2342b32c2991aca782b1b /plugins/calendar
parent02ef2e60505a6319599042c9e6e92a7a2f42de8c (diff)
downloadroundcubemail-plugins-kolab-515a7d9ef6dcdc1c1de2488745a511bdac256896.tar.gz
Small fixes to recurring event invitations (#4387)
Diffstat (limited to 'plugins/calendar')
-rw-r--r--plugins/calendar/calendar.php3
-rw-r--r--plugins/calendar/drivers/kolab/kolab_driver.php26
2 files changed, 24 insertions, 5 deletions
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index 8be5956..f6079db 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -1171,11 +1171,12 @@ class calendar extends rcube_plugin
$sent = $this->notify_attendees($master, null, $action, $event['_comment']);
if ($sent < 0)
$this->rc->output->show_message('calendar.errornotifying', 'error');
+
+ $event['attendees'] = $master['attendees']; // this tricks us into the next if clause
}
$event['id'] = $success;
$event['_savemode'] = 'all';
- $event['attendees'] = $master['attendees']; // this tricks us into the next if clause
$old = null;
}
diff --git a/plugins/calendar/drivers/kolab/kolab_driver.php b/plugins/calendar/drivers/kolab/kolab_driver.php
index d6fb55a..88c2a38 100644
--- a/plugins/calendar/drivers/kolab/kolab_driver.php
+++ b/plugins/calendar/drivers/kolab/kolab_driver.php
@@ -993,24 +993,37 @@ class kolab_driver extends calendar_driver
// remove recurrence exceptions on re-scheduling
if ($reschedule) {
- unset($event['recurrence']['EXCEPTIONS']);
+ unset($event['recurrence']['EXCEPTIONS'], $master['recurrence']['EXDATE']);
}
else if (is_array($event['recurrence']['EXCEPTIONS'])) {
// only keep relevant exceptions
$event['recurrence']['EXCEPTIONS'] = array_filter($event['recurrence']['EXCEPTIONS'], function($exception) use ($event) {
return $exception['start'] > $event['start'];
});
+ if (is_array($event['recurrence']['EXDATE'])) {
+ $event['recurrence']['EXDATE'] = array_filter($event['recurrence']['EXDATE'], function($exdate) use ($event) {
+ return $exdate > $event['start'];
+ });
+ }
}
// compute remaining occurrences
if ($event['recurrence']['COUNT']) {
if (!$old['_count'])
- $old['_count'] = $this->get_recurrence_count($object, $event['start']);
+ $old['_count'] = $this->get_recurrence_count($object, $old['start']);
$event['recurrence']['COUNT'] -= intval($old['_count']);
}
+ // remove fixed weekday when date changed
+ if ($old['start']->format('Y-m-d') != $event['start']->format('Y-m-d')) {
+ if (strlen($event['recurrence']['BYDAY']) == 2)
+ unset($event['recurrence']['BYDAY']);
+ if ($old['recurrence']['BYMONTH'] == $old['start']->format('n'))
+ unset($event['recurrence']['BYMONTH']);
+ }
+
// set until-date on master event
- $master['recurrence']['UNTIL'] = clone $event['start'];
+ $master['recurrence']['UNTIL'] = clone $old['start'];
$master['recurrence']['UNTIL']->sub(new DateInterval('P1D'));
unset($master['recurrence']['COUNT']);
@@ -1020,6 +1033,11 @@ class kolab_driver extends calendar_driver
return $exception['start'] < $event['start'];
});
}
+ if (is_array($master['recurrence']['EXDATE'])) {
+ $master['recurrence']['EXDATE'] = array_filter($master['recurrence']['EXDATE'], function($exdate) use ($event) {
+ return $exdate < $event['start'];
+ });
+ }
// save new event
if ($success = $storage->insert_event($event)) {
@@ -1115,7 +1133,7 @@ class kolab_driver extends calendar_driver
// when saving an instance in 'all' mode, copy recurrence exceptions over
if ($old['recurrence_id']) {
- $event['recurrence'] = $master['recurrence'];
+ $event['recurrence']['EXCEPTIONS'] = $master['recurrence']['EXCEPTIONS'];
}
// TODO: forward changes to exceptions (which do not yet have differing values stored)