From 22f2fb796b63d2c5b180a2a6eb4060f14a4c15a1 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 20 Jul 2017 12:37:56 +0200 Subject: [PATCH] [SIGNED-OFF] Bug 10306: Allow controlfields in TransformKohaToMarc 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. Signed-off-by: Josef Moravec --- 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