Advanced Search: resolve variables for the search screen

SVN:b1162[5488]
This commit is contained in:
Eric Espié
2018-03-21 13:45:37 +00:00
parent b05b41c7cc
commit 3cdf22e9b2
2 changed files with 29 additions and 2 deletions

View File

@@ -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

View File

@@ -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)