From 7713c47dfdc29a9d35a1cc8cc0be7023a26a89a6 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 Signed-off-by: David Nind --- Koha/Schema/Result/Accountline.pm | 6 ++---- Koha/Schema/Result/Aqbasket.pm | 6 ++---- Koha/Schema/Result/Aqinvoice.pm | 6 ++---- Koha/Schema/Result/Aqorder.pm | 7 ++----- Koha/Schema/Result/Subscription.pm | 6 ++---- 5 files changed, 10 insertions(+), 21 deletions(-) diff --git a/Koha/Schema/Result/Accountline.pm b/Koha/Schema/Result/Accountline.pm index 1903a552ec6..bbcddc02795 100644 --- a/Koha/Schema/Result/Accountline.pm +++ b/Koha/Schema/Result/Accountline.pm @@ -496,9 +496,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 }, @@ -511,4 +509,4 @@ sub koha_object_class { 'Koha::Account::Line'; } -1; +1; \ No newline at end of file diff --git a/Koha/Schema/Result/Aqbasket.pm b/Koha/Schema/Result/Aqbasket.pm index eb2ce481b79..eee2e6a921b 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 }, @@ -390,4 +388,4 @@ __PACKAGE__->add_columns( '+is_standing' => { is_boolean => 1 } ); -1; +1; \ No newline at end of file diff --git a/Koha/Schema/Result/Aqinvoice.pm b/Koha/Schema/Result/Aqinvoice.pm index 89fea491df3..fdefdfaef0c 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 }, @@ -243,4 +241,4 @@ sub koha_objects_class { 'Koha::Acquisition::Invoices'; } -1; +1; \ No newline at end of file diff --git a/Koha/Schema/Result/Aqorder.pm b/Koha/Schema/Result/Aqorder.pm index 2adab1a8b48..e8b66408bfd 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 }, @@ -912,4 +909,4 @@ __PACKAGE__->add_columns( '+uncertainprice' => { is_boolean => 1 } ); -1; +1; \ No newline at end of file diff --git a/Koha/Schema/Result/Subscription.pm b/Koha/Schema/Result/Subscription.pm index bffd28e210b..23e97e87b00 100644 --- a/Koha/Schema/Result/Subscription.pm +++ b/Koha/Schema/Result/Subscription.pm @@ -597,9 +597,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 }, @@ -611,4 +609,4 @@ __PACKAGE__->add_columns( ); # You can replace this text with custom content, and it will be preserved on regeneration -1; +1; \ No newline at end of file -- 2.48.1