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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-17 / +71 lines)
Lines 5-17 Link Here
5
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
6
<script type= "text/javascript">
6
<script type= "text/javascript">
7
//<![CDATA[
7
//<![CDATA[
8
$(document).ready(function() {
9
    $('#payindivfine, #woindivfine, #payfine').preventDoubleFormSubmit();
10
});
11
//]]>
12
</script>
13
<script type= "text/javascript">
14
//<![CDATA[
15
function moneyFormat(textObj) {
8
function moneyFormat(textObj) {
16
    var newValue = textObj.value;
9
    var newValue = textObj.value;
17
    var decAmount = "";
10
    var decAmount = "";
Lines 60-65 function moneyFormat(textObj) { Link Here
60
53
61
    textObj.value = dolAmount + "." + decAmount;
54
    textObj.value = dolAmount + "." + decAmount;
62
}
55
}
56
57
$(document).ready(function() {
58
    $('#payform, #woindivfine').preventDoubleFormSubmit();
59
});
63
//]]>
60
//]]>
64
</script>
61
</script>
65
</head>
62
</head>
Lines 93-106 function moneyFormat(textObj) { Link Here
93
    </li>
90
    </li>
94
</ul>
91
</ul>
95
<div class="tabs-container">
92
<div class="tabs-container">
96
[% IF ( error_over ) %]
93
[% IF (error_negative) %]
97
    <div id="error_message" class="dialog alert">
94
    <div id="error_message" class="dialog alert">
98
    You must pay a value less than or equal to [% total_due | format('%.2f') %].
95
        <span>The amount paid can't be negative!</span>
99
    </div>
96
    </div>
100
[% END %]
97
[% END %]
101
98
99
[% IF (error_collected_less) %]
100
    <div id="error_message" class="dialog alert">
101
        <span>The amount collected can't be lower than the amount paid!</span>
102
    </div>
103
[% END %]
104
105
[% UNLESS (writeoff_individual) %]
106
    <form name="payform" id="payform" action="/cgi-bin/koha/members/paycollect.pl" method="post">
107
[% END %]
108
109
[% IF (give_change) %]
110
    <div id="change_message" class="dialog message">
111
        <span>The amount collected is greater than the total amount paid.</span><br />
112
        <strong>Change to give back: [% give_change %]</strong><br /><br />
113
        <input type="submit" name="submitbutton" value="Confirm payment" />
114
        <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
115
     </div>
116
[% END %]
117
102
[% IF ( pay_individual ) %]
118
[% IF ( pay_individual ) %]
103
    <form name="payindivfine" id="payindivfine" onsubmit="return validatePayment(this);" method="post" action="/cgi-bin/koha/members/paycollect.pl">
104
    <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
119
    <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
105
    <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" />
120
    <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" />
106
    <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber %]" />
121
    <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber %]" />
Lines 142-153 function moneyFormat(textObj) { Link Here
142
</table>
157
</table>
143
158
144
<ol>
159
<ol>
145
160
    [% IF ( give_change ) %]
146
    <li>
161
    <li>
147
        <label for="paid">Collect from patron: </label>
162
        <label for="paid">Amount paid:</label>
148
            <!-- default to paying all -->
163
        <input type="hidden" name="paid" id="paid" value="[% amount_paid %]" />
149
        <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payindivfine.paid)"/>
164
        <input type="hidden" name="collected" id="collected" value="[% amount_paid %]" />
165
        [% amount_paid %]
150
    </li>
166
    </li>
167
    <li>
168
        <label>Collect from patron:</label>
169
        [% amount_collected %]
170
    </li>
171
    <li>
172
        <label>Change to give back:</label>
173
        [% give_change %]
174
    </li>
175
    [% ELSE %]
176
    <li>
177
        <label for="paid">Amount paid :</label>
178
        <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payform.paid)"/>
179
        [% amount_paid %]
180
    </li>
181
    <li>
182
        <label for="collected">Collect from patron:</label>
183
        <input name="collected" id="collected" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payform.collected)" />
184
    </li>
185
    [% END %]
151
</ol>
186
</ol>
152
</fieldset>
187
</fieldset>
153
188
Lines 196-202 function moneyFormat(textObj) { Link Here
196
    </form>
231
    </form>
197
[% ELSE %]
232
[% ELSE %]
198
233
199
    <form name="payfine" id="payfine" onsubmit="return validatePayment(this);" method="post" action="/cgi-bin/koha/members/paycollect.pl">
200
    <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
234
    <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
201
    <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts %]" />
235
    <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts %]" />
202
    <input type="hidden" name="total" id="total" value="[% total %]" />
