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 532-537 subtest 'Desks' => sub { Link Here
532
subtest 'get_items_that_can_fill' => sub {
532
subtest 'get_items_that_can_fill' => sub {
533
    plan tests => 6;
533
    plan tests => 6;
534
534
535
    Koha::CirculationRules->search(
536
        {
537
            rule_name    => 'holdallowed',
538
            rule_value   => 'not_allowed',
539
        }
540
    )->delete;
541
535
    my $biblio = $builder->build_sample_biblio;
542
    my $biblio = $builder->build_sample_biblio;
536
    my $itype_1 = $builder->build_object({ class => 'Koha::ItemTypes' }); # For 1, 2, 3, 4
543
    my $itype_1 = $builder->build_object({ class => 'Koha::ItemTypes' }); # For 1, 2, 3, 4
537
    my $itype_2 = $builder->build_object({ class => 'Koha::ItemTypes' });
544
    my $itype_2 = $builder->build_object({ class => 'Koha::ItemTypes' });
538
- 

Return to bug 29087