Merge pull request #9861 from atm-john/FIX_unit_select_form

FIX translation in select unit form
This commit is contained in:
Laurent Destailleur 2018-10-24 12:25:55 +02:00 committed by GitHub
commit 9972521456
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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>';