minor improvment : loads only the 1st sentence. Thus, avoid lllooonnnggg descriptions
[koha.git] / marc / koha2marc
1 #!/usr/bin/perl
2
3
4 #  CAREFUL!!!!
5 # This next line deletes _ALL_ of the existing MARC data from the
6 # MySQL tables!!!  It is only in here during development!!!!
7
8 system("mysql Koha -pkohapass < deletemarc");
9
10 use C4::Context;
11 use C4::Catalogue;
12 use CGI;
13 use DBI;
14 #use strict;
15 use C4::Acquisitions;
16 use C4::Biblio;
17 use C4::Output;
18 my $dbh = C4::Context->dbh;
19 my $userid=$ENV{'REMOTE_USER'};
20
21 my $sth=$dbh->prepare("select * from biblio,biblioitems where biblio.biblionumber=biblioitems.biblionumber");
22 $sth->execute;
23 my $env;
24 $env->{'marconly'}=1;
25
26 while (my $biblioitem=$sth->fetchrow_hashref) {
27     print "Processing $biblioitem->{'title'}\n";
28     my $Record_ID;
29     ($env, $Record_ID) = newBiblioItem($env,$biblioitem);
30     my $sti=$dbh->prepare("select * from items,biblioitems where items.biblioitemnumber=biblioitems.biblioitemnumber and biblioitems.biblioitemnumber=$biblioitem->{'biblioitemnumber'}");
31     $sti->execute;
32     while (my $item=$sti->fetchrow_hashref) {
33         newItem($env, $Record_ID, $item);
34     }
35 }