2 # This script finds and fixes missing 090 fields in Koha for MARC21
3 # Written by TG on 01/10/2005
4 # Revised by Joshua Ferraro on 03/31/2006
7 # find Koha's Perl modules
8 # test carefully before changing this
10 eval { require "$FindBin::Bin/../../kohalib.pl" };
18 use MARC::File::USMARC;
21 my $dbh = C4::Context->dbh;
23 my $sth=$dbh->prepare("select m.bibid,b.biblioitemnumber from marc_biblio m left join biblioitems b on b.biblionumber=m.biblionumber ");
26 while (my ($biblionumber,$biblioitemnumber)=$sth->fetchrow ){
27 my $record = MARCgetbiblio($dbh,$biblionumber);
29 MARCmodleader($biblionumber,$record);
34 my ($biblionumber,$record)=@_;
37 #warn "".$record->leader();
38 #if (length($record->leader())>24){
39 # $record->leader(substr($record->leader,0,24));
41 #} elsif (length($record->leader())<24){
42 $record->leader(' nac 22 1u 4500');
46 warn "leader : ".$record->leader if ($biblionumber==2262);
47 foreach ($record->field('995')) {
48 $record->delete_field($_);
51 &ModBiblioMarc($record,'',$biblionumber);
52 print "$biblionumber \n";