Bug 29325: (QA follow-up) Tidy up

tools/manage-marc-import.pl: sub commit_batch does no longer need $schema
tools/manage-marc-import.pl: sub revert_batch: calling BatchRevertRecords which has no interval and callback
misc/commit_file.pl: sub print_progress_and_commit does no longer commit, renamed
misc/commit_file.pl: sub print_progress does no longer have a schema parameter
misc/commit_file.pl: sub revert_batch reported deleted items as added

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Marcel de Rooy 2022-06-24 09:31:51 +00:00 committed by Tomas Cohen Arazi
parent 1f62cbc618
commit 1eee121bed
2 changed files with 5 additions and 8 deletions

View File

@ -83,7 +83,7 @@ sub process_batch {
print "... importing MARC records -- please wait\n";
my ($num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored) =
BatchCommitRecords($import_batch_id, $framework, 100, \&print_progress_and_commit);
BatchCommitRecords($import_batch_id, $framework, 100, \&print_progress);
print "... finished importing MARC records\n";
print <<_SUMMARY_;
@ -120,14 +120,14 @@ Number of records deleted: $num_deleted
Number of errors: $num_errors
Number of records reverted: $num_reverted
Number of records ignored: $num_ignored
Number of items added: $num_items_deleted
Number of items deleted: $num_items_deleted
_SUMMARY_
}
sub print_progress_and_commit {
my ( $recs, $schema ) = @_;
sub print_progress {
my ( $recs ) = @_;
print "... processed $recs records\n";
}

View File

@ -234,7 +234,6 @@ sub commit_batch {
my $job = undef;
my ( $num_added, $num_updated, $num_items_added,
$num_items_replaced, $num_items_errored, $num_ignored );
my $schema = Koha::Database->new->schema;
my $callback = sub { };
if ($runinbackground) {
$job = put_in_background($import_batch_id);
@ -274,15 +273,13 @@ sub revert_batch {
my $schema = Koha::Database->new->schema;
$schema->txn_do(
sub {
my $callback = sub { };
if ($runinbackground) {
$job = put_in_background($import_batch_id);
$callback = progress_callback( $job );
}
(
$num_deleted, $num_errors, $num_reverted,
$num_items_deleted, $num_ignored
) = BatchRevertRecords( $import_batch_id, 50, $callback );
) = BatchRevertRecords( $import_batch_id );
}
);