From 421d82c008c912d0fe430495a5434bb30a640c9e Mon Sep 17 00:00:00 2001 From: m-lopez-f Date: Mon, 14 Dec 2015 11:19:14 +0100 Subject: [PATCH] Fixed count total agents when group have propagate acl. Tiquet: #3078 (cherry picked from commit c3e0ccb12645133e3cbdd89746fa1a8aa78973c9) --- .../godmode/agentes/modificar_agente.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index f2cb959e1e..fe25fe7a2d 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -271,12 +271,6 @@ else{ // Show only selected groups if ($ag_group > 0) { - $sql = sprintf ('SELECT COUNT(*) - FROM tagente - WHERE id_grupo = %d - %s', - $ag_group, $search_sql); - $total_agents = db_get_sql ($sql); $ag_groups = array(); $ag_groups = (array)$ag_group; @@ -316,11 +310,19 @@ if ($ag_group > 0) { $sql = oracle_recode_query ($sql, $set); break; } + + $sql_total = sprintf ('SELECT COUNT(*) + FROM tagente + WHERE id_grupo IN (%s) + %s', + implode (",", $ag_groups), $search_sql); + $total_agents = db_get_sql ($sql_total); } else { // Admin user get ANY group, even if they doesnt exist - if (check_acl ($config['id_user'], 0, "PM")) { + if (check_acl ($config['id_user'], 0, "PM")) { + $sql = sprintf ('SELECT COUNT(*) FROM tagente WHERE 1=1 %s', $search_sql); $total_agents = db_get_sql ($sql); switch ($config["dbtype"]) { @@ -354,6 +356,7 @@ else { } } else { + // Concatenate AW and AD permisions to get all the possible groups where the user can manage $user_groupsAW = users_get_groups ($config['id_user'], 'AW'); $user_groupsAD = users_get_groups ($config['id_user'], 'AD');