[icinga-checkins] icinga.org: icinga-web/jmosshammer/default: * fixed default columns not working in search

git at icinga.org git at icinga.org
Thu Aug 11 16:28:03 CEST 2011


Module: icinga-web
Branch: jmosshammer/default
Commit: 8d51b9907cad0004284a32f6a8db6fec9afc5efe
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=8d51b9907cad0004284a32f6a8db6fec9afc5efe

Author: Jannis Mosshammer <jannis.mosshammer at netways.de>
Date:   Thu Aug 11 16:27:43 2011 +0200

* fixed default columns not working in search

---

 app/modules/Api/actions/ApiSearchAction.class.php |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/app/modules/Api/actions/ApiSearchAction.class.php b/app/modules/Api/actions/ApiSearchAction.class.php
index 170530e..f6607a4 100644
--- a/app/modules/Api/actions/ApiSearchAction.class.php
+++ b/app/modules/Api/actions/ApiSearchAction.class.php
@@ -200,13 +200,18 @@ class Api_ApiSearchAction extends IcingaApiBaseAction {
         $columns = $rd->getParameter("columns",null);
         if(!is_array($columns))
             $columns = array($columns);
-        foreach($columns as &$column) {
-           $column = preg_replace("/[^1-9_A-Za-z]/","",$column);
-           $column = strtoupper($column);
-        } 
-        if (!is_null($columns)) {
-            $search->setResultColumns($columns);
-        } else {
+        $columns_result = array();
+        foreach($columns as $column) {
+            $column = preg_replace("/[^1-9_A-Za-z]/","",$column);
+            $column = strtoupper($column);
+            if($column)
+                $columns_result[] = $column;
+        }
+         
+        if (!is_null($columns_result) && !empty($columns_result)) {
+            
+            $search->setResultColumns($columns_result);
+        } else {            
             $search->setResultColumns(self::$defaultColumns[$rd->getParameter("target")]);
         }
     }





More information about the icinga-checkins mailing list