Merge branch 'ent-9575-14286-crear-un-macro-que-contenga-el-simbolo-de-la-unidad-de-un-modulo' into 'develop'

Ent 9575 14286 crear un macro que contenga el simbolo de la unidad de un modulo

Closes pandora_enterprise#9575

See merge request artica/pandorafms!6294
This commit is contained in:
Rafael Ameijeiras 2023-08-21 05:57:46 +00:00
commit c133c4a0c8
1 changed files with 4 additions and 0 deletions

View File

@ -1399,6 +1399,7 @@ sub pandora_execute_action ($$$$$$$$$;$$) {
_timestamp_ => (defined($timestamp)) ? $timestamp : strftime ("%Y-%m-%d %H:%M:%S", localtime()),
_timezone_ => strftime ("%Z", localtime()),
_data_ => $data,
_dataunit_ => (defined ($module)) ? $module->{'unit'} : '',
_prevdata_ => undef,
_homeurl_ => $pa_config->{'public_url'},
_alert_name_ => $alert->{'name'},
@ -4905,6 +4906,9 @@ sub on_demand_macro($$$$$$;$) {
my $field_number = $1;
my $field_value = get_db_value($dbh, 'SELECT description FROM tagent_custom_data WHERE id_field=? AND id_agent=?', $field_number, $agent_id);
return (defined($field_value)) ? $field_value : '';
} elsif ($macro eq '_dataunit_'){
return '' unless defined ($module);
my $field_value = get_db_value($dbh, 'SELECT unit FROM tagente_modulo where id_agente_modulo = ? limit 1', $module->{'id_agente_modulo'});
} elsif ($macro eq '_prevdata_') {
return '' unless defined ($module);
if ($module->{'id_tipo_modulo'} eq 3){