Bugzilla – Attachment 165685 Details for
Bug 36672
Circulation rules are performing too many lookups
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36672: Circulation rules are performing too many lookups
Bug-36672-Circulation-rules-are-performing-too-man.patch (text/plain), 3.56 KB, created by
Kyle M Hall
on 2024-04-26 17:51:15 UTC
(
hide
)
Description:
Bug 36672: Circulation rules are performing too many lookups
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2024-04-26 17:51:15 UTC
Size:
3.56 KB
patch
obsolete
>From d1accd539f9daff4dfa3feff975a70d3d200f405 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 26 Apr 2024 17:41:06 +0000 >Subject: [PATCH] Bug 36672: Circulation rules are performing too many lookups > >Looking at the template, for every section after the main rules block we loop over categories or itemtypes, and lookup the value for each rule name. > >In systems with large numbers of categories and item types this becomes very slow. > >In the rules section, we have already built a hash of rules by category and itemtype - we should continue to use this throughout the page. > >Test Plan: >1) Apply this patch >2) For each rule section, create, update and delete a rule >3) No change in behavior should be noted! >--- > .../prog/en/modules/admin/smart-rules.tt | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >index 0430b8ac10a..2f755206f3b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >@@ -993,7 +993,8 @@ > </tr> > [% FOREACH c IN categorycodes %] > [% NEXT UNLESS c %] >- [% SET open_article_requests_limit = CirculationRules.Search( branchcode, c, undef, 'open_article_requests_limit' ) %] >+ [% SET i = undef %] >+ [% SET open_article_requests_limit = all_rules.$c.$i.open_article_requests_limit %] > > [% IF ( open_article_requests_limit.defined && open_article_requests_limit != '' ) %] > <tr> >@@ -1047,9 +1048,8 @@ > <th> </th> > </tr> > [% FOREACH c IN categorycodes %] >- [% SET c = '*' UNLESS c.defined AND c != '' %] >- >- [% SET article_request_fee = CirculationRules.Search( current_branch, c, undef, 'article_request_fee' ) %] >+ [% SET i = undef %] >+ [% SET article_request_fee = all_rules.$c.$i.article_request_fee %] > > [% IF ( article_request_fee.defined && article_request_fee != '' ) %] > <tr> >@@ -1313,9 +1313,11 @@ > <th> </th> > </tr> > [% FOREACH i IN itemtypeloop %] >- [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %] >- [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %] >- [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %] >+ [% SET it = i.itemtype %] >+ [% SET c = undef %] >+ [% SET holdallowed = all_rules.$c.$it.holdallowed %] >+ [% SET hold_fulfillment_policy = all_rules.$c.$it.hold_fulfillment_policy %] >+ [% SET returnbranch = all_rules.$c.$it.returnbranch %] > > [% IF holdallowed || hold_fulfillment_policy || returnbranch %] > <tr> >-- >2.30.2
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 36672
:
165685
|
165687
|
166151
|
167393