summaryrefslogtreecommitdiff
path: root/plugins/libkolab
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-01-28 16:27:16 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2015-01-28 16:27:16 (GMT)
commit7fe08b2814ed99dc1cd186be16746e0be3c85140 (patch)
tree353fd85a0bfc78ec3ca94ea0e99006d95803ba09 /plugins/libkolab
parent859dc5ab9880ba270bae4d50c1e14a43baa08ee4 (diff)
downloadroundcubemail-plugins-kolab-7fe08b2814ed99dc1cd186be16746e0be3c85140.tar.gz
Cleanup recurrence exception data when saving events (#4318)
Diffstat (limited to 'plugins/libkolab')
-rw-r--r--plugins/libkolab/lib/kolab_format_event.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/libkolab/lib/kolab_format_event.php b/plugins/libkolab/lib/kolab_format_event.php
index da0e43a..8cad89a 100644
--- a/plugins/libkolab/lib/kolab_format_event.php
+++ b/plugins/libkolab/lib/kolab_format_event.php
@@ -96,11 +96,13 @@ class kolab_format_event extends kolab_format_xcal
// save recurrence exceptions
if (is_array($object['recurrence']) && $object['recurrence']['EXCEPTIONS']) {
$vexceptions = new vectorevent;
- foreach((array)$object['recurrence']['EXCEPTIONS'] as $exception) {
+ foreach((array)$object['recurrence']['EXCEPTIONS'] as $i => $exception) {
$exevent = new kolab_format_event;
- $exevent->set($this->compact_exception($exception)); // only save differing values
+ $exevent->set(($compacted = $this->compact_exception($exception, $object))); // only save differing values
$exevent->obj->setRecurrenceID(self::get_datetime($exception['start'], null, true), (bool)$exception['thisandfuture']);
$vexceptions->push($exevent->obj);
+ // write cleaned-up exception data back to memory/cache
+ $object['recurrence']['EXCEPTIONS'][$i] = $this->expand_exception($compacted, $object);
}
$this->obj->setExceptions($vexceptions);
}
@@ -207,7 +209,7 @@ class kolab_format_event extends kolab_format_xcal
/**
* Remove some attributes from the exception container
*/
- private function compact_exception($exception)
+ private function compact_exception($exception, $master)
{
$forbidden = array('recurrence','organizer','attendees','sequence');
@@ -217,6 +219,12 @@ class kolab_format_event extends kolab_format_xcal
}
}
+ foreach ($master as $prop => $value) {
+ if (isset($exception[$prop]) && gettype($exception[$prop]) == gettype($value) && $exception[$prop] == $value) {
+ unset($exception[$prop]);
+ }
+ }
+
return $exception;
}