From f6f5346229233dabdd265c9578fe4116cbc0ab9e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Apr 2010 10:26:33 +0000 Subject: [PATCH] For constants that must be stored for allentities, we now must use 'allentities' in const array instead of '0'. This is more clear. --- dev/skeletons/modMyModule.class.php | 8 ++++---- htdocs/includes/modules/DolibarrModules.class.php | 10 +++++----- htdocs/includes/modules/modMultiCompany.class.php | 2 +- htdocs/includes/modules/modProduit.class.php | 2 +- htdocs/includes/modules/modSociete.class.php | 7 ++++--- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index befaf88d148..da12e1d3aeb 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/** +/** * \defgroup mymodule Module MyModule * \brief Example of a module descriptor. * Such a file must be copied into htdocs/includes/module directory. @@ -33,7 +33,7 @@ include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php"); -/** +/** * \class modMyModule * \brief Description and activation class for module MyModule */ @@ -70,7 +70,7 @@ class modMyModule extends DolibarrModules // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' $this->picto='generic'; - + // Defined if the directory /mymodule/inc/triggers/ contains triggers or not $this->triggers = 0; @@ -93,7 +93,7 @@ class modMyModule extends DolibarrModules $this->langfiles = array("mymodule"); // Constants - $this->const = array(); // List of particular constants to add when module is enabled + $this->const = array(); // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 0 or 'allentities', condition) //Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',0), // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) ); diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php index cadbfc010a8..4eae91a315f 100644 --- a/htdocs/includes/modules/DolibarrModules.class.php +++ b/htdocs/includes/modules/DolibarrModules.class.php @@ -89,7 +89,7 @@ class DolibarrModules // Insert new pages for tabs into llx_const if (! $err) $err+=$this->insert_tabs(); - + // Insert activation triggers if (! $err) $err+=$this->insert_triggers(); @@ -184,7 +184,7 @@ class DolibarrModules // Remove activation of module's new tabs if (! $err) $err+=$this->delete_tabs(); - + // Remove activation of module's triggers if (! $err) $err+=$this->delete_triggers(); @@ -790,7 +790,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]:$conf->entity; + $entity = ! empty($this->const[$key][5])?0:$conf->entity; $sql = "SELECT count(*)"; $sql.= " FROM ".MAIN_DB_PREFIX."const"; @@ -1205,7 +1205,7 @@ class DolibarrModules return $err; } - + /** * \brief Insert activation triggers from modules in llx_const * \return int Number of errors (0 if ok) @@ -1240,7 +1240,7 @@ class DolibarrModules } return $err; } - + /** * \brief Remove activation triggers from modules in llx_const * \return int Nombre d'erreurs (0 si ok) diff --git a/htdocs/includes/modules/modMultiCompany.class.php b/htdocs/includes/modules/modMultiCompany.class.php index a2ab36abfba..94225673f64 100644 --- a/htdocs/includes/modules/modMultiCompany.class.php +++ b/htdocs/includes/modules/modMultiCompany.class.php @@ -87,7 +87,7 @@ class modMultiCompany extends DolibarrModules // List of particular constants to add when module is enabled //Example: $this->const=array(0=>array('MODULE_MY_NEW_CONST1','chaine','myvalue','This is a constant to add',0), // 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) ); - $this->const=array(1=>array('MAIN_MODULE_MULTICOMPANY_NEEDSMARTY',"chaine",1,'Need smarty',0,0)); + $this->const=array(1=>array('MAIN_MODULE_MULTICOMPANY_NEEDSMARTY',"chaine",1,'Need smarty',0,'allentities')); // Boxes $this->boxes = array(); // List of boxes diff --git a/htdocs/includes/modules/modProduit.class.php b/htdocs/includes/modules/modProduit.class.php index 4f1c6c91bb1..9c3e6ace027 100644 --- a/htdocs/includes/modules/modProduit.class.php +++ b/htdocs/includes/modules/modProduit.class.php @@ -84,7 +84,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; + $this->const[$r][5] = 'allentities'; $r++; // Boxes diff --git a/htdocs/includes/modules/modSociete.class.php b/htdocs/includes/modules/modSociete.class.php index 47319d45db7..1f6f024282d 100644 --- a/htdocs/includes/modules/modSociete.class.php +++ b/htdocs/includes/modules/modSociete.class.php @@ -91,7 +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; + $this->const[$r][5] = 'allentities'; $r++; $this->const[$r][0] = "MAIN_SEARCHFORM_CONTACT"; @@ -99,14 +99,15 @@ 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; + $this->const[$r][5] = 'allentities'; $r++; - + $this->const[$r][0] = "COMPANY_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "DOL_DATA_ROOT/odttemplates/thirdparties"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; + $this->const[$r][6] = '$this->db->type != \'pgsql\''; // Condition $r++; // Boxes