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

(-)a/Koha/Items.pm (+1 lines)
Lines 61-66 sub filter_by_for_hold { Link Here
61
            rule_value   => 'not_allowed',
61
            rule_value   => 'not_allowed',
62
        }
62
        }
63
    )->get_column('itemtype');
63
    )->get_column('itemtype');
64
    push @hold_not_allowed_itypes, Koha::ItemTypes->search({ notforloan => 1 })->get_column('itemtype');
64
65
65
    return $self->search(
66
    return $self->search(
66
        {
67
        {
(-)a/t/db_dependent/Koha/Items.t (-3 / +16 lines)
Lines 1510-1516 subtest 'can_be_transferred' => sub { Link Here
1510
};
1510
};
1511
1511
1512
subtest 'filter_by_for_hold' => sub {
1512
subtest 'filter_by_for_hold' => sub {
1513
    plan tests => 9;
1513
    plan tests => 11;
1514
1514
1515
    my $biblio = $builder->build_sample_biblio;
1515
    my $biblio = $builder->build_sample_biblio;
1516
    is( $biblio->items->filter_by_for_hold->count, 0, 'no item yet' );
1516
    is( $biblio->items->filter_by_for_hold->count, 0, 'no item yet' );
Lines 1536-1542 subtest 'filter_by_for_hold' => sub { Link Here
1536
    t::lib::Mocks::mock_preference('AllowHoldsOnDamagedItems', 1);
1536
    t::lib::Mocks::mock_preference('AllowHoldsOnDamagedItems', 1);
1537
    is( $biblio->items->filter_by_for_hold->count, 6, '6 items for hold - damaged if AllowHoldsOnDamagedItems' );
1537
    is( $biblio->items->filter_by_for_hold->count, 6, '6 items for hold - damaged if AllowHoldsOnDamagedItems' );
1538
1538
1539
    my $not_holdable_itemtype = $builder->build_object({ class => 'Koha::ItemTypes' })->itemtype;
1539
    my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes' });
1540
    my $not_holdable_itemtype = $itemtype->itemtype;
1540
    $builder->build_sample_item(
1541
    $builder->build_sample_item(
1541
        {
1542
        {
1542
            biblionumber => $biblio->biblionumber,
1543
            biblionumber => $biblio->biblionumber,
Lines 1553-1558 subtest 'filter_by_for_hold' => sub { Link Here
1553
    );
1554
    );
1554
    is( $biblio->items->filter_by_for_hold->count, 6, '6 items for hold - holdallowed=not_allowed' );
1555
    is( $biblio->items->filter_by_for_hold->count, 6, '6 items for hold - holdallowed=not_allowed' );
1555
1556
1557
    # Remove rule, test notforloan on itemtype
1558
    Koha::CirculationRules->set_rule(
1559
        {
1560
            branchcode   => undef,
1561
            itemtype     => $not_holdable_itemtype,
1562
            rule_name    => 'holdallowed',
1563
            rule_value   => undef,
1564
        }
1565
    );
1566
    is( $biblio->items->filter_by_for_hold->count, 7, '7 items for hold - rule deleted' );
1567
    $itemtype->notforloan(1)->store;
1568
    is( $biblio->items->filter_by_for_hold->count, 6, '6 items for hold - notforloan' );
1569
1556
    $biblio->delete;
1570
    $biblio->delete;
1557
};
1571
};
1558
1572
1559
- 

Return to bug 3142