ZfQueryBasedTable: only search with wildcards...
...when no wildcard has been given
This commit is contained in:
parent
dce9770dcd
commit
d8184ce373
|
@ -89,14 +89,22 @@ abstract class ZfQueryBasedTable extends QueryBasedTable
|
|||
if (strpos($search, ' ') === false) {
|
||||
$filter = Filter::matchAny();
|
||||
foreach ($columns as $column) {
|
||||
$filter->addFilter(Filter::expression($column, '=', "*$search*"));
|
||||
if (strpos($search, '*') === false) {
|
||||
$filter->addFilter(Filter::expression($column, '=', "*$search*"));
|
||||
} else {
|
||||
$filter->addFilter(Filter::expression($column, '=', $search));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$filter = Filter::matchAll();
|
||||
foreach (explode(' ', $search) as $s) {
|
||||
$sub = Filter::matchAny();
|
||||
foreach ($columns as $column) {
|
||||
$sub->addFilter(Filter::expression($column, '=', "*$s*"));
|
||||
if (strpos($search, '*') === false) {
|
||||
$sub->addFilter(Filter::expression($column, '=', "*$s*"));
|
||||
} else {
|
||||
$sub->addFilter(Filter::expression($column, '=', $s));
|
||||
}
|
||||
}
|
||||
$filter->addFilter($sub);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue