Bug 6939 DefaultClassificationSource should be default in 942
[koha_fer] / C4 / Letters.pm
index 514b355..4bde166 100644 (file)
@@ -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(