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

This commit is contained in:
Nathan Gray 2013-04-22 15:07:54 +00:00
parent 70f4343fcf
commit 9366bced65
2 changed files with 8 additions and 2 deletions

View File

@ -367,7 +367,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']);
@ -341,7 +346,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",