New: Add property hidden into module descriptor to allow to hide a

module according to some dynamic conditions.
This commit is contained in:
Laurent Destailleur 2013-06-24 18:31:56 +02:00
parent 7778a17a89
commit a8547b5375
4 changed files with 13 additions and 4 deletions

View File

@ -35,6 +35,8 @@ For developers:
- New: Show version of client lib used by mysql drivers.
- New: Add function to get content of an url (using all dolibarr setup like timeout, proxies...)
- New: Upgrade lib of TCPDF to 6.0
- New: Add property hidden into module descriptor to allow to hide a module according to
some dynamic conditions.
***** ChangeLog for 3.4 compared to 3.3.2 *****

View File

@ -97,8 +97,10 @@ class modMyModule extends DolibarrModules
$this->config_page_url = array("mysetuppage.php@mymodule");
// Dependencies
$this->hidden = false; // A condition to hide module
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->conflictwith = array(); // List of modules id this module is in conflict with
$this->phpmin = array(5,0); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module
$this->langfiles = array("mylangfile@mymodule");

View File

@ -152,8 +152,9 @@ foreach ($modulesdir as $dir)
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0;
if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0;
//if ($mode == 'expdev' && ($objMod->version != 'experimental' && $objMod->version != 'development')) $modulequalified=0;
// We discard modules according to property disabled
if (isset($objMod->hidden) && $objMod->hidden) $modulequalified=false;
// Define array $categ with categ with at least one qualified module
if ($modulequalified)
{

View File

@ -39,6 +39,8 @@ class modCron extends DolibarrModules
*/
function __construct($db)
{
global $langs,$conf;
$this->db = $db;
$this->numero = 2300;
@ -65,8 +67,10 @@ class modCron extends DolibarrModules
// Dependancies
//-------------
$this->depends = array();
$this->requiredby = array();
$this->hidden = ! empty($conf->global->CRON_MODULE_DISABLED); // A condition to disable module
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->conflictwith = array(); // List of modules id this module is in conflict with
$this->langfiles = array("cron@cron");
// Constantes