From 6b0852e90fddda28e2492362ab3521c600f018e3 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 16 Jul 2015 13:33:25 +0000 Subject: [PATCH] * InfoLog/CalDAV: fixed since last package (Horde_Icalendar update) not imported start, due and completed dates --- infolog/inc/class.infolog_ical.inc.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/infolog/inc/class.infolog_ical.inc.php b/infolog/inc/class.infolog_ical.inc.php index a474eb9930..365d395245 100644 --- a/infolog/inc/class.infolog_ical.inc.php +++ b/infolog/inc/class.infolog_ical.inc.php @@ -624,6 +624,17 @@ class infolog_ical extends infolog_bo return $result; } + /** + * Convert date(-array) to timestamp used in InfoLog + * + * @param int|array $date + * @return int + */ + protected static function date2ts($date) + { + return is_scalar($date) ? $date : egw_time::to($date, 'ts'); + } + /** * Convert VTODO into a eGW infolog entry * @@ -720,8 +731,7 @@ class infolog_ical extends infolog_bo } foreach ($component->getAllAttributes() as $attribute) { - //$attribute['value'] = trim($attribute['value']); - if (!strlen($attribute['value'])) continue; + if (!$attribute['value'] && $attribute['value'] !== '0') continue; switch ($attribute['name']) { @@ -768,15 +778,15 @@ class infolog_ical extends infolog_bo case 'DUE': // even as EGroupware only displays the date, we can still store the full value // unless infolog get's stored, it does NOT truncate the time - $taskData['info_enddate'] = $attribute['value']; + $taskData['info_enddate'] = self::date2ts($attribute['value']); break; case 'COMPLETED': - $taskData['info_datecompleted'] = $attribute['value']; + $taskData['info_datecompleted'] = self::date2ts($attribute['value']); break; case 'DTSTART': - $taskData['info_startdate'] = $attribute['value']; + $taskData['info_startdate'] = self::date2ts($attribute['value']); break; case 'PRIORITY':