fix: on mass action confirm box tag filter must not make LEFT JOIN

This commit is contained in:
Florian HENRY 2021-05-20 13:24:30 +02:00
parent a3c28edfbb
commit d83dbd1922

View File

@ -467,10 +467,10 @@ if ($search_sale && $search_sale != '-1') {
$sql .= ", sc.fk_soc, sc.fk_user";
}
// We'll need these fields in order to filter by categ
if ($search_categ_cus) {
if ($search_categ_cus && $search_categ_cus!=-1) {
$sql .= ", cc.fk_categorie, cc.fk_soc";
}
if ($search_categ_sup) {
if ($search_categ_sup && $search_categ_sup!=-1) {
$sql .= ", cs.fk_categorie, cs.fk_soc";
}
// Add fields from extrafields
@ -494,10 +494,10 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_ef
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)";
// We'll need this table joined to the select in order to filter by categ
if (!empty($search_categ_cus)) {
if (!empty($search_categ_cus) && $search_categ_cus!=-1) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
}
if (!empty($search_categ_sup)) {
if (!empty($search_categ_sup) && $search_categ_sup!=-1) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ
}
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id";