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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-10 / +70 lines)
Lines 53-64 Link Here
53
    </li>
53
    </li>
54
</ul>
54
</ul>
55
<div class="tabs-container">
55
<div class="tabs-container">
56
[% IF ( error_over ) %]
56
[% IF (error_negative) %]
57
    <div id="error_message" class="dialog alert">
57
    <div id="error_message" class="dialog alert">
58
    You must pay a value less than or equal to [% total_due | format('%.2f') %].
58
        <span>The amount paid can't be negative!</span>
59
    </div>
59
    </div>
60
[% END %]
60
[% END %]
61
61
62
[% IF (error_collected_less) %]
63
    <div id="error_message" class="dialog alert">
64
        <span>The amount collected can't be lower than the amount paid!</span>
65
    </div>
66
[% END %]
67
68
[% UNLESS (writeoff_individual) %]
69
    <form name="payform" id="payform" action="/cgi-bin/koha/members/paycollect.pl" method="post">
70
[% END %]
71
72
[% IF (give_change) %]
73
    <div id="change_message" class="dialog message">
74
        <span>The amount collected is greater than the total amount paid.</span><br />
75
        <strong>Change to give back: [% give_change %]</strong><br /><br />
76
        <input type="submit" name="submitbutton" value="Confirm payment" />
77
        <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
78
     </div>
79
[% END %]
80
62
[% IF ( pay_individual ) %]
81
[% IF ( pay_individual ) %]
63
    <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
82
    <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
64
    <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
83
    <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
Lines 96-106 Link Here
96
</table>
115
</table>
97
116
98
<ol>
117
<ol>
99
118
    [% IF ( give_change ) %]
119
    <li>
120
        <label for="paid">Amount paid:</label>
121
        <input type="hidden" name="paid" id="paid" value="[% amount_paid %]" />
122
        <input type="hidden" name="collected" id="collected" value="[% amount_paid %]" />
123
        [% amount_paid %]
124
    </li>
100
    <li>
125
    <li>
101
        <label for="paid">Collect from patron: </label>
126
        <label>Collect from patron:</label>
102
            <!-- default to paying all -->
127
        [% amount_collected %]
103
        <input name="paid" id="paid" value="[% amountoutstanding %]" />
128
    </li>
129
    <li>
130
        <label>Change to give back:</label>
131
        [% give_change %]
132
    </li>
133
    [% ELSE %]
134
    <li>
135
        <label for="paid">Amount paid :</label>
136
        <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payform.paid)"/>
137
        [% amount_paid %]
138
    </li>
139
    <li>
140
        <label for="collected">Collect from patron:</label>
141
        <input name="collected" id="collected" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payform.collected)" />
104
    </li>
142
    </li>
105
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
143
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
106
    [% IF payment_types %]
144
    [% IF payment_types %]
Lines 114-119 Link Here
114
            </select>
152
            </select>
115
        </li>
153
        </li>
116
    [% END %]
154
    [% END %]
155
    [% END %]
117
</ol>
156
</ol>
118
</fieldset>
157
</fieldset>
119
158
Lines 190-203 Link Here
190
            <span class="label">Total amount outstanding: </span>
229
            <span class="label">Total amount outstanding: </span>
191
            <span class="debit">[% total | format('%.2f') %]</span>
230
            <span class="debit">[% total | format('%.2f') %]</span>
192
        </li>
231
        </li>
232
    [% IF ( give_change ) %]
233
    <li>
234
        <label for="paid">Amount paid:</label>
235
        <input type="hidden" name="paid" id="paid" value="[% amount_paid %]" />
236
        [% amount_paid %]
237
    </li>
238
    <li>
239
        <label>Collected from patron:</label>
240
        <input type="hidden" name="collected" id="collected" value="[% amount_paid %]" />
241
        [% amount_collected %]
242
    </li>
243
    <li>
244
        <label>Change to give back:</label>
245
        [% give_change %]
246
    </li>
247
    [% ELSE %]
248
    <li>
249
        <label for="paid">Amount paid :</label>
250
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payform.paid)" />
251
    </li>
193
    <li>
252
    <li>
194
        [% IF type == 'writeoff' %]
253
        [% IF type == 'writeoff' %]
195
            <label for="paid">Writeoff amount: </label>
254
            <label for="collected">Writeoff amount: </label>
196
        [% ELSE %]
255
        [% ELSE %]
197
            <label for="paid">Collect from patron: </label>
256
            <label for="collected">Collect from patron: </label>
198
        [% END %]
257
        [% END %]
199
        <!-- default to paying all -->
258
        <!-- default to paying all -->
200
        <input name="paid" id="paid" value="[% total | format('%.2f') %]" />
259
        <input name="collected" id="collected" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payform.collected)"/>
201
    </li>
260
    </li>
202
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
261
    [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
203
    [% IF payment_types %]
262
    [% IF payment_types %]
Lines 211-216 Link Here
211
            </select>
270
            </select>
212
        </li>
271
        </li>
213
    [% END %]
272
    [% END %]
273
    [% END %]
214
    <li>
274
    <li>
215
        <label for="selected_accts_notes">Note: </label>
275
        <label for="selected_accts_notes">Note: </label>
216
        <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea>
276
        <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea>
Lines 236-242 Link Here
236
    [% Asset.js("js/members-menu.js") %]
296
    [% Asset.js("js/members-menu.js") %]
237
    <script type= "text/javascript">
297
    <script type= "text/javascript">
238
        $(document).ready(function() {
298
        $(document).ready(function() {
239
            $('#payindivfine, #payfine').preventDoubleFormSubmit();
299
            $('#payindivfine, #payfine, #payform').preventDoubleFormSubmit();
240
            $("#paid").on("change",function(){
300
            $("#paid").on("change",function(){
241
                moneyFormat( this );
301
                moneyFormat( this );
242
            });
302
            });
(-)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 => sprintf('%.2f', $total_due),
123
            amount_collected => sprintf('%.2f', $total_collected),
124
            give_change => sprintf('%.2f',($total_collected-$total_due))
125
        );
126
    }
127
    elsif ($total_paid < $total_due and $total_collected ne $total_paid) {
128
         $template->param(
129
            amount_paid => sprintf('%.2f', $total_paid),
130
            amount_collected => sprintf('%.2f', $total_collected),
131
            give_change => sprintf('%.2f',($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