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;
34 my $dbh=C4::Context->dbh;
35 $dbh->do("delete from marc_biblio");
36 $dbh->do("delete from marc_blob_subfield");
37 $dbh->do("delete from marc_subfield_table");
38 $dbh->do("delete from marc_word");
39 my $sth=$dbh->prepare("select * from biblio left join biblioitems on biblioitems.biblionumber=biblio.biblionumber order by biblio.biblionumber");
41 my $sth2 = $dbh->prepare("select count(*) from biblio");
43 my ($total) = $sth2->fetchrow_array;
47 while ($row=$sth->fetchrow_hashref) {
52 print "$rest / $total\n";
54 my $MARCbiblio = MARCkoha2marcBiblio($dbh,$row->{biblionumber},$row->{biblioitemnumber});
55 &MARCaddbiblio($dbh,$MARCbiblio,$row->{biblionumber});
56 my $sth_item = $dbh->prepare("select * from items where biblionumber=? and biblioitemnumber=?");
57 $sth_item->execute($row->{biblionumber},$row->{biblioitemnumber});
58 while ($row2=$sth_item->fetchrow_hashref) {
59 my $MARCitem = &MARCkoha2marcItem($dbh,$row2->{biblionumber},$row2->{itemnumber});
60 &MARCadditem($dbh,$MARCitem,$row2->{biblionumber});