diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 9295412c48..a4acadfdcd 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -263,12 +263,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; @@ -308,11 +302,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"]) { @@ -346,6 +348,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');