Fix converting all-day events to SIF-E.
authorJan Schneider <jan@horde.org>
Fri, 8 Oct 2010 16:51:34 +0000 (18:51 +0200)
committerJan Schneider <jan@horde.org>
Fri, 8 Oct 2010 16:51:34 +0000 (18:51 +0200)
framework/SyncML/SyncML/Device/Sync4j.php
framework/SyncML/tests/sif.phpt
horde/docs/CHANGES

index c941ff7..c2f69c1 100644 (file)
@@ -900,12 +900,17 @@ class SyncML_Device_sync4j extends SyncML_Device {
         if (!empty($start_params[0]['VALUE']) &&
             $start_params[0]['VALUE'] == 'DATE') {
             $hash['AllDayEvent'] = 1;
-            $hash['Start'] = $start->format('Y-m-d');
-            $start = $start->datestamp();
+            $hash['Start'] = sprintf('%04d-%02d-%02d',
+                                     $start['year'],
+                                     $start['month'],
+                                     $start['mday']);
+            $start = mktime(0, 0, 0,
+                            $start['month'],
+                            $start['mday'],
+                            $start['year']);
         } else {
             $hash['AllDayEvent'] = 0;
             $hash['Start'] = Horde_Icalendar::_exportDateTime($start);
-            $start = $start->timestamp();
         }
 
         foreach ($content->getAllAttributes() as $item) {
@@ -1098,7 +1103,7 @@ class SyncML_Device_sync4j extends SyncML_Device {
             } else {
                 // Parse VALARM components.
                 foreach ($content->getComponents() as $component) {
-                    if ($component->getType != 'vAlarm' ||
+                    if ($component->getType() != 'vAlarm' ||
                         is_a($trigger = $component->getAttribute('TRIGGER'), 'PEAR_Error') ||
                         is_array($trigger) ||
                         empty($trigger)) {
index 8c36b66..c5d47d1 100644 (file)
@@ -44,6 +44,37 @@ EVENT;
 echo $device->vevent2sif($data);
 echo "\n\n";
 
+$data = <<<EVENT
+BEGIN:VCALENDAR
+VERSION:2.0
+X-WR-CALNAME:cdillon's Calendar
+PRODID:-//The Horde Project//Horde_iCalendar Library//EN
+METHOD:PUBLISH
+BEGIN:VEVENT
+DTSTART;VALUE=DATE:20080630
+DTEND;VALUE=DATE:20080631
+DTSTAMP:20080630T201939Z
+UID:20080630151854.190949aaovgixvhq@www.wolves.k12.mo.us
+CREATED:20080630T201854Z
+LAST-MODIFIED:20080630T201854Z
+SUMMARY:Server02
+ORGANIZER;CN=Chris Dillon:mailto:cdillon@wolves.k12.mo.us
+CLASS:PUBLIC
+STATUS:CONFIRMED
+TRANSP:OPAQUE
+ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN="Dillon,
+  Chris":mailto:cdillon@wolves.k12.mo.us
+BEGIN:VALARM
+ACTION:DISPLAY
+TRIGGER;VALUE=DURATION:-PT15M
+END:VALARM
+END:VEVENT
+END:VCALENDAR
+EVENT;
+
+echo $device->vevent2sif($data);
+echo "\n\n";
+
 $data = <<<CONTACT
 <?xml version="1.0" encoding="UTF-8"?>
 <contact>
@@ -144,13 +175,15 @@ echo $device->sif2vcard($data);
 --EXPECT--
 <?xml version="1.0"?><appointment><ReminderSet>1</ReminderSet><IsRecurring>0</IsRecurring><BusyStatus>2</BusyStatus><AllDayEvent>0</AllDayEvent><Start>20080630T110000Z</Start><End>20080630T120000Z</End><Subject>Server02</Subject><Sensitivity>0</Sensitivity><ReminderMinutesBeforeStart>15</ReminderMinutesBeforeStart><Duration>60</Duration></appointment>
 
+<?xml version="1.0"?><appointment><ReminderSet>1</ReminderSet><IsRecurring>0</IsRecurring><BusyStatus>2</BusyStatus><AllDayEvent>1</AllDayEvent><Start>2008-06-30</Start><End>2008-06-30</End><Subject>Server02</Subject><Sensitivity>0</Sensitivity><ReminderMinutesBeforeStart>15</ReminderMinutesBeforeStart></appointment>
+
 BEGIN:VCARD
 VERSION:3.0
 FN:Lastname\, Firstname
 TEL;TYPE=WORK:+61 712341234
 TEL;TYPE=CELL:+61 123123123
 EMAIL:test@domain.com
-EMAIL:user@seconddomain.com
+EMAIL;TYPE=HOME:user@seconddomain.com
 NOTE:Comments\nMore comments\nAnd just a couple more
 BDAY:2008-10-18
 N:Lastname;Firstname;;;
index 1b89c87..fd1340a 100644 (file)
@@ -51,7 +51,9 @@ v4.0-cvs
 v3.3.10-cvs
 -----------
 
-[mms] Fix memcache cache regression introduced in v3.3.9 (Bug #9279).
+[jan] Fix conversion of all-day events and certain yearly recurring events for
+      Funambol clients.
+[mms] Fix memcache cache regression (Bug #9279).
 [jan] Fix SyncML page sometimes deleting more anchors than selected.