Advanced Search: Unit tests and some fixes

SVN:b1162[5555]
This commit is contained in:
Eric Espié
2018-03-28 12:53:46 +00:00
parent e33bdab4e9
commit 9b0ccb8943
3 changed files with 241 additions and 47 deletions

View File

@@ -510,11 +510,6 @@ class BinaryExpression extends Expression
$bReverseOperator = false;
$oLeftExpr = $this->GetLeftExpr();
$oRightExpr = $this->GetRightExpr();
if ($oLeftExpr instanceof FieldExpression && $oRightExpr instanceof FieldExpression)
{
// Default criterion (Field OPE Field) is not supported
return parent::GetCriterion($oSearch, $aArgs, $bRetrofitParams, $oAttDef);
}
$oAttDef = $oLeftExpr->GetAttDef($oSearch->GetJoinedClasses());
@@ -532,7 +527,6 @@ class BinaryExpression extends Expression
$aCriteriaLeft = $oLeftExpr->GetCriterion($oSearch, $aArgs, $bRetrofitParams, $oAttDef);
$aCriteriaRight = $oRightExpr->GetCriterion($oSearch, $aArgs, $bRetrofitParams, $oAttDef);
if ($bReverseOperator)
{
$aCriteria = array_merge($aCriteriaRight, $aCriteriaLeft);
@@ -565,6 +559,12 @@ class BinaryExpression extends Expression
$aCriteria['oql'] = $this->Render($aArgs, $bRetrofitParams);
$aCriteria['label'] = $this->Display($oSearch, $aArgs, $oAttDef);
if (isset($aCriteriaLeft['ref']) && isset($aCriteriaRight['ref']) && ($aCriteriaLeft['ref'] != $aCriteriaRight['ref']))
{
// Only one Field is supported in the expressions
$aCriteria['widget'] = AttributeDefinition::SEARCH_WIDGET_TYPE_RAW;
}
return $aCriteria;
}
}