2
0
forked from Wavyzz/dolibarr

FIX default language defined for IN country

This commit is contained in:
Laurent Destailleur
2021-09-20 13:20:54 +02:00
parent be2a95ca51
commit 0eff2fa15b
2 changed files with 19 additions and 5 deletions

View File

@@ -73,6 +73,18 @@ class FormAdmin
$langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 12, 0, $mainlangonly);
// If the language to select is not inside the list of available language and empty value is not available, we must find
// an alternative as the language code to pre-select (to avoid to have first element in list pre-selected).
if ($selected && !in_array($selected, $langs_available) && empty($showempty)) {
$tmparray = explode('_', $selected);
if (!empty($tmparray[1])) {
$selected = getLanguageCodeFromCountryCode($tmparray[1]);
}
if (empty($selected)) {
$selected = $langs->defaultlang;
}
}
$out = '';
$out .= '<select '.($multiselect ? 'multiple="multiple" ' : '').'class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiselect ? '[]' : '').'"'.($disabled ? ' disabled' : '').'>';