Bug 22806: CanBookBeReserved and CanItemBeReserved must check AllowHoldsOnPatronsPossessions

Test plan :
1 - set AllowHoldsOnPatronsPossessions to "Don't Allow"
2 - Checkout an item to a borrower
3 - Try to reserve an item using ILS-DI WebService -> Will work without complaining.
4 - Cancel the hold and apply patch
5 - Repeat 3 -> Should not place hold and show error "NotHoldable"

Signed-off-by: Laurence Rault <laurence.rault@biblibre.com>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Arthur Suzuki 2019-05-14 02:30:26 +02:00 committed by Jonathan Druart
parent 0ee41b5316
commit 3fd7d5974a

View file

@ -318,6 +318,12 @@ See CanItemBeReserved() for possible return values.
sub CanBookBeReserved{
my ($borrowernumber, $biblionumber, $pickup_branchcode, $params) = @_;
# Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set)
if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
&& C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $biblio->biblionumber ) ) {
return { status =>'itemAlreadyOnLoan' };
}
my @itemnumbers = Koha::Items->search({ biblionumber => $biblionumber})->get_column("itemnumber");
#get items linked via host records
my @hostitems = get_hostitemnumbers_of($biblionumber);
@ -386,6 +392,12 @@ sub CanItemBeReserved {
return { status =>'itemAlreadyOnHold' }
if Koha::Holds->search( { borrowernumber => $borrowernumber, itemnumber => $itemnumber } )->count();
# Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set)
if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
&& C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $biblio->biblionumber ) ) {
return { status =>'itemAlreadyOnLoan' };
}
my $controlbranch = C4::Context->preference('ReservesControlBranch');
my $querycount = q{