Bugzilla – Attachment 92387 Details for
Bug 20691
Add ability for guarantors to view guarantee's fines in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20691: Implement fines view
Bug-20691-Implement-fines-view.patch (text/plain), 8.47 KB, created by
Agustín Moyano
on 2019-08-20 18:24:21 UTC
(
hide
)
Description:
Bug 20691: Implement fines view
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2019-08-20 18:24:21 UTC
Size:
8.47 KB
patch
obsolete
>From 7aa9934bf8ee65ca36d11f4ac1ccbc2b20e7628b Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatetsolutions.com> >Date: Wed, 22 May 2019 03:20:13 -0300 >Subject: [PATCH] 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> >--- > .../bootstrap/en/includes/account-table.inc | 40 +++++++++++++++++++ > .../bootstrap/en/modules/opac-user.tt | 23 ++++++++++- > opac/opac-account.pl | 28 +++++++++++++ > opac/opac-user.pl | 13 ++++++ > 4 files changed, 103 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc >index 6705ad5dcd..0137ca2305 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc >@@ -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 >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >index 40f5eed3a4..abf298407e 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -149,8 +149,9 @@ > [% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %] > [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue ([% overdues_count | html %])</a></li>[% END %] > [% IF ( OPACFinesTab ) %] >- [% IF ( amountoutstanding > 0 ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %] >+ [% IF ( amountoutstanding > 0 ) %]<li><a href="#opac-user-fines">Fines ([% 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 %] >diff --git a/opac/opac-account.pl b/opac/opac-account.pl >index d5677fc1b3..8ba2ba33f8 100755 >--- a/opac/opac-account.pl >+++ b/opac/opac-account.pl >@@ -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, >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 360ed6ebfc..8eac2478a6 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -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}, >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20691
:
74968
|
74969
|
74970
|
74971
|
74972
|
74973
|
74974
|
74975
|
89951
|
89952
|
89953
|
89990
|
89991
|
89992
|
89993
|
90093
|
90094
|
90095
|
90096
|
91025
|
91026
|
91159
|
91160
|
91161
|
91162
|
92385
|
92386
|
92387
|
92388
|
92485
|
92700
|
92701
|
92702
|
92703
|
92704
|
92705
|
92897