Skip to content
Snippets Groups Projects
Commit ce1cad28 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge pull request #2207 from frederic34/patch-3

Enhance select_categories with select2
parents 6ca90ffd 56dd2765
No related branches found
No related tags found
No related merge requests found
......@@ -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 ='<select class="flat" id="select_categ_'.$htmlname.'" name="'.$htmlname.'">';
$moreforfilter.='<select class="flat" id="select_categ_'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';
$moreforfilter.='<option value="">&nbsp;</option>'; // Should use -1 to say nothing
if (is_array($tab_categs))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment