Bugzilla – Attachment 145407 Details for
Bug 32656
Script delete_records_via_leader.pl no longer deletes items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32656: Script delete_records_via_leader.pl no longer deletes items
Bug-32656-Script-deleterecordsvialeaderpl-no-longe.patch (text/plain), 2.58 KB, created by
Kyle M Hall (khall)
on 2023-01-18 20:05:28 UTC
(
hide
)
Description:
Bug 32656: Script delete_records_via_leader.pl no longer deletes items
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2023-01-18 20:05:28 UTC
Size:
2.58 KB
patch
obsolete
>From d8cb18cbb7cca0c644e2884e96f2883ef979da0a Mon Sep 17 00:00:00 2001 >From: Kyle Hall <kyle@bywatersolutions.com> >Date: Tue, 17 Jan 2023 12:18:00 -0500 >Subject: [PATCH] =?UTF-8?q?Bug=C2=A032656:=20Script=20delete=5Frecords=5Fv?= > =?UTF-8?q?ia=5Fleader.pl=20no=20longer=20deletes=20items?= >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Bug 29788 inadvertantly replaced a call to safe_delete() with safe_to_delete() such that any time the script should delete an item it only checks to see if the item is delectable, after which deletion of the record fails because the items were not deleted. > >Test Plan: >1) Mark a record with items to be deleted via the record leader >2) Run delete_records_via_leader.pl -i -b -v >3) Note the script says it is deleting the items but then the record > deletion fails. Note the items remain in the items table of the > database. >4) Apply this patch >5) Repeat step 2 >6) This time the items and record should be deleted! >--- > misc/cronjobs/delete_records_via_leader.pl | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > >diff --git a/misc/cronjobs/delete_records_via_leader.pl b/misc/cronjobs/delete_records_via_leader.pl >index 030b1475dd7..c94a2615ca7 100755 >--- a/misc/cronjobs/delete_records_via_leader.pl >+++ b/misc/cronjobs/delete_records_via_leader.pl >@@ -70,16 +70,16 @@ This script has the following parameters : > exit(); > } > >-my @metadatas = # Should be replaced by a call to C4::Search on zebra index >+my $metadatas = # Should be replaced by a call to C4::Search on zebra index > # Record-status when bug 15537 will be pushed > Koha::Biblio::Metadatas->search( { format => 'marcxml', schema => C4::Context->preference('marcflavour'), metadata => { LIKE => '%<leader>_____d%' } } ); > >-my $total_records_count = @metadatas; >+my $total_records_count = $metadatas->count; > my $deleted_records_count = 0; > my $total_items_count = 0; > my $deleted_items_count = 0; >-foreach my $m (@metadatas) { >- my $biblionumber = $m->get_column('biblionumber'); >+while ( my $m = $metadatas->next ) { >+ my $biblionumber = $m->biblionumber; > > say "RECORD: $biblionumber" if $verbose; > >@@ -99,7 +99,7 @@ foreach my $m (@metadatas) { > say "TEST MODE: ERROR DELETING ITEM $itemnumber: $error"; > } > } else { >- my $deleted = $item->safe_to_delete; >+ my $deleted = $item->safe_delete; > if ( $deleted ) { > say "DELETED ITEM $itemnumber" if $verbose; > $deleted_items_count++; >-- >2.39.1
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 32656
:
145364
|
145407
|
145460
|
145506