mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
N°931: TagSet search (manage undefined values) unit tests
This commit is contained in:
@@ -578,6 +578,7 @@ class BinaryExpression extends Expression
|
||||
* @param null $oAttDef
|
||||
*
|
||||
* @return array
|
||||
* @throws \MissingQueryArgument
|
||||
*/
|
||||
public function GetCriterion($oSearch, &$aArgs = null, $bRetrofitParams = false, $oAttDef = null)
|
||||
{
|
||||
@@ -676,6 +677,10 @@ class BinaryExpression extends Expression
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($aCriteriaLeft['widget']) && isset($aCriteriaRight['widget']) && ($aCriteriaLeft['widget'] == AttributeDefinition::SEARCH_WIDGET_TYPE_TAG_SET) && ($aCriteriaRight['widget'] == AttributeDefinition::SEARCH_WIDGET_TYPE_TAG_SET))
|
||||
{
|
||||
$aCriteriaOverride['operator'] = 'MATCHES';
|
||||
}
|
||||
}
|
||||
|
||||
return array_merge($aCriteriaLeft, $aCriteriaRight, $aCriteriaOverride);
|
||||
@@ -886,20 +891,20 @@ class ScalarExpression extends UnaryExpression
|
||||
|
||||
public function GetCriterion($oSearch, &$aArgs = null, $bRetrofitParams = false, $oAttDef = null)
|
||||
{
|
||||
$aCriteria = array();
|
||||
$aCriterion = array();
|
||||
switch ((string)($this->m_value))
|
||||
{
|
||||
case '%Y-%m-%d':
|
||||
$aCriteria['unit'] = 'DAY';
|
||||
$aCriterion['unit'] = 'DAY';
|
||||
break;
|
||||
case '%Y-%m':
|
||||
$aCriteria['unit'] = 'MONTH';
|
||||
$aCriterion['unit'] = 'MONTH';
|
||||
break;
|
||||
case '%w':
|
||||
$aCriteria['unit'] = 'WEEKDAY';
|
||||
$aCriterion['unit'] = 'WEEKDAY';
|
||||
break;
|
||||
case '%H':
|
||||
$aCriteria['unit'] = 'HOUR';
|
||||
$aCriterion['unit'] = 'HOUR';
|
||||
break;
|
||||
default:
|
||||
$aValue = array();
|
||||
@@ -938,7 +943,7 @@ class ScalarExpression extends UnaryExpression
|
||||
}
|
||||
else
|
||||
{
|
||||
$aValue['label'] = Dict::S('Enum:Undefined');
|
||||
$aCriterion['has_undefined'] = true;
|
||||
}
|
||||
}
|
||||
catch (Exception $e)
|
||||
@@ -981,12 +986,12 @@ class ScalarExpression extends UnaryExpression
|
||||
{
|
||||
// only if a label is found
|
||||
$aValue['value'] = $this->GetValue();
|
||||
$aCriteria['values'] = array($aValue);
|
||||
$aCriterion['values'] = array($aValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
$aCriteria['oql'] = $this->RenderExpression(false, $aArgs, $bRetrofitParams);
|
||||
return $aCriteria;
|
||||
$aCriterion['oql'] = $this->RenderExpression(false, $aArgs, $bRetrofitParams);
|
||||
return $aCriterion;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user