瀏覽代碼

Support several successive renaming of the same object

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1980 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 13 年之前
父節點
當前提交
573ba1765f
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      setup/modelfactory.class.inc.php

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

@@ -1595,7 +1595,15 @@ class MFElement extends DOMElement
 	 */	
 	public function Rename($sId)
 	{
-		$this->setAttribute('_old_id', $this->getAttribute('id'));
+		$sOriginalId = $this->getAttribute('_old_id');
+		if ($sOriginalId == '')
+		{
+			$this->setAttribute('_old_id', $this->getAttribute('id'));
+		}
+		else if($sOriginalId == $sId)
+		{
+			$this->removeAttribute('_old_id');
+		}
 		$this->setAttribute('id', $sId);
 	}
 }