From 0c6216622c6aa66ec5934f57305463a252d89b75 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Fri, 10 May 2024 14:54:10 +0200 Subject: [PATCH] #13712 Fixed response in metaconsole --- pandora_console/include/ajax/events.php | 5 ++++- pandora_console/include/functions_events.php | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index b053d304b6..92aebb457f 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -1205,9 +1205,11 @@ if ($get_response === true) { if (empty($event_id) === false) { try { + $target_metaconsole = ''; if (is_metaconsole() === true && $server_id > 0 ) { + $target_metaconsole = io_safe_output(db_get_value('target', 'tevent_response', 'id', $event_response['id'])); $node = new Node($server_id); $node->connect(); } @@ -1217,7 +1219,8 @@ if ($get_response === true) { $event_response, $response_parameters, $server_id, - ($server_id !== 0) ? $node->server_name() : 'Metaconsole' + ($server_id !== 0) ? $node->server_name() : 'Metaconsole', + $target_metaconsole ); } catch (\Exception $e) { // Unexistent agent. diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index bf10fc8eb6..9d43b05c2f 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -3838,7 +3838,8 @@ function events_get_response_target( array $event_response, ?array $response_parameters=null, ?int $server_id=0, - ?string $server_name='' + ?string $server_name='', + ?string $target_metaconsole='' ) { global $config; @@ -3852,6 +3853,9 @@ function events_get_response_target( $event = db_get_row('tevento', 'id_evento', $event_id); $target = io_safe_output(db_get_value('target', 'tevent_response', 'id', $event_response['id'])); + if (empty($target) === true && $target_metaconsole !== '') { + $target = io_safe_output($target_metaconsole); + } // Replace parameters response. if (isset($response_parameters) === true @@ -6070,9 +6074,11 @@ function get_events_get_response_target( $response_parameters=[] ) { try { + $target_metaconsole = ''; if (is_metaconsole() === true && $server_id > 0 ) { + $target_metaconsole = io_safe_output(db_get_value('target', 'tevent_response', 'id', $event_response['id'])); $node = new Node($server_id); $node->connect(); } @@ -6082,7 +6088,8 @@ function get_events_get_response_target( $event_response, $response_parameters, $server_id, - ($server_id !== 0) ? $node->server_name() : 'Metaconsole' + ($server_id !== 0) ? $node->server_name() : 'Metaconsole', + $target_metaconsole ); } catch (\Exception $e) { // Unexistent agent.