Bug 37511: Location of the currency symbol (before or *after*) the amount

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 <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Janusz Kaczmarek 2024-10-01 08:30:33 +00:00 committed by Katrin Fischer
parent 14de7e35a6
commit d0beea7f0b
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
3 changed files with 19 additions and 6 deletions

View File

@ -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;

View File

@ -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; };

View File

@ -148,6 +148,14 @@
<input type="checkbox" id="p_sep_by_space" name="p_sep_by_space" value="1" />
[% END %]
</li>
<li>
<label for="p_cs_precedes">Currency symbol precedes value: </label>
[% IF currency.p_cs_precedes %]
<input type="checkbox" id="p_cs_precedes" name="p_cs_precedes" value="1" checked="checked" />
[% ELSE %]
<input type="checkbox" id="p_cs_precedes" name="p_cs_precedes" value="1" />
[% END %]
</li>
<li>
<label for="active">Active: </label>
[% IF currency.active %]