From bc1c2bbae5ab0c91277c7cfab2f67a9978008386 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Wed, 8 Jun 2011 11:23:55 +0000
Subject: [PATCH] Enhance installer

---
 build/exe/doliwamp/install.forced.php.install |  9 +++++++--
 htdocs/install/etape0.php                     |  3 ++-
 htdocs/install/etape1.php                     |  4 +++-
 htdocs/install/etape2.php                     |  4 +++-
 htdocs/install/etape4.php                     |  4 +++-
 htdocs/install/etape5.php                     | 18 +++++++++++-------
 htdocs/langs/en_US/install.lang               |  2 +-
 htdocs/langs/fr_FR/install.lang               |  2 +-
 8 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/build/exe/doliwamp/install.forced.php.install b/build/exe/doliwamp/install.forced.php.install
index 89a2625e050..b8a29864703 100644
--- a/build/exe/doliwamp/install.forced.php.install
+++ b/build/exe/doliwamp/install.forced.php.install
@@ -1,6 +1,11 @@
 <?php
-// This file must be presen into htdocs/install directory
-// to force values of install wizard.
+// File to force Dolibarr wizard installer choices.
+//
+// This file must be present into htdocs/install directory
+// during install process to be used.
+//
+// $Id$
+//
 $force_install_noedit=1;
 $force_install_message='KeepDefaultValuesWamp';
 $force_install_main_data_root='WAMPROOT/dolibarr_documents';
diff --git a/htdocs/install/etape0.php b/htdocs/install/etape0.php
index b354b1486a2..9988ca42ab2 100644
--- a/htdocs/install/etape0.php
+++ b/htdocs/install/etape0.php
@@ -51,7 +51,7 @@ $main_dir=isset($_POST["main_dir"])?trim($_POST["main_dir"]):'';
 // Init "forced values" to nothing. "forced values" are used after an doliwamp install wizard.
 if (file_exists("./install.forced.php")) include_once("./install.forced.php");
 
