StockMovements
class StockMovements extends DolibarrApi (View source)
API class for stock movements
Properties
| protected DoliDB | $db | from DolibarrApi | |
| Restler | $r | from DolibarrApi | |
| static string[] | $FIELDS | ||
| MouvementStock | $stockmovement |
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 stock movement object
Get a list of stock movements
Create a stock movement
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
object
get(int $id)
Get properties of a stock movement object
Return an array with stock movement information
array
index(string $sortfield = "t.rowid", string $sortorder = 'ASC', int $limit = 100, int $page = 0, string $sqlfilters = '', string $properties = '', bool $pagination_data = false)
Get a list of stock movements
int
post(int $product_id, int $warehouse_id, float $qty, int $type = 2, string $batch = '', string $movementcode = '', string $label = '', string $price = '', string $datem = '', string $sellBy = '', string $eatBy = '', string $origin_type = '', int $origin_id = 0)
Create a stock movement
You can use the following message to test this REST API:
{ "product_id": 1, "warehouse_id": 1, "qty": 1, "batch": "", "movementcode": "INV123", "label": "Inventory 123", "price": 0 } $price Can be set to update AWP (Average Weighted Price) when you make a stock increase $eatBy Eat-by date. Will be used if a batch does not exist yet and will be created. sellBy Sell-by date. Will be used if a batch does not exist yet and will be created.