Merge pull request #3110 from hregis/develop_strict
Fix: Use hooks (Multicompany)
This commit is contained in:
commit
0cbf92c716
@ -647,25 +647,6 @@ if (! defined('NOLOGIN'))
|
|||||||
$db->commit();
|
$db->commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create entity cookie, just used for login page
|
|
||||||
// TODO Multicompany Move this into hook
|
|
||||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_COOKIE_ENABLED) && isset($_POST["entity"]))
|
|
||||||
{
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/cookie.class.php';
|
|
||||||
|
|
||||||
$entity = $_SESSION["dol_login"].'|'.$_POST["entity"];
|
|
||||||
|
|
||||||
$prefix=dol_getprefix();
|
|
||||||
$entityCookieName = 'DOLENTITYID_'.$prefix;
|
|
||||||
// TTL : is defined in the config page multicompany
|
|
||||||
$ttl = (! empty($conf->global->MULTICOMPANY_COOKIE_TTL) ? dol_now()+$conf->global->MULTICOMPANY_COOKIE_TTL : dol_now()+60*60*8 );
|
|
||||||
// Cryptkey : will be created randomly in the config page multicompany
|
|
||||||
$cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
|
|
||||||
|
|
||||||
$entityCookie = new DolCookie($cryptkey);
|
|
||||||
$entityCookie->_setCookie($entityCookieName, $entity, $ttl);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hooks on successfull login
|
// Hooks on successfull login
|
||||||
$action='';
|
$action='';
|
||||||
$hookmanager->initHooks(array('login'));
|
$hookmanager->initHooks(array('login'));
|
||||||
@ -831,18 +812,6 @@ else
|
|||||||
|
|
||||||
$heightforframes=52;
|
$heightforframes=52;
|
||||||
|
|
||||||
// Switch to another entity
|
|
||||||
// TODO Multicompany Remove this
|
|
||||||
if (! empty($conf->multicompany->enabled) && GETPOST('action') == 'switchentity')
|
|
||||||
{
|
|
||||||
if ($mc->switchEntity(GETPOST('entity','int')) > 0)
|
|
||||||
{
|
|
||||||
header("Location: ".DOL_URL_ROOT.'/');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Init menu manager
|
// Init menu manager
|
||||||
if (! defined('NOREQUIREMENU'))
|
if (! defined('NOREQUIREMENU'))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user