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

(-)a/C4/Reserves.pm (-1 / +1 lines)
Lines 793-799 sub CheckReserves { Link Here
793
    return unless $itemnumber; # bail if we got nothing.
793
    return unless $itemnumber; # bail if we got nothing.
794
    # if item is not for loan it cannot be reserved either.....
794
    # if item is not for loan it cannot be reserved either.....
795
    # except where items.notforloan < 0 :  This indicates the item is holdable.
795
    # except where items.notforloan < 0 :  This indicates the item is holdable.
796
    return if  ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype;
796
    return if $notforloan_per_item or $notforloan_per_itemtype;
797
797
798
    # Find this item in the reserves
798
    # Find this item in the reserves
799
    my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days, $ignore_borrowers);
799
    my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days, $ignore_borrowers);
(-)a/t/db_dependent/Holds.t (-2 / +15 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 => 61;
10
use Test::More tests => 63;
11
use MARC::Record;
11
use MARC::Record;
12
12
13
use C4::Biblio;
13
use C4::Biblio;
Lines 344-349 t::lib::Mocks::mock_preference( 'AllowHoldsOnDamagedItems', 0 ); Link Here
344
ok( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status} eq 'damaged', "Patron cannot reserve damaged item with AllowHoldsOnDamagedItems disabled" );
344
ok( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status} eq 'damaged', "Patron cannot reserve damaged item with AllowHoldsOnDamagedItems disabled" );
345
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" );
345
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" );
346
346
347
# Items that are not for loan, but holdable should not be trapped until they are available for loan
348
Koha::Items->find($itemnumber)->damaged(0)->notforloan(-1)->store;
349
Koha::Holds->search({ biblionumber => $biblio->id })->delete();
350
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status}, 'OK', "Patron can place hold on item that is not for loan but holdable ( notforloan < 0 )" );
351
$hold = Koha::Hold->new(
352
    {
353
        borrowernumber => $borrowernumbers[0],
354
        itemnumber     => $itemnumber,
355
        biblionumber   => $biblio->biblionumber,
356
    }
357
)->store();
358
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item that is not for loan but holdable ( notforloan < 0 )" );
359
$hold->delete();
360
347
# Regression test for bug 9532
361
# Regression test for bug 9532
348
$biblio = $builder->build_sample_biblio({ itemtype => 'CANNOT' });
362
$biblio = $builder->build_sample_biblio({ itemtype => 'CANNOT' });
349
$item = $builder->build_sample_item({ library => $branch_1, itype => 'CANNOT', biblionumber => $biblio->biblionumber});
363
$item = $builder->build_sample_item({ library => $branch_1, itype => 'CANNOT', biblionumber => $biblio->biblionumber});
350
- 

Return to bug 25184