2 # migrate koha-biblios to MARCbiblios
6 # Copyright 2000-2002 Katipo Communications
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along with
20 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
21 # Suite 330, Boston, MA 02111-1307 USA
29 use MARC::File::USMARC;
33 $dbh->do("delete from marc_biblio");
34 $dbh->do("delete from marc_blob_subfield");
35 $dbh->do("delete from marc_subfield_table");
36 $dbh->do("delete from marc_word");
37 my $sth=$dbh->prepare("select * from biblio left join biblioitems on biblioitems.biblionumber=biblio.biblionumber order by biblio.biblionumber");
39 my $sth2 = $dbh->prepare("select count(*) from biblio");
41 my ($total) = $sth2->fetchrow_array;
45 while ($row=$sth->fetchrow_hashref) {
50 print "$rest / $total\n";
52 my $MARCbiblio = MARCkoha2marcBiblio($dbh,$row->{biblionumber},$row->{biblioitemnumber});
53 &MARCaddbiblio($dbh,$MARCbiblio,$row->{biblionumber});
54 my $sth_item = $dbh->prepare("select * from items where biblionumber=? and biblioitemnumber=?");
55 $sth_item->execute($row->{biblionumber},$row->{biblioitemnumber});
56 while ($row2=$sth_item->fetchrow_hashref) {
57 my $MARCitem = &MARCkoha2marcItem($dbh,$row2->{biblionumber},$row2->{itemnumber});
58 &MARCadditem($dbh,$MARCitem,$row2->{biblionumber});