From d0beea7f0be1d52c8346e62ed4c01e4435c7b6f3 Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Tue, 1 Oct 2024 08:30:33 +0000 Subject: [PATCH] Bug 37511: Location of the currency symbol (before or *after*) the amount MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It is customary in non-English-speaking European countries to write the currency symbol after the amount and separated from it by a space (e.g. 123 €, 54 zł, 38 Kč). This custom should be taken into account in Koha::Number::Price::_format_params (by proper use the p_cs_precedes parameter). The correct display of the currency is particularly important when using OPACShowSavings system preference. Test plan: ========== 1. Enable OPACShowSavings, have some items with defined 'v - Cost, replacement price'. Check out the items to a patron. 2. Log in to OPAC as the patron. See the amount of 'total savings' on the main page. Note that the currency symbol precedes the amount. There is no way to configure the position of the currency symbol. 3. Apply the patch ; updatedatabase.pl ; restart_all. 4. Go to Administration > Currencies and exchange rates. Modify the active currency unchecking the 'Currency symbol precedes value' checkbox. 5. Refresh the OPAC page. See that the position of the currency symbol has been changed. Sponsored-by: Ignatianum University in Cracow Signed-off-by: Roman Dolny Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- Koha/Number/Price.pm | 3 ++- admin/currency.pl | 14 +++++++++----- .../prog/en/modules/admin/currency.tt | 8 ++++++++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Koha/Number/Price.pm b/Koha/Number/Price.pm index a0f847d495..4518e97457 100644 --- a/Koha/Number/Price.pm +++ b/Koha/Number/Price.pm @@ -127,7 +127,8 @@ sub _format_params { } - $format_params{p_cs_precedes} = $p_cs_precedes if defined $p_cs_precedes; + $format_params{p_cs_precedes} = + defined $p_cs_precedes ? $p_cs_precedes : ( $currency and $currency->p_cs_precedes ) ? 1 : 0; $format_params{p_sep_by_space} = ( $currency and $currency->p_sep_by_space ) ? 1 : 0; return \%format_params; diff --git a/admin/currency.pl b/admin/currency.pl index 6220bbd081..2ca7d620e4 100755 --- a/admin/currency.pl +++ b/admin/currency.pl @@ -57,6 +57,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') // 0; my $is_a_modif = $input->param('is_a_modif'); if ($is_a_modif) { @@ -66,6 +67,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' }; @@ -74,12 +76,14 @@ if ( $op eq 'add_form' ) { } } else { my $currency = Koha::Acquisition::Currency->new( - { currency => $currency_code, - symbol => $symbol, - isocode => $isocode, - rate => $rate, - active => $active, + { + currency => $currency_code, + symbol => $symbol, + isocode => $isocode, + 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 0cf35c914d..a3ef292b31 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt @@ -148,6 +148,14 @@ [% END %] +
  • + + [% IF currency.p_cs_precedes %] + + [% ELSE %] + + [% END %] +
  • [% IF currency.active %] -- 2.39.5