Merge branch 'ent-6576-macros-de-respuestas-de-eventos-que-no-funcionan' into 'develop'

fixes in event macros (responses)

See merge request artica/pandorafms!3560
This commit is contained in:
Daniel Rodriguez 2020-10-30 11:32:09 +01:00
commit a047ca8181
1 changed files with 16 additions and 5 deletions

View File

@ -3805,7 +3805,7 @@ function events_get_response_target(
if (strpos($target, '_group_name_') !== false) { if (strpos($target, '_group_name_') !== false) {
$target = str_replace( $target = str_replace(
'_group_name_', '_group_name_',
groups_get_name($event['id_grupo'], true), io_safe_output(groups_get_name($event['id_grupo'], true)),
$target $target
); );
} }
@ -3821,7 +3821,7 @@ function events_get_response_target(
if (strpos($target, '_event_date_') !== false) { if (strpos($target, '_event_date_') !== false) {
$target = str_replace( $target = str_replace(
'_event_date_', '_event_date_',
date($config['date_format'], $event['utimestamp']), io_safe_output(date($config['date_format'], $event['utimestamp'])),
$target $target
); );
} }
@ -3845,7 +3845,7 @@ function events_get_response_target(
if (strpos($target, '_alert_id_') !== false) { if (strpos($target, '_alert_id_') !== false) {
$target = str_replace( $target = str_replace(
'_alert_id_', '_alert_id_',
empty($event['is_alert_am']) ? __('N/A') : $event['is_alert_am'], empty($event['id_alert_am']) ? __('N/A') : $event['id_alert_am'],
$target $target
); );
} }
@ -3927,6 +3927,15 @@ function events_get_response_target(
$target = str_replace('_current_user_', $config['id_user'], $target); $target = str_replace('_current_user_', $config['id_user'], $target);
} }
// This will replace the macro with the command timeout value.
if (strpos($target, '_command_timeout_') !== false) {
$target = str_replace(
'_command_timeout_',
$event_response['command_timeout'],
$target
);
}
return $target; return $target;
} }
@ -7007,7 +7016,7 @@ function events_get_field_value_by_event_id(
if (strpos($value, '_group_name_') !== false) { if (strpos($value, '_group_name_') !== false) {
$value = str_replace( $value = str_replace(
'_group_name_', '_group_name_',
groups_get_name($event['id_grupo'], true), io_safe_output(groups_get_name($event['id_grupo'], true)),
$value $value
); );
} }
@ -7023,7 +7032,9 @@ function events_get_field_value_by_event_id(
if (strpos($value, '_event_date_') !== false) { if (strpos($value, '_event_date_') !== false) {
$value = str_replace( $value = str_replace(
'_event_date_', '_event_date_',
date($config['date_format'], $event['utimestamp']), io_safe_output(
date($config['date_format'], $event['utimestamp'])
),
$value $value
); );
} }