summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-08-25 23:01:15 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-08-25 23:01:15 (GMT)
commit70b2e7c805b3aae17daa85c996c2cae912fb3f8a (patch)
tree9ba3a58ee58899cc406d27f7fb05bb61f61feb2f
parent9899d1e67e7acb939d052ef9c6834f71b4980057 (diff)
downloadkolab-syncroton-70b2e7c805b3aae17daa85c996c2cae912fb3f8a.tar.gz
Support kolab tasks/notes object's categories for backward compat.
-rw-r--r--lib/kolab_sync_data.php9
-rw-r--r--lib/kolab_sync_data_notes.php2
-rw-r--r--lib/kolab_sync_data_tasks.php2
3 files changed, 9 insertions, 4 deletions
diff --git a/lib/kolab_sync_data.php b/lib/kolab_sync_data.php
index ac452b1..09956c2 100644
--- a/lib/kolab_sync_data.php
+++ b/lib/kolab_sync_data.php
@@ -1635,13 +1635,18 @@ abstract class kolab_sync_data implements Syncroton_Data_IData
/**
* Returns list of tag names assigned to kolab object
*/
- protected function getKolabTags($uid)
+ protected function getKolabTags($uid, $categories = null)
{
$config = kolab_storage_config::get_instance();
$tags = $config->get_tags($uid);
$tags = array_filter(array_map(function($v) { return $v['name']; }, $tags));
- return !empty($tags) ? $tags : null;
+ // merge result with old categories
+ if (!empty($categories)) {
+ $tags = array_unique(array_merge($tags, (array) $categories));
+ }
+
+ return $tags;
}
/**
diff --git a/lib/kolab_sync_data_notes.php b/lib/kolab_sync_data_notes.php
index 8c6ad92..480da1d 100644
--- a/lib/kolab_sync_data_notes.php
+++ b/lib/kolab_sync_data_notes.php
@@ -112,7 +112,7 @@ class kolab_sync_data_notes extends kolab_sync_data
$result['messageClass'] = 'IPM.StickyNote';
// convert kolab tags into categories
- $result['categories'] = $this->getKolabTags($note['uid']);
+ $result['categories'] = $this->getKolabTags($note['uid'], $result['categories']);
return $as_array ? $result : new Syncroton_Model_Note($result);
}
diff --git a/lib/kolab_sync_data_tasks.php b/lib/kolab_sync_data_tasks.php
index 5e20178..61beb7c 100644
--- a/lib/kolab_sync_data_tasks.php
+++ b/lib/kolab_sync_data_tasks.php
@@ -156,7 +156,7 @@ class kolab_sync_data_tasks extends kolab_sync_data
}
// convert kolab tags into categories
- $result['categories'] = $this->getKolabTags($task['uid']);
+ $result['categories'] = $this->getKolabTags($task['uid'], $result['categories']);
// Recurrence
$this->recurrence_from_kolab($collection, $task, $result, 'Task');