From 77552805a403f34d2d84901a50f1b6054e12aecd Mon Sep 17 00:00:00 2001 From: Calvo Date: Fri, 16 Jul 2021 13:55:31 +0200 Subject: [PATCH] Fix list agent with secondaty grouos on selec --- .../godmode/agentes/configurar_agente.php | 13 ++++++++++++- pandora_console/include/functions_agents.php | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index abdb5a8dca..ee58019a5a 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -976,6 +976,8 @@ if ($update_agent) { $cps = get_parameter_switch('cps', -1); $old_values = db_get_row('tagente', 'id_agente', $id_agente); $fields = db_get_all_fields_in_table('tagent_custom_fields'); + $secondary_groups = (string) get_parameter('secondary_hidden', ''); + if ($fields === false) { $fields = []; @@ -1205,7 +1207,16 @@ if ($update_agent) { "Quiet":"'.(int) $quiet.'", "Cps":"'.(int) $cps.'"}'; - enterprise_hook('update_agent', [$id_agente]); + // Create the secondary groups. + enterprise_hook( + 'agents_update_secondary_groups', + [ + $id_agente, + explode(',', $secondary_groups), + [], + ] + ); + ui_print_success_message(__('Successfully updated')); db_pandora_audit( 'Agent management', diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 8f9791332f..e0e6b560e7 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -1283,7 +1283,7 @@ function agents_get_group_agents( if (!$add_alert_bulk_op) { // Add the rest of the filter from the search array. foreach ($search as $key => $value) { - $filter[] = $value; + $filter[$key] = $value; } } } else if ($filter !== true) {