From 432e6aaa643493e012e034b597bfe35f17a13520 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 --- installer/onboarding.pl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/installer/onboarding.pl b/installer/onboarding.pl index 1acc420c43..aabb6b9014 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, @@ -268,6 +267,26 @@ if ( $step == 5 ) { else { push @messages, { code => 'error_on_insert_circ_rule' }; } + + 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' }; + } } $step++ if Koha::IssuingRules->count; -- 2.20.1