Преглед изворни кода

#53 Global search always returning all organization, reviewed Denis's fix

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@204 a333f486-631f-4898-b8df-5754b55c2be0
romainq пре 15 година
родитељ
комит
eb42dc008c
1 измењених фајлова са 7 додато и 3 уклоњено
  1. 7 3
      core/dbobjectsearch.class.php

+ 7 - 3
core/dbobjectsearch.class.php

@@ -275,8 +275,6 @@ class DBObjectSearch
 	public function AddCondition_FullText($sFullText)
 	{
 		$this->m_aFullText[] = $sFullText;
-		$index = count($this->m_aParams) + 1;
-		$this->m_aParams['param'.$index] = 1;
 	}
 
 	protected function AddToNameSpace(&$aClassAliases, &$aAliasTranslation)
@@ -466,7 +464,7 @@ class DBObjectSearch
 
 	public function RenderCondition()
 	{
-		return $this->m_oSearchCondition->Render($this->m_aParams, true);
+		return $this->m_oSearchCondition->Render($this->m_aParams, false);
 	}
 
 	public function serialize()
@@ -634,6 +632,12 @@ class DBObjectSearch
 		$sRes = "SELECT ".$this->GetClass().' AS '.$this->GetClassAlias();
 		$sRes .= $this->ToOQL_Joins();
 		$sRes .= " WHERE ".$this->m_oSearchCondition->Render($aParams, $bRetrofitParams);
+
+		// Temporary: add more info about other conditions, necessary to avoid strange behaviors with the cache
+		foreach($this->m_aFullText as $sFullText)
+		{
+			$sRes .= " AND MATCHES '$sFullText'";
+		}
 		return $sRes;
 	}