Fix: missing input text value in ajax if error

This commit is contained in:
Regis Houssin 2011-03-11 10:15:18 +00:00
parent b3a5de3ff5
commit 392af4ace1

View File

@ -888,16 +888,17 @@ class Form
* @param price_level Level of price to show * @param price_level Level of price to show
* @param status -1=Return all products, 0=Products not on sell, 1=Products on sell * @param status -1=Return all products, 0=Products not on sell, 1=Products on sell
* @param finished 2=all, 1=finished, 0=raw material * @param finished 2=all, 1=finished, 0=raw material
* @param $selected_input_value Value of preselected input text (with ajax)
*/ */
function select_produits($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$status=1,$finished=2) function select_produits($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$status=1,$finished=2,$selected_input_value='')
{ {
global $langs,$conf; global $langs,$conf;
if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT) if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)
{ {
// mode=1 means customers products // mode=1 means customers products
print ajax_autocompleter('', $htmlname, DOL_URL_ROOT.'/product/ajaxproducts.php', 'outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT); print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajaxproducts.php', 'outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT);
print $langs->trans("RefOrLabel").' : <input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'">'; print $langs->trans("RefOrLabel").' : <input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'" />';
print '<br>'; print '<br>';
} }
else else