View | Details | Raw Unified | Return to bug 6799
Collapse All | Expand All

(-)a/misc/migration_tools/rebuild_zebra.pl (-8 / +5 lines)
Lines 323-341 sub export_marc_records_from_sth { Link Here
323
                my @items = GetItemsInfo($record_number);
323
                my @items = GetItemsInfo($record_number);
324
                if (@items){
324
                if (@items){
325
                    my $record = MARC::Record->new;
325
                    my $record = MARC::Record->new;
326
                    $record->encoding('UTF-8');
326
                    my @itemsrecord;
327
                    my @itemsrecord;
327
                    foreach my $item (@items){
328
                    foreach my $item (@items){
328
                        my $record = Item2Marc($item, $record_number);                        
329
                        my $record = Item2Marc($item, $record_number);                        
329
                        push @itemsrecord, $record->field($itemtag);
330
                        push @itemsrecord, $record->field($itemtag);
330
                    }
331
                    }
331
                    $record->insert_fields_ordered(@itemsrecord);
332
                    $record->insert_fields_ordered(@itemsrecord);
332
                    my $itemsxml=$record->as_xml_record();
333
                    my $itemsxml = $record->as_xml_record();
333
                    my $searchstring = '<record>\n';
334
                    $marcxml =
334
                    my $index = index($itemsxml, '<record>\n', 0);
335
                        substr($marcxml, 0, length($marcxml)-10) .
335
                    $itemsxml = substr($itemsxml, $index + length($searchstring));
336
                        substr($itemsxml, index($itemsxml, "</leader>\n", 0) + 10);
336
                    $searchstring = '</record>';
337
                    $marcxml = substr($marcxml, 0, index($marcxml, $searchstring));
338
                    $marcxml .= $itemsxml;
339
                }
337
                }
340
            }
338
            }
341
            if ( $marcxml ) {
339
            if ( $marcxml ) {
342
- 

Return to bug 6799