summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2013-06-24 10:54:40 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2013-06-24 10:54:40 (GMT)
commitd363efb7909b05c6e281d9eddd3821d6bafd5a13 (patch)
tree87373844e3160dd1c72b33ad496b353edfec6315 /plugins
parente0e9dc290005f8b58e1c9153b8905cce277b823b (diff)
downloadroundcubemail-plugins-kolab-d363efb7909b05c6e281d9eddd3821d6bafd5a13.tar.gz
Revert "Fix saving of recurrence exceptions for v2: create unique UIDs, correctly save this-and-future instances with (modified) recurrence rule"
This reverts commit eb715970740a17e8f379edfcabe0d16155e2e1b1.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/libkolab/lib/kolab_storage_folder.php39
1 files changed, 8 insertions, 31 deletions
diff --git a/plugins/libkolab/lib/kolab_storage_folder.php b/plugins/libkolab/lib/kolab_storage_folder.php
index 98f8511..cf2c8bd 100644
--- a/plugins/libkolab/lib/kolab_storage_folder.php
+++ b/plugins/libkolab/lib/kolab_storage_folder.php
@@ -717,35 +717,22 @@ class kolab_storage_folder
// save every exception as individual object
foreach((array)$object['recurrence']['EXCEPTIONS'] as $exception) {
- $exception['uid'] = self::recurrence_exception_uid($object['uid'], $exception['start']->format('Ymd'));
+ $exception['uid'] = $object['uid'] . '-' . $exception['start']->format('Ymd');
+ $exception['recurrence-id'] = $exception['start']->format('Y-m-d');
$exception['sequence'] = $object['sequence'] + 1;
- if ($exception['thisandfuture']) {
- $exception['recurrence'] = $object['recurrence'];
-
- // adjust the recurrence duration of the exception
- if ($object['recurrence']['COUNT']) {
- $recurrence = new kolab_date_recurrence($object['_formatobj']);
- if ($end = $recurrence->end()) {
- unset($exception['recurrence']['COUNT']);
- $exception['recurrence']['UNTIL'] = new DateTime('@'.$end);
- }
- }
+ unset($exception['recurrence'], $exception['organizer'], $exception['attendees']);
+ $this->save($exception, $type, $exception['uid']);
- // set UNTIL date if we have a thisandfuture exception
+ // set UNTIL date if we have a thisandfuture exception
+ if ($exception['thisandfuture']) {
$untildate = clone $exception['start'];
$untildate->sub(new DateInterval('P1D'));
$object['recurrence']['UNTIL'] = $untildate;
unset($object['recurrence']['COUNT']);
}
- else {
- if (!$exdates[$exception['start']->format('Y-m-d')])
- $object['recurrence']['EXDATE'][] = clone $exception['start'];
- unset($exception['recurrence']);
- }
-
- unset($exception['recurrence']['EXCEPTIONS'], $exception['_formatobj'], $exception['_msguid']);
- $this->save($exception, $type, $exception['uid']);
+ else if (!$exdates[$exception['start']->format('Y-m-d')])
+ $object['recurrence']['EXDATE'][] = clone $exception['start'];
}
unset($object['recurrence']['EXCEPTIONS']);
@@ -753,16 +740,6 @@ class kolab_storage_folder
}
/**
- * Generate an object UID with the given recurrence-ID in a way that it is
- * unique (the original UID is not a substring) but still recoverable.
- */
- private static function recurrence_exception_uid($uid, $recurrence_id)
- {
- $offset = -2;
- return substr($uid, 0, $offset) . '-' . $recurrence_id . '-' . substr($uid, $offset);
- }
-
- /**
* Delete the specified object from this folder.
*
* @param mixed $object The Kolab object to delete or object UID