N°8291 - CSV import - column name not automatically recognized in import when name ending by a space

This commit is contained in:
Anne-Cath
2025-03-31 11:16:42 +02:00
parent 84708fb327
commit 8b7005fbb3

View File

@@ -147,7 +147,7 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo
// When not in advanced mode do not allow to use reconciliation keys (on external keys) if they are themselves external keys !
$aChoices[$sAttCode.'->'.$sTargetAttCode] = MetaModel::GetLabel($sClassName, $sAttCode.'->'.$sTargetAttCode, true);
foreach ($aSignatures as $sSignature) {
if (strcasecmp($sFieldName, $sSignature) == 0) {
if (strcasecmp(trim($sFieldName), trim($sSignature)) == 0) {
$sFieldCode = $sAttCode.'->'.$sTargetAttCode;
}
}
@@ -160,7 +160,7 @@ function GetMappingForField($sClassName, $sFieldName, $iFieldIndex, $bAdvancedMo
|| ($oAttDef instanceof AttributeFriendlyName)
) {
$aChoices[$sAttCode] = MetaModel::GetLabel($sClassName, $sAttCode, true);
if (($sFieldName == $oAttDef->GetLabel()) || ($sFieldName == $sAttCode)) {
if (strcasecmp(trim($sFieldName), trim($oAttDef->GetLabel())) == 0 || (trim($sFieldName) == $sAttCode)) {
$sFieldCode = $sAttCode;
}
}