From de9ce93cf284aa32f8c5c527387949ebc79cc4ea Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 30 Jan 2020 16:15:14 +0100 Subject: [PATCH] Bug 23463: Fix safe_return return value in deletion tools Signed-off-by: Tomas Cohen Arazi Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- tools/batchMod.pl | 2 +- tools/batch_delete_records.pl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/batchMod.pl b/tools/batchMod.pl index eedf9b827a..8b13257e5d 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -191,7 +191,7 @@ if ($op eq "action") { my $itemdata = $item->unblessed; if ( $del ){ my $return = $item->safe_delete; - if ($return == 1) { + if (ref($return)) { $deleted_items++; } else { $not_deleted_items++; diff --git a/tools/batch_delete_records.pl b/tools/batch_delete_records.pl index d1ab80c892..1dccbae99f 100755 --- a/tools/batch_delete_records.pl +++ b/tools/batch_delete_records.pl @@ -177,8 +177,8 @@ if ( $op eq 'form' ) { # Delete items my $items = Koha::Items->search({ biblionumber => $biblionumber }); while ( my $item = $items->next ) { - my $error = eval { $item->safe_delete }; - if ( $error ne '1' or $@ ) { + my $deleted_item = eval { $item->safe_delete }; + if ( !ref($deleted_item) or $@ ) { push @messages, { type => 'error', code => 'item_not_deleted', -- 2.39.5