FIX translation in select unit form

This commit is contained in:
John BOTELLA 2018-10-24 10:23:27 +02:00
parent f0dc2df526
commit fccea99e23

View File

@ -3388,13 +3388,19 @@ class Form
while($res = $this->db->fetch_object($resql))
{
$unitLabel = $res->label;
if (! empty($langs->tab_translate['unit'.$res->code])) // check if Translation is available before
{
$unitLabel = $langs->trans('unit'.$res->code)!=$res->label?$langs->trans('unit'.$res->code):$res->label;
}
if ($selected == $res->rowid)
{
$return.='<option value="'.$res->rowid.'" selected>'.($langs->trans('unit'.$res->code)!=$res->label?$langs->trans('unit'.$res->code):$res->label).'</option>';
$return.='<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>';
}
else
{
$return.='<option value="'.$res->rowid.'">'.($langs->trans('unit'.$res->code)!=$res->label?$langs->trans('unit'.$res->code):$res->label).'</option>';
$return.='<option value="'.$res->rowid.'">'.$unitLabel.'</option>';
}
}
$return.='</select>';