Fix set PROFID1

This commit is contained in:
Laurent Destailleur 2023-12-17 22:51:13 +01:00
parent 64b9414271
commit 1661534d5a

View File

@ -66,8 +66,13 @@ if ($reshook < 0) {
if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|| ($action == 'updateedit')) {
$tmparray = getCountry(GETPOST('country_id', 'int'), 'all', $db, $langs, 0);
$tmparray = getCountry(GETPOSTINT('country_id'), 'all', $db, $langs, 0);
if (!empty($tmparray['id'])) {
if ($tmparray['code'] == 'FR' && $tmparray['id'] != $mysoc->country_id) {
// For FR, default value of option to show profid SIREN is on by default
$res = dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", 1, 'chaine', 0, '', $conf->entity);
}
$mysoc->country_id = $tmparray['id'];
$mysoc->country_code = $tmparray['code'];
$mysoc->country_label = $tmparray['label'];
@ -75,11 +80,6 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
$s = $mysoc->country_id.':'.$mysoc->country_code.':'.$mysoc->country_label;
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s, 'chaine', 0, '', $conf->entity);
if($mysoc->country_code == 'FR' && !isset($conf->global->MAIN_PROFID1_IN_ADDRESS)){
// For FR, default value of option to show profid SIREN is on by default
$res = dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", 1, 'chaine', 0, '', $conf->entity);
}
activateModulesRequiredByCountry($mysoc->country_code);
}