[Koha] losing data during import
Scott Scriven
koha-main at toykeeper.net
Fri Aug 6 13:01:42 NZST 2004
* Scott Scriven <koha-main at toykeeper.net> wrote:
> I think I'll try modifying Koha's import script to accept MARC
> XML files. This way, I might simply sidestep the issue by
> removing two conversion steps.
Just a note to everyone that this worked, and was a trivial
modification. It can support the LoC MARC21slim XML format
pretty easily. Here's the diff:
--- bulkmarcimport.pl.orig 2004-08-05 11:38:50.000000000 -0600
+++ bulkmarcimport.pl 2004-08-05 13:00:39.000000000 -0600
@@ -5,6 +5,7 @@
# Koha modules used
use MARC::File::USMARC;
+use MARC::File::XML;
use MARC::Record;
use MARC::Batch;
use C4::Context;
@@ -69,7 +70,13 @@
$char_encoding = 'MARC21' unless ($char_encoding);
print "CHAR : $char_encoding\n" if $verbose;
my $starttime = gettimeofday;
-my $batch = MARC::Batch->new( 'USMARC', $input_marc_file );
+my $batch = "";
+if($input_marc_file =~ /xml$/) {
+ $batch = MARC::Batch->new( 'XML', $input_marc_file );
+}
+else {
+ $batch = MARC::Batch->new( 'USMARC', $input_marc_file );
+}
$batch->warnings_off();
$batch->strict_off();
my $i=0;
-- Scott
More information about the Koha
mailing list