From 9a3e2a53b8db11b5472f0a027f5d232fa3856a64 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 20 Feb 2025 12:46:01 +0000 Subject: [PATCH] Bug 39177: DBIC Add AdditionalFields to AccountCreditType Sponsored-by: PTFS Europe --- Koha/Schema/Result/AccountCreditType.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Koha/Schema/Result/AccountCreditType.pm b/Koha/Schema/Result/AccountCreditType.pm index d246ebad990..135202caf4d 100644 --- a/Koha/Schema/Result/AccountCreditType.pm +++ b/Koha/Schema/Result/AccountCreditType.pm @@ -134,6 +134,22 @@ __PACKAGE__->add_columns( '+archived' => { is_boolean => 1 } ); +__PACKAGE__->has_many( + "additional_field_values", + "Koha::Schema::Result::AdditionalFieldValue", + sub { + my ($args) = @_; + + return { + "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.code" }, + + "$args->{foreign_alias}.field_id" => + { -in => \'(SELECT id FROM additional_fields WHERE tablename="account_credit_types")' }, + }; + }, + { cascade_copy => 0, cascade_delete => 0 }, +); + sub koha_objects_class { 'Koha::Account::CreditTypes'; } -- 2.48.1