SupplierOrders
class SupplierOrders extends DolibarrApi (View source)
API class for supplier orders
Properties
| protected DoliDB | $db | from DolibarrApi | |
| Restler | $r | from DolibarrApi | |
| static string[] | $FIELDS | ||
| CommandeFournisseur | $order |
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 a supplier order object
List orders
Create supplier order object
Update supplier order
Add a line to a given supplier order
Get contacts of given supplier order
Add a contact type of given supplier order
Unlink a contact type of given supplier order
Delete supplier order
Validate an order
Approve an order
Sends an order to the vendor
Receives the order, dispatches products.
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)
Get properties of a supplier order object
Return an array with supplier order information
array
index(string $sortfield = "t.rowid", string $sortorder = 'ASC', int $limit = 100, int $page = 0, string $thirdparty_ids = '', string $product_ids = '', string $status = '', string $sqlfilters = '', string $sqlfilterlines = '', string $properties = '', bool $pagination_data = false)
List orders
Get a list of supplier orders
int
post(array $request_data = null)
Create supplier order object
Example: {"ref": "auto", "ref_supplier": "1234", "socid": "1", "multicurrency_code": "SEK", "multicurrency_tx": 1, "tva_tx": 25, "note": "Imported via the REST API"}
object|false
put(int $id, array $request_data = null)
Update supplier order
int
postLine(int $id, array $request_data = null)
Add a line to a given supplier order
array<int, mixed>
getContacts(int $id, string $source, string $type = '')
Get contacts of given supplier order
Return an array with contact information
array
postContact(int $id, int $contactid, string $type, string $source)
Add a contact type of given supplier order
array
deleteContact(int $id, int $contactid, string $type, string $source)
Unlink a contact type of given supplier order
array
delete(int $id)
Delete supplier order
array
validate(int $id, int $idwarehouse = 0, int $notrigger = 0)
Validate an order
array
approve(int $id, int $idwarehouse = 0, int $secondlevel = 0)
Approve an order
array
makeOrder(int $id, int $date, int $method, string $comment = '')
Sends an order to the vendor
array
receiveOrder(int $id, int $closeopenorder, string $comment, array $lines)
Receives the order, dispatches products.
Example:
"closeopenorder": 1,
"comment": "",
"lines": [{
"id": 14,
"fk_product": 112,
"qty": 18,
"warehouse": 1,
"price": 114,
"comment": "",
"eatby": 0,
"sellby": 0,
"batch": 0,
"notrigger": 0
}]
}```