diff --git a/library/Icinga/Web/Widget/FilterEditor.php b/library/Icinga/Web/Widget/FilterEditor.php index 2d64e4c2b..dd84a5e52 100644 --- a/library/Icinga/Web/Widget/FilterEditor.php +++ b/library/Icinga/Web/Widget/FilterEditor.php @@ -216,25 +216,22 @@ class FilterEditor extends AbstractWidget $filter = $this->getFilter(); if ($search !== null) { - if (empty($this->searchColumns)) { - if (strpos($search, '=') === false) { - Notification::error(mt('monitoring', 'Cannot search here')); - return $this; - } else { - list($k, $v) = preg_split('/=/', $search); - $filter = $this->mergeRootExpression($filter, trim($k), '=', ltrim($v)); - } - } else { - if (false === $this->resetSearchColumns($filter)) { + if (strpos($search, '=') !== false) { + list($k, $v) = preg_split('/=/', $search); + $filter = $this->mergeRootExpression($filter, trim($k), '=', ltrim($v)); + } elseif (! empty($this->searchColumns)) { + if (! $this->resetSearchColumns($filter)) { $filter = Filter::matchAll(); } - $filters = array(); $search = ltrim($search); foreach ($this->searchColumns as $searchColumn) { $filters[] = Filter::expression($searchColumn, '=', "*$search*"); } $filter->andFilter(new FilterOr($filters)); + } else { + Notification::error(mt('monitoring', 'Cannot search here')); + return $this; } $url = $this->url()->setQueryString(