Bugzilla – Attachment 43789 Details for
Bug 14504
Add command-line script to batch delete items based on data in items table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
bug 14504: use C4::Items::DelItemCheck in delete_items.pl
bug-14504-use-C4ItemsDelItemCheck-in-deleteitemspl.patch (text/plain), 1.73 KB, created by
Barton Chittenden
on 2015-10-22 21:12:01 UTC
(
hide
)
Description:
bug 14504: use C4::Items::DelItemCheck in delete_items.pl
Filename:
MIME Type:
Creator:
Barton Chittenden
Created:
2015-10-22 21:12:01 UTC
Size:
1.73 KB
patch
obsolete
>From 85960c2f4d50bf0975b8ab1da67062aeb6a39237 Mon Sep 17 00:00:00 2001 >From: Barton Chittenden <barton@bywatersolutions.com> >Date: Thu, 22 Oct 2015 14:06:10 -0700 >Subject: [PATCH] bug 14504: use C4::Items::DelItemCheck in delete_items.pl > >--- > misc/cronjobs/delete_items.pl | 22 ++++++++-------------- > 1 file changed, 8 insertions(+), 14 deletions(-) > >diff --git a/misc/cronjobs/delete_items.pl b/misc/cronjobs/delete_items.pl >index 81f11c7..41a385b 100755 >--- a/misc/cronjobs/delete_items.pl >+++ b/misc/cronjobs/delete_items.pl >@@ -56,21 +56,15 @@ $GLOBAL->{sth}->{target_items} = $dbh->prepare( $query->{target_items} . $where_ > $GLOBAL->{sth}->{target_items}->execute(); > > DELITEM: while ( my $item = $GLOBAL->{sth}->{target_items}->fetchrow_hashref() ) { >- my $issue = GetOpenIssue( $item->{itemnumber} ); >- my $holds = GetItemHolds( $item->{biblionumber}, $item->{itemnumber} ); >- >- if( defined $issue ) { >- verbose "Cannot delete '$item->{itemnumber}' -- item is checked out."; >- next DELITEM; >- } >- >- if( $holds ) { >- verbose "Cannot delete '$item->{itemnumber}' -- item has open holds."; >- next DELITEM; >+ my $del_check_options = $OPTIONS->{flags}->{commit} >+ ? undef >+ : { do_not_commit => 1 }; >+ my $status = C4::Items::DelItemCheck( $dbh, $item->{itemnumber}, $item->{biblionumber}, $del_check_options ); >+ if( $status == 1 ) { >+ verbose "Deleting '$item->{itemnumber}'"; >+ } else { >+ verbose "Item '$item->{itemnumber}' not deletd: $status"; > } >- >- verbose "Deleting '$item->{itemnumber}' "; >- C4::Items::DelItem( { itemnumber => $item->{itemnumber} } ) if $OPTIONS->{flags}->{commit} ; > } > > =head1 NAME >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14504
:
40830
|
42978
|
43445
|
43533
|
43788
|
43789
|
44013
|
44149
|
45789
|
49648
|
49649
|
49650
|
49651
|
49652
|
49653
|
52425
|
53224
|
53225
|
54514
|
54515
|
54516
|
54517
|
54518
|
54519
|
54520
|
54521
|
54522
|
54525
|
54530
|
54531
|
54691
|
54692
|
54693
|
54694
|
54695
|
54696
|
54697
|
54698
|
54699
|
54700
|
54701
|
54702
|
54703