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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (+6 lines)
Lines 213-218 Patrons: Link Here
213
               yes: Allow only superlibrarians
213
               yes: Allow only superlibrarians
214
               no: Allow all permitted users
214
               no: Allow all permitted users
215
         - "to access/change superlibrarian privileges. Note: A permitted user needs to have the 'permissions' flag (if no superlibrarian)."
215
         - "to access/change superlibrarian privileges. Note: A permitted user needs to have the 'permissions' flag (if no superlibrarian)."
216
     -
217
         - pref: FineChange
218
           choices:
219
               yes: Enable
220
               no: Disable
221
         - fine change display when a user pays a fine.
216
    Privacy:
222
    Privacy:
217
     -
223
     -
218
         - Use the following URL
224
         - Use the following URL
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-15 / +74 lines)
Lines 54-65 Link Here
54
    </li>
54
    </li>
55
</ul>
55
</ul>
56
<div class="tabs-container">
56
<div class="tabs-container">
57
[% IF ( error_over ) %]
57
[% IF (error_negative) %]
58
    <div id="error_message" class="dialog alert">
58
    <div id="error_message" class="dialog alert">
59
    You must pay a value less than or equal to [% total_due | format('%.2f') %].
59
        The amount paid can't be negative.
60
    </div>
60
    </div>
61
[% END %]
61
[% END %]
62
62
63
[% IF (error_collected_less) %]
64
    <div id="error_message" class="dialog alert">
65
        The amount collected can't be lower than the amount paid.
66
    </div>
67
[% END %]
68
69
[% UNLESS (writeoff_individual) %]
70
    <form name="payform" id="payform" action="/cgi-bin/koha/members/paycollect.pl" method="post">
71
[% END %]
72
63
[% IF ( pay_individual ) %]
73
[% IF ( pay_individual ) %]
64
    <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
74
    <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 %]" />
75
    <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
Lines 84-108 Link Here
84
            <th>Amount outstanding</th>
94
            <th>Amount outstanding</th>
85
        </tr></thead>
95
        </tr></thead>
86
    <tfoot>
96
    <tfoot>
87
        <td colspan="3">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td>
97
        <td colspan="3">Total amount payable:</td><td>[% amountoutstanding | $Price %]</td>
88
    </tfoot>
98
    </tfoot>
89
    <tbody><tr>
99
    <tbody><tr>
90
            <td>
100
            <td>
91
                [% individual_description | html %]
101
                [% individual_description | html %]
92
            </td>
102
            </td>
93
            <td>[% accounttype | html %]</td>
103
            <td>[% accounttype | html %]</td>
94
            <td class="debit">[% amount | format('%.2f') %]</td>
104
            <td class="debit">[% amount | $Price %]</td>
95
            <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
105
            <td class="debit">[% amountoutstanding | $Price %]</td>
96
        </tr></tbody>
106
        </tr></tbody>
97
</table>
107
</table>
98
108
99
<ol>
109
<ol>
100
110
    [% IF FineChange %]
111
    <li>
112
        <label for="paid">Amount paid:</label>
113
        <input name="paid" id="paid" value="[% amountoutstanding | $Price %]"/>
114
    </li>
101
    <li>
115
    <li>
102
        <label for="paid">Collect from patron: </label>
116
        <label for="collected">Collect from patron:</label>
103
            <!-- default to paying all -->
117
        <input name="collected" id="collected" value="[% amountoutstanding | $Price %]"/>
104
        <input name="paid" id="paid" value="[% amountoutstanding | html %]" />
105
    </li>
118
    </li>
119
    <li>
120
        <label>Change to give back:</label>
121
        <input id="change" value="0.00" disabled/>
122
    </li>
123
    [% ELSE %]
124
    <li>
125
        <label for="paid">Collect from patron:</label>
126
        <input name="paid" id="collected" value="[% amountoutstanding | $Price %]"/>
127
    </li>
128
    [% END %]
106
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
129
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
107
    [% IF payment_types %]
130
    [% IF payment_types %]
108
        <li>
131
        <li>
Lines 144-155 Link Here
144
            <th>Amount</th>
167
            <th>Amount</th>
145
            <th>Amount outstanding</th>
168
            <th>Amount outstanding</th>
146
        </tr></thead>
169
        </tr></thead>
147
    <tfoot><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tfoot>
170
    <tfoot><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | $Price %]</td></tfoot>
148
    <tbody><tr>
171
    <tbody><tr>
149
            <td>[% description | html %] [% title | html %]</td>
172
            <td>[% description | html %] [% title | html %]</td>
150
            <td>[% accounttype | html %]</td>
173
            <td>[% accounttype | html %]</td>
151
            <td class="debit">[% amount | format('%.2f') %]</td>
174
            <td class="debit">[% amount | $Price %]</td>
152
            <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
175
            <td class="debit">[% amountoutstanding | $Price %]</td>
153
        </tr></tbody>
176
        </tr></tbody>
154
    </table>
177
    </table>
155
178
Lines 189-196 Link Here
189
    <ol>
212
    <ol>
190
        <li>
213
        <li>
191
            <span class="label">Total amount outstanding: </span>
214
            <span class="label">Total amount outstanding: </span>
192
            <span class="debit">[% total | format('%.2f') %]</span>
215
            <span class="debit">[% total | $Price %]</span>
193
        </li>
216
        </li>
217
    [% IF FineChange %]
218
    <li>
219
        <label for="paid">Amount paid :</label>
220
        <input name="paid" id="paid" value="[% total | $Price %]"/>
