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

(-)a/C4/Reserves.pm (-19 / +13 lines)
Lines 486-491 sub CanItemBeReserved { Link Here
486
        }
486
        }
487
    }
487
    }
488
488
489
    # must check the notforloan setting of the itemtype
490
    # FIXME - a lot of places in the code do this
491
    #         or something similar - need to be
492
    #         consolidated
493
    my $itemtype = $item->effective_itemtype;
494
    return { status => 'missing_itemtype' }
495
        unless defined $itemtype;
496
    my $notforloan_per_itemtype = Koha::ItemTypes->find($itemtype)->notforloan;
497
498
    return { status => 'notforloan' } if ( $item->notforloan > 0 || $notforloan_per_itemtype );
499
    return { status => 'itemlost' }   if $item->itemlost;
500
    return { status => 'withdrawn' }  if $item->withdrawn;
501
489
    # If an item is damaged and we don't allow holds on damaged items, we can stop right here
502
    # If an item is damaged and we don't allow holds on damaged items, we can stop right here
490
    return _cache { status => 'damaged' }
503
    return _cache { status => 'damaged' }
491
        if ( $item->damaged
504
        if ( $item->damaged
Lines 1356-1380 sub IsAvailableForItemLevelRequest { Link Here
1356
    my $patron            = shift;
1369
    my $patron            = shift;
1357
    my $pickup_branchcode = shift;
1370
    my $pickup_branchcode = shift;
1358
1371
1359
    my $dbh = C4::Context->dbh;
1360
1361
    # must check the notforloan setting of the itemtype
1362
    # FIXME - a lot of places in the code do this
1363
    #         or something similar - need to be
1364
    #         consolidated
1365
    my $itemtype = $item->effective_itemtype;
1366
    return 0
1367
        unless defined $itemtype;
1368
    my $notforloan_per_itemtype = Koha::ItemTypes->find($itemtype)->notforloan;
1369
1370
    return 0
1371
        if $notforloan_per_itemtype
1372
        || $item->itemlost
1373
        || $item->notforloan > 0
1374
        ||    # item with negative or zero notforloan value is holdable
1375
        $item->withdrawn
1376
        || ( $item->damaged && !C4::Context->preference('AllowHoldsOnDamagedItems') );
1377
1378
    if ($pickup_branchcode) {
1372
    if ($pickup_branchcode) {
1379
        my $destination = Koha::Libraries->find($pickup_branchcode);
1373
        my $destination = Koha::Libraries->find($pickup_branchcode);
1380
        return 0 unless $destination;
1374
        return 0 unless $destination;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (+4 lines)
Lines 890-895 Link Here
890
                                                                <span>No valid pickup location</span>
890
                                                                <span>No valid pickup location</span>
891
                                                            [% ELSIF itemloo.not_holdable == 'notforloan' %]
891
                                                            [% ELSIF itemloo.not_holdable == 'notforloan' %]
892
                                                                <span>Not for loan</span>
892
                                                                <span>Not for loan</span>
893
                                                            [% ELSIF itemloo.not_holdable == 'withdrawn' %]
894
                                                                <span>Item has been withdrawn</span>
895
                                                            [% ELSIF itemloo.not_holdable == 'itemlost' %]
896
                                                                <span>Item has been marked lost</span>
893
                                                            [% ELSE %]
897
                                                            [% ELSE %]
894
                                                                <span>[% itemloo.not_holdable | html %]</span>
898
                                                                <span>[% itemloo.not_holdable | html %]</span>
895
                                                            [% END %]
899
                                                            [% END %]
(-)a/t/db_dependent/Reserves.t (-7 / +1 lines)
Lines 1540-1546 $schema->storage->txn_rollback(); Link Here
1540
1540
1541
subtest 'IsAvailableForItemLevelRequest() tests' => sub {
1541
subtest 'IsAvailableForItemLevelRequest() tests' => sub {
1542
1542
1543
    plan tests => 3;
1543
    plan tests => 2;
1544
1544
1545
    $schema->storage->txn_begin;
1545
    $schema->storage->txn_begin;
1546
1546
Lines 1553-1563 subtest 'IsAvailableForItemLevelRequest() tests' => sub { Link Here
1553
1553
1554
    my $item = $builder->build_sample_item;
1554
    my $item = $builder->build_sample_item;
1555
1555
1556
    ok(
1557
        !C4::Reserves::IsAvailableForItemLevelRequest( $item, $patron ),
1558
        "Item not available for item-level hold because no effective item type"
1559
    );
1560
1561
    # Weird use case to highlight issue
1556
    # Weird use case to highlight issue
1562
    $item_type = '0';
1557
    $item_type = '0';
1563
    Koha::ItemTypes->search( { itemtype => $item_type } )->delete;
1558
    Koha::ItemTypes->search( { itemtype => $item_type } )->delete;
1564
- 

Return to bug 32702