Fixed the product unit translation

This commit is contained in:
Tim Otte 2020-05-11 15:11:23 +02:00
parent 947609fc12
commit 65011c2877
2 changed files with 3 additions and 3 deletions

View File

@ -2099,7 +2099,7 @@ else
print '<tr><td>'.$langs->trans('DefaultUnitToShow').'</td><td>';
if ($unit !== '') {
print $langs->trans($unit);
print $unit;
}
print '</td></tr>';
}

View File

@ -5387,11 +5387,11 @@ class Product extends CommonObject
$label_type = 'short_label';
}
$sql = 'select '.$label_type.' from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit;
$sql = 'select '.$label_type.', code from '.MAIN_DB_PREFIX.'c_units where rowid='.$this->fk_unit;
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql);
$label = $res[$label_type];
$label = $label_type == 'short' ? $res[$label_type] : $langs->trans('unit' . $res['code']);
$this->db->free($resql);
return $label;
}