"Fossies" - the Fresh Open Source Software Archive

Member "koha-19.11.15/misc/batchRepairMissingBiblionumbers.pl" (23 Feb 2021, 1119 Bytes) of package /linux/misc/koha-19.11.15.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "batchRepairMissingBiblionumbers.pl" see the Fossies "Dox" file reference documentation.

    1 #!/usr/bin/perl
    2 # This script finds and fixes missing biblionumber/biblioitemnumber fields in Koha
    3 #  Written by TG on 01/10/2005
    4 #  Revised by Joshua Ferraro on 03/31/2006
    5 use strict;
    6 use warnings;
    7 BEGIN {
    8     # find Koha's Perl modules
    9     # test carefully before changing this
   10     use FindBin;
   11     eval { require "$FindBin::Bin/kohalib.pl" };
   12 }
   13 
   14 # Koha modules used
   15 use Koha::Script;
   16 use C4::Context;
   17 use C4::Biblio;
   18 
   19 
   20 my $dbh = C4::Context->dbh;
   21 my %kohafields;
   22 
   23 my $sth=$dbh->prepare("SELECT biblio.biblionumber, biblioitemnumber, frameworkcode FROM biblio JOIN biblioitems USING (biblionumber)");
   24 $sth->execute();
   25 
   26 while (my ($biblionumber,$biblioitemnumber,$frameworkcode)=$sth->fetchrow ){
   27     my $record = GetMarcBiblio({ biblionumber => $biblionumber });
   28     C4::Biblio::_koha_marc_update_bib_ids($record, $frameworkcode, $biblionumber, $biblioitemnumber);
   29     my $biblionumber = eval {ModBiblioMarc( $record, $biblionumber, $frameworkcode )};
   30     if($@){
   31         print "Problem with biblionumber : $biblionumber\n";
   32         exit -1;
   33     }else{
   34         print "biblionumber : $biblionumber\r\r";
   35     }
   36 }
   37 
   38 END;