Bug 18731 - Add routes for acquisition orders
Summary: Add routes for acquisition orders
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Martin Renvoize (ashimema)
URL: https://wiki.koha-community.org/wiki/...
Keywords:
Depends on: 18137 19196 19209 19234 19369 19370 19410 24302 24321
Blocks: 20212 24457 24459 24462 24611 25513 28248
  Show dependency treegraph
 
Reported: 2017-06-05 16:46 UTC by Kyle M Hall (khall)
Modified: 2021-04-28 14:31 UTC (History)
11 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This development adds API routes to perform CRUD operation on acquisition order lines.
Version(s) released in:
20.05.00
Circulation function:


Attachments
Bug 18731: WIP /acquisitions/orders endpoint (5.25 KB, patch)
2017-11-16 18:52 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: OpenAPI definitions (18.95 KB, patch)
2017-11-16 18:52 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: /acquisitions/orders endpoint (5.91 KB, patch)
2017-11-23 14:18 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: OpenAPI definitions (19.68 KB, patch)
2017-11-23 14:18 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: OpenAPI definitions (18.75 KB, patch)
2017-12-05 18:38 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: /acquisitions/orders endpoint (11.05 KB, patch)
2018-04-10 16:18 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: OpenAPI definitions (17.81 KB, patch)
2018-04-10 16:18 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: /acquisitions/orders endpoint (11.05 KB, patch)
2018-09-05 11:53 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: OpenAPI definitions (17.88 KB, patch)
2018-09-05 11:53 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: /acquisitions/orders endpoint (10.88 KB, patch)
2019-01-17 09:18 UTC, Matthias Meusburger
Details | Diff | Splinter Review
Bug 18731: OpenAPI definitions (17.93 KB, patch)
2019-01-17 09:18 UTC, Matthias Meusburger
Details | Diff | Splinter Review
Bug 18731: Unit tests (11.94 KB, patch)
2019-11-05 14:43 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: OpenAPI definitions (18.32 KB, patch)
2019-11-05 14:43 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: /acquisitions/orders endpoint (15.29 KB, patch)
2019-11-05 14:43 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: Make authenticate_api_request stash the embed structure (2.72 KB, patch)
2020-01-06 17:10 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: Unit tests (11.91 KB, patch)
2020-01-06 17:10 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: OpenAPI definitions (30.18 KB, patch)
2020-01-06 17:10 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: /acquisitions/orders endpoint (9.78 KB, patch)
2020-01-06 17:10 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: Add API mappings to K::A::{Basket,Invoice} (4.08 KB, patch)
2020-01-06 17:11 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: Use the stashed koha.embed in objects.search (3.50 KB, patch)
2020-01-06 17:11 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: /acquisitions/orders endpoint (9.83 KB, patch)
2020-01-07 17:50 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: Add API mappings to K::A::{Basket,Invoice} (4.08 KB, patch)
2020-01-07 17:50 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: Use the stashed koha.embed in objects.search (3.50 KB, patch)
2020-01-07 17:51 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: OpenAPI definitions (30.19 KB, patch)
2020-01-07 18:27 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 18731: Make authenticate_api_request stash the embed structure (2.79 KB, patch)
2020-01-07 20:29 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 18731: Unit tests (11.98 KB, patch)
2020-01-07 20:30 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 18731: /acquisitions/orders endpoint (9.90 KB, patch)
2020-01-07 20:30 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 18731: Add API mappings to K::A::{Basket,Invoice} (4.15 KB, patch)
2020-01-07 20:30 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 18731: Use the stashed koha.embed in objects.search (3.57 KB, patch)
2020-01-07 20:30 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 18731: OpenAPI definitions (30.26 KB, patch)
2020-01-07 20:30 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 18731: Make authenticate_api_request stash the embed structure (2.83 KB, patch)
2020-01-09 16:27 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 18731: Unit tests (12.03 KB, patch)
2020-01-09 16:27 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 18731: /acquisitions/orders endpoint (9.95 KB, patch)
2020-01-09 16:27 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 18731: Add API mappings to K::A::{Basket,Invoice} (4.20 KB, patch)
2020-01-09 16:27 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 18731: Use the stashed koha.embed in objects.search (3.62 KB, patch)
2020-01-09 16:27 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 18731: OpenAPI definitions (30.31 KB, patch)
2020-01-09 16:27 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 18731: (QA follow-up) Spelling and POD corrections (1.21 KB, patch)
2020-01-09 16:27 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 18731: Overload K::A::Fund->to_api to avoid conflict (3.23 KB, patch)
2020-01-13 18:46 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall (khall) 2017-06-05 16:46:48 UTC
Some libraries may have hundreds of open orders for a vendor, depending on acqisitions workflow. At that number of open orders, the tables on parcel.pl take 10 to 20 seconds to load.

