From 56a79a8bc49a40095c9c7ce1dcedd88a75e5975f Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 22 Aug 2016 10:34:48 -0300 Subject: [PATCH] Bug 14504: (followup) Make deletion conditional on --commit Signed-off-by: Tomas Cohen Arazi --- misc/cronjobs/delete_items.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/misc/cronjobs/delete_items.pl b/misc/cronjobs/delete_items.pl index 7d15560..78a9b35 100755 --- a/misc/cronjobs/delete_items.pl +++ b/misc/cronjobs/delete_items.pl @@ -42,7 +42,7 @@ my @where = @{ $OPTIONS->{where} }; pod2usage( -verbose => 2 ) if $OPTIONS->{flags}->{manual}; pod2usage( -verbose => 1 ) if $OPTIONS->{flags}->{help}; -pod2usage( -verbose => 1 -msg => 'You must supply at least one --where option' ) if scalar @where == 0; +pod2usage( -verbose => 1 -msg => 'You must supply at least one --where option' ) if scalar @where == 0; sub verbose { say @_ if $OPTIONS->{flags}->{verbose}; @@ -59,7 +59,8 @@ DELITEM: while ( my $item = $GLOBAL->{sth}->{target_items}->fetchrow_hashref() ) my $status = C4::Items::ItemSafeToDelete( $item->{biblionumber}, $item->{itemnumber} ); if( $status eq '1' ) { - C4::Items::DelItemCheck( $item->{biblionumber}, $item->{itemnumber} ); + C4::Items::DelItemCheck( $item->{biblionumber}, $item->{itemnumber} ) + if $OPTIONS->{flags}->{commit}; verbose "Deleting '$item->{itemnumber}'"; } else { verbose "Item '$item->{itemnumber}' not deletd: $status"; -- 2.9.2