From af984f54772644c8b2b5ff7a251ab5c26caf15ce Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Thu, 8 Mar 2012 13:50:47 +0100 Subject: [PATCH] Bug 6090: Do not enqueue empty messages This patch avoid enqueuing messages that have an empty body. It can happen when letter is empty or becomes empty after being processed by parseletter Signed-off-by: Kyle M Hall --- C4/Letters.pm | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/C4/Letters.pm b/C4/Letters.pm index 89213fe..0290910 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -1,4 +1,4 @@ -package C4::Letters; +kfpackage C4::Letters; # Copyright 2000-2002 Katipo Communications # @@ -672,6 +672,13 @@ sub EnqueueLetter ($) { return unless exists $params->{'borrowernumber'}; return unless exists $params->{'message_transport_type'}; + my $content = $params->{letter}->{content}; + $content =~ s/\s+//g if(defined $content); + if ( not defined $content or $content eq '' ) { + warn "Trying to add an empty message to the message queue" if $debug; + return; + } + # If we have any attachments we should encode then into the body. if ( $params->{'attachments'} ) { $params->{'letter'} = _add_attachments( -- 1.7.2.5