To speed up the loading of this page and the data, we should convert the order tables from pre-loading all order data to ajax tables that load order data on an as needed basis. That way we are only pulling the data for the orders that are currently visible.
Comment 1 Katrin Fischer 2017-08-15 21:04:11 UTC
Was a bit confused by the bug title - hope I made it a bit more clear.
Comment 2 Tomás Cohen Arazi (tcohen) 2017-11-16 18:52:52 UTC
Created attachment 69184 [details] [review]
Bug 18731: WIP /acquisitions/orders endpoint

This patches implement the /acquisitions/orders endpoint.
It uses the new pagination and query parsing plugins.

Sponsored-by: Camden County
Comment 3 Tomás Cohen Arazi (tcohen) 2017-11-16 18:52:56 UTC
Created attachment 69185 [details] [review]
Bug 18731: OpenAPI definitions

This patch introduces the OpenAPI definitions required for the orders
endpoint. It adds query parameters definitions for the reserved params:

- _match
- _order_by
- _page
- _per_page
Comment 4 Tomás Cohen Arazi (tcohen) 2017-11-23 14:18:35 UTC
Created attachment 69309 [details] [review]
Bug 18731: /acquisitions/orders endpoint

This patches implement the /acquisitions/orders endpoint.
It uses the new pagination, query parsing and object searching plugins.

Sponsored-by: Camden County
Comment 5 Tomás Cohen Arazi (tcohen) 2017-11-23 14:18:42 UTC
Created attachment 69310 [details] [review]
Bug 18731: OpenAPI definitions

This patch introduces the OpenAPI definitions required for the orders
endpoint. It adds query parameters definitions for the reserved params:

- _match
- _order_by
- _page
- _per_page
Comment 6 Tomás Cohen Arazi (tcohen) 2017-12-05 18:38:30 UTC
Created attachment 69544 [details] [review]
Bug 18731: OpenAPI definitions

This patch introduces the OpenAPI definitions required for the orders
endpoint.
Comment 7 Tomás Cohen Arazi (tcohen) 2018-02-27 13:20:33 UTC
I'm writting a new RFC spec to be voted on a proper dev meeting. I will re-do this work based on that vote.
Comment 8 Tomás Cohen Arazi (tcohen) 2018-04-10 16:18:45 UTC
Created attachment 73959 [details] [review]
Bug 18731: /acquisitions/orders endpoint

This patches implement the /acquisitions/orders endpoint.
It uses the new pagination, query parsing and object searching plugins.

The attribute names are consistent with the voted RFC

Sponsored-by: Camden County
Comment 9 Tomás Cohen Arazi (tcohen) 2018-04-10 16:18:49 UTC
Created attachment 73960 [details] [review]
Bug 18731: OpenAPI definitions

This patch introduces the OpenAPI definitions required for the orders
endpoint. It adds query parameters definitions for the reserved params:

- _match
- _order_by
- _page
- _per_page
Comment 10 Tomás Cohen Arazi (tcohen) 2018-09-05 11:53:20 UTC
Created attachment 78435 [details] [review]
Bug 18731: /acquisitions/orders endpoint

This patches implement the /acquisitions/orders endpoint.
It uses the new pagination, query parsing and object searching plugins.

The attribute names are consistent with the voted RFC

Sponsored-by: Camden County
Comment 11 Tomás Cohen Arazi (tcohen) 2018-09-05 11:53:35 UTC
Created attachment 78436 [details] [review]
Bug 18731: OpenAPI definitions

This patch introduces the OpenAPI definitions required for the orders
endpoint. It adds query parameters definitions for the reserved params:

- _match
- _order_by
- _page
- _per_page
Comment 12 Matthias Meusburger 2019-01-17 09:18:32 UTC
Created attachment 84133 [details] [review]
Bug 18731: /acquisitions/orders endpoint

This patches implement the /acquisitions/orders endpoint.
It uses the new pagination, query parsing and object searching plugins.

The attribute names are consistent with the voted RFC

Sponsored-by: Camden County
Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>
Comment 13 Matthias Meusburger 2019-01-17 09:18:40 UTC
Created attachment 84134 [details] [review]
Bug 18731: OpenAPI definitions

This patch introduces the OpenAPI definitions required for the orders
endpoint. It adds query parameters definitions for the reserved params:

