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 .= '
';
+ // Prospect status
print '
';
- print ' ';
+ // TODO Add here a list of prospect status
+ //print $form->selectarray($htmlname, $array, $search_stcomm);
+ //print ' ';
print '
';
print '
';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 39634e6af31..6eab9d8b545 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -4304,36 +4304,40 @@ class Form
/**
* Return a HTML select string, built from an array of key+value.
- * Note: Do not use returned string into a langs->trans function, content may be entity encoded twice.
+ * Note: Do not apply langs->trans function on returned content, content may be entity encoded twice.
*
- * @param string $htmlname Name of html select area
- * @param array $array Array with key+value
- * @param string $id Preselected key
- * @param int $show_empty 0 no empty value allowed, 1 to add an empty value into list (value is '' or ' ').
- * @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value"
- * @param int $value_as_key 1 to use value as key
- * @param string $moreparam Add more parameters onto the select tag
- * @param int $translate Translate and encode value
- * @param int $maxlen Length maximum for labels
- * @param int $disabled Html select box is disabled
- * @param int $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' = Do not sort
- * @param string $morecss Add more class to css styles
- * @param int $addjscombo Add js combo
- * @return string HTML select string.
+ * @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect
+ * @param array $array Array with key+value
+ * @param string|string[] $id Preselected key or preselected keys for multiselect
+ * @param int $show_empty 0 no empty value allowed, 1 to add an empty value into list (value is '' or ' ').
+ * @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value"
+ * @param int $value_as_key 1 to use value as key
+ * @param string $moreparam Add more parameters onto the select tag
+ * @param int $translate Translate and encode value
+ * @param int $maxlen Length maximum for labels
+ * @param int $disabled Html select box is disabled
+ * @param int $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' = Do not sort
+ * @param string $morecss Add more class to css styles
+ * @param int $addjscombo Add js combo
+ * @return string HTML select string.
* @see multiselectarray
*/
static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0)
{
global $conf, $langs;
+ // Do we want a multiselect ?
+ $multiselect = 0;
+ if (preg_match('/^multi/',$htmlname)) $multiselect = 1;
+
if ($value_as_key) $array=array_combine($array, $array);
$out='';
// Add code for jquery to use multiselect
- if ($addjscombo && empty($conf->dol_use_jmobile) && (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')))
+ if ($addjscombo && empty($conf->dol_use_jmobile) && $multiselect)
{
- $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT;
+ $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT')?constant('REQUIRE_JQUERY_MULTISELECT'):'select2':$conf->global->MAIN_USE_JQUERY_MULTISELECT;
$out.='