Bug 36637 - listOrders for a given biblio_id will return all orders like %biblio_id%
Summary: listOrders for a given biblio_id will return all orders like %biblio_id%
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: 23.11
Hardware: All All
: P5 - low minor
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-18 08:44 UTC by Jan Kissig
Modified: 2024-12-23 08:07 UTC (History)
2 users (show)

See Also:
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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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