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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc (-4 / +4 lines)
Lines 16-22 Link Here
16
16
17
        <tbody>
17
        <tbody>
18
            [% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %]
18
            [% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %]
19
                [% IF ( ACCOUNT_LINE.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
19
                <tr>
20
                    [% IF ENABLE_OPAC_PAYMENTS %]
20
                    [% IF ENABLE_OPAC_PAYMENTS %]
21
                        <td>
21
                        <td>
22
                            [% IF ACCOUNT_LINE.amountoutstanding > 0 %]
22
                            [% IF ACCOUNT_LINE.amountoutstanding > 0 %]
Lines 58-67 Link Here
58
                    <td>
58
                    <td>
59
                        [%- IF ACCOUNT_LINE.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', ACCOUNT_LINE.payment_type, 1) | html %][% END %]
59
                        [%- IF ACCOUNT_LINE.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', ACCOUNT_LINE.payment_type, 1) | html %][% END %]
60
                        [%- IF ACCOUNT_LINE.description %][% ACCOUNT_LINE.description | html %][% END %]
60
                        [%- IF ACCOUNT_LINE.description %][% ACCOUNT_LINE.description | html %][% END %]
61
                        [% IF ACCOUNT_LINE.title %]([% ACCOUNT_LINE.title | html %])[% END %]
61
                        [% IF ACCOUNT_LINE.itemnumber %]([% ACCOUNT_LINE.item.biblio.title | html %])[% END %]
62
                    </td>
62
                    </td>
63
                    [% IF ( ACCOUNT_LINE.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amount | $Price %]</td>
63
                    [% IF ( ACCOUNT_LINE.amount <= 0 ) %]<td class="credit">[% ACCOUNT_LINE.amount * -1 | $Price %][% ELSE %]<td class="debit">[% ACCOUNT_LINE.amount | $Price %][% END %]</td>
64
                    [% IF ( ACCOUNT_LINE.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amountoutstanding | $Price %]</td>
64
                    [% IF ( ACCOUNT_LINE.amountoutstanding <= 0 ) %]<td class="credit">[% ACCOUNT_LINE.amountoutstanding * -1 | $Price %][% ELSE %]<td class="debit">[% ACCOUNT_LINE.amountoutstanding | $Price %][% END %]</td>
65
                </tr>
65
                </tr>
66
            [% END %]
66
            [% END %]
67
        </tbody>
67
        </tbody>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-20 / +5 lines)
Lines 149-157 Link Here
149
                            [% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
149
                            [% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
150
                            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue ([% overdues_count | html %])</a></li>[% END %]
150
                            [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue ([% overdues_count | html %])</a></li>[% END %]
151
                            [% IF ( OPACFinesTab ) %]
151
                            [% IF ( OPACFinesTab ) %]
152
                                [% IF ( borrower.amountoverfive ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %]
152
                            [% IF ( amountoutstanding > 0 ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %]
153
                                [% IF ( borrower.amountoverzero ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %]
153
                                [% IF ( amountoutstanding < 0 ) %]<li><a href="#opac-user-fines">Credits ([% amountoutstanding * -1 | $Price %])</a></li>[% END %]
154
                                [% IF ( borrower.amountlessthanzero ) %]<li><a href="#opac-user-fines">Credits ([% amountoutstanding | $Price %])</a></li>[% END %]
155
                            [% END %]
154
                            [% END %]
156
155
157
                            [% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
156
                            [% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
Lines 386-392 Link Here
386
385
387
                        [% IF ( OPACFinesTab ) %]
386
                        [% IF ( OPACFinesTab ) %]
388
                            <!-- FINES BOX -->
387
                            <!-- FINES BOX -->
389
                            [% IF borrower.amountoverfive %]
388
                            [% IF ( amountoutstanding > 0 ) %]
390
                                <div id="opac-user-fines"> <h3>Fines and charges</h3>
389
                                <div id="opac-user-fines"> <h3>Fines and charges</h3>
391
                                    <table class="table table-bordered table-striped">
390
                                    <table class="table table-bordered table-striped">
392
                                        <thead><tr><th colspan="2">Amount</th></tr></thead>
391
                                        <thead><tr><th colspan="2">Amount</th></tr></thead>
Lines 400-426 Link Here
400
                                </div>
399
                                </div>
401
                            [% END %]
400
                            [% END %]
402
401
403
                            [% IF borrower.amountoverzero %]
402
                            [% IF ( amountoutstanding < 0 ) %]
404
                               <div id="opac-user-fines"> <h3>Fines and charges</h3>
405
                                    <table class="table table-bordered table-striped">
406
                                        <thead><tr><th colspan="2">Amount</th></tr></thead>
407
                                        <tbody>
408
                                            <tr>
409
                                                <td>You currently owe fines and charges amounting to:</td>
410
                                                <td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding | $Price %]</a></td>
411
                                            </tr>
412
                                        </tbody>
413
                                    </table>
414
                                </div>
415
                            [% END %]
416
417
                            [% IF borrower.amountlessthanzero %]
418
                                <div id="opac-user-fines">  <h3>Credits</h3>
403
                                <div id="opac-user-fines">  <h3>Credits</h3>
419
                                    <table class="table table-bordered table-striped">
404
                                    <table class="table table-bordered table-striped">
420
                                        <thead><tr><th colspan="2">Amount</th></tr></thead>
405
                                        <thead><tr><th colspan="2">Amount</th></tr></thead>
421
                                        <tbody>
406
                                        <tbody>
422
                                            <tr>
407
                                            <tr>
423
                                                <td>You have a credit of:</td><td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding | $Price %]</a></td>
408
                                                <td>You have a credit of:</td><td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding * -1 | $Price %]</a></td>
424
                                            </tr>
409
                                            </tr>
425
                                        </tbody>
410
                                        </tbody>
426
                                    </table>
411
                                    </table>
(-)a/opac/opac-account.pl (-18 / +3 lines)
Lines 41-69 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
41
41
42
my $patron = Koha::Patrons->find( $borrowernumber );
42
my $patron = Koha::Patrons->find( $borrowernumber );
43
my $total = $patron->account->balance;
43
my $total = $patron->account->balance;
44
my $accts = Koha::Account::Lines->search(
44
my @accts = Koha::Account::Lines->search(
45
    { borrowernumber => $patron->borrowernumber },
45
    { borrowernumber => $patron->borrowernumber },
46
    { order_by       => { -desc => 'accountlines_id' } }
46
    { order_by       => { -desc => 'accountlines_id' } }
47
);
47
);
48
48
49
my @accountlines;
50
while ( my $line = $accts->next ) {
51
    my $accountline = $line->unblessed;
52
    $accountline->{'amount'} = sprintf( "%.2f", $accountline->{'amount'} || '0.00');
53
    if ( $accountline->{'amount'} >= 0 ) {
54
        $accountline->{'amountcredit'} = 1;
55
    }
56
    $accountline->{'amountoutstanding'} =
57
      sprintf( "%.2f", $accountline->{'amountoutstanding'} || '0.00' );
58
    if ( $accountline->{'amountoutstanding'} >= 0 ) {
59
        $accountline->{'amountoutstandingcredit'} = 1;
60
    }
61
    push @accountlines, $accountline;
62
}
63
64
$template->param(
49
$template->param(
65
    ACCOUNT_LINES => \@accountlines,
50
    ACCOUNT_LINES => \@accts,
66
    total         => sprintf( "%.2f", $total ), # FIXME Use TT plugin Price
51
    total         => $total,
67
    accountview   => 1,
52
    accountview   => 1,
68
    message       => scalar $query->param('message') || q{},
53
    message       => scalar $query->param('message') || q{},
69
    message_value => scalar $query->param('message_value') || q{},
54
    message_value => scalar $query->param('message_value') || q{},
(-)a/opac/opac-user.pl (-11 lines)
Lines 120-131 if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) { Link Here
120
}
120
}
121
121
122
my $amountoutstanding = $patron->account->balance;
122
my $amountoutstanding = $patron->account->balance;
123
if ( $amountoutstanding > 5 ) {
124
    $borr->{'amountoverfive'} = 1;
125
}
126
if ( 5 >= $amountoutstanding && $amountoutstanding > 0 ) {
127
    $borr->{'amountoverzero'} = 1;
128
}
129
my $no_renewal_amt = C4::Context->preference( 'OPACFineNoRenewals' );
123
my $no_renewal_amt = C4::Context->preference( 'OPACFineNoRenewals' );
130
$no_renewal_amt = undef unless looks_like_number( $no_renewal_amt );
124
$no_renewal_amt = undef unless looks_like_number( $no_renewal_amt );
131
125
Lines 141-151 if ( C4::Context->preference('OpacRenewalAllowed') Link Here
141
    );
135
    );
142
}
136
}
143
137
144
if ( $amountoutstanding < 0 ) {
145
    $borr->{'amountlessthanzero'} = 1;
146
    $amountoutstanding = -1 * ( $amountoutstanding );
147
}
148
149
# Warningdate is the date that the warning starts appearing
138
# Warningdate is the date that the warning starts appearing
150
if ( $borr->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') ) {
139
if ( $borr->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') ) {
151
    my $days_to_expiry = Date_to_Days( $warning_year, $warning_month, $warning_day ) - Date_to_Days( $today_year, $today_month, $today_day );
140
    my $days_to_expiry = Date_to_Days( $warning_year, $warning_month, $warning_day ) - Date_to_Days( $today_year, $today_month, $today_day );
(-)a/opac/sco/sco-main.pl (-20 / +4 lines)
Lines 279-304 if ($borrower) { Link Here
279
    }
279
    }
280
280
281
    my $total = $patron->account->balance;
281
    my $total = $patron->account->balance;
282
    my $accts = Koha::Account::Lines->search(
282
    my @accts = Koha::Account::Lines->search(
283
        { borrowernumber => $borrower->{borrowernumber} },
283
        { borrowernumber => $borrower->{borrowernumber} },
284
        { order_by       => { -desc => 'accountlines_id' } }
284
        { order_by       => { -desc => 'accountlines_id' } }
285
    );
285
    );
286
286
287
    my @accountlines;
288
    while ( my $line = $accts->next ) {
289
        my $accountline = $line->unblessed;
290
        $accountline->{'amount'} = sprintf( "%.2f", $accountline->{'amount'} || '0.00');
291
        if ( $accountline->{'amount'} >= 0 ) {
292
            $accountline->{'amountcredit'} = 1;
293
        }
294
        $accountline->{'amountoutstanding'} =
295
        sprintf( "%.2f", $accountline->{'amountoutstanding'} || '0.00' );
296
        if ( $accountline->{'amountoutstanding'} >= 0 ) {
297
            $accountline->{'amountoutstandingcredit'} = 1;
298
        }
299
        push @accountlines, $accountline;
300
    }
301
302
    my $holds = $patron->holds;
287
    my $holds = $patron->holds;
303
288
304
    $template->param(
289
    $template->param(
Lines 315-323 if ($borrower) { Link Here
315
        borrowernumber => $borrower->{'borrowernumber'},
300
        borrowernumber => $borrower->{'borrowernumber'},
316
        SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
301
        SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
317
        AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
302
        AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
318
        showpriority   => $show_priority,
303
        howpriority   => $show_priority,
319
        ACCOUNT_LINES => \@accountlines,
304
        ACCOUNT_LINES => \@accts,
320
        total => sprintf( "%.2f", $total ),
305
        total => $total,
321
    );
306
    );
322
307
323
    my $patron_messages = Koha::Patron::Messages->search(
308
    my $patron_messages = Koha::Patron::Messages->search(
324
- 

Return to bug 22588