NEW Hidden option MAIN_LANDING_PAGE to choose the first page to show

after login works as a "global" option (llx_const) and as a "per user"
option (llx_user_param).
This commit is contained in:
Laurent Destailleur 2016-01-24 17:40:07 +01:00
parent c1ebdd3b4f
commit 7c96194750
2 changed files with 8 additions and 6 deletions

View File

@ -354,7 +354,7 @@ if (! defined('NOLOGIN'))
exit;
}
// If requested by the login has already occurred, it is retrieved from the session
// If login request was already post, we retrieve login from the session
// Call module if not realized that his request.
// At the end of this phase, the variable $login is defined.
$resultFetchUser='';
@ -516,7 +516,7 @@ if (! defined('NOLOGIN'))
exit;
}
$resultFetchUser=$user->fetch('', $login, '', 0, ($entitytotest ? $entitytotest : -1));
$resultFetchUser=$user->fetch('', $login, '', 1, ($entitytotest ? $entitytotest : -1));
if ($resultFetchUser <= 0)
{
dol_syslog('User not found, connexion refused');
@ -692,10 +692,12 @@ if (! defined('NOLOGIN'))
{
$db->commit();
}
if (! empty($conf->global->MAIN_LANDING_PAGE)) // Example: /index.php
// Change landing page if defined.
$landingpage=(empty($user->conf->MAIN_LANDING_PAGE)?(empty($conf->global->MAIN_LANDING_PAGE)?'':$conf->global->MAIN_LANDING_PAGE):$user->conf->MAIN_LANDING_PAGE);
if (! empty($landingpage)) // Example: /index.php
{
$newpath=dol_buildpath($conf->global->MAIN_LANDING_PAGE, 1);
$newpath=dol_buildpath($landingpage, 1);
if ($_SERVER["PHP_SELF"] != $newpath) // not already on landing page (avoid infinite loop)
{
header('Location: '.$newpath);

View File

@ -156,7 +156,7 @@ class User extends CommonObject
* @param int $id Si defini, id a utiliser pour recherche
* @param string $login Si defini, login a utiliser pour recherche
* @param string $sid Si defini, sid a utiliser pour recherche
* @param int $loadpersonalconf Also load personal conf of user (in $user->conf->xxx)
* @param int $loadpersonalconf 1=also load personal conf of user (in $user->conf->xxx)
* @param int $entity If a value is >= 0, we force the search on a specific entity. If -1, means search depens on default setup.
* @return int <0 if KO, 0 not found, >0 if OK
*/