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

(-)a/C4/ILSDI/Services.pm (-1 / +1 lines)
Lines 969-975 sub _availability { Link Here
969
    my $location = $library ? $library->branchname : '';
969
    my $location = $library ? $library->branchname : '';
970
    my $itemcallnumber = $item->itemcallnumber;
970
    my $itemcallnumber = $item->itemcallnumber;
971
971
972
    if ( $item->notforloan ) {
972
    if ( $item->is_notforloan ) {
973
        return ( $biblionumber, __('not available'), __('Not for loan'), $location, $itemcallnumber );
973
        return ( $biblionumber, __('not available'), __('Not for loan'), $location, $itemcallnumber );
974
    } elsif ( $item->onloan ) {
974
    } elsif ( $item->onloan ) {
975
        return ( $biblionumber, __('not available'), __('Checked out'), $location, $itemcallnumber );
975
        return ( $biblionumber, __('not available'), __('Checked out'), $location, $itemcallnumber );
(-)a/Koha/Item.pm (+28 lines)
Lines 1638-1643 sub check_recalls { Link Here
1638
    return $recall;
1638
    return $recall;
1639
}
1639
}
1640
1640
1641
=head3 is_notforloan
1642
1643
    my $is_notforloan = $item->is_notforloan;
1644
1645
Determine whether or not this item is "notforloan" based on
1646
the item's notforloan status or its item type
1647
1648
=cut
1649
1650
sub is_notforloan {
1651
    my ( $self ) = @_;
1652
    my $is_notforloan = 0;
1653
1654
    if ( $self->notforloan ){
1655
        $is_notforloan = 1;
1656
    }
1657
    else {
1658
        my $itemtype = $self->itemtype;
1659
        if ($itemtype){
1660
            if ( $itemtype->notforloan ){
1661
                $is_notforloan = 1;
1662
            }
1663
        }
1664
    }
1665
1666
    return $is_notforloan;
1667
}
1668
1641
=head3 _type
1669
=head3 _type
1642
1670
1643
=cut
1671
=cut
(-)a/t/db_dependent/Koha/Item.t (-2 / +19 lines)
Lines 20-26 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
use utf8;
21
use utf8;
22
22
23
use Test::More tests => 15;
23
use Test::More tests => 16;
24
use Test::Exception;
24
use Test::Exception;
25
25
26
use C4::Biblio qw( GetMarcSubfieldStructure );
26
use C4::Biblio qw( GetMarcSubfieldStructure );
Lines 1420-1422 subtest 'Recalls tests' => sub { Link Here
1420
    $schema->storage->txn_rollback;
1420
    $schema->storage->txn_rollback;
1421
};
1421
};
1422
1422
1423
- 
1423
subtest 'Notforloan tests' => sub {
1424
1425
    plan tests => 3;
1426
1427
    $schema->storage->txn_begin;
1428
1429
    my $item1 = $builder->build_sample_item;
1430
    $item1->update({ notforloan => 0 });
1431
    $item1->itemtype->notforloan(0);
1432
    is ( $item1->is_notforloan, 0, 'Notforloan is correctly false by item status and item type');
1433
    $item1->update({ notforloan => 1 });
1434
    is ( $item1->is_notforloan, 1, 'Notforloan is correctly true by item status');
1435
    $item1->update({ notforloan => 0 });
1436
    $item1->itemtype->update({ notforloan => 1 });
1437
    is ( $item1->is_notforloan, 1, 'Notforloan is correctly true by item type');
1438
1439
    $schema->storage->txn_rollback;
1440
};

Return to bug 30636