N°3905 - Polishing: CSV Import

This commit is contained in:
acognet
2021-06-17 11:16:31 +02:00
parent 77cf879f4f
commit 11f6c88ac7
8 changed files with 45 additions and 27 deletions

View File

@@ -120,7 +120,6 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo
$aChoices['id'] = Dict::S('UI:CSVImport:idField');
}
foreach (MetaModel::ListAttributeDefs($sClassName) as $sAttCode => $oAttDef) {
$sStar = '';
if ($oAttDef->IsExternalKey()) {
if (($sFieldName == $oAttDef->GetLabel()) || ($sFieldName == $sAttCode)) {
$sFieldCode = $sAttCode;
@@ -128,10 +127,6 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo
if ($bAdvancedMode) {
$aChoices[$sAttCode] = $oAttDef->GetLabel();
}
$oExtKeyAttDef = MetaModel::GetAttributeDef($sClassName, $oAttDef->GetKeyAttCode());
if (!$oExtKeyAttDef->IsNullAllowed()) {
$sStar = '*';
}
// Get fields of the external class that are considered as reconciliation keys
$sTargetClass = $oAttDef->GetTargetClass();
foreach (MetaModel::ListAttributeDefs($sTargetClass) as $sTargetAttCode => $oTargetAttDef) {
@@ -151,7 +146,7 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo
$aChoices[$sAttCode.'->'.$sTargetAttCode] = MetaModel::GetLabel($sClassName, $sAttCode.'->'.$sTargetAttCode, true);
foreach ($aSignatures as $sSignature) {
if (strcasecmp($sFieldName, $sSignature) == 0) {
$sFieldCode = $sAttCode.'->'.$sTargetAttCode.$sStar;
$sFieldCode = $sAttCode.'->'.$sTargetAttCode;
}
}
}