Bug 28255: Follow up to bug 23463 - use item_object in misc/cronjobs/delete_items.pl

This looks like just an assumption that the $item variable was an object

Correct the code to use $item_object

To test:
1 - perl misc/cronjobs/delete_items.pl -where="barcode LIKE '%8'" --commit --verbose
2 - Can't call method "safe_delete" on unblessed reference at /usr/share/koha/bin/cronjobs/delete_items.pl line 67.
3 - Apply patch
4 - Repeat
5 - Success! You deleted a bunch of items

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 423421eb64)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit bac2651c60)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2021-04-28 17:56:11 +00:00 committed by Andrew Fuerste-Henry
parent fc7589193d
commit cd66aa48de
1 changed files with 1 additions and 1 deletions

View File

@ -63,7 +63,7 @@ DELITEM: while ( my $item = $GLOBAL->{sth}->{target_items}->fetchrow_hashref() )
my $item_object = Koha::Items->find($item->{itemnumber});
my $safe_to_delete = $item_object->safe_to_delete;
if( $safe_to_delete eq '1' ) {
$item->safe_delete
$item_object->safe_delete
if $OPTIONS->{flags}->{commit};
verbose "Deleting '$item->{itemnumber}'";
} else {