QUAL add $mysoc->currency and call default lang before setMysoc()

This commit is contained in:
Regis Houssin 2025-02-01 17:40:51 +01:00
parent 81dda600fc
commit a16bc363c7
2 changed files with 12 additions and 10 deletions

View file

@ -214,6 +214,15 @@ if (!is_numeric($conf->entity)) {
//print "We work with data into entity instance number '".$conf->entity."'";
$conf->setValues($db);
// Set default language (must be after the setValues setting global conf 'MAIN_LANG_DEFAULT'. Page main.inc.php will overwrite langs->defaultlang with user value later)
if (!defined('NOREQUIRETRAN')) {
$langcode = (GETPOST('lang', 'aZ09') ? GETPOST('lang', 'aZ09', 1) : getDolGlobalString('MAIN_LANG_DEFAULT', 'auto'));
if (defined('MAIN_LANG_DEFAULT')) { // So a page can force the language whatever is setup and parameters in URL
$langcode = constant('MAIN_LANG_DEFAULT');
}
$langs->setDefaultLang($langcode);
}
// Create object $mysoc (A thirdparty object that contains properties of companies managed by Dolibarr.
if (!defined('NOREQUIREDB') && !defined('NOREQUIRESOC')) {
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
@ -260,13 +269,3 @@ if (!defined('NOREQUIREDB') && !defined('NOREQUIRESOC')) {
$conf->global->MAIN_NO_INPUT_PRICE_WITH_TAX = 1;
}
}
// Set default language (must be after the setValues setting global conf 'MAIN_LANG_DEFAULT'. Page main.inc.php will overwrite langs->defaultlang with user value later)
if (!defined('NOREQUIRETRAN')) {
$langcode = (GETPOST('lang', 'aZ09') ? GETPOST('lang', 'aZ09', 1) : getDolGlobalString('MAIN_LANG_DEFAULT', 'auto'));
if (defined('MAIN_LANG_DEFAULT')) { // So a page can force the language whatever is setup and parameters in URL
$langcode = constant('MAIN_LANG_DEFAULT');
}
$langs->setDefaultLang($langcode);
}

View file

@ -4543,6 +4543,9 @@ class Societe extends CommonObject
$this->town = getDolGlobalString('MAIN_INFO_SOCIETE_TOWN');
$this->region_code = getDolGlobalString('MAIN_INFO_SOCIETE_REGION');
$this->currency_code = getDolGlobalString('MAIN_MONNAIE');
$this->currency = currency_name($this->currency_code);
$this->socialobject = getDolGlobalString('MAIN_INFO_SOCIETE_OBJECT');
$this->note_private = getDolGlobalString('MAIN_INFO_SOCIETE_NOTE');