Fix autoselect
This commit is contained in:
parent
8000adb694
commit
b98f547c4a
@ -202,7 +202,7 @@ class FormProduct
|
||||
/**
|
||||
* Return list of warehouses
|
||||
*
|
||||
* @param string|int $selected Id of preselected warehouse ('' or '-1' for no value, 'ifone'=select value if one value otherwise no value, '-2' to use the default value from setup)
|
||||
* @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)
|
||||
* @param string $htmlname Name of html select html
|
||||
* @param string $filterstatus warehouse status filter, following comma separated filter options can be used
|
||||
* 'warehouseopen' = select products from open warehouses,
|
||||
@ -279,7 +279,7 @@ class FormProduct
|
||||
}
|
||||
|
||||
$out .= '<option value="'.$id.'"';
|
||||
if ($selected == $id || ($selected == 'ifone' && $nbofwarehouses == 1)) {
|
||||
if ($selected == $id || (preg_match('/^ifone/', $selected) && $nbofwarehouses == 1)) {
|
||||
$out .= ' selected';
|
||||
}
|
||||
$out .= ' data-html="'.dol_escape_htmltag($label).'"';
|
||||
|
||||
@ -363,7 +363,7 @@ print $form->select_produits($productid, 'productid', '', 0, 0, -1, 2, '', 0, ar
|
||||
print ' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddingrightonly"> </span> ';
|
||||
print img_picto('', 'stock', 'class="pictofiwedwidth"');
|
||||
print '</span> ';
|
||||
print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifone'), 'fk_warehouse', '', 1, 0, 0, $langs->trans('Warehouse'), 0, 0, null, '', null, 1, false, 'e.ref');
|
||||
print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifonenodefault'), 'fk_warehouse', '', 1, 0, 0, $langs->trans('Warehouse'), 0, 0, null, '', null, 1, false, 'e.ref');
|
||||
print '</div>';
|
||||
|
||||
$parameters = array();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user