gunnar: server/patches/horde-webmail/1.2.0 horde-webmail-1.2.0_kolab_openpkg.patch, 1.32.2.17, 1.32.2.18

cvs at kolab.org cvs at kolab.org
Tue Nov 10 10:59:10 CET 2009


Author: gunnar

Update of /kolabrepository/server/patches/horde-webmail/1.2.0
In directory doto:/tmp/cvs-serv4824/patches/horde-webmail/1.2.0

Modified Files:
      Tag: kolab_2_2_branch
	horde-webmail-1.2.0_kolab_openpkg.patch 
Log Message:
 kolab/issue3846 (fix recurring events that are counted per week and not per incident) and upstream http://bugs.horde.org/ticket/8546

Index: horde-webmail-1.2.0_kolab_openpkg.patch
===================================================================
RCS file: /kolabrepository/server/patches/horde-webmail/1.2.0/Attic/horde-webmail-1.2.0_kolab_openpkg.patch,v
retrieving revision 1.32.2.17
retrieving revision 1.32.2.18
diff -u -d -r1.32.2.17 -r1.32.2.18
--- horde-webmail-1.2.0_kolab_openpkg.patch	9 Nov 2009 22:52:03 -0000	1.32.2.17
+++ horde-webmail-1.2.0_kolab_openpkg.patch	10 Nov 2009 09:59:07 -0000	1.32.2.18
@@ -27765,6 +27765,203 @@
 Date:   Thu Nov 5 09:26:25 2009 +0100
 
     Imported patch from kolab/issue3844 (New user preference to specify order of date input fields)
