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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt (+10 lines)
Lines 52-58 Link Here
52
<tfoot>
52
<tfoot>
53
<tr>
53
<tr>
54
    <td class="total" colspan="6">Total due:</td>
54
    <td class="total" colspan="6">Total due:</td>
55
[% IF outstanding_credits.total_outstanding < 0 %]
56
    <td style="text-align: right;">[% total + outstanding_credits.total_outstanding | $Price %]</td>
57
[% ELSE %]
55
    <td style="text-align: right;">[% total | $Price %]</td>
58
    <td style="text-align: right;">[% total | $Price %]</td>
59
[% END %]
56
</tr>
60
</tr>
57
</tfoot>
61
</tfoot>
58
<tbody>
62
<tbody>
Lines 109-114 Link Here
109
    <td class="debit" style="text-align: right;">[% line.amountoutstanding | $Price %]</td>
113
    <td class="debit" style="text-align: right;">[% line.amountoutstanding | $Price %]</td>
110
</tr>
114
</tr>
111
[% END %]
115
[% END %]
116
[% IF outstanding_credits.total_outstanding < 0 %]
117
<tr>
118
    <td class="total" colspan="6">Outstanding credits could be applied <input type="submit" id="apply_credits" name="apply_credits"  value="Apply credits" class="submit" /></td>
119
    <td class="credit" style="text-align: right;">[% outstanding_credits.total_outstanding | $Price %]</td>
120
</tr>
121
[% END %]
112
[% IF ( account_grp.total ) %]
122
[% IF ( account_grp.total ) %]
113
<tr>
123
<tr>
114
124
(-)a/members/pay.pl (-2 / +20 lines)
Lines 87-92 elsif ( $input->param('writeoff_selected') ) { Link Here
87
elsif ( $input->param('woall') ) {
87
elsif ( $input->param('woall') ) {
88
    writeoff_all(@names);
88
    writeoff_all(@names);
89
}
89
}
90
elsif ( $input->param('apply_credits') ) {
91
    apply_credits({ patron => $patron, cgi => $input });
92
}
90
elsif ( $input->param('confirm_writeoff') ) {
93
elsif ( $input->param('confirm_writeoff') ) {
91
    my $accountlines_id = $input->param('accountlines_id');
94
    my $accountlines_id = $input->param('accountlines_id');
92
    my $amount          = $input->param('amountwrittenoff');
95
    my $amount          = $input->param('amountwrittenoff');
Lines 138-144 output_html_with_http_headers $input, $cookie, $template->output; Link Here
138
sub add_accounts_to_template {
141
sub add_accounts_to_template {
139
142
140
    my $patron = Koha::Patrons->find( $borrowernumber );
143
    my $patron = Koha::Patrons->find( $borrowernumber );
141
    my $account_lines = $patron->account->outstanding_debits;
144
    my $account = $patron->account;
145
    my $outstanding_credits = $account->outstanding_credits;
146
    my $account_lines = $account->outstanding_debits;
142
    my $total = $account_lines->total_outstanding;
147
    my $total = $account_lines->total_outstanding;
143
    my @accounts;
148
    my @accounts;
144
    while ( my $account_line = $account_lines->next ) {
149
    while ( my $account_line = $account_lines->next ) {
Lines 157-163 sub add_accounts_to_template { Link Here
157
        patron   => $patron,
162
        patron   => $patron,
158
        accounts => \@accounts,
163
        accounts => \@accounts,
159
        total    => $total,
164
        total    => $total,
165
        outstanding_credits => $outstanding_credits
160
    );
166
    );
167
161
    return;
168
    return;
162
169
163
}
170
}
Lines 273-275 sub payselected { Link Here
273
    print $input->redirect($redirect);
280
    print $input->redirect($redirect);
274
    return;
281
    return;
275
}
282
}
276
- 
283
284
sub apply_credits {
285
    my ($args) = @_;
286
287
    my $patron = $args->{patron};
288
    my $cgi    = $args->{cgi};
289
290
    $patron->account->reconcile_balance();
291
292
    print $cgi->redirect("/cgi-bin/koha/members/pay.pl?borrowernumber=" . $patron->borrowernumber );
293
    return;
294
}

Return to bug 18805