Bug 13504: Remove the '----' marker for CHECKIN and CHECKOUT notices
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 31 Dec 2014 12:23:06 +0000 (13:23 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Sun, 4 Jan 2015 14:20:10 +0000 (11:20 -0300)
If only 1 item exist in the message, the marker is not removed.
This marker is removed by render_metadata, but this method is only
called on appending.

Test plan:
1/ Enable the CHECKIN and/or CHECKOUT notices for a patron
2/ check and item in or out and verify that the marker is no longer
displayed in the generated notices.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Message.pm

index a63b3ca..eb27a20 100644 (file)
@@ -159,8 +159,13 @@ sub enqueue {
     my ($class, $letter, $borrower, $transport) = @_;
     my $metadata   = _metadata($letter);
     my $to_address = _to_address($borrower, $transport);
+
+    # Same as render_metadata
+    my $format ||= sub { $_[0] || "" };
+    my $body = join('', map { $format->($_) } @{$metadata->{body}});
+    $letter->{content} = $metadata->{header} . $body . $metadata->{footer};
+
     $letter->{metadata} = Dump($metadata);
-    #carp "enqueuing... to $to_address";
     C4::Letters::EnqueueLetter({
         letter                 => $letter,
         borrowernumber         => $borrower->{borrowernumber},