Orders
class Orders extends DolibarrApi (View source)
API class for orders
Properties
| protected DoliDB | $db | from DolibarrApi | |
| Restler | $r | from DolibarrApi | |
| static string[] | $FIELDS | ||
| Commande | $commande |
Methods
Constructor
Check and convert a string depending on its type/name.
Filter properties that will be returned on object
Clean sensible object datas
Check access by user to a given resource
Return if a $sqlfilters parameter is valid Function no more used. Kept for backward compatibility with old APIs of modules
Function to forge a SQL criteria from a Generic filter string.
Get properties of an order object by id
Get properties of an order object by ref
Get properties of an order object by ref_ext
List orders
Create a sale order
Get lines of an order
Get properties of a line of an order object by id
Add a line to given order
Update a line to given order
Delete a line of a given order
Get contacts of a given order
Add a contact type of given order
Unlink a contact type of given order
Update order general fields (won't touch lines of order)
Delete order
Validate an order
Tag the order as validated (opened)
Classify the order as invoiced. Could be also called setbilled
Close an order (Classify it as "Delivered")
Set an order to draft
Create an order using an existing proposal.
Get the shipments of an order
Create the shipment of an order
Details
__construct()
Constructor
protected string|array<string, mixed>
_checkValForAPI(string $field, string|string[] $value, object $object)
Check and convert a string depending on its type/name.
protected object
_filterObjectProperties(object $object, string $properties)
Filter properties that will be returned on object
protected object
_cleanObjectDatas(object $object)
Clean sensible object datas
static protected bool
_checkAccessToResource(string $resource, int $resource_id = 0, string $dbtablename = '', string $feature2 = '', string $dbt_keyfield = 'fk_soc', string $dbt_select = 'rowid')
Check access by user to a given resource
protected bool|string
_checkFilters(string $sqlfilters, string $error = '')
Return if a $sqlfilters parameter is valid Function no more used. Kept for backward compatibility with old APIs of modules
static protected string
_forge_criteria_callback(string[] $matches)
Function to forge a SQL criteria from a Generic filter string.
Function no more used. Kept for backward compatibility with old APIs of modules
array|mixed
get(int $id, int $contact_list = -1)
Get properties of an order object by id
Return an array with order information
array|mixed
getByRef(string $ref, int $contact_list = -1)
Get properties of an order object by ref
Return an array with order information
array|mixed
getByRefExt(string $ref_ext, int $contact_list = -1)
Get properties of an order object by ref_ext
Return an array with order information
array
index(string $sortfield = "t.rowid", string $sortorder = 'ASC', int $limit = 100, int $page = 0, string $thirdparty_ids = '', string $sqlfilters = '', string $sqlfilterlines = '', string $properties = '', bool $pagination_data = false, int $loadlinkedobjects = 0)
List orders
Get a list of orders
int
post(array $request_data = null)
Create a sale order
Example: { "socid": 2, "date": 1595196000, "type": 0, "lines": [{ "fk_product": 2, "qty": 1 }] }
array
getLines(int $id)
Get lines of an order
object
getLine(int $id, int $lineid, string $properties = '')
Get properties of a line of an order object by id
int
postLine(int $id, array $request_data = null)
Add a line to given order
object|false
putLine(int $id, int $lineid, array $request_data = null)
Update a line to given order
object
deleteLine(int $id, int $lineid)
Delete a line of a given order
array<int, mixed>
getContacts(int $id, string $type = '')
Get contacts of a given order
Return an array with contact information
array
postContact(int $id, int $contactid, string $type, string $source = "external", int $notrigger = 0)
Add a contact type of given order
array
deleteContact(int $id, int $contactid, string $type)
Unlink a contact type of given order
object
put(int $id, array $request_data = null)
Update order general fields (won't touch lines of order)
array
delete(int $id)
Delete order
object
validate(int $id, int $idwarehouse = 0, int $notrigger = 0)
Validate an order
If you get a bad value for param notrigger check, provide this in body { "idwarehouse": 0, "notrigger": 0 }
int
reopen(int $id)
Tag the order as validated (opened)
Function used when order is reopend after being closed.
object
setinvoiced(int $id)
Classify the order as invoiced. Could be also called setbilled
object
close(int $id, int $notrigger = 0)
Close an order (Classify it as "Delivered")
object
settodraft(int $id, int $idwarehouse = -1)
Set an order to draft
object
createOrderFromProposal(int $proposalid)
Create an order using an existing proposal.
array
getOrderShipments(int $id)
Get the shipments of an order
int
createOrderShipment(int $id, int $warehouse_id)
Create the shipment of an order