Bugzilla – Attachment 77066 Details for
Bug 12001
GetMemberAccountRecords slows down display of patron details and checkout pages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12001: [17.11.X] Remove simple calls to GetMemberAccountRecords
Bug-12001-1711X-Remove-simple-calls-to-GetMemberAc.patch (text/plain), 4.22 KB, created by
Nick Clemens (kidclamp)
on 2018-07-18 11:39:50 UTC
(
hide
)
Description:
Bug 12001: [17.11.X] Remove simple calls to GetMemberAccountRecords
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-07-18 11:39:50 UTC
Size:
4.22 KB
patch
obsolete
>From 8e2d03f551921b4245fbfeda5e9c8d598e462db8 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 18 Jul 2018 11:36:36 +0000 >Subject: [PATCH] Bug 12001: [17.11.X] Remove simple calls to > GetMemberAccountRecords > >I chose not to backport the main patchset as it was big and didn't apply >clean, however, this problem seems to be an issue in 17.11.x > >This patchset removes the calls where only the total is fetched/used > >Please consider for backport > >To test: >1 - Have a patron with some fines >2 - View these pages and confirm fine amounts display: > circ/circulation.pl > opac/opac-main.pl > opac/opac-reserve.pl > opac/opac-user.pl > reserve/request.pl >3 - Apply patch >4 - View pages again, confirm fines display correctly and no errors >--- > circ/circulation.pl | 2 +- > opac/opac-main.pl | 4 +++- > opac/opac-reserve.pl | 3 ++- > opac/opac-user.pl | 4 +++- > reserve/request.pl | 2 +- > 5 files changed, 10 insertions(+), 5 deletions(-) > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 74ce477..1326246 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -543,7 +543,7 @@ foreach my $flag ( sort keys %$flags ) { > my $amountold = $flags ? $flags->{'CHARGES'}->{'message'} || 0 : 0; > $amountold =~ s/^.*\$//; # remove upto the $, if any > >-my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber ); >+my $total = $patron ? $patron->account->balance : 0; > > if ( $patron && $patron->category->category_type eq 'C') { > my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >diff --git a/opac/opac-main.pl b/opac/opac-main.pl >index a397627..37b9292 100755 >--- a/opac/opac-main.pl >+++ b/opac/opac-main.pl >@@ -29,6 +29,7 @@ use C4::Members; > use C4::Overdues; > use Koha::Checkouts; > use Koha::Holds; >+use Koha::Patrons; > > my $input = new CGI; > my $dbh = C4::Context->dbh; >@@ -72,7 +73,8 @@ if ( defined $borrowernumber ){ > my ( $overdues_count, $overdues ) = checkoverdues($borrowernumber); > my $holds_pending = Koha::Holds->search({ borrowernumber => $borrowernumber, found => undef })->count; > my $holds_waiting = Koha::Holds->search({ borrowernumber => $borrowernumber })->waiting->count; >- my ( $total , $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber ); >+ my $patron = Koha::Patrons->find( $borrowernumber ); >+ my $total = $patron ? $patron->account->balance : 0; > > if ( $checkouts > 0 || $overdues_count > 0 || $holds_pending > 0 || $holds_waiting > 0 || $total > 0 ) { > $template->param( dashboard_info => 1 ); >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 95204b3..68128de 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -329,7 +329,8 @@ if ( $query->param('place_reserve') ) { > my $noreserves = 0; > my $maxoutstanding = C4::Context->preference("maxoutstanding"); > $template->param( noreserve => 1 ) unless $maxoutstanding; >-my ( $amountoutstanding ) = GetMemberAccountRecords($borrowernumber); >+my $amountoutstanding = $patron ? $patron->account->balance : 0; >+ > if ( $amountoutstanding && ($amountoutstanding > $maxoutstanding) ) { > my $amount = sprintf "%.02f", $amountoutstanding; > $template->param( message => 1 ); >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 55c04a3..b051ecd 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -116,7 +116,9 @@ if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) { > $canrenew = 0; > } > >-my ( $amountoutstanding ) = GetMemberAccountRecords($borrowernumber); >+my $patron = Koha::Patrons->find( $borrowernumber ); >+my $amountoutstanding = $patron ? $patron->account->balance : 0; >+ > if ( $amountoutstanding > 5 ) { > $borr->{'amountoverfive'} = 1; > } >diff --git a/reserve/request.pl b/reserve/request.pl >index 8cedeac..2ea19ba 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -198,7 +198,7 @@ if ($borrowernumber_hold && !$action) { > messages => $messages, > warnings => $warnings, > restricted => $is_debarred, >- amount_outstanding => GetMemberAccountRecords($patron->borrowernumber), >+ amount_outstanding => $patron->account->balance, > ); > } > >-- >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 12001
:
70314
|
70342
|
70343
|
70344
|
70345
|
70346
|
71798
|
71799
|
71800
|
71801
|
71802
|
71852
|
71853
|
71854
|
71855
|
71856
|
71857
|
71979
|
71980
|
71981
|
71982
|
71983
|
71984
|
71985
|
71986
|
71987
|
71988
|
77066
|
77136
|
77278
|
77279