Bugzilla – Attachment 74971 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), 10.64 KB, created by
Kyle M Hall (khall)
on 2018-05-02 13:13:53 UTC
(
hide
)
Description:
Bug 20691 - Implement fines view
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-05-02 13:13:53 UTC
Size:
10.64 KB
patch
obsolete
>From 8b5bdef669ba97446c6a09a4189a7da0e5d6a079 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 2 May 2018 13:12:02 +0000 >Subject: [PATCH] Bug 20691 - Implement fines view > >--- > circ/circulation.pl | 4 +- > .../opac-tmpl/bootstrap/en/modules/opac-account.tt | 62 ++++++++++++++++++++++ > .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 22 ++++++++ > opac/opac-account.pl | 27 ++++++++++ > opac/opac-user.pl | 12 +++++ > 5 files changed, 125 insertions(+), 2 deletions(-) > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index e82d036cb8..2bb5211fe1 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -503,8 +503,8 @@ if ( $patron ) { > $no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees ); > if ( defined $no_issues_charge_guarantees ) { > my $guarantees_non_issues_charges = 0; >- my $guarantees = $patron->guarantees; >- while ( my $g = $guarantees->next ) { >+ my $guarantees = $patron->guarantee_relationships->guarantees; >+ while ( my $g = $guarantees->next ) { #FIXME - Belongs in 14570 > $guarantees_non_issues_charges += $g->account->non_issues_charges; > } > if ( $guarantees_non_issues_charges > $no_issues_charge_guarantees ) { >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt >index d5b5e346ec..072e4d87c8 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt >@@ -177,6 +177,68 @@ > [% ELSE %] > <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> >+ [% SWITCH a.accounttype %] >+ [% CASE 'Pay' %]Payment, thanks >+ [% CASE 'Pay00' %]Payment, thanks (cash via SIP2) >+ [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2) >+ [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2) >+ [% CASE 'N' %]New card >+ [% CASE 'F' %]Fine >+ [% CASE 'A' %]Account management fee >+ [% CASE 'M' %]Sundry >+ [% CASE 'L' %]Lost item >+ [% CASE 'W' %]Writeoff >+ [% CASE 'FU' %]Accruing fine >+ [% CASE 'HE' %]Hold waiting too long >+ [% CASE 'Rent' %]Rental fee >+ [% CASE 'FOR' %]Forgiven >+ [% CASE 'LR' %]Lost item fee refund >+ [% CASE 'PF' %]Processing fee >+ [% CASE 'PAY' %]Payment >+ [% CASE 'WO' %]Writeoff >+ [% CASE 'C' %]Credit >+ [% CASE 'CR' %]Credit >+ [% CASE %][% a.accounttype %] >+ [%- END -%] >+ [%- 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 %] > </div> <!-- / #useraccount --> > </div> <!-- / .span10 --> > </div> <!-- / .row-fluid --> >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 4c87896b50..453d1aabfd 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -133,6 +133,8 @@ > [% IF ( BORROWER_INFO.amountoverfive ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %] > [% IF ( BORROWER_INFO.amountoverzero ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %] > [% IF ( BORROWER_INFO.amountlessthanzero ) %]<li><a href="#opac-user-fines">Credits ([% amountoutstanding | $Price %])</a></li>[% END %] >+ >+ [% IF relatives %]<li><a href="#opac-user-relative-fines">Relatives' fines</a></li>[% END %] > [% END %] > > [% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %] >@@ -396,6 +398,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 9611554b58..6d9c222fe6 100755 >--- a/opac/opac-account.pl >+++ b/opac/opac-account.pl >@@ -67,6 +67,33 @@ while ( my $line = $accts->next ) { > push @accountlines, $accountline; > } > >+if ( C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') >+ || C4::Context->preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') >+ ) >+{ >+ 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_checkouts ) { >+ >+ 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 => sprintf( "%.2f", $total ), # FIXME Use TT plugin Price >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index a40cb60c5a..b4acebbec2 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -350,6 +350,18 @@ 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( > borrower => scalar Koha::Patrons->find($borrowernumber), > patron_messages => $patron_messages, >-- >2.15.1 (Apple Git-101)
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