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

(-)a/C4/Reserves.pm (-10 / +1 lines)
Lines 413-431 sub CanItemBeReserved { Link Here
413
    }
413
    }
414
414
415
    # Now we need to check hold limits by patron category
415
    # Now we need to check hold limits by patron category
416
    my $rule = Koha::CirculationRules->find(
416
    my $rule = Koha::CirculationRules->get_effective_rule(
417
        {
417
        {
418
            categorycode => $borrower->{categorycode},
418
            categorycode => $borrower->{categorycode},
419
            branchcode   => $branchcode,
419
            branchcode   => $branchcode,
420
            itemtype     => undef,
421
            rule_name    => 'max_holds',
422
        }
423
    );
424
    $rule ||= Koha::CirculationRules->find(
425
        {
426
            categorycode => $borrower->{categorycode},
427
            branchcode   => undef,,
428
            itemtype     => undef,
429
            rule_name    => 'max_holds',
420
            rule_name    => 'max_holds',
430
        }
421
        }
431
    );
422
    );
(-)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 271-277 elsif ($op eq "set-branch-defaults") { Link Here
271
    Koha::CirculationRules->set_rule(
271
    Koha::CirculationRules->set_rule(
272
        {
272
        {
273
            branchcode   => $branch,
273
            branchcode   => $branch,
274
            categorycode => '*',
274
            categorycode => undef,
275
            itemtype     => undef,
275
            itemtype     => undef,
276
            rule_name    => 'max_holds',
276
            rule_name    => 'max_holds',
277
            rule_value   => $max_holds,
277
            rule_value   => $max_holds,
Lines 348-354 elsif ($op eq "add-branch-cat") { Link Here
348
348
349
            Koha::CirculationRules->set_rule(
349
            Koha::CirculationRules->set_rule(
350
                {
350
                {
351
                    branchcode   => '*',
351
                    branchcode   => undef,
352
                    categorycode => $categorycode,
352
                    categorycode => $categorycode,
353
                    itemtype     => undef,
353
                    itemtype     => undef,
354
                    rule_name    => 'max_holds',
354
                    rule_name    => 'max_holds',
355
- 

Return to bug 18887