@@ -, +, @@
format syspref
---
Koha/Number/Price.pm | 18 ++++++++++++++++++
.../prog/en/modules/members/maninvoice.tt | 5 ++---
.../prog/en/modules/members/paycollect.tt | 8 ++++----
members/maninvoice.pl | 1 +
members/pay.pl | 3 +++
members/paycollect.pl | 8 +++++---
6 files changed, 33 insertions(+), 10 deletions(-)
--- a/Koha/Number/Price.pm
+++ a/Koha/Number/Price.pm
@@ -53,6 +53,8 @@ sub format_for_editing {
return unless defined $self->value;
my $format_params = $self->_format_params( $params );
+ my $currency_format = C4::Context->preference("CurrencyFormat");
+
$format_params = {
%$format_params,
int_curr_symbol => '',
@@ -60,6 +62,22 @@ sub format_for_editing {
mon_decimal_point => '.',
};
+ if ( $currency_format eq 'FR' ) {
+ %$format_params = (
+ int_curr_symbol => '',
+ mon_thousands_sep => ' ',
+ mon_decimal_point => ','
+ );
+ }
+
+ if ( $currency_format eq 'CH' ) {
+ %$format_params = (
+ int_curr_symbol => '',
+ mon_thousands_sep => '\'',
+ mon_decimal_point => '.'
+ );
+ }
+
# To avoid the system to crash, we will not format big number
# We divide per 100 because we want to keep the default DECIMAL_DIGITS (2)
# error - round() overflow. Try smaller precision or use Math::BigFloat
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt
@@ -94,9 +94,8 @@
-
-
- 5[% decimal_delimiter | html %]12
+
+ 5[% decimal_delimiter | html %]12
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt
@@ -175,11 +175,11 @@
-
+
-
+
@@ -328,12 +328,12 @@
[% ELSE %]
[% END %]
-
+
[% IF type != 'WRITEOFF' %]
-
+
--- a/members/maninvoice.pl
+++ a/members/maninvoice.pl
@@ -80,6 +80,7 @@ output_and_exit_if_error(
my $library_id = C4::Context->userenv->{'branch'};
my $desc = $input->param('desc');
my $amount = $input->param('amount');
+$amount = Koha::Number::Price->new( $amount )->format();
my $note = $input->param('note');
my $debit_type = $input->param('type');
my $barcode = $input->param('barcode');
--- a/members/pay.pl
+++ a/members/pay.pl
@@ -43,6 +43,7 @@ use Koha::Items;
use Koha::Patron::Categories;
use URI::Escape qw( uri_escape_utf8 uri_unescape );
+use Koha::Number::Price;
our $input = CGI->new;
@@ -100,6 +101,8 @@ elsif ( $input->param('confirm_writeoff') ) {
my $accountline = Koha::Account::Lines->find( $accountlines_id );
+ $amount = Koha::Number::Price->new( $amount )->unformat();
+
$amount = $accountline->amountoutstanding if (abs($amount - $accountline->amountoutstanding) < 0.01) && C4::Context->preference('RoundFinesAtPayment');
if ( $amount > $accountline->amountoutstanding ) {
print $input->redirect( "/cgi-bin/koha/members/paycollect.pl?"
--- a/members/paycollect.pl
+++ a/members/paycollect.pl
@@ -37,6 +37,7 @@ use Koha::AdditionalFields;
use Koha::Token;
use Koha::DateUtils qw( output_pref );
use Koha::Number::Price;
+use Number::Format qw( unformat_number );
my $input = CGI->new();
@@ -137,6 +138,8 @@ if ( $selected_accts ) {
$total_due = $sum->_resultset->first->get_column('total_amountoutstanding');
}
+$total_paid = Koha::Number::Price->new( $total_paid )->unformat();
+
if ( $total_paid and $total_paid ne '0.00' ) {
$total_paid = $total_due if (abs($total_paid - $total_due) < 0.01) && C4::Context->preference('RoundFinesAtPayment');
if ( $total_paid < 0 or $total_paid > $total_due ) {
@@ -273,11 +276,10 @@ if ( $total_paid and $total_paid ne '0.00' ) {
}
if ( $input->param('error_over') ) {
- $template->param( error_over => 1, total_due => scalar $input->param('amountoutstanding') );
+ my $amountoutstanding = Koha::Number::Price->new($input->param('amountoutstanding'))->format();
+ $template->param( error_over => 1, total_due => scalar $amountoutstanding );
}
-$total_due = Koha::Number::Price->new( $total_due )->format({mon_decimal_point => '-'});
-
$template->param(
payment_id => $payment_id,
--