Bugzilla – Attachment 87574 Details for
Bug 18888
Include the definition of currency in onboarding tool
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18888: Updated Currency onboarding step to match DB
Bug-18888-Updated-Currency-onboarding-step-to-matc.patch (text/plain), 16.20 KB, created by
Hayley Pelham
on 2019-04-09 05:59:12 UTC
(
hide
)
Description:
Bug 18888: Updated Currency onboarding step to match DB
Filename:
MIME Type:
Creator:
Hayley Pelham
Created:
2019-04-09 05:59:12 UTC
Size:
16.20 KB
patch
obsolete
>From d98839bffcf67b56063710df3a1ada9210bf79ee Mon Sep 17 00:00:00 2001 >From: Hayley Mapley <hayleymapley@catalyst.net.nz> >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 >--- > 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' %] >-<title>Koha › Web installer › >- [% IF all_done %] >- Complete >- [% ELSE %] >- Create circulation rule >- [% END %] >-</title> >+<title>Koha › Web installer › Define a currency</title> > [% INCLUDE 'installer-doc-head-close.inc' %] > </head> > >@@ -14,119 +8,55 @@ > <div class="row"> > <div id="onboarding-step6" class="installer-main col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2"> > <h1 id="logo"><a href="#">Koha</a></h1> >+ <h2>Web installer › Define a currency </h2> > >- [% IF all_done %] >- <h2>Web installer › Complete</h2> >- [% INCLUDE 'onboarding_messages.inc' %] >- <h3>Congratulations, you have finished and are ready to use Koha</h3> >- <a class="btn btn-success" href="/cgi-bin/koha/mainpage.pl">Start using Koha</a> >- [% ELSE %] >- >- <h2>Web installer › Create a new circulation rule </h2> >- >- [% INCLUDE 'onboarding_messages.inc' %] >- >- <form name="createcirculationrule" method="post" action="onboarding.pl"> >- <fieldset class="rows"> >- <input type="hidden" name="step" value="6"/> >- <input type="hidden" name="op" value="add_validate_circ_rule" /> >- <ol> >- <li> >- <label for="branchname" class="required"> Library branch</label> >- <select name="branch" id="branchname" required="required"> >- <option value=""> Choose</option> >- <option value="*" selected="selected">All</option> >- [% FOREACH library IN libraries %] >- <option value="[% library.branchcode | html %]"> [% library.branchname | html %]</option> >- [% END %] >- </select> >- <span class="required">Required</span> >- </li> >- <li> >- <label for="categorycode" class="required">Patron category: </label> >- <select name="categorycode" id="categorycode" required="required"> >- <option value=""> Choose</option> >- <option value="*" selected="selected">All</option> >- [% FOREACH category IN categories %] >- <option value = "[% category.categorycode | html %]"> [% category.description | html %]</option> >- [%END%] >- </select> >- <span class="required">Required</span> >- </li> >- >- <li> >- <label for="itemtype"> Item type: </label> >- <select id="itemtype" name="itemtype" required="required"> >- <option value=""> Choose </option> >- <option value="*" selected="selected">All</option> >- [% FOREACH item IN itemtypes %] >- <option value = "[% item.itemtype | html %]"> [% item.itemtype | html %] >- [%END%] >- </select> >- <span class="required"> Required</span> >- </li> >- <li> >- <label for="maxissueqty" class="required">Current checkouts allowed: </label> >- <input type="number" min="0" name="maxissueqty" id="maxissueqty" size="10" value="50" class="required" required="required" /> >- <span class="required">Required</span> >- </li> >- >- <li> >- <label for="issuelength" class="required">Loan period: </label> >- <input type="number" min="0" name="issuelength" id="issuelength" size="10" value="14" class="required" required="required" /> >- <span class="required">Required</span> >- </li> >- <li> >- <label for="lengthunit">Units: </label> >- <select name="lengthunit" id="lengthunit" required="required"> >- <option value=""> Choose </option> >- [% SET units = 'days' %] >- [% IF category %] >- [% SET default_privacy = category.default_privacy %] >- [% END %] >- >- [% SWITCH units %] >- [% CASE 'days' %] >- <option value="days" selected="selected">Days</option> >- <option value="hours">Hours</option> >- [% CASE 'hours' %] >- <option value="days">Days</option> >- <option value="hours" selected="selected">Hours</option> >- [% END %] >- </select> >- </li> >- <li> >- <label for="renewalsallowed" class="required">Renewals allowed: </label> >- <input type="number" min="0" name="renewalsallowed" id="renewalsallowed" size="10" max="10" value="10" class="required" required="required" /> >- <span class="required">Required</span> >- </li> >- >- <li> >- <label for="renewalperiod" class="required">Renewals period: </label> >- <input type="number" min="0" name="renewalperiod" id="renewalperiod" size="10" value="14" class="required" required="required" /> >- <span class="required">Required</span> >- </li> >- >- <li> >- <label for="onshelfholds">On shelf holds allowed: </label> >- <select name="onshelfholds" id="onshelfholds" required="required"> >- <option value="">Choose</option> >- <option value="1" selected="selected">Yes</option> >- <option value="0">If any unavailable</option> >- <option value="2">If all unavailable</option> >- </select> >- </li> >- </ol> >- <p> >- To create circulation rule, go to: >- <span class="breadcrumbs">Administration › Circulation and fine rules </span> >- </p> >- >- </fieldset> >+ [% INCLUDE 'onboarding_messages.inc' %] > >+ <form name="createcurrency" id="createcurrency" method="post" action="onboarding.pl"> >+ <input type="hidden" name="step" value="6"/> >+ <input type="hidden" name="op" value="add_validate_currency" /> >+ <fieldset class="rows"> >+ <legend> >+ New currency >+ </legend> >+ <ol> >+ <li> >+ [% IF currency %] >+ <span class="label">Currency: </span> >+ <input type="hidden" name="is_a_modif" value="1" /> >+ <input type="hidden" name="currency_code" id="currency" value="[% currency.currency | html %]" />[% currency.currency | html %] >+ [% ELSE %] >+ <label for="currency_code" class="required">Currency: </label> >+ <input type="text" name="currency_code" id="currency_code" size="50" maxlength="50" required="required" class="required" /> <span class="required">Required</span> >+ [% END %] >+ </li> >+ <li> >+ <label for="rate" class="required">Rate: </label> >+ <input type="text" name="rate" id="rate" size="10" maxlength="10" value=1 readonly /> <span class="required">Required</span> >+ </li> >+ <li> >+ <label for="symbol" class="required">Symbol: </label> >+ <input type="text" name="symbol" id="symbol" size="5" maxlength="5" value="[% currency.symbol | html %]" required="required" class="required" /> <span class="required">Required</span> >+ </li> >+ <li> >+ <label for="isocode">ISO code: </label> >+ <input type="text" name="isocode" id="isocode" size="5" maxlength="5" value="[% currency.isocode | html %]" /> >+ </li> >+ <li> >+ <label for="p_sep_by_space">Space separation between symbol and value: </label> >+ <input type="checkbox" name="p_sep_by_space" id="p_sep_by_space" size="5" maxlength="5" value="1" /> >+ </li> >+ <input type="hidden" id="active" name="active" value="1"/> >+ </ol> >+ </fieldset> >+ <p> >+ To create another currency, go to: >+ <span class="breadcrumbs">Administration › Currencies and exchange rates </span> >+ </p> >+ <fieldset class="action"> > <input type="submit" class="btn btn-primary" value="Submit" /> >- </form> >- [% END %] >+ </fieldset> >+ </form> > </div> <!-- / #onboarding-step6 --> > </div> <!-- / .row --> > </div><!-- / .container-fluid --> >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18888
:
64767
|
64771
|
86709
|
86710
|
87574
|
87687
|
87691
|
87692