From 7d6d4adcdba1a8dab42b8c58a453d0e79a15b271 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Jul 2017 18:16:41 +0200 Subject: [PATCH] Fix combo for multicompany not visible where there is other hooks by other modules --- htdocs/core/lib/security2.lib.php | 3 ++- htdocs/core/tpl/login.tpl.php | 12 +++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 248c3bde43e..817fd2be8da 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -166,7 +166,7 @@ function dol_loginfunction($langs,$conf,$mysoc) } $conf_css = $themepath."?lang=".$langs->defaultlang; - // Select templates + // Select templates dir if (! empty($conf->modules_parts['tpl'])) // Using this feature slow down application { $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl/')); @@ -205,6 +205,7 @@ function dol_loginfunction($langs,$conf,$mysoc) // Should be an array with differents options in $hookmanager->resArray $parameters=array('entity' => GETPOST('entity','int')); $reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks. resArray is filled by hook. + $morelogincontent = $hookmanager->resArray['options']; // TODO Use here a resprints // Login $login = (! empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username","alpha") ? GETPOST("username","alpha") : $demologin)); diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index c518649a337..a1fdc3e9e9d 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -17,9 +17,7 @@ */ // Need global variable $title to be defined by caller (like dol_loginfunction) -// Caller can also set $theResArray = array(['options']=>array('js'=>..., 'table'=>...); - - +// Caller can also set $morelogincontent = array(['options']=>array('js'=>..., 'table'=>...); header('Cache-Control: Public, must-revalidate'); header("Content-type: text/html; charset=".$conf->file->character_set_client); @@ -125,8 +123,8 @@ if ($disablenofollow) echo ''; resArray['options'])) { - foreach ($hookmanager->resArray['options'] as $format => $option) +if (! empty($morelogincontent) && is_array($morelogincontent)) { + foreach ($morelogincontent as $format => $option) { if ($format == 'table') { echo ''; @@ -280,8 +278,8 @@ if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) { global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER; ?> resArray['options'])) { - foreach ($hookmanager->resArray['options'] as $format => $option) +if (! empty($morelogincontent) && is_array($morelogincontent)) { + foreach ($morelogincontent as $format => $option) { if ($format == 'js') { echo "\n".'';