diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php
index dea2a1a596e..10a02f6507c 100644
--- a/htdocs/modulebuilder/template/admin/setup.php
+++ b/htdocs/modulebuilder/template/admin/setup.php
@@ -244,7 +244,7 @@ if ($action == 'updateMask') {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
- if ($conf->global->$constforval == "$value") {
+ if (getDolGlobalString($constforval) == "$value") {
dolibarr_del_const($db, $constforval, $conf->entity);
}
}
@@ -257,7 +257,7 @@ if ($action == 'updateMask') {
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
// The constant that was read before the new set
// We therefore requires a variable to have a coherent view
- $conf->global->$constforval = $value;
+ $conf->global->{$constforval} = $value;
}
// We disable/enable the document template (into llx_document_model table)
@@ -357,10 +357,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
$module = new $file($db);
// Show modules according to features level
- if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
+ if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
continue;
}
- if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
+ if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
continue;
}
@@ -494,10 +494,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
$module = new $classname($db);
$modulequalified = 1;
- if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
+ if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
$modulequalified = 0;
}
- if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
+ if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
$modulequalified = 0;
}
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index eca483f0c8b..5122bf3e59e 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -84,7 +84,7 @@ class MyObject extends CommonObject
* Note: Filter must be a Dolibarr filter syntax string. Example: "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.status:!=:0) or (t.nature:is:NULL)"
* 'label' the translation key.
* 'picto' is code of a picto to show before value in forms
- * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or 'isModEnabled("multicurrency")' ...)
+ * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalInt('MY_SETUP_PARAM')' or 'isModEnabled("multicurrency")' ...)
* 'position' is the sort order of field.
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
@@ -251,7 +251,7 @@ class MyObject extends CommonObject
$this->db = $db;
- if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid']) && !empty($this->fields['ref'])) {
+ if (empty(getDolGlobalInt('MAIN_SHOW_TECHNICAL_ID')) && isset($this->fields['rowid']) && !empty($this->fields['ref'])) {
$this->fields['rowid']['visible'] = 0;
}
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
@@ -574,8 +574,8 @@ class MyObject extends CommonObject
return 0;
}
- /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->myobject->write))
- || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->myobject->myobject_advance->validate))))
+ /* if (! ((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mymodule','write'))
+ || (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->mymodule->myobject->myobject_advance->validate))))
{
$this->error='NotEnoughPermissions';
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
@@ -692,8 +692,8 @@ class MyObject extends CommonObject
return 0;
}
- /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->write))
- || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->mymodule_advance->validate))))
+ /* if (! ((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mymodule','write'))
+ || (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mymodule','mymodule_advance','validate'))))
{
$this->error='Permission denied';
return -1;
@@ -716,8 +716,8 @@ class MyObject extends CommonObject
return 0;
}
- /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->write))
- || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->mymodule->mymodule_advance->validate))))
+ /* if (! ((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mymodule','write'))
+ || (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mymodule','mymodule_advance','validate'))))
{
$this->error='Permission denied';
return -1;
@@ -793,7 +793,7 @@ class MyObject extends CommonObject
$linkclose = '';
if (empty($notooltip)) {
- if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+ if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
@@ -833,7 +833,7 @@ class MyObject extends CommonObject
$pospoint = strpos($filearray[0]['name'], '.');
$pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint);
- if (empty($conf->global->{strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS'})) {
+ if (empty(getDolGlobalString(strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS'))) {
$result .= '
';
} else {
$result .= '
';
@@ -1105,8 +1105,8 @@ class MyObject extends CommonObject
if (!empty($this->model_pdf)) {
$modele = $this->model_pdf;
- } elseif (!empty($conf->global->MYOBJECT_ADDON_PDF)) {
- $modele = $conf->global->MYOBJECT_ADDON_PDF;
+ } elseif (!empty(getDolGlobalString('MYOBJECT_ADDON_PDF'))) {
+ $modele = getDolGlobalString('MYOBJECT_ADDON_PDF');
}
}
diff --git a/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php
index 7ea4b553e71..4c34d790df4 100644
--- a/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php
+++ b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php
@@ -101,8 +101,8 @@ class mymodulewidget1 extends ModeleBoxes
$this->param = $param;
- //$this->enabled = $conf->global->FEATURES_LEVEL > 0; // Condition when module is enabled or not
- //$this->hidden = ! ($user->rights->mymodule->myobject->read); // Condition when module is visible by user (test on permission)
+ //$this->enabled = getDolGlobalInt(FEATURES_LEVEL) > 0; // Condition when module is enabled or not
+ //$this->hidden = ! ($user->hasRight('mymodule,'myobject','read'); // Condition when module is visible by user (test on permission)
}
/**
diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
index 99cd900b512..311bc6c14b5 100644
--- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
+++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
@@ -403,8 +403,8 @@ class modMyModule extends DolibarrModules
$this->import_convertvalue_array[$r] = array(
't.ref' => array(
'rule'=>'getrefifauto',
- 'class'=>(empty($conf->global->MYMODULE_MYOBJECT_ADDON) ? 'mod_myobject_standard' : $conf->global->MYMODULE_MYOBJECT_ADDON),
- 'path'=>"/core/modules/commande/".(empty($conf->global->MYMODULE_MYOBJECT_ADDON) ? 'mod_myobject_standard' : $conf->global->MYMODULE_MYOBJECT_ADDON).'.php'
+ 'class'=>(empty(getDolGlobalString('MYMODULE_MYOBJECT_ADDON')) ? 'mod_myobject_standard' : getDolGlobalString('MYMODULE_MYOBJECT_ADDON')),
+ 'path'=>"/core/modules/commande/".(empty(getDolGlobalString('MYMODULE_MYOBJECT_ADDON')) ? 'mod_myobject_standard' : getDolGlobalString('MYMODULE_MYOBJECT_ADDON')).'.php'
'classobject'=>'MyObject',
'pathobject'=>'/mymodule/class/myobject.class.php',
),
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
index b7dfc374a52..17936af12de 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
@@ -129,7 +129,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
// List of directories area
$texte .= '