For constants that must be stored for allentities, we now must use 'allentities' in const array instead of '0'. This is more clear.

This commit is contained in:
Laurent Destailleur 2010-04-03 10:26:33 +00:00
parent 933c84c127
commit f6f5346229
5 changed files with 15 additions and 14 deletions

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
/** /**
* \defgroup mymodule Module MyModule * \defgroup mymodule Module MyModule
* \brief Example of a module descriptor. * \brief Example of a module descriptor.
* Such a file must be copied into htdocs/includes/module directory. * 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"); include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
/** /**
* \class modMyModule * \class modMyModule
* \brief Description and activation class for module MyModule * \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 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' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
$this->picto='generic'; $this->picto='generic';
// Defined if the directory /mymodule/inc/triggers/ contains triggers or not // Defined if the directory /mymodule/inc/triggers/ contains triggers or not
$this->triggers = 0; $this->triggers = 0;
@ -93,7 +93,7 @@ class modMyModule extends DolibarrModules
$this->langfiles = array("mymodule"); $this->langfiles = array("mymodule");
// Constants // 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), //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) ); // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) );

View File

@ -89,7 +89,7 @@ class DolibarrModules
// Insert new pages for tabs into llx_const // Insert new pages for tabs into llx_const
if (! $err) $err+=$this->insert_tabs(); if (! $err) $err+=$this->insert_tabs();
// Insert activation triggers // Insert activation triggers
if (! $err) $err+=$this->insert_triggers(); if (! $err) $err+=$this->insert_triggers();
@ -184,7 +184,7 @@ class DolibarrModules
// Remove activation of module's new tabs // Remove activation of module's new tabs
if (! $err) $err+=$this->delete_tabs(); if (! $err) $err+=$this->delete_tabs();
// Remove activation of module's triggers // Remove activation of module's triggers
if (! $err) $err+=$this->delete_triggers(); if (! $err) $err+=$this->delete_triggers();
@ -790,7 +790,7 @@ class DolibarrModules
$val = $this->const[$key][2]; $val = $this->const[$key][2];
$note = $this->const[$key][3]; $note = $this->const[$key][3];
$visible= $this->const[$key][4]; $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 = "SELECT count(*)";
$sql.= " FROM ".MAIN_DB_PREFIX."const"; $sql.= " FROM ".MAIN_DB_PREFIX."const";
@ -1205,7 +1205,7 @@ class DolibarrModules
return $err; return $err;
} }
/** /**
* \brief Insert activation triggers from modules in llx_const * \brief Insert activation triggers from modules in llx_const
* \return int Number of errors (0 if ok) * \return int Number of errors (0 if ok)
@ -1240,7 +1240,7 @@ class DolibarrModules
} }
return $err; return $err;
} }
/** /**
* \brief Remove activation triggers from modules in llx_const * \brief Remove activation triggers from modules in llx_const
* \return int Nombre d'erreurs (0 si ok) * \return int Nombre d'erreurs (0 si ok)

View File

@ -87,7 +87,7 @@ class modMultiCompany extends DolibarrModules
// List of particular constants to add when module is enabled // 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), //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) ); // 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 // Boxes
$this->boxes = array(); // List of boxes $this->boxes = array(); // List of boxes

View File

@ -84,7 +84,7 @@ class modProduit extends DolibarrModules
$this->const[$r][2] = "1"; $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][3] = "Affichage formulaire de recherche des Produits et Services dans la barre de gauche";
$this->const[$r][4] = 0; $this->const[$r][4] = 0;
$this->const[$r][5] = 0; $this->const[$r][5] = 'allentities';
$r++; $r++;
// Boxes // Boxes

View File

@ -91,7 +91,7 @@ class modSociete extends DolibarrModules
$this->const[$r][2] = "1"; $this->const[$r][2] = "1";
$this->const[$r][3] = "Affichage formulaire de recherche des Societes dans la barre de gauche"; $this->const[$r][3] = "Affichage formulaire de recherche des Societes dans la barre de gauche";
$this->const[$r][4] = 0; $this->const[$r][4] = 0;
$this->const[$r][5] = 0; $this->const[$r][5] = 'allentities';
$r++; $r++;
$this->const[$r][0] = "MAIN_SEARCHFORM_CONTACT"; $this->const[$r][0] = "MAIN_SEARCHFORM_CONTACT";
@ -99,14 +99,15 @@ class modSociete extends DolibarrModules
$this->const[$r][2] = "1"; $this->const[$r][2] = "1";
$this->const[$r][3] = "Affichage formulaire de recherche des Contacts dans la barre de gauche"; $this->const[$r][3] = "Affichage formulaire de recherche des Contacts dans la barre de gauche";
$this->const[$r][4] = 0; $this->const[$r][4] = 0;
$this->const[$r][5] = 0; $this->const[$r][5] = 'allentities';
$r++; $r++;
$this->const[$r][0] = "COMPANY_ADDON_PDF_ODT_PATH"; $this->const[$r][0] = "COMPANY_ADDON_PDF_ODT_PATH";
$this->const[$r][1] = "chaine"; $this->const[$r][1] = "chaine";
$this->const[$r][2] = "DOL_DATA_ROOT/odttemplates/thirdparties"; $this->const[$r][2] = "DOL_DATA_ROOT/odttemplates/thirdparties";
$this->const[$r][3] = ""; $this->const[$r][3] = "";
$this->const[$r][4] = 0; $this->const[$r][4] = 0;
$this->const[$r][6] = '$this->db->type != \'pgsql\''; // Condition
$r++; $r++;
// Boxes // Boxes