my @items = GetItemsInfo($record_number);
if (@items){
my $record = MARC::Record->new;
+ $record->encoding('UTF-8');
my @itemsrecord;
foreach my $item (@items){
my $record = Item2Marc($item, $record_number);
push @itemsrecord, $record->field($itemtag);
}
$record->insert_fields_ordered(@itemsrecord);
- my $itemsxml=$record->as_xml_record();
- my $searchstring = '<record>\n';
- my $index = index($itemsxml, '<record>\n', 0);
- $itemsxml = substr($itemsxml, $index + length($searchstring));
- $searchstring = '</record>';
- $marcxml = substr($marcxml, 0, index($marcxml, $searchstring));
- $marcxml .= $itemsxml;
+ my $itemsxml = $record->as_xml_record();
+ $marcxml =
+ substr($marcxml, 0, length($marcxml)-10) .
+ substr($itemsxml, index($itemsxml, "</leader>\n", 0) + 10);
}
}
if ( $marcxml ) {
if (defined $marc) {
fix_leader($marc);
- if ($record_type eq 'biblio') {
- my $succeeded = fix_biblio_ids($marc, $record_number);
- return unless $succeeded;
- } else {
+ if ($record_type eq 'authority') {
fix_authority_id($marc, $record_number);
}
if (C4::Context->preference("marcflavour") eq "UNIMARC") {
$fetch_sth->finish();
return unless $marc;
} else {
- eval { $marc = GetMarcBiblio($record_number); };
+ eval { $marc = GetMarcBiblio($record_number, 1); };
if ($@ || !$marc) {
# here we do warn since catching an exception
# means that the bib was found but failed
return;
}
}
- # ITEM
- C4::Biblio::EmbedItemsInMarcBiblio($marc, $record_number);
} else {
eval { $marc = GetAuthority($record_number); };
if ($@) {