From d7dc4d4bfe691de9a0d8fa54019c4ab6ff1bc0a7 Mon Sep 17 00:00:00 2001 From: simith Date: Thu, 31 Jul 2014 09:29:17 -0400 Subject: [PATCH] Bug 8687 - Overdues: Add utf-8 support to HTML and additional fields to CSV output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch contains small improvements made in the overdue_notices.pl script. - UTF-8 support in the HTML output - Add the phone, cardnumber, branchname and letternumber columns to the csv output Testing: I) Create an issue overdue (intranet): 0) Enter in a patron account, add some characters like ユーザー別サイト in his address 1) Check if in Patron category administration the overdue column is YES for his code 2) In Tools -> Notice triggers define first delay = 7, letter Overdue notice. Nothing for second ni third 3) Check if Tools -> Notices and slips, code overdue is available 4) checkout a book with a retard more than 7 days. 5) Check if Adminstration -> Defining circulation and fine rules for all libraries has fine rules for his patron category, item type book. II) Before applying the patch 0) Run misc/cronjobs/overdue_notices.pl -n -html . 1) Open the file notices_"date".html in a brower 2) Validate the characters are not correct III) After applying the patch 0) Run misc/cronjobs/overdue_notices.pl -n -html . 1) Open the file notices_"date".html in a brower 2) Validate the characters are correct 3) Run misc/cronjobs/overdue_notices.pl -n -csv temp.csv 4) Validate phone, cardnumber, branchname and letternumber columns and values Signed-off-by: Kyle M Hall --- misc/cronjobs/overdue_notices.pl | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index a0a1254..4e4938f 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -381,7 +381,7 @@ if ( defined $csvfilename ) { } else { open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!"; } - if ( $csv->combine(qw(name surname address1 address2 zipcode city country email itemcount itemsinfo)) ) { + if ( $csv->combine(qw(name surname address1 address2 zipcode city country email phone cardnumber itemcount itemsinfo branchname letternumber)) ) { print $csv_fh $csv->string, "\n"; } else { $verbose and warn 'combine failed on argument: ' . $csv->error_input; @@ -395,11 +395,12 @@ if ( defined $htmlfilename ) { $fh = *STDOUT; } else { my $today = DateTime->now(time_zone => C4::Context->tz ); - open $fh, ">",File::Spec->catdir ($htmlfilename,"notices-".$today->ymd().".html"); + open $fh, ">:encoding(UTF-8)",File::Spec->catdir ($htmlfilename,"notices-".$today->ymd().".html"); } print $fh "\n"; print $fh "\n"; + print $fh "\n"; print $fh "