Bug 18928: (bug 22679 follow-up) Do not remove all rules along with the issuing rule

We actually want to remove maxissueqty, maxonsiteissueqty and max_holds (for now)

Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2019-05-03 16:47:59 -04:00 committed by Martin Renvoize
parent 86f37b1eb3
commit d52ec38cef
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
2 changed files with 17 additions and 3 deletions

View File

@ -46,6 +46,11 @@ sub delete {
branchcode => $branchcode,
itemtype => $itemtype,
categorycode => $categorycode,
rule_name => [qw(
maxissueqty
maxonsiteissueqty
max_holds
)],
})->delete;
$self->SUPER::delete;

View File

@ -329,19 +329,28 @@ subtest 'delete' => sub {
$builder->build_object({ class => 'Koha::CirculationRules', value => {
categorycode => $category->categorycode,
itemtype => $itemtype->itemtype,
branchcode => $library->branchcode
branchcode => $library->branchcode,
rule_name => 'maxissueqty',
}
});
$builder->build_object({ class => 'Koha::CirculationRules', value => {
categorycode => $category->categorycode,
itemtype => $itemtype->itemtype,
branchcode => $library->branchcode
branchcode => $library->branchcode,
rule_name => 'maxonsiteissueqty',
}
});
$builder->build_object({ class => 'Koha::CirculationRules', value => {
categorycode => $category->categorycode,
itemtype => $itemtype->itemtype,
branchcode => $library->branchcode,
rule_name => 'another_rule', # That must not be deleted
}
});
# Now we delete the issuing rule
$issue_rule->delete;
is( Koha::CirculationRules->search()->count ,$count, "We remove related circ rules with our issuing rule");
is( Koha::CirculationRules->search()->count ,$count + 1, "We remove related circ rules maxissueqty and maxonsiteissueqty with our issuing rule");
};