summaryrefslogtreecommitdiff
path: root/plugins/libkolab
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-02-16 10:00:26 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2015-02-16 10:00:26 (GMT)
commitaaaa9c58185d96a120893f2f3e3c361d44309e8a (patch)
tree5ee3517cfd462e1bf0b17813e3786f9e20739f31 /plugins/libkolab
parent8a74dc2d28aba4af89d123228fb638e4b4999dbd (diff)
downloadroundcubemail-plugins-kolab-aaaa9c58185d96a120893f2f3e3c361d44309e8a.tar.gz
Take differing parstat values in recurrence exceptions into account when querying for pending/declined/regular events:
- Colelct partstat tags from recurrence exceptions when caching - Querying for 'tags != x-partstat:<email>:needs-action' may miss some valid records - Do post-filtering on all events, including recurring instances
Diffstat (limited to 'plugins/libkolab')
-rw-r--r--plugins/libkolab/lib/kolab_format_event.php9
-rw-r--r--plugins/libkolab/lib/kolab_format_task.php15
-rw-r--r--plugins/libkolab/lib/kolab_format_xcal.php18
3 files changed, 26 insertions, 16 deletions
diff --git a/plugins/libkolab/lib/kolab_format_event.php b/plugins/libkolab/lib/kolab_format_event.php
index a5b0f73..0fda1e3 100644
--- a/plugins/libkolab/lib/kolab_format_event.php
+++ b/plugins/libkolab/lib/kolab_format_event.php
@@ -223,15 +223,16 @@ class kolab_format_event extends kolab_format_xcal
*
* @return array List of tags to save in cache
*/
- public function get_tags()
+ public function get_tags($obj = null)
{
- $tags = parent::get_tags();
+ $tags = parent::get_tags($obj);
+ $object = $obj ?: $this->data;
- foreach ((array)$this->data['categories'] as $cat) {
+ foreach ((array)$object['categories'] as $cat) {
$tags[] = rcube_utils::normalize_string($cat);
}
- return $tags;
+ return array_unique($tags);
}
/**
diff --git a/plugins/libkolab/lib/kolab_format_task.php b/plugins/libkolab/lib/kolab_format_task.php
index d3ddfe9..4640875 100644
--- a/plugins/libkolab/lib/kolab_format_task.php
+++ b/plugins/libkolab/lib/kolab_format_task.php
@@ -121,20 +121,21 @@ class kolab_format_task extends kolab_format_xcal
*
* @return array List of tags to save in cache
*/
- public function get_tags()
+ public function get_tags($obj = null)
{
- $tags = parent::get_tags();
+ $tags = parent::get_tags($obj);
+ $object = $obj ?: $this->data;
- if ($this->data['status'] == 'COMPLETED' || ($this->data['complete'] == 100 && empty($this->data['status'])))
+ if ($object['status'] == 'COMPLETED' || ($object['complete'] == 100 && empty($object['status'])))
$tags[] = 'x-complete';
- if ($this->data['priority'] == 1)
+ if ($object['priority'] == 1)
$tags[] = 'x-flagged';
- if ($this->data['parent_id'])
- $tags[] = 'x-parent:' . $this->data['parent_id'];
+ if ($object['parent_id'])
+ $tags[] = 'x-parent:' . $object['parent_id'];
- return $tags;
+ return array_unique($tags);
}
}
diff --git a/plugins/libkolab/lib/kolab_format_xcal.php b/plugins/libkolab/lib/kolab_format_xcal.php
index 6d49ad1..3d7bc27 100644
--- a/plugins/libkolab/lib/kolab_format_xcal.php
+++ b/plugins/libkolab/lib/kolab_format_xcal.php
@@ -611,23 +611,31 @@ abstract class kolab_format_xcal extends kolab_format
*
* @return array List of tags to save in cache
*/
- public function get_tags()
+ public function get_tags($obj = null)
{
$tags = array();
+ $object = $obj ?: $this->data;
- if (!empty($this->data['valarms'])) {
+ if (!empty($object['valarms'])) {
$tags[] = 'x-has-alarms';
}
// create tags reflecting participant status
- if (is_array($this->data['attendees'])) {
- foreach ($this->data['attendees'] as $attendee) {
+ if (is_array($object['attendees'])) {
+ foreach ($object['attendees'] as $attendee) {
if (!empty($attendee['email']) && !empty($attendee['status']))
$tags[] = 'x-partstat:' . $attendee['email'] . ':' . strtolower($attendee['status']);
}
}
- return $tags;
+ // collect tags from recurrence exceptions
+ if (is_array($object['recurrence']) && $object['recurrence']['EXCEPTIONS']) {
+ foreach((array)$object['recurrence']['EXCEPTIONS'] as $exception) {
+ $tags = array_merge($tags, $this->get_tags($exception));
+ }
+ }
+
+ return array_unique($tags);
}
/**