Bug 20691: Implement fines view
This patch implements the logic to show guarantee's fines with guarantor user. To test: 1) Apply (if not already done) steps 1 to 5 of previous patch 2) Apply this patch 3) Set OPACFinesTab and AllowStaffToSetFinesVisibilityForGuarantor preference to "Allow" 4) Find a guarantee and in accounting create a manual invoice 5) Enter OPAC with guarantor user CHECK => In summary there is no "Relatives fines" tab 6) On intranet edit guarantee and set "Show fines to guarantors" to "Yes" and save 7) Reload guarantor's OPAC SUCCESS => You see a "Relatives fines" tab with guarantee's fines information 8) Sign off Signed-off-by: Agustin Moyano <agustinmoyano@theke.io> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
1ad03f5509
commit
5583a0a42c
|
|
@ -116,6 +116,46 @@
|
|||
<h4>You have no fines or charges</h4>
|
||||
[% END %]
|
||||
|
||||
[% FOREACH r IN relatives %]
|
||||
<h3 id="g[% r.patron.id %]">[% r.patron.firstname %] [% r.patron.surname %]'s fines and charges</h3>
|
||||
|
||||
<table class="table table-bordered table-striped" id="finestable-[% r.id %]">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="title-string">Date</th>
|
||||
<th>Description</th>
|
||||
<th>Fine amount</th>
|
||||
<th>Amount outstanding</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
[% SET account_sum = 0 %]
|
||||
[% FOREACH a IN r.accountlines %]
|
||||
[% SET account_sum = account_sum + a.amountoutstanding %]
|
||||
<tr>
|
||||
<td><span title="[% a.date %]">[% a.date | $KohaDates %]</span></td>
|
||||
<td>
|
||||
[% PROCESS account_type_description account=a %]
|
||||
[%- IF a.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', a.payment_type, 1) %][% END %]
|
||||
[%- IF a.description %], [% a.description %][% END %]
|
||||
[% IF a.itemnumber %]([% a.item.biblio.title %])[% END %]
|
||||
</td>
|
||||
[% IF ( a.amount < 0 ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% a.amount | $Price %]</td>
|
||||
[% IF ( a.amountoutstanding < 0 ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% a.amountoutstanding | $Price %]</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="sum" colspan="3">Total due</th>
|
||||
<td class="sum">[% account_sum | $Price %]</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
[% END %]
|
||||
|
||||
[%- BLOCK account_type_description -%]
|
||||
[%- SWITCH account.accounttype -%]
|
||||
[%- CASE 'Pay' -%]<span>Payment
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@
|
|||
[% IF ( OPACFinesTab ) %]
|
||||
[% IF ( amountoutstanding > 0 ) %]<li><a href="#opac-user-fines">Charges ([% amountoutstanding | $Price %])</a></li>[% END %]
|
||||
[% IF ( amountoutstanding < 0 ) %]<li><a href="#opac-user-fines">Credits ([% amountoutstanding * -1 | $Price %])</a></li>[% END %]
|
||||
[% IF relatives_with_fines %]<li><a href="#opac-user-relative-fines">Relatives' fines</a></li>[% END %]
|
||||
[% END %]
|
||||
|
||||
[% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
|
||||
|
|
@ -411,6 +412,26 @@
|
|||
</table>
|
||||
</div>
|
||||
[% END %]
|
||||
|
||||
[% IF relatives_with_fines %]
|
||||
<div id="opac-user-relative-fines"> <h3>Fines and charges</h3>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% FOREACH r IN relatives_with_fines %]
|
||||
<tr>
|
||||
<td>[% r.firstname %] [% r.surname %] currently owes fines and charges amounting to:</td>
|
||||
<td><a href="/cgi-bin/koha/opac-account.pl#g[% r.id %]">[% r.account.balance | $Price %]</a></td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
[% END %]
|
||||
[% END # / OPACFinesTab %]
|
||||
|
||||
[% IF relatives %]
|
||||
|
|
|
|||
|
|
@ -45,6 +45,34 @@ my $accountlines = $account->lines->search({ amountoutstanding => { '>=' => 0 }}
|
|||
my $total_outstanding = $accountlines->total_outstanding;
|
||||
my $outstanding_credits = $account->outstanding_credits;
|
||||
|
||||
if ( C4::Context->preference('AllowPatronToSetFinesVisibilityForGuarantor')
|
||||
|| C4::Context->preference('AllowStaffToSetFinesVisibilityForGuarantor')
|
||||
)
|
||||
{
|
||||
my @relatives;
|
||||
|
||||
# Filter out guarantees that don't want guarantor to see checkouts
|
||||
foreach my $gr ( $patron->guarantee_relationships() ) {
|
||||
my $g = $gr->guarantee;
|
||||
if ( $g->privacy_guarantor_fines ) {
|
||||
|
||||
my $relatives_accountlines = Koha::Account::Lines->search(
|
||||
{ borrowernumber => $g->borrowernumber },
|
||||
{ order_by => { -desc => 'accountlines_id' } }
|
||||
);
|
||||
push(
|
||||
@relatives,
|
||||
{
|
||||
patron => $g,
|
||||
accountlines => $relatives_accountlines,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
$template->param( relatives => \@relatives );
|
||||
}
|
||||
|
||||
|
||||
$template->param(
|
||||
ACCOUNT_LINES => $accountlines,
|
||||
total => $total_outstanding,
|
||||
|
|
|
|||
|
|
@ -339,6 +339,19 @@ if ( C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor'
|
|||
$template->param( relatives => \@relatives );
|
||||
}
|
||||
|
||||
if ( C4::Context->preference('AllowPatronToSetFinesVisibilityForGuarantor')
|
||||
|| C4::Context->preference('AllowStaffToSetFinesVisibilityForGuarantor') )
|
||||
{
|
||||
my @relatives_with_fines;
|
||||
# Filter out guarantees that don't want guarantor to see checkouts
|
||||
foreach my $gr ( $patron->guarantee_relationships() ) {
|
||||
my $g = $gr->guarantee;
|
||||
push( @relatives_with_fines, $g ) if $g->privacy_guarantor_fines;
|
||||
}
|
||||
$template->param( relatives_with_fines => \@relatives_with_fines );
|
||||
}
|
||||
|
||||
|
||||
$template->param(
|
||||
patron_messages => $patron_messages,
|
||||
opacnote => $borr->{opacnote},
|
||||
|
|
|
|||
Loading…
Reference in New Issue