Bugzilla – Attachment 7838 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), 5.87 KB, created by
Kyle M Hall
on 2012-02-23 17:12:27 UTC
(
hide
)
Description:
Bug 7408 - Expire holds that have been waiting too long
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2012-02-23 17:12:27 UTC
Size:
5.87 KB
patch
obsolete
>From 94b61073ecc6ed743293fc4b2837de685483e411 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] Bug 7408 - Expire holds that have been waiting too long > >Sets the expiration date at the time the hold is marked waiting, >based on the ReservesMaxPickupDelay syspref, assuming the new >system preference ExpireReservesMaxPickUpDelay is enabled. >--- > C4/Reserves.pm | 41 ++++++++++++-------- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 7 +++ > .../en/modules/admin/preferences/circulation.pref | 6 +++ > 4 files changed, 39 insertions(+), 16 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 359bbad..ae2bc2f 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1137,13 +1137,15 @@ 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 $expire_sql = ''; >+ if ( $newstatus eq 'W' && C4::Context->preference("ExpireReservesMaxPickUpDelay") ) { >+ my $days_until_expiration = C4::Context->preference("ReservesMaxPickUpDelay"); >+ $expire_sql = ", expirationdate = DATE( DATE_ADD( NOW(), INTERVAL $days_until_expiration DAY ) )"; >+ } >+ >+ my $query = "UPDATE reserves SET found = ?, waitingdate = NOW()$expire_sql WHERE itemnumber = ? AND found IS NULL AND priority = 0"; > my $sth_set = $dbh->prepare($query); > $sth_set->execute( $newstatus, $itemnumber ); > >@@ -1196,15 +1198,22 @@ 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 = ? >- "; >+ my $expire_sql = ''; >+ if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) { >+ my $days_until_expiration = C4::Context->preference("ReservesMaxPickUpDelay"); >+ $expire_sql = ", expirationdate = DATE( DATE_ADD( NOW(), INTERVAL $days_until_expiration DAY ) )"; >+ } >+ >+ $query = " >+ UPDATE reserves >+ SET priority = 0, >+ found = 'W', >+ waitingdate = NOW(), >+ itemnumber = ? >+ $expire_sql >+ WHERE borrowernumber = ? >+ AND biblionumber = ? >+ "; > } > $sth = $dbh->prepare($query); > $sth->execute( $itemnumber, $borrowernumber,$biblionumber); >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 0cc79b2..a5a9465 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -336,3 +336,4 @@ 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'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index d2d9d97..d46959b 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -4712,6 +4712,13 @@ 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 ('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)\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 b3716c0..5c86c30 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,12 @@ 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" >+ - > - Satisfy holds from the libraries > - pref: StaticHoldsQueueWeight > class: multi >-- >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