When trying to fetch checked_in checkouts for a borrower, if the old_issues doesn't have an itemnumber (for example the item was deleted). It brings a 500 error. This is a message I got while querying this url : /api/v1/checkouts?patron_id=13662&checked_in=1 <pre> {"errors":[{"message":"Expected integer - got null.","path":"\/0\/item_id"},{"message":"Expected integer - got null.","path":"\/1\/item_id"},{"message":"Expected integer - got null.","path":"\/9\/item_id"},{"message":"Expected integer - got null.","path":"\/12\/item_id"},{"message":"Expected integer - got null.","path":"\/13\/item_id"},{"message":"Expected integer - got null.","path":"\/14\/item_id"},{"message":"Expected integer - got null.","path":"\/15\/item_id"}],"status":200} </pre> Querying with itemnumber not null solves the issue : /api/v1/checkouts?patron_id=13662&checked_in=1&q={"item_id":{"-not_like":"null"}}
Created attachment 153044 [details] [review] Bug 32801: Add tests
Created attachment 153045 [details] [review] Bug 32801: Prevent 500 on /checkouts If checked_in flag is passed we return the "old checkouts". But if the item has been deleted we explode with "message":"Expected integer - got null.","path":"\/0\/item_id" The specs should reflect that an item can have been deleted. Test plan: Hit the endpoint and confirm the above. Can be done easily using curl: curl -u koha:koha --request GET 'http://localhost:8081/api/v1/checkouts?patron_id=5&checked_in=1' --header "Content-Type: application/json" | jq
Created attachment 153106 [details] [review] Bug 32801: Add tests Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 153107 [details] [review] Bug 32801: Prevent 500 on /checkouts If checked_in flag is passed we return the "old checkouts". But if the item has been deleted we explode with "message":"Expected integer - got null.","path":"\/0\/item_id" The specs should reflect that an item can have been deleted. Test plan: Hit the endpoint and confirm the above. Can be done easily using curl: curl -u koha:koha --request GET 'http://localhost:8081/api/v1/checkouts?patron_id=5&checked_in=1' --header "Content-Type: application/json" | jq Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 153340 [details] [review] Bug 32801: Prevent 500 on /checkouts If checked_in flag is passed we return the "old checkouts". But if the item has been deleted we explode with "message":"Expected integer - got null.","path":"\/0\/item_id" The specs should reflect that an item can have been deleted. Test plan: Hit the endpoint and confirm the above. Can be done easily using curl: curl -u koha:koha --request GET 'http://localhost:8081/api/v1/checkouts?patron_id=5&checked_in=1' --header "Content-Type: application/json" | jq Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed to master for 23.11. Nice work everyone, thanks!
Thanks for all the hard work! Pushed to 23.05.x for the next release
Nice work everyone! Pushed to oldstable for 22.11.x