dolibarr 21.0.0-beta
|
Public Member Functions | |
__construct () | |
Constructor. | |
get ($id, $contact_list=1) | |
Get properties of an order object by id. | |
getByRef ($ref, $contact_list=1) | |
Get properties of an order object by ref. | |
getByRefExt ($ref_ext, $contact_list=1) | |
Get properties of an order object by ref_ext. | |
index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $thirdparty_ids='', $sqlfilters='', $sqlfilterlines='', $properties='', $pagination_data=false) | |
List orders. | |
post ($request_data=null) | |
Create a sale order. | |
getLines ($id) | |
Get lines of an order. | |
postLine ($id, $request_data=null) | |
Add a line to given order. | |
putLine ($id, $lineid, $request_data=null) | |
Update a line to given order. | |
deleteLine ($id, $lineid) | |
Delete a line of a given order. | |
getContacts ($id, $type='') | |
Get contacts of given order. | |
postContact ($id, $contactid, $type) | |
Add a contact type of given order. | |
deleteContact ($id, $contactid, $type) | |
Unlink a contact type of given order. | |
put ($id, $request_data=null) | |
Update order general fields (won't touch lines of order) | |
delete ($id) | |
Delete order. | |
validate ($id, $idwarehouse=0, $notrigger=0) | |
Validate an order. | |
reopen ($id) | |
Tag the order as validated (opened) | |
setinvoiced ($id) | |
Classify the order as invoiced. | |
close ($id, $notrigger=0) | |
Close an order (Classify it as "Delivered") | |
settodraft ($id, $idwarehouse=-1) | |
Set an order to draft. | |
createOrderFromProposal ($proposalid) | |
Create an order using an existing proposal. | |
getOrderShipments ($id) | |
Get the shipments of an order. | |
createOrderShipment ($id, $warehouse_id) | |
Create the shipment of an order. | |
Public Member Functions inherited from DolibarrApi | |
__construct ($db, $cachedir='', $refreshCache=false) | |
Constructor. | |
Protected Member Functions | |
_cleanObjectDatas ($object) | |
Clean sensible object datas. | |
Protected Member Functions inherited from DolibarrApi | |
_checkValForAPI ($field, $value, $object) | |
Check and convert a string depending on its type/name. | |
_filterObjectProperties ($object, $properties) | |
Filter properties that will be returned on object. | |
_checkFilters ($sqlfilters, &$error='') | |
Return if a $sqlfilters parameter is valid Function no more used. | |
Private Member Functions | |
_fetch ($id, $ref='', $ref_ext='', $contact_list=1) | |
Get properties of an order object. | |
_validate ($data) | |
Validate fields before create or update object. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from DolibarrApi | |
static | _checkAccessToResource ($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') |
Check access by user to a given resource. | |
static | _forge_criteria_callback ($matches) |
Function to forge a SQL criteria from a Generic filter string. | |
Definition at line 30 of file api_orders.class.php.
|
protected |
Clean sensible object datas.
Object | $object | Object to clean |
Reimplemented from DolibarrApi.
Definition at line 1114 of file api_orders.class.php.
References $object.
Referenced by _fetch(), close(), createOrderFromProposal(), getContacts(), getLines(), getOrderShipments(), index(), putLine(), setinvoiced(), settodraft(), and validate().
|
private |
Get properties of an order object.
Return an array with order information
int | $id | ID of order |
string | $ref | Ref of object |
string | $ref_ext | External reference of object |
int | $contact_list | 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id |
RestException |
Definition at line 120 of file api_orders.class.php.
References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().
Referenced by get(), getByRef(), and getByRefExt().
|
private |
Validate fields before create or update object.
array | $data | Array with data to verify |
RestException |
Definition at line 1136 of file api_orders.class.php.
Referenced by post().
Orders::close | ( | $id, | |
$notrigger = 0 ) |
Close an order (Classify it as "Delivered")
int | $id | Order ID |
int | $notrigger | Disabled triggers |
@url POST {id}/close
Definition at line 884 of file api_orders.class.php.
References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().
Orders::createOrderFromProposal | ( | $proposalid | ) |
Create an order using an existing proposal.
int | $proposalid | Id of the proposal |
@url POST /createfromproposal/{proposalid}
RestException | 400 |
RestException | 401 |
RestException | 404 |
RestException | 405 |
Definition at line 979 of file api_orders.class.php.
References _cleanObjectDatas().
Orders::createOrderShipment | ( | $id, | |
$warehouse_id ) |
Create the shipment of an order.
int | $id | Id of the order |
int | $warehouse_id | Id of a warehouse |
@url POST {id}/shipment/{warehouse_id}
RestException | 401 |
RestException | 404 |
RestException | 500 System error |
Definition at line 1077 of file api_orders.class.php.
References $id.
Orders::delete | ( | $id | ) |
Delete order.
int | $id | Order ID |
Definition at line 708 of file api_orders.class.php.
References $id, and DolibarrApi\_checkAccessToResource().
Orders::deleteContact | ( | $id, | |
$contactid, | |||
$type ) |
Unlink a contact type of given order.
int | $id | Id of order to update |
int | $contactid | Id of contact |
string | $type | Type of the contact (BILLING, SHIPPING, CUSTOMER). |
@url DELETE {id}/contact/{contactid}/{type}
RestException | 401 |
RestException | 404 |
RestException | 500 System error |
Definition at line 613 of file api_orders.class.php.
References $id, and DolibarrApi\_checkAccessToResource().
Orders::deleteLine | ( | $id, | |
$lineid ) |
Delete a line of a given order.
int | $id | Id of order to update |
int | $lineid | Id of line to delete |
@url DELETE {id}/lines/{lineid}
RestException | 401 |
RestException | 404 |
Definition at line 496 of file api_orders.class.php.
References $id, and DolibarrApi\_checkAccessToResource().
Orders::get | ( | $id, | |
$contact_list = 1 ) |
Get properties of an order object by id.
Return an array with order information
int | $id | ID of order |
int | $contact_list | 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id |
RestException |
Definition at line 66 of file api_orders.class.php.
Orders::getByRef | ( | $ref, | |
$contact_list = 1 ) |
Get properties of an order object by ref.
Return an array with order information
string | $ref | Ref of object |
int | $contact_list | 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id |
@url GET ref/{ref}
RestException |
Definition at line 84 of file api_orders.class.php.
References _fetch().
Orders::getByRefExt | ( | $ref_ext, | |
$contact_list = 1 ) |
Get properties of an order object by ref_ext.
Return an array with order information
string | $ref_ext | External reference of object |
int | $contact_list | 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id |
@url GET ref_ext/{ref_ext}
RestException |
Definition at line 102 of file api_orders.class.php.
References _fetch().
Orders::getContacts | ( | $id, | |
$type = '' ) |
Get contacts of given order.
Return an array with contact information
int | $id | ID of order |
string | $type | Type of the contact (BILLING, SHIPPING, CUSTOMER) |
@url GET {id}/contacts
RestException |
Definition at line 532 of file api_orders.class.php.
References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().
Orders::getLines | ( | $id | ) |
Get lines of an order.
int | $id | Id of order |
@url GET {id}/lines
Definition at line 329 of file api_orders.class.php.
References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().
Orders::getOrderShipments | ( | $id | ) |
Get the shipments of an order.
int | $id | Id of the order |
@url GET {id}/shipment
RestException | 401 |
RestException | 404 |
RestException | 500 System error |
Definition at line 1021 of file api_orders.class.php.
References $id, _cleanObjectDatas(), and dol_syslog().
Orders::index | ( | $sortfield = "t.rowid", | |
$sortorder = 'ASC', | |||
$limit = 100, | |||
$page = 0, | |||
$thirdparty_ids = '', | |||
$sqlfilters = '', | |||
$sqlfilterlines = '', | |||
$properties = '', | |||
$pagination_data = false ) |
List orders.
Get a list of orders
string | $sortfield | Sort field |
string | $sortorder | Sort order |
int | $limit | Limit for list |
int | $page | Page number |
string | $thirdparty_ids | Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} |
string | $sqlfilters | Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" |
string | $sqlfilterlines | Other criteria to filter answers separated by a comma. Syntax example "(tl.fk_product:=:'17') and (tl.price:<:'250')" |
string | $properties | Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names |
bool | $pagination_data | If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* |
RestException | 404 Not found |
RestException | 503 Error |
Definition at line 168 of file api_orders.class.php.
References _cleanObjectDatas(), DolibarrApi\_filterObjectProperties(), dol_syslog(), and forgeSQLFromUniversalSearchCriteria().
Orders::post | ( | $request_data = null | ) |
Create a sale order.
Example: { "socid": 2, "date": 1595196000, "type": 0, "lines": [{ "fk_product": 2, "qty": 1 }] }
array | $request_data | Request data |
Definition at line 288 of file api_orders.class.php.
References DolibarrApi\_checkValForAPI(), _validate(), and sanitizeVal().
Orders::postContact | ( | $id, | |
$contactid, | |||
$type ) |
Add a contact type of given order.
int | $id | Id of order to update |
int | $contactid | Id of contact to add |
string | $type | Type of the contact (BILLING, SHIPPING, CUSTOMER) |
@url POST {id}/contact/{contactid}/{type}
RestException | 401 |
RestException | 404 |
Definition at line 565 of file api_orders.class.php.
References $id, and DolibarrApi\_checkAccessToResource().
Orders::postLine | ( | $id, | |
$request_data = null ) |
Add a line to given order.
int | $id | Id of order to update |
array | $request_data | OrderLine data |
@url POST {id}/lines
Definition at line 361 of file api_orders.class.php.
References $id, DolibarrApi\_checkAccessToResource(), and sanitizeVal().
Orders::put | ( | $id, | |
$request_data = null ) |
Update order general fields (won't touch lines of order)
int | $id | Id of order to update |
array | $request_data | Datas |
Definition at line 655 of file api_orders.class.php.
References $id, DolibarrApi\_checkAccessToResource(), DolibarrApi\_checkValForAPI(), and sanitizeVal().
Orders::putLine | ( | $id, | |
$lineid, | |||
$request_data = null ) |
Update a line to given order.
int | $id | Id of order to update |
int | $lineid | Id of line to update |
array | $request_data | OrderLine data |
@url PUT {id}/lines/{lineid}
Definition at line 428 of file api_orders.class.php.
References $id, DolibarrApi\_checkAccessToResource(), _cleanObjectDatas(), and sanitizeVal().
Orders::reopen | ( | $id | ) |
Tag the order as validated (opened)
Function used when order is reopend after being closed.
int | $id | Id of the order |
@url POST {id}/reopen
RestException | 304 |
RestException | 400 |
RestException | 401 |
RestException | 404 |
RestException | 405 |
Definition at line 807 of file api_orders.class.php.
References $id.
Orders::setinvoiced | ( | $id | ) |
Classify the order as invoiced.
Could be also called setbilled
int | $id | Id of the order |
@url POST {id}/setinvoiced
RestException | 400 |
RestException | 401 |
RestException | 404 |
RestException | 405 |
Definition at line 843 of file api_orders.class.php.
References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().
Orders::settodraft | ( | $id, | |
$idwarehouse = -1 ) |
Set an order to draft.
int | $id | Order ID |
int | $idwarehouse | Warehouse ID to use for stock change (Used only if option STOCK_CALCULATE_ON_VALIDATE_ORDER is on) |
@url POST {id}/settodraft
Definition at line 929 of file api_orders.class.php.
References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().
Orders::validate | ( | $id, | |
$idwarehouse = 0, | |||
$notrigger = 0 ) |
Validate an order.
If you get a bad value for param notrigger check, provide this in body { "idwarehouse": 0, "notrigger": 0 }
int | $id | Order ID |
int | $idwarehouse | Warehouse ID |
int | $notrigger | 1=Does not execute triggers, 0= execute triggers |
@url POST {id}/validate
RestException | 304 |
RestException | 401 |
RestException | 404 |
RestException | 500 System error |
Definition at line 756 of file api_orders.class.php.
References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().