From e9d5ae421605aa1262f7084043abde222c882d32 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 14 Apr 2011 16:58:28 +0000 Subject: [PATCH] Special formatting for date custom fields --- .../inc/class.importexport_import_csv.inc.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/importexport/inc/class.importexport_import_csv.inc.php b/importexport/inc/class.importexport_import_csv.inc.php index 41971e5452..b5ca42d354 100755 --- a/importexport/inc/class.importexport_import_csv.inc.php +++ b/importexport/inc/class.importexport_import_csv.inc.php @@ -303,10 +303,22 @@ class importexport_import_csv implements importexport_iface_import_record { //, } } foreach((array)$fields['date-time'] as $name) { - if ($record[$name] && !is_numeric($record[$name])) $record[$name] = egw_time::user2server($record[$name],'ts'); + if ($record[$name] && !is_numeric($record[$name])) { + $record[$name] = egw_time::user2server($record[$name],'ts'); + if(in_array($name, self::$cf_parse_cache[$appname][0]['date-time'])) { + // Custom fields stored in a particular format (from customfields_widget) + $record[$name] = date('Y-m-d H:i:s', $record[$name]); + } + } } foreach((array)$fields['date'] as $name) { - if ($record[$name] && !is_numeric($record[$name])) $record[$name] = egw_time::user2server($record[$name],'ts'); + if ($record[$name] && !is_numeric($record[$name])) { + $record[$name] = egw_time::user2server($record[$name],'ts'); + if(in_array($name, self::$cf_parse_cache[$appname][0]['date'])) { + // Custom fields stored in a particular format (from customfields_widget) + $record[$name] = date('Y-m-d', $record[$name]); + } + } } // Some custom methods for conversion