Bugzilla – Attachment 30875 Details for
Bug 8687
Improvements in overdue_notices.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 8687 - Overdues: Add utf-8 support to HTML and additional fields to CSV output
PASSED-QA-Bug-8687---Overdues-Add-utf-8-support-to.patch (text/plain), 6.00 KB, created by
Katrin Fischer
on 2014-08-16 19:59:20 UTC
(
hide
)
Description:
[PASSED QA] Bug 8687 - Overdues: Add utf-8 support to HTML and additional fields to CSV output
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2014-08-16 19:59:20 UTC
Size:
6.00 KB
patch
obsolete
>From 535e2027fb0d56f6addbf02c3795797025fe85fc Mon Sep 17 00:00:00 2001 >From: simith <simith@inlibro.com> >Date: Thu, 31 Jul 2014 09:29:17 -0400 >Subject: [PATCH] [PASSED QA] 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 <kyle@bywatersolutions.com> >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >Passes tests and QA script. >Works as described, no problems found. >--- > 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 "<html>\n"; > print $fh "<head>\n"; >+ print $fh "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"; > print $fh "<style type='text/css'>\n"; > print $fh "pre {page-break-after: always;}\n"; > print $fh "pre {white-space: pre-wrap;}\n"; >@@ -435,10 +436,11 @@ foreach my $branchcode (@branches) { > $verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $admin_email_address; > > my $sth2 = $dbh->prepare( <<"END_SQL" ); >-SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, TO_DAYS($date)-TO_DAYS(date_due) AS days_overdue >- FROM issues,items,biblio, biblioitems >+SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, TO_DAYS($date)-TO_DAYS(date_due) AS days_overdue, branchname >+ FROM issues,items,biblio, biblioitems, branches b > WHERE items.itemnumber=issues.itemnumber > AND biblio.biblionumber = items.biblionumber >+ AND b.branchcode = items.homebranch > AND biblio.biblionumber = biblioitems.biblionumber > AND issues.borrowernumber = ? > END_SQL >@@ -484,7 +486,7 @@ END_SQL > # <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode> <country> > > my $borrower_sql = <<'END_SQL'; >-SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, >+SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, > TO_DAYS(?)-TO_DAYS(date_due) as difference, date_due > FROM issues,borrowers,categories > WHERE issues.borrowernumber=borrowers.borrowernumber >@@ -680,6 +682,10 @@ END_SQL > address1 => $data->{'address'}, > address2 => $data->{'address2'}, > city => $data->{'city'}, >+ phone => $data->{'phone'}, >+ cardnumber => $data->{'cardnumber'}, >+ branchname => $branch_details->{'branchname'}, >+ letternumber => $i, > postcode => $data->{'zipcode'}, > country => $data->{'country'}, > email => $notice_email, >@@ -877,7 +883,8 @@ sub prepare_letter_for_printing { > if ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'csv' ) { > if ($csv->combine( > $params->{'firstname'}, $params->{'lastname'}, $params->{'address1'}, $params->{'address2'}, $params->{'postcode'}, >- $params->{'city'}, $params->{'country'}, $params->{'email'}, $params->{'itemcount'}, $params->{'titles'} >+ $params->{'city'}, $params->{'country'}, $params->{'email'}, $params->{'phone'}, $params->{'cardnumber'}, >+ $params->{'itemcount'}, $params->{'titles'}, $params->{'branchname'}, $params->{'letternumber'} > ) > ) { > return $csv->string, "\n"; >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8687
:
11826
|
11829
|
12404
|
12711
|
12712
|
12713
|
17601
|
17941
|
23150
|
23229
|
30403
|
30451
|
30530
|
30538
|
30873
|
30874
| 30875