From 49e77b1fcfe81a29a93a4e2e6f36a4806a179f70 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Sun, 2 Jul 2017 13:02:31 +0000 Subject: [PATCH] Bug 18888 - Currency defined in new onboardingstep6.tt after installation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test plan: 1. Restart memcached and drop and recreate your database 2. Go through the Koha web installer making sure to install all data except the currencies 3. Run through the onboarding tool noticing that after creating the circulation rule the complete page appears and you can click to log into Koha with the superlibrarian user you have created in the onboarding tool 4. Apply patch 5. Repeat step 1, and 2 6. Run through the onboarding tool and notice that after creating the circulation rule, a screen appears for you to define a currency 7. Write in the currency name and symbol (notice: you cannot edit the exchange rate of 1) and submit the form 8. Notice the complete screen appears and you can log in with the superlibrarian account created in the onboarding tool 9. Go to Administration->Currencies and exchange rates and notice that the currency you created in the onboarding tool is displayed as active 10. Repeat step 1 11. Go through the Koha web installer making sure to install all data including currencies 12. Run through the onboarding tool and notice that after creating the circulation rule then the complete screen appears and click to log into Koha with your superlibrarian account 13. Run qa tool and all tests should be successful 14. Sign off Sponsored-by: Catalyst IT Folloewe test plan, works as expected. Signed-off-by: Marc VĂ©ron --- admin/currency.pl | 6 ++ installer/onboarding.pl | 33 ++++++++- .../prog/en/modules/onboarding/onboardingstep6.tt | 79 ++++++++++++++++++++++ 3 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt diff --git a/admin/currency.pl b/admin/currency.pl index 1c5ec3e..f7e3e0e 100755 --- a/admin/currency.pl +++ b/admin/currency.pl @@ -58,6 +58,7 @@ if ( $op eq 'add_form' ) { my $rate = $input->param('rate'); my $active = $input->param('active'); 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); @@ -89,6 +90,11 @@ 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); diff --git a/installer/onboarding.pl b/installer/onboarding.pl index 8b032c9..f0808d9 100755 --- a/installer/onboarding.pl +++ b/installer/onboarding.pl @@ -284,9 +284,38 @@ $template_params->{group_types} = [ }, ]; -if ( $step > 5 ) { - $template_params->{all_done} = 1; # If step 5 is complete, we are done! +my $cur = Koha::Acquisition::Currencies->get_active; + +if ( $step > 5 && $cur ) { + $template_params->{all_done} = 1; # If step 5 is completei and currency exists, we are done! $step = 5; +} elsif ($step > 5 && !$cur) { + $step =6; + 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 $is_a_modif = $input->param('is_a_modif'); + my $currency = Koha::Acquisition::Currency->new( + { currency => $currency_code, + symbol => $symbol, + isocode => $isocode, + rate => $rate, + active => $active, + } + ); + 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) { + $template_params->{all_done} = 1; # If currency exists then we are done! + $step = 5; + } } #Getting the appropriate template to display to the user diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt new file mode 100644 index 0000000..6195540 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt @@ -0,0 +1,79 @@ +[% INCLUDE 'doc-head-open.inc' %] +Koha › Web installer › + [% IF all_done %] + Complete + [% ELSE %] + Define a currency + [% END %] + +[% INCLUDE 'installer-doc-head-close.inc' %] +[% INCLUDE 'validator-strings.inc' %] +[% INCLUDE 'installer-strings.inc' %] + + + + +
+
+
+

Koha

+ + [% IF all_done %] + +

Web installer › Complete

+ [% INCLUDE 'onboarding_messages.inc' %] +

Congratulations you have finished and are ready to use Koha

+ Start using Koha + + [% ELSE %] + +

Web installer › Define a currency

+ + [% INCLUDE 'onboarding_messages.inc' %] + +
+ + +
+ + New currency + +
    +
  1. + [% IF currency %] + Currency: + + [% currency.currency %] + [% ELSE %] + + Required + [% END %] +
  2. +
  3. + + Required +
  4. +
  5. + + Required +
  6. +
  7. + + +
  8. + +
+
+

+ To create another currency, go to: + Administration › Currencies and exchange rates +

+
+ +
+
+ [% END %] +
+
+ +[% INCLUDE 'intranet-bottom.inc' %] -- 2.1.4