|
|
| __construct () |
| | Constructor.
|
| |
| | get ($id) |
| | Get properties of a stock movement object.
|
| |
| | index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $sqlfilters='', $properties='', $pagination_data=false) |
| | Get a list of stock movements.
|
| |
| | post ($product_id, $warehouse_id, $qty, $type=2, $batch='', $movementcode='', $label='', $price='', $datem='', $sellBy='', $eatBy='', $origin_type='', $origin_id=0) |
| | Create a stock movement.
|
| |
| | __construct ($db, $cachedir='', $refreshCache=false) |
| | Constructor.
|
| |
|
| | _cleanObjectDatas ($object) |
| | Update stock movement.
|
| |
| | _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.
|
| |
|
| 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.
|
| |
◆ _cleanObjectDatas()
| StockMovements::_cleanObjectDatas |
( |
| $object | ) |
|
|
protected |
Update stock movement.
- Parameters
-
| int | $id | Id of warehouse to update |
| array | $request_data | Datas |
- Returns
- Object Updated object Delete stock movement
- Parameters
-
- Returns
- array Clean sensible object datas @phpstan-template T
- Parameters
-
- Returns
- Object Object with cleaned properties @phpstan-param T $object @phpstan-return T
Reimplemented from DolibarrApi.
Definition at line 326 of file api_stockmovements.class.php.
References $object.
Referenced by get(), and index().
◆ _validate()
| StockMovements::_validate |
( |
| $data | ) |
|
|
private |
Validate fields before create or update object.
- Parameters
-
| ?array<string,string> | $data Data to validate |
- Returns
- array<string,string>
- Exceptions
-
Definition at line 384 of file api_stockmovements.class.php.
◆ get()
| StockMovements::get |
( |
| $id | ) |
|
Get properties of a stock movement object.
Return an array with stock movement information
- Since
- 23.0.0 Initial implementation
- Parameters
-
| int | $id | ID of stock movement |
- Returns
- Object Stock movement object with cleaned properties
@url GET {id}
- Exceptions
-
| RestException | 400 Bad Request |
| RestException | 403 Not allowed |
| RestException | 404 Not found |
| RestException | 500 Internal Server Error |
Definition at line 77 of file api_stockmovements.class.php.
References $id, and _cleanObjectDatas().
◆ index()
| StockMovements::index |
( |
| $sortfield = "t.rowid", |
|
|
| $sortorder = 'ASC', |
|
|
| $limit = 100, |
|
|
| $page = 0, |
|
|
| $sqlfilters = '', |
|
|
| $properties = '', |
|
|
| $pagination_data = false ) |
Get a list of stock movements.
- Since
- 5.0.0 Initial implementation
- Parameters
-
| string | $sortfield | Sort field |
| string | $sortorder | Sort order |
| int | $limit | Limit for list |
| int | $page | Page number |
| string | $sqlfilters | Other criteria to filter answers separated by a comma. Syntax example "(t.fk_product:=:1) and (t.date_creation:<:'20160101')" |
| 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* |
- Returns
- array Array of warehouse objects @phan-return MouvementStock[] @phpstan-return MouvementStock[]
- Exceptions
-
Definition at line 111 of file api_stockmovements.class.php.
References _cleanObjectDatas(), DolibarrApi\_filterObjectProperties(), and forgeSQLFromUniversalSearchCriteria().
◆ post()
| StockMovements::post |
( |
| $product_id, |
|
|
| $warehouse_id, |
|
|
| $qty, |
|
|
| $type = 2, |
|
|
| $batch = '', |
|
|
| $movementcode = '', |
|
|
| $label = '', |
|
|
| $price = '', |
|
|
| $datem = '', |
|
|
| $sellBy = '', |
|
|
| $eatBy = '', |
|
|
| $origin_type = '', |
|
|
| $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.
- Since
- 5.0.0 Initial implementation
- Parameters
-
| int | $product_id | ID product id {@min 1} {@from body} {@required true} |
| int | $warehouse_id | ID warehouse {@min 1} {@from body} {@required true} |
| float | $qty | Qty to add (Use negative value for a stock decrease) {@from body} {@required true} |
| int | $type | Optionally specify the type of movement. 0=input (stock increase by a stock transfer), 1=output (stock decrease by a stock transfer), 2=output (stock decrease), 3=input (stock increase). {@from body} {@type int} |
| string | $batch | Lot {@from body} |
| string | $movementcode | Movement code {@from body} |
| string | $label | Movement label {@from body} |
| string | $price | To update AWP (Average Weighted Price) when you make a stock increase (qty must be higher then 0). {@from body} |
| string | $datem | Date of movement {@from body} {@type date} |
| string | $sellBy | Eat-by date. {@from body} {@type date} |
| string | $eatBy | Sell-by date. {@from body} {@type date} |
| string | $origin_type | Origin type (Element of source object, like 'project', 'inventory', ...) |
| int | $origin_id | Origin id (ID of source object) |
- Returns
- int ID of stock movement
- Exceptions
-
Definition at line 212 of file api_stockmovements.class.php.
References dol_stringtotime().
The documentation for this class was generated from the following file: