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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-17 / +78 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Koha %]
3
[% USE Koha %]
4
[% USE Price %]
4
[% USE Branches %]
5
[% USE Branches %]
5
[% USE AuthorisedValues %]
6
[% USE AuthorisedValues %]
6
[% USE Price %]
7
[% USE Price %]
Lines 54-65 Link Here
54
    </li>
55
    </li>
55
</ul>
56
</ul>
56
<div class="tabs-container">
57
<div class="tabs-container">
57
[% IF ( error_over ) %]
58
[% IF (error_negative) %]
59
    <div id="error_message" class="dialog alert">
60
        The amount paid can't be negative.
61
    </div>
62
[% END %]
63
64
[% IF (error_collected_less) %]
58
    <div id="error_message" class="dialog alert">
65
    <div id="error_message" class="dialog alert">
59
    You must pay a value less than or equal to [% total_due | format('%.2f') %].
66
        The amount collected can't be lower than the amount paid.
60
    </div>
67
    </div>
61
[% END %]
68
[% END %]
62
69
70
[% UNLESS (writeoff_individual) %]
71
    <form name="payform" id="payform" action="/cgi-bin/koha/members/paycollect.pl" method="post">
72
[% END %]
73
74
[% IF (give_change) %]
75
    <div id="change_message" class="dialog message">
76
        <span>The amount collected is greater than the total amount paid.</span><br />
77
        <strong>Change to give back: [% give_change %]</strong><br /><br />
78
        <input type="submit" name="submitbutton" value="Confirm payment" />
79
        <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
80
     </div>
81
[% END %]
82
63
[% IF ( pay_individual ) %]
83
[% IF ( pay_individual ) %]
64
    <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
84
    <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
65
    <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
85
    <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
Lines 84-107 Link Here
84
            <th>Amount outstanding</th>
104
            <th>Amount outstanding</th>
85
        </tr></thead>
105
        </tr></thead>
86
    <tfoot>
106
    <tfoot>
87
        <td colspan="3">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td>
107
        <td colspan="3">Total amount payable:</td><td>[% amountoutstanding | $Price %]</td>
88
    </tfoot>
108
    </tfoot>
89
    <tbody><tr>
109
    <tbody><tr>
90
            <td>
110
            <td>
91
                [% individual_description | html %]
111
                [% individual_description | html %]
92
            </td>
112
            </td>
93
            <td>[% accounttype | html %]</td>
113
            <td>[% accounttype | html %]</td>
94
            <td class="debit">[% amount | format('%.2f') %]</td>
114
            <td class="debit">[% amount | $Price %]</td>
95
            <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
115
            <td class="debit">[% amountoutstanding | $Price %]</td>
96
        </tr></tbody>
116
        </tr></tbody>
97
</table>
117
</table>
98
118
99
<ol>
119
<ol>
100
120
    [% IF ( give_change ) %]
121
    <li>
122
        <label for="paid">Amount paid:</label>
123
        <input type="hidden" name="paid" id="paid" value="[% amount_paid %]" />
124
        <input type="hidden" name="collected" id="collected" value="[% amount_paid %]" />
125
        [% amount_paid | $Price %]
126
    </li>
127
    <li>
128
        <label>Collect from patron:</label>
129
        [% amount_collected | $Price %]
130
    </li>
131
    <li>
132
        <label>Change to give back:</label>
133
        [% give_change | $Price %]
134
    </li>
135
    [% ELSE %]
136
    <li>
137
        <label for="paid">Amount paid:</label>
138
        <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payform.paid)"/>
139
        [% amount_paid | $Price %]
140
    </li>
101
    <li>
141
    <li>
102
        <label for="paid">Collect from patron: </label>
142
        <label for="collected">Collect from patron:</label>
103
            <!-- default to paying all -->
143
        <input name="collected" id="collected" value="[% amountoutstanding %]" onchange="moneyFormat(document.payform.collected)" />
104
        <input name="paid" id="paid" value="[% amountoutstanding | html %]" />
105
    </li>
144
    </li>
106
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
145
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
107
    [% IF payment_types %]
146
    [% IF payment_types %]
Lines 115-120 Link Here
115
            </select>
154
            </select>
116
        </li>
155
        </li>
117
    [% END %]
156
    [% END %]
157
    [% END %]
118
</ol>
158
</ol>
119
</fieldset>
159
</fieldset>
120
160
Lines 144-155 Link Here
144
            <th>Amount</th>
184
            <th>Amount</th>
145
            <th>Amount outstanding</th>
185
            <th>Amount outstanding</th>
146
        </tr></thead>
186
        </tr></thead>
147
    <tfoot><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tfoot>
187
    <tfoot><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | $Price %]</td></tfoot>
148
    <tbody><tr>
188
    <tbody><tr>
149
            <td>[% description | html %] [% title | html %]</td>
189
            <td>[% description | html %] [% title | html %]</td>
150
            <td>[% accounttype | html %]</td>
190
            <td>[% accounttype | html %]</td>
151
            <td class="debit">[% amount | format('%.2f') %]</td>
191
            <td class="debit">[% amount | $Price %]</td>
152
            <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
192
            <td class="debit">[% amountoutstanding | $Price %]</td>
153
        </tr></tbody>
193
        </tr></tbody>
154
    </table>
194
    </table>
155
195
Lines 189-204 Link Here
189
    <ol>
229
    <ol>
190
        <li>
230
        <li>
191
            <span class="label">Total amount outstanding: </span>
