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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc (+40 lines)
Lines 116-121 Link Here
116
    <h4>You have no fines or charges</h4>
116
    <h4>You have no fines or charges</h4>
117
[% END %]
117
[% END %]
118
118
119
[% FOREACH r IN relatives %]
120
    <h3 id="g[% r.patron.id %]">[% r.patron.firstname %] [% r.patron.surname %]'s fines and charges</h3>
121
122
    <table class="table table-bordered table-striped" id="finestable-[% r.id %]">
123
        <thead>
124
            <tr>
125
                <th class="title-string">Date</th>
126
                <th>Description</th>
127
                <th>Fine amount</th>
128
                <th>Amount outstanding</th>
129
            </tr>
130
        </thead>
131
132
        <tbody>
133
            [% SET account_sum = 0 %]
134
            [% FOREACH a IN r.accountlines %]
135
                [% SET account_sum = account_sum + a.amountoutstanding %]
136
                <tr>
137
                    <td><span title="[% a.date %]">[% a.date | $KohaDates %]</span></td>
138
                    <td>
139
                        [% PROCESS account_type_description account=a %]
140
                        [%- IF a.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', a.payment_type, 1) %][% END %]
141
                        [%- IF a.description %], [% a.description %][% END %]
142
                        [% IF a.itemnumber %]([% a.item.biblio.title %])[% END %]
143
                    </td>
144
                    [% IF ( a.amount < 0 ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% a.amount | $Price %]</td>
145
                    [% IF ( a.amountoutstanding < 0 ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% a.amountoutstanding | $Price %]</td>
146
                </tr>
147
            [% END %]
148
        </tbody>
149
150
        <tfoot>
151
            <tr>
152
                <th class="sum" colspan="3">Total due</th>
153
                <td class="sum">[% account_sum | $Price %]</td>
154
            </tr>
155
        </tfoot>
156
    </table>
157
[% END %]
158
119
[%- BLOCK account_type_description -%]
159
[%- BLOCK account_type_description -%]
120
    [%- SWITCH account.accounttype -%]
160
    [%- SWITCH account.accounttype -%]
121
        [%- CASE 'Pay'     -%]<span>Payment
161
        [%- CASE 'Pay'     -%]<span>Payment
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-1 / +22 lines)
Lines 149-156 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 ( amountoutstanding > 0 ) %]<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 ( amountoutstanding < 0 ) %]<li><a href="#opac-user-fines">Credits ([% amountoutstanding * -1 | $Price %])</a></li>[% END %]
153
                                [% IF ( amountoutstanding < 0 ) %]<li><a href="#opac-user-fines">Credits ([% amountoutstanding * -1 | $Price %])</a></li>[% END %]
154
                                [% IF relatives_with_fines %]<li><a href="#opac-user-relative-fines">Relatives' fines</a></li>[% END %]
154
                            [% END %]
155
                            [% END %]
155
156
156
                            [% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
157
                            [% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
Lines 411-416 Link Here
411
                                    </table>
412
                                    </table>
412
                                </div>
413
                                </div>
413
                            [% END %]
414
                            [% END %]
415
416
                            [% IF relatives_with_fines %]
417
                               <div id="opac-user-relative-fines"> <h3>Fines and charges</h3>
418
                                    <table class="table table-bordered table-striped">
419
                                        <thead>
420
                                            <tr>
421
                                                <th colspan="2">Amount</th>
422
                                            </tr>
423
                                        </thead>
424
                                        <tbody>
425
                                            [% FOREACH r IN relatives_with_fines %]
426
                                            <tr>
427
                                                <td>[% r.firstname %] [% r.surname %] currently owes fines and charges amounting to:</td>
428
                                                <td><a href="/cgi-bin/koha/opac-account.pl#g[% r.id %]">[% r.account.balance | $Price %]</a></td>
429
                                            </tr>
430
                                            [% END %]
431
                                        </tbody>
432
                                    </table>
433
                                </div>
434
                            [% END %]
414
                        [% END # / OPACFinesTab %]
435
                        [% END # / OPACFinesTab %]
415
436
416
                        [% IF relatives %]
437
                        [% IF relatives %]
(-)a/opac/opac-account.pl (+28 lines)
Lines 45-50 my $accountlines = $account->lines->search({ amountoutstanding => { '>=' => 0 }} Link Here
45
my $total_outstanding = $accountlines->total_outstanding;
45
my $total_outstanding = $accountlines->total_outstanding;
46
my $outstanding_credits = $account->outstanding_credits;
46
my $outstanding_credits = $account->outstanding_credits;
47
47
48
if ( C4::Context->preference('AllowPatronToSetFinesVisibilityForGuarantor')
49
    || C4::Context->preference('AllowStaffToSetFinesVisibilityForGuarantor')
50
  )
51
{
52
    my @relatives;
53
54
    # Filter out guarantees that don't want guarantor to see checkouts
55
    foreach my $gr ( $patron->guarantee_relationships() ) {
56
        my $g = $gr->guarantee;
57
        if ( $g->privacy_guarantor_fines ) {
58
59
            my $relatives_accountlines = Koha::Account::Lines->search(
60
                { borrowernumber => $g->borrowernumber },
61
                { order_by       => { -desc => 'accountlines_id' } }
62
            );
63
            push(
64
                @relatives,
65
                {
66
                    patron       => $g,
67
                    accountlines => $relatives_accountlines,
68
                }
69
            );
70
        }
71
    }
72
    $template->param( relatives => \@relatives );
73
}
74
75
48
$template->param(
76
$template->param(
49
    ACCOUNT_LINES       => $accountlines,
77
    ACCOUNT_LINES       => $accountlines,
50
    total               => $total_outstanding,
78
    total               => $total_outstanding,
(-)a/opac/opac-user.pl (-1 / +13 lines)
Lines 340-345 if ( C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor' Link Here
340
    $template->param( relatives => \@relatives );
340
    $template->param( relatives => \@relatives );
341
}
341
}
342
342
343
if (   C4::Context->preference('AllowPatronToSetFinesVisibilityForGuarantor')
344
    || C4::Context->preference('AllowStaffToSetFinesVisibilityForGuarantor') )
345
{
346
    my @relatives_with_fines;
347
    # Filter out guarantees that don't want guarantor to see checkouts
348
    foreach my $gr ( $patron->guarantee_relationships() ) {
349
        my $g = $gr->guarantee;
350
        push( @relatives_with_fines, $g ) if $g->privacy_guarantor_fines;
351
    }
352
    $template->param( relatives_with_fines => \@relatives_with_fines );
353
}
354
355
343
$template->param(
356
$template->param(
344
    patron_messages          => $patron_messages,
357
    patron_messages          => $patron_messages,
345
    opacnote                 => $borr->{opacnote},
358
    opacnote                 => $borr->{opacnote},
346
- 

Return to bug 20691