Use isModEnabled

This commit is contained in:
Alexandre SPANGARO 2022-08-29 11:34:29 +02:00
parent a2fe675ead
commit ebff140389

View File

@ -103,7 +103,7 @@ $nbofyear = ($year_end - $year_start) + 1;
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING') // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
$modecompta = $conf->global->ACCOUNTING_MODE; $modecompta = $conf->global->ACCOUNTING_MODE;
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$modecompta = 'BOOKKEEPING'; $modecompta = 'BOOKKEEPING';
} }
if (GETPOST("modecompta")) { if (GETPOST("modecompta")) {
@ -114,10 +114,10 @@ if (GETPOST("modecompta")) {
if ($user->socid > 0) { if ($user->socid > 0) {
$socid = $user->socid; $socid = $user->socid;
} }
if (!empty($conf->comptabilite->enabled)) { if (isModEnabled('comptabilite')) {
$result = restrictedArea($user, 'compta', '', '', 'resultat'); $result = restrictedArea($user, 'compta', '', '', 'resultat');
} }
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }
@ -142,7 +142,7 @@ if ($modecompta == "BOOKKEEPINGCOLLECTED") {
if ($modecompta == "CREANCES-DETTES") { if ($modecompta == "CREANCES-DETTES") {
$name = $langs->trans("PurchaseTurnover"); $name = $langs->trans("PurchaseTurnover");
$calcmode = $langs->trans("CalcModeDebt"); $calcmode = $langs->trans("CalcModeDebt");
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')'; $calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')';
$calcmode = str_replace('{link1}', '<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">', $calcmode); $calcmode = str_replace('{link1}', '<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">', $calcmode);
$calcmode = str_replace('{link2}', '</a>', $calcmode); $calcmode = str_replace('{link2}', '</a>', $calcmode);
@ -187,7 +187,7 @@ if (!empty($modecompta)) {
} }
report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode); report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode);
if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
} }