From e316de81b6903155fbc5d3f7488f44900d2a78e0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 23 Jan 2020 16:01:13 +0100 Subject: [PATCH] Bug 18936: Insert default rules during the onboarding tool MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Those default values have been picked from bug 15522 (Koha::CirculationRules) Signed-off-by: Minna Kivinen Signed-off-by: Joonas Kylmälä Signed-off-by: Martin Renvoize --- installer/onboarding.pl | 60 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/installer/onboarding.pl b/installer/onboarding.pl index 8951530a26..990dc9cc50 100755 --- a/installer/onboarding.pl +++ b/installer/onboarding.pl @@ -251,17 +251,65 @@ if ( $step == 5 ) { categorycode => $categorycode, itemtype => $itemtype, rules => { - renewalsallowed => $renewalsallowed, - renewalperiod => $renewalperiod, - issuelength => $issuelength, - lengthunit => $lengthunit, - onshelfholds => $onshelfholds, + renewalsallowed => $renewalsallowed, + renewalperiod => $renewalperiod, + issuelength => $issuelength, + lengthunit => $lengthunit, + onshelfholds => $onshelfholds, + article_requests => "no", + auto_renew => 0, + cap_fine_to_replacement_price => 0, + chargeperiod => 0, + chargeperiod_charge_at => 0, + fine => 0, + finedays => 0, + firstremind => 0, + hardduedate => "", + hardduedatecompare => -1, + holds_per_day => undef, + holds_per_record => 1, + maxissueqty => "", + maxonsiteissueqty => "", + maxsuspensiondays => "", + no_auto_renewal_after => "", + no_auto_renewal_after_hard_limit => "", + norenewalbefore => "", + opacitemholds => "N", + overduefinescap => "", + rentaldiscount => 0, + reservesallowed => 0, + suspension_chargeperiod => undef, + } + }; + + my $params_2 = { + branchcode => $branchcode, + categorycode => $categorycode, + rules => { + patron_maxissueqty => "", + patron_maxonsiteissueqty => "", + max_holds => "", + } + }; + + my $params_3 = { + branchcode => $branchcode, + itemtype => $itemtype, + rules => { + holdallowed => "", + hold_fulfillment_policy => "", + returnbranch => "", } }; - eval { Koha::CirculationRules->set_rules( $params ) }; + eval { + Koha::CirculationRules->set_rules($params); + Koha::CirculationRules->set_rules($params_2); + Koha::CirculationRules->set_rules($params_3); + }; if ($@) { + warn $@; push @messages, { code => 'error_on_insert_circ_rule' }; } else { -- 2.39.2