From 12334a3cd185541a78a79abb3fdecc4a38e77d67 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Diaz Date: Tue, 14 Jul 2015 16:15:04 +0200 Subject: [PATCH] Planned downtime list and edit changed. Ticket #2404 --- .../godmode/agentes/planned_downtime.editor.php | 11 ++++++++++- .../godmode/agentes/planned_downtime.list.php | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index 02dfa70f5a..c0ae46623a 100755 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -557,6 +557,14 @@ if ($id_downtime > 0) { $filter_group = get_parameter("filter_group", 0); + $groupsAW = users_get_groups($config['id_user'], 'AW', true, false, null, 'id_grupo'); + $groupsAW = array_keys($groupsAW); + $id_groups_list = implode(",", $groupsAW); + + if (empty($id_groups_list)){ + $id_groups_list = -1; + } + $filter_cond = ''; if ($filter_group > 0) $filter_cond = " AND id_grupo = $filter_group "; @@ -569,7 +577,8 @@ if ($id_downtime > 0) { WHERE tplanned_downtime_agents.id_agent = tagente.id_agente AND tplanned_downtime_agents.id_downtime = %d ) AND disabled = 0 $filter_cond - ORDER by tagente.nombre", $id_downtime); + AND tagente.id_grupo IN (%s) + ORDER by tagente.nombre", $id_downtime, $id_groups_list); $downtimes = db_get_all_rows_sql ($sql); $data = array (); if ($downtimes) { diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php index 347ad6b048..5d7794ec6f 100755 --- a/pandora_console/godmode/agentes/planned_downtime.list.php +++ b/pandora_console/godmode/agentes/planned_downtime.list.php @@ -447,6 +447,10 @@ else { $groupsAW = users_get_groups($config['id_user'], 'AW', true, false, null, 'id_grupo'); $groupsAW = array_keys($groupsAW); + if (empty($groupsAW)){ + $groupsAW = -1; + } + foreach ($downtimes as $downtime) { $data = array(); $total = db_get_sql ("SELECT COUNT(id_agent)