Acquisitions orders endpoint RFC

From Koha Wiki
Jump to navigation Jump to search

This RFC should be the basis for writing an endpoint for CRUD operations on order lines following the guidelines. The implementation will be handled in bug 18731

Actions and routes

The following table presents the proposed routes and actions mappings to be implemented.


Description Action
List orders
 GET /acquisitions/orders
Add an order
 POST /acquisitions/orders
Get an order
 GET /acquisitions/orders/{order_id}
Overwrite an order
 PUT /acquisitions/orders/{order_id}
Delete an order
 DELETE /acquisitions/orders/{order_id}
Partially update an order
 PATCH /acquisitions/orders/{order_id}

Documented actions (besides plain CRUD) should also be implemented, using PATCH:

Description Payload
Receive order
{ "" }
Cancel order
{ "status": "cancelled", "cancellation_reason": "reason", "cancellation_date": "the date" }
Cancel receipt

Transfer order
{ "basket_id": "new_basket_id" }

Order object definition

DB schema Proposed API Details
ordernumber order_id Generated on POST
biblionumber biblio_id
entrydate entry_date
quantity quantity
currency currency
listprice list_price
datereceived date_received
invoiceid invoice_id
freight shipping_cost
unitprice unit_price
unitprice_tax_excluded unit_price_tax_excluded
unitprice_tax_included unit_price_tax_included
quantityreceived quantity_received
datecacellationprinted cancellation_date
cancellationreason cancellation_reason
order_internalnote internal_note
order_vendornote vendor_note
purchaseordernumber REMOVED (obsolete)
basketno basket_id Optional (basket will be generated automatically if ommited)
timestamp timestamp
rpp rrp
rrp_tax_excluded rrp_tax_excluded
rrp_tax_included rrp_tax_included
ecost ecost
ecost_tax_excluded ecost_tax_excluded
ecost_tax_included ecost_tax_included
tax_rate_bak REMOVED UNUSED
tax_rate_on_ordering tax_rate_on_ordering
tax_rate_on_receiving tax_rate_on_receiving
tax_value_bak REMOVED UNUSED
tax_value_on_ordering tax_value_on_ordering
tax_value_on_receiving tax_value_on_receiving
discount discount_rate
budget_id budget_id
budgetdate REMOVED UNUSED
sort1 statistics_1
sort2 statistics_2
sort1_authcat statistics_1_authcat
sort2_authcat statistics_2_authcat
uncertainprice uncertain_price Boolean
claims_count claims_count
claimed_date last_claim_date
subscriptionid subscription_id
parent_ordernumber parent_order_id
orderstatus status
line_item_id REMOVED EDIFACT related
suppliers_reference_number REMOVED EDIFACT related
suppliers_reference_qualifier REMOVED EDIFACT related
suppliers_report REMOVED EDIFACT related
vendor_id Optional (used for creating a basket if basket_id is not passed)

Comments

  • List orders: will it be possible to limit to orders from a specific basket or vendor?
  • Cancel order: I think there should be a way to indicate if you want to delete just the order or the record as well? Otherwise we should define the default behaviour and document it.
  • budget_id: I think this should be the fund_id instead to match the GUI. The code is all backwards there because we switched terms after acq was implemented.
  • statistics*_2_authcat stems from funds. There we have used: statistic1_auth_value_category. We should make them match. (plural vs. singular, _1 vs. 1...)

--Kfischer 16:36, 10 April 2018 (EDT)