From de58fe7b900744ec84614bc45cb1615ca0a71dc0 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Fri, 6 Jul 2018 14:03:05 +0200 Subject: [PATCH] Fixes --- pandora_console/include/functions.php | 6 +----- pandora_console/include/functions_agents.php | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 95892d211a..6adcfa475b 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1360,11 +1360,7 @@ function safe_sql_string($string) { function is_metaconsole() { global $config; - - if ($config['metaconsole']) - return true; - else - return false; + return (bool) $config['metaconsole']; } /** diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 65e27936cd..a5bb41a29a 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -799,8 +799,17 @@ function agents_common_modules ($id_agent, $filter = false, $indexed = true, $ge * * @return array An array with all agents in the group or an empty array */ -function agents_get_group_agents ($id_group = 0, $search = false, - $case = "lower", $noACL = false, $childGroups = false, $serialized = false, $separator = '|', $add_alert_bulk_op = false) { +function agents_get_group_agents ( + $id_group = 0, + $search = false, + $case = "lower", + $noACL = false, + $childGroups = false, + $serialized = false, + $separator = '|', + $add_alert_bulk_op = false, + $meta_use_main_id = false +) { global $config; @@ -951,7 +960,7 @@ function agents_get_group_agents ($id_group = 0, $search = false, $table_name = 'tmetaconsole_agent'; $fields = array( - 'id_tagente AS id_agente', + $meta_use_main_id ? 'id_agente' : 'id_tagente AS id_agente', 'alias', 'id_tmetaconsole_setup AS id_server' ); @@ -2010,7 +2019,8 @@ function agents_get_agentmodule_group ($id_module) { * @return int The group id */ function agents_get_agent_group ($id_agent) { - return (int) db_get_value ('id_grupo', 'tagente', 'id_agente', (int) $id_agent); + $table = is_metaconsole() ? "tmetaconsole_agent" : "tagente"; + return (int) db_get_value ('id_grupo', $table, 'id_agente', (int) $id_agent); } /**