Bugzilla – Attachment 7841 Details for
Bug 7408
Expire holds that have been waiting too long
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7408 - Expire holds that have been waiting too long
Bug-7408---Expire-holds-that-have-been-waiting-too.patch (text/plain), 2.71 KB, created by
Kyle M Hall
on 2012-02-23 19:08:47 UTC
(
hide
)
Description:
Bug 7408 - Expire holds that have been waiting too long
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2012-02-23 19:08:47 UTC
Size:
2.71 KB
patch
obsolete
>From 54b489ada679e84253c8a1b7623b354e334e148f Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 23 Feb 2012 14:02:06 -0500 >Subject: [PATCH] Bug 7408 - Expire holds that have been waiting too long > >Modification to cancel_expired_holds.pl. Gives the option to have >any waiting holds past ReservesMaxPickupDelay automatically canceled, >with the option of charging a fee. >--- > misc/cronjobs/holds/cancel_expired_holds.pl | 54 ++++++++++++++++++++++++++- > 1 files changed, 53 insertions(+), 1 deletions(-) > >diff --git a/misc/cronjobs/holds/cancel_expired_holds.pl b/misc/cronjobs/holds/cancel_expired_holds.pl >index 70a2f59..ddb637b 100755 >--- a/misc/cronjobs/holds/cancel_expired_holds.pl >+++ b/misc/cronjobs/holds/cancel_expired_holds.pl >@@ -21,14 +21,66 @@ > #use warnings; FIXME - Bug 2505 > > BEGIN { >+ > # find Koha's Perl modules > # test carefully before changing this > use FindBin; > eval { require "$FindBin::Bin/../kohalib.pl" }; > } > >-# cancel all expired hold requests >+use Getopt::Long; > >+use C4::Context; >+use C4::Accounts qw(manualinvoice); > use C4::Reserves; > >+my ( $help, $verbose, $charge, $cancelwaiting ); >+my $count = 0; >+my $maxdelay = C4::Context->preference("ReservesMaxPickupDelay"); >+ >+GetOptions( >+ 'h|help' => \$help, >+ 'v|verbose' => \$verbose, >+ 'cancelwaiting' => \$cancelwaiting, >+ 'charge:f' => \$charge, >+); >+ >+my $usage = << 'ENDUSAGE'; >+ >+This script cancels expired holds and optionally expires all waiting >+holds over ReservesMaxPickupDelay, and can charge the patron a fee >+for not picking up the material in time. >+ >+This script has the following parameters : >+ -h --help: this message >+ -v --verbose >+ --cancelwaiting >+ --charge <<amount>>: charge the patron <<amount>> for not >+ picking up the waiting hold on time. >+ >+ENDUSAGE >+die $usage if $help; >+ >+print sprintf "Charging patrons \$%.2f for each hold waiting too long...\n", >+ $charge >+ if ( defined $verbose ); >+ >+if ( defined $cancelwaiting ) { >+ my $dbh = C4::Context->dbh; >+ my $sql = "SELECT * FROM reserves WHERE TO_DAYS( NOW() )-TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0"; >+ my $sth = $dbh->prepare($sql); >+ $sth->execute($maxdelay); >+ >+ while ( my $row = $sth->fetchrow_hashref ) { >+ manualinvoice( $row->{'borrowernumber'}, $row->{'itemnumber'}, 'Hold waiting too long', 'F', $charge ) if ($charge); >+ >+ CancelReserve( $row->{'biblionumber'}, '', $row->{'borrowernumber'} ); >+ } >+ >+ print "A total of $count waiting holds canceled\n" if ( defined $verbose ); >+} >+ >+# cancel all expired hold requests > CancelExpiredReserves(); >+print "All expired holds canceled\n" if ( defined $verbose ); >+ >-- >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 7408
:
7357
|
7838
|
7839
|
7840
|
7841
|
7856
|
8022
|
8101
|
8241
|
8242
|
8323
|
8325