Bugzilla – Attachment 169318 Details for
Bug 37389
REST API queries joining on extended_attributes may cause severe performance issues
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37389: Apply ExtendedAttributes Mixin to AdditionalFields
Bug-37389-Apply-ExtendedAttributes-Mixin-to-Additi.patch (text/plain), 4.00 KB, created by
Pedro Amorim
on 2024-07-22 16:20:26 UTC
(
hide
)
Description:
Bug 37389: Apply ExtendedAttributes Mixin to AdditionalFields
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-07-22 16:20:26 UTC
Size:
4.00 KB
patch
obsolete
>From c226a8522e1b35e28432ddd24d1b8540a6606729 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Mon, 22 Jul 2024 16:14:38 +0000 >Subject: [PATCH] Bug 37389: Apply ExtendedAttributes Mixin to AdditionalFields > >This is only applied to subscription for now. More are missing >--- > Koha/ILL/Requests.pm | 3 ++- > Koha/Object/Mixin/AdditionalFields.pm | 2 ++ > Koha/Objects/Mixin/AdditionalFields.pm | 13 +++++++++++++ > Koha/Objects/Mixin/ExtendedAttributes.pm | 4 ++-- > Koha/Patrons.pm | 3 ++- > Koha/Subscription.pm | 8 ++++++++ > 6 files changed, 29 insertions(+), 4 deletions(-) > >diff --git a/Koha/ILL/Requests.pm b/Koha/ILL/Requests.pm >index f10e6edd6f..39ca48d3e9 100644 >--- a/Koha/ILL/Requests.pm >+++ b/Koha/ILL/Requests.pm >@@ -112,8 +112,9 @@ sub search_incomplete { > =cut > > sub extended_attributes_config { >+ my ( $self ) = @_; > return { >- 'id_field' => 'illrequest_id', >+ 'id_field' => { 'foreign' => 'illrequest_id', 'self' => 'illrequest_id' }, > 'key_field' => 'type', > 'schema_class' => 'Koha::Schema::Result::Illrequestattribute', > }; >diff --git a/Koha/Object/Mixin/AdditionalFields.pm b/Koha/Object/Mixin/AdditionalFields.pm >index bf6598d8c9..eaeebbde1c 100644 >--- a/Koha/Object/Mixin/AdditionalFields.pm >+++ b/Koha/Object/Mixin/AdditionalFields.pm >@@ -4,6 +4,8 @@ use Modern::Perl; > use Koha::AdditionalFields; > use Koha::AdditionalFieldValues; > >+use base qw(Koha::Objects::Mixin::ExtendedAttributes); >+ > =head1 NAME > > Koha::Object::Mixin::AdditionalFields >diff --git a/Koha/Objects/Mixin/AdditionalFields.pm b/Koha/Objects/Mixin/AdditionalFields.pm >index a412d3215a..a383abf865 100644 >--- a/Koha/Objects/Mixin/AdditionalFields.pm >+++ b/Koha/Objects/Mixin/AdditionalFields.pm >@@ -56,6 +56,19 @@ sub filter_by_additional_fields { > return $class->search(\%conditions, { join => [ ('additional_field_values') x $idx ] }); > } > >+=head3 extended_attributes_config >+ >+=cut >+ >+sub extended_attributes_config { >+ my ($self) = @_; >+ return { >+ 'id_field' => { 'foreign' => 'record_id', 'self' => $self->extended_attributes_record_id_field }, >+ 'key_field' => 'field_id', >+ 'schema_class' => 'Koha::Schema::Result::AdditionalFieldValue', >+ }; >+} >+ > =head1 AUTHOR > > Koha Development Team <http://koha-community.org/> >diff --git a/Koha/Objects/Mixin/ExtendedAttributes.pm b/Koha/Objects/Mixin/ExtendedAttributes.pm >index f4d4420d47..01c646af75 100644 >--- a/Koha/Objects/Mixin/ExtendedAttributes.pm >+++ b/Koha/Objects/Mixin/ExtendedAttributes.pm >@@ -49,8 +49,8 @@ sub _build_extended_attributes_relations { > my $args = shift; > > return { >- "$args->{foreign_alias}.$ea_config->{id_field}" => >- { -ident => "$args->{self_alias}.$ea_config->{id_field}" }, >+ "$args->{foreign_alias}.$ea_config->{id_field}->{foreign}" => >+ { -ident => "$args->{self_alias}.$ea_config->{id_field}->{self}" }, > "$args->{foreign_alias}.$ea_config->{key_field}" => { '=', $type }, > }; > }, >diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm >index 3f11d3d326..813d741c2a 100644 >--- a/Koha/Patrons.pm >+++ b/Koha/Patrons.pm >@@ -571,8 +571,9 @@ sub filter_by_have_permission { > =cut > > sub extended_attributes_config { >+ my ( $self ) = @_; > return { >- 'id_field' => 'borrowernumber', >+ 'id_field' => { 'foreign' => 'borrowernumber', 'self' => 'borrowernumber' }, > 'key_field' => 'code', > 'schema_class' => 'Koha::Schema::Result::BorrowerAttribute', > }; >diff --git a/Koha/Subscription.pm b/Koha/Subscription.pm >index 45d1c09fa0..46e3485f88 100644 >--- a/Koha/Subscription.pm >+++ b/Koha/Subscription.pm >@@ -195,6 +195,14 @@ sub get_sharable_info { > } > > >+=head3 extended_attributes_record_id_field >+ >+=cut >+ >+sub extended_attributes_record_id_field { >+ return 'subscriptionid'; >+} >+ > =head3 _type > > =cut >-- >2.39.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 37389
:
169130
|
169133
|
169140
|
169149
|
169159
|
169178
|
169185
|
169189
|
169191
|
169192
|
169234
|
169243
|
169244
|
169245
|
169246
|
169317
|
169318
|
169569
|
169570
|
169583
|
169584
|
169585
|
169586
|
169850
|
169851
|
169944
|
169945
|
169946
|
169954
|
169955
|
169956