From: Bill Erickson Date: Fri, 9 Dec 2016 16:00:43 +0000 (-0800) Subject: JBAS-1437 Backstage export skips bibs with warnings X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=47266f157d37da022ae8c8ce53f31dbcab1c9fe7;p=working%2FEvergreen.git JBAS-1437 Backstage export skips bibs with warnings So far this only affects bibs with invalid leader lengths. Signed-off-by: Bill Erickson --- diff --git a/KCLS/authority-control/backstage/export-bibs.pl b/KCLS/authority-control/backstage/export-bibs.pl index 3858a31d6f..a82a0b0c8d 100755 --- a/KCLS/authority-control/backstage/export-bibs.pl +++ b/KCLS/authority-control/backstage/export-bibs.pl @@ -198,6 +198,7 @@ sub export_marc { $sth->execute; my $count = 0; + my @skipped; while (my $bib = $sth->fetchrow_hashref) { $count++; next if $count_only; @@ -216,9 +217,14 @@ sub export_marc { my $marc = $rec->[0]->[0]; my $marcdoc = MARC::Record->new_from_xml($marc, 'UTF-8', 'USMARC'); - print MARCFILE $marcdoc->as_usmarc; + if (my @warnings = $marcdoc->warnings) { + print "Skipping record $bib_id on warnings: @warnings\n"; + push(@skipped, $bib_id); + } else { + print MARCFILE $marcdoc->as_usmarc; + } - print "$count records written...\n" if ($count % 1000) == 0; + print "$count records processed...\n" if ($count % 1000) == 0; next unless $export_date; @@ -230,7 +236,11 @@ sub export_marc { close(MARCFILE) if $out_file; - print "$count total bib records\n"; + my $skip_count = scalar(@skipped); + print "total bib count = $count\n"; + print "skipped bib count = $skip_count\n"; + print "export bib count = ".($count - $skip_count)."\n"; + print "skipped bibs: @skipped\n"; $sth->finish; $edate_sth->finish;