From b597c936e846f49320a1d55992d0d394564c91e1 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Mon, 20 Aug 2018 12:02:34 +0200 Subject: [PATCH] [Secondary groups] Avoid duplicates in manage agents --- pandora_console/godmode/agentes/modificar_agente.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 5b97384cb4..994b5a69ea 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -361,7 +361,7 @@ if ($ag_group > 0) { $user_groups_to_sql = implode (',', array_keys ($user_groups)); } -$sql = sprintf ('SELECT COUNT(*) +$sql = sprintf ('SELECT COUNT(DISTINCT(tagente.id_agente)) FROM tagente LEFT JOIN tagent_secondary_group tasg ON tagente.id_agente = tasg.id_agent WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s)) @@ -376,6 +376,7 @@ $sql = sprintf ('SELECT * ON tagente.id_agente = tasg.id_agent WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s)) %s + GROUP BY tagente.id_agente ORDER BY %s %s, %s %s LIMIT %d, %d', $user_groups_to_sql, $user_groups_to_sql,