From 8c86a93bb23b172b2fd93d93ab3ad421411307f1 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Tue, 19 Nov 2013 13:28:35 +0000 Subject: [PATCH] 2013-11-19 Sergio Martin * operation/events/events.build_query.php: Fixed a subquery OR condition for not normal type. * operation/agentes/status_monitor.php: Fixed monitor filter by group and tags * mobile/operation/events.php: Fixed filter of events view in mobile console git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9097 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 +++++++++++ pandora_console/mobile/operation/events.php | 13 +++++++------ .../operation/agentes/status_monitor.php | 13 +++++-------- .../operation/events/events.build_query.php | 2 +- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 32244a6b26..fa152c651f 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2013-11-19 Sergio Martin + + * operation/events/events.build_query.php: Fixed a + subquery OR condition for not normal type. + + * operation/agentes/status_monitor.php: Fixed monitor + filter by group and tags + + * mobile/operation/events.php: Fixed filter of events + view in mobile console + 2013-11-19 Juan Manuel Ramon * include/functions_groups.php diff --git a/pandora_console/mobile/operation/events.php b/pandora_console/mobile/operation/events.php index 6aa8b132cf..69c48a5842 100644 --- a/pandora_console/mobile/operation/events.php +++ b/pandora_console/mobile/operation/events.php @@ -22,7 +22,7 @@ class Events { private $free_search = ''; private $hours_old = 8; private $status = 3; - private $type = ""; + private $type = "all"; private $severity = -1; private $filter = 0; private $group = 0; @@ -333,7 +333,7 @@ class Events { $this->type = $system->getRequest('type', __("Type")); if ($this->type === __("Type")) { - $this->type = ""; + $this->type = "all"; } else { $this->default = false; @@ -576,16 +576,17 @@ class Events { 'name' => 'type', 'title' => __('Type'), 'label' => __('Type'), - 'items' => get_event_types(), + 'items' => array_merge(array("all" => __('All')), get_event_types()), 'selected' => $this->type ); + $ui->formAddSelectBox($options); $options = array( 'name' => 'severity', 'title' => __('Severity'), 'label' => __('Severity'), - 'items' => get_priorities(), + 'items' => array("-1" => __('All')) + get_priorities(), 'selected' => $this->severity ); $ui->formAddSelectBox($options); @@ -1035,7 +1036,7 @@ class Events { $(document).ready(function() { $(window).bind(\"scroll\", function () { if ($(this).scrollTop() + $(this).height() - >= ($(document).height() - 100)) { + >= ($(document).height() - 100) || true) { ajax_load_rows(); } @@ -1094,4 +1095,4 @@ class Events { } } -?> \ No newline at end of file +?> diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 8c94161a10..d052a3d9c1 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -97,8 +97,8 @@ $id_ag_group = db_get_value('id_grupo', 'tgrupo', 'nombre', $ag_group); // Agent group selector if (!defined('METACONSOLE')) { - if ($ag_group > 0 && check_acl ($config["id_user"], $id_ag_group, "AR")) { - $sql_conditions_group = sprintf (" AND tagente.id_grupo = %d", $id_ag_group); + if ($ag_group > 0 && check_acl ($config["id_user"], $ag_group, "AR")) { + $sql_conditions_group = sprintf (" AND tagente.id_grupo = %d", $ag_group); } elseif ($user_groups != '') { // User has explicit permission on group 1 ? @@ -121,9 +121,7 @@ if (defined('METACONSOLE')) { FROM tmodule_group WHERE name = '%s')", $modulegroup); } else if ($modulegroup > -1) { - - $id_modulegroup = db_get_value('id_agente_modulo', 'tagente_modulo', 'nombre', $modulegroup); - $sql_conditions .= sprintf (" AND tagente_modulo.id_module_group = '%d'", $id_modulegroup); + $sql_conditions .= sprintf (" AND tagente_modulo.id_module_group = '%d'", $modulegroup); } @@ -172,12 +170,11 @@ if ($tag_filter !== 0) { WHERE ttag_module.id_tag IN (SELECT id_tag FROM ttag where name LIKE '%" . $tag_filter . "%') )"; } - else{ - $id_tag_filter = db_get_value('id_tag', 'ttag', 'name', $tag_filter); + else{ $sql_conditions .= " AND tagente_modulo.id_agente_modulo IN ( SELECT ttag_module.id_agente_modulo FROM ttag_module - WHERE ttag_module.id_tag = " . $id_tag_filter . " + WHERE ttag_module.id_tag = " . $tag_filter . " )"; } diff --git a/pandora_console/operation/events/events.build_query.php b/pandora_console/operation/events/events.build_query.php index 66208ca26b..c3bba51774 100755 --- a/pandora_console/operation/events/events.build_query.php +++ b/pandora_console/operation/events/events.build_query.php @@ -82,7 +82,7 @@ if ($event_type != "") { $sql_post .= " AND event_type LIKE '%$event_type%' "; } elseif ($event_type == "not_normal") { - $sql_post .= " AND event_type LIKE '%warning%' OR event_type LIKE '%critical%' OR event_type LIKE '%unknown%' "; + $sql_post .= " AND (event_type LIKE '%warning%' OR event_type LIKE '%critical%' OR event_type LIKE '%unknown%') "; } elseif ($event_type != "all") { $sql_post .= " AND event_type = '" . $event_type."'";