mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 01:58:47 +02:00
Enhancing the search (Trac #147): now allows to pass some "magic patterns" when doing a standard search without any operator. Specially useful for searching on ranges of dates/datetimes
SVN:trunk[638]
This commit is contained in:
@@ -224,15 +224,25 @@ class DBObjectSearch
|
||||
MyHelpers::CheckKeyInArray('filter code', $sFilterCode, MetaModel::GetClassFilterDefs($this->GetClass()));
|
||||
$oFilterDef = MetaModel::GetClassFilterDef($this->GetClass(), $sFilterCode);
|
||||
|
||||
$oField = new FieldExpression($sFilterCode, $this->GetClassAlias());
|
||||
if (empty($sOpCode))
|
||||
{
|
||||
$sOpCode = $oFilterDef->GetLooseOperator();
|
||||
if ($sFilterCode == 'id')
|
||||
{
|
||||
$sOpCode = '=';
|
||||
}
|
||||
else
|
||||
{
|
||||
$oAttDef = MetaModel::GetAttributeDef($this->GetClass(), $sFilterCode);
|
||||
$oNewCondition = $oAttDef->GetSmartConditionExpression($value, $oField, $this->m_aParams);
|
||||
$this->AddConditionExpression($oNewCondition);
|
||||
return;
|
||||
}
|
||||
}
|
||||
MyHelpers::CheckKeyInArray('operator', $sOpCode, $oFilterDef->GetOperators());
|
||||
|
||||
// Preserve backward compatibility - quick n'dirty way to change that API semantic
|
||||
//
|
||||
$oField = new FieldExpression($sFilterCode, $this->GetClassAlias());
|
||||
switch($sOpCode)
|
||||
{
|
||||
case 'SameDay':
|
||||
|
||||
Reference in New Issue
Block a user