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

(-)a/Koha/Item.pm (-15 / +1 lines)
Lines 2409-2429 the item's notforloan status or its item type Link Here
2409
2409
2410
sub is_notforloan {
2410
sub is_notforloan {
2411
    my ( $self ) = @_;
2411
    my ( $self ) = @_;
2412
    my $is_notforloan = 0;
2412
    return $self->not_for_loan;
2413
2414
    if ( $self->notforloan ){
2415
        $is_notforloan = 1;
2416
    }
2417
    else {
2418
        my $itemtype = $self->itemtype;
2419
        if ($itemtype){
2420
            if ( $itemtype->notforloan ){
2421
                $is_notforloan = 1;
2422
            }
2423
        }
2424
    }
2425
2426
    return $is_notforloan;
2427
}
2413
}
2428
2414
2429
=head3 is_denied_renewal
2415
=head3 is_denied_renewal
(-)a/t/db_dependent/Koha/Item.t (-4 / +3 lines)
Lines 2251-2262 subtest 'Notforloan tests' => sub { Link Here
2251
    my $item1 = $builder->build_sample_item;
2251
    my $item1 = $builder->build_sample_item;
2252
    $item1->update({ notforloan => 0 });
2252
    $item1->update({ notforloan => 0 });
2253
    $item1->itemtype->notforloan(0);
2253
    $item1->itemtype->notforloan(0);
2254
    is ( $item1->is_notforloan, 0, 'Notforloan is correctly false by item status and item type');
2254
    ok( !$item1->is_notforloan, 'Notforloan is correctly false by item status and item type');
2255
    $item1->update({ notforloan => 1 });
2255
    $item1->update({ notforloan => 1 });
2256
    is ( $item1->is_notforloan, 1, 'Notforloan is correctly true by item status');
2256
    ok( $item1->is_notforloan, 'Notforloan is correctly true by item status');
2257
    $item1->update({ notforloan => 0 });
2257
    $item1->update({ notforloan => 0 });
2258
    $item1->itemtype->update({ notforloan => 1 });
2258
    $item1->itemtype->update({ notforloan => 1 });
2259
    is ( $item1->is_notforloan, 1, 'Notforloan is correctly true by item type');
2259
    ok( $item1->is_notforloan, 'Notforloan is correctly true by item type');
2260
2260
2261
    $schema->storage->txn_rollback;
2261
    $schema->storage->txn_rollback;
2262
};
2262
};
2263
- 

Return to bug 28762