From 682842f15fe3074e37ea967ecf5c89f6f79e6205 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Fri, 13 Nov 2015 10:37:51 +0100
Subject: [PATCH] Fix into title of login page, we must report the tru dolibarr
 version after the @ (technical information), event if application
 name/version was replaced with a constant.

---
 htdocs/core/lib/security2.lib.php | 4 +++-
 htdocs/core/tpl/login.tpl.php     | 2 +-
 htdocs/main.inc.php               | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php
index 0d94357a201..a32805b6169 100644
--- a/htdocs/core/lib/security2.lib.php
+++ b/htdocs/core/lib/security2.lib.php
@@ -148,8 +148,10 @@ function dol_loginfunction($langs,$conf,$mysoc)
 	if (! preg_match('/mainmenu=/',$php_self)) $php_self.=(preg_match('/\?/',$php_self)?'&':'?').'mainmenu=home';
 
 	// Title
-	$title='Dolibarr '.DOL_VERSION;
+	$appli=constant('DOL_APPLICATION_TITLE');
+	$title=$appli.' '.DOL_VERSION;
 	if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
+	$titletruedolibarrversion=DOL_VERSION;	// $title used by login template after the @ to inform of true Dolibarr version
 
 	// Note: $conf->css looks like '/theme/eldy/style.css.php'
 	$conf->css = "/theme/".(GETPOST('theme')?GETPOST('theme','alpha'):$conf->theme)."/style.css.php";
diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php
index c0af2a25b74..7bfb576b1c4 100644
--- a/htdocs/core/tpl/login.tpl.php
+++ b/htdocs/core/tpl/login.tpl.php
@@ -33,7 +33,7 @@ $arrayofjs=array(
 	'/includes/jstz/jstz.min.js'.(empty($conf->dol_use_jmobile)?'':'?version='.urlencode(DOL_VERSION)),
 	'/core/js/dst.js'.(empty($conf->dol_use_jmobile)?'':'?version='.urlencode(DOL_VERSION))
 );
-$titleofloginpage=$langs->trans('Login').' @ '.$title;	// title is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page.
+$titleofloginpage=$langs->trans('Login').' @ '.$titletruedolibarrversion;	// $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page and find true dolibarr version.
 
 print top_htmlhead('',$titleofloginpage,0,0,$arrayofjs);
 ?>
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index eb2aa212e7c..b629b265012 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1447,7 +1447,8 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
 	    	else $appli.=" ".DOL_VERSION;
 	    }
 	    else $appli.=" ".DOL_VERSION;
-		if (! empty($conf->global->MAIN_FEATURES_LEVEL)) $appli.="<br>".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL;
+
+	    if (! empty($conf->global->MAIN_FEATURES_LEVEL)) $appli.="<br>".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL;
 
 	    $logouttext='';
 	    $logouthtmltext=$appli.'<br>';
-- 
GitLab