From c288b8ebbd0a365691ea10e39976a6b9f6da0579 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 31 Aug 2016 15:27:44 +0200 Subject: [PATCH] Bug 17229: Check if patron is expired in CanItemBeReserved This way, calls to ILS-DI HoldTitle and HoldItem do this check too Added test plan to commit message : -Set Syspref BlockExpiredPatronOpacActions to "ON", -Set a patron's category variable "Block expired patrons" to "Follow SysPref" or -"Block" (ideally test both). -Get the id of a patron from this category (ie : 1234). -Set this patron's expiration date to a date earlier than today. -Get a biblionumber which can be reserved (ie : 5678). Put the following string in your webbrowser (replacing OpacBaseUrl, 1234 and 5678 by your own values) : http://[OpacBaseUrl]/cgi-bin/koha/ilsdi.pl?service=HoldTitle&patron_id=1234&bib_id=5678&request_location='127.0.0.1' Should not create a new hold for the patron and report an error. Signed-off-by: Brendan Gallagher --- C4/Reserves.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 974168f8a3..9430857bbb 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -306,6 +306,7 @@ sub CanBookBeReserved{ { status => libraryNotFound }, if given branchcode is not an existing library { status => libraryNotPickupLocation }, if given branchcode is not configured to be a pickup location { status => cannotBeTransferred }, if branch transfer limit applies on given item and branchcode + { status => patronExpired }, if patron is expired and expired patrons are not allowed to place holds =cut @@ -325,6 +326,9 @@ sub CanItemBeReserved { my $patron = Koha::Patrons->find( $borrowernumber ); my $borrower = $patron->unblessed; + return { status => 'patronExpired' } + if ($patron->category->effective_BlockExpiredPatronOpacActions && $patron->is_expired); + # If an item is damaged and we don't allow holds on damaged items, we can stop right here return { status =>'damaged' } if ( $item->{damaged} -- 2.13.7