https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36369

--- Comment #34 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 202877
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202877&action=edit
Bug 36369: (follow-up) Add waiting_list_items.getAll() to the preservation
client

waiting_list_items.get_from_barcode() built its own request URL, doing by
hand what HttpClient->getAll() already does: JSON-encoding the query,
assembling the query string with URLSearchParams and concatenating it to
the endpoint.

This patch adds a waiting_list_items.getAll() method, consistent with the
other resources in this client (trains, processings, train_items), and
expresses get_from_barcode() in terms of it. The barcode lookup now reads
as what it is: a getAll() filtered on me.barcode, limited to one result.

The resulting request is unchanged: same path, same query parameters
(_page, _per_page and q, only emitted in a different order, which is not
significant), same x-koha-embed header and same return value (the first
matching item, or undefined).

Note that getAll() has no caller in tree yet. The waiting list table
fetches its data directly through DataTables rather than the client, and
base-resource.js only calls get() and delete() on the configured API
client. It is added here so the resource exposes the same surface as its
siblings, and so callers have somewhere to go other than crafting URLs.

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
   k$ qa -c 3
=> SUCCESS: QA passes
3. Go to Preservation > Waiting list
4. Make sure the module is configured (Preservation > Settings, a
   'not for loan' value is selected for the waiting list)
5. Add items to the waiting list by scanning/typing barcodes
=> SUCCESS: The items are found and listed with their title and author,
   which come from the embedded biblio
6. Go to a train, add an item to it by barcode
=> SUCCESS: The item is found by barcode and added
7. Enter a barcode that does not exist
=> SUCCESS: Handled as before, no item is added
8. Confirm in the devtools network tab that the request to
   /api/v1/preservation/waiting-list/items still carries the
   x-koha-embed: biblio header
9. Sign off :-D

Assisted-by: Opus 5 (Anthropic)

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to