Koha/misc/batchRepairMissingBiblionumbers.pl
Nick Clemens a96c73eb76 Bug 25306: Remove framework paramter from ModBiblioMarc
Tested with :

For a framework (not the default) :

Creation of a biblio record
Edition of this biblio record
Creation of an item of this record
Creation of an item of this record

./misc/batchRepairMissingBiblionumbers.pl OK

prove t/db_dependent/Biblio/ModBiblioMarc.t OK

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-01-12 16:13:50 +01:00

37 lines
1.1 KiB
Perl
Executable file

#!/usr/bin/perl
# This script finds and fixes missing biblionumber/biblioitemnumber fields in Koha
# Written by TG on 01/10/2005
# Revised by Joshua Ferraro on 03/31/2006
use strict;
use warnings;
BEGIN {
# find Koha's Perl modules
# test carefully before changing this
use FindBin;
eval { require "$FindBin::Bin/kohalib.pl" };
}
# Koha modules used
use Koha::Script;
use C4::Context;
use C4::Biblio;
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("SELECT biblio.biblionumber, biblioitemnumber, frameworkcode FROM biblio JOIN biblioitems USING (biblionumber)");
$sth->execute();
while (my ($biblionumber,$biblioitemnumber,$frameworkcode)=$sth->fetchrow ){
my $record = GetMarcBiblio({ biblionumber => $biblionumber });
C4::Biblio::_koha_marc_update_bib_ids($record, $frameworkcode, $biblionumber, $biblioitemnumber);
my $biblionumber = eval {ModBiblioMarc( $record, $biblionumber )};
if($@){
print "Problem with biblionumber : $biblionumber\n";
exit -1;
}else{
print "biblionumber : $biblionumber\r\r";
}
}
END;