From 3c4232e746cef574de9d1a346be7704dc3cd2e33 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 12 Mar 2019 17:29:38 +0000 Subject: [PATCH] Bug 22489: Update onboarding tool for bug 18925 When going through the onboarding process, the tool fails on submit of step 5, due to changes made in the database structure and rule definitions by bug 18925. This patch fixes this, adding code that creates a circulation rule where an issuing rule is also created in onboarding.pl. It removes maxissueqty from being sent with params to make an issuing rule, and adds it instead to the params to make a circulation rule, to reflect the changes that have been made in the database. Test plan: 1) Drop and recreate your database 2) Reload the staff client and follow the installer and onboarding process 3) Confirm that the process finishes without errors Signed-off-by: Martin Renvoize Signed-off-by: Liz Rea Bug 22489: (follow-up) Correctly set success messages The original patch was duplicating the success message upon successful circ rule insertion. This corrects that. Signed-off-by: Martin Renvoize Signed-off-by: Liz Rea Signed-off-by: Jonathan Druart Patches squashed for readability Signed-off-by: Nick Clemens --- installer/onboarding.pl | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/installer/onboarding.pl b/installer/onboarding.pl index 1acc420c43..77aa12018a 100755 --- a/installer/onboarding.pl +++ b/installer/onboarding.pl @@ -251,7 +251,6 @@ if ( $step == 5 ) { branchcode => $branchcode, categorycode => $categorycode, itemtype => $itemtype, - maxissueqty => $maxissueqty, renewalsallowed => $renewalsallowed, renewalperiod => $renewalperiod, issuelength => $issuelength, @@ -262,11 +261,29 @@ if ( $step == 5 ) { my $issuingrule = Koha::IssuingRule->new($params); eval { $issuingrule->store; }; - unless ($@) { - push @messages, { code => 'success_on_insert_circ_rule' }; - } - else { + if ($@) { push @messages, { code => 'error_on_insert_circ_rule' }; + } else { + + eval { + Koha::CirculationRules->set_rules( + { + categorycode => $categorycode, + itemtype => $itemtype, + branchcode => $branchcode, + rules => { + maxissueqty => $maxissueqty, + } + } + ); + }; + + unless ($@) { + push @messages, { code => 'success_on_insert_circ_rule' }; + } + else { + push @messages, { code => 'error_on_insert_circ_rule' }; + } } } -- 2.39.5