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
8 # find Koha's Perl modules
9 # test carefully before changing this
11 eval { require "$FindBin::Bin/kohalib.pl" };
20 my $dbh = C4::Context->dbh;
22 my $sth=$dbh->prepare("SELECT biblio.biblionumber, biblioitemnumber, frameworkcode FROM biblio JOIN biblioitems USING (biblionumber)");
25 while (my ($biblionumber,$biblioitemnumber,$frameworkcode)=$sth->fetchrow ){
26 my $record = GetMarcBiblio({ biblionumber => $biblionumber });
27 C4::Biblio::_koha_marc_update_bib_ids($record, $frameworkcode, $biblionumber, $biblioitemnumber);
28 my $biblionumber = eval {ModBiblioMarc( $record, $biblionumber )};
30 print "Problem with biblionumber : $biblionumber\n";
33 print "biblionumber : $biblionumber\r\r";