Bugzilla – Attachment 87065 Details for
Bug 22588
Simplify getting account information in opac and self checkout module
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22588: Simplify getting fines information in opac and selfcheckout
Bug-22588-Simplify-getting-fines-information-in-op.patch (text/plain), 11.28 KB, created by
Owen Leonard
on 2019-03-27 12:42:15 UTC
(
hide
)
Description:
Bug 22588: Simplify getting fines information in opac and selfcheckout
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2019-03-27 12:42:15 UTC
Size:
11.28 KB
patch
obsolete
>From 7bb40bd99c8e5e03d01b663326f7f564041f0040 Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Wed, 27 Mar 2019 08:27:13 +0000 >Subject: [PATCH] Bug 22588: Simplify getting fines information in opac and > selfcheckout > >Test plan: >0) Have patron with some fines and credits >1) Go to opac and log in >2) Go to 'your summary' page and confirm it shows the right amount and >description for both, credit and debit >3) Go to 'your fines' page and confirm it show right information >4) Go to self checkout page and confirm the fines are right here > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > .../bootstrap/en/includes/account-table.inc | 10 ++++----- > .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 25 +++++----------------- > opac/opac-account.pl | 21 +++--------------- > opac/opac-user.pl | 11 ---------- > opac/sco/sco-main.pl | 23 ++++---------------- > 5 files changed, 17 insertions(+), 73 deletions(-) > >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 a73da77..656b90f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc >@@ -15,7 +15,7 @@ > > <tbody> > [% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %] >- [% IF ( ACCOUNT_LINE.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %] >+ <tr> > [% IF ENABLE_OPAC_PAYMENTS %] > <td> > [% IF ACCOUNT_LINE.amountoutstanding > 0 %] >@@ -52,10 +52,10 @@ > [%- END -%] > [%- IF ACCOUNT_LINE.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', ACCOUNT_LINE.payment_type, 1) | html %][% END %] > [%- IF ACCOUNT_LINE.description %], [% ACCOUNT_LINE.description | html %][% END %] >- [% IF ACCOUNT_LINE.title %]([% ACCOUNT_LINE.title | html %])[% END %] >+ [% IF ACCOUNT_LINE.itemnumber %]([% ACCOUNT_LINE.item.biblio.title | html %])[% END %] > </td> >- [% IF ( ACCOUNT_LINE.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amount | $Price %]</td> >- [% IF ( ACCOUNT_LINE.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amountoutstanding | $Price %]</td> >+ [% IF ( ACCOUNT_LINE.amount <= 0 ) %]<td class="credit">[% ACCOUNT_LINE.amount * -1 | $Price %][% ELSE %]<td class="debit">[% ACCOUNT_LINE.amount | $Price %][% END %]</td> >+ [% IF ( ACCOUNT_LINE.amountoutstanding <= 0 ) %]<td class="credit">[% ACCOUNT_LINE.amountoutstanding * -1 | $Price %][% ELSE %]<td class="debit">[% ACCOUNT_LINE.amountoutstanding | $Price %][% END %]</td> > </tr> > [% END %] > </tbody> >@@ -109,4 +109,4 @@ > </form> > [% ELSE %] > <h4>You have no fines or charges</h4> >-[% END %] >\ No newline at end of file >+[% END %] >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 6f074a8..12aad6b 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -149,9 +149,8 @@ > [% 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 ( borrower.amountoverfive ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %] >- [% IF ( borrower.amountoverzero ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %] >- [% IF ( borrower.amountlessthanzero ) %]<li><a href="#opac-user-fines">Credits ([% 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 %] > [% END %] > > [% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %] >@@ -386,7 +385,7 @@ > > [% IF ( OPACFinesTab ) %] > <!-- FINES BOX --> >- [% IF borrower.amountoverfive %] >+ [% IF ( amountoutstanding > 0 ) %] > <div id="opac-user-fines"> <h3>Fines and charges</h3> > <table class="table table-bordered table-striped"> > <thead><tr><th colspan="2">Amount</th></tr></thead> >@@ -400,27 +399,13 @@ > </div> > [% END %] > >- [% IF borrower.amountoverzero %] >- <div id="opac-user-fines"> <h3>Fines and charges</h3> >- <table class="table table-bordered table-striped"> >- <thead><tr><th colspan="2">Amount</th></tr></thead> >- <tbody> >- <tr> >- <td>You currently owe fines and charges amounting to:</td> >- <td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding | $Price %]</a></td> >- </tr> >- </tbody> >- </table> >- </div> >- [% END %] >- >- [% IF borrower.amountlessthanzero %] >+ [% IF ( amountoutstanding < 0 ) %] > <div id="opac-user-fines"> <h3>Credits</h3> > <table class="table table-bordered table-striped"> > <thead><tr><th colspan="2">Amount</th></tr></thead> > <tbody> > <tr> >- <td>You have a credit of:</td><td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding | $Price %]</a></td> >+ <td>You have a credit of:</td><td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding * -1 | $Price %]</a></td> > </tr> > </tbody> > </table> >diff --git a/opac/opac-account.pl b/opac/opac-account.pl >index 2cbbf4e..4e4d789 100755 >--- a/opac/opac-account.pl >+++ b/opac/opac-account.pl >@@ -41,29 +41,14 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > > my $patron = Koha::Patrons->find( $borrowernumber ); > my $total = $patron->account->balance; >-my $accts = Koha::Account::Lines->search( >+my @accts = Koha::Account::Lines->search( > { borrowernumber => $patron->borrowernumber }, > { order_by => { -desc => 'accountlines_id' } } > ); > >-my @accountlines; >-while ( my $line = $accts->next ) { >- my $accountline = $line->unblessed; >- $accountline->{'amount'} = sprintf( "%.2f", $accountline->{'amount'} || '0.00'); >- if ( $accountline->{'amount'} >= 0 ) { >- $accountline->{'amountcredit'} = 1; >- } >- $accountline->{'amountoutstanding'} = >- sprintf( "%.2f", $accountline->{'amountoutstanding'} || '0.00' ); >- if ( $accountline->{'amountoutstanding'} >= 0 ) { >- $accountline->{'amountoutstandingcredit'} = 1; >- } >- push @accountlines, $accountline; >-} >- > $template->param( >- ACCOUNT_LINES => \@accountlines, >- total => sprintf( "%.2f", $total ), # FIXME Use TT plugin Price >+ ACCOUNT_LINES => \@accts, >+ total => $total, > accountview => 1, > message => scalar $query->param('message') || q{}, > message_value => scalar $query->param('message_value') || q{}, >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 1fde24b..bd638af 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -120,12 +120,6 @@ if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) { > } > > my $amountoutstanding = $patron->account->balance; >-if ( $amountoutstanding > 5 ) { >- $borr->{'amountoverfive'} = 1; >-} >-if ( 5 >= $amountoutstanding && $amountoutstanding > 0 ) { >- $borr->{'amountoverzero'} = 1; >-} > my $no_renewal_amt = C4::Context->preference( 'OPACFineNoRenewals' ); > $no_renewal_amt = undef unless looks_like_number( $no_renewal_amt ); > >@@ -141,11 +135,6 @@ if ( C4::Context->preference('OpacRenewalAllowed') > ); > } > >-if ( $amountoutstanding < 0 ) { >- $borr->{'amountlessthanzero'} = 1; >- $amountoutstanding = -1 * ( $amountoutstanding ); >-} >- > # Warningdate is the date that the warning starts appearing > if ( $borr->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') ) { > my $days_to_expiry = Date_to_Days( $warning_year, $warning_month, $warning_day ) - Date_to_Days( $today_year, $today_month, $today_day ); >diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl >index 7fd6ee8..46e84ce 100755 >--- a/opac/sco/sco-main.pl >+++ b/opac/sco/sco-main.pl >@@ -278,26 +278,11 @@ if ($borrower) { > } > > my $total = $patron->account->balance; >- my $accts = Koha::Account::Lines->search( >+ my @accts = Koha::Account::Lines->search( > { borrowernumber => $borrower->{borrowernumber} }, > { order_by => { -desc => 'accountlines_id' } } > ); > >- my @accountlines; >- while ( my $line = $accts->next ) { >- my $accountline = $line->unblessed; >- $accountline->{'amount'} = sprintf( "%.2f", $accountline->{'amount'} || '0.00'); >- if ( $accountline->{'amount'} >= 0 ) { >- $accountline->{'amountcredit'} = 1; >- } >- $accountline->{'amountoutstanding'} = >- sprintf( "%.2f", $accountline->{'amountoutstanding'} || '0.00' ); >- if ( $accountline->{'amountoutstanding'} >= 0 ) { >- $accountline->{'amountoutstandingcredit'} = 1; >- } >- push @accountlines, $accountline; >- } >- > my $holds = $patron->holds; > > $template->param( >@@ -314,9 +299,9 @@ if ($borrower) { > borrowernumber => $borrower->{'borrowernumber'}, > SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'), > AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'), >- showpriority => $show_priority, >- ACCOUNT_LINES => \@accountlines, >- total => sprintf( "%.2f", $total ), >+ howpriority => $show_priority, >+ ACCOUNT_LINES => \@accts, >+ total => $total, > ); > > my $patron_messages = Koha::Patron::Messages->search( >-- >2.1.4
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 22588
:
87049
|
87065
|
87131
|
87350
|
87351
|
88021
|
88022