Selaa lähdekoodia

#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 vuotta sitten
vanhempi
commit
eb42dc008c
1 muutettua tiedostoa jossa 7 lisäystä ja 3 poistoa
  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;
 	}