Merge remote-tracking branch 'origin/develop' into ent-6599-errores-en-filtro-de-monitor-detail
This commit is contained in:
commit
2748f0ac29
|
@ -668,7 +668,7 @@ function mainAgentsModules()
|
|||
if ($recursion) {
|
||||
$filter_groups['id_grupo'] = array_merge(
|
||||
$group_id,
|
||||
groups_get_id_recursive($group_id, true)
|
||||
groups_get_children_ids($group_id, true)
|
||||
);
|
||||
} else {
|
||||
$filter_groups['id_grupo'] = $group_id;
|
||||
|
|
|
@ -408,7 +408,7 @@ if ($ag_group > 0) {
|
|||
$ag_groups = [];
|
||||
$ag_groups = (array) $ag_group;
|
||||
if ($recursion) {
|
||||
$ag_groups = groups_get_id_recursive($ag_group, true);
|
||||
$ag_groups = groups_get_children_ids($ag_group, true);
|
||||
}
|
||||
|
||||
$user_groups_to_sql = implode(',', $ag_groups);
|
||||
|
|
|
@ -877,7 +877,7 @@ if ($id_downtime > 0) {
|
|||
$filter_cond = '';
|
||||
if ($filter_group > 0) {
|
||||
if ($recursion) {
|
||||
$rg = groups_get_id_recursive($filter_group, true);
|
||||
$rg = groups_get_children_ids($filter_group, true);
|
||||
$filter_cond .= ' AND id_grupo IN (';
|
||||
|
||||
$i = 0;
|
||||
|
|
|
@ -40,7 +40,7 @@ if (is_ajax()) {
|
|||
$keys_prefix = (string) get_parameter('keys_prefix', '');
|
||||
|
||||
if ($recursion) {
|
||||
$groups = groups_get_id_recursive($id_group, true);
|
||||
$groups = groups_get_children_ids($id_group, true);
|
||||
} else {
|
||||
$groups = [$id_group];
|
||||
}
|
||||
|
|
|
@ -278,7 +278,7 @@ if ($ag_group > 0) {
|
|||
$ag_groups = [];
|
||||
$ag_groups = (array) $ag_group;
|
||||
if ($recursion) {
|
||||
$ag_groups = groups_get_id_recursive($ag_group, true);
|
||||
$ag_groups = groups_get_children_ids($ag_group, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3744,6 +3744,16 @@ $(document).ready (function () {
|
|||
|
||||
$("#combo_group").change (
|
||||
function () {
|
||||
|
||||
// Alert report group must show all matches when selecting All group
|
||||
// ignoring 'recursion' option. #6497.
|
||||
if ($("#combo_group").val() == 0) {
|
||||
$('#checkbox-recursion').attr('disabled',true)
|
||||
$('#checkbox-recursion').attr('checked','checked')
|
||||
} else {
|
||||
$('#checkbox-recursion').removeAttr('disabled')
|
||||
}
|
||||
|
||||
$("#id_agents").html('');
|
||||
$("#id_agents2").html('');
|
||||
$("#module").html('');
|
||||
|
@ -3772,6 +3782,7 @@ $(document).ready (function () {
|
|||
);
|
||||
}
|
||||
);
|
||||
$("#combo_group").change();
|
||||
|
||||
$("#checkbox-recursion").change (
|
||||
function () {
|
||||
|
|
|
@ -143,7 +143,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
|
|||
$ag_groups = [];
|
||||
$ag_groups = (array) $ag_group;
|
||||
if ($recursion) {
|
||||
$ag_groups = groups_get_id_recursive($ag_group, true);
|
||||
$ag_groups = groups_get_children_ids($ag_group, true);
|
||||
}
|
||||
} else if ($own_info['is_admin']) {
|
||||
$returnAllGroups = 1;
|
||||
|
|
|
@ -248,7 +248,7 @@ class CredentialStore extends Wizard
|
|||
);
|
||||
} else {
|
||||
$groups = [ $filter['filter_id_group'] ];
|
||||
$childrens = groups_get_childrens($id_group, null, true);
|
||||
$childrens = groups_get_children($id_group, null, true);
|
||||
if (!empty($childrens)) {
|
||||
foreach ($childrens as $child) {
|
||||
$groups[] = (int) $child['id_grupo'];
|
||||
|
|
|
@ -810,7 +810,7 @@ class NetworkMap
|
|||
$filter['id_grupo'] = $this->idGroup;
|
||||
} else {
|
||||
// Show current group and children.
|
||||
$childrens = groups_get_childrens($this->idGroup, null, true);
|
||||
$childrens = groups_get_children($this->idGroup, null, true);
|
||||
if (!empty($childrens)) {
|
||||
$childrens = array_keys($childrens);
|
||||
|
||||
|
|
|
@ -1342,6 +1342,73 @@ function get_priority_name($priority)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Translates status into string.
|
||||
*
|
||||
* @param integer $status Agent status.
|
||||
*
|
||||
* @return string Translation.
|
||||
*/
|
||||
function get_agent_status_string($status)
|
||||
{
|
||||
switch ($status) {
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
return __('CRITICAL');
|
||||
|
||||
case AGENT_STATUS_WARNING:
|
||||
return __('WARNING');
|
||||
|
||||
case AGENT_STATUS_ALERT_FIRED:
|
||||
return __('ALERT FIRED');
|
||||
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
return __('NO DATA');
|
||||
|
||||
case AGENT_STATUS_NORMAL:
|
||||
return __('NORMAL');
|
||||
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
default:
|
||||
return __('UNKNOWN');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Translates status into string.
|
||||
*
|
||||
* @param integer $status Module status.
|
||||
*
|
||||
* @return string Translation.
|
||||
*/
|
||||
function get_module_status_string($status)
|
||||
{
|
||||
switch ($status) {
|
||||
case AGENT_MODULE_STATUS_CRITICAL_BAD:
|
||||
return __('CRITICAL');
|
||||
|
||||
case AGENT_MODULE_STATUS_WARNING_ALERT:
|
||||
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
|
||||
return __('ALERT FIRED');
|
||||
|
||||
case AGENT_MODULE_STATUS_WARNING:
|
||||
return __('WARNING');
|
||||
|
||||
case AGENT_MODULE_STATUS_UNKNOWN:
|
||||
return __('UNKNOWN');
|
||||
|
||||
case AGENT_MODULE_STATUS_NO_DATA:
|
||||
case AGENT_MODULE_STATUS_NOT_INIT:
|
||||
return __('NO DATA');
|
||||
|
||||
case AGENT_MODULE_STATUS_NORMAL_ALERT:
|
||||
case AGENT_MODULE_STATUS_NORMAL:
|
||||
default:
|
||||
return __('NORMAL');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get priority class (CSS class) from priority value.
|
||||
*
|
||||
|
|
|
@ -19,17 +19,18 @@
|
|||
|
||||
require_once $config['homedir'].'/include/functions.php';
|
||||
require_once $config['homedir'].'/include/functions_modules.php';
|
||||
require_once $config['homedir'].'/include/functions_users.php';/**
|
||||
* Return the agent if exists in the DB.
|
||||
*
|
||||
* @param integer $id_agent The agent id.
|
||||
* @param boolean $show_disabled Show the agent found althought it is disabled. By default false.
|
||||
* @param boolean $force_meta
|
||||
*
|
||||
* @return boolean The result to check if the agent is in the DB.
|
||||
*/
|
||||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
|
||||
|
||||
/**
|
||||
* Return the agent if exists in the DB.
|
||||
*
|
||||
* @param integer $id_agent The agent id.
|
||||
* @param boolean $show_disabled Show the agent found althought it is disabled. By default false.
|
||||
* @param boolean $force_meta
|
||||
*
|
||||
* @return boolean The result to check if the agent is in the DB.
|
||||
*/
|
||||
function agents_get_agent($id_agent, $show_disabled=true, $force_meta=false)
|
||||
{
|
||||
$agent = db_get_row_filter(
|
||||
|
@ -1113,11 +1114,14 @@ function agents_get_group_agents(
|
|||
foreach ($id_group as $parent) {
|
||||
$id_group = array_merge(
|
||||
$id_group,
|
||||
groups_get_id_recursive($parent, false)
|
||||
groups_get_children_ids($parent, $noACL)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$id_group = groups_get_id_recursive($id_group, false);
|
||||
$id_group = array_merge(
|
||||
[$id_group],
|
||||
groups_get_children_ids($id_group, $noACL)
|
||||
);
|
||||
}
|
||||
|
||||
// Check available groups for target user only if asking for 'All' group.
|
||||
|
|
|
@ -1973,7 +1973,7 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType)
|
|||
$ag_groups = $other['data'][1];
|
||||
// Recursion.
|
||||
if ($other['data'][6] === '1') {
|
||||
$ag_groups = groups_get_id_recursive($ag_groups, true);
|
||||
$ag_groups = groups_get_children_ids($ag_groups, true);
|
||||
}
|
||||
|
||||
$ag_groups = implode(',', (array) $ag_groups);
|
||||
|
|
|
@ -367,7 +367,7 @@ function agent_counters_custom_fields($filters)
|
|||
if ($filters['group']) {
|
||||
// Recursion check acl.
|
||||
if ($filters['recursion']) {
|
||||
$recursion_groups = groups_get_id_recursive($filters['group'], true);
|
||||
$recursion_groups = groups_get_children_ids($filters['group'], true);
|
||||
if (!users_can_manage_group_all('AR')) {
|
||||
if (isset($user_groups) && is_array($user_groups)) {
|
||||
$groups_intersect = array_intersect($user_groups, $recursion_groups);
|
||||
|
|
|
@ -871,37 +871,23 @@ function events_get_all(
|
|||
}
|
||||
|
||||
$groups = $filter['id_group_filter'];
|
||||
if (isset($groups) && $groups > 0) {
|
||||
$propagate = db_get_value(
|
||||
'propagate',
|
||||
'tgrupo',
|
||||
'id_grupo',
|
||||
$groups
|
||||
);
|
||||
if (isset($groups) === true && $groups > 0) {
|
||||
$children = groups_get_children($groups);
|
||||
|
||||
if (!$propagate && isset($groups)) {
|
||||
$sql_filters[] = sprintf(
|
||||
' AND (te.id_grupo = %d OR tasg.id_group = %d)',
|
||||
$groups,
|
||||
$groups
|
||||
);
|
||||
} else {
|
||||
$children = groups_get_children($groups);
|
||||
$_groups = [ $groups ];
|
||||
if (!empty($children)) {
|
||||
foreach ($children as $child) {
|
||||
$_groups[] = (int) $child['id_grupo'];
|
||||
}
|
||||
$_groups = [ $groups ];
|
||||
if (empty($children) === false) {
|
||||
foreach ($children as $child) {
|
||||
$_groups[] = (int) $child['id_grupo'];
|
||||
}
|
||||
|
||||
$groups = $_groups;
|
||||
|
||||
$sql_filters[] = sprintf(
|
||||
' AND (te.id_grupo IN (%s) OR tasg.id_group IN (%s))',
|
||||
join(',', $groups),
|
||||
join(',', $groups)
|
||||
);
|
||||
}
|
||||
|
||||
$groups = $_groups;
|
||||
|
||||
$sql_filters[] = sprintf(
|
||||
' AND (te.id_grupo IN (%s) OR tasg.id_group IN (%s))',
|
||||
join(',', $groups),
|
||||
join(',', $groups)
|
||||
);
|
||||
}
|
||||
|
||||
// Skip system messages if user is not PM.
|
||||
|
|
|
@ -266,48 +266,25 @@ function groups_check_used($idGroup)
|
|||
|
||||
|
||||
/**
|
||||
* Return a array of id_group of childrens (to branches down)
|
||||
*
|
||||
* @param integer $parent The id_group parent to search the childrens.
|
||||
* @param array $groups The groups, its for optimize the querys to DB.
|
||||
*/
|
||||
function groups_get_childrens_ids($parent, $groups=null)
|
||||
{
|
||||
if (empty($groups)) {
|
||||
$groups = db_get_all_rows_in_table('tgrupo');
|
||||
}
|
||||
|
||||
$return = '';
|
||||
|
||||
foreach ($groups as $key => $group) {
|
||||
if ($group['id_grupo'] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($group['parent'] == $parent) {
|
||||
$return .= $group['id_grupo'].',';
|
||||
$propagate = db_get_value('propagate', 'tgrupo', 'id_grupo', $group['id_grupo']);
|
||||
if ($propagate) {
|
||||
$return .= groups_get_childrens_ids($group['id_grupo']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a array of id_group of children of given parent.
|
||||
* Return a array of id_group of children of given parent INCLUDING PARENT!!.
|
||||
*
|
||||
* @param integer $parent The id_grupo parent to search its children.
|
||||
* @param array $ignorePropagate Ignore propagate.
|
||||
* @param string $privilege Default privilege.
|
||||
* @param boolean $selfInclude Include group "id_parent" in return.
|
||||
*
|
||||
* @return array Of Groups, children of $parent.
|
||||
*/
|
||||
function groups_get_children($parent, $ignorePropagate=false)
|
||||
{
|
||||
function groups_get_children(
|
||||
$parent,
|
||||
$ignorePropagate=false,
|
||||
$privilege='AR',
|
||||
$selfInclude=true
|
||||
) {
|
||||
static $groups;
|
||||
static $user_groups;
|
||||
|
||||
if (empty($groups)) {
|
||||
if (empty($groups) === true) {
|
||||
$aux_groups = [];
|
||||
$groups = db_get_all_rows_in_table('tgrupo');
|
||||
foreach ($groups as $key => $value) {
|
||||
|
@ -317,19 +294,45 @@ function groups_get_children($parent, $ignorePropagate=false)
|
|||
$groups = $aux_groups;
|
||||
}
|
||||
|
||||
if (empty($user_groups) === true) {
|
||||
$user_groups = users_get_groups(false, $privilege, true);
|
||||
}
|
||||
|
||||
// Admin see always all groups.
|
||||
$ignorePropagate = users_is_admin() || $ignorePropagate;
|
||||
|
||||
// Prepare array.
|
||||
$return = [];
|
||||
|
||||
if ($selfInclude === true) {
|
||||
if (array_key_exists($parent, $user_groups) === true) {
|
||||
$return[$parent] = $groups[$parent];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($groups as $key => $g) {
|
||||
if ($g['id_grupo'] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($ignorePropagate || $parent == 0 || $groups[$parent]['propagate']) {
|
||||
// IgnorePropagate will be true if user can access child.
|
||||
$allowed = $ignorePropagate || array_key_exists(
|
||||
$g['id_grupo'],
|
||||
$user_groups
|
||||
);
|
||||
|
||||
if ($allowed === true
|
||||
|| (int) $parent === 0
|
||||
|| (bool) $groups[$parent]['propagate'] === true
|
||||
) {
|
||||
if ($g['parent'] == $parent) {
|
||||
$return += [$g['id_grupo'] => $g];
|
||||
if ($g['propagate'] || $ignorePropagate) {
|
||||
$return += groups_get_children(
|
||||
$g['id_grupo'],
|
||||
$ignorePropagate
|
||||
$ignorePropagate,
|
||||
$privilege,
|
||||
$selfInclude
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -340,38 +343,6 @@ function groups_get_children($parent, $ignorePropagate=false)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated This is not working. Expects 'propagate' on CHILD not on PARENT!!!
|
||||
*
|
||||
* Return a array of id_group of childrens (to branches down)
|
||||
*
|
||||
* @param integer $parent The id_group parent to search the childrens.
|
||||
* @param array $groups The groups, its for optimize the querys to DB.
|
||||
*/
|
||||
function groups_get_childrens($parent, $groups=null, $onlyPropagate=false)
|
||||
{
|
||||
if (empty($groups)) {
|
||||
$groups = db_get_all_rows_in_table('tgrupo');
|
||||
}
|
||||
|
||||
$return = [];
|
||||
|
||||
foreach ($groups as $key => $group) {
|
||||
if ($group['id_grupo'] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($group['propagate'] || $onlyPropagate) {
|
||||
if ($group['parent'] == $parent) {
|
||||
$return = ($return + [$group['id_grupo'] => $group] + groups_get_childrens($group['id_grupo'], $groups, $onlyPropagate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a array of id_group of parents (to roots up).
|
||||
*
|
||||
|
@ -534,42 +505,30 @@ function groups_get_all($groupWithAgents=false)
|
|||
|
||||
|
||||
/**
|
||||
* Get all groups recursive from an initial group.
|
||||
* Get all groups recursive from an initial group INCLUDING PARENT!!.
|
||||
*
|
||||
* @param int Id of the parent group
|
||||
* @param bool Whether to force recursive search ignoring propagation (true) or not (false)
|
||||
* @param integer $id_parent Id of the parent group.
|
||||
* @param boolean $ignorePropagate Whether to force recursive search ignoring
|
||||
* propagation (true) or not (false).
|
||||
* @param boolean $selfInclude Include group "id_parent" in return.
|
||||
* @param string $privilege Privilege flag to search for default 'AR'.
|
||||
*
|
||||
* @return array with all result groups
|
||||
* @return array With all result groups.
|
||||
*/
|
||||
function groups_get_id_recursive($id_parent, $all=false)
|
||||
{
|
||||
$return = [];
|
||||
function groups_get_children_ids(
|
||||
$id_parent,
|
||||
$ignorePropagate=false,
|
||||
$selfInclude=true,
|
||||
$privilege='AR'
|
||||
) {
|
||||
$return = groups_get_children(
|
||||
$id_parent,
|
||||
$ignorePropagate,
|
||||
$privilege,
|
||||
$selfInclude
|
||||
);
|
||||
|
||||
$return = array_merge($return, [$id_parent]);
|
||||
|
||||
// Check propagate
|
||||
$propagate = db_get_value_filter('propagate', 'tgrupo', ['id_grupo' => $id_parent]);
|
||||
|
||||
if (($propagate == 1) || $all) {
|
||||
$children = db_get_all_rows_filter('tgrupo', ['parent' => $id_parent, 'disabled' => 0], ['id_grupo']);
|
||||
|
||||
if ($children === false) {
|
||||
$children = [];
|
||||
} else {
|
||||
$temp = [];
|
||||
foreach ($children as $id_children) {
|
||||
$temp = array_merge($temp, [$id_children['id_grupo']]);
|
||||
}
|
||||
|
||||
$children = $temp;
|
||||
}
|
||||
|
||||
foreach ($children as $id_children) {
|
||||
$return = array_merge($return, groups_get_id_recursive($id_children, $all));
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
return array_keys($return);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -319,7 +319,7 @@ function networkmap_generate_dot(
|
|||
if ($dont_show_subgroups) {
|
||||
$filter['id_grupo'] = $group;
|
||||
} else {
|
||||
$childrens = groups_get_childrens($group, null, true);
|
||||
$childrens = groups_get_children($group, null, true);
|
||||
if (!empty($childrens)) {
|
||||
$childrens = array_keys($childrens);
|
||||
|
||||
|
|
|
@ -3912,7 +3912,7 @@ function reporting_alert_report_group($report, $content)
|
|||
|
||||
$agent_modules = alerts_get_agent_modules(
|
||||
$content['id_group'],
|
||||
$content['recursion']
|
||||
(((string) $content['id_group'] === '0') ? true : $content['recursion'])
|
||||
);
|
||||
|
||||
if (empty($alerts)) {
|
||||
|
@ -9169,7 +9169,7 @@ function reporting_get_group_stats($id_group=0, $access='AR')
|
|||
$covered_groups = [];
|
||||
$group_array = [];
|
||||
foreach ($id_group as $group) {
|
||||
$children = groups_get_childrens($group);
|
||||
$children = groups_get_children($group);
|
||||
|
||||
// Show empty groups only if they have children with agents
|
||||
// $group_array = array();
|
||||
|
|
|
@ -941,7 +941,7 @@ function tags_get_acl_tags_event_condition(
|
|||
}
|
||||
|
||||
// Group condition (The module belongs to an agent of the group X)
|
||||
// $group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_id_recursive($group_id, true))));.
|
||||
// $group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_children_ids($group_id, true))));.
|
||||
$group_condition = '('.$id_grupo_table_pretag.'id_grupo = '.$group_id.' OR '.$alt_id_grupo_table_pretag.'id_group = '.$group_id.')';
|
||||
|
||||
// Tags condition (The module has at least one of the restricted tags).
|
||||
|
@ -1350,7 +1350,7 @@ function tags_checks_event_acl($id_user, $id_group, $access, $tags=[], $children
|
|||
foreach ($user_tags as $user_tag) {
|
||||
$tags_user = $user_tag['tags'];
|
||||
$id_group_user = $user_tag['id_grupo'];
|
||||
$childrens = groups_get_childrens($id_group_user, null, true);
|
||||
$childrens = groups_get_children($id_group_user, null, true);
|
||||
|
||||
if (empty($childrens)) {
|
||||
$group_ids = $id_group_user;
|
||||
|
@ -1421,7 +1421,7 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
|
|||
$tags_arr = explode(',', $tags);
|
||||
foreach ($tags_arr as $tag) {
|
||||
if ($tag == $id_tag) {
|
||||
$hierarchy_groups = groups_get_id_recursive($group_id);
|
||||
$hierarchy_groups = groups_get_children_ids($group_id);
|
||||
$groups_id = array_merge($groups_id, $hierarchy_groups);
|
||||
}
|
||||
}
|
||||
|
@ -1923,7 +1923,7 @@ function tags_get_monitors_counter($id_tag, $groups_and_tags=[], $agent_filter=[
|
|||
$tags_arr = explode(',', $tags);
|
||||
foreach ($tags_arr as $tag) {
|
||||
if ($tag == $id_tag) {
|
||||
$hierarchy_groups = groups_get_id_recursive($group_id);
|
||||
$hierarchy_groups = groups_get_children_ids($group_id);
|
||||
$groups_id = array_merge($groups_id, $hierarchy_groups);
|
||||
}
|
||||
}
|
||||
|
@ -2219,7 +2219,7 @@ function tags_monitors_fired_alerts($id_tag, $groups_and_tags=[], $id_agente=fal
|
|||
$tags_arr = explode(',', $tags);
|
||||
foreach ($tags_arr as $tag) {
|
||||
if ($tag == $id_tag) {
|
||||
$hierarchy_groups = groups_get_id_recursive($group_id);
|
||||
$hierarchy_groups = groups_get_children_ids($group_id);
|
||||
$groups_id = array_merge($groups_id, $hierarchy_groups);
|
||||
}
|
||||
}
|
||||
|
@ -2283,7 +2283,7 @@ function tags_get_monitors_alerts($id_tag, $groups_and_tags=[], $id_agente=false
|
|||
$tags_arr = explode(',', $tags);
|
||||
foreach ($tags_arr as $tag) {
|
||||
if ($tag == $id_tag) {
|
||||
$hierarchy_groups = groups_get_id_recursive($group_id);
|
||||
$hierarchy_groups = groups_get_children_ids($group_id);
|
||||
$groups_id = array_merge($groups_id, $hierarchy_groups);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -546,7 +546,7 @@ if (!empty($search_custom)) {
|
|||
if ($group_id > 0) {
|
||||
$groups = [$group_id];
|
||||
if ($recursion) {
|
||||
$groups = groups_get_id_recursive($group_id, true);
|
||||
$groups = groups_get_children_ids($group_id, true);
|
||||
}
|
||||
} else {
|
||||
$groups = [];
|
||||
|
@ -576,7 +576,7 @@ if ($strict_user) {
|
|||
if ($group_id > 0) {
|
||||
$groups = [$group_id];
|
||||
if ($recursion) {
|
||||
$groups = groups_get_id_recursive($group_id, true);
|
||||
$groups = groups_get_children_ids($group_id, true);
|
||||
}
|
||||
|
||||
$filter['id_group'] = implode(',', $groups);
|
||||
|
|
|
@ -88,7 +88,7 @@ if (is_ajax()) {
|
|||
|
||||
if ($get_agents_group_json) {
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
$recursion = (bool) get_parameter('recursion');
|
||||
$recursion = (get_parameter_switch('recursion', 'false') === 'true');
|
||||
$id_os = get_parameter('id_os', '');
|
||||
$agent_name = get_parameter('name', '');
|
||||
|
||||
|
@ -146,14 +146,24 @@ if (is_ajax()) {
|
|||
|
||||
// Perform search.
|
||||
$agents = agents_get_group_agents(
|
||||
// Id_group.
|
||||
$id_group,
|
||||
// Search.
|
||||
$filter,
|
||||
// Case.
|
||||
'lower',
|
||||
false,
|
||||
// NoACL.
|
||||
true,
|
||||
// ChildGroups.
|
||||
$recursion,
|
||||
// Serialized.
|
||||
false,
|
||||
// Separator.
|
||||
'|',
|
||||
$cluster_mode
|
||||
// Add_alert_bulk_op.
|
||||
$cluster_mode,
|
||||
// Force_serialized.
|
||||
false
|
||||
);
|
||||
|
||||
if (empty($agents)) {
|
||||
|
|
|
@ -28,7 +28,7 @@ if ($id_group > 0) {
|
|||
if ($propagate) {
|
||||
$childrens_ids = [$id_group];
|
||||
|
||||
$childrens = groups_get_childrens($id_group, null, true);
|
||||
$childrens = groups_get_children($id_group, null, true);
|
||||
|
||||
if (!empty($childrens)) {
|
||||
foreach ($childrens as $child) {
|
||||
|
|
Loading…
Reference in New Issue