Bug 9372: replace carriage return with <br /> in printed HTML files for overdues
authorSophie Meynieux <sophie.meynieux@biblibre.com>
Fri, 2 Aug 2013 13:48:27 +0000 (15:48 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 16 Sep 2013 18:37:47 +0000 (18:37 +0000)
For PDF generation, HTML files need explicit <br /> HTML tags. With
this patch, carriage return are replaced by <br /> when letters are
written into HTML files.

Test plan :
- Ensure you've got at least one reader with overdue triggering notice
- Ensure that your notice template got HTML checked
- Run misc/cronjobs/overdue_notices.pl -v -n -html <dirname>
  and misc/cronjobs/printoverdues.sh <dirname>

Without patch, the content of the letter is all on one line in PDF file
With the patch, PDF file is correctly formated

- remove your reader email
- Run misc/cronjobs/overdue_notices.pl -v -html <dirname>
  and misc/cronjobs/printoverdues.sh <dirname>

Without patch, the content of PDF file is all on one line
with the patch, PDF file is correctly formated.

- restore reader email
- run misc/cronjobs/overdue_notice.pl -v -html <dirname>

Verify that the a message has been generated in message_queue table
With or without patch, the message is the same

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
misc/cronjobs/overdue_notices.pl

index 598f922..5da424e 100755 (executable)
@@ -765,7 +765,10 @@ sub prepare_letter_for_printing {
         }
     } elsif ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'html' ) {
       $return = "<pre>\n";
-      $return .= "$params->{'letter'}->{'content'}\n";
+      my $content = $params->{'letter'}->{'content'};
+      $content=~s/\n/<br \/>/g;
+      $content=~s/\r//g;
+      $return .= "$content\n";
       $return .= "\n</pre>\n";
     } else {
         $return .= "$params->{'letter'}->{'content'}\n";