From c9ae46db50f4aee2775ca0839f86b9ad08b00a44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Sep 2021 20:56:17 +0200 Subject: [PATCH] FIX Filter on categories --- htdocs/comm/propal/list.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index dcba8a63ed8..a0877a50028 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -475,7 +475,7 @@ $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as u if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", sc.fk_soc, sc.fk_user"; } -if ($search_categ_cus) { +if (!empty($search_categ_cus) && $search_categ_cus != '-1') { $sql .= ", cc.fk_categorie, cc.fk_soc"; } // Add fields from extrafields @@ -493,7 +493,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; -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 } $sql .= ', '.MAIN_DB_PREFIX.'propal as p'; @@ -592,6 +592,7 @@ if ($search_multicurrency_montant_ttc != '') { if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } + if ($search_categ_cus > 0) { $sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus); }