fix bug in event filter by group when not using secondary groups
Former-commit-id: fe9c88e8e2d7552fed7e5c7cd5a5694d47ee444f
This commit is contained in:
parent
3b2d72308e
commit
36119ebb85
|
@ -83,22 +83,42 @@ if (($date_from === '') && ($date_to === '')) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$is_using_secondary_group = enterprise_hook('agents_is_using_secondary_groups');
|
||||||
|
|
||||||
// Group selection.
|
// Group selection.
|
||||||
if ($id_group > 0 && in_array($id_group, array_keys($groups))) {
|
if ($id_group > 0 && in_array($id_group, array_keys($groups))) {
|
||||||
if ($propagate) {
|
if ($propagate) {
|
||||||
$childrens_str = implode(',', $childrens_ids);
|
$childrens_str = implode(',', $childrens_ids);
|
||||||
$sql_post .= " AND (id_grupo IN ($childrens_str) OR id_group IN ($childrens_str))";
|
$sql_post .= " AND (id_grupo IN ($childrens_str)";
|
||||||
|
|
||||||
|
if ($is_using_secondary_group)
|
||||||
|
$sql_post .= " OR id_group IN ($childrens_str)";
|
||||||
|
|
||||||
|
$sql_post .= ")";
|
||||||
} else {
|
} else {
|
||||||
// If a group is selected and it's in the groups allowed.
|
// If a group is selected and it's in the groups allowed.
|
||||||
$sql_post .= " AND (id_grupo = $id_group OR id_group = $id_group)";
|
$sql_post .= " AND (id_grupo = $id_group";
|
||||||
|
|
||||||
|
if ($is_using_secondary_group)
|
||||||
|
$sql_post .= " OR id_group = $id_group";
|
||||||
|
|
||||||
|
$sql_post .= ")";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!users_is_admin() && !users_can_manage_group_all('ER')) {
|
if (!users_is_admin() && !users_can_manage_group_all('ER')) {
|
||||||
$sql_post .= sprintf(
|
if ($is_using_secondary_group) {
|
||||||
' AND (id_grupo IN (%s) OR id_group IN (%s)) ',
|
$sql_post .= sprintf(
|
||||||
implode(',', array_keys($groups)),
|
' AND (id_grupo IN (%s) OR id_group IN (%s)) ',
|
||||||
implode(',', array_keys($groups))
|
implode(',', array_keys($groups)),
|
||||||
);
|
implode(',', array_keys($groups))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql_post .= sprintf(
|
||||||
|
' AND (id_grupo IN (%s)) ',
|
||||||
|
implode(',', array_keys($groups))
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue