Branch 'dev/libcalendaring' - plugins/libkolab

Thomas Brüderli bruederli at kolabsys.com
Thu Nov 8 15:41:34 CET 2012


 plugins/libkolab/lib/kolab_date_recurrence.php |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit fa497d2dbbb4e87635c10651196f0a504e1a4f02
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Thu Nov 8 15:41:23 2012 +0100

    Fix recurrence computation using libkolab bindings

diff --git a/plugins/libkolab/lib/kolab_date_recurrence.php b/plugins/libkolab/lib/kolab_date_recurrence.php
index 0df96e0..3aaa399 100644
--- a/plugins/libkolab/lib/kolab_date_recurrence.php
+++ b/plugins/libkolab/lib/kolab_date_recurrence.php
@@ -30,6 +30,7 @@ class kolab_date_recurrence
     private /* kolab_format_xcal */ $object;
     private /* DateTime */ $start;
     private /* DateTime */ $next;
+    private /* cDateTime */ $cnext;
     private /* DateInterval */ $duration;
 
     /**
@@ -44,6 +45,7 @@ class kolab_date_recurrence
         $this->object = $object;
         $this->engine = $object->to_libcal();
         $this->start = $this->next = $data['start'];
+        $this->cnext = kolab_format::get_datetime($this->next);
 
         if (is_object($data['start']) && is_object($data['end']))
             $this->duration = $data['start']->diff($data['end']);
@@ -62,9 +64,10 @@ class kolab_date_recurrence
         $time = false;
 
         if ($this->engine && $this->next) {
-            $cstart = kolab_format::get_datetime($this->next);
-            if ($next = kolab_format::php_datetime(new cDateTime($this->engine->getNextOccurence($cstart)))) {
+            if (($cnext = new cDateTime($this->engine->getNextOccurence($this->cnext))) && $cnext->isValid()) {
+                $next = kolab_format::php_datetime($cnext);
                 $time = $timestamp ? $next->format('U') : $next;
+                $this->cnext = $cnext;
                 $this->next = $next;
             }
         }





More information about the commits mailing list