X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=misc%2Fstage_file.pl;h=2e154667588e9f9874bc3a5222e0ed8b5dc8d8c2;hb=5d6c092921919526ade501facb1220f8a108a08f;hp=4ce16b59e15d2ad493c527004280bb769d0c4ab0;hpb=8a53d284907bbbe9d3ee2552e964af9f5dfbd0ac;p=koha_fer diff --git a/misc/stage_file.pl b/misc/stage_file.pl index 4ce16b59e1..2e15466758 100755 --- a/misc/stage_file.pl +++ b/misc/stage_file.pl @@ -45,12 +45,14 @@ my $input_file = ""; my $batch_comment = ""; my $want_help = 0; my $no_replace ; +my $item_action = 'always_add'; my $result = GetOptions( 'encoding:s' => \$encoding, 'file:s' => \$input_file, 'match|match-bibs:s' => \$match, 'add-items' => \$add_items, + 'item-action:s' => \$item_action, 'no-replace' => \$no_replace, 'comment:s' => \$batch_comment, 'authorities' => \$authorities, @@ -99,7 +101,7 @@ sub process_batch { print "... staging MARC records -- please wait\n"; my ($batch_id, $num_valid_records, $num_items, @import_errors) = - BatchStageMarcRecords($record_type, $encoding, $marc_records, $input_file, $batch_comment, '', $add_items, 0, + BatchStageMarcRecords($record_type, $encoding, $marc_records, $input_file, undef, $batch_comment, '', $add_items, 0, 100, \&print_progress_and_commit); print "... finished staging MARC records\n"; @@ -117,7 +119,7 @@ sub process_batch { # set default record overlay behavior SetImportBatchOverlayAction($batch_id, ($no_replace) ? 'ignore' : 'replace'); SetImportBatchNoMatchAction($batch_id, 'create_new'); - SetImportBatchItemAction($batch_id, 'always_add'); + SetImportBatchItemAction($batch_id, $item_action); print "... looking for matches with records already in database\n"; $num_with_matches = BatchFindDuplicates($batch_id, $matcher, 10, 100, \&print_progress_and_commit); print "... finished looking for matches\n"; @@ -186,6 +188,10 @@ Parameters: --add-items use this option to specify that item data is embedded in the MARC bibs and should be parsed. + --item-action action to take if --add-items is specifed; + choices are 'always_add', + 'add_only_for_matches', 'add_only_for_new', + 'ignore', or 'replace' --no-replace overlay action for record: default is to replace extant with the imported record. --comment optional comment to describe