From db32f394a636848488de4d1637d9efc5b7fcf004 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 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 Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart --- C4/Biblio.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 5f696a2e5f..51666e71ea 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2196,9 +2196,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.39.5