From b29efb0e96698f37e4143b79a7dc95e7b0cd62b0 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Fri, 4 Sep 2009 23:23:05 +0000
Subject: [PATCH] Remove install warning if DoliWamp

---
 build/exe/doliwamp/doliwamp.iss |  2 +-
 htdocs/install/etape5.php       | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss
index 07473ee9287..bf22ef5af78 100644
--- a/build/exe/doliwamp/doliwamp.iss
+++ b/build/exe/doliwamp/doliwamp.iss
@@ -167,7 +167,7 @@ var value: String;
 
 function InitializeSetup(): Boolean;
 begin
-  Result := MsgBox('You will install or upgrade DoliWamp (Apache+Mysql+PHP+Dolibarr) on your computer.' #13#13 'This setup install or upgrade Dolibarr ERP-CRM and third party softwares (Apache, Mysql and PHP) configured for a Dolibarr usage.' #13#13 'If you have technical knowledge and plan to share your Apache, Mysql and PHP with other projects than Dolibarr, you should not use this assistant and make a manual installation of Dolibarr on an existing Apache, Mysql and PHP installation (installed by WampServer for example).' #13#13 'Do you want to start installation/upgrade process ?', mbConfirmation, MB_YESNO) = idYes;
+  Result := MsgBox('You will install or upgrade to DoliWamp (Apache+Mysql+PHP+Dolibarr) on your computer.' #13#13 'This setup install or upgrade Dolibarr ERP-CRM and third party softwares (Apache, Mysql and PHP) configured for a Dolibarr usage.' #13#13 'If you have technical knowledge and plan to share your Apache, Mysql and PHP with other projects than Dolibarr, you should not use this assistant and make a manual installation of Dolibarr on an existing Apache, Mysql and PHP installation (WampServer for example).' #13#13 'Do you want to start installation/upgrade process ?', mbConfirmation, MB_YESNO) = idYes;
 end;
 
 procedure InitializeWizard();
diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php
index 3c5f57a915a..17278c54053 100644
--- a/htdocs/install/etape5.php
+++ b/htdocs/install/etape5.php
@@ -59,7 +59,12 @@ if (! isset($force_install_databasepass))      $force_install_databasepass='';
 if (! isset($force_install_databaserootlogin)) $force_install_databaserootlogin='';
 if (! isset($force_install_databaserootpass))  $force_install_databaserootpass='';
 if (! isset($force_install_lockinstall))       $force_install_lockinstall='';
-if (file_exists("./install.forced.php")) include_once("./install.forced.php");
+$usedoliwamp=false;
+if (file_exists("./install.forced.php"))
+{
+	$usedoliwamp=true;
+	include_once("./install.forced.php");
+}
 
 dolibarr_install_syslog("etape5: Entering etape5.php page", LOG_INFO);
 
@@ -187,6 +192,14 @@ if ($_POST["action"] == "set" || eregi('upgrade',$_POST["action"]))
 				$db->query("INSERT INTO llx_const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL',$conf->db->dolibarr_main_db_encryption,$conf->db->dolibarr_main_db_cryptkey).",".$db->encrypt($targetversion,$conf->db->dolibarr_main_db_encryption,$conf->db->dolibarr_main_db_cryptkey).",'chaine',0,'Dolibarr version when install',0)");
 				$conf->global->MAIN_VERSION_LAST_INSTALL=$targetversion;
 
+				if ($usedoliwamp)
+				{
+					dolibarr_install_syslog('install/etape5.php set MAIN_REMOVE_INSTALL_WARNING const to 1', LOG_DEBUG);
+					$db->query("DELETE FROM llx_const WHERE ".$db->decrypt('name',$conf->db->dolibarr_main_db_encryption,$conf->db->dolibarr_main_db_cryptkey)."='MAIN_REMOVE_INSTALL_WARNING'");
+					$db->query("INSERT INTO llx_const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_REMOVE_INSTALL_WARNING',$conf->db->dolibarr_main_db_encryption,$conf->db->dolibarr_main_db_cryptkey).",".$db->encrypt(1,$conf->db->dolibarr_main_db_encryption,$conf->db->dolibarr_main_db_cryptkey).",'chaine',1,'Disable install warnings',0)");
+					$conf->global->MAIN_REMOVE_INSTALL_WARNING=1;
+				}
+
 				dolibarr_install_syslog('install/etape5.php Remove MAIN_NOT_INSTALLED const', LOG_DEBUG);
 				$db->query("DELETE FROM llx_const WHERE ".$db->decrypt('name',$conf->db->dolibarr_main_db_encryption,$conf->db->dolibarr_main_db_cryptkey)."='MAIN_NOT_INSTALLED'");
 
-- 
GitLab