Merge branch 'ent-3332-fallo-al-filtrar-por-grupos-en-prediction-module' into 'develop'

Fixed agents_get_group_agents while trying to get agent list from target group

See merge request artica/pandorafms!2107

Former-commit-id: 5c036aa603fbd341617b065dfa6bb870f652775e
This commit is contained in:
fbsanchez 2019-01-03 14:34:26 +01:00
commit 361b85efb8
3 changed files with 9 additions and 6 deletions

View File

@ -827,7 +827,8 @@ function agents_get_group_agents (
$filter = array();
if (!$noACL) {
// check available groups for target user only if asking for 'All' group
if (!$noACL && $id_group == 0) {
$id_group = $id_group == 0
? array_keys(users_get_groups(false, "AR", false))
: groups_safe_acl($config["id_user"], $id_group, "AR");
@ -848,7 +849,8 @@ function agents_get_group_agents (
$id_group = groups_get_id_recursive($id_group, true);
}
if (!$noACL) {
// check available groups for target user only if asking for 'All' group
if (!$noACL && $id_group == 0) {
$id_group = array_keys(
users_get_groups(false, "AR", true, false, (array)$id_group));
}

View File

@ -441,7 +441,7 @@ function groups_get_all($groupWithAgents = false) {
* Get all groups recursive from an initial group.
*
* @param int Id of the parent group
* @param bool Whether to return All group or not
* @param bool Whether to force recursive search ignoring propagation (true) or not (false)
*
* @return Array with all result groups
*/
@ -451,10 +451,11 @@ function groups_get_id_recursive($id_parent, $all = false) {
$return = array_merge($return, array($id_parent));
//Check propagate
$id = db_get_value_filter('id_grupo', 'tgrupo', array('id_grupo' => $id_parent, 'propagate' => 1));
$propagate = db_get_value_filter('propagate', 'tgrupo', array('id_grupo' => $id_parent));
if (($id !== false) || $all) {
if (($propagate != 1) || $all) {
$children = db_get_all_rows_filter("tgrupo", array('parent' => $id_parent, 'disabled' => 0), array('id_grupo'));
if ($children === false) {
$children = array();
}

View File

@ -110,7 +110,7 @@ if (is_ajax ()) {
}
// Perform search
$agents = agents_get_group_agents($id_group,$filter,"lower",false,false,false,'|',$cluster_mode);
$agents = agents_get_group_agents($id_group,$filter,"lower",false,$recursion,false,'|',$cluster_mode);
if (empty($agents)) $agents = array();
// Add keys prefix