From 63798b98f189fbf3ed22871272907e9fcb365d13 Mon Sep 17 00:00:00 2001 From: Martin Kamerbeek Date: Thu, 6 May 2010 13:51:51 +0200 Subject: [PATCH] Add mail style template override. --- lib/WebGUI/AssetAspect/Mailable.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/AssetAspect/Mailable.pm b/lib/WebGUI/AssetAspect/Mailable.pm index b648a52..1382daf 100644 --- a/lib/WebGUI/AssetAspect/Mailable.pm +++ b/lib/WebGUI/AssetAspect/Mailable.pm @@ -25,6 +25,12 @@ sub definition { my $i18n = WebGUI::International->new( $session,'AssetAspect_Mailable' ); tie my %properties, 'Tie::IxHash', ( + mailStyleTemplateId => { + fieldType => 'template', + label => 'Mail template', + tab => 'mailable', + namespace => 'style', + }, ); push( @{ $definition }, { @@ -73,8 +79,15 @@ sub processContentAsUser { $session->user( { userId => $userId } ); $session->log->preventDebugOutput; + my $styleTemplateId = + $self->get('mailStyleTemplateId') + || $self->get('styleTemplateId'); + # Generate email body for this user - my $content = $self->generateEmailContent; + my $content = $session->style->process( + $self->generateEmailContent, + $styleTemplateId, + ); # Process macros WebGUI::Macro::process( $session, \$content );