From 833ef3149a993b111fe3955b185c81395ab103b5 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Wed, 20 Apr 2011 14:57:49 +0000 Subject: [PATCH] 2011-04-20 Ramon Novoa * lib/PandoraFMS/Core.pm: Added _policy_ macro to alerts (Enterprise). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4269 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 4 ++++ pandora_server/lib/PandoraFMS/Core.pm | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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; }