From 719f56efec65ca4af7a1b074c11f315080c08f1d Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Mon, 29 Jul 2019 16:32:50 +0200 Subject: [PATCH 1/3] Modified SQL queries for avoidance of case sensitive --- pandora_console/include/ajax/agent.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/ajax/agent.php b/pandora_console/include/ajax/agent.php index 50fe7dc992..698ab7df9b 100644 --- a/pandora_console/include/ajax/agent.php +++ b/pandora_console/include/ajax/agent.php @@ -63,6 +63,7 @@ if ($get_agents_group) { if ($search_agents && (!is_metaconsole() || $force_local)) { $id_agent = (int) get_parameter('id_agent'); $string = (string) get_parameter('q'); + $string = strtoupper($string); // q is what autocomplete plugin gives $id_group = (int) get_parameter('id_group', -1); $addedItems = html_entity_decode((string) get_parameter('add')); @@ -98,11 +99,11 @@ if ($search_agents && (!is_metaconsole() || $force_local)) { $filter_alias = $filter; switch ($config['dbtype']) { case 'mysql': - $filter_alias[] = '(alias LIKE "%'.$string.'%")'; + $filter_alias[] = '(UPPER(alias) LIKE "%'.$string.'%")'; break; case 'postgresql': - $filter_alias[] = '(alias LIKE \'%'.$string.'%\')'; + $filter_alias[] = '(UPPER(alias) LIKE \'%'.$string.'%\')'; break; case 'oracle': @@ -127,11 +128,11 @@ if ($search_agents && (!is_metaconsole() || $force_local)) { $filter_agents = $filter; switch ($config['dbtype']) { case 'mysql': - $filter_agents[] = '(alias NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci LIKE "%'.$string.'%")'; + $filter_agents[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) COLLATE utf8_general_ci LIKE "%'.$string.'%")'; break; case 'postgresql': - $filter_agents[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre LIKE \'%'.$string.'%\')'; + $filter_agents[] = '(UPPER(alias) NOT LIKE \'%'.$string.'%\' AND UPPER(nombre) LIKE \'%'.$string.'%\')'; break; case 'oracle': @@ -156,11 +157,11 @@ if ($search_agents && (!is_metaconsole() || $force_local)) { $filter_address = $filter; switch ($config['dbtype']) { case 'mysql': - $filter_address[] = '(alias NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion LIKE "%'.$string.'%")'; + $filter_address[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND UPPER(direccion) LIKE "%'.$string.'%")'; break; case 'postgresql': - $filter_address[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre NOT LIKE \'%'.$string.'%\' AND direccion LIKE \'%'.$string.'%\')'; + $filter_address[] = '(UPPER(alias) NOT LIKE \'%'.$string.'%\' AND UPPER(nombre) NOT LIKE \'%'.$string.'%\' AND UPPER(direccion) LIKE \'%'.$string.'%\')'; break; case 'oracle': @@ -185,11 +186,11 @@ if ($search_agents && (!is_metaconsole() || $force_local)) { $filter_description = $filter; switch ($config['dbtype']) { case 'mysql': - $filter_description[] = '(alias NOT LIKE "%'.$string.'%" AND nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion NOT LIKE "%'.$string.'%" AND comentarios LIKE "%'.$string.'%")'; + $filter_description[] = '(UPPER(alias) NOT LIKE "%'.$string.'%" AND UPPER(nombre) COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND UPPER(direccion) NOT LIKE "%'.$string.'%" AND UPPER(comentarios) LIKE "%'.$string.'%")'; break; case 'postgresql': - $filter_description[] = '(alias NOT LIKE \'%'.$string.'%\' AND nombre NOT LIKE \'%'.$string.'%\' AND direccion NOT LIKE \'%'.$string.'%\' AND comentarios LIKE \'%'.$string.'%\')'; + $filter_description[] = '(UPPER(alias) NOT LIKE \'%'.$string.'%\' AND UPPER(nombre) NOT LIKE \'%'.$string.'%\' AND UPPER(direccion) NOT LIKE \'%'.$string.'%\' AND UPPER(comentarios) LIKE \'%'.$string.'%\')'; break; case 'oracle': From dd77429aea9e65df09792767ab14b47e18d033bb Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Mon, 29 Jul 2019 17:22:16 +0200 Subject: [PATCH 2/3] Solved issue with status names --- pandora_console/include/class/TreeService.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/class/TreeService.class.php b/pandora_console/include/class/TreeService.class.php index 2316714031..8d0039c9a8 100644 --- a/pandora_console/include/class/TreeService.class.php +++ b/pandora_console/include/class/TreeService.class.php @@ -218,15 +218,15 @@ class TreeService extends Tree break; case '1': - $data_modules[$key]['statusImageHTML'] = 'CRITICAL status.'; + $data_modules[$key]['statusImageHTML'] = 'CRITICAL status.'; break; case '2': - $data_modules[$key]['statusImageHTML'] = 'WARNING status.'; + $data_modules[$key]['statusImageHTML'] = 'WARNING status.'; break; case '4': - $data_modules[$key]['statusImageHTML'] = 'UNKNOWN status.'; + $data_modules[$key]['statusImageHTML'] = 'UNKNOWN status.'; break; default: From 3d03faed9a6eb36d73b6e6db456efaf5c5786afe Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 6 Aug 2019 14:56:57 +0200 Subject: [PATCH 3/3] Solved some issues --- .../include/class/TreeService.class.php | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/class/TreeService.class.php b/pandora_console/include/class/TreeService.class.php index 8d0039c9a8..251fde0d73 100644 --- a/pandora_console/include/class/TreeService.class.php +++ b/pandora_console/include/class/TreeService.class.php @@ -214,26 +214,37 @@ class TreeService extends Tree foreach ($data_modules as $key => $module) { switch ($module['estado']) { case '0': - $data_modules[$key]['statusImageHTML'] = 'NORMAL status.'; + $module_status = 'ok'; + $module_title = 'NORMAL'; break; case '1': - $data_modules[$key]['statusImageHTML'] = 'CRITICAL status.'; + $module_status = 'critical'; + $module_title = 'CRITICAL'; break; case '2': - $data_modules[$key]['statusImageHTML'] = 'WARNING status.'; + $module_status = 'warning'; + $module_title = 'WARNING'; + break; + + case '3': + $module_status = 'down'; + $module_title = 'UNKNOWN'; break; case '4': - $data_modules[$key]['statusImageHTML'] = 'UNKNOWN status.'; + $module_status = 'no_data'; + $module_title = 'NOT INITIALIZED'; break; default: - // code... + $module_status = 'down'; + $module_title = 'UNKNOWN'; break; } + $data_modules[$key]['statusImageHTML'] = ''.$module_title.' status.'; $data_modules[$key]['showEventsBtn'] = 1; $data_modules[$key]['eventModule'] = $module['id_agente_modulo']; }