From 0ea4f718251cfe5b86295cdb80feca93c941103f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick?= Date: Fri, 24 Aug 2012 13:43:51 -0400 Subject: [PATCH] Bug 8687: Improvements in the overdue_notices.pl script - UTF-8 support in the HTML output - Add the cardnumber and phone columns to the csv output Patch sponsored by the CCSR ( http://www.ccsr.qc.ca ) --- misc/cronjobs/overdue_notices.pl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index 5f285c0..72ae66b 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -60,7 +60,7 @@ overdue_notices.pl -max maximum days overdue to deal with -library only deal with overdues from this library (repeatable : several libraries can be given) -csv populate CSV file - -html Output html to file + -html Output html to file directory or to STDOUT if none specified -itemscontent item information in templates -borcat category code that must be included -borcatout category code that must be excluded @@ -362,7 +362,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)) ) { print $csv_fh $csv->string, "\n"; } else { $verbose and warn 'combine failed on argument: ' . $csv->error_input; @@ -376,11 +376,13 @@ 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"); + my $htmlfile = File::Spec->catdir ($htmlfilename,"notices-".$today->ymd().".html"); + open $html_fh, ">:encoding(UTF-8)", $htmlfile or die "unable to open $htmlfile; $! (Be sure to create the directory)\n"; } print $html_fh "\n"; print $html_fh "\n"; + print $html_fh "\n"; print $html_fh "