View | Details | Raw Unified | Return to bug 28078
Collapse All | Expand All

(-)a/C4/Reserves.pm (-1 / +1 lines)
Lines 394-400 sub CanItemBeReserved { Link Here
394
394
395
    # Check that the patron doesn't have an item level hold on this item already
395
    # Check that the patron doesn't have an item level hold on this item already
396
    return { status =>'itemAlreadyOnHold' }
396
    return { status =>'itemAlreadyOnHold' }
397
      if Koha::Holds->search( { borrowernumber => $borrowernumber, itemnumber => $itemnumber } )->count();
397
      if ( !$params->{ignore_hold_counts} && Koha::Holds->search( { borrowernumber => $borrowernumber, itemnumber => $itemnumber } )->count() );
398
398
399
    # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set)
399
    # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set)
400
    if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
400
    if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
(-)a/t/db_dependent/Holds.t (-2 / +9 lines)
Lines 7-13 use t::lib::TestBuilder; Link Here
7
7
8
use C4::Context;
8
use C4::Context;
9
9
10
use Test::More tests => 70;
10
use Test::More tests => 72;
11
use MARC::Record;
11
use MARC::Record;
12
12
13
use C4::Biblio;
13
use C4::Biblio;
Lines 369-374 t::lib::Mocks::mock_preference( 'SkipHoldTrapOnNotForLoanValue', '-1' ); Link Here
369
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item with notforloan value matching SkipHoldTrapOnNotForLoanValue" );
369
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item with notforloan value matching SkipHoldTrapOnNotForLoanValue" );
370
t::lib::Mocks::mock_preference( 'SkipHoldTrapOnNotForLoanValue', '-1|1' );
370
t::lib::Mocks::mock_preference( 'SkipHoldTrapOnNotForLoanValue', '-1|1' );
371
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item with notforloan value matching SkipHoldTrapOnNotForLoanValue" );
371
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item with notforloan value matching SkipHoldTrapOnNotForLoanValue" );
372
is(
373
    CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status}, 'itemAlreadyOnHold',
374
    "cannot request item that you have already reservedd"
375
);
376
is(
377
    CanItemBeReserved( $borrowernumbers[0], $item->itemnumber, undef, { ignore_hold_counts => 1 })->{status}, 'OK',
378
    "can request item if we are not checking holds counts, but only if policy allows or forbids it"
379
);
372
$hold->delete();
380
$hold->delete();
373
381
374
# Regression test for bug 9532
382
# Regression test for bug 9532
375
- 

Return to bug 28078