dolibarr 21.0.0-alpha
|
Class with static methods for building HTML components related to products Only components common to products and services must be here. More...
Public Member Functions | |
__construct ($db) | |
Constructor. | |
loadWarehouses ($fk_product=0, $batch='', $status='', $sumStock=true, $exclude=array(), $stockMin=false, $orderBy='e.ref') | |
Load in cache array list of warehouses If fk_product is not 0, we do not use cache. | |
loadWorkstations ($fk_product=0, $exclude=array(), $orderBy='w.ref') | |
Load in cache array list of workstations If fk_product is not 0, we do not use cache. | |
selectWarehouses ($selected='', $htmlname='idwarehouse', $filterstatus='', $empty=0, $disabled=0, $fk_product=0, $empty_label='', $showstock=0, $forcecombo=0, $events=array(), $morecss='minwidth200', $exclude=array(), $showfullpath=1, $stockMin=false, $orderBy='e.ref', $multiselect=0) | |
Return list of warehouses. | |
selectWorkstations ($selected='', $htmlname='idworkstations', $empty=0, $disabled=0, $fk_product=0, $empty_label='', $forcecombo=0, $events=array(), $morecss='minwidth200', $exclude=array(), $showfullpath=1, $orderBy='e.ref') | |
Return list of workstations. | |
formSelectWarehouses ($page, $selected='', $htmlname='warehouse_id', $addempty=0) | |
Display form to select warehouse. | |
select_measuring_units ($name='measuring_units', $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. | |
selectMeasuringUnits ($name='measuring_units', $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. | |
selectProductNature ($name='finished', $selected='', $mode=0, $showempty=1) | |
Return a combo box with list of units NAture of product labels are defined in llx_c_product_nature. | |
selectLotStock ($selected='', $htmlname='batch_id', $filterstatus='', $empty=0, $disabled=0, $fk_product=0, $fk_entrepot=0, $objectLines=array(), $empty_label='', $forcecombo=0, $events=array(), $morecss='minwidth200') | |
Return list of lot numbers (stock from product_batch) with stock location and stock qty. | |
selectLotDataList ($htmlname='batch_id', $empty=0, $fk_product=0, $fk_entrepot=0, $objectLines=array()) | |
Return list of lot numbers (stock from product_batch) for product and warehouse. | |
Private Member Functions | |
get_parent_path ($tab, $final_label='') | |
Return full path to current warehouse in $tab (recursive function) Set Hidden conf MAIN_WAREHOUSE_LIST_DISPLAY_MODE at 0 || 1 || 2 to unlock display 0 : Default behavior, display parents of warehouse 1 : Display only current warehouse label only 2 : Display last parent warehouse label. | |
loadLotStock ($productIdArray=array()) | |
Load in cache array list of lot available in stock from a given list of products. | |
Class with static methods for building HTML components related to products Only components common to products and services must be here.
Definition at line 32 of file html.formproduct.class.php.
FormProduct::__construct | ( | $db | ) |
Constructor.
Definition at line 64 of file html.formproduct.class.php.
FormProduct::formSelectWarehouses | ( | $page, | |
$selected = '', | |||
$htmlname = 'warehouse_id', | |||
$addempty = 0 ) |
Display form to select warehouse.
string | $page | Page |
string | int | $selected | Id of warehouse |
string | $htmlname | Name of select html field |
int<0,2> | $addempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. |
Definition at line 516 of file html.formproduct.class.php.
References selectWarehouses().
|
private |
Return full path to current warehouse in $tab (recursive function) Set Hidden conf MAIN_WAREHOUSE_LIST_DISPLAY_MODE at 0 || 1 || 2 to unlock display 0 : Default behavior, display parents of warehouse 1 : Display only current warehouse label only 2 : Display last parent warehouse label.
array{id:int,label:string,parent_id:int,description:string,stock:string,full_label:string} | $tab warehouse data in $this->cache_warehouses line | |
string | $final_label | full label with all parents, separated by ' >> ' (completed on each call) |
Definition at line 255 of file html.formproduct.class.php.
References get_parent_path(), and getDolGlobalInt().
Referenced by get_parent_path(), and loadWarehouses().
|
private |
Load in cache array list of lot available in stock from a given list of products.
int[] | $productIdArray | array of product id's from who to get lot numbers. A |
Definition at line 880 of file html.formproduct.class.php.
References dol_print_error(), dol_syslog(), and getEntity().
Referenced by selectLotDataList(), and selectLotStock().
FormProduct::loadWarehouses | ( | $fk_product = 0, | |
$batch = '', | |||
$status = '', | |||
$sumStock = true, | |||
$exclude = array(), | |||
$stockMin = false, | |||
$orderBy = 'e.ref' ) |
Load in cache array list of warehouses If fk_product is not 0, we do not use cache.
int | $fk_product | Add quantity of stock in label for product with id fk_product. Nothing if 0. |
string | $batch | Add quantity of batch stock in label for product with batch name batch, batch name precedes batch_id. Nothing if ''. |
string | $status | warehouse status filter, following comma separated filter options can be used 'warehouseopen' = select products from open warehouses, 'warehouseclosed' = select products from closed warehouses, 'warehouseinternal' = select products from warehouses for internal correct/transfer only |
boolean | $sumStock | sum total stock of a warehouse, default true |
int[] | $exclude | warehouses ids to exclude |
bool | int | $stockMin | [=false] Value of minimum stock to filter (only warehouse with stock > stockMin are loaded) or false not not filter by minimum stock |
string | $orderBy | [='e.ref'] Order by |
Exception |
Definition at line 87 of file html.formproduct.class.php.
References dol_print_error(), dol_syslog(), get_parent_path(), price2num(), Entrepot\STATUS_CLOSED, Entrepot\STATUS_OPEN_ALL, and Entrepot\STATUS_OPEN_INTERNAL.
Referenced by selectWarehouses().
FormProduct::loadWorkstations | ( | $fk_product = 0, | |
$exclude = array(), | |||
$orderBy = 'w.ref' ) |
Load in cache array list of workstations If fk_product is not 0, we do not use cache.
int | $fk_product | Add quantity of stock in label for product with id fk_product. Nothing if 0. |
int[] | $exclude | warehouses ids to exclude |
string | $orderBy | [='e.ref'] Order by |
Exception |
Definition at line 197 of file html.formproduct.class.php.
References dol_print_error(), and dol_syslog().
Referenced by selectWorkstations().
FormProduct::select_measuring_units | ( | $name = 'measuring_units', | |
$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.
string | $name | Name of HTML field |
string | $measuring_style | Unit to show: weight, size, surface, volume, time |
string | $selected | Preselected value |
int | $adddefault | Add empty unit called "Default" |
int | $mode | 1=Use short label as value, 0=Use rowid |
Definition at line 554 of file html.formproduct.class.php.
References selectMeasuringUnits().
FormProduct::selectLotDataList | ( | $htmlname = 'batch_id', | |
$empty = 0, | |||
$fk_product = 0, | |||
$fk_entrepot = 0, | |||
$objectLines = array() ) |
Return list of lot numbers (stock from product_batch) for product and warehouse.
string | $htmlname | Name of key that is inside attribute "list" of an input text field. |
int | $empty | 1=Can be empty, 0 if not |
int | $fk_product | show lot numbers of product with id fk_product. All from objectLines if 0. |
int | $fk_entrepot | filter lot numbers for warehouse with id fk_entrepot. All if 0. |
CommonObjectLine[] | $objectLines | Only cache lot numbers for products in lines of object. If no lines only for fk_product. If no fk_product, all. |
Definition at line 809 of file html.formproduct.class.php.
References $id, dol_syslog(), and loadLotStock().
FormProduct::selectLotStock | ( | $selected = '', | |
$htmlname = 'batch_id', | |||
$filterstatus = '', | |||
$empty = 0, | |||
$disabled = 0, | |||
$fk_product = 0, | |||
$fk_entrepot = 0, | |||
$objectLines = array(), | |||
$empty_label = '', | |||
$forcecombo = 0, | |||
$events = array(), | |||
$morecss = 'minwidth200' ) |
Return list of lot numbers (stock from product_batch) with stock location and stock qty.
string | int | $selected | Id of preselected lot stock id ('' for no value, 'ifone'=select value if one value otherwise no value) |
string | $htmlname | Name of html select html |
string | $filterstatus | lot status filter, following comma separated filter options can be used |
int | $empty | 1=Can be empty, 0 if not |
int | $disabled | 1=Select is disabled |
int | $fk_product | show lot numbers of product with id fk_product. All from objectLines if 0. |
int | $fk_entrepot | filter lot numbers for warehouse with id fk_entrepot. All if 0. |
CommonObjectLine[] | $objectLines | Only cache lot numbers for products in lines of object. If no lines only for fk_product. If no fk_product, all. |
string | $empty_label | Empty label if needed (only if $empty=1) |
int | $forcecombo | 1=Force combo iso ajax select2 |
array<array{method:string,url:string,htmlname:string,params:array<string,string>}> | $events Events to add to select2 | |
string | $morecss | Add more css classes to HTML select |
Definition at line 726 of file html.formproduct.class.php.
References $id, ajax_combobox(), dol_syslog(), and loadLotStock().
FormProduct::selectMeasuringUnits | ( | $name = 'measuring_units', | |
$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.
string | $name | Name of HTML field |
string | $measuring_style | Unit to show: weight, size, surface, volume, time |
string | $selected | Preselected value |
int | string | $adddefault | 1=Add empty unit called "Default", ''=Add empty value |
int<0,2> | $mode 1=Use short label as value, 0=Use rowid, 2=Use scale (power) | |
string | $morecss | More CSS |
Definition at line 572 of file html.formproduct.class.php.
References ajax_combobox(), and dol_print_error().
Referenced by select_measuring_units().
FormProduct::selectProductNature | ( | $name = 'finished', | |
$selected = '', | |||
$mode = 0, | |||
$showempty = 1 ) |
Return a combo box with list of units NAture of product labels are defined in llx_c_product_nature.
string | $name | Name of HTML field |
string | $selected | Preselected value |
int | $mode | 1=Use label as value, 0=Use code |
int | $showempty | 1=show empty value, 0= no |
Definition at line 649 of file html.formproduct.class.php.
References ajax_combobox(), and dol_print_error().
FormProduct::selectWarehouses | ( | $selected = '', | |
$htmlname = 'idwarehouse', | |||
$filterstatus = '', | |||
$empty = 0, | |||
$disabled = 0, | |||
$fk_product = 0, | |||
$empty_label = '', | |||
$showstock = 0, | |||
$forcecombo = 0, | |||
$events = array(), | |||
$morecss = 'minwidth200', | |||
$exclude = array(), | |||
$showfullpath = 1, | |||
$stockMin = false, | |||
$orderBy = 'e.ref', | |||
$multiselect = 0 ) |
Return list of warehouses.
''|'-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) | |
string | $htmlname | Name of html select html |
string | $filterstatus | warehouse status filter, following comma separated filter options can be used 'warehouseopen' = select products from open warehouses, 'warehouseclosed' = select products from closed warehouses, 'warehouseinternal' = select products from warehouses for internal correct/transfer only |
int<0,1> | $empty 1=Can be empty, 0 if not | |
int<0,1> | $disabled 1=Select is disabled | |
int | $fk_product | Add quantity of stock in label for product with id fk_product. Nothing if 0. |
string | $empty_label | Empty label if needed (only if $empty=1) |
int<0,1> | $showstock 1=Show stock count | |
int<0,1> | $forcecombo 1=Force combo iso ajax select2 | |
array<array{method:string,url:string,htmlname:string,params:array<string,string>}> | $events Events to add to select2 | |
string | $morecss | Add more css classes to HTML select |
int[] | $exclude | Warehouses ids to exclude |
int | $showfullpath | 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse |
bool | int | $stockMin | [=false] Value of minimum stock to filter (only warehouse with stock > stockMin are loaded) or false not not filter by minimum stock |
string | $orderBy | [='e.ref'] Order by |
int<0,1> | $multiselect 1=Allow multiselect |
Exception |
Definition at line 303 of file html.formproduct.class.php.
References $id, ajax_combobox(), dol_syslog(), getDolGlobalString(), and loadWarehouses().
Referenced by formSelectWarehouses().
FormProduct::selectWorkstations | ( | $selected = '', | |
$htmlname = 'idworkstations', | |||
$empty = 0, | |||
$disabled = 0, | |||
$fk_product = 0, | |||
$empty_label = '', | |||
$forcecombo = 0, | |||
$events = array(), | |||
$morecss = 'minwidth200', | |||
$exclude = array(), | |||
$showfullpath = 1, | |||
$orderBy = 'e.ref' ) |
Return list of workstations.
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) |
string | $htmlname | Name of html select html |
int<0,1> | $empty 1=Can be empty, 0 if not | |
int<0,1> | $disabled 1=Select is disabled | |
int | $fk_product | Add quantity of stock in label for product with id fk_product. Nothing if 0. |
string | $empty_label | Empty label if needed (only if $empty=1) |
int<0,1> | $forcecombo 1=Force combo iso ajax select2 | |
array<array{method:string,url:string,htmlname:string,params:array<string,string>}> | $events Events to add to select2 | |
string | $morecss | Add more css classes to HTML select |
int[] | $exclude | Warehouses ids to exclude |
int<0,1> | $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse | |
string | $orderBy | [='e.ref'] Order by |
Exception |
Definition at line 427 of file html.formproduct.class.php.
References $id, ajax_combobox(), dol_syslog(), getDolGlobalString(), and loadWorkstations().