Przeglądaj źródła

- Fixed Trac #254: external fields specified as reconciliation keys were not automatically checked in the interactive mapping process.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@835 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 lat temu
rodzic
commit
36c24ebb1a
1 zmienionych plików z 4 dodań i 5 usunięć
  1. 4 5
      pages/ajax.csvimport.php

+ 4 - 5
pages/ajax.csvimport.php

@@ -321,7 +321,7 @@ switch($sOperation)
 		}
 		$oPage->add("</table>\n");
 		$aReconciliationKeys = MetaModel::GetReconcKeys($sClassName);
-		$aMoreReconciliationKeys = array();
+		$aMoreReconciliationKeys = array(); // Store: key => void to automatically remove duplicates
 		foreach($aReconciliationKeys as $sAttCode)
 		{
 			$oAttDef = MetaModel::GetAttributeDef($sClassName, $sAttCode);
@@ -329,7 +329,7 @@ switch($sOperation)
 			{
 				// An external key is specified as a reconciliation key: this means that all the reconciliation
 				// keys of this class are proposed to identify the target object
-				$aMoreReconciliationKeys = array_keys(GetMappingsForExtKey($sAttCode, $oAttDef, $bAdvanced));
+				$aMoreReconciliationKeys = array_merge($aMoreReconciliationKeys, GetMappingsForExtKey($sAttCode, $oAttDef, $bAdvanced));
 			}
 			elseif($oAttDef->IsExternalField())
 			{
@@ -337,11 +337,10 @@ switch($sOperation)
 				// since external fields are not writable, and thus never appears in the mapping form
 				$sKeyAttCode = $oAttDef->GetKeyAttCode();
 				$sTargetAttCode = $oAttDef->GetExtAttCode();
-				
-				$aMoreReconciliationKeys = array($sKeyAttCode.'->'.$sTargetAttCode);				
+				$aMoreReconciliationKeys[$sKeyAttCode.'->'.$sTargetAttCode] = '';			
 			}
 		}
-		$sDefaultKeys = '"'.implode('", "',array_merge($aReconciliationKeys,$aMoreReconciliationKeys)).'"';
+		$sDefaultKeys = '"'.implode('", "',array_merge($aReconciliationKeys, array_keys($aMoreReconciliationKeys))).'"';
 		$oPage->add_ready_script(
 <<<EOF
 		$('select[name^=field]').change( DoCheckMapping );