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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-8 / +72 lines)
Lines 60-65 function moneyFormat(textObj) { Link Here
60
60
61
    textObj.value = dolAmount + "." + decAmount;
61
    textObj.value = dolAmount + "." + decAmount;
62
}
62
}
63
64
$(document).ready(function() {
65
    $('#payform, #woindivfine').preventDoubleFormSubmit();
66
});
63
//]]>
67
//]]>
64
</script>
68
</script>
65
</head>
69
</head>
Lines 93-104 function moneyFormat(textObj) { Link Here
93
    </li>
97
    </li>
94
</ul>
98
</ul>
95
<div class="tabs-container">
99
<div class="tabs-container">
96
[% IF ( error_over ) %]
100
[% IF (error_negative) %]
101
    <div id="error_message" class="dialog alert">
102
        <span>The amount paid can't be negative!</span>
103
    </div>
104
[% END %]
105
106
[% IF (error_collected_less) %]
97
    <div id="error_message" class="dialog alert">
107
    <div id="error_message" class="dialog alert">
98
    You must pay a value less than or equal to [% total_due | format('%.2f') %].
108
        <span>The amount collected can't be lower than the amount paid!</span>
99
    </div>
109
    </div>
100
[% END %]
110
[% END %]
101
111
112
[% UNLESS (writeoff_individual) %]
113
    <form name="payform" id="payform" action="/cgi-bin/koha/members/paycollect.pl" method="post">
114
[% END %]
115
116
[% IF (give_change) %]
117
    <div id="change_message" class="dialog message">
118
        <span>The amount collected is greater than the total amount paid.</span><br />
119
        <strong>Change to give back: [% give_change %]</strong><br /><br />
120
        <input type="submit" name="submitbutton" value="Confirm payment" />
121
        <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
122
     </div>
123
[% END %]
124
102
[% IF ( pay_individual ) %]
125
[% IF ( pay_individual ) %]
103
    <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
126
    <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
104
    <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
127
    <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
Lines 136-147 function moneyFormat(textObj) { Link Here
136
</table>
159
</table>
137
160
138
<ol>
161
<ol>
139
162
    [% IF ( give_change ) %]
163
    <li>
164
        <label for="paid">Amount paid:</label>
165
        <input type="hidden" name="paid" id="paid" value="[% amount_paid %]" />
166
        <input type="hidden" name="collected" id="collected" value="[% amount_paid %]" />
167
        [% amount_paid %]
168
    </li>
140
    <li>
169
    <li>
141
        <label for="paid">Collect from patron: </label>
170
        <label>Collect from patron:</label>
142
            <!-- default to paying all -->
171
        [% amount_collected %]
143
        <input name="paid" id="paid" value="[% amountoutstanding %]" />
144
    </li>
172
    </li>
173
    <li>
174
        <label>Change to give back:</label>
175
        [% give_change %]
176
    </li>
177
    [% ELSE %]
178
    <li>
179
        <label for="paid">Amount paid :</label>
180
        <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payform.paid)"/>
181
        [% amount_paid %]
182
    </li>
183
    <li>
184
        <label for="collected">Collect from patron:</label>
185
        <input name="collected" id="collected" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payform.collected)" />
186
    </li>
187
    [% END %]
145
</ol>
188
</ol>
146
</fieldset>
189
</fieldset>
147
190
Lines 204-214 function moneyFormat(textObj) { Link Here
204
            <span class="label">Total amount outstanding: </span>
247
            <span class="label">Total amount outstanding: </span>
205
            <span class="debit">[% total | format('%.2f') %]</span>
248
            <span class="debit">[% total | format('%.2f') %]</span>
206
        </li>
249
        </li>
250
    [% IF ( give_change ) %]
251
    <li>
252
        <label for="paid">Amount paid:</label>
253
        <input type="hidden" name="paid" id="paid" value="[% amount_paid %]" />
254
        [% amount_paid %]
255
    </li>
256
    <li>
257
        <label>Collected from patron:</label>
258
        <input type="hidden" name="collected" id="collected" value="[% amount_paid %]" />
259
        [% amount_collected %]
260
    </li>
261
    <li>
262
        <label>Change to give back:</label>
263
        [% give_change %]
264
    </li>
265
    [% ELSE %]
266
    <li>
267
        <label for="paid">Amount paid :</label>
268
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payform.paid)" />
269
    </li>
207
    <li>
270
    <li>
208
        <label for="paid">Collect from patron: </label>
271
        <label for="collected">Collect from patron:</label>
209
        <!-- default to paying all -->
272
        <!-- default to paying all -->
210
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" />
273
        <input name="collected" id="collected" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payform.collected)"/>
211
    </li>
274
    </li>
275
    [% END %]
212
    <li>
276
    <li>
213
        <label for="selected_accts_notes">Note: </label>
277
        <label for="selected_accts_notes">Note: </label>
214
        <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea>
278
        <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea>
(-)a/members/paycollect.pl (-7 / +25 lines)
Lines 65-70 my $branch = C4::Context->userenv->{'branch'}; Link Here
65
65
66
my ( $total_due, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber);
66
my ( $total_due, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber);
67
my $total_paid = $input->param('paid');
67
my $total_paid = $input->param('paid');
68
my $total_collected = $input->param('collected');
68
69
69
my $individual   = $input->param('pay_individual');
70
my $individual   = $input->param('pay_individual');
70
my $writeoff     = $input->param('writeoff_individual');
71
my $writeoff     = $input->param('writeoff_individual');
Lines 97-116 if ( $individual || $writeoff ) { Link Here
97
        individual_description => $description,
98
        individual_description => $description,
98
        payment_note    => $payment_note,
99
        payment_note    => $payment_note,
99
    );
100
    );
100
} elsif ($select_lines) {
101
} elsif ($select) {
101
    $total_due = $input->param('amt');
102
    $total_due = ($input->param('amt') || $input->param('total'));
102
    $template->param(
103
    $template->param(
103
        selected_accts => $select_lines,
104
        selected_accts => $select,
104
        amt            => $total_due,
105
        amt            => $total_due,
105
        selected_accts_notes => scalar $input->param('notes'),
106
        selected_accts_notes => scalar $input->param('notes'),
106
    );
107
    );
107
}
108
}
108
109
109
if ( $total_paid and $total_paid ne '0.00' ) {
110
if ( $total_paid and $total_paid ne '0.00' ) {
110
    if ( $total_paid < 0 or $total_paid > $total_due ) {
111
    if ( $total_paid < 0 ) {
111
        $template->param(
112
        $template->param(
112
            error_over => 1,
113
            error_negative => 1,
113
            total_due => $total_due
114
        );
115
    }
116
    elsif (($total_collected - $total_paid) < 0) {
117
        $template->param(
118
            error_collected_less => 1,
119
        );
120
    }
121
    elsif ($total_paid >=  $total_due and $total_collected ne $total_paid) {
122
        $template->param(
123
            amount_paid => sprintf('%.2f', $total_due),
124
            amount_collected => sprintf('%.2f', $total_collected),
125
            give_change => sprintf('%.2f',($total_collected-$total_due))
126
        );
127
    }
128
    elsif ($total_paid < $total_due and $total_collected ne $total_paid) {
129
         $template->param(
130
            amount_paid => sprintf('%.2f', $total_paid),
131
            amount_collected => sprintf('%.2f', $total_collected),
132
            give_change => sprintf('%.2f',($total_collected-$total_paid))
114
        );
133
        );
115
    } else {
134
    } else {
116
        die "Wrong CSRF token"
135
        die "Wrong CSRF token"
117
- 

Return to bug 11373