2 # Import an iso2709 file into Koha 3
8 use MARC::File::USMARC;
22 use C4::Charset qw( MarcToUTF8Record SetUTF8Flag );
23 use C4::Items qw( AddItemBatchFromMarc );
24 use C4::MarcModificationTemplates qw(
25 GetModificationTemplates
26 ModifyRecordWithTemplate
28 use C4::AuthoritiesMarc qw( GuessAuthTypeCode GuessAuthId GetAuthority ModAuthority AddAuthority );
31 use Time::HiRes qw( gettimeofday );
32 use Getopt::Long qw( GetOptions );
34 use Pod::Usage qw( pod2usage );
39 use Koha::SearchEngine;
40 use Koha::SearchEngine::Search;
42 use open qw( :std :encoding(UTF-8) );
43 binmode( STDOUT, ":encoding(UTF-8)" );
44 my ( $input_marc_file, $number, $offset) = ('',0,0);
45 my ($version, $delete, $test_parameter, $skip_marc8_conversion, $char_encoding, $verbose, $commit, $fk_off,$format,$biblios,$authorities,$keepids,$match, $isbn_check, $logfile);
46 my ( $insert, $filters, $update, $all, $yamlfile, $authtypes, $append );
48 my ($sourcetag,$sourcesubfield,$idmapfl, $dedup_barcode);
51 my $marc_mod_template = '';
52 my $marc_mod_template_id = -1;
57 'commit:f' => \$commit,
58 'file:s' => \$input_marc_file,
60 'o|offset:f' => \$offset,
63 't|test' => \$test_parameter,
64 's' => \$skip_marc8_conversion,
65 'c:s' => \$char_encoding,
71 'k|keepids:s' => \$keepids,
72 'b|biblios' => \$biblios,
73 'a|authorities' => \$authorities,
74 'authtypes:s' => \$authtypes,
75 'filter=s@' => \$filters,
79 'match=s@' => \$match,
80 'i|isbn' => \$isbn_check,
82 'y:s' => \$sourcesubfield,
83 'idmap:s' => \$idmapfl,
84 'cleanisbn!' => \$cleanisbn,
85 'yaml:s' => \$yamlfile,
86 'dedupbarcode' => \$dedup_barcode,
87 'framework=s' => \$framework,
88 'custom:s' => \$localcust,
89 'marcmodtemplate:s' => \$marc_mod_template,
91 $biblios ||= !$authorities;
93 my $writemode = ($append) ? "a" : "w";
95 pod2usage( -msg => "\nYou must specify either --biblios or --authorities, not both.\n", -exitval ) if $biblios && $authorities;
102 if ($version || ($input_marc_file eq '')) {
103 pod2usage( -verbose => 2 );
106 if( $update && !( $match || $isbn_check ) ) {
107 warn "Using -update without -match or -isbn seems to be useless.\n";
110 if(defined $localcust) { #local customize module
112 $localcust= $localcust||'LocalChanges'; #default name
113 $localcust=~ s/^.*\/([^\/]+)$/$1/; #extract file name only
114 $localcust=~ s/\.pm$//; #remove extension
115 my $fqcust= $FindBin::Bin."/$localcust.pm"; #try migration_tools dir
120 print "WARNING: customize module $localcust.pm not found!\n";
124 require $localcust if $localcust;
125 $localcust=\&customize if $localcust;
128 if($marc_mod_template ne '') {
129 my @templates = GetModificationTemplates();
130 foreach my $this_template (@templates) {
131 if($this_template->{'name'} eq $marc_mod_template) {
132 if($marc_mod_template_id < 0) {
133 $marc_mod_template_id = $this_template->{'template_id'};
135 print "WARNING: MARC modification template name " .
136 "'$marc_mod_template' matches multiple templates. " .
137 "Please rename these templates\n";
142 if($marc_mod_template_id < 0) {
143 die "Can't located MARC modification template '$marc_mod_template'\n";
145 print "Records will be modified using MARC modification template: $marc_mod_template\n" if $verbose;
149 my $dbh = C4::Context->dbh;
150 my $heading_fields=get_heading_fields();
153 if (defined $idmapfl) {
154 open($idmapfh, '>', $idmapfl) or die "cannot open $idmapfl \n";
157 if ((not defined $sourcesubfield) && (not defined $sourcetag)){
163 # Disable logging for the biblios and authorities import operation. It would unnecessarily
165 $ENV{OVERRIDE_SYSPREF_CataloguingLog} = 0;
166 $ENV{OVERRIDE_SYSPREF_AuthoritiesLog} = 0;
169 $dbh->do("SET FOREIGN_KEY_CHECKS = 0");
175 print "deleting biblios\n";
176 $dbh->do("DELETE FROM biblio");
177 $dbh->do("ALTER TABLE biblio AUTO_INCREMENT = 1");
178 $dbh->do("DELETE FROM biblioitems");
179 $dbh->do("ALTER TABLE biblioitems AUTO_INCREMENT = 1");
180 $dbh->do("DELETE FROM items");
181 $dbh->do("ALTER TABLE items AUTO_INCREMENT = 1");
184 print "deleting authorities\n";
185 $dbh->do("truncate auth_header");
187 $dbh->do("truncate zebraqueue");
192 if ($test_parameter) {
193 print "TESTING MODE ONLY\n DOING NOTHING\n===============\n";
196 my $marcFlavour = C4::Context->preference('marcflavour') || 'MARC21';
198 # The definition of $searcher must be before MARC::Batch->new
199 my $searcher = Koha::SearchEngine::Search->new(
203 ? $Koha::SearchEngine::AUTHORITIES_INDEX
204 : $Koha::SearchEngine::BIBLIOS_INDEX
209 print "Characteristic MARC flavour: $marcFlavour\n" if $verbose;
210 my $starttime = gettimeofday;
212 my $fh = IO::File->new($input_marc_file); # don't let MARC::Batch open the file, as it applies the ':utf8' IO layer
213 if (defined $format && $format =~ /XML/i) {
214 # ugly hack follows -- MARC::File::XML, when used by MARC::Batch,
215 # appears to try to convert incoming XML records from MARC-8
216 # to UTF-8. Setting the BinaryEncoding key turns that off
217 # TODO: see what happens to ISO-8859-1 XML files.
218 # TODO: determine if MARC::Batch can be fixed to handle
219 # XML records properly -- it probably should be
220 # be using a proper push or pull XML parser to
221 # extract the records, not using regexes to look
222 # for <record>.*</record>.
223 $MARC::File::XML::_load_args{BinaryEncoding} = 'utf-8';
224 my $recordformat= ($marcFlavour eq "MARC21"?"USMARC":uc($marcFlavour));
225 #UNIMARC Authorities have a different way to manage encoding than UNIMARC biblios.
226 $recordformat=$recordformat."AUTH" if ($authorities and $marcFlavour ne "MARC21");
227 $MARC::File::XML::_load_args{RecordFormat} = $recordformat;
228 $batch = MARC::Batch->new( 'XML', $fh );
230 $batch = MARC::Batch->new( 'USMARC', $fh );
232 $batch->warnings_off();
233 $batch->strict_off();
235 my $commitnum = $commit ? $commit : 50;
240 print "Skipping file offset: $offset records\n";
241 $batch->next() while ($offset--);
244 my ($tagid,$subfieldid);
249 ( $tagid, $subfieldid ) =
250 GetMarcFromKohaField( "biblio.biblionumber" );
254 # the SQL query to search on isbn
255 my $sth_isbn = $dbh->prepare("SELECT biblionumber,biblioitemnumber FROM biblioitems WHERE isbn=?");
259 $loghandle= IO::File->new($logfile, $writemode) ;
260 print $loghandle "id;operation;status\n";
263 my $logger = Koha::Logger->get;
264 my $schema = Koha::Database->schema;
269 eval { $record = $batch->next() };
271 print "Bad MARC record $i: $@ skipped\n";
272 # FIXME - because MARC::Batch->next() combines grabbing the next
273 # blob and parsing it into one operation, a correctable condition
274 # such as a MARC-8 record claiming that it's UTF-8 can't be recovered
275 # from because we don't have access to the original blob. Note
276 # that the staging import can deal with this condition (via
277 # C4::Charset::MarcToUTF8Record) because it doesn't use MARC::Batch.
280 # skip if we get an empty record (that is MARC valid, but will result in AddBiblio failure
281 last unless ( $record );
283 if( ($verbose//1)==1 ) { #no dot for verbose==2
284 print "." . ( $i % 100==0 ? "\n$i" : '' );
287 # transcode the record to UTF8 if needed & applicable.
288 if ($record->encoding() eq 'MARC-8' and not $skip_marc8_conversion) {
289 # FIXME update condition
290 my ($guessed_charset, $charset_errors);
291 ($record, $guessed_charset, $charset_errors) = MarcToUTF8Record($record, $marcFlavour.(($authorities and $marcFlavour ne "MARC21")?'AUTH':''));
292 if ($guessed_charset eq 'failed') {
293 warn "ERROR: failed to perform character conversion for record $i\n";
297 SetUTF8Flag($record);
298 if($marc_mod_template_id > 0) {
299 print "Modifying MARC\n" if $verbose;
300 ModifyRecordWithTemplate( $marc_mod_template_id, $record );
302 &$localcust($record) if $localcust;
304 # remove trailing - in isbn (only for biblios, of course)
306 my $tag = $marcFlavour eq 'UNIMARC' ? '010' : '020';
307 my $field = $record->field($tag);
308 $isbn = $field && $field->subfield('a');
309 if ( $isbn && $cleanisbn ) {
311 $field->update('a' => $isbn);
315 # search for duplicates (based on Local-number)
317 $originalid = GetRecordId( $record, $tagid, $subfieldid );
320 my $query = build_query( $match, $record );
321 my $server = ( $authorities ? 'authorityserver' : 'biblioserver' );
322 my ( $error, $results, $totalhits ) = $searcher->simple_search_compat( $query, 0, 3, [$server] );
323 # changed to warn so able to continue with one broken record
324 if ( defined $error ) {
325 warn "unable to search the database for duplicates : $error";
326 printlog( { id => $id || $originalid || $match, op => "match", status => "ERROR" } ) if ($logfile);
329 if ( $results && scalar(@$results) == 1 ) {
330 my $marcrecord = C4::Search::new_record_from_zebra( $server, $results->[0] );
331 SetUTF8Flag($marcrecord);
332 $id = GetRecordId( $marcrecord, $tagid, $subfieldid );
333 if ( $authorities && $marcFlavour ) {
334 #Skip if authority in database is the same as the on in database
335 if ( $marcrecord->field('005') && $record->field('005') &&
336 $marcrecord->field('005')->data && $record->field('005')->data &&
337 $marcrecord->field('005')->data >= $record->field('005')->data ) {
339 $yamlhash->{$originalid}->{'authid'} = $id;
341 # we recover all subfields of the heading authorities
343 foreach my $field ( $marcrecord->field("2..") ) {
344 push @subfields, map { ( $_->[0] =~ /[a-z]/ ? $_->[1] : () ) } $field->subfields();
346 $yamlhash->{$originalid}->{'subfields'} = \@subfields;
347 $yamlhash->{$originalid}->{'updated'} = 0;
352 } elsif ( $results && scalar(@$results) > 1 ) {
353 $logger->debug("more than one match for $query");
355 $logger->debug("nomatch for $query");
358 if ($keepids && $originalid) {
360 if ( length($keepids) == 3 ) {
361 $storeidfield = MARC::Field->new( $keepids, $originalid );
363 $storeidfield = MARC::Field->new( substr( $keepids, 0, 3 ), "", "", substr( $keepids, 3, 1 ), $originalid );
365 $record->insert_fields_ordered($storeidfield);
366 $record->delete_field( $record->field($tagid) );
368 foreach my $stringfilter (@$filters) {
369 if ( length($stringfilter) == 3 ) {
370 foreach my $field ( $record->field($stringfilter) ) {
371 $record->delete_field($field);
372 $logger->debug("removed : ", $field->as_string);
374 } elsif ($stringfilter =~ /([0-9]{3})([a-z0-9])(.*)/) {
376 my $removesubfield = $2;
377 my $removematch = $3;
378 if ( ( $removetag > "010" ) && $removesubfield ) {
379 foreach my $field ( $record->field($removetag) ) {
380 $field->delete_subfield( code => "$removesubfield", match => $removematch );
381 $logger->debug("Potentially removed : ", $field->subfield($removesubfield));
386 unless ($test_parameter) {
388 my $authtypecode=GuessAuthTypeCode($record, $heading_fields);
389 my $authid= ($id?$id:GuessAuthId($record));
390 if ($authid && GetAuthority($authid) && $update ){
391 ## Authority has an id and is in database : Replace
392 eval { ( $authid ) = ModAuthority($authid,$record, $authtypecode) };
394 warn "Problem with authority $authid Cannot Modify";
395 printlog({id=>$originalid||$id||$authid, op=>"edit",status=>"ERROR"}) if ($logfile);
398 printlog({id=>$originalid||$id||$authid, op=>"edit",status=>"ok"}) if ($logfile);
402 ## True insert in database
403 eval { ( $authid ) = AddAuthority($record,"", $authtypecode) };
405 warn "Problem with authority $authid Cannot Add".$@;
406 printlog({id=>$originalid||$id||$authid, op=>"insert",status=>"ERROR"}) if ($logfile);
409 printlog({id=>$originalid||$id||$authid, op=>"insert",status=>"ok"}) if ($logfile);
413 $yamlhash->{$originalid}->{'authid'} = $authid;
415 foreach my $field ( $record->field("2..") ) {
416 push @subfields, map { ( $_->[0] =~ /[a-z]/ ? $_->[1] : () ) } $field->subfields();
418 $yamlhash->{$originalid}->{'subfields'} = \@subfields;
419 $yamlhash->{$originalid}->{'updated'} = 1;
423 my ( $biblionumber, $biblioitemnumber, $itemnumbers_ref, $errors_ref );
425 # check for duplicate, based on ISBN (skip it if we already have found a duplicate with match parameter
426 if (!$biblionumber && $isbn_check && $isbn) {
427 # warn "search ISBN : $isbn";
428 $sth_isbn->execute($isbn);
429 ($biblionumber,$biblioitemnumber) = $sth_isbn->fetchrow;
431 if (defined $idmapfl) {
432 if ($sourcetag < "010"){
433 if ($record->field($sourcetag)){
434 my $source = $record->field($sourcetag)->data();
435 printf($idmapfh "%s|%s\n",$source,$biblionumber);
438 my $source=$record->subfield($sourcetag,$sourcesubfield);
439 printf($idmapfh "%s|%s\n",$source,$biblionumber);
442 # create biblio, unless we already have it ( either match or isbn )
445 $biblioitemnumber = Koha::Biblios->find( $biblionumber )->biblioitem->biblioitemnumber;
448 eval { ModBiblio( $record, $biblionumber, $framework, { overlay_context => { source => 'bulkmarcimport' } } ) };
450 warn "ERROR: Edit biblio $biblionumber failed: $@\n";
451 printlog( { id => $id || $originalid || $biblionumber, op => "update", status => "ERROR" } ) if ($logfile);
454 printlog( { id => $id || $originalid || $biblionumber, op => "update", status => "ok" } ) if ($logfile);
457 printlog( { id => $id || $originalid || $biblionumber, op => "insert", status => "warning : already in database" } ) if ($logfile);
461 eval { ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, $framework, { defer_marc_save => 1 } ) };
463 warn "ERROR: Adding biblio $biblionumber failed: $@\n";
464 printlog( { id => $id || $originalid || $biblionumber, op => "insert", status => "ERROR" } ) if ($logfile);
467 printlog( { id => $id || $originalid || $biblionumber, op => "insert", status => "ok" } ) if ($logfile);
470 warn "WARNING: Updating record ".($id||$originalid)." failed";
471 printlog( { id => $id || $originalid || $biblionumber, op => "update", status => "warning : not in database" } ) if ($logfile);
475 eval { ( $itemnumbers_ref, $errors_ref ) = AddItemBatchFromMarc( $record, $biblionumber, $biblioitemnumber, '' ); };
476 my $error_adding = $@;
477 # Work on a clone so that if there are real errors, we can maybe
479 my $clone_record = $record->clone();
480 C4::Biblio::_strip_item_fields($clone_record, '');
481 # This sets the marc fields if there was an error, and also calls
483 ModBiblioMarc( $clone_record, $biblionumber );
484 if ( $error_adding ) {
485 warn "ERROR: Adding items to bib $biblionumber failed: $error_adding";
486 printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ERROR"}) if ($logfile);
487 # if we failed because of an exception, assume that
488 # the MARC columns in biblioitems were not set.
492 printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ok"}) if ($logfile);
494 if ($dedup_barcode && grep { exists $_->{error_code} && $_->{error_code} eq 'duplicate_barcode' } @$errors_ref) {
495 # Find the record called 'barcode'
496 my ($tag, $sub) = C4::Biblio::GetMarcFromKohaField( 'items.barcode' );
497 # Now remove any items that didn't have a duplicate_barcode error,
498 # erase the barcodes on items that did, and re-add those items.
500 foreach my $i (0 .. $#{$errors_ref}) {
501 my $ref = $errors_ref->[$i];
502 if ($ref && ($ref->{error_code} eq 'duplicate_barcode')) {
503 $dupes{$ref->{item_sequence}} = 1;
504 # Delete the error message because we're going to
506 delete $errors_ref->[$i];
510 foreach my $field ($record->field($tag)) {
513 # Here we remove the barcode
514 $field->delete_subfield(code => $sub);
516 # otherwise we delete the field because we don't want
518 $record->delete_fields($field);
521 # Now re-add the record as before, adding errors to the prev list
523 eval { ( $itemnumbers_ref, $more_errors ) = AddItemBatchFromMarc( $record, $biblionumber, $biblioitemnumber, '' ); };
525 warn "ERROR: Adding items to bib $biblionumber failed: $@\n";
526 printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ERROR"}) if ($logfile);
527 # if we failed because of an exception, assume that
528 # the MARC columns in biblioitems were not set.
529 ModBiblioMarc( $record, $biblionumber );
532 printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ok"}) if ($logfile);
534 push @$errors_ref, @{ $more_errors };
536 if ($#{ $errors_ref } > -1) {
537 report_item_errors($biblionumber, $errors_ref);
539 $yamlhash->{$originalid} = $biblionumber if ($yamlfile);
541 if ( 0 == $i % $commitnum ) {
546 print $record->as_formatted()."\n" if ($verbose//0)==2;
547 last if $i == $number;
552 $dbh->do("SET FOREIGN_KEY_CHECKS = 1");
555 # Restore CataloguingLog and AuthoritiesLog
556 delete $ENV{OVERRIDE_SYSPREF_CataloguingLog};
557 delete $ENV{OVERRIDE_SYSPREF_AuthoritiesLog};
559 my $timeneeded = gettimeofday - $starttime;
560 print "\n$i MARC records done in $timeneeded seconds\n";
562 print $loghandle "file : $input_marc_file\n";
563 print $loghandle "$i MARC records done in $timeneeded seconds\n";
567 open my $yamlfileout, q{>}, "$yamlfile" or die "cannot open $yamlfile \n";
568 print $yamlfileout Encode::decode_utf8(YAML::XS::Dump($yamlhash));
573 my $marcrecord=shift;
578 return $marcrecord->field($tag)->data() if $marcrecord->field($tag);
581 if ($marcrecord->field($tag)){
582 return $marcrecord->subfield($tag,$subfield);
591 foreach my $matchingpoint (@$match){
592 my $string = build_simplequery($matchingpoint,$record);
593 push @searchstrings,$string if (length($string)>0);
596 return join(" $op ",@searchstrings);
598 sub build_simplequery {
602 my ($index,$recorddata)=split /,/,$element;
603 if ($recorddata=~/(\d{3})(.*)/) {
604 my ($tag,$subfields) =($1,$2);
605 foreach my $field ($record->field($tag)){
606 if (length($field->as_string("$subfields"))>0){
607 push @searchstrings,"$index:\"".$field->as_string("$subfields")."\"";
612 return join(" $op ",@searchstrings);
614 sub report_item_errors {
615 my $biblionumber = shift;
616 my $errors_ref = shift;
618 foreach my $error (@{ $errors_ref }) {
620 my $msg = "Item not added (bib $biblionumber, item tag #$error->{'item_sequence'}, barcode $error->{'item_barcode'}): ";
621 my $error_code = $error->{'error_code'};
622 $error_code =~ s/_/ /g;
623 $msg .= "$error_code $error->{'error_information'}";
628 my $logelements=shift;
629 print $loghandle join( ";", map { defined $_ ? $_ : "" } @$logelements{qw<id op status>} ), "\n";
631 sub get_heading_fields{
634 $headingfields = YAML::XS::LoadFile($authtypes);
635 $headingfields={C4::Context->preference('marcflavour')=>$headingfields};
636 $logger->debug(Encode::decode_utf8(YAML::XS::Dump($headingfields)));
638 unless ($headingfields){
639 $headingfields=$dbh->selectall_hashref("SELECT auth_tag_to_report, authtypecode from auth_types",'auth_tag_to_report',{Slice=>{}});
640 $headingfields={C4::Context->preference('marcflavour')=>$headingfields};
642 return $headingfields;
647 bulkmarcimport.pl - Import bibliographic/authority records into Koha
651 $ export KOHA_CONF=/etc/koha.conf
652 $ perl misc/migration_tools/bulkmarcimport.pl -d -commit 1000 \\
653 -file /home/jmf/koha.mrc -n 3000
657 Don't use this script before you've entered and checked your MARC parameters
658 tables twice (or more!). Otherwise, the import won't work correctly and you
659 will get invalid data.
667 This version/help screen
669 =item B<-b, -biblios>
671 Type of import: bibliographic records
673 =item B<-a, -authorities>
675 Type of import: authority records
677 =item B<-file>=I<FILE>
679 The I<FILE> to import
683 Verbose mode. 1 means "some infos", 2 means "MARC dumping"
687 Turn off foreign key checks during import.
689 =item B<-n>=I<NUMBER>
691 The I<NUMBER> of records to import. If missing, all the file is imported
693 =item B<-o, -offset>=I<NUMBER>
695 File offset before importing, ie I<NUMBER> of records to skip.
697 =item B<-commit>=I<NUMBER>
699 The I<NUMBER> of records to wait before performing a 'commit' operation
703 File logs actions done for each record and their status into file
707 If specified, data will be appended to the logfile. If not, the logfile will be erased for each execution.
711 Test mode: parses the file, saying what it would do, but doing nothing.
715 Skip automatic conversion of MARC-8 to UTF-8. This option is provided for
718 =item B<-c>=I<CHARACTERISTIC>
720 The I<CHARACTERISTIC> MARC flavour. At the moment, only I<MARC21> and
721 I<UNIMARC> are supported. MARC21 by default.
725 Delete EVERYTHING related to biblio in koha-DB before import. Tables: biblio,
728 =item B<-m>=I<FORMAT>
730 Input file I<FORMAT>: I<MARCXML> or I<ISO2709> (defaults to ISO2709)
734 file yamlfile with authoritiesTypes and distinguishable record field in order
735 to store the correct authtype
739 yaml file format a yaml file with ids
743 list of fields that will not be imported. Can be any from 000 to 999 or field,
744 subfield and subfield's matching value such as 200avalue
748 if set, only insert when possible
752 if set, only updates (any biblio should have a matching record)
756 if set, do whatever is required
758 =item B<-k, -keepids>=<FIELD>
760 Field store ids in I<FIELD> (useful for authorities, where 001 contains the
761 authid for Koha, that can contain a very valuable info for authorities coming
762 from LOC or BNF. useless for biblios probably)
764 =item B<-match>=<FIELD>
766 I<FIELD> matchindex,fieldtomatch matchpoint to use to deduplicate fieldtomatch
767 can be either 001 to 999 or field and list of subfields as such 100abcde
771 If set, a search will be done on isbn, and, if the same isbn is found, the
772 biblio is not added. It's another method to deduplicate. B<-match> & B<-isbn>
777 Clean ISBN fields from entering biblio records, ie removes hyphens. By default,
778 ISBN are cleaned. --nocleanisbn will keep ISBN unchanged.
782 Source bib I<TAG> for reporting the source bib number
784 =item B<-y>=I<SUBFIELD>
786 Source I<SUBFIELD> for reporting the source bib number
788 =item B<-idmap>=I<FILE>
790 I<FILE> for the koha bib and source id
794 Store ids in 009 (useful for authorities, where 001 contains the authid for
795 Koha, that can contain a very valuable info for authorities coming from LOC or
796 BNF. useless for biblios probably)
798 =item B<-dedupbarcode>
800 If set, whenever a duplicate barcode is detected, it is removed and the attempt
801 to add the record is retried, thereby giving the record a blank barcode. This
802 is useful when something has set barcodes to be a biblio ID, or similar
803 (usually other software.)
807 This is the code for the framework that the requested records will have attached
808 to them when they are created. If not specified, then the default framework
811 =item B<-custom>=I<MODULE>
813 This parameter allows you to use a local module with a customize subroutine
814 that is called for each MARC record.
815 If no filename is passed, LocalChanges.pm is assumed to be in the
816 migration_tools subdirectory. You may pass an absolute file name or a file name
817 from the migration_tools directory.
819 =item B<-marcmodtemplate>=I<TEMPLATE>
821 This parameter allows you to specify the name of an existing MARC
822 modification template to apply as the MARC records are imported (these
823 templates are created in the "MARC modification templates" tool in Koha).
824 If not specified, no MARC modification templates are used (default).