From a85749ff67e3a07d1134b40188886dde0ad59d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick?= Date: Mon, 25 Nov 2013 17:13:27 -0500 Subject: [PATCH][SIGNED OFF] Bug 8687: Improvements in overdue_notices.pl script (Newer version) UTF-8 support in the HTML output - Add the cardnumber, phone, branchname and letternumber columns to the csv output === Test made : I ran overdue_notices.pl -n -csv before and after the patch The new columns are displayed, the old are still there I ran overdue_notices.pl -n -html before and after the patch with some chinese characters in my notice The display is correct before and after. Signed-off-by: Mathieu Saby --- misc/cronjobs/overdue_notices.pl | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index 7745047..dfab99d 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -276,7 +276,7 @@ my $csvfilename; my $htmlfilename; my $triggered = 0; my $listall = 0; -my $itemscontent = join( ',', qw( date_due title barcode author itemnumber ) ); +my $itemscontent = join( ',', qw( itemnumber issuedate date_due title barcode author itemcallnumber branchname ) ); my @myborcat; my @myborcatout; my $date; @@ -367,7 +367,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; @@ -381,11 +381,12 @@ if ( defined $htmlfilename ) { $html_fh = *STDOUT; } else { my $today = DateTime->now(time_zone => C4::Context->tz ); - open $html_fh, ">",File::Spec->catdir ($htmlfilename,"notices-".$today->ymd().".html"); + open $html_fh, ">:utf8",File::Spec->catdir ($htmlfilename,"notices-".$today->ymd().".html"); } print $html_fh "\n"; print $html_fh "\n"; + print $html_fh "\n"; print $html_fh "