- _match
- _order_by
- _page
- _per_page

Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>
Comment 14 Matthias Meusburger 2019-01-17 09:19:33 UTC
As far as I'm concerned, it works as expected.
Comment 15 Josef Moravec 2019-02-21 14:53:08 UTC
started testing:
1) we should generalize API controller to not repeat almost same code againg, this is nice prototype, but out of the scope of this report

2)  basket_id description: "Basket this order is linked to. If ommited, a new basket is automatically created"

It is not true, basket is not created

3) Tests are missing

4) Where mandatory parameter in body is missing on creation of object, api reports 500 "Something went wrong, check the logs". But the api client has no chance to know what is wrong here. This is probably true on more places in api, but i not tested it all now.

anyway good start, thanks Tomas for working on that!
Comment 16 Josef Moravec 2019-02-21 14:55:04 UTC
And last thing for now, qa tools are complaining:

 FAIL	Koha/REST/V1/Acquisitions/Orders.pm
   FAIL	  pod
		=head3 without preceding higher level
		
		 in file Koha/REST/V1/Acquisitions/Orders.pm
		=head2 without preceding higher level
		 
		*** WARNING: 
   FAIL	  pod coverage
		POD is missing for add
		POD is missing for delete
		POD is missing for get
		POD is missing for list
		POD is missing for update
Comment 17 Tomás Cohen Arazi (tcohen) 2019-11-05 14:43:48 UTC
Created attachment 95054 [details] [review]
Bug 18731: Unit tests

This patch implements unit tests for the orders endpoint.

Sponsored-by: Camden County
Comment 18 Tomás Cohen Arazi (tcohen) 2019-11-05 14:43:53 UTC
Created attachment 95055 [details] [review]
Bug 18731: OpenAPI definitions

This patch introduces the OpenAPI definitions required for the orders
endpoint. It matches the voted RFC.

Sponsored-by: Camden County

Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>
Comment 19 Tomás Cohen Arazi (tcohen) 2019-11-05 14:43:57 UTC
Created attachment 95056 [details] [review]
Bug 18731: /acquisitions/orders endpoint

This patches implement the /acquisitions/orders endpoint.

The attribute names are consistent with the voted RFC

To test:
1. Apply this patchset
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/acquisitions_orders.t
=> SUCCESS: Tests pass!
3. Test the API with your favourite tool (Postman?)
=> SUCCESS: It works as expected!
4 Sign off :-D

Sponsored-by: Camden County

Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>
Comment 20 Tomás Cohen Arazi (tcohen) 2020-01-06 17:10:47 UTC
Created attachment 96853 [details] [review]
Bug 18731: Make authenticate_api_request stash the embed structure
Comment 21 Tomás Cohen Arazi (tcohen) 2020-01-06 17:10:51 UTC
Created attachment 96854 [details] [review]
Bug 18731: Unit tests

This patch implements unit tests for the orders endpoint.

Sponsored-by: Camden County
Comment 22 Tomás Cohen Arazi (tcohen) 2020-01-06 17:10:55 UTC
Created attachment 96855 [details] [review]
Bug 18731: OpenAPI definitions

This patch introduces the OpenAPI definitions required for the orders
endpoint. It matches the voted RFC.

Sponsored-by: Camden County

Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>
Comment 23 Tomás Cohen Arazi (tcohen) 2020-01-06 17:10:59 UTC
Created attachment 96856 [details] [review]
Bug 18731: /acquisitions/orders endpoint

This patches implement the /acquisitions/orders endpoint.

The attribute names are consistent with the voted RFC

To test:
1. Apply this patchset
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/acquisitions_orders.t
=> SUCCESS: Tests pass!
3. Test the API with your favourite tool (Postman?)
=> SUCCESS: It works as expected!
4 Sign off :-D

Sponsored-by: Camden County

Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>
Comment 24 Tomás Cohen Arazi (tcohen) 2020-01-06 17:11:03 UTC
Created attachment 96857 [details] [review]
Bug 18731: Add API mappings to K::A::{Basket,Invoice}

This patch adds to_api_mapping definitions to the following classes:

- Koha::Acquisition::Basket
- Koha::Acquisition::Invoice

They are implemented following the proposed RFCs:
https://wiki.koha-community.org/wiki/Acquisitions_baskets_endpoint_RFC
https://wiki.koha-community.org/wiki/Acquisitions_invoices_endpoint_RFC
Comment 25 Tomás Cohen Arazi (tcohen) 2020-01-06 17:11:08 UTC
Created attachment 96858 [details] [review]
Bug 18731: Use the stashed koha.embed in objects.search

This patch makes the objects.search helper use the koha.embed structure
that is embedded in the authenticate_api_request step.

