From 5f7a9af0322a5b52d6fed38cd55bdf580e6a29cd Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 15 Oct 2020 15:17:46 +0200 Subject: [PATCH] Bug 26515: Don't need to call safe_to_delete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jonathan Druart Signed-off-by: Séverine QUEUNE https://bugs.koha-community.org/show_bug.cgi?id=6819 --- Koha/Acquisition/Order.pm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm index c913a29..07dea68 100644 --- a/Koha/Acquisition/Order.pm +++ b/Koha/Acquisition/Order.pm @@ -127,15 +127,12 @@ sub cancel { # Delete the related items my $items = $self->items; while ( my $item = $items->next ) { - my $safe_to_delete = $item->safe_to_delete; - if ( $safe_to_delete eq '1' ) { - $item->safe_delete; - } - else { + my $deleted = $item->safe_delete; + unless ( ref($deleted) eq 'Koha::Item' ) { $self->add_message( { message => 'error_delitem', - payload => { item => $item, reason => $safe_to_delete } + payload => { item => $item, reason => $deleted } } ); } -- 2.1.4