From: Sophie Meynieux <[email protected]>

    This patch replaces carriage return with <br /> in the content of
    hold notices for printing. This is necessary to convert html file
    into well formatted pdf file.

Test plan :
  - checkin an item reserved by a borrower
    that has not activated email notification
  - verify in message_queue table that you've got a
    new HOLD_PRINT notice with status 'pending'
  - run gather_print_notices.pl <directory>

Without the patch, the script generates a html file without <br /> tags.
If you run printoverdues.sh <directory>, the text in the resulting pdf file
is all on one line

With the patch, the script generates a html file with <br/> tags and
pdf file created by printoverdues.sh is well formatted.

Signed-off-by: Srdjan <[email protected]>
---
 misc/cronjobs/gather_print_notices.pl | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/misc/cronjobs/gather_print_notices.pl 
b/misc/cronjobs/gather_print_notices.pl
index 286b035..2d05557 100755
--- a/misc/cronjobs/gather_print_notices.pl
+++ b/misc/cronjobs/gather_print_notices.pl
@@ -69,6 +69,14 @@ my $today        = C4::Dates->new();
 my @all_messages = @{ GetPrintMessages() };
 exit unless (@all_messages);
 
+## carriage return replaced by <br/> as output is html
+foreach my $message (@all_messages) {
+    local $_ = $message->{'content'};
+    s/\n/<br \/>/g;
+    s/\r//g;
+    $message->{'content'} = $_;
+}
+
 my $OUTPUT;
 
 if ($split) {
-- 
1.8.1.2
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to