[Koha-bugs] [Bug 4078] Display active currency symbol on currency output and input

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Mar 6 11:10:01 CET 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=4078

--- Comment #4 from Marc Véron <veron at veron.ch> ---
I propose to expand this functionality to the formatting of currency values as
well.

Up to now, formatting is handled via the preference "CurrencyFormat". User can
choose between 360,000.00 (US) and 360 000,00 (FR). The preference is evaluated
in a hard coded way in several .pl and .pm files as
acqui-home.pl
aqbudgetperiods.pl
layout2pages.pm
aqplan.pl
aqbudgetperiods.pl
layout3pages.pm
layout2pages.pm
(maybe more)

The code reads:
---Snip---
my $cur_format = C4::Context->preference("CurrencyFormat");
my $num;

if ( $cur_format eq 'US' ) {
    $num = new Number::Format(
        'int_curr_symbol'   => '',
        'mon_thousands_sep' => ',',
        'mon_decimal_point' => '.'
    );
} elsif ( $cur_format eq 'FR' ) {
    $num = new Number::Format(
        'decimal_fill'      => '2',
        'decimal_point'     => ',',
        'int_curr_symbol'   => '',
        'mon_thousands_sep' => ' ',
        'thousands_sep'     => ' ',
        'mon_decimal_point' => ','
    );
}
---Snip---


To make things more configurable I propose to do the following:

1) 
Expand table currency (http://schema.koha-community.org/tables/currency.html)
with an additional column "format"

This column could be pre-filled by system_preferences.sql, and it should be
editable (/admin/currency.pl). 
Maybe some input validation is necessary to get well formed strings.

2)
Remove preference "CurrencyFormat" (not longer used)

3)
The sub GetCurrency()(located in Budgets.pm) will return the currency format
string along with the currency symbol. No chnges needed (Select *....)

Use GetCurrency()->{format} in sub filter and format the number as appropriate.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list