FormProduct
class FormProduct (View source)
Class with static methods for building HTML components related to products Only components common to products and services must be here.
Properties
| DoliDB | $db | ||
| string | $error | ||
| array<int, array{id: int, label: string, parent_id: int, description: string, stock: string, full_label: string}> | $cache_warehouses | ||
| array<int, array<int, array{id: int, batch: string, entrepot_id: int, entrepot_label: string, qty: float, eatbydate: int|string, sellbydate: int|string}>> | $cache_lot | ||
| array<int, array{id: int, ref: string, label: string, type: string, nb_operators_required: int, thm_operator_estimated: float, thm_machine_estimated: float}> | $cache_workstations |
Methods
Constructor
Load in cache array list of warehouses If fk_product is not 0, we do not use cache
Load in cache array list of workstations If fk_product is not 0, we do not use cache
Return list of warehouses
Return list of workstations
Display form to select warehouse
Output a combo box with list of units Currently the units are not define in the DB
Return a combo box with list of units Units labels are defined in llx_c_units
Return a combo box with list of units NAture of product labels are defined in llx_c_product_nature
Return list of lot numbers (stock from product_batch) with stock location and stock qty
Return list of lot numbers (stock from product_batch) for product and warehouse.
Details
__construct($db)
Constructor
@param DoliDB $db Database handler
int
loadWarehouses(int $fk_product = 0, string $batch = '', string $status = '', bool $sumStock = true, int[] $exclude = array(), bool|int $stockMin = false, string $orderBy = 'e.ref')
Load in cache array list of warehouses If fk_product is not 0, we do not use cache
int
loadWorkstations(int $fk_product = 0, int[] $exclude = array(), string $orderBy = 'w.ref')
Load in cache array list of workstations If fk_product is not 0, we do not use cache
selectWarehouses($selected = '', string $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events = array(), $morecss = 'minwidth200', $exclude = array(), $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref', $multiselect = 0)
Return list of warehouses
@param ''|'-1'|'ifone'|'ifonenodefault'|'-2'|string|int|int[] $selected Id of preselected warehouse ('' or '-1' for no value, 'ifone' and 'ifonenodefault' = select value if one value otherwise no value, '-2' to use the default value from setup)
selectWorkstations($selected = '', string $htmlname = 'idworkstations', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $forcecombo = 0, array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events = array(), $morecss = 'minwidth200', $exclude = array(), $showfullpath = 1, $orderBy = 'e.ref')
Return list of workstations
@param string|int $selected Id of preselected warehouse ('' or '-1' for no value, 'ifone' and 'ifonenodefault' = select value if one value otherwise no value, '-2' to use the default value from setup)
formSelectWarehouses($page, string|int $selected = '', $htmlname = 'warehouse_id', $addempty = 0)
Display form to select warehouse
@param string $page Page
select_measuring_units($name = 'measuring_units', string $measuring_style = '', $selected = '0', $adddefault = 0, $mode = 0)
Output a combo box with list of units Currently the units are not define in the DB
@param string $name Name of HTML field
selectMeasuringUnits($name = 'measuring_units', string $measuring_style = '', $selected = '0', $adddefault = 0, $mode = 0, $morecss = 'minwidth75 maxwidth125')
Return a combo box with list of units Units labels are defined in llx_c_units
@param string $name Name of HTML field
selectProductNature($name = 'finished', string $selected = '', $mode = 0, $showempty = 1)
Return a combo box with list of units NAture of product labels are defined in llx_c_product_nature
@param string $name Name of HTML field
selectLotStock($selected = '', string $htmlname = 'batch_id', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array(), $empty_label = '', $forcecombo = 0, array<array{method: string, url: string, htmlname: string, params: array<string, string>}> $events = array(), $morecss = 'minwidth200')
Return list of lot numbers (stock from product_batch) with stock location and stock qty
@param string|int $selected Id of preselected lot stock id ('' for no value, 'ifone'=select value if one value otherwise no value)
selectLotDataList($htmlname = 'batch_id', int $empty = 0, $fk_product = 0, $fk_entrepot = 0, $objectLines = array())
Return list of lot numbers (stock from product_batch) for product and warehouse.
@param string $htmlname Name of key that is inside attribute "list" of an input text field.