Bug 9372: replace carriage return with <br /> in printed HTML files for overdues

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>
(cherry picked from commit 6dbfe1512d)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Sophie Meynieux 2013-08-02 15:48:27 +02:00 committed by Tomas Cohen Arazi
parent 0781cb870c
commit 8f10bef631
1 changed files with 4 additions and 1 deletions

View File

@ -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";