231
            <span class="label">Total amount outstanding: </span>
192
            <span class="debit">[% total | format('%.2f') %]</span>
232
            <span class="debit">[% total | $Price %]</span>
193
        </li>
233
        </li>
234
    [% IF ( give_change ) %]
235
    <li>
236
        <label for="paid">Amount paid:</label>
237
        <input type="hidden" name="paid" id="paid" value="[% amount_paid %]" />
238
        [% amount_paid | $Price %]
239
    </li>
240
    <li>
241
        <label>Collected from patron:</label>
242
        <input type="hidden" name="collected" id="collected" value="[% amount_paid %]" />
243
        [% amount_collected | $Price %]
244
    </li>
245
    <li>
246
        <label>Change to give back:</label>
247
        [% give_change | $Price %]
248
    </li>
249
    [% ELSE %]
250
    <li>
251
        <label for="paid">Amount paid :</label>
252
        <input name="paid" id="paid" value="[% total %]" onchange="moneyFormat(document.payform.paid)" />
253
    </li>
194
    <li>
254
    <li>
195
        [% IF type == 'writeoff' %]
255
        [% IF type == 'writeoff' %]
196
            <label for="paid">Writeoff amount: </label>
256
            <label for="collected">Writeoff amount: </label>
197
        [% ELSE %]
257
        [% ELSE %]
198
            <label for="paid">Collect from patron: </label>
258
            <label for="collected">Collect from patron: </label>
199
        [% END %]
259
        [% END %]
200
        <!-- default to paying all -->
260
        <!-- default to paying all -->
201
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" />
261
        <input name="collected" id="collected" value="[% total %]" onchange="moneyFormat(document.payform.collected)"/>
202
    </li>
262
    </li>
203
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
263
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
204
    [% IF payment_types %]
264
    [% IF payment_types %]
Lines 212-217 Link Here
212
            </select>
272
            </select>
213
        </li>
273
        </li>
214
    [% END %]
274
    [% END %]
275
    [% END %]
215
    <li>
276
    <li>
216
        <label for="selected_accts_notes">Note: </label>
277
        <label for="selected_accts_notes">Note: </label>
217
        <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
278
        <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
Lines 238-244 Link Here
238
    [% Asset.js("js/members-menu.js") | $raw %]
299
    [% Asset.js("js/members-menu.js") | $raw %]
239
    <script type= "text/javascript">
300
    <script type= "text/javascript">
240
        $(document).ready(function() {
301
        $(document).ready(function() {
241
            $('#payindivfine, #payfine').preventDoubleFormSubmit();
302
            $('#payindivfine, #payfine, #payform').preventDoubleFormSubmit();
242
            $("#paid").on("change",function(){
303
            $("#paid").on("change",function(){
243
                moneyFormat( this );
304
                moneyFormat( this );
244
            });
305
            });
(-)a/members/paycollect.pl (-7 / +25 lines)
Lines 62-67 my $branch = C4::Context->userenv->{'branch'}; Link Here
62
my $total_due = $patron->account->outstanding_debits->total_outstanding;
62
my $total_due = $patron->account->outstanding_debits->total_outstanding;
63
63
64
my $total_paid = $input->param('paid');
64
my $total_paid = $input->param('paid');
65
my $total_collected = $input->param('collected');
65
66
66
my $individual   = $input->param('pay_individual');
67
my $individual   = $input->param('pay_individual');
67
my $writeoff     = $input->param('writeoff_individual');
68
my $writeoff     = $input->param('writeoff_individual');
Lines 96-115 if ( $individual || $writeoff ) { Link Here
96
        individual_description => $description,
97
        individual_description => $description,
97
        payment_note    => $payment_note,
98
        payment_note    => $payment_note,
98
    );
99
    );
99
} elsif ($select_lines) {
100
} elsif ($select) {
100
    $total_due = $input->param('amt');
101
    $total_due = ($input->param('amt') || $input->param('total'));
101
    $template->param(
102
    $template->param(
102
        selected_accts => $select_lines,
103
        selected_accts => $select,
103
        amt            => $total_due,
104
        amt            => $total_due,
104
        selected_accts_notes => scalar $input->param('notes'),
105
        selected_accts_notes => scalar $input->param('notes'),
105
    );
106
    );
106
}
107
}
107
108
108
if ( $total_paid and $total_paid ne '0.00' ) {
109
if ( $total_paid and $total_paid ne '0.00' ) {
109
    if ( $total_paid < 0 or $total_paid > $total_due ) {
110
    if ( $total_paid < 0 ) {
110
        $template->param(
111
        $template->param(
111
            error_over => 1,
112
            error_negative => 1,
112
            total_due => $total_due
113
        );
114
    }
115
    elsif (($total_collected - $total_paid) < 0) {
116
        $template->param(
117
            error_collected_less => 1,
118
        );
119
    }
120
    elsif ($total_paid >=  $total_due and $total_collected ne $total_paid) {
121
        $template->param(
122
            amount_paid => $total_due,
123
            amount_collected => $total_collected,
124
            give_change => $total_collected-$total_due,
125
        );
126
    }
127
    elsif ($total_paid < $total_due and $total_collected ne $total_paid) {
128
         $template->param(
129
            amount_paid => $total_paid,
130
            amount_collected => $total_collected,
131
            give_change => $total_collected-$total_paid,
113
        );
132
        );
114
    } else {
133
    } else {
115
        die "Wrong CSRF token"
134
        die "Wrong CSRF token"
116
- 

Return to bug 11373