FIX: $conf must reflect enabled/disabled state of modules (#29126)
This commit is contained in:
parent
a9bfe73e1a
commit
8b00b89f9d
1 changed files with 21 additions and 0 deletions
|
|
@ -521,6 +521,17 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||
// Return code
|
||||
if (!$err) {
|
||||
$this->db->commit();
|
||||
|
||||
// set $conf properties
|
||||
$conf->global->{$this->const_name} = 1;
|
||||
$moduleNameInConf = strtolower(preg_replace('/^MAIN_MODULE_/', '', $this->const_name));
|
||||
// two exceptions to handle
|
||||
if ($moduleNameInConf === 'propale') $moduleNameInConf = 'propal';
|
||||
elseif ($moduleNameInConf === 'supplierproposal') $moduleNameInConf = 'supplier_proposal';
|
||||
if (! isset($conf->{$moduleNameInConf})) {
|
||||
$conf->{$moduleNameInConf} = (object) array('enabled' => 1);
|
||||
}
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
|
|
@ -539,6 +550,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||
*/
|
||||
protected function _remove($array_sql, $options = '')
|
||||
{
|
||||
global $conf;
|
||||
// phpcs:enable
|
||||
$err = 0;
|
||||
|
||||
|
|
@ -605,6 +617,15 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
|||
// Return code
|
||||
if (!$err) {
|
||||
$this->db->commit();
|
||||
|
||||
// unset $conf properties
|
||||
if (isset($conf->global->{$this->const_name})) unset($conf->global->{$this->const_name});
|
||||
$moduleNameInConf = strtolower(preg_replace('/^MAIN_MODULE_/', '', $this->const_name));
|
||||
// two exceptions to handle
|
||||
if ($moduleNameInConf === 'propale') $moduleNameInConf = 'propal';
|
||||
elseif ($moduleNameInConf === 'supplierproposal') $moduleNameInConf = 'supplier_proposal';
|
||||
if (isset($conf->{$moduleNameInConf})) unset($conf->{$moduleNameInConf});
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
|
|
|
|||
Loading…
Reference in a new issue