diff --git a/importexport/inc/class.importexport_export_csv.inc.php b/importexport/inc/class.importexport_export_csv.inc.php index 9bcbb60dc2..0c60db42f8 100644 --- a/importexport/inc/class.importexport_export_csv.inc.php +++ b/importexport/inc/class.importexport_export_csv.inc.php @@ -391,9 +391,13 @@ class importexport_export_csv implements importexport_iface_export_record if (empty($dec_separator)) $dec_separator = '.'; $thousands_separator = $GLOBALS['egw_info']['user']['preferences']['common']['number_format'][1]; } - if($record->name && (string)$record->$name != '') + if($record->$name && (string)$record->$name != '') { - $record->name = number_format(str_replace(' ','',$record->name), 2, + if(!is_numeric($record->$name)) + { + $record->$name = floatval(str_replace($dec_separator, '.', preg_replace('/[^\d'.preg_quote($dec_separator).']/', '', $record->$name))); + } + $record->$name = number_format(str_replace(' ','',$record->$name), 2, $dec_separator,$thousands_separator ); } diff --git a/importexport/inc/class.importexport_import_csv.inc.php b/importexport/inc/class.importexport_import_csv.inc.php index bb62330eab..24d9d715fa 100755 --- a/importexport/inc/class.importexport_import_csv.inc.php +++ b/importexport/inc/class.importexport_import_csv.inc.php @@ -464,6 +464,14 @@ class importexport_import_csv implements importexport_iface_import_record { //, $record[$name] = null; } } + foreach((array)$fields['float'] as $name) + { + if($record[$name] != null && $record[$name] != '') { + $dec_point = $GLOBALS['egw_info']['user']['preferences']['common']['number_format'][0]; + if (empty($dec_point)) $dec_point = '.'; + $record[$name] = floatval(str_replace($dec_point, '.', preg_replace('/[^\d'.preg_quote($dec_point).']/', '', $record[$name]))); + } + } // Some custom methods for conversion foreach((array)$methods as $name => $method) {