summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-02-20 11:32:20 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2015-02-20 11:32:20 (GMT)
commitb41f2a05cb0d4fd67f5b65d00132c271d19a68b0 (patch)
tree16ab4c72c8e6a0e2f2f1989aaf99903f34e0eac1 /plugins
parent928e4131c463d8176256dda5c3221f4d0567ba09 (diff)
downloadroundcubemail-plugins-kolab-b41f2a05cb0d4fd67f5b65d00132c271d19a68b0.tar.gz
Fix rescheduling and notification on change of recurrence rules
Diffstat (limited to 'plugins')
-rw-r--r--plugins/calendar/calendar.php4
-rw-r--r--plugins/libkolab/lib/kolab_format_xcal.php11
2 files changed, 11 insertions, 4 deletions
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index f6079db..b67d84c 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -1185,8 +1185,8 @@ class calendar extends rcube_plugin
$_savemode = $event['_savemode'];
// send notification for the main event when savemode is 'all'
- if ($action != 'remove' && $_savemode == 'all' && $old['recurrence_id']) {
- $event['id'] = $old['recurrence_id'];
+ if ($action != 'remove' && $_savemode == 'all' && ($event['recurrence_id'] || $old['recurrence_id'] || ($old && $old['id'] != $event['id']))) {
+ $event['id'] = $event['recurrence_id'] ?: ($old['recurrence_id'] ?: $old['id']);
$event = $this->driver->get_event($event);
unset($event['_instance'], $event['recurrence_date']);
}
diff --git a/plugins/libkolab/lib/kolab_format_xcal.php b/plugins/libkolab/lib/kolab_format_xcal.php
index 4d3a758..3a9ad1f 100644
--- a/plugins/libkolab/lib/kolab_format_xcal.php
+++ b/plugins/libkolab/lib/kolab_format_xcal.php
@@ -662,10 +662,17 @@ abstract class kolab_format_xcal extends kolab_format
$b = $b->format('Y-m-d');
}
if ($prop == 'recurrence' && is_array($a) && is_array($b)) {
- unset($a['EXCEPTIONS']);
- unset($b['EXCEPTIONS']);
+ unset($a['EXCEPTIONS'], $b['EXCEPTIONS']);
$a = array_filter($a);
$b = array_filter($b);
+
+ // advanced rrule comparison: no rescheduling if series was shortened
+ if ($a['COUNT'] && $b['COUNT'] && $b['COUNT'] < $a['COUNT']) {
+ unset($a['COUNT'], $b['COUNT']);
+ }
+ else if ($a['UNTIL'] && $b['UNTIL'] && $b['UNTIL'] < $a['UNTIL']) {
+ unset($a['UNTIL'], $b['UNTIL']);
+ }
}
if ($a != $b) {
$reschedule = true;