+From: Gunnar Wrobel <p at rdus.de>
+Subject: [PATCH] t/kronolith/HK/GW/FixWeeklyRecurringEvents
+
+kronolith: fix recurring events that are counted per week and not per incident
+
+horde counts recurring events per week and not per incident. This gets a
+problem if a recurring event with more than one incident per week is defined.
+A recurring event with incidents on monday and friday with 3 incidents overall
+is displayed correctly with 3 incidents over one and a half week in kontact
+and Outlook. Without this patch horde displays 6 incidents over 3 weeks.
+
+Signed-off-by: Gunnar Wrobel <p at rdus.de>
+
+---
+ horde-webmail/kronolith/lib/Recurrence.php  |   57 ++++++++++++++++++++++++--
+ horde-webmail/lib/Horde/Date/Recurrence.php |   57 ++++++++++++++++++++++++--
+ 2 files changed, 104 insertions(+), 10 deletions(-)
+
+diff --git a/horde-webmail/kronolith/lib/Recurrence.php b/horde-webmail/kronolith/lib/Recurrence.php
+index f22351d..5aa5960 100644
+--- a/horde-webmail/kronolith/lib/Recurrence.php
++++ b/horde-webmail/kronolith/lib/Recurrence.php
+@@ -374,18 +374,65 @@ class Horde_Date_Recurrence {
+ 
+             $diff = Date_Calc::dateDiff($start_week->mday, $start_week->month, $start_week->year,
+                                         $after_week->mday, $after_week->month, $after_week->year);
+-            $recur = $diff + ($diff % ($this->recurInterval * 7));
+-            if ($this->recurCount &&
+-                ceil($recur / 7) / $this->recurInterval >= $this->recurCount) {
+-                return false;
++            $interval = $this->recurInterval * 7;
++            $repeats = floor($diff / $interval);
++            if ($diff % $interval < 7) {
++                $recur = $diff;
++            } else {
++                /**
++                 * If the after_week is not in the first week interval the
++                 * search needs to skip ahead a complete interval. The way it is
++                 * calculated here means that an event that occurs every second
++                 * week on Monday and Wednesday with the event actually starting
++                 * on Tuesday or Wednesday will only have one incidence in the
++                 * first week.
++                 */
++                $recur = $interval * ($repeats + 1);
+             }
++
++            if ($this->hasRecurCount()) {
++                $recurrences = 0;
++                /**
++                 * Correct the number of recurrences by the number of events
++                 * that lay between the start of the start week and the
++                 * recurrence start.
++                 */
++                $next = new Horde_Date($start_week);
++                while ($next->compareDateTime($this->start) < 0) {
++                    if ($this->recurOnDay((int)pow(2, $next->dayOfWeek()))) {
++                        $recurrences--;
++                    }
++                    ++$next->mday;
++                }
++                if ($repeats > 0) {
++                    $weekdays = $this->recurData;
++                    $total_recurrences_per_week = 0;
++                    while ($weekdays > 0) {
++                        if ($weekdays % 2) {
++                            $total_recurrences_per_week++;
++                        }
++                        $weekdays = ($weekdays - ($weekdays % 2)) / 2;
++                    }
++                    $recurrences += $total_recurrences_per_week * $repeats;
++                }
++            }
++
+             $next = $start_week;
+-            list($next->mday, $next->month, $next->year) = explode('/', Date_Calc::daysToDate(Date_Calc::dateToDays($next->mday, $next->month, $next->year) + $recur, '%e/%m/%Y'));
++            list($next->mday, $next->month, $next->year) = explode('/', Date_Calc::daysToDate(Date_Calc::dateToDays($next->mday, $next->month, $next->year) + $recur - 1, '%e/%m/%Y'));
+             $next = new Horde_Date($next);
+             while ($next->compareDateTime($after) < 0 &&
+                    $next->compareDateTime($after_week_end) < 0) {
+                 ++$next->mday;
+                 $next->correct();
++                if ($this->hasRecurCount()
++                    && $next->compareDateTime($after) < 0
++                    && $this->recurOnDay((int)pow(2, $next->dayOfWeek()))) {
++                    $recurrences++;
++                }
++            }
++            if ($this->hasRecurCount() &&
++                $recurrences >= $this->recurCount) {
++                return false;
+             }
+             if (!$this->hasRecurEnd() ||
+                 $next->compareDateTime($this->recurEnd) <= 0) {
+diff --git a/horde-webmail/lib/Horde/Date/Recurrence.php b/horde-webmail/lib/Horde/Date/Recurrence.php
+index 9dbf057..e21193f 100644
+--- a/horde-webmail/lib/Horde/Date/Recurrence.php
++++ b/horde-webmail/lib/Horde/Date/Recurrence.php
+@@ -374,18 +374,65 @@ class Horde_Date_Recurrence {
+ 
+             $diff = Date_Calc::dateDiff($start_week->mday, $start_week->month, $start_week->year,
+                                         $after_week->mday, $after_week->month, $after_week->year);
+-            $recur = $diff + ($diff % ($this->recurInterval * 7));
+-            if ($this->recurCount &&
+-                ceil($recur / 7) / $this->recurInterval >= $this->recurCount) {
+-                return false;
++            $interval = $this->recurInterval * 7;
++            $repeats = floor($diff / $interval);
++            if ($diff % $interval < 7) {
++                $recur = $diff;
++            } else {
++                /**
++                 * If the after_week is not in the first week interval the
++                 * search needs to skip ahead a complete interval. The way it is
++                 * calculated here means that an event that occurs every second
++                 * week on Monday and Wednesday with the event actually starting
++                 * on Tuesday or Wednesday will only have one incidence in the
++                 * first week.
++                 */
++                $recur = $interval * ($repeats + 1);
+             }
++
++            if ($this->hasRecurCount()) {
++                $recurrences = 0;
++                /**
++                 * Correct the number of recurrences by the number of events
++                 * that lay between the start of the start week and the
++                 * recurrence start.
++                 */
++                $next = new Horde_Date($start_week);
++                while ($next->compareDateTime($this->start) < 0) {
++                    if ($this->recurOnDay((int)pow(2, $next->dayOfWeek()))) {
++                        $recurrences--;
++                    }
++                    ++$next->mday;
++                }
++                if ($repeats > 0) {
++                    $weekdays = $this->recurData;
++                    $total_recurrences_per_week = 0;
++                    while ($weekdays > 0) {
++                        if ($weekdays % 2) {
++                            $total_recurrences_per_week++;
++                        }
++                        $weekdays = ($weekdays - ($weekdays % 2)) / 2;
++                    }
++                    $recurrences += $total_recurrences_per_week * $repeats;
++                }
++            }
++
+             $next = $start_week;
+-            list($next->mday, $next->month, $next->year) = explode('/', Date_Calc::daysToDate(Date_Calc::dateToDays($next->mday, $next->month, $next->year) + $recur, '%e/%m/%Y'));
++            list($next->mday, $next->month, $next->year) = explode('/', Date_Calc::daysToDate(Date_Calc::dateToDays($next->mday, $next->month, $next->year) + $recur - 1, '%e/%m/%Y'));
+             $next = new Horde_Date($next);
+             while ($next->compareDateTime($after) < 0 &&
+                    $next->compareDateTime($after_week_end) < 0) {
+                 ++$next->mday;
+                 $next->correct();
++                if ($this->hasRecurCount()
++                    && $next->compareDateTime($after) < 0
++                    && $this->recurOnDay((int)pow(2, $next->dayOfWeek()))) {
++                    $recurrences++;
++                }
++            }
++            if ($this->hasRecurCount() &&
++                $recurrences >= $this->recurCount) {
++                return false;
+             }
+             if (!$this->hasRecurEnd() ||
+                 $next->compareDateTime($this->recurEnd) <= 0) {
+-- 
+tg: (01f4e60..) t/kronolith/HK/GW/FixWeeklyRecurringEvents (depends on: t/kronolith/HK/UV/dateInputFieldOrder)
+-- 
+TOPGIT patch commit log
+=======================
+
+commit ecde0d9b33f53d7ed3a3d5bdd358118213d4abe1
+Author: Gunnar Wrobel <p at rdus.de>
+Date:   Tue Nov 10 10:38:20 2009 +0100
+
+    Another fix for another corner case.
+
+commit 3b0550f0c84354d9210fa097397af9cd424d8c35
+Author: Gunnar Wrobel <p at rdus.de>
+Date:   Tue Nov 10 09:46:38 2009 +0100
+
+    Fix another problem found when testing recurrences with multiple incidences per week.
+
+commit c5b9c97a29db689afadf411fa2eacce06b3e9022
+Author: Gunnar Wrobel <p at rdus.de>
+Date:   Tue Nov 10 08:09:47 2009 +0100
+
+    Remove stray patch file.
+
+commit 1d1005e3b0e81a0b74edaca7b242919e8f79336f
+Author: Gunnar Wrobel <p at rdus.de>
+Date:   Tue Nov 10 07:25:22 2009 +0100
+
+     kolab/issue3846 (fix recurring events that are counted per week and not per incident)
 diff -c a/horde-webmail/lib/Horde/Kolab/Storage/Folder.php b/horde-webmail/lib/Horde/Kolab/Storage/Folder.php
 --- a/horde-webmail/lib/Horde/Kolab/Storage/Folder.php
 +++ b/horde-webmail/lib/Horde/Kolab/Storage/Folder.php





More information about the commits mailing list