Koha/misc/migration_tools/upgradeitems.pl
Paul POULAIN 8e1844d495 missing )
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-05-05 05:39:13 -05:00

30 lines
No EOL
835 B
Perl
Executable file

#!/usr/bin/perl
use strict;
use C4::Context;
use C4::Items;
use C4::Biblio;
my $dbh=C4::Context->dbh;
if (C4::Context->preference("marcflavour") ne "UNIMARC") {
print "this script is for UNIMARC only\n";
exit;
}
my $rqbiblios=$dbh->prepare("SELECT biblionumber from biblioitems");
$rqbiblios->execute;
$|=1;
while (my ($biblionumber)= $rqbiblios->fetchrow_array){
my $record=GetMarcBiblio($biblionumber);
foreach my $itemfield ($record->field('995')){
my $marcitem=MARC::Record->new();
$marcitem->encoding('UTF-8');
$marcitem->append_fields($itemfield);
eval{ModItemFromMarc($marcitem,$biblionumber,$itemfield->subfield('9'));};
print "\r$biblionumber";
if ($@){
warn "$biblionumber : $@";
warn $record->as_formatted;
}
}
}