Fixed count total agents when group have propagate acl. Tiquet: #3078

(cherry picked from commit c3e0ccb126)
This commit is contained in:
m-lopez-f 2015-12-14 11:19:14 +01:00
parent 41e6d71159
commit 66a2fe4420
1 changed files with 10 additions and 7 deletions

View File

@ -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');