From 226822aa0a877eb227c8753ae58ef4af2a3b5667 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 16 Jun 2008 08:45:55 -0500 Subject: [PATCH] bypass corrupt bibs when linking headings During link_bibs_to_authorities.pl run, a bib was observed that had both biblioitems.marc and biblioitems.marcxml set to blank or NULL. Added check to verify that a defined value is returned from GetMarcBiblio(); may follow up with additional patches once it's determined how the corrupt bib came to be loaded. Signed-off-by: Joshua Ferraro --- misc/link_bibs_to_authorities.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/misc/link_bibs_to_authorities.pl b/misc/link_bibs_to_authorities.pl index 0ef713a597..1cb0483fd8 100755 --- a/misc/link_bibs_to_authorities.pl +++ b/misc/link_bibs_to_authorities.pl @@ -32,6 +32,7 @@ if (not $result or $want_help) { my $num_bibs_processed = 0; my $num_bibs_modified = 0; +my $num_bad_bibs = 0; my $dbh = C4::Context->dbh; $dbh->{AutoCommit} = 0; process_bibs(); @@ -62,6 +63,7 @@ Bib authority heading linking report ------------------------------------ Number of bibs checked: $num_bibs_processed Number of bibs modified: $num_bibs_modified +Number of bibs with errors: $num_bad_bibs _SUMMARY_ } @@ -69,6 +71,12 @@ sub process_bib { my $biblionumber = shift; my $bib = GetMarcBiblio($biblionumber); + unless (defined $bib) { + print "\nCould not retrieve bib $biblionumber from the database - record is corrupt.\n"; + $num_bad_bibs++; + return; + } + my $headings_changed = LinkBibHeadingsToAuthorities($bib); if ($headings_changed) { -- 2.39.5