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

(-)a/C4/ImportBatch.pm (-7 / +17 lines)
Lines 1415-1421 sub SetImportRecordBiblioMatch { Link Here
1415
1415
1416
=head RecordsFromISO2709File
1416
=head RecordsFromISO2709File
1417
1417
1418
    my $records = C4::ImportBatch::RecordsFromISO2709File($input_file, $record_type, $encoding);
1418
    my ($errors, $records) = C4::ImportBatch::RecordsFromISO2709File($input_file, $record_type, $encoding);
1419
1419
1420
Reads ISO2709 binary porridge from the given file and creates MARC::Record-objects out of it.
1420
Reads ISO2709 binary porridge from the given file and creates MARC::Record-objects out of it.
1421
1421
Lines 1453-1459 sub RecordsFromISO2709File { Link Here
1453
1453
1454
=head RecordsFromMARCXMLFile
1454
=head RecordsFromMARCXMLFile
1455
1455
1456
    my $records = C4::ImportBatch::RecordsFromMARCXMLFile($input_file, $encoding);
1456
    my ($errors, $records) = C4::ImportBatch::RecordsFromMARCXMLFile($input_file, $encoding);
1457
1457
1458
Creates MARC::Record-objects out of the given MARCXML-file.
1458
Creates MARC::Record-objects out of the given MARCXML-file.
1459
1459
Lines 1466-1475 sub RecordsFromMARCXMLFile { Link Here
1466
    my ($filename, $encoding) = @_;
1466
    my ($filename, $encoding) = @_;
1467
    my $batch = MARC::File::XML->in( $filename );
1467
    my $batch = MARC::File::XML->in( $filename );
1468
    my @marcRecords;
1468
    my @marcRecords;
1469
    while (my $record = $batch->next($encoding)) { #How incredibly hard can be these MARC-libraries be to use?
1469
    my @errors;
1470
        push @marcRecords, $record;
1470
    my $record;
1471
    }
1471
1472
    return \@marcRecords;
1472
    do {
1473
        eval {
1474
            $record = $batch->next($encoding);
1475
            push @marcRecords, $record if $record;
1476
        };
1477
        if ($@) {
1478
            push @errors, $@;
1479
        }
1480
1481
    } while ($@ || $record);
1482
1483
    return (\@errors, \@marcRecords);
1473
}
1484
}
1474
1485
1475
# internal functions
1486
# internal functions
1476
- 

Return to bug 10407