diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7d74276ce90..99dd80a8b2d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3890,9 +3890,10 @@ class Form * @param string $selected Preselected Unit ID * @param string $htmlname Select name * @param int $showempty Add a nempty line + * @param string $unit_type Restrict to one given unit type * @return string HTML select */ - public function selectUnits($selected = '', $htmlname = 'units', $showempty = 0, $unit_type = false) + public function selectUnits($selected = '', $htmlname = 'units', $showempty = 0, $unit_type = '') { global $langs; @@ -3902,8 +3903,8 @@ class Form $sql = 'SELECT rowid, label, code from '.MAIN_DB_PREFIX.'c_units'; $sql .= ' WHERE active > 0'; - if (!empty($unit_type)){ - $sql .= ' AND unit_type = "'.$this->db->escape($unit_type).'" '; + if (!empty($unit_type)) { + $sql .= " AND unit_type = '".$this->db->escape($unit_type)."'"; } $resql = $this->db->query($sql);