koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/misc/migration_tools rebuild_nozebra.pl


From: Antoine Farnault
Subject: [Koha-cvs] koha/misc/migration_tools rebuild_nozebra.pl
Date: Thu, 19 Jul 2007 09:48:22 +0000

CVSROOT:        /sources/koha
Module name:    koha
Changes by:     Antoine Farnault <toins>        07/07/19 09:48:22

Modified files:
        misc/migration_tools: rebuild_nozebra.pl 

Log message:
        adding an eval to don't die if an error occurs

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/misc/migration_tools/rebuild_nozebra.pl?cvsroot=koha&r1=1.7&r2=1.8

Patches:
Index: rebuild_nozebra.pl
===================================================================
RCS file: /sources/koha/koha/misc/migration_tools/rebuild_nozebra.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- rebuild_nozebra.pl  15 Jun 2007 13:44:46 -0000      1.7
+++ rebuild_nozebra.pl  19 Jul 2007 09:48:22 -0000      1.8
@@ -94,6 +94,7 @@
 
     # remove blancks comma (that could cause problem when decoding the string 
for CQL retrieval) and regexp specific values
     $title =~ s/ |,|;|\[|\]|\(|\)|\*|-|'|=//g;
+    $title = quotemeta $title;
     # limit to 10 char, should be enough, and limit the DB size
     $title = substr($title,0,10);
     #parse each field
@@ -174,13 +175,19 @@
 while (my ($authid) = $sth->fetchrow) {
     $i++;
     print "\r$i";
-    my $record = GetAuthority($authid);
+    my $record;
+    eval{
+        $record = GetAuthority($authid);
+    };
+    if($@){
+        print "  There was some pb getting authnumber : ".$authid."\n";
+        next;
+    }
 
     my %index;
     # for authorities, the "title" is the $a mainentry
     my $authref = C4::AuthoritiesMarc::GetAuthType($record->subfield(152,'b'));
-    use Data::Dumper;
-#     warn "for $authid / ".$record->as_formatted. "Dumper : 
".Dumper($authref);
+
     warn "ERROR : authtype undefined for ".$record->as_formatted unless 
$authref;
     my $title = $record->subfield($authref->{auth_tag_to_report},'a');
     $index{'mainmainentry'}= $authref->{'auth_tag_to_report'}.'a';
@@ -189,6 +196,7 @@
 
     # remove blancks comma (that could cause problem when decoding the string 
for CQL retrieval) and regexp specific values
     $title =~ s/ |,|;|\[|\]|\(|\)|\*|-|'|=//g;
+    $title = quotemeta $title;
     # limit to 10 char, should be enough, and limit the DB size
     $title = substr($title,0,10);
     #parse each field




reply via email to

[Prev in Thread] Current Thread [Next in Thread]