diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 4a24d5a964..30b86478f8 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -2744,28 +2744,7 @@ function html_print_autocomplete_modules( global $config; if ($id_agents === false) { - $groups = []; - if ($ACL) { - $groups = users_get_groups($config['id_user'], 'AW', false); - $groups = array_keys($groups); - - if (empty($groups)) { - $id_groups = 0; - } else { - $id_groups = implode(',', $groups); - } - - $agents = db_get_all_rows_sql( - 'SELECT id_agente - FROM tagente - WHERE id_grupo IN ('.$id_groups.')' - ); - } else { - $agents = db_get_all_rows_sql( - 'SELECT id_agente - FROM tagente' - ); - } + $agents = agents_get_agents(); if ($agents === false) { $agents = []; @@ -2777,10 +2756,7 @@ function html_print_autocomplete_modules( } } else { if ($ACL) { - $groups = users_get_groups($config['id_user'], 'AW', false); - $groups = array_keys($groups); - - $agents = db_get_all_rows_sql('SELECT id_agente FROM tagente WHERE id_grupo IN ('.implode(',', $groups).')'); + $agents = agents_get_agents(); if ($agents === false) { $agents = [];