Bug 28078: (follow-up) Add param check to 'itemAlreadyOnHold' test
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
d3adcec676
commit
a620c1bb11
|
|
@ -394,7 +394,7 @@ sub CanItemBeReserved {
|
|||
|
||||
# Check that the patron doesn't have an item level hold on this item already
|
||||
return { status =>'itemAlreadyOnHold' }
|
||||
if Koha::Holds->search( { borrowernumber => $borrowernumber, itemnumber => $itemnumber } )->count();
|
||||
if ( !$params->{ignore_hold_counts} && 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')
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use t::lib::TestBuilder;
|
|||
|
||||
use C4::Context;
|
||||
|
||||
use Test::More tests => 70;
|
||||
use Test::More tests => 72;
|
||||
use MARC::Record;
|
||||
|
||||
use C4::Biblio;
|
||||
|
|
@ -369,6 +369,14 @@ t::lib::Mocks::mock_preference( 'SkipHoldTrapOnNotForLoanValue', '-1' );
|
|||
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item with notforloan value matching SkipHoldTrapOnNotForLoanValue" );
|
||||
t::lib::Mocks::mock_preference( 'SkipHoldTrapOnNotForLoanValue', '-1|1' );
|
||||
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item with notforloan value matching SkipHoldTrapOnNotForLoanValue" );
|
||||
is(
|
||||
CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status}, 'itemAlreadyOnHold',
|
||||
"cannot request item that you have already reservedd"
|
||||
);
|
||||
is(
|
||||
CanItemBeReserved( $borrowernumbers[0], $item->itemnumber, undef, { ignore_hold_counts => 1 })->{status}, 'OK',
|
||||
"can request item if we are not checking holds counts, but only if policy allows or forbids it"
|
||||
);
|
||||
$hold->delete();
|
||||
|
||||
# Regression test for bug 9532
|
||||
|
|
|
|||
Loading…
Reference in New Issue