diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 66fcf730b11..0c620cb8bd3 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -85,7 +85,7 @@ class CUnits extends CommonDict $this->libelle = trim($this->short_label); } if (isset($this->unit_type)) { - $this->active = trim($this->unit_type); + $this->unit_type = trim($this->unit_type); } if (isset($this->active)) { $this->active = trim($this->active); @@ -402,7 +402,7 @@ class CUnits extends CommonDict * @param string $code code of unit * @param string $mode 0= id , short_label=Use short label as value, code=use code * @param string $unit_type weight,size,surface,volume,qty,time... - * @return int Return integer <0 if KO, Id of code if OK + * @return int|string Return integer <0 if KO, Id of code if OK (or $code if $mode is different from '', 'short_label' or 'code') */ public function getUnitFromCode($code, $mode = 'code', $unit_type = '') {