From b8fca2a019a693a1b8a019db08decbd21e1c7821 Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 20 Oct 2003 15:42:43 +0000 Subject: [PATCH] Upgrade script : the koha2marc.pl copies the old DB into the new MARC one. This script must be executed when migrating from 1.2.x to 2.0.x. --- misc/dumpmarc.pl | 1 + misc/koha.upgrade | 12 ++++++++++++ misc/koha2marc.pl | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100755 misc/koha2marc.pl diff --git a/misc/dumpmarc.pl b/misc/dumpmarc.pl index 8043e7a796..2e355e66de 100755 --- a/misc/dumpmarc.pl +++ b/misc/dumpmarc.pl @@ -39,3 +39,4 @@ while ( my $record = $batch->next() ) { print "\n".$record->as_formatted() if ($i eq $number || $number eq 0); $i++; } +print "\n==================\n$i record parsed\n"; diff --git a/misc/koha.upgrade b/misc/koha.upgrade index 9391debe68..4f199c0880 100644 --- a/misc/koha.upgrade +++ b/misc/koha.upgrade @@ -491,6 +491,18 @@ In the OPAC VirtualHost section you should have: You may also need to uncomment a "LoadModules env_module ... " line and restart Apache. +If you're upgrading from 1.2.x version of Koha note that the MARC DB is NOT populated. +To populate it : +* launch Koha +* Go to Parameters >> Marc structure option and Koha-MARC links option. +* Modify default MARC structure to fit your needs. +* open a console +* type: +cd /path/to/koha/misc +export PERL5LIB=/path/to/koha +./koha2marc.pl +the old DB is "copied" in the new MARC one. +Koha 2.0.0 is ready :-) Please report any problems you encounter through http://bugs.koha.org/ |; diff --git a/misc/koha2marc.pl b/misc/koha2marc.pl new file mode 100755 index 0000000000..13bd151a78 --- /dev/null +++ b/misc/koha2marc.pl @@ -0,0 +1,46 @@ +#!/usr/bin/perl + +use C4::Context; +use CGI; +use DBI; +#use strict; +use C4::Biblio; +use C4::Output; +use Getopt::Long; + +my ( $confirm,$delete); +GetOptions( + 'c' => \$confirm, + 'd' => \$delete, +); + +my $dbh = C4::Context->dbh; +if ($delete) { + print "deleting MARC tables\n"; + $dbh->do("delete from marc_biblio"); + $dbh->do("delete from marc_subfield_table"); + $dbh->do("delete from marc_blob_subfield"); + $dbh->do("delete from marc_word"); +} + +my $userid=$ENV{'REMOTE_USER'}; +my $sthbiblioitem = $dbh->prepare("select biblioitemnumber from biblioitems where biblionumber=?"); +my $sthitems = $dbh->prepare("select itemnumber from items where biblionumber=?"); +my $sth=$dbh->prepare("select biblionumber from biblio"); +$sth->execute; +my $env; +$env->{'marconly'}=1; +my ($MARC, $biblionumber,$biblioitemnumber,$bibid); +while (($biblionumber) = $sth->fetchrow) { + print "Processing $biblionumber\n"; + $sthbiblioitem->execute($biblionumber); + ($biblioitemnumber) = $sthbiblioitem->fetchrow; + $MARC = &MARCkoha2marcBiblio($dbh,$biblionumber,$biblioitemnumber); + $bibid = &MARCaddbiblio($dbh,$MARC,$biblionumber); + # now, search items, and add them... + $sthitems->execute($biblionumber); + while (($itemnumber) = $sthitems->fetchrow) { + $MARC = &MARCkoha2marcItem($dbh,$biblionumber,$itemnumber); + &MARCadditem($dbh,$MARC,$biblionumber); + } +} -- 2.39.5