221
    </li>
222
    <li>
223
        [% IF type == 'writeoff' %]
224
            <label for="collected">Writeoff amount: </label>
225
        [% ELSE %]
226
            <label for="collected">Collect from patron: </label>
227
        [% END %]
228
        <!-- default to paying all -->
229
        <input name="collected" id="collected" value="[% total | $Price %]"/>
230
    </li>
231
    <li>
232
        <label>Change to give back:</label>
233
        <input id="change" value="0.00" disabled/>
234
    </li>
235
    [% ELSE %]
194
    <li>
236
    <li>
195
        [% IF type == 'writeoff' %]
237
        [% IF type == 'writeoff' %]
196
            <label for="paid">Writeoff amount: </label>
238
            <label for="paid">Writeoff amount: </label>
Lines 198-205 Link Here
198
            <label for="paid">Collect from patron: </label>
240
            <label for="paid">Collect from patron: </label>
199
        [% END %]
241
        [% END %]
200
        <!-- default to paying all -->
242
        <!-- default to paying all -->
201
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" />
243
        <input name="paid" id="paid" value="[% total | $Price %]"/>
202
    </li>
244
    </li>
245
    [% END %]
203
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
246
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
204
    [% IF payment_types %]
247
    [% IF payment_types %]
205
        <li>
248
        <li>
Lines 238-246 Link Here
238
    [% Asset.js("js/members-menu.js") | $raw %]
281
    [% Asset.js("js/members-menu.js") | $raw %]
239
    <script type= "text/javascript">
282
    <script type= "text/javascript">
240
        $(document).ready(function() {
283
        $(document).ready(function() {
241
            $('#payindivfine, #payfine').preventDoubleFormSubmit();
284
            $('#payindivfine, #payfine, #payform').preventDoubleFormSubmit();
242
            $("#paid").on("change",function(){
285
            $("#paid").on("change",function(){
243
                moneyFormat( this );
286
                moneyFormat( this );
287
                updateChangeInput();
288
            });
289
            $("#collected").on("change",function(){
290
                moneyFormat( this );
291
                updateChangeInput();
244
            });
292
            });
245
        });
293
        });
246
294
Lines 310-315 Link Here
310
358
311
            textObj.value = dolAmount + "." + decAmount;
359
            textObj.value = dolAmount + "." + decAmount;
312
        }
360
        }
361
362
        function updateChangeInput() {
363
            var change = $('#change')[0];
364
            change.value = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
365
366
            if (change.value < 0) {
367
                change.value = change.defaultValue;
368
            } else {
369
                moneyFormat(change);
370
            }
371
        }
313
    </script>
372
    </script>
314
[% END %]
373
[% END %]
315
374
(-)a/members/paycollect.pl (-7 / +13 lines)
Lines 61-67 my $user = $input->remote_user; Link Here
61
my $branch    = C4::Context->userenv->{'branch'};
61
my $branch    = C4::Context->userenv->{'branch'};
62
my $total_due = $patron->account->outstanding_debits->total_outstanding;
62
my $total_due = $patron->account->outstanding_debits->total_outstanding;
63
63
64
my $fine_change = C4::Context->preference('FineChange');
64
my $total_paid = $input->param('paid');
65
my $total_paid = $input->param('paid');
66
my $total_collected = $input->param('collected');
65
67
66
my $individual   = $input->param('pay_individual');
68
my $individual   = $input->param('pay_individual');
67
my $writeoff     = $input->param('writeoff_individual');
69
my $writeoff     = $input->param('writeoff_individual');
Lines 96-115 if ( $individual || $writeoff ) { Link Here
96
        individual_description => $description,
98
        individual_description => $description,
97
        payment_note    => $payment_note,
99
        payment_note    => $payment_note,
98
    );
100
    );
99
} elsif ($select_lines) {
101
} elsif ($select) {
100
    $total_due = $input->param('amt');
102
    $total_due = ($input->param('amt') || $input->param('total'));
101
    $template->param(
103
    $template->param(
102
        selected_accts => $select_lines,
104
        selected_accts => $select,
103
        amt            => $total_due,
105
        amt            => $total_due,
104
        selected_accts_notes => scalar $input->param('notes'),
106
        selected_accts_notes => scalar $input->param('notes'),
105
    );
107
    );
106
}
108
}
107
109
108
if ( $total_paid and $total_paid ne '0.00' ) {
110
if ( $total_paid and $total_paid ne '0.00' ) {
109
    if ( $total_paid < 0 or $total_paid > $total_due ) {
111
    if ( $total_paid < 0 ) {
110
        $template->param(
112
        $template->param(
111
            error_over => 1,
113
            error_negative => 1,
112
            total_due => $total_due
114
        );
115
    }
116
    elsif ($fine_change and ($total_collected - $total_paid) < 0) {
117
        $template->param(
118
            error_collected_less => 1,
113
        );
119
        );
114
    } else {
120
    } else {
115
        die "Wrong CSRF token"
121
        die "Wrong CSRF token"
Lines 194-199 $template->param( Link Here
194
    patron        => $patron,
200
    patron        => $patron,
195
    total         => $total_due,
201
    total         => $total_due,
196
    ExtendedPatronAttributes => C4::Context->preference('ExtendedPatronAttributes'),
202
    ExtendedPatronAttributes => C4::Context->preference('ExtendedPatronAttributes'),
203
    FineChange => $fine_change,
197
204
198
    csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
205
    csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }),
199
);
206
);
200
- 

Return to bug 11373