From 9448111927d0cb2337a719c3e979c3281a6c3e89 Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Tue, 6 Nov 2018 11:14:12 +0100 Subject: [PATCH] Fixed SQL query - #2973 --- pandora_console/include/ajax/module.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index d39ca49178..5c5908460f 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -602,12 +602,13 @@ if ($list_modules) { AND delete_pending = 0 AND disabled = 0 AND $status_filter_sql + AND $status_module_group_filter $tags_sql AND tagente_estado.estado != $monitor_filter - GROUP BY tagente_modulo.id_agente_modulo "; - $count_modules = db_get_all_rows_sql('SELECT COUNT(*)' . $sql_condition); + $count_modules = db_get_all_rows_sql('SELECT COUNT(DISTINCT tagente_modulo.id_agente_modulo)' . $sql_condition); + if (isset($count_modules[0])) $count_modules = reset($count_modules[0]); else @@ -615,7 +616,9 @@ if ($list_modules) { //Get monitors/modules // Get all module from agent - $sql_modules_info = 'SELECT tagente_estado.*, tagente_modulo.*, tmodule_group.*' . $sql_condition; + $sql_modules_info = "SELECT tagente_estado.*, tagente_modulo.*, tmodule_group.* + $sql_condition + GROUP BY tagente_modulo.id_agente_modulo ORDER BY $order_sql"; if ($monitors_change_filter) { $limit = " LIMIT " . $config['block_size'] . " OFFSET 0";