-dolibarr_install_syslog("etape0: Entering etape0.php page");
+dolibarr_install_syslog("--- etape0: Entering etape0.php page");
 
 
 /*
@@ -357,6 +357,7 @@ if (! $error && $db->connected)
 <?php
 }
 
+dolibarr_install_syslog("--- install/etape0.php end", LOG_INFO);
 
 pFooter($error,$setuplang);
 ?>
\ No newline at end of file
diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php
index 07f6882bd9f..6b9f4e9aac1 100644
--- a/htdocs/install/etape1.php
+++ b/htdocs/install/etape1.php
@@ -39,7 +39,7 @@ $langs->load("install");
 // Init "forced values" to nothing. "forced values" are used after an doliwamp install wizard.
 if (file_exists("./install.forced.php")) include_once("./install.forced.php");
 
-dolibarr_install_syslog("etape1: Entering etape1.php page");
+dolibarr_install_syslog("--- etape1: Entering etape1.php page");
 
 
 /*
@@ -508,6 +508,8 @@ function jsinfo()
 
 <?php
 
+dolibarr_install_syslog("--- install/etape1.php end", LOG_INFO);
+
 pFooter($error,$setuplang,'jsinfo');
 
 
diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php
index 645b5484325..1f24c3dcb45 100644
--- a/htdocs/install/etape2.php
+++ b/htdocs/install/etape2.php
@@ -55,7 +55,7 @@ if ($dolibarr_main_db_type == "mssql")  $choix=3;
 // Init "forced values" to nothing. "forced values" are used after a Doliwamp install wizard.
 if (file_exists("./install.forced.php")) include_once("./install.forced.php");
 
-dolibarr_install_syslog("etape2: Entering etape2.php page");
+dolibarr_install_syslog("--- etape2: Entering etape2.php page");
 
 
 /*
@@ -576,5 +576,7 @@ if ($_POST["action"] == "set")
 	$db->close();
 }
 
+dolibarr_install_syslog("--- install/etape2.php end", LOG_INFO);
+
 pFooter(!$ok,$setuplang);
 ?>
\ No newline at end of file
diff --git a/htdocs/install/etape4.php b/htdocs/install/etape4.php
index 827fa39950c..0ca30ba2bfc 100644
--- a/htdocs/install/etape4.php
+++ b/htdocs/install/etape4.php
@@ -43,7 +43,7 @@ $langs->load("install");
 if (! isset($force_install_dolibarrlogin))     $force_install_dolibarrlogin='';
 if (file_exists("./install.forced.php")) include_once("./install.forced.php");
 
-dolibarr_install_syslog("etape4: Entering etape4.php page");
+dolibarr_install_syslog("--- etape4: Entering etape4.php page");
 
 $err=0;
 $ok = 0;
@@ -108,5 +108,7 @@ if ($db->ok == 1)
 
 $db->close();
 
+dolibarr_install_syslog("--- install/etape4.php end", LOG_INFO);
+
 pFooter($err,$setuplang);
 ?>
diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php
index 5d9ba96a873..9a103dc7d1b 100644
--- a/htdocs/install/etape5.php
+++ b/htdocs/install/etape5.php
@@ -69,7 +69,7 @@ if (file_exists("./install.forced.php"))
 	include_once("./install.forced.php");
 }
 
-dolibarr_install_syslog("etape5: Entering etape5.php page", LOG_INFO);
+dolibarr_install_syslog("--- etape5: Entering etape5.php page", LOG_INFO);
 
 
 /*
@@ -153,7 +153,8 @@ if ($action == "set" || preg_match('/upgrade/i',$action))
 		dolibarr_install_syslog('install/etape5.php Load module user '.DOL_DOCUMENT_ROOT ."/includes/modules/".$file, LOG_INFO);
 		include_once(DOL_DOCUMENT_ROOT ."/includes/modules/".$file);
 		$objMod = new $modName($db);
-		$objMod->init();
+		$result=$objMod->init();
+        if (! $result) print 'ERROR in activating module file='.$file;
 
 		if ($db->connected == 1)
 		{
@@ -217,16 +218,19 @@ if ($action == "set" || preg_match('/upgrade/i',$action))
 				}
 
 				// If we ask to force some modules to be enabled
+				// This works only for module store into root directory. Does not work for alternate modules.
 				if (! empty($force_install_module))
 				{
 					$tmparray=explode(',',$force_install_module);
 					foreach ($tmparray as $modtoactivate)
 					{
 						$modtoactivatenew=preg_replace('/\.class\.php$/i','',$modtoactivate);
-						dolibarr_install_syslog('install/etape5.php Activate module '.$modtoactivatenew);
-						$result=Activate($modtoactivatenew);
-    					$mesg='';
-    					if ($result) $mesg=$result;
+                        $file=$modtoactivatenew.'.class.php';
+						dolibarr_install_syslog('install/etape5.php Activate module file='.$file);
+                        include_once(DOL_DOCUMENT_ROOT ."/includes/modules/".$file);
+                        $objMod = new $modtoactivatenew($db);
+                        $result=$objMod->init();
+                        if (! $result) print 'ERROR in activating module file='.$file;
 					}
 				}
 
@@ -406,7 +410,7 @@ else
 clearstatcache();
 
 
-dolibarr_install_syslog("install/etape5.php Dolibarr setup finished", LOG_INFO);
+dolibarr_install_syslog("--- install/etape5.php Dolibarr setup finished", LOG_INFO);
 
 pFooter(1,$setuplang);
 ?>
\ No newline at end of file
diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang
index f13578c1e1f..4effc8dc465 100644
--- a/htdocs/langs/en_US/install.lang
+++ b/htdocs/langs/en_US/install.lang
@@ -230,4 +230,4 @@ MigrationProjectUserResp=Data migration field fk_user_resp of llx_projet to llx_
 MigrationProjectTaskTime=Update time spent in seconds
 
 # Migration Acctioncom
-MigrationActioncommElement=Update data actions on elements
\ No newline at end of file
+MigrationActioncommElement=Update data on actions
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/install.lang b/htdocs/langs/fr_FR/install.lang
index 45c176a5ac5..b70025dc003 100644
--- a/htdocs/langs/fr_FR/install.lang
+++ b/htdocs/langs/fr_FR/install.lang
@@ -233,4 +233,4 @@ MigrationProjectUserResp=Migration du champ fk_user_resp de llx_projet vers llx_
 MigrationProjectTaskTime=Mise à jour du temps consommé en secondes
 
 # Migration Acctioncom
-MigrationActioncommElement=Mise à jour du données des actions des éléments
+MigrationActioncommElement=Mise à jour des données des actions des éléments
-- 
GitLab