View | Details | Raw Unified | Return to bug 21507
Collapse All | Expand All

(-)a/Koha/Number/Price.pm (+18 lines)
Lines 53-58 sub format_for_editing { Link Here
53
    return unless defined $self->value;
53
    return unless defined $self->value;
54
54
55
    my $format_params = $self->_format_params( $params );
55
    my $format_params = $self->_format_params( $params );
56
    my $currency_format = C4::Context->preference("CurrencyFormat");
57
56
    $format_params = {
58
    $format_params = {
57
        %$format_params,
59
        %$format_params,
58
        int_curr_symbol   => '',
60
        int_curr_symbol   => '',
Lines 60-65 sub format_for_editing { Link Here
60
        mon_decimal_point => '.',
62
        mon_decimal_point => '.',
61
    };
63
    };
62
64
65
    if ( $currency_format eq 'FR' ) {
66
        %$format_params = (
67
            int_curr_symbol   => '',
68
            mon_thousands_sep => ' ',
69
            mon_decimal_point => ','
70
        );
71
    }
72
73
    if ( $currency_format eq 'CH' ) {
74
        %$format_params = (
75
            int_curr_symbol   => '',
76
            mon_thousands_sep => '\'',
77
            mon_decimal_point => '.'
78
        );
79
    }
80
63
    # To avoid the system to crash, we will not format big number
81
    # To avoid the system to crash, we will not format big number
64
    # We divide per 100 because we want to keep the default DECIMAL_DIGITS (2)
82
    # We divide per 100 because we want to keep the default DECIMAL_DIGITS (2)
65
    # error - round() overflow. Try smaller precision or use Math::BigFloat
83
    # error - round() overflow. Try smaller precision or use Math::BigFloat
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt (-3 / +2 lines)
Lines 94-102 Link Here
94
                            </li>
94
                            </li>
95
                            <li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" value="[% barcode | html %]" /></li>
95
                            <li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" value="[% barcode | html %]" /></li>
96
                            <li><label for="desc">Description: </label><input type="text" name="desc" id="desc" size="50" value="[% desc | html %]" /></li>
96
                            <li><label for="desc">Description: </label><input type="text" name="desc" id="desc" size="50" value="[% desc | html %]" /></li>
97
                            <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" value="[% note | html %]" /></li>
97
                            <li><label for="note">Note: </label><input type="text" name="note" size="50" id="note" value="[% note | html %]" /></li>    
98
                            
98
                            <li><label for="amount">Amount: </label><input type="text" inputmode="decimal" pattern=[% decimal_input_pattern %] name="amount" id="amount" required="required" value="[% amount | $Price on_editing => 1 %]" /> 5[% decimal_delimiter | html %]12</li>
99
                                <li><label for="amount">Amount: </label><input type="text" inputmode="decimal" pattern=[% decimal_input_pattern %] name="amount" id="amount" required="required" value="[% amount | $Price on_editing => 1 %]" /> 5[% decimal_delimiter | html %]12</li>
100
                        </ol>
99
                        </ol>
101
                    </fieldset>
100
                    </fieldset>
102
101
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-4 / +4 lines)
Lines 175-185 Link Here
175
175
176
    <li>
176
    <li>
177
        <label for="paid">Amount being paid: </label>
177
        <label for="paid">Amount being paid: </label>
178
        <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
178
        <input name="paid" id="paid" type="text" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
179
    </li>
179
    </li>
180
    <li>
180
    <li>
181
        <label for="collected">Amount tendered: </label>
181
        <label for="collected">Amount tendered: </label>
182
        <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
182
        <input name="collected" id="collected" type="text" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
183
    </li>
183
    </li>
184
    <li>
184
    <li>
185
        <label>Change to give: </label>
185
        <label>Change to give: </label>
Lines 328-339 Link Here
328
        [% ELSE %]
328
        [% ELSE %]
329
            <label for="paid">Amount being paid: </label>
329
            <label for="paid">Amount being paid: </label>
330
        [% END %]
330
        [% END %]
331
        <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
331
        <input name="paid" id="paid" type="text" value="[% total | $Price on_editing => 1 %]"/>
332
    </li>
332
    </li>
333
    [% IF type != 'WRITEOFF' %]
333
    [% IF type != 'WRITEOFF' %]
334
        <li>
334
        <li>
335
            <label for="collected">Amount tendered: </label>
335
            <label for="collected">Amount tendered: </label>
336
            <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
336
            <input name="collected" id="collected" type="text" value="[% total | $Price on_editing => 1 %]"/>
337
        </li>
337
        </li>
338
        <li>
338
        <li>
339
            <label>Change to give: </label>
339
            <label>Change to give: </label>
(-)a/members/maninvoice.pl (+1 lines)
Lines 80-85 output_and_exit_if_error( Link Here
80
my $library_id = C4::Context->userenv->{'branch'};
80
my $library_id = C4::Context->userenv->{'branch'};
81
my $desc       = $input->param('desc');
81
my $desc       = $input->param('desc');
82
my $amount     = $input->param('amount');
82
my $amount     = $input->param('amount');
83
$amount = Koha::Number::Price->new( $amount )->format();
83
my $note       = $input->param('note');
84
my $note       = $input->param('note');
84
my $debit_type = $input->param('type');
85
my $debit_type = $input->param('type');
85
my $barcode    = $input->param('barcode');
86
my $barcode    = $input->param('barcode');
(-)a/members/pay.pl (+3 lines)
Lines 43-48 use Koha::Items; Link Here
43
43
44
use Koha::Patron::Categories;
44
use Koha::Patron::Categories;
45
use URI::Escape qw( uri_escape_utf8 uri_unescape );
45
use URI::Escape qw( uri_escape_utf8 uri_unescape );
46
use Koha::Number::Price;
46
47
47
our $input = CGI->new;
48
our $input = CGI->new;
48
49
Lines 100-105 elsif ( $input->param('confirm_writeoff') ) { Link Here
100
101
101
    my $accountline = Koha::Account::Lines->find( $accountlines_id );
102
    my $accountline = Koha::Account::Lines->find( $accountlines_id );
102
103
104
    $amount  = Koha::Number::Price->new( $amount )->unformat();
105
103
    $amount = $accountline->amountoutstanding if (abs($amount - $accountline->amountoutstanding) < 0.01) && C4::Context->preference('RoundFinesAtPayment');
106
    $amount = $accountline->amountoutstanding if (abs($amount - $accountline->amountoutstanding) < 0.01) && C4::Context->preference('RoundFinesAtPayment');
104
    if ( $amount > $accountline->amountoutstanding ) {
107
    if ( $amount > $accountline->amountoutstanding ) {
105
        print $input->redirect( "/cgi-bin/koha/members/paycollect.pl?"
108
        print $input->redirect( "/cgi-bin/koha/members/paycollect.pl?"
(-)a/members/paycollect.pl (-4 / +5 lines)
Lines 37-42 use Koha::AdditionalFields; Link Here
37
use Koha::Token;
37
use Koha::Token;
38
use Koha::DateUtils qw( output_pref );
38
use Koha::DateUtils qw( output_pref );
39
use Koha::Number::Price;
39
use Koha::Number::Price;
40
use Number::Format qw( unformat_number );
40
41
41
my $input = CGI->new();
42
my $input = CGI->new();
42
43
Lines 137-142 if ( $selected_accts ) { Link Here
137
    $total_due = $sum->_resultset->first->get_column('total_amountoutstanding');
138
    $total_due = $sum->_resultset->first->get_column('total_amountoutstanding');
138
}
139
}
139
140
141
$total_paid  = Koha::Number::Price->new( $total_paid )->unformat();
142
140
if ( $total_paid and $total_paid ne '0.00' ) {
143
if ( $total_paid and $total_paid ne '0.00' ) {
141
    $total_paid = $total_due if (abs($total_paid - $total_due) < 0.01) && C4::Context->preference('RoundFinesAtPayment');
144
    $total_paid = $total_due if (abs($total_paid - $total_due) < 0.01) && C4::Context->preference('RoundFinesAtPayment');
142
    if ( $total_paid < 0 or $total_paid > $total_due ) {
145
    if ( $total_paid < 0 or $total_paid > $total_due ) {
Lines 273-283 if ( $total_paid and $total_paid ne '0.00' ) { Link Here
273
}
276
}
274
277
275
if ( $input->param('error_over') ) {
278
if ( $input->param('error_over') ) {
276
    $template->param( error_over => 1, total_due => scalar $input->param('amountoutstanding') );
279
    my $amountoutstanding = Koha::Number::Price->new($input->param('amountoutstanding'))->format();
280
    $template->param( error_over => 1, total_due => scalar $amountoutstanding );
277
}
281
}
278
282
279
$total_due = Koha::Number::Price->new( $total_due )->format({mon_decimal_point => '-'});
280
281
$template->param(
283
$template->param(
282
    payment_id => $payment_id,
284
    payment_id => $payment_id,
283
285
284
- 

Return to bug 21507