Koha/marc/koha2marc
arensb dbca39823f Merged with arensb-context branch: use C4::Context->dbh instead of
&C4Connect, and generally prefer C4::Context over C4::Database.
2002-10-05 09:44:27 +00:00

35 lines
1,016 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::Context;
use C4::Catalogue;
use CGI;
use DBI;
#use strict;
use C4::Acquisitions;
use C4::Biblio;
use C4::Output;
my $dbh = C4::Context->dbh;
my $userid=$ENV{'REMOTE_USER'};
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);
}
}