X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FBiblio.pm;h=7eb312484d774376f070b193360490d7235f9670;hb=aa398ed055a7226ba02d6559b297cb172b3ce3df;hp=0cc63ab69bb3e9448d83f4392cd1f17945795ccf;hpb=93ffca4eef68f9ce6f28660c0b6ab759330f4a72;p=koha_fer diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 0cc63ab69b..7eb312484d 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -326,6 +326,14 @@ sub ModBiblio { $record->append_fields($field); } + foreach my $field ($record->fields()) { + if (! $field->is_control_field()) { + if (scalar($field->subfields()) == 0) { + $record->delete_fields($field); + } + } + } + # update biblionumber and biblioitemnumber in MARC # FIXME - this is assuming a 1 to 1 relationship between # biblios and biblioitems @@ -1672,13 +1680,18 @@ sub TransformKohaToMarcOneField { } $sth->execute( $frameworkcode, $kohafieldname ); if ( ( $tagfield, $tagsubfield ) = $sth->fetchrow ) { + my @values = split(/\s?\|\s?/, $value, -1); + + foreach my $itemvalue (@values){ my $tag = $record->field($tagfield); if ($tag) { - $tag->update( $tagsubfield => $value ); + $tag->add_subfields( $tagsubfield => $itemvalue ); $record->delete_field($tag); $record->insert_fields_ordered($tag); - } else { - $record->add_fields( $tagfield, " ", " ", $tagsubfield => $value ); + } + else { + $record->add_fields( $tagfield, " ", " ", $tagsubfield => $itemvalue ); + } } } return $record;