fix(param) select_produits_fournisseur_list

This commit is contained in:
Antonin MARCHAL 2021-05-26 16:44:35 +02:00
parent 48945533e4
commit 8dd2af42df

View File

@ -3025,6 +3025,10 @@ class Form
global $langs, $conf;
global $price_level, $status, $finished;
if(empty($status)){
$status = 1;
}
$selected_input_value = '';
if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) {
if ($selected > 0) {
@ -3040,7 +3044,7 @@ class Form
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
print ($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="minwidth300" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>';
} else {
print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', -1, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);
print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);
}
}
@ -3054,7 +3058,7 @@ class Form
* @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
* @param string $filtre Pour filtre sql
* @param string $filterkey Filtre des produits
* @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell (not used here, a filter on tobuy is already hard coded in request)
* @param int $statut -1=Return all products, 0=Products not on buy, 1=Products on buy
* @param int $outputmode 0=HTML select string, 1=Array
* @param int $limit Limit of line number
* @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices
@ -3107,7 +3111,9 @@ class Form
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units u ON u.rowid = p.fk_unit";
}
$sql .= " WHERE p.entity IN (".getEntity('product').")";
$sql .= " AND p.tobuy = 1";
if($statut != -1){
$sql .= " AND p.tobuy = ".$statut;
}
if (strval($filtertype) != '') {
$sql .= " AND p.fk_product_type=".$this->db->escape($filtertype);
}