From 1399945a75ad68ec01aa1fe4ec2c38fe3973dbcc Mon Sep 17 00:00:00 2001 From: tipaul Date: Wed, 1 Aug 2007 09:20:03 +0000 Subject: [PATCH] eval() on getAuthority & getBiblio to avoid a script failure --- misc/migration_tools/rebuild_zebra.pl | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl index 9c33092dab..b9b794650d 100755 --- a/misc/migration_tools/rebuild_zebra.pl +++ b/misc/migration_tools/rebuild_zebra.pl @@ -290,7 +290,15 @@ rank:rank-1 $sth->execute(); my $i=0; while (my ($authid) = $sth->fetchrow) { - my $record = GetAuthority($authid); + my $record; + eval { + $record = GetAuthority($authid); + }; + if($@){ + print " There was some pb getting authority : ".$authid."\n"; + next; + } + print "."; print "\r$i" unless ($i++ %100); # remove leader length, that could be wrong, it will be calculated automatically by as_usmarc @@ -481,11 +489,18 @@ rank:rank-1 open(OUT,">:utf8 ","$directory/biblios/export") or die $!; my $dbh=C4::Context->dbh; my $sth; - $sth=$dbh->prepare("select biblionumber from biblioitems where biblionumber >54000 order by biblionumber $limit"); + $sth=$dbh->prepare("select biblionumber from biblioitems order by biblionumber $limit"); $sth->execute(); my $i=0; while (my ($biblionumber) = $sth->fetchrow) { - my $record = GetMarcBiblio($biblionumber); + my $record; + eval { + $record = GetMarcBiblio($biblionumber); + }; + if($@){ + print " There was some pb getting biblio : #".$biblionumber."\n"; + next; + } # warn $record->as_formatted; # die if $record->subfield('090','9') eq 11; # print $record; -- 2.11.0