[Koha-bugs] [Bug 32656] Script delete_records_via_leader.pl no longer deletes items
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Tue Jan 17 21:35:16 CET 2023
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32656
David Nind <david at davidnind.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |david at davidnind.com
--- Comment #2 from David Nind <david at davidnind.com> ---
Hi Kyle.
I had a go at testing (using KTD and the sample data), but didn't have any
luck:
1. I marked a record (146 with four items) as deleted (I edited the record, for
000 I used the plugin to change 5-Record status to d- Deleted).
2. Before the patch was applied, I ran
misc/cronjobs/delete_records_via_leader.pl -i -t -v (step 2 in the test plan
had -b, but I think that should -t to test?).
3. Output is:
misc/cronjobs/delete_records_via_leader.pl -t -i -v
RECORD: 1
TEST MODE: Item 1 would have been deleted
ERROR DELETING BIBLIO 1: Test mode enabled
DELETED 0 OF 1 RECORDS
DELETED 0 OF 1 ITEMS
4. If I confirm the deletion (-c instead of -t) I get this (the record and
items are not deleted, in the database the records still exist - SQL query:
select * from items where biblionumber = 146;):
misc/cronjobs/delete_records_via_leader.pl -c -i -v
RECORD: 1
DELETED ITEM 1
ERROR DELETING BIBLIO 1: This Biblio has items attached, please delete them
first before deleting this biblio
DELETED 0 OF 1 RECORDS
DELETED 1 OF 1 ITEMS
5. Applied the patch, then ran flush_memcached and restart_all.
6. Repeated step 3 above, the output is the same (as expected):
misc/cronjobs/delete_records_via_leader.pl -t -i -v
RECORD: 1
TEST MODE: Item 1 would have been deleted
ERROR DELETING BIBLIO 1: Test mode enabled
DELETED 0 OF 1 RECORDS
DELETED 0 OF 1 ITEMS
7. Repeated step 4 above, the output is:
misc/cronjobs/delete_records_via_leader.pl -c -i -v
RECORD: 1
DELETED ITEM 1
DELETED BIBLIO 1
DELETED 1 OF 1 RECORDS
DELETED 1 OF 1 ITEM
8. The record and items still exist.
9. I also tried on a record that has no items (Perl best practices - biblio
number = 5), and get the same behavour after the patch is applied:
misc/cronjobs/delete_records_via_leader.pl -t -i -v
RECORD: 2
ERROR DELETING BIBLIO 2: Test mode enabled
DELETED 0 OF 1 RECORDS
DELETED 0 OF 0 ITEMS
......
misc/cronjobs/delete_records_via_leader.pl -c -i -v
RECORD: 2
DELETED BIBLIO 2
DELETED 1 OF 1 RECORDS
DELETED 0 OF 0 ITEMS
So I think I may have misunderstood what should happen, or have just managed to
confuse myself...
Also, just to confirm that if a record has items then the records and items
should not be deleted unless the -i option is used? I found the help text
confusing (if you use -i then it will try to delete the items, but then says
"Records with items cannot be deleted."; or does this mean that if items can't
be deleted, for example if checked out, then the record won't be deleted?):
-i --delete-items: Try deleting items before deleting record.
Records with items cannot be deleted.
David
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list