From 03208d9741ea1886148b35508aa01fe933fd5478 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 1 Jun 2022 19:32:23 +0000 Subject: [PATCH] Bug 29325: Fix import from staff client same test as before, but via the staff client Signed-off-by: Nick Clemens --- tools/manage-marc-import.pl | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/tools/manage-marc-import.pl b/tools/manage-marc-import.pl index e84178fe42..64e3180dfd 100755 --- a/tools/manage-marc-import.pl +++ b/tools/manage-marc-import.pl @@ -235,21 +235,17 @@ sub commit_batch { my ( $num_added, $num_updated, $num_items_added, $num_items_replaced, $num_items_errored, $num_ignored ); my $schema = Koha::Database->new->schema; - $schema->storage->txn_do( - sub { - my $callback = sub { }; - if ($runinbackground) { - $job = put_in_background($import_batch_id); - $callback = progress_callback( $job, $dbh ); - } - ( - $num_added, $num_updated, $num_items_added, - $num_items_replaced, $num_items_errored, $num_ignored - ) - = BatchCommitRecords( $import_batch_id, $framework, 50, - $callback ); - } - ); + my $callback = sub { }; + if ($runinbackground) { + $job = put_in_background($import_batch_id); + $callback = progress_callback( $job ); + } + ( + $num_added, $num_updated, $num_items_added, + $num_items_replaced, $num_items_errored, $num_ignored + ) + = BatchCommitRecords( $import_batch_id, $framework, 50, + $callback ); my $results = { did_commit => 1, @@ -347,11 +343,11 @@ sub put_in_background { sub progress_callback { my $job = shift; - my $dbh = shift; return sub { my $progress = shift; + my $schema = shift; $job->progress($progress); - $dbh->commit(); + $schema->txn_commit; } } -- 2.30.2