diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 8e89f63965..d440b457f9 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,7 @@ +2011-04-20 Ramon Novoa + + * lib/PandoraFMS/Core.pm: Added _policy_ macro to alerts (Enterprise). + 2011-04-19 Ramon Novoa * lib/PandoraFMS/DB.pm, diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 7adba4b667..c6e28af847 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -639,7 +639,7 @@ sub pandora_execute_action ($$$$$$$$$;$) { _module_ => (defined ($module)) ? $module->{'nombre'} : '', _moduledescription_ => (defined ($module)) ? $module->{'descripcion'} : '', _id_agent_ => (defined ($module)) ? $module->{'id_agente'} : '', - _id_alert_ => $alert->{'id'} + _policy_ => (defined ($module)) ? enterprise_hook('get_policy_name', [$dbh, $module->{'id_policy_module'}]) : '', ); if ((defined ($extra_macros)) && (ref($extra_macros) eq "HASH")) { @@ -1495,8 +1495,13 @@ sub subst_alert_macros ($$) { my ($string, $macros) = @_; while ((my $macro, my $value) = each (%{$macros})) { + + # Undefined macro value + next unless defined ($value); + # Macro data may contain HTML entities my $decoded_value = decode_entities ($value); + $string =~ s/($macro)/$decoded_value/ig; }