Bugzilla – Attachment 23150 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]
Improvements in overdue_notices.pl script (Newer version)
0001-Improvements-in-overdue_notices.pl-script-Newer-vers.patch (text/plain), 5.60 KB, created by
Frédérick Capovilla
on 2013-11-25 22:17:15 UTC
(
hide
)
Description:
Improvements in overdue_notices.pl script (Newer version)
Filename:
MIME Type:
Creator:
Frédérick Capovilla
Created:
2013-11-25 22:17:15 UTC
Size:
5.60 KB
patch
obsolete
>From fc9a385111e21288eb28264b9cb1f98a64540ca8 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick?= <frederick.capovilla@libeo.com> >Date: Mon, 25 Nov 2013 17:13:27 -0500 >Subject: [PATCH] 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 > >--- > misc/cronjobs/overdue_notices.pl | 23 +++++++++++++++-------- > 1 files 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 "<html>\n"; > print $html_fh "<head>\n"; >+ print $html_fh "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"; > print $html_fh "<style type='text/css'>\n"; > print $html_fh "pre {page-break-after: always;}\n"; > print $html_fh "pre {white-space: pre-wrap;}\n"; >@@ -406,10 +407,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 = ? > AND TO_DAYS($date)-TO_DAYS(date_due) BETWEEN ? and ? >@@ -456,7 +458,7 @@ END_SQL > # <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode> <country> > > my $borrower_sql = <<'END_SQL'; >-SELECT distinct(issues.borrowernumber), firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email >+SELECT distinct(issues.borrowernumber), firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, phone, cardnumber > FROM issues,borrowers,categories > WHERE issues.borrowernumber=borrowers.borrowernumber > AND borrowers.categorycode=categories.categorycode >@@ -480,7 +482,7 @@ END_SQL > } > > # $sth gets borrower info iff at least one overdue item has triggered the overdue action. >- my $sth = $dbh->prepare($borrower_sql); >+ my $sth = $dbh->prepare($borrower_sql); > $sth->execute(@borrower_parameters); > $verbose and warn $borrower_sql . "\n $branchcode | " . $overdue_rules->{'categorycode'} . "\n ($mindays, $maxdays)\nreturns " . $sth->rows . " rows"; > >@@ -603,10 +605,14 @@ END_SQL > city => $data->{'city'}, > postcode => $data->{'zipcode'}, > country => $data->{'country'}, >+ phone => $data->{'phone'}, >+ cardnumber => $data->{'cardnumber'}, > email => $notice_email, > itemcount => $itemcount, > titles => $titles, > outputformat => defined $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '', >+ branchname => $branch_details->{'branchname'}, >+ letternumber => $i > } > ); > } >@@ -764,7 +770,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.7.2.5 >
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