浏览代码

- Fixed Trac #254: use external fields as reconciliation keys.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@813 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 年之前
父节点
当前提交
c950239b66
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11 0
      pages/ajax.csvimport.php

+ 11 - 0
pages/ajax.csvimport.php

@@ -327,8 +327,19 @@ switch($sOperation)
 			$oAttDef = MetaModel::GetAttributeDef($sClassName, $sAttCode);
 			if ($oAttDef->IsExternalKey())
 			{
+				// 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));
 			}
+			elseif($oAttDef->IsExternalField())
+			{
+				// An external field is specified as a reconciliation key, translate the field into a field on the target class
+				// since external fields are not writable, and thus never appears in the mapping form
+				$sKeyAttCode = $oAttDef->GetKeyAttCode();
+				$sTargetAttCode = $oAttDef->GetExtAttCode();
+				
+				$aMoreReconciliationKeys = array($sKeyAttCode.'->'.$sTargetAttCode);				
+			}
 		}
 		$sDefaultKeys = '"'.implode('", "',array_merge($aReconciliationKeys,$aMoreReconciliationKeys)).'"';
 		$oPage->add_ready_script(