From 77a3d0ed3235fb39347f5eb5ed8af223163afb23 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 7 Jun 2023 11:50:23 -0600 Subject: [PATCH] Importexport: Fix import definition field mapping had trouble with translations --- ...portexport_wizard_basic_import_csv.inc.php | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/importexport/inc/class.importexport_wizard_basic_import_csv.inc.php b/importexport/inc/class.importexport_wizard_basic_import_csv.inc.php index d093da95ed..14ba12c200 100644 --- a/importexport/inc/class.importexport_wizard_basic_import_csv.inc.php +++ b/importexport/inc/class.importexport_wizard_basic_import_csv.inc.php @@ -158,12 +158,23 @@ class importexport_wizard_basic_import_csv if($GLOBALS['egw_info']['user']['preferences']['common']['lang'] != 'en' && !isset($english[$field_name])) { $msg_id = Api\Translation::get_message_id($field_name, $content['application']); } - if($msg_id) { + if($msg_id) + { $english[$field_name] = Api\Translation::read('en', $content['application'], $msg_id); - } else { + } + else + { $english[$field_name] = false; } - if($english[$field_name] && strcasecmp($field, $english[$field_name]) == 0) { + if($english[$field_name] && strcasecmp($field, $english[$field_name]) == 0) + { + $content['field_mapping'][$index] = $key; + continue 2; + } + + // Check for field name translated + if($field == Api\Translation::translate($field_name)) + { $content['field_mapping'][$index] = $key; continue 2; } @@ -171,9 +182,10 @@ class importexport_wizard_basic_import_csv // Check for similar but slightly different $match = 0; if(similar_text(strtolower($field), strtolower($field_name), $match) && - $match > 85 && - $match > $best_match_value - ) { + $match > 85 && + $match > $best_match_value + ) + { $best_match = $key; $best_match_value = $match; }