From a7321813f43083db2e101c2c75dac37990002c65 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=utf8 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 Sponsored-by: CCSR Signed-off-by: Kyle M Hall Signed-off-by: Katrin Fischer Passes tests and QA script. Works as described, no problems found. Signed-off-by: Tomas Cohen Arazi Added the Sponsored-by line. --- 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 51ce0722a3..4e58e8a828 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 "