diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 47c051a4f47..176d71c77be 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -219,34 +219,23 @@ $sql.= " AND s.client IN (2, 3)"; $sql.= ' AND s.entity IN ('.getEntity('societe', 1).')'; if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; if ($socid) $sql.= " AND s.rowid = " .$socid; -if ($search_stcomm != '') $sql.= " AND s.fk_stcomm=".$search_stcomm; -if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid; -if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL"; -if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; -if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; -if ($search_nom) { - $sql .= natural_search('s.nom', $search_nom); -} +if ($search_stcomm != '') $sql.= natural_search("s.fk_stcomm",$search_stcomm,2); +if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid; +if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL"; +if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; +if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; +if ($search_nom) $sql .= natural_search('s.nom', $search_nom); if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape(strtolower($search_zipcode))."%'"; -if ($search_town) { - $sql .= natural_search('s.town', $search_town); -} -if ($search_state) { - $sql .= natural_search('d.nom', $search_state); -} -if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'"; +if ($search_town) $sql .= natural_search('s.town', $search_town); +if ($search_state) $sql .= natural_search('d.nom', $search_state); +if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'"; if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status); // Insert levels filters -if ($search_levels) -{ - $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')'; -} +if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')'; // Insert sale filter -if ($search_sale > 0) +if ($search_sale > 0) $sql .= " AND sc.fk_user = ".$db->escape($search_sale); +if ($socname) { - $sql .= " AND sc.fk_user = ".$db->escape($search_sale); -} -if ($socname) { $sql .= natural_search('s.nom', $search_nom); $sortfield = "s.nom"; $sortorder = "ASC"; @@ -362,22 +351,17 @@ if ($resql) print ''; print ''; - // Added by Matelli + // Prospect levelt print ''; - // Generate in $options_from the list of each option sorted - $options_from = ''; + $options_from = ''; // Generate in $options_from the list of each option sorted foreach ($tab_level as $tab_level_sortorder => $tab_level_label) { $options_from .= ''; } - - // Reverse the list - array_reverse($tab_level, true); - - // Generate in $options_to the list of each option sorted in the reversed order - $options_to = ''; + array_reverse($tab_level, true); // Reverse the list + $options_to = ''; // Generate in $options_to the list of each option sorted in the reversed order foreach ($tab_level as $tab_level_sortorder => $tab_level_label) { $options_to .= '