24require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
44 public function getFilterBox($type, array $preSelected, $morecss =
"minwidth300imp widthcentpercentminusx", $searchCategoryProductOperator = -1, $multiselect = 1, $nocateg = 1, $showempty =
'')
48 if (empty($preSelected) || !is_array($preSelected)) {
49 $preSelected = array();
52 if ($showempty && !is_numeric($showempty)) {
53 $tmptitle = $showempty;
55 $tmptitle = $langs->transnoentitiesnoconv(
"Category");
59 $filter .=
'<div class="divsearchfield">';
60 $filter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
64 $categoryArray[-2] =
"- ".$langs->trans(
'NotCategorized').
" -";
66 $htmlName =
"search_category_".$type.
"_list";
67 $htmlName2 =
"search_category_".$type.
"_operator";
69 $filter .=
Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, $morecss, 0, 0,
'',
'', $tmptitle);
71 $htmlName =
"search_".$type.
"_category";
73 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
76 $filter .= $formother->select_categories($type, $preSelected[0], $htmlName, $nocateg, $tmptitle, $morecss);
78 if ($searchCategoryProductOperator >= 0) {
79 $filter .=
' <input type="checkbox" class="valignmiddle" id="'.$htmlName2.
'" name="'.$htmlName2.
'" value="1"'.($searchCategoryProductOperator == 1 ?
' checked="checked"' :
'').
'/><label class="none valignmiddle" for="'.$htmlName2.
'">'.$langs->trans(
'UseOrOperatorForCategories').
'</label>';
97 $sql =
"SELECT cp.fk_categorie as cat_index, cat.label";
98 $sql .=
" FROM ".MAIN_DB_PREFIX.
"categorie_product as cp";
99 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"categorie as cat ON cat.rowid = cp.fk_categorie";
100 $sql .=
" GROUP BY cp.fk_categorie, cat.label";
102 dol_syslog(get_class($this).
"::selectProductCategory", LOG_DEBUG);
103 $resql = $this->db->query($sql);
105 print
'<select class="flat" id="select_'.$htmlname.
'" name="'.$htmlname.
'">';
107 print
'<option value="0"> </option>';
111 $num_rows = $this->db->num_rows($resql);
112 while ($i < $num_rows) {
113 $category = $this->db->fetch_object($resql);
114 if ($selected && $selected == $category->cat_index) {
115 print
'<option value="'.$category->cat_index.
'" selected>'.$category->label.
'</option>';
117 print
'<option value="'.$category->cat_index.
'">'.$category->label.
'</option>';
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.