From 1240261a4eb879eb2d46f10ef54c92f3baa51c28 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 19 Jan 2024 19:06:28 +0000 Subject: [PATCH] Bug 35165: Do not delete items in a transaction We are testing the deletion with safe_delete before removing, beyond that I think the intent was to delete all of the items, deleting some is better than not deleting any. To test: 1 - Apply patch, restart all 2 - Submit a batch deletion 3 - Confirm items are deleted --- Koha/BackgroundJob/BatchDeleteItem.pm | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Koha/BackgroundJob/BatchDeleteItem.pm b/Koha/BackgroundJob/BatchDeleteItem.pm index 474450e57b2..6c15bbc1587 100644 --- a/Koha/BackgroundJob/BatchDeleteItem.pm +++ b/Koha/BackgroundJob/BatchDeleteItem.pm @@ -94,9 +94,6 @@ sub process { @deleted_biblionumbers ); try { - my $schema = Koha::Database->new->schema; - $schema->txn_do( - sub { my (@biblionumbers); for my $record_id ( sort { $a <=> $b } @record_ids ) { @@ -107,7 +104,6 @@ sub process { my $return = $item->safe_delete({ skip_record_index => 1, skip_holds_queue => 1 }); unless ( $return ) { - # FIXME Do we need to rollback the whole transaction if a deletion failed? push @not_deleted_itemnumbers, $item->itemnumber; push @messages, { @@ -173,8 +169,6 @@ sub process { } ) if C4::Context->preference('RealTimeHoldsQueue'); } - } - ); } catch { @@ -187,8 +181,6 @@ sub process { error => $_, }; - die "Something terrible has happened!" - if ( $_ =~ /Rollback failed/ ); # Rollback failed }; $report->{deleted_itemnumbers} = \@deleted_itemnumbers; -- 2.30.2