# in future, probably should tie to a real user account
C4::Context->set_userenv(0, 'batch', 0, 'batch', 'batch', 'batch', 'batch', 'batch');
# in future, probably should tie to a real user account
C4::Context->set_userenv(0, 'batch', 0, 'batch', 'batch', 'batch', 'batch', 'batch');
if ($batch_number =~ /^\d+$/ and $batch_number > 0) {
my $batch = GetImportBatch($batch_number);
die "$0: import batch $batch_number does not exist in database\n" unless defined $batch;
die "$0: import batch $batch_number status is '" . $batch->{'import_status'} . "', and therefore cannot be imported\n"
unless $batch->{'import_status'} eq "staged" or $batch->{'import_status'} eq "reverted";
process_batch($batch_number);
if ($batch_number =~ /^\d+$/ and $batch_number > 0) {
my $batch = GetImportBatch($batch_number);
die "$0: import batch $batch_number does not exist in database\n" unless defined $batch;
die "$0: import batch $batch_number status is '" . $batch->{'import_status'} . "', and therefore cannot be imported\n"
unless $batch->{'import_status'} eq "staged" or $batch->{'import_status'} eq "reverted";
process_batch($batch_number);
print "... importing MARC records -- please wait\n";
my ($num_added, $num_updated, $num_items_added, $num_items_errored, $num_ignored) =
print "... importing MARC records -- please wait\n";
my ($num_added, $num_updated, $num_items_added, $num_items_errored, $num_ignored) =
- BatchCommitBibRecords($import_batch_id, 100, \&print_progress);
+ BatchCommitBibRecords($import_batch_id, '', 100, \&print_progress_and_commit);