Fix filter on category

This commit is contained in:
Laurent Destailleur 2015-08-20 04:07:07 +02:00
parent 26e3fcc636
commit 936f912216

View File

@ -303,13 +303,14 @@ class FormOther
* Return select list for categories (to use in form search selectors) * Return select list for categories (to use in form search selectors)
* *
* @param int $type Type of categories (0=product, 1=suppliers, 2=customers, 3=members) * @param int $type Type of categories (0=product, 1=suppliers, 2=customers, 3=members)
* @param integer $selected Preselected value * @param integer $selected Preselected value
* @param string $htmlname Name of combo list * @param string $htmlname Name of combo list
* @param int $nocateg Show also an entry "Not categorized" * @param int $nocateg Show also an entry "Not categorized"
* @param int $showempty Add also an empty line
* @return string Html combo list code * @return string Html combo list code
* @see select_all_categories * @see select_all_categories
*/ */
function select_categories($type,$selected=0,$htmlname='search_categ',$nocateg=0) function select_categories($type,$selected=0,$htmlname='search_categ',$nocateg=0,$showempty=1)
{ {
global $conf, $langs; global $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@ -331,7 +332,7 @@ class FormOther
// Print a select with each of them // Print a select with each of them
$moreforfilter.='<select class="flat minwidth100" id="select_categ_'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>'; $moreforfilter.='<select class="flat minwidth100" id="select_categ_'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';
$moreforfilter.='<option value="">&nbsp;</option>'; // Should use -1 to say nothing if ($showempty) $moreforfilter.='<option value="0">&nbsp;</option>'; // Should use -1 to say nothing
if (is_array($tab_categs)) if (is_array($tab_categs))
{ {