Bugzilla – Attachment 99442 Details for
Bug 23966
Library transfer limits editor unusable for sites with many libraries and ccodes/itemtypes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23966 - Branch Transfer Limits editor unusable for sites with many libraries and ccodes/itemtypes
Bug-23966---Branch-Transfer-Limits-editor-unusable.patch (text/plain), 2.95 KB, created by
Bouzid Fergani
on 2020-02-21 20:53:36 UTC
(
hide
)
Description:
Bug 23966 - Branch Transfer Limits editor unusable for sites with many libraries and ccodes/itemtypes
Filename:
MIME Type:
Creator:
Bouzid Fergani
Created:
2020-02-21 20:53:36 UTC
Size:
2.95 KB
patch
obsolete
>From 1b0d7b60b89c61a31cfadb397dcc7c966ab8c847 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 4 Nov 2019 10:59:26 -0500 >Subject: [PATCH] Bug 23966 - Branch Transfer Limits editor unusable for sites > with many libraries and ccodes/itemtypes > >Right now the branch transfer limits editor works fine if an instance has a small number of libraries >and ccodes/itemtypes, but for large consortia who may have over 100 branches and ccodes/itemtypes, >the editor page can take literal minutes to load ( we have partners where the page load time is 7-8 minutes ). > >This is because we run a separate database query for each limit. We should use a single query to find all the limits for this page. > >Test Plan: >1) Enable BranchTransferLimits >2) Create some limits, test adding and removing limits >3) Apply this patch >4) Restart all the things! >5) Reload the page, you should see the same limits in place as before >6) Test adding and removing limits, everything should behave the same > as it did before the patch was applied! > >Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com> >--- > admin/branch_transfer_limits.pl | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > >diff --git a/admin/branch_transfer_limits.pl b/admin/branch_transfer_limits.pl >index 82a8d21..38b70a5 100755 >--- a/admin/branch_transfer_limits.pl >+++ b/admin/branch_transfer_limits.pl >@@ -25,7 +25,8 @@ use C4::Auth; > use C4::Context; > use C4::Output; > use C4::Koha; >-use C4::Circulation qw{ IsBranchTransferAllowed DeleteBranchTransferLimits CreateBranchTransferLimit }; >+use C4::Circulation qw{ DeleteBranchTransferLimits CreateBranchTransferLimit }; >+use Koha::Item::Transfer::Limits; > > my $input = new CGI; > >@@ -75,7 +76,6 @@ while ( my $row = $sth->fetchrow_hashref ) { > if ( $input->param('updateLimits') ) { > DeleteBranchTransferLimits($branchcode); > >- > foreach my $code ( @codes ) { > foreach my $toBranch ( @branchcodes ) { > my $isSet = not $input->param( $code . "_" . $toBranch); >@@ -95,6 +95,12 @@ foreach my $branchcode ( @branchcodes ) { > } > my $branchcount = scalar(@branchcode_loop); > >+my $limits_rs = Koha::Item::Transfer::Limits->search( { fromBranch => $branchcode } ); >+my $limits = {}; >+while ( my $l = $limits_rs->next ) { >+ $limits->{ $l->toBranch } = $l->$limitType; >+} >+ > ## Build the default data > my @codes_loop; > foreach my $code ( @codes ) { >@@ -104,17 +110,15 @@ foreach my $code ( @codes ) { > $row_data{ to_branch_loop } = \@to_branch_loop; > foreach my $toBranch ( @branchcodes ) { > my %row_data; >- my $isChecked = IsBranchTransferAllowed( $toBranch, $branchcode, $code ); > $row_data{ code } = $code; > $row_data{ toBranch } = $toBranch; >- $row_data{ isChecked } = $isChecked; >+ $row_data{ isChecked } = $limits->{ $toBranch } ? 0 : 1; > push( @to_branch_loop, \%row_data ); > } > > push( @codes_loop, \%row_data ); > } > >- > $template->param( > branchcount => $branchcount, > codes_loop => \@codes_loop, >-- >2.7.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 23966
:
95024
|
99442
|
99443