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

(-)a/Koha/IssuingRule.pm (+5 lines)
Lines 46-51 sub delete { Link Here
46
        branchcode   => $branchcode,
46
        branchcode   => $branchcode,
47
        itemtype     => $itemtype,
47
        itemtype     => $itemtype,
48
        categorycode => $categorycode,
48
        categorycode => $categorycode,
49
        rule_name => [qw(
50
            maxissueqty
51
            maxonsiteissueqty
52
            max_holds
53
        )],
49
    })->delete;
54
    })->delete;
50
55
51
    $self->SUPER::delete;
56
    $self->SUPER::delete;
(-)a/t/db_dependent/Koha/IssuingRules.t (-4 / +12 lines)
Lines 329-347 subtest 'delete' => sub { Link Here
329
    $builder->build_object({ class => 'Koha::CirculationRules', value => {
329
    $builder->build_object({ class => 'Koha::CirculationRules', value => {
330
            categorycode => $category->categorycode,
330
            categorycode => $category->categorycode,
331
            itemtype     => $itemtype->itemtype,
331
            itemtype     => $itemtype->itemtype,
332
            branchcode   => $library->branchcode
332
            branchcode   => $library->branchcode,
333
            rule_name    => 'maxissueqty',
333
        }
334
        }
334
    });
335
    });
335
    $builder->build_object({ class => 'Koha::CirculationRules', value => {
336
    $builder->build_object({ class => 'Koha::CirculationRules', value => {
336
            categorycode => $category->categorycode,
337
            categorycode => $category->categorycode,
337
            itemtype     => $itemtype->itemtype,
338
            itemtype     => $itemtype->itemtype,
338
            branchcode   => $library->branchcode
339
            branchcode   => $library->branchcode,
340
            rule_name    => 'maxonsiteissueqty',
341
        }
342
    });
343
    $builder->build_object({ class => 'Koha::CirculationRules', value => {
344
            categorycode => $category->categorycode,
345
            itemtype     => $itemtype->itemtype,
346
            branchcode   => $library->branchcode,
347
            rule_name    => 'another_rule', # That must not be deleted
339
        }
348
        }
340
    });
349
    });
341
350
342
    # Now we delete the issuing rule
351
    # Now we delete the issuing rule
343
    $issue_rule->delete;
352
    $issue_rule->delete;
344
    is( Koha::CirculationRules->search()->count ,$count, "We remove related circ rules with our issuing rule");
353
    is( Koha::CirculationRules->search()->count ,$count +  1, "We remove related circ rules maxissueqty and maxonsiteissueqty with our issuing rule");
345
354
346
};
355
};
347
356
348
- 

Return to bug 18928