X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;ds=sidebyside;f=misc%2FbatchRebuildBiblioTables.pl;h=dc4175c61f0d56a1eb1712af33236d3d8775268e;hb=9066ae153b15ae49b7d5832b331eed31c32ed583;hp=8e1c3aca3ed2352a1cf41199a588b8ef05747b5e;hpb=c41a9cc218cba83c1ef80f67f0dc30444ff1baf6;p=koha.git diff --git a/misc/batchRebuildBiblioTables.pl b/misc/batchRebuildBiblioTables.pl index 8e1c3aca3e..dc4175c61f 100755 --- a/misc/batchRebuildBiblioTables.pl +++ b/misc/batchRebuildBiblioTables.pl @@ -3,7 +3,7 @@ # Formerly named rebuildnonmarc.pl use strict; -# use warnings; FIXME someday +#use warnings; FIXME - Bug 2505 BEGIN { # find Koha's Perl modules @@ -53,14 +53,19 @@ $starttime = gettimeofday; #1st of all, find item MARC tag. my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.itemnumber",''); -# $dbh->do("lock tables biblio write, biblioitems write, items write, marc_biblio write, marc_subfield_table write, marc_blob_subfield write, marc_word write, marc_subfield_structure write, stopwords write"); +# $dbh->do("lock tables biblio write, biblioitems write, items write, marc_biblio write, marc_subfield_table write, marc_blob_subfield write, marc_word write, marc_subfield_structure write"); my $sth = $dbh->prepare("SELECT biblionumber FROM biblio"); $sth->execute; # my ($biblionumbermax) = $sth->fetchrow; # warn "$biblionumbermax <<=="; +my @errors; while (my ($biblionumber)= $sth->fetchrow) { #now, parse the record, extract the item fields, and store them in somewhere else. my $record = GetMarcBiblio($biblionumber); + if (not defined $record) { + push @errors, $biblionumber; + next; + } my @fields = $record->field($tagfield); my @items; my $nbitems=0; @@ -82,13 +87,16 @@ while (my ($biblionumber)= $sth->fetchrow) { # $dbh->do("unlock tables"); my $timeneeded = time() - $starttime; print "$i MARC record done in $timeneeded seconds\n"; +if (scalar(@errors) > 0) { + print "Some biblionumber could not be processed though: ", join(" ", @errors); +} # modified NEWmodbiblio to jump the MARC part of the biblio modif # highly faster sub localNEWmodbiblio { my ($dbh,$record,$biblionumber,$frameworkcode) =@_; $frameworkcode="" unless $frameworkcode; - my $oldbiblio = TransformMarcToKoha($dbh,$record,$frameworkcode); + my $oldbiblio = TransformMarcToKoha($record,$frameworkcode); C4::Biblio::_koha_modify_biblio( $dbh, $oldbiblio, $frameworkcode ); C4::Biblio::_koha_modify_biblioitem_nonmarc( $dbh, $oldbiblio ); return 1;