Update html.form.class.php

This commit is contained in:
Laurent Destailleur 2021-01-07 10:32:23 +01:00 committed by GitHub
parent 312f11d7b3
commit c2855d4d71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);