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

(-)a/C4/ILSDI/Services.pm (-1 / +1 lines)
Lines 972-978 sub _availability { Link Here
972
    my $location = $library ? $library->branchname : '';
972
    my $location = $library ? $library->branchname : '';
973
    my $itemcallnumber = $item->itemcallnumber;
973
    my $itemcallnumber = $item->itemcallnumber;
974
974
975
    if ( $item->notforloan ) {
975
    if ( $item->is_notforloan ) {
976
        return ( $biblionumber, __('not available'), __('Not for loan'), $location, $itemcallnumber );
976
        return ( $biblionumber, __('not available'), __('Not for loan'), $location, $itemcallnumber );
977
    } elsif ( $item->onloan ) {
977
    } elsif ( $item->onloan ) {
978
        return ( $biblionumber, __('not available'), __('Checked out'), $location, $itemcallnumber );
978
        return ( $biblionumber, __('not available'), __('Checked out'), $location, $itemcallnumber );
(-)a/Koha/Item.pm (+28 lines)
Lines 1651-1656 sub check_recalls { Link Here
1651
    return $recall;
1651
    return $recall;
1652
}
1652
}
1653
1653
1654
=head3 is_notforloan
1655
1656
    my $is_notforloan = $item->is_notforloan;
1657
1658
Determine whether or not this item is "notforloan" based on
1659
the item's notforloan status or its item type
1660
1661
=cut
1662
1663
sub is_notforloan {
1664
    my ( $self ) = @_;
1665
    my $is_notforloan = 0;
1666
1667
    if ( $self->notforloan ){
1668
        $is_notforloan = 1;
1669
    }
1670
    else {
1671
        my $itemtype = $self->itemtype;
1672
        if ($itemtype){
1673
            if ( $itemtype->notforloan ){
1674
                $is_notforloan = 1;
1675
            }
1676
        }
1677
    }
1678
1679
    return $is_notforloan;
1680
}
1681
1654
=head3 _type
1682
=head3 _type
1655
1683
1656
=cut
1684
=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
use Test::MockModule;
25
use Test::MockModule;
26
26
Lines 1454-1456 subtest 'Recalls tests' => sub { Link Here
1454
    $schema->storage->txn_rollback;
1454
    $schema->storage->txn_rollback;
1455
};
1455
};
1456
1456
1457
- 
1457
subtest 'Notforloan tests' => sub {
1458
1459
    plan tests => 3;
1460
1461
    $schema->storage->txn_begin;
1462
1463
    my $item1 = $builder->build_sample_item;
1464
    $item1->update({ notforloan => 0 });
1465
    $item1->itemtype->notforloan(0);
1466
    is ( $item1->is_notforloan, 0, 'Notforloan is correctly false by item status and item type');
1467
    $item1->update({ notforloan => 1 });
1468
    is ( $item1->is_notforloan, 1, 'Notforloan is correctly true by item status');
1469
    $item1->update({ notforloan => 0 });
1470
    $item1->itemtype->update({ notforloan => 1 });
1471
    is ( $item1->is_notforloan, 1, 'Notforloan is correctly true by item type');
1472
1473
    $schema->storage->txn_rollback;
1474
};

Return to bug 30636