Merge branch 'ent-13712-guardia-17556-custom-responses-fallan-en-metaconsola-v776' into 'develop'

Ent 13712 guardia 17556 custom responses fallan en metaconsola v776

See merge request artica/pandorafms!7369
This commit is contained in:
Diego Muñoz-Reja 2024-05-13 10:49:33 +00:00
commit bc71d20ba6
2 changed files with 13 additions and 3 deletions

View File

@ -1205,9 +1205,11 @@ if ($get_response === true) {
if (empty($event_id) === false) { if (empty($event_id) === false) {
try { try {
$target_metaconsole = '';
if (is_metaconsole() === true if (is_metaconsole() === true
&& $server_id > 0 && $server_id > 0
) { ) {
$target_metaconsole = io_safe_output(db_get_value('target', 'tevent_response', 'id', $event_response['id']));
$node = new Node($server_id); $node = new Node($server_id);
$node->connect(); $node->connect();
} }
@ -1217,7 +1219,8 @@ if ($get_response === true) {
$event_response, $event_response,
$response_parameters, $response_parameters,
$server_id, $server_id,
($server_id !== 0) ? $node->server_name() : 'Metaconsole' ($server_id !== 0) ? $node->server_name() : 'Metaconsole',
$target_metaconsole
); );
} catch (\Exception $e) { } catch (\Exception $e) {
// Unexistent agent. // Unexistent agent.

View File

@ -3838,7 +3838,8 @@ function events_get_response_target(
array $event_response, array $event_response,
?array $response_parameters=null, ?array $response_parameters=null,
?int $server_id=0, ?int $server_id=0,
?string $server_name='' ?string $server_name='',
?string $target_metaconsole=''
) { ) {
global $config; global $config;
@ -3852,6 +3853,9 @@ function events_get_response_target(
$event = db_get_row('tevento', 'id_evento', $event_id); $event = db_get_row('tevento', 'id_evento', $event_id);
$target = io_safe_output(db_get_value('target', 'tevent_response', 'id', $event_response['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. // Replace parameters response.
if (isset($response_parameters) === true if (isset($response_parameters) === true
@ -6070,9 +6074,11 @@ function get_events_get_response_target(
$response_parameters=[] $response_parameters=[]
) { ) {
try { try {
$target_metaconsole = '';
if (is_metaconsole() === true if (is_metaconsole() === true
&& $server_id > 0 && $server_id > 0
) { ) {
$target_metaconsole = io_safe_output(db_get_value('target', 'tevent_response', 'id', $event_response['id']));
$node = new Node($server_id); $node = new Node($server_id);
$node->connect(); $node->connect();
} }
@ -6082,7 +6088,8 @@ function get_events_get_response_target(
$event_response, $event_response,
$response_parameters, $response_parameters,
$server_id, $server_id,
($server_id !== 0) ? $node->server_name() : 'Metaconsole' ($server_id !== 0) ? $node->server_name() : 'Metaconsole',
$target_metaconsole
); );
} catch (\Exception $e) { } catch (\Exception $e) {
// Unexistent agent. // Unexistent agent.