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

(-)a/Koha/Items.pm (-4 / +26 lines)
Lines 61-75 placing a hold on one of those items. Link Here
61
sub filter_by_for_hold {
61
sub filter_by_for_hold {
62
    my ($self) = @_;
62
    my ($self) = @_;
63
63
64
    my @hold_not_allowed_itypes = Koha::CirculationRules->search(
64
    my $default_rule = Koha::CirculationRules->get_effective_rule(
65
        {
65
        {
66
            rule_name    => 'holdallowed',
66
            rule_name    => 'holdallowed',
67
            branchcode   => undef,
68
            categorycode => undef,
69
            rule_value   => 'not_allowed',
67
            rule_value   => 'not_allowed',
70
        }
68
        }
71
    )->get_column('itemtype');
69
    );
70
    my @hold_not_allowed_itypes;
71
    if ( $default_rule ) {
72
        @hold_not_allowed_itypes = Koha::ItemTypes->search->get_column('itemtype');
73
        my @hold_allowed_itypes = Koha::CirculationRules->search(
74
            {
75
                rule_name    => 'holdallowed',
76
                rule_value   => { '!=' => 'not_allowed' },
77
                branchcode   => undef,
78
                categorycode => undef,
79
            }
80
        )->get_column('itemtype');
81
        @hold_not_allowed_itypes = array_minus( @hold_not_allowed_itypes, @hold_allowed_itypes )
82
    } else {
83
        @hold_not_allowed_itypes = Koha::CirculationRules->search(
84
            {
85
                rule_name    => 'holdallowed',
86
                branchcode   => undef,
87
                categorycode => undef,
88
                rule_value   => 'not_allowed',
89
            }
90
        )->get_column('itemtype');
91
    }
92
72
    push @hold_not_allowed_itypes, Koha::ItemTypes->search({ notforloan => 1 })->get_column('itemtype');
93
    push @hold_not_allowed_itypes, Koha::ItemTypes->search({ notforloan => 1 })->get_column('itemtype');
94
    @hold_not_allowed_itypes = uniq @hold_not_allowed_itypes;
73
95
74
    my $params = {
96
    my $params = {
75
        itemlost   => 0,
97
        itemlost   => 0,
(-)a/t/db_dependent/Koha/Holds.t (-1 / +7 lines)
Lines 533-538 subtest 'Desks' => sub { Link Here
533
subtest 'get_items_that_can_fill' => sub {
533
subtest 'get_items_that_can_fill' => sub {
534
    plan tests => 6;
534
    plan tests => 6;
535
535
536
    Koha::CirculationRules->search(
537
        {
538
            rule_name    => 'holdallowed',
539
            rule_value   => 'not_allowed',
540
        }
541
    )->delete;
542
536
    my $biblio = $builder->build_sample_biblio;
543
    my $biblio = $builder->build_sample_biblio;
537
    my $itype_1 = $builder->build_object({ class => 'Koha::ItemTypes' }); # For 1, 2, 3, 4
544
    my $itype_1 = $builder->build_object({ class => 'Koha::ItemTypes' }); # For 1, 2, 3, 4
538
    my $itype_2 = $builder->build_object({ class => 'Koha::ItemTypes' });
545
    my $itype_2 = $builder->build_object({ class => 'Koha::ItemTypes' });
539
- 

Return to bug 29087