[icinga-checkins] icinga.org: icingaweb2/bugfix/the-equal-sign-breaks-the-search-10801: Make the = sign not breaking the search

git at icinga.org git at icinga.org
Thu Oct 20 19:19:45 CEST 2016


Module: icingaweb2
Branch: bugfix/the-equal-sign-breaks-the-search-10801
Commit: 50a000b26196d61fd9df081147f42bd99c07c0cc
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=50a000b26196d61fd9df081147f42bd99c07c0cc

Author: Alexander A. Klimov <alexander.klimov at icinga.com>
Date:   Thu Oct 20 19:18:27 2016 +0200

Make the = sign not breaking the search

refs #10801

---

 library/Icinga/Web/Widget/FilterEditor.php |   35 ++++++++++++----------------
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/library/Icinga/Web/Widget/FilterEditor.php b/library/Icinga/Web/Widget/FilterEditor.php
index 28e4968..14d820d 100644
--- a/library/Icinga/Web/Widget/FilterEditor.php
+++ b/library/Icinga/Web/Widget/FilterEditor.php
@@ -261,28 +261,23 @@ class FilterEditor extends AbstractWidget
         $filter = $this->getFilter();
 
         if ($search !== null) {
-            if (strpos($search, '=') !== false) {
-                list($k, $v) = preg_split('/=/', $search);
-                $filter = $this->mergeRootExpression($filter, trim($k), '=', ltrim($v));
-            } else {
-                if ($this->searchColumns === null && $this->query instanceof FilterColumns) {
-                    $this->searchColumns = $this->query->getSearchColumns($search);
-                }
+            if ($this->searchColumns === null && $this->query instanceof FilterColumns) {
+                $this->searchColumns = $this->query->getSearchColumns($search);
+            }
 
-                if (! 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 = $filter->andFilter(new FilterOr($filters));
-                } else {
-                    Notification::error(mt('monitoring', 'Cannot search here'));
-                    return $this;
+            if (! 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 = $filter->andFilter(new FilterOr($filters));
+            } else {
+                Notification::error(mt('monitoring', 'Cannot search here'));
+                return $this;
             }
 
             $url = $this->url()->setQueryString(



More information about the icinga-checkins mailing list