If field is not in the list of fields to be imported, do not add it in as null - could overwrite existing data

This commit is contained in:
Nathan Gray 2012-04-24 15:46:25 +00:00
parent 6c6259525a
commit 19ab4d3f4c

View File

@ -368,7 +368,7 @@ class importexport_import_csv implements importexport_iface_import_record { //,
$record[$name] = date('Y-m-d H:i:s', $record[$name]); $record[$name] = date('Y-m-d H:i:s', $record[$name]);
} }
} }
if(strlen(trim($record[$name])) == 0) if(array_key_exists($name, $record) && strlen(trim($record[$name])) == 0)
{ {
$record[$name] = null; $record[$name] = null;
} }
@ -392,7 +392,7 @@ class importexport_import_csv implements importexport_iface_import_record { //,
$record[$name] = date('Y-m-d', $record[$name]); $record[$name] = date('Y-m-d', $record[$name]);
} }
} }
if(strlen(trim($record[$name])) == 0) if(array_key_exists($name, $record) && strlen(trim($record[$name])) == 0)
{ {
$record[$name] = null; $record[$name] = null;
} }