This commit is contained in:
Laurent Destailleur 2020-11-24 12:52:39 +01:00
parent 817de18a5d
commit faa33f2d3c

View File

@ -57,7 +57,6 @@ $search_ref = GETPOST("search_ref", 'alpha');
$search_barcode = GETPOST("search_barcode", 'alpha');
$search_label = GETPOST("search_label", 'alpha');
$search_type = GETPOST("search_type", 'int');
$search_sale = GETPOST("search_sale", 'int');
$search_vatrate = GETPOST("search_vatrate", 'alpha');
$searchCategoryProductOperator = (GETPOST('search_category_product_operator', 'int') ? GETPOST('search_category_product_operator', 'int') : 0);
$searchCategoryProductList = GETPOST('search_category_product_list', 'array');
@ -257,8 +256,8 @@ if (empty($reshook))
$searchCategoryProductList = array();
$search_tosell = "";
$search_tobuy = "";
$search_vatrate = "";
$search_tobatch = '';
$search_vatrate = "";
//$search_type=''; // There is 2 types of list: a list of product and a list of services. No list with both. So when we clear search criteria, we must keep the filter on type.
$show_childproducts = '';
@ -355,8 +354,9 @@ if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTE
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
if ($search_label) $sql .= natural_search('p.label', $search_label);
if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode);
if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell != -1) $sql .= " AND p.tosell = ".$db->escape($search_tosell);
if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy != -1) $sql .= " AND p.tobuy = ".$db->escape($search_tobuy);
if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell != -1) $sql .= " AND p.tosell = ".((int) $search_tosell);
if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy != -1) $sql .= " AND p.tobuy = ".((int) $search_tobuy);
if (isset($search_tobatch) && dol_strlen($search_tobatch) > 0 && $search_tobatch != -1) $sql .= " AND p.tobatch = ".((int) $search_tobatch);
if ($search_vatrate) $sql .= natural_search('p.tva_tx', $search_vatrate);
if (dol_strlen($canvas) > 0) $sql .= " AND p.canvas = '".$db->escape($canvas)."'";
if ($catid > 0) $sql .= " AND cp.fk_categorie = ".$catid;
@ -385,8 +385,7 @@ if ($searchCategoryProductOperator == 1) {
$sql .= " AND (".implode(' AND ', $searchCategoryProductSqlList).")";
}
}
if ($fourn_id > 0) $sql .= " AND pfp.fk_soc = ".$fourn_id;
if ($search_tobatch != '' && $search_tobatch >= 0) $sql .= " AND p.tobatch = ".$db->escape($search_tobatch);
if ($fourn_id > 0) $sql .= " AND pfp.fk_soc = ".((int) $fourn_id);
if ($search_accountancy_code_sell) $sql .= natural_search('p.accountancy_code_sell', $search_accountancy_code_sell);
if ($search_accountancy_code_sell_intra) $sql .= natural_search('p.accountancy_code_sell_intra', $search_accountancy_code_sell_intra);
if ($search_accountancy_code_sell_export) $sql .= natural_search('p.accountancy_code_sell_export', $search_accountancy_code_sell_export);
@ -485,14 +484,14 @@ if ($resql)
if ($search_label) $param .= "&search_label=".urlencode($search_label);
if ($search_tosell != '') $param .= "&search_tosell=".urlencode($search_tosell);
if ($search_tobuy != '') $param .= "&search_tobuy=".urlencode($search_tobuy);
if ($search_vatrate) $sql .= natural_search('p.tva_tx', $search_vatrate);
if ($search_tobatch) $param = "&search_tobatch=".urlencode($search_tobatch);
if ($search_vatrate) $param = "&search_vatrate=".urlencode($search_vatrate);
if ($fourn_id > 0) $param .= ($fourn_id ? "&fourn_id=".$fourn_id : "");
//if ($seach_categ) $param.=($search_categ?"&search_categ=".urlencode($search_categ):"");
if ($show_childproducts) $param .= ($show_childproducts ? "&search_show_childproducts=".urlencode($show_childproducts) : "");
if ($type != '') $param .= '&type='.urlencode($type);
if ($search_type != '') $param .= '&search_type='.urlencode($search_type);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
if ($search_tobatch) $param = "&search_ref_supplier=".urlencode($search_ref_supplier);
if ($search_accountancy_code_sell) $param = "&search_accountancy_code_sell=".urlencode($search_accountancy_code_sell);
if ($search_accountancy_code_sell_intra) $param = "&search_accountancy_code_sell_intra=".urlencode($search_accountancy_code_sell_intra);
if ($search_accountancy_code_sell_export) $param = "&search_accountancy_code_sell_export=".urlencode($search_accountancy_code_sell_export);
@ -785,7 +784,7 @@ if ($resql)
// Stock
if (!empty($arrayfields['stock_virtual']['checked'])) print '<td class="liste_titre">&nbsp;</td>';
// To batch
if (!empty($arrayfields['p.tobatch']['checked'])) print '<td class="liste_titre center">'.$form->selectyesno($search_tobatch, '', '', '', 1).'</td>';
if (!empty($arrayfields['p.tobatch']['checked'])) print '<td class="liste_titre center">'.$form->selectyesno('search_tobatch', $search_tobatch, 1, false, 1).'</td>';
// Accountancy code sell
if (!empty($arrayfields['p.accountancy_code_sell']['checked'])) print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell" value="'.dol_escape_htmltag($search_accountancy_code_sell).'"></td>';
if (!empty($arrayfields['p.accountancy_code_sell_intra']['checked'])) print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell_intra" value="'.dol_escape_htmltag($search_accountancy_code_sell_intra).'"></td>';