Bugzilla – Attachment 8022 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]
[SIGNED OFF] Bug 7408 - Expire holds that have been waiting too long
SIGNED-OFF-Bug-7408---Expire-holds-that-have-been-.patch (text/plain), 7.87 KB, created by
Ian Walls
on 2012-03-05 20:53:20 UTC
(
hide
)
Description:
[SIGNED OFF] Bug 7408 - Expire holds that have been waiting too long
Filename:
MIME Type:
Creator:
Ian Walls
Created:
2012-03-05 20:53:20 UTC
Size:
7.87 KB
patch
obsolete
>From d9cb9d9a84767b5e86ea4af61626507706e39073 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 23 Feb 2012 12:09:06 -0500 >Subject: [PATCH] [SIGNED OFF] Bug 7408 - Expire holds that have been waiting too long > >If the new syspref ExpireReservesMaxPickUpDelay is enabled, >this will cancel holds that have been waiting for longer than the >number of days specified in the syspref ReservesMaxPickupDelay. > >If ExpireReservesMaxPickUpDelayCharge is set, the borrower charged the fee set therein. > >Signed-off-by: Ian Walls <koha.sekjal@gmail.com> >Altered circulation.pref to include currency class and [% local_currency %] param >--- > C4/Reserves.pm | 48 +++++++++++++------- > installer/data/mysql/sysprefs.sql | 2 + > installer/data/mysql/updatedatabase.pl | 8 +++ > .../en/modules/admin/preferences/circulation.pref | 11 +++++ > 4 files changed, 52 insertions(+), 17 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 359bbad..635b3ad 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -860,6 +860,7 @@ Cancels all reserves with an expiration date from before today. > > sub CancelExpiredReserves { > >+ # Cancel reserves that have passed their expiration date. > my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare( " > SELECT * FROM reserves WHERE DATE(expirationdate) < DATE( CURDATE() ) >@@ -871,6 +872,24 @@ sub CancelExpiredReserves { > CancelReserve( $res->{'biblionumber'}, '', $res->{'borrowernumber'} ); > } > >+ # Cancel reserves that have been waiting too long >+ if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) { >+ my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); >+ my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge"); >+ >+ my $query = "SELECT * FROM reserves WHERE TO_DAYS( NOW() ) - TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0"; >+ $sth = $dbh->prepare( $query ); >+ $sth->execute( $max_pickup_delay ); >+ >+ while (my $res = $sth->fetchrow_hashref ) { >+ if ( $charge ) { >+ manualinvoice($res->{'borrowernumber'}, $res->{'itemnumber'}, 'Hold waiting too long', 'F', $charge); >+ } >+ >+ CancelReserve( $res->{'biblionumber'}, '', $res->{'borrowernumber'} ); >+ } >+ } >+ > } > > =head2 CancelReserve >@@ -1137,13 +1156,9 @@ sub ModReserveStatus { > > #first : check if we have a reservation for this item . > my ($itemnumber, $newstatus) = @_; >- my $dbh = C4::Context->dbh; >- my $query = " UPDATE reserves >- SET found=?,waitingdate = now() >- WHERE itemnumber=? >- AND found IS NULL >- AND priority = 0 >- "; >+ my $dbh = C4::Context->dbh; >+ >+ my $query = "UPDATE reserves SET found = ?, waitingdate = NOW() WHERE itemnumber = ? AND found IS NULL AND priority = 0"; > my $sth_set = $dbh->prepare($query); > $sth_set->execute( $newstatus, $itemnumber ); > >@@ -1196,15 +1211,15 @@ sub ModReserveAffect { > } > else { > # affect the reserve to Waiting as well. >- $query = " >- UPDATE reserves >- SET priority = 0, >- found = 'W', >- waitingdate=now(), >- itemnumber = ? >- WHERE borrowernumber = ? >- AND biblionumber = ? >- "; >+ $query = " >+ UPDATE reserves >+ SET priority = 0, >+ found = 'W', >+ waitingdate = NOW(), >+ itemnumber = ? >+ WHERE borrowernumber = ? >+ AND biblionumber = ? >+ "; > } > $sth = $dbh->prepare($query); > $sth->execute( $itemnumber, $borrowernumber,$biblionumber); >@@ -1907,7 +1922,6 @@ sub MergeHolds { > } > } > >- > =head1 AUTHOR > > Koha Development Team <http://koha-community.org/> >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 8f289d6..859a68c 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -337,3 +337,5 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BorrowerRenewalPeriodBase', 'now', 'Set whether the borrower renewal date should be counted from the dateexpiry or from the current date ','dateexpiry|now','Choice'); > INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('AllowItemsOnHoldCheckout',0,'Do not generate RESERVE_WAITING and RESERVED warning when checking out items reserved to someone else. This allows self checkouts for those items.','','YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacExportOptions','bibtex|dc|marcxml|marc8|utf8|marcstd|mods|ris','Define export options available on OPAC detail page.','','free'); >+INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelay', '0', '', 'Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay', 'YesNo'); >+INSERT INTO systempreferences` (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelayCharge', '0', NULL , 'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.', 'free') >\ No newline at end of file >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index e540874..ed4d298 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -4734,6 +4734,14 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.07.00.XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do("INSERT INTO systempreferences` (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelayCharge', '0', NULL , 'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.', 'free')"); >+ $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelay', '0', '', 'Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay', 'YesNo')"); >+ print "Upgrade to $DBversion done (Added system preference ExpireReservesMaxPickUpDelay, system preference ExpireReservesMaxPickUpDelayCharge, add reseves.charge_if_expired)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 6b05b2c..bc01e85 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -279,6 +279,17 @@ Circulation: > class: integer > - days. > - >+ - pref: ExpireReservesMaxPickUpDelay >+ choices: >+ yes: Allow >+ no: "Don't allow" >+ - "holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay" >+ - >+ - If using ExpireReservesMaxPickUpDelay, charge a borrower who allows his or her waiting hold to expire a fee of >+ - pref: ExpireReservesMaxPickUpDelayCharge >+ class: currency >+ - [% local_currency %]. >+ - > - Satisfy holds from the libraries > - pref: StaticHoldsQueueWeight > class: multi >-- >1.7.0.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 7408
:
7357
|
7838
|
7839
|
7840
|
7841
|
7856
|
8022
|
8101
|
8241
|
8242
|
8323
|
8325