Bug 11607: Don't display all items in a single line
authorJonathan Druart <jonathan.druart@biblibre.com>
Wed, 24 Dec 2014 12:09:27 +0000 (13:09 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 19 May 2015 12:27:13 +0000 (09:27 -0300)
If the *DGST notices are sent in HTML, the items are displayed in a
single line.

To reproduce:
1/ Define a *DGST notice using the <<items.content>> pattern.
2/ Checkout at least 2 items to a patron and set the due date as today.
3/ Launch the advance_notices.pl and process_message_queue.pl cronjobs.
4/ Verify the email you will receive separates the items with a line
break.

Verify you don't find a regression for non-html letters.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Note: the display in the notices tab is misleading here,
needs to be verified checking the sent emails or database
entries in message_queue.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Letters.pm

index 0faa91e..c7751ca 100644 (file)
@@ -633,6 +633,10 @@ sub GetPreparedLetter {
 
     if ($substitute) {
         while ( my ($token, $val) = each %$substitute ) {
+            if ( $token eq 'items.content' ) {
+                $val =~ s|\n|<br/>|g if $letter->{is_html};
+            }
+
             $letter->{title} =~ s/<<$token>>/$val/g;
             $letter->{content} =~ s/<<$token>>/$val/g;
        }