瀏覽代碼

#932: fixed a regression introduced by [r3319]... in case a criteria is present several times.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3344 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 10 年之前
父節點
當前提交
91df8ed4c8
共有 2 個文件被更改,包括 6 次插入8 次删除
  1. 5 2
      core/dbobjectset.class.php
  2. 1 6
      core/expression.class.inc.php

+ 5 - 2
core/dbobjectset.class.php

@@ -1098,8 +1098,11 @@ class DBObjectSet
 		{
 		{
 			foreach($aVals as $sCode => $oExpr)
 			foreach($aVals as $sCode => $oExpr)
 			{
 			{
-				$oScalarExpr = $oExpr->GetAsScalar($aScalarArgs);
-				$aConst[$sClassAlias][$sCode] = $oScalarExpr->GetValue();
+				if (is_object($oExpr)) // Array_merge_recursive creates an array when the same key is present multiple times... ignore them
+				{
+					$oScalarExpr = $oExpr->GetAsScalar($aScalarArgs);
+					$aConst[$sClassAlias][$sCode] = $oScalarExpr->GetValue();
+				}
 			}
 			}
 		}
 		}
 		return $aConst;		
 		return $aConst;		

+ 1 - 6
core/expression.class.inc.php

@@ -299,13 +299,8 @@ class BinaryExpression extends Expression
 			{
 			{
 				$aResult[$this->m_oRightExpr->GetParent()][$this->m_oRightExpr->GetName()] = $this->m_oLeftExpr;
 				$aResult[$this->m_oRightExpr->GetParent()][$this->m_oRightExpr->GetName()] = $this->m_oLeftExpr;
 			}
 			}
-			else
-			{
-				// Strictly, this should be removed
-				$aResult = array_merge_recursive($this->m_oRightExpr->ListConstantFields(), $this->m_oLeftExpr->ListConstantFields());
-			}
 		}
 		}
-		else
+		else if ($this->m_sOperator == 'AND')
 		{
 		{
 			// Strictly, this should be done only for the AND operator
 			// Strictly, this should be done only for the AND operator
 			$aResult = array_merge_recursive($this->m_oRightExpr->ListConstantFields(), $this->m_oLeftExpr->ListConstantFields());
 			$aResult = array_merge_recursive($this->m_oRightExpr->ListConstantFields(), $this->m_oLeftExpr->ListConstantFields());