Bug 29959

Summary: Populate prices when creating an order with the API
Product: Koha Reporter: Julian Maurice <julian.maurice>
Component: REST APIAssignee: Julian Maurice <julian.maurice>
Status: Patch doesn't apply --- QA Contact: Kyle M Hall <kyle>
Severity: normal    
Priority: P5 - low CC: jonathan.druart, joonas.kylmala, kyle, tomascohen
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 29955    
Bug Blocks: 30875    
Attachments: Bug 29959: Populate prices when creating an order with the API
Bug 29959: Populate prices when creating an order with the API

Description Julian Maurice 2022-01-27 12:57:23 UTC
Price columns (aqorders.*_tax_included, aqorders.*_tax_excluded, aqorders.tax_value_*) are automatically calculated when creating an order with the staff interface. They should also be automatically calculated when the order is created with the API.
Comment 1 Julian Maurice 2022-01-27 12:58:09 UTC
Created attachment 129875 [details] [review]
Bug 29959: Populate prices when creating an order with the API

Price columns (aqorders.*_tax_included, aqorders.*_tax_excluded,
aqorders.tax_value_*) are automatically calculated when creating an
order with the staff interface. They should also be automatically
calculated when the order is created with the API.

Depends on bug 29955

Test plan:
1. Run tests in t/db_dependent/api/v1/acquisitions_orders.t
Comment 2 Joonas Kylmälä 2022-05-28 10:31:03 UTC
This sounds like a bug to me, marking it as such. Please revert if I'm wrong.
Comment 3 David Nind 2022-05-28 14:14:36 UTC
Created attachment 135437 [details] [review]
Bug 29959: Populate prices when creating an order with the API

Price columns (aqorders.*_tax_included, aqorders.*_tax_excluded,
aqorders.tax_value_*) are automatically calculated when creating an
order with the staff interface. They should also be automatically
calculated when the order is created with the API.

Depends on bug 29955

Test plan:
1. Run tests in t/db_dependent/api/v1/acquisitions_orders.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 Jonathan Druart 2022-05-31 08:46:45 UTC
Shouldn't this actually be called from Koha::Acq::Order->store?
Comment 5 Tomás Cohen Arazi 2022-06-01 11:07:55 UTC
(In reply to Jonathan Druart from comment #4)
> Shouldn't this actually be called from Koha::Acq::Order->store?

We should file a follow-up bug for refactoring things (as it would imply changing the CGI controllers as well and in this case we are fixing a bug).
Comment 6 Tomás Cohen Arazi 2022-06-01 11:08:23 UTC
(In reply to Joonas Kylmälä from comment #2)
> This sounds like a bug to me, marking it as such. Please revert if I'm wrong.

+1
Comment 7 Jonathan Druart 2022-06-01 11:12:25 UTC
(In reply to Tomás Cohen Arazi from comment #5)
> (In reply to Jonathan Druart from comment #4)
> > Shouldn't this actually be called from Koha::Acq::Order->store?
> 
> We should file a follow-up bug for refactoring things (as it would imply
> changing the CGI controllers as well and in this case we are fixing a bug).

This comment was actually for bug 29955 (which this bug depends on), and it's doing refactoring already.