[Koha-cvs] CVS: koha/misc koha2marc.pl,NONE,1.1 dumpmarc.pl,1.2,1.3 koha.upgrade,1.5,1.6

Paul POULAIN tipaul at users.sourceforge.net
Mon Oct 20 17:42:45 CEST 2003


Update of /cvsroot/koha/koha/misc
In directory sc8-pr-cvs1:/tmp/cvs-serv28325/misc

Modified Files:
	dumpmarc.pl koha.upgrade 
Added Files:
	koha2marc.pl 
Log Message:
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.


--- NEW FILE ---
#!/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);
	}
}

Index: dumpmarc.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/dumpmarc.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** dumpmarc.pl	21 May 2003 14:19:32 -0000	1.2
--- dumpmarc.pl	20 Oct 2003 15:42:43 -0000	1.3
***************
*** 40,41 ****
--- 40,42 ----
  	$i++;
  }
+ print "\n==================\n$i record parsed\n";

Index: koha.upgrade
===================================================================
RCS file: /cvsroot/koha/koha/misc/koha.upgrade,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** koha.upgrade	20 Oct 2003 14:25:36 -0000	1.5
--- koha.upgrade	20 Oct 2003 15:42:43 -0000	1.6
***************
*** 492,495 ****
--- 492,507 ----
  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/





More information about the Koha-cvs mailing list