Don't handle the case $this->searchColumns === null for actions in which ::setSearchColumns() is called
refs #8241
This commit is contained in:
parent
a2b262eab1
commit
3243f9a65a
|
@ -217,29 +217,7 @@ class FilterEditor extends AbstractWidget
|
||||||
if ($search !== null) {
|
if ($search !== null) {
|
||||||
if ($this->searchColumns === null) {
|
if ($this->searchColumns === null) {
|
||||||
if (strpos($search, '=') === false) {
|
if (strpos($search, '=') === false) {
|
||||||
// TODO: Ask the view for (multiple) search columns
|
throw new Exception('Cannot search here');
|
||||||
switch($request->getActionName()) {
|
|
||||||
case 'services':
|
|
||||||
$searchCol = 'service';
|
|
||||||
break;
|
|
||||||
case 'hosts':
|
|
||||||
$searchCol = 'host';
|
|
||||||
break;
|
|
||||||
case 'hostgroups':
|
|
||||||
$searchCol = 'hostgroup';
|
|
||||||
break;
|
|
||||||
case 'servicegroups':
|
|
||||||
$searchCol = 'servicegroup';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$searchCol = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($searchCol === null) {
|
|
||||||
throw new Exception('Cannot search here');
|
|
||||||
}
|
|
||||||
$search = ltrim($search);
|
|
||||||
$filter = $this->mergeRootExpression($filter, $searchCol, '=', "*$search*");
|
|
||||||
} else {
|
} else {
|
||||||
list($k, $v) = preg_split('/=/', $search);
|
list($k, $v) = preg_split('/=/', $search);
|
||||||
$filter = $this->mergeRootExpression($filter, trim($k), '=', ltrim($v));
|
$filter = $this->mergeRootExpression($filter, trim($k), '=', ltrim($v));
|
||||||
|
|
Loading…
Reference in New Issue