浏览代码

Compiler and co: fixed issue on delta load (delete then merge a node)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1964 a333f486-631f-4898-b8df-5754b55c2be0
romainq 13 年之前
父节点
当前提交
428cc12bc2
共有 1 个文件被更改,包括 13 次插入1 次删除
  1. 13 1
      setup/modelfactory.class.inc.php

+ 13 - 1
setup/modelfactory.class.inc.php

@@ -1652,7 +1652,19 @@ class MFElement extends DOMElement
 	public function MergeInto($oContainer, $sSearchId, $bMustExist)
 	public function MergeInto($oContainer, $sSearchId, $bMustExist)
 	{
 	{
 		$oTargetNode = $oContainer->FindExistingChildNode($this, $sSearchId);
 		$oTargetNode = $oContainer->FindExistingChildNode($this, $sSearchId);
-		if (!$oTargetNode)
+		if ($oTargetNode)
+		{
+			if ($oTargetNode->getAttribute('_alteration') == 'removed')
+			{
+				if ($bMustExist)
+				{
+					throw new Exception("XML datamodel loader: found mandatory node $this->tagName/$sSearchId marked as deleted in $oContainer->tagName");
+				}
+				$oTargetNode = $oContainer->ownerDocument->ImportNode($this, false);
+				$oContainer->AddChildNode($oTargetNode);
+			}
+		}
+		else
 		{
 		{
 			if ($bMustExist)
 			if ($bMustExist)
 			{
 			{