Koha/marc/koha2marc
2001-11-06 18:25:30 +00:00

38 lines
1,014 B
Perl

#!/usr/bin/perl
# CAREFUL!!!!
# This next line deletes _ALL_ of the existing MARC data from the
# MySQL tables!!! It is only in here during development!!!!
system("mysql Koha -pkohapass < deletemarc");
use C4::Database;
use C4::Catalogue;
use CGI;
use DBI;
#use strict;
use C4::Acquisitions;
use C4::Output;
my $dbh=C4Connect;
my $userid=$ENV{'REMOTE_USER'};
my $dbh=C4Connect;
my $sth=$dbh->prepare("select * from biblio,biblioitems where biblio.biblionumber=biblioitems.biblionumber");
$sth->execute;
my $env;
$env->{'marconly'}=1;
while (my $biblioitem=$sth->fetchrow_hashref) {
print "Processing $biblioitem->{'title'}\n";
my $Record_ID;
($env, $Record_ID) = newBiblioItem($env,$biblioitem);
my $sti=$dbh->prepare("select * from items,biblioitems where items.biblioitemnumber=biblioitems.biblioitemnumber and biblioitems.biblioitemnumber=$biblioitem->{'biblioitemnumber'}");
$sti->execute;
while (my $item=$sti->fetchrow_hashref) {
newItem($env, $Record_ID, $item);
}
}