Works on multi-company module

This commit is contained in:
Regis Houssin 2010-09-26 09:53:42 +00:00
parent 123dba2593
commit 584371edc0

View File

@ -84,6 +84,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
if ( preg_match('/^([^.]+)\/htdocs\//i', realpath($_SERVER["SCRIPT_FILENAME"]), $regs)) $realpath = isset($regs[1])?$regs[1]:''; if ( preg_match('/^([^.]+)\/htdocs\//i', realpath($_SERVER["SCRIPT_FILENAME"]), $regs)) $realpath = isset($regs[1])?$regs[1]:'';
// Set cookie for timeout management // Set cookie for timeout management
// FIXME le cookie n'est pas créé la première fois
$sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].$realpath); $sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].$realpath);
if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", '', 0); if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", '', 0);
@ -116,7 +117,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE)) if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE))
{ {
$entityCookieName = 'DOLENTITYID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]); $entityCookieName = 'DOLENTITYID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].$realpath);
if (isset($_COOKIE[$entityCookieName])) if (isset($_COOKIE[$entityCookieName]))
{ {
include_once(DOL_DOCUMENT_ROOT . "/core/class/cookie.class.php"); include_once(DOL_DOCUMENT_ROOT . "/core/class/cookie.class.php");
@ -153,19 +154,18 @@ function dol_loginfunction($langs,$conf,$mysoc)
$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
} }
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $rowspan++;
// Entity field // Entity field
$select_entity=''; $select_entity='';
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY))
{ {
$res=@include_once(DOL_DOCUMENT_ROOT.'/multicompany/class/multicompany.class.php'); $rowspan++;
$res=@include_once(DOL_DOCUMENT_ROOT.'/multicompany/class/actions_multicompany.class.php');
if ($res) if ($res)
{ {
$mc = new Multicompany($db); $mc = new ActionsMulticompany($db);
$mc->getEntities(0,1);
$select_entity=$mc->select_entities($mc->entities,$lastentity,'tabindex="3"'); $select_entity=$mc->select_entities($lastentity,'tabindex="3"');
} }
} }