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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt (+6 lines)
Lines 66-71 function enableCheckboxActions(){ Link Here
66
	<li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% borrower.borrowernumber %]" >Create manual credit</a></li>
66
	<li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% borrower.borrowernumber %]" >Create manual credit</a></li>
67
</ul>
67
</ul>
68
<div class="tabs-container">
68
<div class="tabs-container">
69
    [% IF ( error_over ) %]
70
        <div id="error_message" class="dialog alert">
71
          The writeoff submitted was more than the value of the fee being written off.
72
          The amount of the writeoff has been reduced from [% error_amount | format('%.2f') %] to [% error_amount_outstanding | format('%.2f') %].
73
        </div>
74
    [% END %]
69
75
70
[% IF ( accounts ) %]
76
[% IF ( accounts ) %]
71
    <form action="/cgi-bin/koha/members/pay.pl" method="post" id="pay-fines-form">
77
    <form action="/cgi-bin/koha/members/pay.pl" method="post" id="pay-fines-form">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-2 / +22 lines)
Lines 6-15 Link Here
6
<script type= "text/javascript">
6
<script type= "text/javascript">
7
//<![CDATA[
7
//<![CDATA[
8
$(document).ready(function() {
8
$(document).ready(function() {
9
    $('#payindivfine, #woindivfine, #payfine').preventDoubleFormSubmit();
9
    $('#payindivfine, #payfine').preventDoubleFormSubmit();
10
    $("#paid").on("change",function(){
10
    $("#paid").on("change",function(){
11
        moneyFormat( this );
11
        moneyFormat( this );
12
    });
12
    });
13
14
    prevent_default = 1;
15
    $('#woindivfine').on('submit', function(e){
16
        if ( prevent_default ) {
17
            e.preventDefault();
18
19
            let amount_outstanding = $('#amountoutstanding').attr('value');
20
            let amount_writeoff = $('#amountwrittenoff').attr('value');;
21
            if ( amount_writeoff > amount_outstanding ) {
22
                alert(_("You are attemping to writeoff more than the value of the fee."));
23
                $('#woindivfine').beenSubmitted = false;
24
            } else {
25
                prevent_default = 0;
26
                $('#woindivfine').preventDoubleFormSubmit();
27
                $('#woindivfine').submit();
28
            }
29
        }
30
    });
13
});
31
});
14
32
15
function moneyFormat(textObj) {
33
function moneyFormat(textObj) {
Lines 162-167 function moneyFormat(textObj) { Link Here
162
    <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id %]" />
180
    <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id %]" />
163
    <input type="hidden" name="title" id="title" value="[% title %]" />
181
    <input type="hidden" name="title" id="title" value="[% title %]" />
164
    <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note %]" />
182
    <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note %]" />
183
    <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" />
165
    <table>
184
    <table>
166
    <thead><tr>
185
    <thead><tr>
167
            <th>Description</th>
186
            <th>Description</th>
Lines 186-192 function moneyFormat(textObj) { Link Here
186
                </li>
205
                </li>
187
            </ol>
206
            </ol>
188
        </fieldset>
207
        </fieldset>
189
        <div class="action"><input type="submit" name="confirm_writeoff" id="confirm_writeoff" value="Write off this charge" />
208
        <input type="hidden" name="confirm_writeoff" value="1" />
209
        <div class="action"><input type="submit" value="Write off this charge" />
190
        <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a></div>
210
        <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a></div>
191
    </form>
211
    </form>
192
[% ELSE %]
212
[% ELSE %]
(-)a/members/pay.pl (-1 / +10 lines)
Lines 98-105 if ($writeoff_all) { Link Here
98
} elsif ($writeoff_item) {
98
} elsif ($writeoff_item) {
99
    my $accountlines_id = $input->param('accountlines_id');
99
    my $accountlines_id = $input->param('accountlines_id');
100
    my $amount       = $input->param('amountwrittenoff');
100
    my $amount       = $input->param('amountwrittenoff');
101
    my $amount_outstanding = $input->param('amountoutstanding');
101
    my $payment_note = $input->param("payment_note");
102
    my $payment_note = $input->param("payment_note");
102
103
104
    if ( $amount > $amount_outstanding ) {
105
        $template->param(
106
            error_over => 1,
107
            error_amount => $amount,
108
            error_amount_outstanding => $amount_outstanding,
109
        );
110
        $amount = $amount_outstanding;
111
    }
112
103
    Koha::Account->new( { patron_id => $borrowernumber } )->pay(
113
    Koha::Account->new( { patron_id => $borrowernumber } )->pay(
104
        {
114
        {
105
            amount     => $amount,
115
            amount     => $amount,
106
- 

Return to bug 20120