Bugzilla – Attachment 193834 Details for
Bug 41917
Parent itemtype fallback missing for bookable flag and circulation rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41917: (QA follow-up) Avoid extra SELECT in get_effective_rule fallback
3da41a9.patch (text/plain), 1.53 KB, created by
Martin Renvoize (ashimema)
on 2026-02-25 07:32:12 UTC
(
hide
)
Description:
Bug 41917: (QA follow-up) Avoid extra SELECT in get_effective_rule fallback
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-02-25 07:32:12 UTC
Size:
1.53 KB
patch
obsolete
>From 3da41a95ce9234e7029156f010b064446a64df7a Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Wed, 25 Feb 2026 06:31:13 +0000 >Subject: [PATCH] Bug 41917: (QA follow-up) Avoid extra SELECT in > get_effective_rule fallback > >The parent itemtype fallback in get_effective_rule called >$itemtype_obj->parent, which uses the DBIx::Class belongs_to >relationship accessor and issues a second SELECT to load the full >parent row. Only the parent's itemtype code is needed for the >subsequent search, so replace it with $itemtype_obj->parent_type >which goes through Koha::Object's AUTOLOAD and reads the already- >fetched column value directly with no extra query. > >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > Koha/CirculationRules.pm | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > >diff --git a/Koha/CirculationRules.pm b/Koha/CirculationRules.pm >index 37df584ceb6..9b49ee46d11 100644 >--- a/Koha/CirculationRules.pm >+++ b/Koha/CirculationRules.pm >@@ -302,11 +302,11 @@ sub get_effective_rule { > my $itemtype_obj = Koha::ItemTypes->find($itemtype); > return $rule unless $itemtype_obj; > >- my $parent = $itemtype_obj->parent; >- return $rule unless $parent; >+ my $parent_type = $itemtype_obj->parent_type; >+ return $rule unless $parent_type; > > my $parent_search = {%$search_params}; >- $parent_search->{itemtype} = [ $parent->itemtype, undef ]; >+ $parent_search->{itemtype} = [ $parent_type, undef ]; > > my $parent_rule = $self->search( > $parent_search, >-- >2.53.0 >
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 41917
:
193776
|
193778
|
193779
|
193780
|
193799
|
193827
|
193828
|
193829
|
193830
|
193831
|
193832
|
193833
| 193834