Bugzilla – Attachment 55174 Details for
Bug 17247
ILS-DI HoldTitle and HoldItem should check if patron is restricted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17247: Check if patron is debarred in CanItemBeReserved
Bug-17247-Check-if-patron-is-debarred-in-CanItemBe.patch (text/plain), 2.50 KB, created by
Julian Maurice
on 2016-09-05 11:52:39 UTC
(
hide
)
Description:
Bug 17247: Check if patron is debarred in CanItemBeReserved
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2016-09-05 11:52:39 UTC
Size:
2.50 KB
patch
obsolete
>From 43f9b6d87aa710eaf78047544728e00e3517b540 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 5 Sep 2016 13:50:54 +0200 >Subject: [PATCH] Bug 17247: Check if patron is debarred in CanItemBeReserved > >This way, calls to ILS-DI HoldTitle and HoldItem do this check too >--- > C4/Reserves.pm | 6 ++++++ > t/db_dependent/Holds.t | 12 +++++++++++- > 2 files changed, 17 insertions(+), 1 deletion(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index c9e270c..16bff6a 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -44,6 +44,7 @@ use Koha::Holds; > use Koha::Libraries; > use Koha::Items; > use Koha::ItemTypes; >+use Koha::Patrons; > > use List::MoreUtils qw( firstidx any ); > use Carp; >@@ -456,6 +457,7 @@ sub CanBookBeReserved{ > cannotReserveFromOtherBranches, if syspref 'canreservefromotherbranches' is OK. > tooManyReserves, if the borrower has exceeded his maximum reserve amount. > notReservable, if holds on this item are not allowed >+ debarred, if patron is debarred > > =cut > >@@ -472,6 +474,10 @@ sub CanItemBeReserved{ > my $biblioData = C4::Biblio::GetBiblioData( $item->{biblionumber} ); > my $borrower = C4::Members::GetMember('borrowernumber'=>$borrowernumber); > >+ if (Koha::Patrons->find($borrowernumber)->is_debarred) { >+ return 'debarred'; >+ } >+ > # If an item is damaged and we don't allow holds on damaged items, we can stop right here > return 'damaged' if ( $item->{damaged} && !C4::Context->preference('AllowHoldsOnDamagedItems') ); > >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index f9ddc46..aad314e 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -8,7 +8,7 @@ use t::lib::TestBuilder; > use C4::Context; > use C4::Branch; > >-use Test::More tests => 60; >+use Test::More tests => 61; > use MARC::Record; > use C4::Biblio; > use C4::Items; >@@ -473,6 +473,16 @@ my $res_id = AddReserve( $branch_1, $borrowernumbers[0], $bibnum, '', 1, ); > is( CanItemBeReserved( $borrowernumbers[0], $itemnumber ), > 'tooManyReserves', 'Patron cannot reserve item with hold limit of 1, 1 bib level hold placed' ); > >+my $debarred_borrowernumber = AddMember( >+ firstname => 'Debarred', >+ surname => 'Patron', >+ categorycode => $category->{categorycode}, >+ branchcode => $branch_1, >+ debarred => '9999-12-31', >+); >+is(CanItemBeReserved($debarred_borrowernumber, $itemnumber), >+ 'debarred', 'Debarred patron cannot reserve'); >+ > > # Helper method to set up a Biblio. > sub create_helper_biblio { >-- >2.1.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 17247
:
55174
|
70684
|
72963
|
75261
|
75262
|
75270
|
89652
|
89653
|
93549
|
94037
|
94038