mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 01:58:47 +02:00
Advanced Search: resolve variables for the search screen
SVN:b1162[5488]
This commit is contained in:
@@ -34,6 +34,14 @@ abstract class Expression
|
||||
|
||||
// recursive translation of identifiers
|
||||
abstract public function GetUnresolvedFields($sAlias, &$aUnresolved);
|
||||
|
||||
/**
|
||||
* @param array $aTranslationData
|
||||
* @param bool $bMatchAll
|
||||
* @param bool $bMarkFieldsAsResolved
|
||||
*
|
||||
* @return Expression Translated expression
|
||||
*/
|
||||
abstract public function Translate($aTranslationData, $bMatchAll = true, $bMarkFieldsAsResolved = true);
|
||||
|
||||
// recursive rendering (aArgs used as input by default, or used as output if bRetrofitParams set to True
|
||||
|
||||
@@ -122,9 +122,18 @@ class SearchForm
|
||||
$sHtml .= "<div id=\"fs_{$sSearchFormId}_criterion_outer\">\n</div>\n";
|
||||
$sHtml .= "</form>\n";
|
||||
|
||||
if (isset($aExtraParams['query_params']))
|
||||
{
|
||||
$aArgs = $aExtraParams['query_params'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$aArgs = array();
|
||||
}
|
||||
|
||||
$aFields = $this->GetFields($oSet);
|
||||
$oSearch = $oSet->GetFilter();
|
||||
$aCriterion = $this->GetCriterion($oSearch, $aFields);
|
||||
$aCriterion = $this->GetCriterion($oSearch, $aFields, $aArgs);
|
||||
|
||||
$oBaseSearch = $oSearch->DeepClone();
|
||||
$oBaseSearch->ResetCondition();
|
||||
@@ -284,12 +293,22 @@ class SearchForm
|
||||
* @param \DBSearch $oSearch
|
||||
* @param array $aFields
|
||||
*
|
||||
* @param array $aArgs
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function GetCriterion($oSearch, $aFields)
|
||||
public function GetCriterion($oSearch, $aFields, $aArgs = array())
|
||||
{
|
||||
$oExpression = $oSearch->GetCriteria();
|
||||
|
||||
if (!empty($aArgs))
|
||||
{
|
||||
$aArgs = MetaModel::PrepareQueryArguments($aArgs);
|
||||
|
||||
$sOQL = $oExpression->Render($aArgs);
|
||||
$oExpression = Expression::FromOQL($sOQL);
|
||||
}
|
||||
|
||||
$aOrCriterion = array();
|
||||
$aORExpressions = Expression::Split($oExpression, 'OR');
|
||||
foreach($aORExpressions as $oORSubExpr)
|
||||
|
||||
Reference in New Issue
Block a user