Bug 25248: (bug 23463 follow-up) Item is returned if deletion successful, not 1
authorNick Clemens <nick@bywatersolutions.com>
Wed, 22 Apr 2020 13:30:06 +0000 (13:30 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 27 Apr 2020 09:56:52 +0000 (10:56 +0100)
To test:
1 - Have a record with some items
2 - Click 'Delete all' under 'Edit'
3 - Confirm deletion
4 - Note you are redirected to additem.pl
5 - Add an item
6 - Apply patch
7 - Delete all items again
8 - Note you are redirected to detail.pl

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

cataloguing/additem.pl

index 1a7e938..8025241 100755 (executable)
@@ -687,7 +687,7 @@ if ($op eq "additem") {
     my $items = Koha::Items->search({ biblionumber => $biblionumber });
     while ( my $item = $items->next ) {
         $error = $item->safe_delete({ skip_modzebra_update => 1 });
-        next if $error eq '1'; # Means ok
+        next if ref $error eq 'Koha::Item'; # Deleted item is returned if deletion successful
         push @errors,$error;
     }
     C4::Biblio::ModZebra( $biblionumber, "specialUpdate", "biblioserver" );