From 40ceec6561763acce9b57d1edba58c06de837b24 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Thu, 18 Oct 2018 18:45:11 +0200 Subject: [PATCH 1/2] Fixed macro _agent_adress_ on events responses --- pandora_console/include/functions_events.php | 21 ++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 39c5fa59ae..3d5e1d6c95 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1863,15 +1863,20 @@ function events_get_response_target($event_id, $response_id, $server_id, $histor // Substitute each macro if (strpos($target, '_agent_address_') !== false) { if ($meta) { - $server = metaconsole_get_connection_by_id ($server_id); - metaconsole_connect($server); - } - - $target = str_replace('_agent_address_', $event['id_agente'], $target); - - if($meta) { - metaconsole_restore_db_force(); + $agente_table_name = 'tmetaconsole_agent'; + $filter = array( + 'id_tagente' => $event['id_agente'], + 'id_metaconsole_setup' => $server_id + ); + } else { + $agente_table_name = 'tagente'; + $filter = array('id_agente' => $event['id_agente']); } + + $ip = db_get_value_filter('direccion', $agente_table_name, $filter); + // If agent has not an ip, display N/A + if ($ip === false) $ip = __('N/A'); + $target = str_replace('_agent_address_', $ip, $target); } if (strpos($target, '_agent_id_') !== false) { $target = str_replace('_agent_id_', $event['id_agente'], $target); From 4d3c74ed3736e20d761b7181cf2f7ecb55beb60c Mon Sep 17 00:00:00 2001 From: fermin831 Date: Thu, 18 Oct 2018 19:20:37 +0200 Subject: [PATCH 2/2] Minor typo fix in events responses --- pandora_console/include/functions_events.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 3d5e1d6c95..ef6518b735 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1866,7 +1866,7 @@ function events_get_response_target($event_id, $response_id, $server_id, $histor $agente_table_name = 'tmetaconsole_agent'; $filter = array( 'id_tagente' => $event['id_agente'], - 'id_metaconsole_setup' => $server_id + 'id_tmetaconsole_setup' => $server_id ); } else { $agente_table_name = 'tagente';