[Bug 41889] New: Checkouts api call for checked in items can fail if the patron has been deleted
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 Bug ID: 41889 Summary: Checkouts api call for checked in items can fail if the patron has been deleted Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Circulation Assignee: koha-bugs@lists.koha-community.org Reporter: lisette@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle@bywatersolutions.com To recreate: Checkout an item to a patron without anonymization and check it back in. Do a call to your instance (may need to turn on api basic auth and just use your credentials) that includes the date in question, see that you get a result. Delete the patron and send the call again, you'll get the error message at the bottom of the comment. This is a problem with third party report services. {ktdurl}/api/v1/checkouts?q={"checkout_date":{">": "2026-01-24T00:00:00Z","<": "2026-07-31T00:00:00Z"}}&checked_in=true&_per_page=5000&_page=1&_order_by=checkout_date Recreated on main, seeing it back at least to old stable. { "errors": [ { "message": "Expected integer - got null.", "path": "/body/0/patron_id" }, -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 --- Comment #1 from Lisette Scheer <lisette@bywatersolutions.com> --- Now I can't recreate on main, but I'm getting a booking related error instead. This might be fixed and my git worktrees were messed up. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Summary|Checkouts api call for |/checkouts?checked_in=1 |checked in items can fail |errors when patron_id is |if the patron has been |null |deleted | See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=32801 Assignee|koha-bugs@lists.koha-commun |lisette@bywatersolutions.co |ity.org |m -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 --- Comment #2 from Lisette Scheer <lisette@bywatersolutions.com> --- Recreated on main, working on a patch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 cschrode <cschrode@akronlibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |cschrode@akronlibrary.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff --- Comment #3 from Lisette Scheer <lisette@bywatersolutions.com> --- If a patron is deleted and there's a checkout associated with them, an api call to {url}/api/v1/checkouts?checked_in=true will result in an error. This patch updates the api to allow for a null value to be returned for patron_id To test: Before applying the patch: 1. In Administration->System preference enable the RESTBasicAuth system preference. 2. Checkout an item to a patron (I used item barcode: 39999000000252 and patron barcode 23529000121682) 3. Check the item back in 4. In your brower go to {sandbox/ktdurl}/api/v1/checkouts?checked_in=1 5. Observe there is a patron ID in the JSON response 6. Delete the patron 7. Repeat step 4 8. Observe an error because a "null" value was returned 9. Apply patch Sandbox: In sandbox management Actions->Apply patches Once complete Actions->Build CSS and JS Actions->Restart services KTD: ktd --shell git bz apply 41889 yarn build restart_all 10. Repeat step 4 11. Observe the checkout loads, but now has a null patron id. 12. Sign off On KTD can also run the script: qa to run tests. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 --- Comment #4 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 201087 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201087&action=edit Bug 41889: Update API to allow for null patron_id to be returned when listing checkouts If a patron is deleted and there's a checkout associated with them, an api call to {url}/api/v1/checkouts?checked_in=true will result in an error. This patch updates the api to allow for a null value to be returned for patron_id To test: Before applying the patch: 1. In Administration->System preference enable the RESTBasicAuth system preference. 2. Checkout an item to a patron (I used item barcode: 39999000000252 and patron barcode 23529000121682) 3. Check the item back in 4. In your brower go to {sandbox/ktdurl}/api/v1/checkouts?checked_in=1 5. Observe there is a patron ID in the JSON response 6. Delete the patron 7. Repeat step 4 8. Observe an error because a "null" value was returned 9. Apply patch Sandbox: In sandbox management Actions->Apply patches Once complete Actions->Build CSS and JS Actions->Restart services KTD: ktd --shell git bz apply 41889 yarn build restart_all 10. Repeat step 4 11. Observe the checkout loads, but now has a null patron id. 12. Sign off On KTD can also run the script: qa to run tests. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #201087|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 --- Comment #5 from David Nind <david@davidnind.com> --- Created attachment 201115 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201115&action=edit Bug 41889: Update API to allow for null patron_id to be returned when listing checkouts If a patron is deleted and there's a checkout associated with them, an api call to {url}/api/v1/checkouts?checked_in=true will result in an error. This patch updates the api to allow for a null value to be returned for patron_id To test: Before applying the patch: 1. In Administration->System preference enable the RESTBasicAuth system preference. 2. Checkout an item to a patron (I used item barcode: 39999000000252 and patron barcode 23529000121682) 3. Check the item back in 4. In your brower go to {sandbox/ktdurl}/api/v1/checkouts?checked_in=1 5. Observe there is a patron ID in the JSON response 6. Delete the patron 7. Repeat step 4 8. Observe an error because a "null" value was returned 9. Apply patch Sandbox: In sandbox management Actions->Apply patches Once complete Actions->Build CSS and JS Actions->Restart services KTD: ktd --shell git bz apply 41889 yarn build restart_all 10. Repeat step 4 11. Observe the checkout loads, but now has a null patron id. 12. Sign off On KTD can also run the script: qa to run tests. Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com QA Contact|testopia@bugs.koha-communit |tomascohen@gmail.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #201115|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 --- Comment #6 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 201197 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201197&action=edit Bug 41889: Update API to allow for null patron_id to be returned when listing checkouts If a patron is deleted and there's a checkout associated with them, an api call to {url}/api/v1/checkouts?checked_in=true will result in an error. This patch updates the api to allow for a null value to be returned for patron_id To test: Before applying the patch: 1. In Administration->System preference enable the RESTBasicAuth system preference. 2. Checkout an item to a patron (I used item barcode: 39999000000252 and patron barcode 23529000121682) 3. Check the item back in 4. In your brower go to {sandbox/ktdurl}/api/v1/checkouts?checked_in=1 5. Observe there is a patron ID in the JSON response 6. Delete the patron 7. Repeat step 4 8. Observe an error because a "null" value was returned 9. Apply patch Sandbox: In sandbox management Actions->Apply patches Once complete Actions->Build CSS and JS Actions->Restart services KTD: ktd --shell git bz apply 41889 yarn build restart_all 10. Repeat step 4 11. Observe the checkout loads, but now has a null patron id. 12. Sign off On KTD can also run the script: qa to run tests. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |26.11.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 --- Comment #7 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Thanks everyone! Pushed to main for 26.11! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41889 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Pushed to stable Version(s)|26.11.00 |26.11.00,26.05.02 released in| | -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org