From 9da74b3fb7373e685c0cf8d4e723d49824bb1074 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 7 Jan 2026 12:14:21 +0000 Subject: [PATCH] Bug 22972: Support 'subfield_to_report_in_1' when merging authorities --- C4/AuthoritiesMarc.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index f0fe2c1325a..050c00d36bd 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -1613,6 +1613,7 @@ sub merge { $authtypefrom = Koha::Authority::Types->find( $authfrom->authtypecode ) if $authfrom; my $auth_tag_to_report_from = $authtypefrom ? $authtypefrom->auth_tag_to_report : ''; my $auth_tag_to_report_to = $authtypeto ? $authtypeto->auth_tag_to_report : ''; + my $subfield_to_report_in_1 = $authtypeto ? $authtypeto->subfield_to_report_in_1 : ''; my @record_to; @@ -1635,6 +1636,16 @@ sub merge { @record_to = $chosen_field->subfields(); } + if ($subfield_to_report_in_1 && $MARCto) { + my ( $tag, $code ) = split /\$/, $subfield_to_report_in_1; + + foreach my $field ( $MARCto->field($tag) ) { + foreach my $subfield ( $field->subfield($code) ) { + push @record_to, ['1', $subfield]; + } + } + } + # Exceptional: If MARCto and authtypeto exist but $auth_tag_to_report_to # is empty, make sure that $9 and $a remain (instead of clearing the # reference) in order to allow for data recovery. -- 2.47.3