Bug 36637

Summary: listOrders for a given biblio_id will return all orders like %biblio_id%
Product: Koha Reporter: Jan Kissig <bibliothek>
Component: REST APIAssignee: Bugs List <koha-bugs>
Status: CLOSED INVALID QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: bibliothek, tomascohen
Version: 23.11   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Jan Kissig 2024-04-18 08:44:14 UTC
When using the API to retrieve orders for a given param biblio_id, it returns orders where the biblio_id is part of the orders biblio_id. 
F.e. if the given param is 26, the API will return orders where biblio_id is 262

Maybe this behaviour is intended in order to act as a search filter but i would expect the API, when used with biblio_id, only to return orders where the biblio_id is exactly like the one in the query.


To Test:
1) go to http://localhost:8081/cgi-bin/koha/acqui/basket.pl?basketno=1 
2) add an order via +Add to basket  
3) use an existing record f.e. 9780596004927
4) click addOrder and enter necessary fields, then add item and choose fund to save the order
5) check the biblionumber of the ordered item f.e. 262
6) use the api to fetch orders
curl -u koha:koha  "http://localhost:8081/api/v1/acquisitions/orders?biblio_id=2"
7) check the biblio_id of the given response
Comment 1 Jan Kissig 2024-05-03 11:51:40 UTC
I should have studied the API a bit more: there is a _match param which can be used with the value exact to retrieve only exact matching results.

http://localhost:8080/api/v1/.html#ref-parameters-parameters_match 

So I should extend my query with to this:
http://localhost:8081/api/v1/acquisitions/orders?biblio_id=2&_match=exact