2 commits - plugins/libcalendaring plugins/libkolab

Thomas Brüderli bruederli at kolabsys.com
Wed Sep 25 17:57:25 CEST 2013


 plugins/libcalendaring/libvcalendar.php |    2 +-
 plugins/libkolab/lib/kolab_format.php   |    9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit a7d38bdf2741929cde7d27d1f566d9a988f0a1af
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Sep 25 17:34:51 2013 +0200

    Export 'changed' date as LAST-MODIFIED

diff --git a/plugins/libcalendaring/libvcalendar.php b/plugins/libcalendaring/libvcalendar.php
index f64499f..30ee3bb 100644
--- a/plugins/libcalendaring/libvcalendar.php
+++ b/plugins/libcalendaring/libvcalendar.php
@@ -675,7 +675,7 @@ class libvcalendar
         if (!empty($event['created']))
             $ve->add(self::datetime_prop('CREATED', $event['created'], true));
         if (!empty($event['changed']))
-            $ve->add(self::datetime_prop('DTSTAMP', $event['changed'], true));
+            $ve->add(self::datetime_prop('LAST-MODIFIED', $event['changed'], true));
         if (!empty($event['start']))
             $ve->add(self::datetime_prop('DTSTART', $event['start'], false, $event['allday']));
         if (!empty($event['end']))


commit 124ae35b06171605119954084b6bdb2106c3e99f
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Sep 25 17:34:05 2013 +0200

    Fix setting created time if missing

diff --git a/plugins/libkolab/lib/kolab_format.php b/plugins/libkolab/lib/kolab_format.php
index dc95c76..ec520e2 100644
--- a/plugins/libkolab/lib/kolab_format.php
+++ b/plugins/libkolab/lib/kolab_format.php
@@ -393,10 +393,11 @@ abstract class kolab_format
             $this->obj->setUid($object['uid']);
 
         // set some automatic values if missing
-        if (method_exists($this->obj, 'setCreated') && !$this->obj->created()) {
-            if (empty($object['created']))
-                $object['created'] = new DateTime('now', self::$timezone);
-            $this->obj->setCreated(self::get_datetime($object['created']));
+        if (empty($object['created']) && method_exists($this->obj, 'setCreated')) {
+            $cdt = $this->obj->created();
+            $object['created'] = $cdt && $cdt->isValid() ? self::php_datetime($cdt) : new DateTime('now', self::$timezone);
+            if (!$cdt || !$cdt->isValid())
+                $this->obj->setCreated(self::get_datetime($object['created']));
         }
 
         $object['changed'] = new DateTime('now', self::$timezone);




More information about the commits mailing list