From 5c790225500f9c571050a11982c23f2653e2aff9 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 20 Jul 2017 12:37:56 +0200 Subject: [PATCH] Bug 10306: Allow controlfields in TransformKohaToMarc Content-Type: text/plain; charset=utf-8 Since the interface allows you to connect a kohafield to a MARC controlfield, this routine should be able to handle that. Unfortunately it did not. Test plan: Change will be tested in Biblio/TransformKohaToMarc.t in the next patch. --- C4/Biblio.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 11c1d9b..e12246f 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2178,9 +2178,11 @@ sub TransformKohaToMarc { my @sfl = @{$tag_hr->{$tag}}; @sfl = sort { $a->[0] cmp $b->[0]; } @sfl; @sfl = map { @{$_}; } @sfl; - $record->insert_fields_ordered( - MARC::Field->new($tag, " ", " ", @sfl) - ); + # Special care for control fields: remove the subfield indication @ + # and do not insert indicators. + my @ind = $tag < 10 ? () : ( " ", " " ); + @sfl = grep { $_ ne '@' } @sfl if $tag < 10; + $record->insert_fields_ordered( MARC::Field->new($tag, @ind, @sfl) ); } return $record; } -- 2.1.4