From 56dd276504426124ec9b87e71470a4f8d04409ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 28 Dec 2014 15:17:54 +0100 Subject: [PATCH] Enhance search_categories with select2 --- htdocs/core/class/html.formother.class.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 29d1140d215..68a7b677667 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -311,15 +311,25 @@ class FormOther */ function select_categories($type,$selected=0,$htmlname='search_categ',$nocateg=0) { - global $langs; + global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load list of "categories" $static_categs = new Categorie($this->db); $tab_categs = $static_categs->get_full_arbo($type); + $moreforfilter = ''; + $nodatarole = ''; + // Enhance with select2 + if ($conf->use_javascript_ajax) + { + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $moreforfilter.= ajax_combobox('select_categ_'.$htmlname); + $nodatarole=' data-role="none"'; + } + // Print a select with each of them - $moreforfilter =''; $moreforfilter.=''; // Should use -1 to say nothing if (is_array($tab_categs))