diff --git a/htdocs/admin/societe.php b/htdocs/admin/societe.php index bde1f3f3e00..8d71c84d2ab 100644 --- a/htdocs/admin/societe.php +++ b/htdocs/admin/societe.php @@ -464,7 +464,12 @@ if (! $conf->use_javascript_ajax) else { print ''; - print $html->selectyesno("activate_COMPANY_USE_SEARCH_TO_SELECT",$conf->global->COMPANY_USE_SEARCH_TO_SELECT,1); + $arrval=array('0'=>$langs->trans("No"), + '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')', + '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')', + '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')', + ); + print $html->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT",$arrval,$conf->global->COMPANY_USE_SEARCH_TO_SELECT); print ''; print ''; print ""; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1be108c2b44..029ace0b3b6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2284,7 +2284,7 @@ class Form { print $this->selectcurrency($selected,$htmlname); } - + /** * \brief Retourne la liste des devises, dans la langue de l'utilisateur * \param selected code devise pre-selectionne @@ -2295,7 +2295,7 @@ class Form { global $conf,$langs,$user; $langs->load("dict"); - + $out=''; if ($selected=='euro' || $selected=='euros') $selected='EUR'; // Pour compatibilite @@ -2862,18 +2862,18 @@ class Form /** - * \brief Show a select form from an array - * \param htmlname Nom de la zone select - * \param array Tableau de key+valeur - * \param id Preselected key - * \param show_empty 1 si il faut ajouter une valeur vide dans la liste, 0 sinon - * \param key_in_label 1 pour afficher la key dans la valeur "[key] value" - * \param value_as_key 1 to use value as key - * \param option Valeur de l'option en fonction du type choisi - * \param translate Traduire la valeur - * \param maxlen Length maximum for labels - * \param disabled Html select box is disabled - * \return string HTML select string + * Show a select form from an array + * @param htmlname Name of html select area + * @param array Array with key+value + * @param id Preselected key + * @param show_empty 1 si il faut ajouter une valeur vide dans la liste, 0 sinon + * @param key_in_label 1 pour afficher la key dans la valeur "[key] value" + * @param value_as_key 1 to use value as key + * @param option Valeur de l'option en fonction du type choisi + * @param translate Traduire la valeur + * @param maxlen Length maximum for labels + * @param disabled Html select box is disabled + * @return string HTML select string */ function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $option='', $translate=0, $maxlen=0, $disabled=0) { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 2815e3f7fb3..3360eb5ff30 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -45,7 +45,8 @@ ErrorDecimalLargerThanAreForbidden=Error, a precision higher than %s is n DictionnarySetup=Dictionary setup DisableJavascript=Disable JavaScript and Ajax functions ConfirmAjax=Use Ajax confirmation popups -UseSearchToSelectCompany=Use a search form to choose a company (instead of using a list box).
Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant SOCIETE_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. +UseSearchToSelectCompany=Use autocompletion fields to choose third parties (instead of using a list box).

Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant SOCIETE_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. +NumberOfKeyToSearch=Nbr of characters to trigger search: %s ViewFullDateActions=Show full dates actions in the third sheet NotAvailableWhenAjaxDisabled=Not available when Ajax disabled JavascriptDisabled=JavaScript disabled diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index b2efa1ceb80..3c04a797e93 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -45,7 +45,8 @@ ErrorDecimalLargerThanAreForbidden= Erreur, les précisions supérieures à % DictionnarySetup= Dictionnaires DisableJavascript= Désactiver les fonctions Javascript et Ajax ConfirmAjax= Utiliser les popups de confirmation Ajax -UseSearchToSelectCompany= Utiliser un formulaire de recherche pour le choix d'un tiers (plutôt qu'une liste déroulante).
Notez que si vous avez un nombre important de produits ou services (> 100 000), vous pouvez améliorer les performances en définissant la constante SOCIETE_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine. +UseSearchToSelectCompany= Utiliser un champ avec autocomplétion pour choisir un tiers (plutôt qu'une liste déroulante).

Notez que si vous avez un nombre important de produits ou services (> 100 000), vous pouvez améliorer les performances en définissant la constante SOCIETE_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine. +NumberOfKeyToSearch=Nb caractères déclenchant la recherche: %s ViewFullDateActions= Visualiser les dates des actions en entier dans la fiche tiers NotAvailableWhenAjaxDisabled= Non disponible quand Ajax désactivé JavascriptDisabled= Javascript désactivé diff --git a/htdocs/lib/ajax.lib.php b/htdocs/lib/ajax.lib.php index 19e5aee51ee..760aba0c5e8 100644 --- a/htdocs/lib/ajax.lib.php +++ b/htdocs/lib/ajax.lib.php @@ -35,6 +35,9 @@ function ajax_autocompleter($selected='',$htmlname,$url,$option='') { global $conf; + if (empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) return "COMPANY_USE_SEARCH_TO_SELECT is empty. This should not happens"; + if (! is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) return "COMPANY_USE_SEARCH_TO_SELECT is not a numeric. This should not happens"; + $script=''; $script.= ''; @@ -63,7 +66,7 @@ function ajax_autocompleter($selected='',$htmlname,$url,$option='') }, "json"); }, dataType: "json", - minLength: 2, + minLength: '.$conf->global->COMPANY_USE_SEARCH_TO_SELECT.', select: function( event, ui ) { jQuery("#'.$htmlname.'").val(ui.item.id); } @@ -89,7 +92,7 @@ function ajax_autocompleter($selected='',$htmlname,$url,$option='') function ajax_multiautocompleter($htmlname,$fields,$url,$option='') { $script=''; - + $fields = php2js($fields); $script.= '