From 19ae57984c3c3ea3a3eac8f6700a03f45ee221cc Mon Sep 17 00:00:00 2001 From: Hayley Mapley Date: Tue, 9 Apr 2019 17:51:03 +1200 Subject: [PATCH] Bug 18888: Updated Currency onboarding step to match DB Between the time that the original patch was created and now, a field has been added to the currency table which allows the user to specify whether the currency should appear with a space between the symbol and value. This patch updates the onboarding tool to accommodate that option, as well as cleans up some issues with script tags and duplicate entries to the DB. This patch depends on Bug 18308, building on the steps that have been rearranged. Test plan: 0) Apply patch 18308. 1) Drop and recreate your database, then restart_all 2) Go through the onboarding tool, noting that the order matches the following: 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 3) Note that when you get to the currency page that there is no option for setting there to be a space between symbol and value 4) Apply this patch, and repeat step 1 - 3 5) Go through the onboarding tool again and this time note that on the currency page there is an option to set there to be a space between symbol and value - check this box. 6) Continue on to Koha 7) Apply a fine to a patron, log in as that patron, and verify that the currency is displayed with a space between the symbol and the value in the OPAC 8) Also verify that there is only one currency (the one you created) in the currency table in your database Note: This patch may fail the QA tools due to Asset not working with the installer. Sponsored-by: Catalyst IT Signed-off-by: Liz Rea --- admin/currency.pl | 4 + installer/onboarding.pl | 44 +++++- .../prog/en/modules/onboarding/onboardingstep6.tt | 164 ++++++--------------- 3 files changed, 91 insertions(+), 121 deletions(-) diff --git a/admin/currency.pl b/admin/currency.pl index 41003aeca9..f31f120682 100755 --- a/admin/currency.pl +++ b/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); diff --git a/installer/onboarding.pl b/installer/onboarding.pl index 3d2e2a4597..6719009125 100755 --- a/installer/onboarding.pl +++ b/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 diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt index 8abdf21dbd..0a20e9daba 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt @@ -1,11 +1,5 @@ [% INCLUDE 'doc-head-open.inc' %] -Koha › Web installer › - [% IF all_done %] - Complete - [% ELSE %] - Create circulation rule - [% END %] - +Koha › Web installer › Define a currency [% INCLUDE 'installer-doc-head-close.inc' %] @@ -14,119 +8,55 @@

Koha

+

Web installer › Define a currency

- [% 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 › Create a new circulation rule

- - [% INCLUDE 'onboarding_messages.inc' %] - -
-
- - -
    -
  1. - - - Required -
  2. -
  3. - - - Required -
  4. - -
  5. - - - Required -
  6. -
  7. - - - Required -
  8. - -
  9. - - - Required -
  10. -
  11. - - -
  12. -
  13. - - - Required -
  14. - -
  15. - - - Required -
  16. - -
  17. - - -
  18. -
-

- To create circulation rule, go to: - Administration › Circulation and fine rules -

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

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

+
- - [% END %] +
+
-- 2.11.0