Bugzilla – Attachment 7175 Details for
Bug 7447
Allow to specify a date in overdue_notice.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7447 allow to specify a date in overdue_notice.pl
Bug-7447-allow-to-specify-a-date-in-overduenoticep.patch (text/plain), 3.94 KB, created by
Paul Poulain
on 2012-01-16 16:19:39 UTC
(
hide
)
Description:
Bug 7447 allow to specify a date in overdue_notice.pl
Filename:
MIME Type:
Creator:
Paul Poulain
Created:
2012-01-16 16:19:39 UTC
Size:
3.94 KB
patch
obsolete
>From a962db5922ca8a9f35274f07e6ba4ab16cff8b09 Mon Sep 17 00:00:00 2001 >From: Paul Poulain <paul.poulain@biblibre.com> >Date: Mon, 16 Jan 2012 17:19:26 +0100 >Subject: [PATCH] Bug 7447 allow to specify a date in overdue_notice.pl > >This patch add a new parameter to overdue_notices.pl, that is a date. >If you add --date=YYYY-MM-DD when running overdue_notices, it will generate overdues as if you were on date provided > >that's usefull if you want to relaunch an overdue calculation that has failed, of after changing your circ rules >--- > misc/cronjobs/overdue_notices.pl | 31 ++++++++++++++++++++++--------- > 1 files changed, 22 insertions(+), 9 deletions(-) > >diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl >index 71e6a05..e965e20 100755 >--- a/misc/cronjobs/overdue_notices.pl >+++ b/misc/cronjobs/overdue_notices.pl >@@ -143,6 +143,10 @@ Default items.content lists only those items that fall in the > range of the currently processing notice. > Choose list-all to include all overdue items in the list (limited by B<-max> setting). > >+=item B<-date> >+ >+use it in order to send overdues on a specific date and not Now. >+ > =back > > =head1 DESCRIPTION >@@ -259,6 +263,7 @@ my $listall = 0; > my $itemscontent = join( ',', qw( date_due title barcode author itemnumber ) ); > my @myborcat; > my @myborcatout; >+my $date; > > GetOptions( > 'help|?' => \$help, >@@ -268,12 +273,13 @@ GetOptions( > 'max=s' => \$MAX, > 'library=s' => \@branchcodes, > 'csv:s' => \$csvfilename, # this optional argument gets '' if not supplied. >- 'html:s' => \$htmlfilename, # this optional argument gets '' if not supplied. >+ 'html:s' => \$htmlfilename, # this optional argument gets '' if not supplied. > 'itemscontent=s' => \$itemscontent, >- 'list-all' => \$listall, >- 't|triggered' => \$triggered, >- 'borcat=s' => \@myborcat, >- 'borcatout=s' => \@myborcatout, >+ 'list-all' => \$listall, >+ 't|triggered' => \$triggered, >+ 'date' => \$date, >+ 'borcat=s' => \@myborcat, >+ 'borcatout=s' => \@myborcatout, > ) or pod2usage(2); > pod2usage(1) if $help; > pod2usage( -verbose => 2 ) if $man; >@@ -320,6 +326,13 @@ if (@branchcodes) { > } > } > >+if ($date){ >+ $date=$dbh->quote($date); >+} >+else { >+ $date="NOW()"; >+} >+ > # these are the fields that will be substituted into <<item.content>> > my @item_content_fields = split( /,/, $itemscontent ); > >@@ -376,13 +389,13 @@ 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(NOW())-TO_DAYS(date_due) AS days_overdue >+SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, TO_DAYS($date)-TO_DAYS(date_due) AS days_overdue > FROM issues,items,biblio, biblioitems > WHERE items.itemnumber=issues.itemnumber > AND biblio.biblionumber = items.biblionumber > AND biblio.biblionumber = biblioitems.biblionumber > AND issues.borrowernumber = ? >- AND TO_DAYS(NOW())-TO_DAYS(date_due) BETWEEN ? and ? >+ AND TO_DAYS($date)-TO_DAYS(date_due) BETWEEN ? and ? > END_SQL > > my $query = "SELECT * FROM overduerules WHERE delay1 IS NOT NULL AND branchcode = ? "; >@@ -442,10 +455,10 @@ END_SQL > } > $borrower_sql .= ' AND categories.overduenoticerequired=1 '; > if($triggered) { >- $borrower_sql .= ' AND TO_DAYS(NOW())-TO_DAYS(date_due) = ?'; >+ $borrower_sql .= ' AND TO_DAYS($date)-TO_DAYS(date_due) = ?'; > push @borrower_parameters, $mindays; > } else { >- $borrower_sql .= ' AND TO_DAYS(NOW())-TO_DAYS(date_due) BETWEEN ? and ? ' ; >+ $borrower_sql .= ' AND TO_DAYS($date)-TO_DAYS(date_due) BETWEEN ? and ? ' ; > push @borrower_parameters, $mindays, $maxdays; > } > >-- >1.7.5.4
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 7447
:
7175
|
9995