Fixed the product unit translation
This commit is contained in:
parent
947609fc12
commit
65011c2877
@ -2099,7 +2099,7 @@ else
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans('DefaultUnitToShow').'</td><td>';
|
print '<tr><td>'.$langs->trans('DefaultUnitToShow').'</td><td>';
|
||||||
if ($unit !== '') {
|
if ($unit !== '') {
|
||||||
print $langs->trans($unit);
|
print $unit;
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5387,11 +5387,11 @@ class Product extends CommonObject
|
|||||||
$label_type = 'short_label';
|
$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);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql && $this->db->num_rows($resql) > 0) {
|
if ($resql && $this->db->num_rows($resql) > 0) {
|
||||||
$res = $this->db->fetch_array($resql);
|
$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);
|
$this->db->free($resql);
|
||||||
return $label;
|
return $label;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user