From eaef495288ed621ed5cebd0787a72b5b7c23efc2 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Wed, 29 Sep 2010 16:28:03 +0200 Subject: [PATCH] MFB: Fix setting start dates. Yearly recurrences don't allow intervals. --- framework/SyncML/SyncML/Device/Sync4j.php | 36 +++++++++++++------------------ 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/framework/SyncML/SyncML/Device/Sync4j.php b/framework/SyncML/SyncML/Device/Sync4j.php index cef52c60a..d1f440976 100644 --- a/framework/SyncML/SyncML/Device/Sync4j.php +++ b/framework/SyncML/SyncML/Device/Sync4j.php @@ -896,23 +896,16 @@ class SyncML_Device_sync4j extends SyncML_Device { 'BusyStatus' => 2); $alarm = $end = null; $start = $content->getAttribute('DTSTART'); - if ($start) { - if (!empty($start['params']['VALUE']) && - $start['params']['VALUE'] == 'DATE') { - $hash['AllDayEvent'] = 1; - $hash['Start'] = sprintf('%04d-%02d-%02d', - $start['value']['year'], - $start['value']['month'], - $start['value']['mday']); - $start = mktime(0, 0, 0, - $start['value']['month'], - $start['value']['mday'], - $start['value']['year']); - } else { - $hash['AllDayEvent'] = 0; - $hash['Start'] = Horde_Icalendar::_exportDateTime($start); - $start = $start; - } + $start_params = $content->getAttribute('DTSTART', true); + if (!empty($start_params[0]['VALUE']) && + $start_params[0]['VALUE'] == 'DATE') { + $hash['AllDayEvent'] = 1; + $hash['Start'] = $start->format('Y-m-d'); + $start = $start->datestamp(); + } else { + $hash['AllDayEvent'] = 0; + $hash['Start'] = Horde_Icalendar::_exportDateTime($start); + $start = $start->timestamp(); } foreach ($content->getAllAttributes() as $item) { @@ -1028,6 +1021,10 @@ class SyncML_Device_sync4j extends SyncML_Device { } } + $hash['Interval'] = isset($rdata['INTERVAL']) + ? $rdata['INTERVAL'] + : 1; + switch (Horde_String::upper($rdata['FREQ'])) { case 'DAILY': $hash['RecurrenceType'] = 0; @@ -1061,13 +1058,10 @@ class SyncML_Device_sync4j extends SyncML_Device { $hash['DayOfMonth'] = date('j', $start); } $hash['MonthOfYear'] = date('n', $start); + unset($hash['Interval']); break; } - $hash['Interval'] = isset($rdata['INTERVAL']) - ? $rdata['INTERVAL'] - : 1; - if (isset($rdata['UNTIL'])) { $hash['NoEndDate'] = 0; $hash['PatternEndDate'] = $rdata['UNTIL']; -- 2.11.0