Bugzilla – Attachment 98236 Details for
Bug 20352
Add ability of currency/price to have a symbol after amount
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20352: Add the ability to chose the position of the currency
Bug-20352-Add-the-ability-to-chose-the-position-of.patch (text/plain), 4.80 KB, created by
Martin Renvoize
on 2020-01-31 14:09:14 UTC
(
hide
)
Description:
Bug 20352: Add the ability to chose the position of the currency
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2020-01-31 14:09:14 UTC
Size:
4.80 KB
patch
obsolete
>From beaff2003dc2eb39cd08d071732c83db394bfcfc Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 18 Dec 2019 12:00:14 +0100 >Subject: [PATCH] Bug 20352: Add the ability to chose the position of the > currency > >This patch mimicks what has been done for p_sep_by_space to add a space >separation between the symbol and the value. >Here we are adding p_cs_precedes to display the symbol before or after >the value. >Note that so far the symbol is only displayed in one place at the OPAC >(opac-main) > >Test plan: >- Create a manual invoice for a patron >- Edit the active currency, select 'Before' (should be the default here) >- Use the charged patron to login at the OPAC >=> On the mainpage you should see the charges displayed, with the symbol >before the value >- Edit the active currency, select 'After' >=> The symbol is now positionned after the value > >QA note: >From https://www.gnu.org/software/libc/manual/html_node/Currency-Symbol.html >p_cs_precedes is only used for positive amount, n_cs_precedes should be >used for negative. Here we are assuming that positive and negative >amounts are displayed the same way. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Number/Price.pm | 3 +-- > admin/currency.pl | 3 +++ > .../prog/en/modules/admin/currency.tt | 14 ++++++++++++++ > 3 files changed, 18 insertions(+), 2 deletions(-) > >diff --git a/Koha/Number/Price.pm b/Koha/Number/Price.pm >index 7b0b826a14..ab361973ad 100644 >--- a/Koha/Number/Price.pm >+++ b/Koha/Number/Price.pm >@@ -95,7 +95,6 @@ sub round { > sub _format_params { > my ( $self, $params ) = @_; > my $with_symbol = $params->{with_symbol} || 0; >- my $p_cs_precedes = $params->{p_cs_precedes}; > my $currency = Koha::Acquisition::Currencies->get_active; > my $currency_format = C4::Context->preference("CurrencyFormat"); > >@@ -132,8 +131,8 @@ sub _format_params { > } > > >- $format_params{p_cs_precedes} = $p_cs_precedes if defined $p_cs_precedes; > $format_params{p_sep_by_space} = ( $currency and $currency->p_sep_by_space ) ? 1 : 0; >+ $format_params{p_cs_precedes} = ( $currency and $currency->p_cs_precedes ) ? 1 : 0; > > return \%format_params; > } >diff --git a/admin/currency.pl b/admin/currency.pl >index 41003aeca9..4733b147bf 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 $p_sep_by_space = $input->param('p_sep_by_space'); >+ my $p_cs_precedes = $input->param('p_cs_precedes'); > my $is_a_modif = $input->param('is_a_modif'); > > if ($is_a_modif) { >@@ -67,6 +68,7 @@ if ( $op eq 'add_form' ) { > $currency->rate($rate); > $currency->active($active); > $currency->p_sep_by_space($p_sep_by_space); >+ $currency->p_cs_precedes($p_cs_precedes); > eval { $currency->store; }; > if ($@) { > push @messages, { type => 'error', code => 'error_on_update' }; >@@ -81,6 +83,7 @@ if ( $op eq 'add_form' ) { > rate => $rate, > active => $active, > p_sep_by_space => $p_sep_by_space, >+ p_cs_precedes => $p_cs_precedes, > } > ); > eval { $currency->store; }; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >index e16313110b..1025de096f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >@@ -102,6 +102,20 @@ > <input type="checkbox" id="p_sep_by_space" name="p_sep_by_space" value="1" /> > [% END %] > </li> >+ <li> >+ <label>Position of the currency symbol: </label> >+ [% IF currency.p_cs_precedes %] >+ <label for="p_cs_precedes_before">Before >+ <input type="radio" id="p_cs_precedes_before" name="p_cs_precedes" value="1" checked="checked" /></label> >+ <label for="p_cs_precedes_after">After >+ <input type="radio" id="p_cs_precedes_after" name="p_cs_precedes" value="0" /></label> >+ [% ELSE %] >+ <label for="p_cs_precedes_before">Before >+ <input type="radio" id="p_cs_precedes_before" name="p_cs_precedes" value="1" /></label> >+ <label for="p_cs_precedes_after">After >+ <input type="radio" id="p_cs_precedes_after" name="p_cs_precedes" value="0" checked="checked" /></label> >+ [% END %] >+ </li> > <li> > <label for="active">Active: </label> > [% IF currency.active %] >-- >2.20.1
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 20352
:
96410
|
96411
|
96412
|
98234
|
98235
|
98236
|
103924
|
103925
|
103926
|
103927