From d40c64d203ea486686d2e5d661f1e7b8a894204c Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 23 Dec 2009 11:48:19 +0000 Subject: [PATCH] 2009-12-23 Miguel de Dios * include/functions_db.php: fix warning messages when pass only group as string or integer in the function "isAllGroups". * include/functions_reporting.php: fix ambiguous colummn in query in the function "get_group_stats". git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2233 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 +++++++ pandora_console/include/functions_db.php | 4 +++- pandora_console/include/functions_reporting.php | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b6e67a92aa..155adb8a48 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2009-12-23 Miguel de Dios + + * include/functions_db.php: fix warning messages when pass only group as + string or integer in the function "isAllGroups". + * include/functions_reporting.php: fix ambiguous colummn in query in the + function "get_group_stats". + 2009-12-22 Miguel de Dios * include/functions_custom_graphs.php: fix the name of custom graphs in the diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index ca3e0dd87d..624b52e284 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -353,12 +353,14 @@ function give_disabled_group ($id_group) { function isAllGroups($idGroups) { if (!is_array($idGroups)) $arrayGroups = array($idGroups); + else + $arrayGroups = $idGroups; $groupsDB = get_db_all_rows_in_table ('tgrupo'); $returnVar = true; foreach ($groupsDB as $group) { - if (!in_array($group['id_grupo'],$idGroups)) { + if (!in_array($group['id_grupo'], $arrayGroups)) { $returnVar = false; break; } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index d11efd3014..19aec3a0c5 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -123,6 +123,7 @@ function get_group_stats ($id_group = 0) { $id_group = array_keys (get_user_groups ()); } + if (isAllGroups($id_group)) { $filter = ' 1 = 1 '; $total_agents = get_db_value_sql('SELECT count(id_agente) FROM tagente WHERE disabled = 0'); @@ -136,7 +137,7 @@ function get_group_stats ($id_group = 0) { //No agents in this group, means no data return $data; } - $filter = 'id_agente IN ('.implode (",", $agents).') '; + $filter = 'tagente_estado.id_agente IN ('.implode (",", $agents).') '; $alerts = get_agent_alerts ($agents); }