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

(-)a/C4/Reserves.pm (-2 / +2 lines)
Lines 1195-1202 sub IsAvailableForItemLevelRequest { Link Here
1195
    # FIXME - a lot of places in the code do this
1195
    # FIXME - a lot of places in the code do this
1196
    #         or something similar - need to be
1196
    #         or something similar - need to be
1197
    #         consolidated
1197
    #         consolidated
1198
    my $itemtype = $item->effective_itemtype;
1198
    my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype );
1199
    my $notforloan_per_itemtype = Koha::ItemTypes->find($itemtype)->notforloan;
1199
    my $notforloan_per_itemtype = defined $itemtype ? $itemtype->notforloan : 0;
1200
1200
1201
    return 0 if
1201
    return 0 if
1202
        $notforloan_per_itemtype ||
1202
        $notforloan_per_itemtype ||
(-)a/t/db_dependent/Reserves.t (-2 / +9 lines)
Lines 17-25 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 62;
20
use Test::More tests => 64;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Warn;
22
use Test::Warn;
23
use Test::Exception;
23
24
24
use t::lib::Mocks;
25
use t::lib::Mocks;
25
use t::lib::TestBuilder;
26
use t::lib::TestBuilder;
Lines 533-538 $item = Koha::Items->find($itemnumber); Link Here
533
534
534
ok( C4::Reserves::IsAvailableForItemLevelRequest($item, $patron), "Reserving a book on item level" );
535
ok( C4::Reserves::IsAvailableForItemLevelRequest($item, $patron), "Reserving a book on item level" );
535
536
537
# Tests for items not for loan status, bug 24331
538
my $item_no_type = $builder->build_sample_item({ itype => undef });
539
lives_ok{ C4::Reserves::IsAvailableForItemLevelRequest($item_no_type, $patron) } "Reserving a book on item level with no itemtype";
540
my $itemtype_notforloan = $builder->build_object({ class => 'Koha::ItemTypes', value => { notforloan => 1 } })->itemtype;
541
my $item_notforloan = $builder->build_sample_item({ itype => $itemtype_notforloan });
542
is( C4::Reserves::IsAvailableForItemLevelRequest($item_notforloan, $patron), 0, "Item not available if itemtype notforloan" );
543
536
my $pickup_branch = $builder->build({ source => 'Branch' })->{ branchcode };
544
my $pickup_branch = $builder->build({ source => 'Branch' })->{ branchcode };
537
t::lib::Mocks::mock_preference( 'UseBranchTransferLimits',  '1' );
545
t::lib::Mocks::mock_preference( 'UseBranchTransferLimits',  '1' );
538
t::lib::Mocks::mock_preference( 'BranchTransferLimitsType', 'itemtype' );
546
t::lib::Mocks::mock_preference( 'BranchTransferLimitsType', 'itemtype' );
539
- 

Return to bug 24331