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 <josef.moravec@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Marcel de Rooy 2017-07-20 12:37:56 +02:00 committed by Jonathan Druart
parent 01fbe2be99
commit db32f394a6
1 changed files with 5 additions and 3 deletions

View File

@ -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;
}