From dbc211ce3b130627199f7e5d36ce0ec2516ca28d Mon Sep 17 00:00:00 2001
From: Regis Houssin <regis@dolibarr.fr>
Date: Tue, 5 Jan 2010 17:21:01 +0000
Subject: [PATCH] Fix: current entity by default Todo: some constant already
 defined in module ?

---
 htdocs/includes/modules/DolibarrModules.class.php | 3 +--
 htdocs/includes/modules/modProduit.class.php      | 1 +
 htdocs/includes/modules/modPropale.class.php      | 3 ++-
 htdocs/includes/modules/modSociete.class.php      | 2 ++
 htdocs/install/mysql/data/llx_const.sql           | 1 +
 5 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php
index 7867c9e1f5c..b937860a2a1 100644
--- a/htdocs/includes/modules/DolibarrModules.class.php
+++ b/htdocs/includes/modules/DolibarrModules.class.php
@@ -759,8 +759,7 @@ class DolibarrModules
 			$val    = $this->const[$key][2];
 			$note   = $this->const[$key][3];
 			$visible= $this->const[$key][4];
-			$entity = isset($this->const[$key][5])?$this->const[$key][5]:0;
-			$entity = ((!empty($entity) || $entity == '0')?$entity:$conf->entity);
+			$entity = isset($this->const[$key][5])?$this->const[$key][5]:$conf->entity;
 
 			$sql = "SELECT count(*)";
 			$sql.= " FROM ".MAIN_DB_PREFIX."const";
diff --git a/htdocs/includes/modules/modProduit.class.php b/htdocs/includes/modules/modProduit.class.php
index 25210fd33cd..266234c6da4 100644
--- a/htdocs/includes/modules/modProduit.class.php
+++ b/htdocs/includes/modules/modProduit.class.php
@@ -85,6 +85,7 @@ class modProduit extends DolibarrModules
 		$this->const[$r][2] = "1";
 		$this->const[$r][3] = "Affichage formulaire de recherche des Produits et Services dans la barre de gauche";
 		$this->const[$r][4] = 0;
+		$this->const[$r][5] = 0;
 		$r++;
 
 		// Boxes
diff --git a/htdocs/includes/modules/modPropale.class.php b/htdocs/includes/modules/modPropale.class.php
index 19f8715b49d..a07ef66debc 100644
--- a/htdocs/includes/modules/modPropale.class.php
+++ b/htdocs/includes/modules/modPropale.class.php
@@ -34,7 +34,8 @@
 include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
 
 
-/** \class 		modPropale
+/** 
+ *  \class 		modPropale
  *	\brief      Classe de description et activation du module Propale
  */
 class modPropale extends DolibarrModules
diff --git a/htdocs/includes/modules/modSociete.class.php b/htdocs/includes/modules/modSociete.class.php
index 0359cb47b52..efe885aec48 100644
--- a/htdocs/includes/modules/modSociete.class.php
+++ b/htdocs/includes/modules/modSociete.class.php
@@ -91,6 +91,7 @@ class modSociete extends DolibarrModules
 		$this->const[$r][2] = "1";
 		$this->const[$r][3] = "Affichage formulaire de recherche des Societes dans la barre de gauche";
 		$this->const[$r][4] = 0;
+		$this->const[$r][5] = 0;
 		$r++;
 
 		$this->const[$r][0] = "MAIN_SEARCHFORM_CONTACT";
@@ -98,6 +99,7 @@ class modSociete extends DolibarrModules
 		$this->const[$r][2] = "1";
 		$this->const[$r][3] = "Affichage formulaire de recherche des Contacts dans la barre de gauche";
 		$this->const[$r][4] = 0;
+		$this->const[$r][5] = 0;
 		$r++;
 
 		// Boxes
diff --git a/htdocs/install/mysql/data/llx_const.sql b/htdocs/install/mysql/data/llx_const.sql
index 497649e427e..2099742b049 100644
--- a/htdocs/install/mysql/data/llx_const.sql
+++ b/htdocs/install/mysql/data/llx_const.sql
@@ -47,6 +47,7 @@ insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_M
 
 insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_UPLOAD_DOC','2048','chaine','Max size for file upload (0 means no upload allowed)',0,0);
 
+-- TODO deja initialise dans le module ?
 insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_SEARCHFORM_SOCIETE','1','yesno','Show form for quick company search',0,0);
 insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_SEARCHFORM_CONTACT','1','yesno','Show form for quick contact search',0,0);
 insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_SEARCHFORM_PRODUITSERVICE' ,'1','yesno','Show form for quick product search',0,0);
-- 
GitLab