Bugzilla – Attachment 43320 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 - Display active currency symbol on currency output and input
Bug-4078---Display-active-currency-symbol-on-curre.patch (text/plain), 8.17 KB, created by
Marc Véron
on 2015-10-10 23:44:31 UTC
(
hide
)
Description:
Bug 4078 - Display active currency symbol on currency output and input
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2015-10-10 23:44:31 UTC
Size:
8.17 KB
patch
obsolete
>From 9c8e4540b6ed607dee03c215efac008c19554c65 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Sun, 11 Oct 2015 01:25:19 +0200 >Subject: [PATCH] Bug 4078 - Display active currency symbol on currency output > and input > >Display active currency using international formatting patterns and active >currency symbol withplugin price. > >The patch inlcudes an example on Opac. > >To test: > >Without patch: >- Log in to the Opac with an user who has credits or fines. >- Go to 'Your summary'. The amount appears in the tab 'Credits'rsp. 'Fines' >- Apply patch >- Make sure that you have defined an active currency in > Home > Administration > Currency & Exchange rates >- Search for Syspref 'Currency Format' >- Select a formatting pattern from the drop down list >- Go back to the Opac and verify that the amount is properly formatted, > including the position of the currency symbol. >--- > Koha/Number/Price.pm | 71 ++++++++++++++++---- > .../en/modules/admin/preferences/acquisitions.pref | 19 +++++- > .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 5 +- > 3 files changed, 76 insertions(+), 19 deletions(-) > >diff --git a/Koha/Number/Price.pm b/Koha/Number/Price.pm >index 2d563f9..1ff3c8b 100644 >--- a/Koha/Number/Price.pm >+++ b/Koha/Number/Price.pm >@@ -79,7 +79,7 @@ sub round { > > sub _format_params { > my ( $self, $params ) = @_; >- my $with_symbol = $params->{with_symbol} || 0; >+ my $with_symbol = $params->{with_symbol}; > my $p_cs_precedes = $params->{p_cs_precedes}; > my $p_sep_by_space = $params->{p_sep_by_space}; > my $currency = GetCurrency(); >@@ -92,21 +92,64 @@ sub _format_params { > mon_decimal_point => '.' > ); > >- 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 => ',', >- int_curr_symbol => $int_curr_symbol, >- mon_thousands_sep => ' ', >- thousands_sep => ' ', >- mon_decimal_point => ',' >- ); >+ if ( $currency_format =~ m/(_LEAD)/ ) { >+ $p_cs_precedes = 1 unless ( defined $p_cs_precedes ); >+ } >+ >+ if ( $currency_format =~ m/(_TRAIL)/ ) { >+ $p_cs_precedes = 0 unless ( defined $p_cs_precedes ); >+ } >+ >+ $format_params{'p_cs_precedes'} = $p_cs_precedes >+ if ( defined $p_cs_precedes ); >+ >+ if ( $currency_format =~ m/(_SPACE)/ ) { >+ $p_sep_by_space = 1 unless ( $p_sep_by_space ); >+ } >+ else { >+ $p_sep_by_space = 0 unless ( $p_sep_by_space ); >+ } >+ >+ $format_params{'p_sep_by_space'} = $p_sep_by_space; >+ >+ if ( $currency_format =~ m/(SYMB)/ ) { >+ $with_symbol = 1 unless ( defined $with_symbol ); >+ } >+ >+ $format_params{'int_curr_symbol'} = $currency->{symbol} >+ if ( $with_symbol ); >+ >+ # $format_params{'int_curr_symbol'} = "xxxxxxxxxxxxxx"; >+ >+ # TODO Add more currency formats (Syspref CurrencyFormat) >+ >+ # syspref FR: 360 000,00 >+ if ( $currency_format =~ m/(^FR)/ ) { >+ $format_params{'decimal_fill'} = '2'; >+ $format_params{'decimal_point'} = ','; >+ $format_params{'mon_decimal_point'} = ','; >+ $format_params{'thousands_sep'} = ' '; >+ $format_params{'mon_thousands_sep'} = ' '; >+ } >+ >+ # syspref US: 360,000.00 >+ if ( $currency_format =~ m/(^US)/ ) { >+ $format_params{'decimal_fill'} = '2'; >+ $format_params{'decimal_point'} = '.'; >+ $format_params{'mon_decimal_point'} = '.'; >+ $format_params{'thousands_sep'} = ','; >+ $format_params{'mon_thousands_sep'} = ','; >+ } >+ >+ # syspref CH: 360'000.00 >+ if ( $currency_format =~ m/(^CH)/ ) { >+ $format_params{'decimal_fill'} = '2'; >+ $format_params{'decimal_point'} = '.'; >+ $format_params{'mon_decimal_point'} = '.'; >+ $format_params{'thousands_sep'} = '\''; >+ $format_params{'mon_thousands_sep'} = '\''; > } > >- $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; > > return \%format_params; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >index b52b5a9..d719c19 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >@@ -27,11 +27,24 @@ Acquisitions: > branch: from staff member's library. > all: in system, regardless of owner. > - >- - Display currencies using the following format >+ - "Display currencies using the following format (¤ = symbol of active currency as defined in <a href='/cgi-bin/koha/admin/currency.pl'>Currency and exchange rates</a>.)" > - pref: CurrencyFormat > choices: >- US: 360,000.00 (US) >- FR: 360 000,00 (FR) >+ US: "360,000.00" >+ US_SYMB_LEAD_SPACE: ¤ 360,000.00 >+ US_SYMB_LEAD: ¤360,000.00 >+ US_SYMB_TRAIL_SPACE: 360,000.00 ¤ >+ US_SYMB_TRAIL: 360,000.00¤ >+ FR: "360 000,00" >+ FR_SYMB_LEAD_SPACE: ¤ 360 000,00 >+ FR_SYMB_LEAD: ¤360 000,00 >+ FR_SYMB_TRAIL_SPACE: 360 000,00 ¤ >+ FR_SYMB_TRAIL: 360 000,00¤ >+ CH: "360'000.00" >+ CH_SYMB_LEAD_SPACE: ¤ 360'000.00 >+ CH_SYMB_LEAD: ¤360'000.00 >+ CH_SYMB_TRAIL_SPACE: 360'000.00 ¤ >+ CH_SYMB_TRAIL: 360'000.00¤ > - > - Tax rates are > - pref: gist >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >index 1a200e6..37c0191 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -1,5 +1,6 @@ > [% USE Koha %] > [% USE KohaDates %] >+[% USE Price %] > > [% INCLUDE 'doc-head-open.inc' %] > <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your library home</title> >@@ -115,7 +116,7 @@ > [% IF ( OPACFinesTab ) %] > [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines ([% BORROWER_INF.amountoutstanding %])</a></li>[% END %] > [% IF ( BORROWER_INF.amountoverzero ) %]<li><a href="#opac-user-fines">Fines ([% BORROWER_INF.amountoutstanding %])</a></li>[% END %] >- [% IF ( BORROWER_INF.amountlessthanzero ) %]<li><a href="#opac-user-fines">Credits ([% BORROWER_INF.amountoutstanding %])</a></li>[% END %] >+ [% IF ( BORROWER_INF.amountlessthanzero ) %]<li><a href="#opac-user-fines">Credits ([% BORROWER_INF.amountoutstanding | $Price %])</a></li>[% END %] > [% END %] > [% IF ( waiting_count ) %][% IF ( BORROWER_INF.atdestination ) %]<li><a href="#opac-user-waiting">Waiting ([% waiting_count %])</a></li>[% END %][% END %] > [% IF ( reserves_count ) %]<li><a href="#opac-user-holds">Holds ([% reserves_count %])</a></li>[% END %] >@@ -324,7 +325,7 @@ > <thead><tr><th colspan="2">Amount</th></tr></thead> > <tbody> > <tr> >- <td>You have a credit of:</td><td><a href="/cgi-bin/koha/opac-account.pl">[% BORROWER_INF.amountoutstanding %]</a></td> >+ <td>You have a credit of:</td><td><a href="/cgi-bin/koha/opac-account.pl">[% BORROWER_INF.amountoutstanding | $Price %]</a></td> > </tr> > </tbody> > </table> >-- >1.7.10.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