Bugzilla – Attachment 72515 Details for
Bug 4078
Add the ability to customize and display the symbol for a currency
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 4078: Add the ability to display and configure the symbol for prices
Bug-4078-Add-the-ability-to-display-and-configure-.patch (text/plain), 3.68 KB, created by
Josef Moravec
on 2018-03-07 16:34:43 UTC
(
hide
)
Description:
Bug 4078: Add the ability to display and configure the symbol for prices
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-03-07 16:34:43 UTC
Size:
3.68 KB
patch
obsolete
>From 32861486192c75bf24c7b79201b98de9f3c5e359 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 1 Feb 2018 14:32:39 -0300 >Subject: [PATCH] Bug 4078: Add the ability to display and configure the symbol > for prices > >The symbol of currencies are not displayed (or not correctly) so far. >This patch set adds the ability to configure the display of the symbol >(with or without a whitespace between the symbol and the price). > >Test plan: >1. Execute the update DB entry, go to the currency admin page and tick the >new "Space separation between symbol and value" checkbox >2. Add a fine to a patron and use their credentials to login at the OPAC >3. You should see the "$ 42 due fines and charges" info in the >dashboard >4. Untick the new checkbox to remove the space and reload the OPAC main >page. >=> The space should not be longer displayed ($42) > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > Koha/Number/Price.pm | 8 ++------ > t/Number/Price.t | 7 +++---- > 2 files changed, 5 insertions(+), 10 deletions(-) > >diff --git a/Koha/Number/Price.pm b/Koha/Number/Price.pm >index 8e08607..899044f 100644 >--- a/Koha/Number/Price.pm >+++ b/Koha/Number/Price.pm >@@ -86,11 +86,10 @@ sub _format_params { > my ( $self, $params ) = @_; > my $with_symbol = $params->{with_symbol} || 0; > my $p_cs_precedes = $params->{p_cs_precedes}; >- my $p_sep_by_space = $params->{p_sep_by_space}; > my $currency = Koha::Acquisition::Currencies->get_active; > my $currency_format = C4::Context->preference("CurrencyFormat"); > >- my $int_curr_symbol = q||; >+ my $int_curr_symbol = $with_symbol ? $currency->symbol : q||; > my %format_params = ( > decimal_fill => '2', > decimal_point => '.', >@@ -101,8 +100,6 @@ sub _format_params { > ); > > if ( $currency_format eq 'FR' ) { >- # FIXME This test should be done for all currencies >- $int_curr_symbol = $currency->symbol if $with_symbol; > %format_params = ( > decimal_fill => '2', > decimal_point => ',', >@@ -114,7 +111,6 @@ sub _format_params { > } > > if ( $currency_format eq 'CH' ) { >- $int_curr_symbol = $currency->symbol if $with_symbol; > %format_params = ( > decimal_fill => '2', > decimal_point => '.', >@@ -127,7 +123,7 @@ sub _format_params { > > > $format_params{p_cs_precedes} = $p_cs_precedes if defined $p_cs_precedes; >- $format_params{p_sep_by_space} = ( $int_curr_symbol and defined $p_sep_by_space ) ? $p_sep_by_space : 0; >+ $format_params{p_sep_by_space} = $currency->p_sep_by_space ? 1 : 0; > > return \%format_params; > } >diff --git a/t/Number/Price.t b/t/Number/Price.t >index ea58488..4b706b3 100644 >--- a/t/Number/Price.t >+++ b/t/Number/Price.t >@@ -35,15 +35,14 @@ is( Koha::Number::Price->new(1234567890)->format( $format ), > > is( Koha::Number::Price->new(100000000000000)->format, '100000000000000', 'Numbers too big are not formatted'); > >-# FIXME This should be display symbol, but it was the case before the creation of this module > is( Koha::Number::Price->new->format( { %$format, with_symbol => 1 } ), >- '0.00', 'US: format 0 with symbol' ); >+ '$0.00', 'US: format 0 with symbol' ); > is( Koha::Number::Price->new(3)->format( { %$format, with_symbol => 1 } ), >- '3.00', 'US: format 3 with symbol' ); >+ '$3.00', 'US: format 3 with symbol' ); > is( > Koha::Number::Price->new(1234567890) > ->format( { %$format, with_symbol => 1 }, 'US: format 1234567890 with symbol' ), >- '1,234,567,890.00' >+ '$1,234,567,890.00' > ); > > is( Koha::Number::Price->new->unformat, '0', 'US: unformat 0' ); >-- >2.1.4
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 4078
:
7308
|
43320
|
45877
|
45878
|
45888
|
71118
|
71119
|
71120
|
71121
|
71122
|
71123
|
72378
|
72379
|
72380
|
72381
|
72382
|
72383
|
72511
|
72512
|
72513
|
72514
| 72515 |
72516
|
73196