From 7d20cafc4f8472fb07ba9ffa8f2a9432bf5847f4 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 Signed-off-by: Jonathan Druart --- 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 c913a294c6..07dea68939 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.39.5