From eee64ed4d31282b80462944b75065ef23fdc3458 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 | 4 +--- 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/Koha/Schema/Result/Accountline.pm b/Koha/Schema/Result/Accountline.pm index ea1a8b7bd34..27814fe87cd 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 }, @@ -524,4 +522,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 f4d160f555e..2edf001fa44 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 }, @@ -410,4 +408,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 915759d9a2f..09fc0c698cc 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 }, @@ -256,4 +254,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 19259e8d046..a602de8aa51 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 }, @@ -924,4 +921,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 be2df217703..46463ebbb0d 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 }, -- 2.49.0