From 7e6e9604cc1edd61fb3eae0d91c0861ce73ba776 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Mon, 15 Feb 2010 21:22:04 +0000
Subject: [PATCH] Fix: Autodetect if upgrade is required was not working just
 after a first installation.

---
 htdocs/main.inc.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 69dd0062a32..44fe1ef1f29 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -181,7 +181,8 @@ if (! empty($conf->global->MAIN_NOT_INSTALLED) || ! empty($conf->global->MAIN_NO
 	exit;
 }
 // If an upgrade process is required, we call the install page.
-if (! empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && ($conf->global->MAIN_VERSION_LAST_UPGRADE != DOL_VERSION))
+if ((! empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && ($conf->global->MAIN_VERSION_LAST_UPGRADE != DOL_VERSION))
+|| (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && ! empty($conf->global->MAIN_VERSION_LAST_INSTALL) && ($conf->global->MAIN_VERSION_LAST_INSTALL != DOL_VERSION)))
 {
 	require_once(DOL_DOCUMENT_ROOT ."/lib/admin.lib.php");
 	$dolibarrversionlastupgrade=preg_split('/[.-]/',$conf->global->MAIN_VERSION_LAST_UPGRADE);
-- 
GitLab