From abe13d108b40975b5fd28ee2a75b7915ca4fbbdc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Nov 2017 09:23:18 +0100 Subject: [PATCH] Clean code used for autocompletion --- htdocs/barcode/printsheet.php | 4 +- htdocs/core/class/html.form.class.php | 44 +++++++------------- htdocs/core/class/html.formbarcode.class.php | 1 + 3 files changed, 17 insertions(+), 32 deletions(-) diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index e8deb15a8d2..27674fe7ad0 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -292,9 +292,9 @@ foreach(array_keys($_Avery_Labels) as $codecards) $labeltoshow=$_Avery_Labels[$codecards]['name']; //$labeltoshow.=' ('.$_Avery_Labels[$row['code']]['paper-size'].')'; $arrayoflabels[$codecards]=$labeltoshow; - $arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name']; } -print $form->selectarray('modellabel',$arrayoflabels,(GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE),1,0,0); +asort($arrayoflabels); +print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1); print ''; // Number of stickers to print diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6ec92a69d11..afcc2e047f6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1096,11 +1096,10 @@ class Form $resql=$this->db->query($sql); if ($resql) { - if ($conf->use_javascript_ajax && ! $forcecombo) + if (! $forcecombo) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $comboenhancement =ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); - $out.= $comboenhancement; + $out .= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); } // Construct $out and $outarray @@ -1333,8 +1332,7 @@ class Form if ($conf->use_javascript_ajax && ! $forcecombo && ! $options_only) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $comboenhancement = ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT); - $out.= $comboenhancement; + $out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT); } if ($htmlname != 'none' || $options_only) $out.= ''; @@ -2023,11 +2017,10 @@ class Form $events=null; - if ($conf->use_javascript_ajax && ! $forcecombo) + if (! $forcecombo) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $comboenhancement =ajax_combobox($htmlname, $events, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT); - $out.= $comboenhancement; + $out .= ajax_combobox($htmlname, $events, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT); } $out.='use_javascript_ajax) - { - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $comboenhancement = ajax_combobox($htmlname); - $out.= $comboenhancement; - } + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $out .= ajax_combobox($htmlname); $out.= '"; + print ajax_combobox("select_".$htmlname); } else { dol_print_error($this->db);