diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 9c7cc01630d..406172590d7 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1441,7 +1441,7 @@ class Setup extends DolibarrApi { global $conf; - if (empty($conf->socialnetworks->enabled)) { + if (!isModEnabled('socialnetworks')) { throw new RestException(400, 'API not available: this dictionary is not enabled by setup'); } diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 4c0d36fdcfe..0abf864084d 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -237,7 +237,7 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $ // Defined if module is enabled $enabled = true; - if (empty($conf->$modulenameforenabled->enabled)) { + if (!isModEnabled($modulenameforenabled)) { $enabled = false; } diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index af14185b3d0..d15de486560 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1376,7 +1376,7 @@ class BOM extends CommonObject $unit = measuringUnitString($line->fk_unit, '', '', 1); $qty = convertDurationtoHour($line->qty, $unit); - if ($conf->workstation->enabled && !empty($tmpproduct->fk_default_workstation)) { + if (isModEnabled('workstation') && !empty($tmpproduct->fk_default_workstation)) { $workstation = new Workstation($this->db); $res = $workstation->fetch($tmpproduct->fk_default_workstation); diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 41aeec4b96f..0243928116e 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -84,7 +84,7 @@ if ($nolinesbefore) { print '' . $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')) . ''; } else { print '' . $form->textwithpicto($langs->trans('Unit'), '').''; - if ($conf->workstation->enabled) print '' . $form->textwithpicto($langs->trans('Workstation'), '') . ''; + if (isModEnabled('workstation')) print '' . $form->textwithpicto($langs->trans('Workstation'), '') . ''; print '' . $form->textwithpicto($langs->trans('TotalCost'), '') . ''; } diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php index f93fb59fe0d..5252baf61ca 100644 --- a/htdocs/bom/tpl/objectline_title.tpl.php +++ b/htdocs/bom/tpl/objectline_title.tpl.php @@ -85,7 +85,7 @@ if ($filtertype != 1) { } else { print '' . $form->textwithpicto($langs->trans('Unit'), '').''; - if ($conf->workstation->enabled) print '' . $form->textwithpicto($langs->trans('DefaultWorkstation'), '') . ''; + if (isModEnabled('workstation')) print '' . $form->textwithpicto($langs->trans('DefaultWorkstation'), '') . ''; // Cost print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCostService")).'';