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="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
127
    <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
Lines 141-152 function moneyFormat(textObj) { Link Here
141
</table>
164
</table>
142
165
143
<ol>
166
<ol>
144
167
    [% IF ( give_change ) %]
168
    <li>
169
        <label for="paid">Amount paid:</label>
170
        <input type="hidden" name="paid" id="paid" value="[% amount_paid %]" />
171
        <input type="hidden" name="collected" id="collected" value="[% amount_paid %]" />
172
        [% amount_paid %]
173
    </li>
145
    <li>
174
    <li>
146
        <label for="paid">Collect from patron: </label>
175
        <label>Collect from patron:</label>
147
            <!-- default to paying all -->
176
        [% amount_collected %]
148
        <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" />
149
    </li>
177
    </li>
178
    <li>
179
        <label>Change to give back:</label>
180
        [% give_change %]
181
    </li>
182
    [% ELSE %]
183
    <li>
184
        <label for="paid">Amount paid :</label>
185
        <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payform.paid)"/>
186
        [% amount_paid %]
187
    </li>
188
    <li>
189
        <label for="collected">Collect from patron:</label>
190
        <input name="collected" id="collected" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payform.collected)" />
191
    </li>
192
    [% END %]
150
</ol>
193
</ol>
151
</fieldset>
194
</fieldset>
152
195
Lines 206-216 function moneyFormat(textObj) { Link Here
206
            <span class="label">Total amount outstanding: </span>
249
            <span class="label">Total amount outstanding: </span>
207
            <span class="debit">[% total | format('%.2f') %]</span>
250
            <span class="debit">[% total | format('%.2f') %]</span>
208
        </li>
251
        </li>
252
    [% IF ( give_change ) %]
253
    <li>
254
        <label for="paid">Amount paid:</label>
255
        <input type="hidden" name="paid" id="paid" value="[% amount_paid %]" />
256
        [% amount_paid %]
257
    </li>
258
    <li>
259
        <label>Collected from patron:</label>
260
        <input type="hidden" name="collected" id="collected" value="[% amount_paid %]" />
261
        [% amount_collected %]
262
    </li>
263
    <li>
264
        <label>Change to give back:</label>
265
        [% give_change %]
266
    </li>
267
    [% ELSE %]
268
    <li>
269
        <label for="paid">Amount paid :</label>
270
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payform.paid)" />
271
    </li>
209
    <li>
272
    <li>
210
        <label for="paid">Collect from patron: </label>
273
        <label for="collected">Collect from patron:</label>
211
        <!-- default to paying all -->
274
        <!-- default to paying all -->
212
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" />
275
        <input name="collected" id="collected" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payform.collected)"/>
213
    </li>
276
    </li>
277
    [% END %]
214
    <li>
278
    <li>
215
        <label for="selected_accts_notes">Note: </label>
279
        <label for="selected_accts_notes">Note: </label>
216
        <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea>
280
        <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea>
(-)a/members/paycollect.pl (-7 / +25 lines)
Lines 64-69 my $branch = C4::Context->userenv->{'branch'}; Link Here
64
64
65
my ( $total_due, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber);
65
my ( $total_due, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber);
66
my $total_paid = $input->param('paid');
66
my $total_paid = $input->param('paid');
67
my $total_collected = $input->param('collected');
67
68
68
my $individual   = $input->param('pay_individual');
69
my $individual   = $input->param('pay_individual');
69
my $writeoff     = $input->param('writeoff_individual');
70
my $writeoff     = $input->param('writeoff_individual');
Lines 100-119 if ( $individual || $writeoff ) { Link Here
100
        notify_level      => $notify_level,
101
        notify_level      => $notify_level,
101
        payment_note    => $payment_note,
102
        payment_note    => $payment_note,
102
    );
103
    );
103
} elsif ($select_lines) {
104
} elsif ($select) {
104
    $total_due = $input->param('amt');
105
    $total_due = ($input->param('amt') || $input->param('total'));
105
    $template->param(
106
    $template->param(
106
        selected_accts => $select_lines,
107
        selected_accts => $select,
107
        amt            => $total_due,
108
        amt            => $total_due,
108
        selected_accts_notes => scalar $input->param('notes'),
109
        selected_accts_notes => scalar $input->param('notes'),
109
    );
110
    );
110
}
111
}
111
112
112
if ( $total_paid and $total_paid ne '0.00' ) {
113
if ( $total_paid and $total_paid ne '0.00' ) {
113
    if ( $total_paid < 0 or $total_paid > $total_due ) {
114
    if ( $total_paid < 0 ) {
114
        $template->param(
115
        $template->param(
115
            error_over => 1,
116
            error_negative => 1,
116
            total_due => $total_due
117
        );
118
    }
119
    elsif (($total_collected - $total_paid) < 0) {
120
        $template->param(
121
            error_collected_less => 1,
122
        );
123
    }
124
    elsif ($total_paid >=  $total_due and $total_collected ne $total_paid) {
125
        $template->param(
126
            amount_paid => sprintf('%.2f', $total_due),
127
            amount_collected => sprintf('%.2f', $total_collected),
128
            give_change => sprintf('%.2f',($total_collected-$total_due))
129
        );
130
    }
131
    elsif ($total_paid < $total_due and $total_collected ne $total_paid) {
132
         $template->param(
133
            amount_paid => sprintf('%.2f', $total_paid),
134
            amount_collected => sprintf('%.2f', $total_collected),
135
            give_change => sprintf('%.2f',($total_collected-$total_paid))
117
        );
136
        );
118
    } else {
137
    } else {
119
        if ($individual) {
138
        if ($individual) {
120
- 

Return to bug 11373