From 0b826a62886e64b43407cc1ee8e510b8fa61ad6e 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 Signed-off-by: Brendan Gallagher --- 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 d246ebad99..135202caf4 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.39.5