[Tickets #8474] Re: All day events cause crash with Funambol outlook connector

bugs at horde.org bugs at horde.org
Wed Aug 19 14:30:44 UTC 2009


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/8474
------------------------------------------------------------------------------
  Ticket             | 8474
  Updated By         | lst_hoe02 at kwsoft.de
  Summary            | All day events cause crash with Funambol outlook
                     | connector
  Queue              | SyncML
  Type               | Bug
  State              | Feedback
  Priority           | 2. Medium
  Milestone          |
  Patch              |
  Owners             |
------------------------------------------------------------------------------


lst_hoe02 at kwsoft.de (2009-08-19 10:30) wrote:

What about the following :
I have included the DTSTART case in the getAllAttributes() loop again  
to streamline the code and modified the DTEND case to use the same  
formating as the DTSTART. The variable "$start" is only used to  
compare against "$alarm" as far as i can see and this is working. The  
"$end" is only used to compute "Duration" which is no SIF-E attribute  
anyway as far as i can see??

--- lib/SyncML/Device/Sync4j.php.orig	2009-08-14 17:01:24.000000000 +0200
+++ lib/SyncML/Device/Sync4j.php	2009-08-19 16:26:18.000000000 +0200
@@ -829,7 +829,8 @@
          $hash = array('ReminderSet' => 0,
                        'IsRecurring' => 0,
                        'BusyStatus' => 2);
-        $alarm = null;
+        $alarm = $end = null;
+
          foreach ($content->getAllAttributes() as $item) {
              $GLOBALS['backend']->logMessage(
                  sprintf('Sync4j for name %s, value %s',
@@ -843,18 +844,19 @@
                  if (!empty($item['params']['VALUE']) &&
                      $item['params']['VALUE'] == 'DATE') {
                      $hash['AllDayEvent'] = 1;
-                    $hash['Start'] = sprintf('%04d-%02d-%02dT00:00:00Z',
-                                             $item['value']['year'],
-                                             $item['value']['month'],
-                                             $item['value']['mday']);
+                    $date = new Horde_Date(array('year' =>  
$item['value']['year'],
+                                                 'month' =>  
$item['value']['month'],
+                                                 'mday' =>  
$item['value']['mday']));
+                    $date->correct();
+                    $hash['Start'] = $date->format('Y-m-d');
                      $start = mktime(0, 0, 0,
                                      $item['value']['month'],
                                      $item['value']['mday'],
                                      $item['value']['year']);
                  } else {
                      $hash['AllDayEvent'] = 0;
-                    $hash['Start'] = Horde_iCalendar::_exportDateTime
-                        ($item['value']);
+                    $hash['Start'] = Horde_iCalendar::_exportDateTime(
+                        $item['value']);
                      $start = $item['value'];
                  }
                  break;
@@ -863,10 +865,12 @@
                  if (!empty($item['params']['VALUE']) &&
                      $item['params']['VALUE'] == 'DATE') {
                      $hash['AllDayEvent'] = 1;
-                    $hash['End'] = sprintf('%04d-%02d-%02dT00:00:00Z',
-                                           $item['value']['year'],
-                                           $item['value']['month'],
-                                           $item['value']['mday']);
+                    $date = new Horde_Date(array('year' =>  
$item['value']['year'],
+                                                 'month' =>  
$item['value']['month'],
+                                                 'mday' =>  
$item['value']['mday']));
+                    $date->mday--;
+                    $date->correct();
+                    $hash['End'] = $date->format('Y-m-d');
                      $end = mktime(0, 0, 0,
                                    $item['value']['month'],
                                    $item['value']['mday'],
@@ -983,13 +987,7 @@
                          $hash['DayOfWeekMask'] = $mask;
                      } else {
                          $hash['RecurrenceType'] = 2;
-                        $start = $content->getAttribute('DTSTART');
-                        if (!empty($start['params']['VALUE']) &&
-                            $start['params']['VALUE'] == 'DATE') {
-                            $hash['DayOfMonth'] = $start['value']['mday'];
-                        } else {
-                            $hash['DayOfMonth'] = date('j', $start);
-                        }
+                        $hash['DayOfMonth'] = date('j', $start);
                      }
                      break;







More information about the bugs mailing list