Use mapped columns instead of original file columns to verify file. Still not perfect, but maybe better?

This commit is contained in:
Nathan Gray 2012-10-09 15:53:45 +00:00
parent 72e6f6f8f4
commit d7316f76ad

View File

@ -294,11 +294,11 @@
$data = translation::convert($data,$options['charset']);
$ok = true;
if(max(array_keys($data)) != max(array_keys($options['csv_fields'])))
if(count($data) != count($options['field_mapping']))
{
$message[] = lang("Column mismatch. Expected %1 columns, your file has %2.",
max(array_keys($options['csv_fields'])),
max(array_keys($data))
count($options['field_mapping']),
count($data)
);
$ok = false;
}
@ -309,7 +309,7 @@
// Skipped column in definition
continue;
}
elseif($index < count($options['csv_fields']) && $options['csv_fields'][$index] != $header)
elseif($index < count($options['csv_fields']) && strtoupper($options['csv_fields'][$index]) != strtoupper($header))
{
// Problem
$message[] = lang("Column mismatch: %1 should be %2, not %3",