浏览代码

#702 The first implementation of this fiw was not incomplete (not compatible with some constraint queries)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2692 a333f486-631f-4898-b8df-5754b55c2be0
romainq 12 年之前
父节点
当前提交
57369a92a7
共有 1 个文件被更改,包括 27 次插入0 次删除
  1. 27 0
      core/dbobjectsearch.class.php

+ 27 - 0
core/dbobjectsearch.class.php

@@ -133,8 +133,35 @@ class DBObjectSearch
 		{
 			throw new Exception("Could not change the search class from '$sCurrClass' to '$sNewClass'. Only child classes are permitted.");
 		}
+
+		// Change for this node
+		//
 		$this->m_aSelectedClasses[$sAlias] = $sNewClass;
 		$this->m_aClasses[$sAlias] = $sNewClass;
+
+		// Change for all the related node (yes, this was necessary with some queries - strange effects otherwise)
+		//
+		foreach($this->m_aRelatedTo as $aRelatedTo)
+		{
+			$aRelatedTo['flt']->ChangeClass($sNewClass, $sAlias);
+		}
+		foreach($this->m_aPointingTo as $sExtKeyAttCode=>$aPointingTo)
+		{
+			foreach($aPointingTo as $iOperatorCode => $aFilter)
+			{
+				foreach($aFilter as $oExtFilter)
+				{
+					$oExtFilter->ChangeClass($sNewClass, $sAlias);
+				}
+			}
+		}
+		foreach($this->m_aReferencedBy as $sForeignClass => $aReferences)
+		{
+			foreach($aReferences as $sForeignExtKeyAttCode => $oForeignFilter)
+			{
+				$oForeignFilter->ChangeClass($sNewClass, $sAlias);
+			}
+		}
 	}
 
 	public function SetSelectedClasses($aNewSet)