Fix default language of reminders
This commit is contained in:
parent
513fc8f410
commit
429da47d68
@ -2756,9 +2756,13 @@ class Adherent extends CommonObject
|
||||
{
|
||||
$adherent->fetch_thirdparty();
|
||||
|
||||
// Language code to use ($languagecodeformember) is default language of thirdparty, if no thirdparty, the language found from country of member then country of thirdparty, and if still not found we use the language of company.
|
||||
$languagefromcountrycode = getLanguageCodeFromCountryCode($adherent->country_code ? $adherent->country_code : $adherent->thirdparty->country_code);
|
||||
$languagecodeformember = (empty($adherent->thirdparty->default_lang) ? ($languagefromcountrycode ? $languagefromcountrycode : $mysoc->default_lang) : $adherent->thirdparty->default_lang);
|
||||
|
||||
// Send reminder email
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang(empty($adherent->thirdparty->default_lang) ? $mysoc->default_lang : $adherent->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang($languagecodeformember);
|
||||
$outputlangs->loadLangs(array("main", "members"));
|
||||
dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang);
|
||||
|
||||
|
||||
@ -6829,7 +6829,8 @@ function picto_from_langcode($codelang, $moreatt = '')
|
||||
}
|
||||
|
||||
/**
|
||||
* Return default language from country code
|
||||
* Return default language from country code.
|
||||
* Return null if not found.
|
||||
*
|
||||
* @param string $countrycode Country code like 'US', 'FR', 'CA', ...
|
||||
* @return string Value of locale like 'en_US', 'fr_FR', ...
|
||||
@ -6838,6 +6839,8 @@ function getLanguageCodeFromCountryCode($countrycode)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
if (empty($countrycode)) return null;
|
||||
|
||||
if (strtoupper($countrycode) == 'MQ') return 'fr_CA';
|
||||
if (strtoupper($countrycode) == 'SE') return 'sv_SE'; // se_SE is Sami/Sweden, and we want in priority sv_SE for SE country
|
||||
if (strtoupper($countrycode) == 'CH')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user