FIX multicompany compatibility

This commit is contained in:
Regis Houssin 2023-09-05 10:06:30 +02:00
parent 0ed6a63fb0
commit c437aecb1f

View File

@ -191,9 +191,9 @@ if (session_id() && !empty($_SESSION["dol_entity"])) {
} elseif (!empty($_ENV["dol_entity"])) {
// Entity inside a CLI script
$conf->entity = $_ENV["dol_entity"];
} elseif (GETPOSTISSET("loginfunction") && GETPOST("entity", 'int')) {
} elseif (GETPOSTISSET("loginfunction") && (GETPOST("entity", 'int') || GETPOST("switchentity", 'int'))) {
// Just after a login page
$conf->entity = GETPOST("entity", 'int');
$conf->entity = (GETPOSTISSET("entity") ? GETPOST("entity", 'int') : GETPOST("switchentity", 'int'));
} elseif (defined('DOLENTITY') && is_numeric(constant('DOLENTITY'))) {
// For public page with MultiCompany module
$conf->entity = constant('DOLENTITY');