From d801bcc690f8e7db97e41f27e60aeff8af5df44f Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Fri, 8 Aug 2014 14:37:51 +0200
Subject: [PATCH] Fix: When jmobile is forced, we force enable of javascript.

---
 htdocs/core/tpl/login.tpl.php             | 5 ++++-
 htdocs/core/tpl/passwordforgotten.tpl.php | 3 +++
 htdocs/main.inc.php                       | 3 ++-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php
index bb67e863667..82748a69b05 100644
--- a/htdocs/core/tpl/login.tpl.php
+++ b/htdocs/core/tpl/login.tpl.php
@@ -25,6 +25,9 @@ if (GETPOST('dol_optimize_smallscreen')) $conf->dol_optimize_smallscreen=1;
 if (GETPOST('dol_no_mouse_hover')) $conf->dol_no_mouse_hover=1;
 if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile=1;
 
+// If we force to use jmobile, then we reenable javascript
+if (! empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax=1;
+
 $arrayofjs=array('/core/js/dst.js'.(empty($conf->dol_use_jmobile)?'':'?version='.urlencode(DOL_VERSION)));					// Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second
 $titleofloginpage=$langs->trans('Login').' '.$title;	// title is defined by dol_loginfunction in security2.lib.php
 print top_htmlhead('',$titleofloginpage,0,0,$arrayofjs);
@@ -209,7 +212,7 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file
 
 <!-- authentication mode = <?php echo $main_authentication ?> -->
 <!-- cookie name used for this session = <?php echo $session_name ?> -->
-<!-- urlfrom in this session = <?php echo $_SESSION["urlfrom"] ?> -->
+<!-- urlfrom in this session = <?php echo isset($_SESSION["urlfrom"])?$_SESSION["urlfrom"]:''; ?> -->
 
 <!-- Common footer is not used for login page, this is same than footer but inside login tpl -->
 
diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php
index 5e002653922..7331a81ead0 100644
--- a/htdocs/core/tpl/passwordforgotten.tpl.php
+++ b/htdocs/core/tpl/passwordforgotten.tpl.php
@@ -25,6 +25,9 @@ if (GETPOST('dol_optimize_smallscreen')) $conf->dol_optimize_smallscreen=1;
 if (GETPOST('dol_no_mouse_hover')) $conf->dol_no_mouse_hover=1;
 if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile=1;
 
+// If we force to use jmobile, then we reenable javascript
+if (! empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax=1;
+
 print top_htmlhead('',$langs->trans('Login').' '.$title);
 ?>
 <!-- BEGIN PHP TEMPLATE PASSWORDFORGOTTEN.TPL.PHP -->
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index bdaaffdafe3..30837b590f8 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -722,7 +722,8 @@ if (! empty($conf->browser->phone))
 	$conf->dol_optimize_smallscreen=1;
 	$conf->dol_no_mouse_hover=1;
 }
-
+// If we force to use jmobile, then we reenable javascript
+if (! empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax=1;
 // Disabled bugged themes
 if (! empty($conf->dol_use_jmobile) && in_array($conf->theme,array('bureau2crea','cameleo')))
 {
-- 
GitLab