This way, any controller using it will benefit from automatic embed
handling.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t
=> SUCCESS: Tests pass!
3. Sign off :-D
Comment 26 Tomás Cohen Arazi (tcohen) 2020-01-06 17:18:02 UTC
I've set this back to NSO as I introduced some important changes.
Comment 27 Tomás Cohen Arazi (tcohen) 2020-01-07 17:50:54 UTC
Created attachment 96916 [details] [review]
Bug 18731: /acquisitions/orders endpoint

This patches implement the /acquisitions/orders endpoint.

The attribute names are consistent with the voted RFC

To test:
1. Apply this patchset
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/acquisitions_orders.t
=> SUCCESS: Tests pass!
3. Test the API with your favourite tool (Postman?)
=> SUCCESS: It works as expected!
4 Sign off :-D

Sponsored-by: Camden County

Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>
Comment 28 Tomás Cohen Arazi (tcohen) 2020-01-07 17:50:58 UTC
Created attachment 96917 [details] [review]
Bug 18731: Add API mappings to K::A::{Basket,Invoice}

This patch adds to_api_mapping definitions to the following classes:

- Koha::Acquisition::Basket
- Koha::Acquisition::Invoice

They are implemented following the proposed RFCs:
https://wiki.koha-community.org/wiki/Acquisitions_baskets_endpoint_RFC
https://wiki.koha-community.org/wiki/Acquisitions_invoices_endpoint_RFC
Comment 29 Tomás Cohen Arazi (tcohen) 2020-01-07 17:51:02 UTC
Created attachment 96918 [details] [review]
Bug 18731: Use the stashed koha.embed in objects.search

This patch makes the objects.search helper use the koha.embed structure
that is embedded in the authenticate_api_request step.

This way, any controller using it will benefit from automatic embed
handling.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t
=> SUCCESS: Tests pass!
3. Sign off :-D
Comment 30 Tomás Cohen Arazi (tcohen) 2020-01-07 18:27:37 UTC
Created attachment 96938 [details] [review]
Bug 18731: OpenAPI definitions

This patch introduces the OpenAPI definitions required for the orders
endpoint. It matches the voted RFC.

Sponsored-by: Camden County

Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>
Comment 31 Kyle M Hall (khall) 2020-01-07 20:29:03 UTC
Created attachment 96961 [details] [review]
Bug 18731: Make authenticate_api_request stash the embed structure

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 32 Kyle M Hall (khall) 2020-01-07 20:30:09 UTC
Created attachment 96962 [details] [review]
Bug 18731: Unit tests

This patch implements unit tests for the orders endpoint.

Sponsored-by: Camden County

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 33 Kyle M Hall (khall) 2020-01-07 20:30:12 UTC
Created attachment 96963 [details] [review]
Bug 18731: /acquisitions/orders endpoint

This patches implement the /acquisitions/orders endpoint.

The attribute names are consistent with the voted RFC

To test:
1. Apply this patchset
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/acquisitions_orders.t
=> SUCCESS: Tests pass!
3. Test the API with your favourite tool (Postman?)
=> SUCCESS: It works as expected!
4 Sign off :-D

Sponsored-by: Camden County

Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 34 Kyle M Hall (khall) 2020-01-07 20:30:16 UTC
Created attachment 96964 [details] [review]
Bug 18731: Add API mappings to K::A::{Basket,Invoice}

This patch adds to_api_mapping definitions to the following classes:

- Koha::Acquisition::Basket
- Koha::Acquisition::Invoice

They are implemented following the proposed RFCs:
https://wiki.koha-community.org/wiki/Acquisitions_baskets_endpoint_RFC
https://wiki.koha-community.org/wiki/Acquisitions_invoices_endpoint_RFC

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 35 Kyle M Hall (khall) 2020-01-07 20:30:19 UTC
Created attachment 96965 [details] [review]
Bug 18731: Use the stashed koha.embed in objects.search

This patch makes the objects.search helper use the koha.embed structure
that is embedded in the authenticate_api_request step.

This way, any controller using it will benefit from automatic embed
handling.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 36 Kyle M Hall (khall) 2020-01-07 20:30:23 UTC
Created attachment 96966 [details] [review]
Bug 18731: OpenAPI definitions

This patch introduces the OpenAPI definitions required for the orders
endpoint. It matches the voted RFC.

Sponsored-by: Camden County

Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 37 Martin Renvoize (ashimema) 2020-01-09 16:15:02 UTC
This is an impressive culmination of work.

There's little chance of introducing regressions here and in my testing everything appears to work as expected.

Passing QA and Pushing.. lets see if anything drops out of it when we start to use the endpoints in earnest :)

