Load applications translations for header check, add field name to invalid user warning

This commit is contained in:
Nathan Gray 2013-04-04 16:47:39 +00:00
parent 051c724e37
commit 2f7af7fa25
2 changed files with 8 additions and 2 deletions

View File

@ -368,7 +368,7 @@ class importexport_import_csv implements importexport_iface_import_record { //,
if(count($new_owner) != count(explode(',',$record[$name])))
{
// Unable to parse value into account
$warnings[] = lang('%1 is not a known user or group', $record[$name]);
$warnings[] = $name . ': ' .lang('%1 is not a known user or group', $record[$name]);
}
if($new_owner != '') {
$record[$name] = $new_owner;

View File

@ -43,6 +43,11 @@
$appname = $_GET['appname'] ? $_GET['appname'] : $content['appname'];
$definition = $_GET['definition'] ? $_GET['definition'] : $content['definition'];
// Load application's translations
if($appname)
{
translation::add_app($appname);
}
if($content['import'] && $definition) {
try {
$definition_obj = new importexport_definition($content['definition']);
@ -356,7 +361,8 @@
// Skipped column in definition
continue;
}
elseif($index < count($options['csv_fields']) && strtoupper($options['csv_fields'][$index]) != strtoupper($header) && strtoupper(lang($options['csv_fields'][$index])) != strtoupper($header))
// Check column headers, taking into account different translations
elseif($index < count($options['csv_fields']) && strtoupper($options['csv_fields'][$index]) != strtoupper($header) && strtoupper(lang($options['csv_fields'][$index])) != strtoupper($header) && strtoupper($options['csv_fields'][$index]) != strtoupper(lang($header)))
{
// Problem
$message[] = lang("Column mismatch: %1 should be %2, not %3",