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

(-)a/C4/Reserves.pm (-10 / +1 lines)
Lines 411-429 sub CanItemBeReserved { Link Here
411
    }
411
    }
412
412
413
    # Now we need to check hold limits by patron category
413
    # Now we need to check hold limits by patron category
414
    my $rule = Koha::CirculationRules->find(
414
    my $rule = Koha::CirculationRules->get_effective_rule(
415
        {
415
        {
416
            categorycode => $borrower->{categorycode},
416
            categorycode => $borrower->{categorycode},
417
            branchcode   => $borrower->{branchcode},
417
            branchcode   => $borrower->{branchcode},
418
            itemtype     => undef,
419
            rule_name    => 'max_holds',
420
        }
421
    );
422
    $rule ||= Koha::CirculationRules->find(
423
        {
424
            categorycode => $borrower->{categorycode},
425
            branchcode   => undef,,
426
            itemtype     => undef,
427
            rule_name    => 'max_holds',
418
            rule_name    => 'max_holds',
428
        }
419
        }
429
    );
420
    );
(-)a/Koha/CirculationRules.pm (-3 / +6 lines)
Lines 53-61 sub get_effective_rule { Link Here
53
    my $search_params;
53
    my $search_params;
54
    $search_params->{rule_name} = $rule_name;
54
    $search_params->{rule_name} = $rule_name;
55
55
56
    $search_params->{categorycode} = defined $categorycode ? { 'in' => [ $categorycode, '*' ] } : undef;
56
    $search_params->{categorycode} = defined $categorycode ? [ $categorycode, undef ] : undef;
57
    $search_params->{itemtype}     = defined $itemtype     ? { 'in' => [ $itemtype,     '*' ] } : undef;
57
    $search_params->{itemtype}     = defined $itemtype     ? [ $itemtype, undef ] : undef;
58
    $search_params->{branchcode}   = defined $branchcode   ? { 'in' => [ $branchcode,   '*' ] } : undef;
58
    $search_params->{branchcode}   = defined $branchcode   ? [ $branchcode,   undef ] : undef;
59
59
60
    my $rule = $self->search(
60
    my $rule = $self->search(
61
        $search_params,
61
        $search_params,
Lines 94-99 sub set_rule { Link Here
94
    my $rule_name    = $params->{rule_name};
94
    my $rule_name    = $params->{rule_name};
95
    my $rule_value   = $params->{rule_value};
95
    my $rule_value   = $params->{rule_value};
96
96
97
    for my $v ( $branchcode, $categorycode, $itemtype ) {
98
        $v = undef if $v and $v eq '*';
99
    }
97
    my $rule = $self->search(
100
    my $rule = $self->search(
98
        {
101
        {
99
            rule_name    => $rule_name,
102
            rule_name    => $rule_name,
(-)a/admin/smart-rules.pl (-3 / +2 lines)
Lines 267-273 elsif ($op eq "set-branch-defaults") { Link Here
267
    Koha::CirculationRules->set_rule(
267
    Koha::CirculationRules->set_rule(
268
        {
268
        {
269
            branchcode   => $branch,
269
            branchcode   => $branch,
270
            categorycode => '*',
270
            categorycode => undef,
271
            itemtype     => undef,
271
            itemtype     => undef,
272
            rule_name    => 'max_holds',
272
            rule_name    => 'max_holds',
273
            rule_value   => $max_holds,
273
            rule_value   => $max_holds,
Lines 344-350 elsif ($op eq "add-branch-cat") { Link Here
344
344
345
            Koha::CirculationRules->set_rule(
345
            Koha::CirculationRules->set_rule(
346
                {
346
                {
347
                    branchcode   => '*',
347
                    branchcode   => undef,
348
                    categorycode => $categorycode,
348
                    categorycode => $categorycode,
349
                    itemtype     => undef,
349
                    itemtype     => undef,
350
                    rule_name    => 'max_holds',
350
                    rule_name    => 'max_holds',
351
- 

Return to bug 18887