236
    <input type="hidden" name="total" id="total" value="[% total %]" />
Lines 208-218 function moneyFormat(textObj) { Link Here
208
            <span class="label">Total amount outstanding: </span>
242
            <span class="label">Total amount outstanding: </span>
209
            <span class="debit">[% total | format('%.2f') %]</span>
243
            <span class="debit">[% total | format('%.2f') %]</span>
210
        </li>
244
        </li>
245
    [% IF ( give_change ) %]
246
    <li>
247
        <label for="paid">Amount paid:</label>
248
        <!-- default to paying all -->
249
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payform.paid)"/>
250
    </li>
251
    <li>
252
        <label>Collect from patron:</label>
253
        [% amount_collected %]
254
    </li>
255
    <li>
256
        <label>Change to give back:</label>
257
        [% give_change %]
258
    </li>
259
    [% ELSE %]
260
    <li>
261
        <label for="paid">Amount paid :</label>
262
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payform.paid)" />
263
    </li>
211
    <li>
264
    <li>
212
        <label for="paid">Collect from patron: </label>
265
        <label for="collected">Collect from patron:</label>
213
        <!-- default to paying all -->
266
        <!-- default to paying all -->
214
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payfine.paid)"/>
267
        <input name="collected" id="collected" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payform.collected)"/>
215
    </li>
268
    </li>
269
    [% END %]
216
    <li>
270
    <li>
217
        <label for="selected_accts_notes">Note: </label>
271
        <label for="selected_accts_notes">Note: </label>
218
        <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea>
272
        <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea>
(-)a/members/paycollect.pl (-9 / +26 lines)
Lines 55-65 my $branch = C4::Context->userenv->{'branch'}; Link Here
55
55
56
my ( $total_due, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber);
56
my ( $total_due, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber);
57
my $total_paid = $input->param('paid');
57
my $total_paid = $input->param('paid');
58
my $total_collected = $input->param('collected');
58
59
59
my $individual   = $input->param('pay_individual');
60
my $individual   = $input->param('pay_individual');
60
my $writeoff     = $input->param('writeoff_individual');
61
my $writeoff     = $input->param('writeoff_individual');
61
my $select_lines = $input->param('selected');
62
my $select       = ($input->param('selected') || $input->param('selected_accts'));
62
my $select       = $input->param('selected_accts');
63
my $payment_note = uri_unescape $input->param('payment_note');
63
my $payment_note = uri_unescape $input->param('payment_note');
64
my $accountno;
64
my $accountno;
65
my $accountlines_id;
65
my $accountlines_id;
Lines 94-113 if ( $individual || $writeoff ) { Link Here
94
        notify_level      => $notify_level,
94
        notify_level      => $notify_level,
95
        payment_note    => $payment_note,
95
        payment_note    => $payment_note,
96
    );
96
    );
97
} elsif ($select_lines) {
97
} elsif ($select) {
98
    $total_due = $input->param('amt');
98
    $total_due = ($input->param('amt') || $input->param('total'));
99
    $template->param(
99
    $template->param(
100
        selected_accts => $select_lines,
100
        selected_accts => $select,
101
        amt            => $total_due,
101
        amt            => $total_due,
102
        selected_accts_notes => scalar $input->param('notes'),
102
        selected_accts_notes => scalar $input->param('notes'),
103
    );
103
    );
104
}
104
}
105
105
106
if ( $total_paid and $total_paid ne '0.00' ) {
106
if ( $total_paid and $total_paid ne '0.00' ) {
107
    if ( $total_paid < 0 or $total_paid > $total_due ) {
107
    if ( $total_paid < 0 ) {
108
        $template->param(
108
        $template->param(
109
            error_over => 1,
109
            error_negative => 1,
110
            total_due => $total_due
110
        );
111
    }
112
    elsif (($total_collected - $total_paid) < 0) {
113
        $template->param(
114
            error_collected_less => 1,
115
        );
116
    }
117
    elsif ($total_paid > $total_due) {
118
        $template->param(
119
            amount_paid => sprintf('%.2f', $total_due),
120
            amount_collected => sprintf('%.2f', $total_collected),
121
            give_change => sprintf('%.2f',($total_collected-$total_due))
122
        );
123
    }
124
    elsif ($total_paid < $total_due and $total_collected ne $total_paid) {
125
         $template->param(
126
            amount_paid => sprintf('%.2f', $total_paid),
127
            amount_collected => sprintf('%.2f', $total_collected),
128
            give_change => sprintf('%.2f',($total_collected-$total_paid))
111
        );
129
        );
112
    } else {
130
    } else {
113
        if ($individual) {
131
        if ($individual) {
114
- 

Return to bug 11373