Skip to content

Latest commit

 

History

History
200 lines (116 loc) · 6.18 KB

interface.StockManagerInterface.md

File metadata and controls

200 lines (116 loc) · 6.18 KB

Interface StockManagerInterface

StockManagerInterface : defines a way to manage stock

Contents

Methods

Methods

addProduct

boolean StockManagerInterface::addProduct(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)

For a given product, adds a given quantity

Arguments

  • $id_product integer
  • $id_product_attribute integer
  • $warehouse Warehouse
  • $quantity integer
  • $id_stock_movement_reason integer
  • $price_te float
  • $is_usable boolean
  • $id_supply_order integer - optionnal

getProductCoverage

integer StockManagerInterface::getProductCoverage(integer $id_product, integer $id_product_attribute, integer $coverage, integer $id_warehouse)

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)

Arguments

  • $id_product integer
  • $id_product_attribute integer
  • $coverage integer
  • $id_warehouse integer - Optional

getProductPhysicalQuantities

integer StockManagerInterface::getProductPhysicalQuantities(integer $id_product, integer $id_product_attribute, array|integer $ids_warehouse, boolean $usable)

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

Arguments

  • $id_product integer
  • $id_product_attribute integer
  • $ids_warehouse array|integer - optional
  • $usable boolean - false default - in this case we retrieve all physical quantities, otherwise we retrieve physical quantities flagged as usable

getProductRealQuantities

integer StockManagerInterface::getProductRealQuantities(integer $id_product, integer $id_product_attribute, array|integer $ids_warehouse, boolean $usable)

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

Arguments

  • $id_product integer
  • $id_product_attribute integer
  • $ids_warehouse array|integer - optional
  • $usable boolean - false by default

isAvailable

\StockManagerInterface StockManagerInterface::isAvailable()

Checks if the StockManager is available

removeProduct

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

For a given product, removes a given quantity

Arguments

  • $id_product integer
  • $id_product_attribute integer
  • $warehouse Warehouse
  • $quantity integer
  • $id_stock_movement_reason integer
  • $is_usable boolean
  • $id_order integer - Optionnal

transferBetweenWarehouses

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

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

Arguments

  • $id_product integer
  • $id_product_attribute integer
  • $quantity integer
  • $warehouse_from integer
  • $warehouse_to integer
  • $usable_from boolean - Optional, true by default
  • $usable_to boolean - Optional, true by default