diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index f31cb0f741e..71673aca078 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -823,11 +823,13 @@ class Form
* @param string $showfunction Add function into label
* @param string $moreclass Add more class to class style
* @param string $showsoc Add company into label
+ * @param int $forcecombo Force to use combo box
+ * @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @return int <0 if KO, Nb of contact in list if OK
*/
- function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $showsoc=0)
+ function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $showsoc=0, $forcecombo=0, $event=array())
{
- print $this->selectcontacts($socid,$selected,$htmlname,$showempty,$exclude,$limitto,$showfunction, $moreclass, $showsoc);
+ print $this->selectcontacts($socid,$selected,$htmlname,$showempty,$exclude,$limitto,$showfunction, $moreclass, $showsoc, $forcecombo, $event);
return $this->num;
}
@@ -844,9 +846,11 @@ class Form
* @param string $moreclass Add more class to class style
* @param bool $options_only Return options only (for ajax treatment)
* @param string $showsoc Add company into label
+ * @param int $forcecombo Force to use combo box
+ * @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @return int <0 if KO, Nb of contact in list if OK
*/
- function selectcontacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $options_only=false, $showsoc=0)
+ function selectcontacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $options_only=false, $showsoc=0, $forcecombo=0, $event=array())
{
global $conf,$langs;
@@ -872,6 +876,11 @@ class Form
if ($resql)
{
$num=$this->db->num_rows($resql);
+
+ if ($conf->use_javascript_ajax && $conf->global->CONTACT_USE_SEARCH_TO_SELECT && ! $forcecombo)
+ {
+ $out.= ajax_combobox($htmlname, $event);
+ }
if ($htmlname != 'none' || $options_only) $out.= '