From bb4fce07a1ed6c75f8f94967b40ee57f3245111b Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Wed, 11 Dec 2019 12:35:27 +0100 Subject: [PATCH] Added secondary groups in event details --- pandora_console/include/ajax/events.php | 8 +------- pandora_console/include/functions_events.php | 21 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index a9221004c5..24fa8be341 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -1304,24 +1304,18 @@ if ($get_extended_event) { // If metaconsole switch to node to get details and custom fields. if ($meta) { $server = metaconsole_get_connection_by_id($server_id); - metaconsole_connect($server); } else { $server = ''; } $details = events_page_details($event, $server); - if ($meta) { - metaconsole_restore_db(); - } - if (events_has_extended_info($event['id_evento']) === true) { $related = events_page_related($event, $server); } if ($meta) { - $server = metaconsole_get_connection_by_id($server_id); - metaconsole_connect($server); + metaconsole_connect($server); } $custom_fields = events_page_custom_fields($event); diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 6fa2a6533f..a971b896de 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -4222,6 +4222,10 @@ function events_page_details($event, $server='') $details = '
'.html_print_table($table_details, true).'
'; + if (!empty($server) && is_metaconsole()) { + metaconsole_restore_db(); + } + return $details; } @@ -4395,6 +4399,15 @@ function events_page_general($event) global $group_rep; + $secondary_groups = ''; + if (isset($event['id_agente']) && $event['id_agente'] > 0) { + enterprise_include_once('include/functions_agents.php'); + $secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$event['id_agente'], is_metaconsole()]); + if (!empty($secondary_groups_selected)) { + $secondary_groups = implode(', ', $secondary_groups_selected['for_select']); + } + } + // General. $table_general = new stdClass; $table_general->cellspacing = 0; @@ -4521,6 +4534,14 @@ function events_page_general($event) $table_general->data[] = $data; + if (!empty($secondary_groups)) { + $data = []; + $data[0] = __('Secondary groups'); + $data[1] = $secondary_groups; + + $table_general->data[] = $data; + } + $data = []; $data[0] = __('Contact'); $data[1] = '';