summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-03-16 13:41:50 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2015-03-16 13:43:02 (GMT)
commitc51c60eff835bd396c4adbde4ace0527cbebf385 (patch)
tree0522e242bc61ed2fbcbf1d447897ed8034de5899
parent96442eae9d8f87a4a3ab2aee6b717dc0191d0a97 (diff)
downloadroundcubemail-plugins-kolab-c51c60eff835bd396c4adbde4ace0527cbebf385.tar.gz
Avoid fatal errors when setting recurrence until date for tasks (#4852)
-rw-r--r--plugins/libkolab/lib/kolab_format_task.php14
-rw-r--r--plugins/libkolab/lib/kolab_format_xcal.php19
2 files changed, 32 insertions, 1 deletions
diff --git a/plugins/libkolab/lib/kolab_format_task.php b/plugins/libkolab/lib/kolab_format_task.php
index 4640875..cb35f98 100644
--- a/plugins/libkolab/lib/kolab_format_task.php
+++ b/plugins/libkolab/lib/kolab_format_task.php
@@ -117,6 +117,20 @@ class kolab_format_task extends kolab_format_xcal
}
/**
+ * Return the reference date for recurrence and alarms
+ *
+ * @return mixed DateTime instance of null if no refdate is available
+ */
+ public function get_reference_date()
+ {
+ if ($this->data['due'] && $this->data['due'] instanceof DateTime) {
+ return $this->data['due'];
+ }
+
+ return self::php_datetime($this->obj->due()) ?: parent::get_reference_date();
+ }
+
+ /**
* Callback for kolab_storage_cache to get object specific tags to cache
*
* @return array List of tags to save in cache
diff --git a/plugins/libkolab/lib/kolab_format_xcal.php b/plugins/libkolab/lib/kolab_format_xcal.php
index 8c63b26..e7d1122 100644
--- a/plugins/libkolab/lib/kolab_format_xcal.php
+++ b/plugins/libkolab/lib/kolab_format_xcal.php
@@ -184,7 +184,10 @@ abstract class kolab_format_xcal extends kolab_format
$object['recurrence']['COUNT'] = $count;
}
else if ($until = self::php_datetime($rr->end())) {
- $until->setTime($object['start']->format('G'), $object['start']->format('i'), 0);
+ $refdate = $this->get_reference_date();
+ if ($refdate && $refdate instanceof DateTime && !$refdate->_dateonly) {
+ $until->setTime($refdate->format('G'), $refdate->format('i'), 0);
+ }
$object['recurrence']['UNTIL'] = $until;
}
@@ -568,6 +571,20 @@ abstract class kolab_format_xcal extends kolab_format
}
/**
+ * Return the reference date for recurrence and alarms
+ *
+ * @return mixed DateTime instance of null if no refdate is available
+ */
+ public function get_reference_date()
+ {
+ if ($this->data['start'] && $this->data['start'] instanceof DateTime) {
+ return $this->data['start'];
+ }
+
+ return self::php_datetime($this->obj->start());
+ }
+
+ /**
* Callback for kolab_storage_cache to get words to index for fulltext search
*
* @return array List of words to save in cache