\StockManagerInterface

StockManagerInterface : defines a way to manage stock

Summary

Methods
Constants
isAvailable()
addProduct()
removeProduct()
getProductPhysicalQuantities()
getProductRealQuantities()
transferBetweenWarehouses()
getProductCoverage()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

isAvailable()

isAvailable() : \StockManagerInterface

Checks if the StockManager is available

Returns

\StockManagerInterface

addProduct()

addProduct(integer  $id_product, integer  $id_product_attribute, \Warehouse  $warehouse, integer  $quantity, integer  $id_stock_movement_reason, float  $price_te, boolean  $is_usable = true, integer  $id_supply_order = null) : boolean

For a given product, adds a given quantity

Parameters

integer $id_product
integer $id_product_attribute
\Warehouse $warehouse
integer $quantity
integer $id_stock_movement_reason
float $price_te
boolean $is_usable
integer $id_supply_order

optionnal

Returns

boolean

removeProduct()

removeProduct(integer  $id_product,   $id_product_attribute, \Warehouse  $warehouse, integer  $quantity, integer  $id_stock_movement_reason, boolean  $is_usable = true, integer  $id_order = null) : array

For a given product, removes a given quantity

Parameters

integer $id_product
$id_product_attribute
\Warehouse $warehouse
integer $quantity
integer $id_stock_movement_reason
boolean $is_usable
integer $id_order

Optionnal

Returns

array —
  • empty if an error occurred | details of removed products quantities with corresponding prices otherwise

getProductPhysicalQuantities()

getProductPhysicalQuantities(integer  $id_product, integer  $id_product_attribute, array|integer  $ids_warehouse = null, boolean  $usable = false) : integer

For a given product, returns its physical quantity If the given product has combinations and $id_product_attribute is null, returns the sum for all combinations

Parameters

integer $id_product
integer $id_product_attribute
array|integer $ids_warehouse

optional

boolean $usable

false default - in this case we retrieve all physical quantities, otherwise we retrieve physical quantities flagged as usable

Returns

integer

getProductRealQuantities()

getProductRealQuantities(integer  $id_product, integer  $id_product_attribute, array|integer  $ids_warehouse = null, boolean  $usable = false) : integer

For a given product, returns its real quantity If the given product has combinations and $id_product_attribute is null, returns the sum for all combinations Real quantity : (physical_qty + supply_orders_qty - client_orders_qty) If $usable is defined, real quantity: usable_qty + supply_orders_qty - client_orders_qty

Parameters

integer $id_product
integer $id_product_attribute
array|integer $ids_warehouse

optional

boolean $usable

false by default

Returns

integer

transferBetweenWarehouses()

transferBetweenWarehouses(integer  $id_product, integer  $id_product_attribute, integer  $quantity, integer  $warehouse_from, integer  $warehouse_to, boolean  $usable_from = true, boolean  $usable_to = true) : boolean

For a given product, transfers quantities between two warehouses By default, it manages usable quantities It is also possible to transfer a usable quantity from warehouse 1 in an unusable quantity to warehouse 2 It is also possible to transfer a usable quantity from warehouse 1 in an unusable quantity to warehouse 1

Parameters

integer $id_product
integer $id_product_attribute
integer $quantity
integer $warehouse_from
integer $warehouse_to
boolean $usable_from

Optional, true by default

boolean $usable_to

Optional, true by default

Returns

boolean

getProductCoverage()

getProductCoverage(integer  $id_product, integer  $id_product_attribute, integer  $coverage, integer  $id_warehouse = null) : integer

For a given product, returns the time left before being out of stock.

By default, for the given product, it will use sum(quantities removed in all warehouses)

Parameters

integer $id_product
integer $id_product_attribute
integer $coverage
integer $id_warehouse

Optional

Returns

integer —

time