summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2012-11-14 15:02:56 (GMT)
committerThomas Bruederli <thomas@roundcube.net>2012-11-14 15:02:56 (GMT)
commitbfc961ba2fd0fbe3caadb4c2cc7f9faa8cc3461d (patch)
tree212b488f78685993e8437722761c5a93f5155421
parent92eb064f4ff5a5507b9f9b5c9e5351a53e08f27d (diff)
downloadroundcubemail-plugins-kolab-roundcubemail-plugins-kolab-format2.tar.gz
Support percentage values for task completeness according to spec (requires patch on Horde classes)roundcubemail-plugins-kolab-format2
-rw-r--r--plugins/libkolab/lib/kolab_format_task.php15
1 files changed, 7 insertions, 8 deletions
diff --git a/plugins/libkolab/lib/kolab_format_task.php b/plugins/libkolab/lib/kolab_format_task.php
index eb0f2ee..b1f02a0 100644
--- a/plugins/libkolab/lib/kolab_format_task.php
+++ b/plugins/libkolab/lib/kolab_format_task.php
@@ -74,7 +74,7 @@ class kolab_format_task extends kolab_format
if ($kolab_status = $status_map[$object['status']])
$this->kolab_object['status'] = $kolab_status;
- $this->kolab_object['due'] = $this->kolab_object['start'] = 0;
+ $this->kolab_object['due'] = $this->kolab_object['start'] = null;
if ($object['due']) {
$dtdue = clone $object['due'];
$dtdue->setTimezone(new DateTimeZone('UTC'));
@@ -91,13 +91,13 @@ class kolab_format_task extends kolab_format
}
// set 'completed-date' on transition
- if (!$this->kolab_object['complete'] && $object['status'] == 'COMPLETED')
+ if ($this->kolab_object['complete'] < 100 && $object['status'] == 'COMPLETED')
$this->kolab_object['completed-date'] = time();
if ($object['status'] == 'COMPLETED' || $object['complete'] == 100)
$this->kolab_object['completed'] = true;
- else if ($object['status'] != 'COMPLETED' && $this->kolab_object['completed'])
- $this->kolab_object['completed'] = 0;
+ else if ($object['status'] != 'COMPLETED')
+ $this->kolab_object['completed'] = intval($object['complete']);
// handle alarms
$this->kolab_object['alarm'] = self::to_kolab2_alarm($object['alarms']);
@@ -123,7 +123,7 @@ class kolab_format_task extends kolab_format
$object = array(
'uid' => $record['uid'],
'dtstamp' => $record['last-modification-date'],
- 'complete' => 0,
+ 'complete' => intval($record['completed']),
);
// map basic fields rcube => $kolab
@@ -131,12 +131,11 @@ class kolab_format_task extends kolab_format
$object[$rcube] = $record[$kolab];
}
- if ($record['completed']) {
+ if ($record['completed'] === true || $record['completed'] == 100) {
$object['status'] = 'COMPLETED';
- $object['complete'] = 100;
}
- $object['categories'] = array_filter(explode(',', $record['categories']));
+ $object['categories'] = array_filter(explode(',', $record['_categories_all'] ? $record['_categories_all'] : $record['categories']));
if ($record['due']) {
$object['due'] = new DateTime('@'.$record['due']);