Well done everyone!
Comment 38 Martin Renvoize (ashimema) 2020-01-09 16:27:32 UTC
Created attachment 97107 [details] [review]
Bug 18731: Make authenticate_api_request stash the embed structure

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 39 Martin Renvoize (ashimema) 2020-01-09 16:27:35 UTC
Created attachment 97108 [details] [review]
Bug 18731: Unit tests

This patch implements unit tests for the orders endpoint.

Sponsored-by: Camden County
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 40 Martin Renvoize (ashimema) 2020-01-09 16:27:39 UTC
Created attachment 97109 [details] [review]
Bug 18731: /acquisitions/orders endpoint

This patches implement the /acquisitions/orders endpoint.

The attribute names are consistent with the voted RFC

To test:
1. Apply this patchset
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/acquisitions_orders.t
=> SUCCESS: Tests pass!
3. Test the API with your favourite tool (Postman?)
=> SUCCESS: It works as expected!
4 Sign off :-D

Sponsored-by: Camden County
Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 41 Martin Renvoize (ashimema) 2020-01-09 16:27:43 UTC
Created attachment 97110 [details] [review]
Bug 18731: Add API mappings to K::A::{Basket,Invoice}

This patch adds to_api_mapping definitions to the following classes:

- Koha::Acquisition::Basket
- Koha::Acquisition::Invoice

They are implemented following the proposed RFCs:
https://wiki.koha-community.org/wiki/Acquisitions_baskets_endpoint_RFC
https://wiki.koha-community.org/wiki/Acquisitions_invoices_endpoint_RFC

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 42 Martin Renvoize (ashimema) 2020-01-09 16:27:47 UTC
Created attachment 97111 [details] [review]
Bug 18731: Use the stashed koha.embed in objects.search

This patch makes the objects.search helper use the koha.embed structure
that is embedded in the authenticate_api_request step.

This way, any controller using it will benefit from automatic embed
handling.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 43 Martin Renvoize (ashimema) 2020-01-09 16:27:50 UTC
Created attachment 97112 [details] [review]
Bug 18731: OpenAPI definitions

This patch introduces the OpenAPI definitions required for the orders
endpoint. It matches the voted RFC.

Sponsored-by: Camden County
Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 44 Martin Renvoize (ashimema) 2020-01-09 16:27:54 UTC
Created attachment 97113 [details] [review]
Bug 18731: (QA follow-up) Spelling and POD corrections

Just a coulpe of very minor tweaks to keep the QA scripts happy

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 45 Martin Renvoize (ashimema) 2020-01-09 16:28:59 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 46 Chris Slone 2020-01-09 16:30:07 UTC
This is really great to see! Is it able to be backported to 19.05?
Comment 47 Jonathan Druart 2020-01-13 16:11:25 UTC
The new test is failing (randomly?)

t/db_dependent/Koha/REST/Plugin/Objects.t .. 1/3
    #   Failed test 'exact match for JSON Pointer "/0"'
    #   at t/db_dependent/Koha/REST/Plugin/Objects.t line 174.
    #     Structures begin differing at:
    #          $got->{fund}{budget_id} = '534289848'
    #     $expected->{fund}{budget_id} = Does not exist

Koha_Master_D9_My8 run 76

It's not related to My8, I recreate locally with MariaDB latest.
Comment 48 Tomás Cohen Arazi (tcohen) 2020-01-13 18:20:42 UTC
(In reply to Jonathan Druart from comment #47)
> The new test is failing (randomly?)
> 
> t/db_dependent/Koha/REST/Plugin/Objects.t .. 1/3
>     #   Failed test 'exact match for JSON Pointer "/0"'
>     #   at t/db_dependent/Koha/REST/Plugin/Objects.t line 174.
>     #     Structures begin differing at:
>     #          $got->{fund}{budget_id} = '534289848'
>     #     $expected->{fund}{budget_id} = Does not exist
> 
> Koha_Master_D9_My8 run 76
> 
> It's not related to My8, I recreate locally with MariaDB latest.

I really like it when tests serve the purpose :-D
Comment 49 Tomás Cohen Arazi (tcohen) 2020-01-13 18:46:45 UTC
Created attachment 97331 [details] [review]
Bug 18731: Overload K::A::Fund->to_api to avoid conflict

This patch overloads the to_api methods on the Fund class, so
conflicting (on mapping) attribute names are not a problem.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Acquisition/Fund.t \
           t/db_dependent/Koha/REST/Plugin/Objects.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 50 Martin Renvoize (ashimema) 2020-01-14 09:24:58 UTC
Followup pushed, thanks Tomas
Comment 51 Joy Nelson 2020-02-06 22:57:42 UTC
Enhancement not backported to 19.11.x