@@ -, +, @@ 1 Create a library 2 Create patron category 3 Set minPasswordLength 4 Create Koha administrator 5 Create item type 6 Define currency (see step 3!) 7 Circulation rule/Complete --- admin/currency.pl | 4 + installer/onboarding.pl | 44 +++++- .../prog/en/modules/onboarding/onboardingstep6.tt | 164 ++++++--------------- 3 files changed, 91 insertions(+), 121 deletions(-) --- a/admin/currency.pl +++ a/admin/currency.pl @@ -59,6 +59,7 @@ if ( $op eq 'add_form' ) { my $active = $input->param('active'); my $p_sep_by_space = $input->param('p_sep_by_space'); my $is_a_modif = $input->param('is_a_modif'); + my $step = $input->param('step'); if ($is_a_modif) { my $currency = Koha::Acquisition::Currencies->find($currency_code); @@ -92,6 +93,9 @@ if ( $op eq 'add_form' ) { } $searchfield = q||; $op = 'list'; + if ( $step ) { + print $input->redirect("/cgi-bin/koha/installer/onboarding.pl"); + } } elsif ( $op eq 'delete_confirm' ) { my $currency = Koha::Acquisition::Currencies->find($currency_code); --- a/installer/onboarding.pl +++ a/installer/onboarding.pl @@ -253,8 +253,44 @@ if ( $step == 5 ) { $step++ if Koha::ItemTypes->count; } +#Create currency if it doesn't exist +my $cur = Koha::Acquisition::Currencies->get_active; +if ( $step == 6 && !$cur ) { + my $currency_code = $input->param('currency_code'); + my $symbol = $input->param('symbol'); + my $isocode = $input->param('isocode'); + my $rate = $input->param('rate'); + my $active = $input->param('active'); + my $p_sep_by_space = $input->param('p_sep_by_space'); + my $is_a_modif = $input->param('is_a_modif'); + + if ( $currency_code ) { + my $currency = Koha::Acquisition::Currency->new( + { currency => $currency_code, + symbol => $symbol, + isocode => $isocode, + rate => $rate, + active => $active, + p_sep_by_space => $p_sep_by_space, + } + ); + eval { $currency->store; }; + if ($@) { + push @messages, { type => 'error', code => 'error_on_insert' }; + } else { + push @messages, { type => 'message', code => 'success_on_insert' }; + } + } + $cur = Koha::Acquisition::Currencies->get_active; + if ($cur) { + $step++; + } +} elsif ( $step == 6 && $cur ){ + $step++; +} + #Create circulation rule -if ( $step == 6 ) { +if ( $step == 7 ) { if ( $op eq 'add_validate_circ_rule' ) { @@ -324,9 +360,9 @@ $template_params->{libraries} = $libraries; my $minPasswordLength = C4::Context->preference('minPasswordLength'); $template_params->{minPasswordLength} = $minPasswordLength; -if ( $step > 6 ) { - $template_params->{all_done} = 1; # If step 5 is complete, we are done! - $step = 6; +if ( $step > 7 ) { + $template_params->{all_done} = 1; # If step 7 is complete, we are done! + $step = 7; } #Getting the appropriate template to display to the user --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt @@ -1,11 +1,5 @@ [% INCLUDE 'doc-head-open.inc' %] -