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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc (-5 / +5 lines)
Lines 27-33 Link Here
27
27
28
        <tbody>
28
        <tbody>
29
            [% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %]
29
            [% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %]
30
                [% IF ( ACCOUNT_LINE.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
30
                <tr>
31
                    [% IF ENABLE_OPAC_PAYMENTS %]
31
                    [% IF ENABLE_OPAC_PAYMENTS %]
32
                        <td>
32
                        <td>
33
                            [% IF ACCOUNT_LINE.amountoutstanding > 0 %]
33
                            [% IF ACCOUNT_LINE.amountoutstanding > 0 %]
Lines 64-73 Link Here
64
                        [%- END -%]
64
                        [%- END -%]
65
                        [%- IF ACCOUNT_LINE.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', ACCOUNT_LINE.payment_type, 1) | html %][% END %]
65
                        [%- IF ACCOUNT_LINE.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', ACCOUNT_LINE.payment_type, 1) | html %][% END %]
66
                        [%- IF ACCOUNT_LINE.description %], [% ACCOUNT_LINE.description | html %][% END %]
66
                        [%- IF ACCOUNT_LINE.description %], [% ACCOUNT_LINE.description | html %][% END %]
67
                        [% IF ACCOUNT_LINE.title %]([% ACCOUNT_LINE.title | html %])[% END %]
67
                        [% IF ACCOUNT_LINE.itemnumber %]([% ACCOUNT_LINE.item.biblio.title | html %])[% END %]
68
                    </td>
68
                    </td>
69
                    [% IF ( ACCOUNT_LINE.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amount | $Price %]</td>
69
                    [% IF ( ACCOUNT_LINE.amount <= 0 ) %]<td class="credit">[% ACCOUNT_LINE.amount * -1 | $Price %][% ELSE %]<td class="debit">[% ACCOUNT_LINE.amount | $Price %][% END %]</td>
70
                    [% IF ( ACCOUNT_LINE.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amountoutstanding | $Price %]</td>
70
                    [% IF ( ACCOUNT_LINE.amountoutstanding <= 0 ) %]<td class="credit">[% ACCOUNT_LINE.amountoutstanding * -1 | $Price %][% ELSE %]<td class="debit">[% ACCOUNT_LINE.amountoutstanding | $Price %][% END %]</td>
71
                </tr>
71
                </tr>
72
            [% END %]
72
            [% END %]
73
        </tbody>
73
        </tbody>
Lines 109-112 Link Here
109
    </form>
109
    </form>
110
[% ELSE %]
110
[% ELSE %]
111
    <h4>You have no fines or charges</h4>
111
    <h4>You have no fines or charges</h4>
112
[% END %]
112
[% END %]
(-)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 278-303 if ($borrower) { Link Here
278
    }
278
    }
279
279
280
    my $total = $patron->account->balance;
280
    my $total = $patron->account->balance;
281
    my $accts = Koha::Account::Lines->search(
281
    my @accts = Koha::Account::Lines->search(
282
        { borrowernumber => $borrower->{borrowernumber} },
282
        { borrowernumber => $borrower->{borrowernumber} },
283
        { order_by       => { -desc => 'accountlines_id' } }
283
        { order_by       => { -desc => 'accountlines_id' } }
284
    );
284
    );
285
285
286
    my @accountlines;
287
    while ( my $line = $accts->next ) {
288
        my $accountline = $line->unblessed;
289
        $accountline->{'amount'} = sprintf( "%.2f", $accountline->{'amount'} || '0.00');
290
        if ( $accountline->{'amount'} >= 0 ) {
291
            $accountline->{'amountcredit'} = 1;
292
        }
293
        $accountline->{'amountoutstanding'} =
294
        sprintf( "%.2f", $accountline->{'amountoutstanding'} || '0.00' );
295
        if ( $accountline->{'amountoutstanding'} >= 0 ) {
296
            $accountline->{'amountoutstandingcredit'} = 1;
297
        }
298
        push @accountlines, $accountline;
299
    }
300
301
    my $holds = $patron->holds;
286
    my $holds = $patron->holds;
302
287
303
    $template->param(
288
    $template->param(
Lines 314-322 if ($borrower) { Link Here
314
        borrowernumber => $borrower->{'borrowernumber'},
299
        borrowernumber => $borrower->{'borrowernumber'},
315
        SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
300
        SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
316
        AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
301
        AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
317
        showpriority   => $show_priority,
302
        howpriority   => $show_priority,
318
        ACCOUNT_LINES => \@accountlines,
303
        ACCOUNT_LINES => \@accts,
319
        total => sprintf( "%.2f", $total ),
304
        total => $total,
320
    );
305
    );
321
306
322
    my $patron_messages = Koha::Patron::Messages->search(
307
    my $patron_messages = Koha::Patron::Messages->search(
323
- 

Return to bug 22588