From 6e06d517b382b9e189454716014c44427371f1af Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 30 Nov 2023 11:48:41 +0000 Subject: [PATCH] Bug 35451: Update relations --- Koha/Schema/Result/Accountline.pm | 4 +--- Koha/Schema/Result/Aqbasket.pm | 4 +--- Koha/Schema/Result/Aqinvoice.pm | 4 +--- Koha/Schema/Result/Aqorder.pm | 5 +---- Koha/Schema/Result/Subscription.pm | 4 +--- 5 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Koha/Schema/Result/Accountline.pm b/Koha/Schema/Result/Accountline.pm index d1ba673cf2d..793699b3b3b 100644 --- a/Koha/Schema/Result/Accountline.pm +++ b/Koha/Schema/Result/Accountline.pm @@ -447,9 +447,7 @@ __PACKAGE__->has_many( return { "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.accountlines_id" }, - - "$args->{foreign_alias}.field_id" => - { -in => \'(SELECT id FROM additional_fields WHERE tablename LIKE "accountlines:%")' }, + "$args->{foreign_alias}.record_table" => __PACKAGE__->table, }; }, { cascade_copy => 0, cascade_delete => 0 }, diff --git a/Koha/Schema/Result/Aqbasket.pm b/Koha/Schema/Result/Aqbasket.pm index eb2ce481b79..7150aaececb 100644 --- a/Koha/Schema/Result/Aqbasket.pm +++ b/Koha/Schema/Result/Aqbasket.pm @@ -352,9 +352,7 @@ __PACKAGE__->has_many( return { "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.basketno" }, - - "$args->{foreign_alias}.field_id" => - { -in => \'(SELECT id FROM additional_fields WHERE tablename = "aqbasket")' }, + "$args->{foreign_alias}.record_table" => __PACKAGE__->table, }; }, { cascade_copy => 0, cascade_delete => 0 }, diff --git a/Koha/Schema/Result/Aqinvoice.pm b/Koha/Schema/Result/Aqinvoice.pm index 89fea491df3..0ba2161aa2d 100644 --- a/Koha/Schema/Result/Aqinvoice.pm +++ b/Koha/Schema/Result/Aqinvoice.pm @@ -228,9 +228,7 @@ __PACKAGE__->has_many( return { "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.invoiceid" }, - - "$args->{foreign_alias}.field_id" => - { -in => \'(SELECT id FROM additional_fields WHERE tablename="aqinvoices")' }, + "$args->{foreign_alias}.record_table" => __PACKAGE__->table, }; }, { cascade_copy => 0, cascade_delete => 0 }, diff --git a/Koha/Schema/Result/Aqorder.pm b/Koha/Schema/Result/Aqorder.pm index 2adab1a8b48..fd819748722 100644 --- a/Koha/Schema/Result/Aqorder.pm +++ b/Koha/Schema/Result/Aqorder.pm @@ -891,10 +891,7 @@ __PACKAGE__->has_many( return { "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.ordernumber" }, - - # TODO Add column additional_field_values.tablename to avoid subquery ? - "$args->{foreign_alias}.field_id" => - { -in => \'(SELECT id FROM additional_fields WHERE tablename = "aqorders")' }, + "$args->{foreign_alias}.record_table" => __PACKAGE__->table, }; }, { cascade_copy => 0, cascade_delete => 0 }, diff --git a/Koha/Schema/Result/Subscription.pm b/Koha/Schema/Result/Subscription.pm index cb5d1533f44..1f476a307a2 100644 --- a/Koha/Schema/Result/Subscription.pm +++ b/Koha/Schema/Result/Subscription.pm @@ -577,9 +577,7 @@ __PACKAGE__->has_many( return { "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.subscriptionid" }, - - "$args->{foreign_alias}.field_id" => - { -in => \'(SELECT id FROM additional_fields WHERE tablename = "subscription")' }, + "$args->{foreign_alias}.record_table" => __PACKAGE__->table, }; }, { cascade_copy => 0, cascade_delete => 0 }, -- 2.47.0