From 465498b36c6e4d34e1c18dba5623007cbbb90e2b Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 6 Feb 2012 16:23:33 +0000 Subject: [PATCH] - Return errors in timestamp formatting so they can be displayed to user - Make sure timestamps returned are timestamps, not DateTimes --- .../inc/class.importexport_import_csv.inc.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/importexport/inc/class.importexport_import_csv.inc.php b/importexport/inc/class.importexport_import_csv.inc.php index f36cb5e95b..5ee0a99744 100755 --- a/importexport/inc/class.importexport_import_csv.inc.php +++ b/importexport/inc/class.importexport_import_csv.inc.php @@ -321,12 +321,19 @@ class importexport_import_csv implements importexport_iface_import_record { //, if($format == 1) { $formatted = egw_time::createFromFormat( - egw_time::$user_dateformat . ', ' .egw_time::$user_timeformat, + egw_time::$user_dateformat . ' ' .egw_time::$user_timeformat, $record[$name] ); + if(!$formatted && $errors = egw_time::getLastErrors()) + { + foreach($errors['errors'] as $msg) + { + $warnings[] = $name . ': ' . $msg; + } + } if($errors = egw_time::getLastErrors() && $errors['error_count'] == 0) { - $record[$name] = $formatted; + $record[$name] = $formatted->getTimestamp(); } } @@ -346,7 +353,7 @@ class importexport_import_csv implements importexport_iface_import_record { //, $formatted = egw_time::createFromFormat(egw_time::$user_dateformat, $record[$name]); if($errors = egw_time::getLastErrors() && $errors['error_count'] == 0) { - $record[$name] = $formatted; + $record[$name] = $formatted->getTimestamp(); } } $record[$name] = egw_time::user2server($record[$name],'ts');