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:
Denis Flaven
2010-07-28 15:18:52 +00:00
parent 0938baefb6
commit 9974457971
10 changed files with 124 additions and 17 deletions

View File

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