Bug 29794

Summary: delete_items.pl missing include
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: Command-line UtilitiesAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: andrew, fridolin.somers, jonathan.druart, kyle, lucas, robin
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28255
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00,21.11.02
Circulation function:
Bug Depends on: 23463    
Bug Blocks: 29788    
Attachments: Bug 29794: Add missing include in delete_items.pl
Bug 29794: (follow-up) Add license
Bug 29794: Add missing include in delete_items.pl
Bug 29794: (follow-up) Add license
Bug 29794: (follow-up) Add license

Description Tomás Cohen Arazi (tcohen) 2022-01-04 19:50:27 UTC
To reproduce:
1. Choose an item that is checked out and copy its barcode
2. Run:
   $ kshell
  k$ perl misc/cronjobs/delete_items.pl --verbose \
          --where "barcode='39999000010831'"
=> FAIL: It explodes with:
Can't locate object method "find" via package "Koha::Items"...
Comment 1 Tomás Cohen Arazi (tcohen) 2022-01-04 19:56:03 UTC
Created attachment 129011 [details] [review]
Bug 29794: Add missing include in delete_items.pl

This patch adds a missing include so the script is no longer broken.

To test:
1. Choose an item that is checked out and copy its barcode
2. Run:
   $ kshell
  k$ perl misc/cronjobs/delete_items.pl --verbose \
          --where "barcode='39999000010831'"
=> FAIL: It explodes with:
Can't locate object method "find" via package "Koha::Items"...
3. Apply this patch
4. Repeat 2
=> SUCCESS: You get:
Where statement:  where barcode='39999000010831'
Item '549' not deleted: book_on_loan
5. Sign off :-D
Comment 2 Tomás Cohen Arazi (tcohen) 2022-01-04 19:56:08 UTC
Created attachment 129012 [details] [review]
Bug 29794: (follow-up) Add license
Comment 3 Lucas Gass (lukeg) 2022-01-04 21:29:42 UTC
Created attachment 129014 [details] [review]
Bug 29794: Add missing include in delete_items.pl

This patch adds a missing include so the script is no longer broken.

To test:
1. Choose an item that is checked out and copy its barcode
2. Run:
   $ kshell
  k$ perl misc/cronjobs/delete_items.pl --verbose \
          --where "barcode='39999000010831'"
=> FAIL: It explodes with:
Can't locate object method "find" via package "Koha::Items"...
3. Apply this patch
4. Repeat 2
=> SUCCESS: You get:
Where statement:  where barcode='39999000010831'
Item '549' not deleted: book_on_loan
5. Sign off :-D

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 4 Lucas Gass (lukeg) 2022-01-04 21:29:45 UTC
Created attachment 129015 [details] [review]
Bug 29794: (follow-up) Add license

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 5 Jonathan Druart 2022-01-05 08:58:45 UTC
Does nobody use this script?
Comment 6 Jonathan Druart 2022-01-05 09:01:27 UTC
Created attachment 129017 [details] [review]
Bug 29794: (follow-up) Add license

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Fridolin Somers 2022-01-06 06:06:37 UTC
Bug 23463 replaced DelItemCheck() with Koha::Items->find() and $item->safe_delete
It should have impact the includes
Comment 8 Fridolin Somers 2022-01-10 07:05:17 UTC
Pushed to master for 22.05, thanks to everybody involved ﷐[U+1F984]﷑
Comment 9 Kyle M Hall (khall) 2022-01-14 13:37:11 UTC
Pushed to 21.11.x for 21.11.02
Comment 10 Andrew Fuerste-Henry 2022-01-21 16:38:12 UTC
I can't recreate this issue on 21.05.x. Following the test plan, I get the correct message of "Item '1' not deleted: book_on_loan" without the patch applied.

Not backporting, please request if needed.