|
| __construct () |
| Constructor.
|
|
| index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $sqlfilters='', $properties='') |
| Get properties of a stock movement object.
|
|
| post ($product_id, $warehouse_id, $qty, $type=2, $lot='', $movementcode='', $movementlabel='', $price='', $datem='', $dlc='', $dluo='', $origin_type='', $origin_id=0) |
| Create stock movement object.
|
|
| __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
- int Delete stock movement
- Parameters
-
- Returns
- array Clean sensible object datas
- Parameters
-
- Returns
- Object Object with cleaned properties
Reimplemented from DolibarrApi.
Definition at line 287 of file api_stockmovements.class.php.
Referenced by index().
◆ _validate()
StockMovements::_validate |
( |
| $data | ) |
|
|
private |
◆ index()
StockMovements::index |
( |
| $sortfield = "t.rowid", |
|
|
| $sortorder = 'ASC', |
|
|
| $limit = 100, |
|
|
| $page = 0, |
|
|
| $sqlfilters = '', |
|
|
| $properties = '' ) |
Get properties of a stock movement object.
Return an array with stock movement informations
- Parameters
-
- Returns
- Object Object with cleaned properties
- Exceptions
-
RestException | Get a list of stock movement |
- 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.product_id:=:1) and (t.date_creation:<:'20160101')" |
string | $properties | Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names |
- Returns
- array Array of warehouse objects
- Exceptions
-
Definition at line 97 of file api_stockmovements.class.php.
References _cleanObjectDatas(), DolibarrApi\_filterObjectProperties(), and forgeSQLFromUniversalSearchCriteria().
◆ post()
StockMovements::post |
( |
| $product_id, |
|
|
| $warehouse_id, |
|
|
| $qty, |
|
|
| $type = 2, |
|
|
| $lot = '', |
|
|
| $movementcode = '', |
|
|
| $movementlabel = '', |
|
|
| $price = '', |
|
|
| $datem = '', |
|
|
| $dlc = '', |
|
|
| $dluo = '', |
|
|
| $origin_type = '', |
|
|
| $origin_id = 0 ) |
Create stock movement object.
You can use the following message to test this RES API: { "product_id": 1, "warehouse_id": 1, "qty": 1, "lot": "", "movementcode": "INV123", "movementlabel": "Inventory 123", "price": 0 } $price Can be set to update AWP (Average Weighted Price) when you make a stock increase $dlc Eat-by date. Will be used if lot does not exists yet and will be created. $dluo Sell-by date. Will be used if lot does not exists yet and will be created.
- 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 | $lot | Lot {@from body} |
string | $movementcode | Movement code {@from body} |
string | $movementlabel | 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 | $dlc | Eat-by date. {@from body} {@type date} |
string | $dluo | 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 176 of file api_stockmovements.class.php.
References dol_stringtotime().
The documentation for this class was generated from the following file: