Use isModEnabled

This commit is contained in:
Alexandre SPANGARO 2022-09-25 15:27:42 +02:00
parent 58e96a1db8
commit c674f00cb2
5 changed files with 5 additions and 5 deletions

View File

@ -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');
}

View File

@ -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;
}

View File

@ -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);

View File

@ -84,7 +84,7 @@ if ($nolinesbefore) {
print '<td class="linecollost right">' . $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')) . '</td>';
} else {
print '<td class="linecolunit right">' . $form->textwithpicto($langs->trans('Unit'), '').'</td>';
if ($conf->workstation->enabled) print '<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans('Workstation'), '') . '</td>';
if (isModEnabled('workstation')) print '<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans('Workstation'), '') . '</td>';
print '<td class="linecoltotalcost right">' . $form->textwithpicto($langs->trans('TotalCost'), '') . '</td>';
}

View File

@ -85,7 +85,7 @@ if ($filtertype != 1) {
} else {
print '<td class="linecolunit right">' . $form->textwithpicto($langs->trans('Unit'), '').'</td>';
if ($conf->workstation->enabled) print '<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans('DefaultWorkstation'), '') . '</td>';
if (isModEnabled('workstation')) print '<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans('DefaultWorkstation'), '') . '</td>';
// Cost
print '<td class="linecolcost right">'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCostService")).'</td>';