';
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"');
$categoriesProductArr = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', '', 64, 0, 1);
@@ -533,7 +533,7 @@ if ($resql) {
}
//Show/hide child products. Hidden by default
- if (!empty($conf->variants->enabled) && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
+ if (isModEnabled('variants') && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
$moreforfilter .= '
';
$moreforfilter .= '';
$moreforfilter .= ' ';
diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php
index 2af12470b08..324c9c767b4 100644
--- a/htdocs/accountancy/bookkeeping/balance.php
+++ b/htdocs/accountancy/bookkeeping/balance.php
@@ -143,7 +143,7 @@ if (!empty($search_ledger_code)) {
}
}
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php
index 7c8c0dca547..c2071e76cea 100644
--- a/htdocs/accountancy/bookkeeping/card.php
+++ b/htdocs/accountancy/bookkeeping/card.php
@@ -79,7 +79,7 @@ if (!empty($update)) {
$object = new BookKeeping($db);
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index 8b8620f123d..f27a23256b6 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -214,7 +214,7 @@ if (empty($listofformat[$formatexportset])) {
$error = 0;
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php
index bb864fc39e3..0bd1c06aab8 100644
--- a/htdocs/accountancy/bookkeeping/listbyaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbyaccount.php
@@ -187,7 +187,7 @@ if ($search_date_end && empty($search_date_endyear)) {
$search_date_endday = $tmparray['mday'];
}
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php
index c8948b05012..9720399fb5e 100644
--- a/htdocs/accountancy/class/accountingjournal.class.php
+++ b/htdocs/accountancy/class/accountingjournal.class.php
@@ -429,7 +429,7 @@ class AccountingJournal extends CommonObject
{
global $conf, $langs;
- if (empty($conf->asset->enabled)) {
+ if (!isModEnabled('asset')) {
return array();
}
@@ -867,7 +867,7 @@ class AccountingJournal extends CommonObject
}
}
//
- // if (!$error_for_line && !empty($conf->asset->enabled) && $this->nature == 1 && $bookkeeping->fk_doc > 0) {
+ // if (!$error_for_line && isModEnabled('asset') && $this->nature == 1 && $bookkeeping->fk_doc > 0) {
// // Set last cumulative depreciation
// require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php';
// $asset = new Asset($this->db);
diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php
index a1d75440b56..2aaa24d942a 100644
--- a/htdocs/accountancy/closure/index.php
+++ b/htdocs/accountancy/closure/index.php
@@ -57,7 +57,7 @@ $search_date_end = dol_get_last_day($year_end, $month_end);
$year_current = $year_start;
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php
index 296d6729301..0b3435ecb92 100644
--- a/htdocs/accountancy/customer/card.php
+++ b/htdocs/accountancy/customer/card.php
@@ -38,7 +38,7 @@ $codeventil = GETPOST('codeventil', 'int');
$id = GETPOST('id', 'int');
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php
index 0eca61c72c1..06db5cedd0e 100644
--- a/htdocs/accountancy/customer/index.php
+++ b/htdocs/accountancy/customer/index.php
@@ -40,7 +40,7 @@ $validatemonth = GETPOST('validatemonth', 'int');
$validateyear = GETPOST('validateyear', 'int');
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
@@ -77,7 +77,7 @@ $action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
@@ -622,7 +622,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
print '
';
- if (!empty($conf->margin->enabled)) {
+ if (isModEnabled('margin')) {
print "
\n";
print '
';
print '
';
diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php
index 4a8080ab8b4..469f29ad3c7 100644
--- a/htdocs/accountancy/customer/lines.php
+++ b/htdocs/accountancy/customer/lines.php
@@ -85,7 +85,7 @@ if (!$sortorder) {
}
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index b2a127e86a4..4038bb4b5bc 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -104,7 +104,7 @@ $accountingAccount = new AccountingAccount($db);
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/expensereport/card.php b/htdocs/accountancy/expensereport/card.php
index 7c2310ccce4..0255e019138 100644
--- a/htdocs/accountancy/expensereport/card.php
+++ b/htdocs/accountancy/expensereport/card.php
@@ -42,7 +42,7 @@ $codeventil = GETPOST('codeventil', 'int');
$id = GETPOST('id', 'int');
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php
index 08657fe7a62..d0b25bdffd2 100644
--- a/htdocs/accountancy/expensereport/index.php
+++ b/htdocs/accountancy/expensereport/index.php
@@ -58,7 +58,7 @@ $year_current = $year_start;
$action = GETPOST('action', 'aZ09');
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php
index 005783ed7a8..926d03f9235 100644
--- a/htdocs/accountancy/expensereport/lines.php
+++ b/htdocs/accountancy/expensereport/lines.php
@@ -79,7 +79,7 @@ if (!$sortorder) {
}
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php
index 880af769183..7a02d0b4564 100644
--- a/htdocs/accountancy/expensereport/list.php
+++ b/htdocs/accountancy/expensereport/list.php
@@ -97,7 +97,7 @@ $accounting = new AccountingAccount($db);
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php
index 99ae0bd845b..db761bdd01e 100644
--- a/htdocs/accountancy/index.php
+++ b/htdocs/accountancy/index.php
@@ -39,14 +39,14 @@ if ($user->socid > 0) {
accessforbidden();
}
/*
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
accessforbidden();
}
*/
-if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled) && empty($conf->asset->enabled) && empty($conf->intracommreport->enabled)) {
+if (!isModEnabled('comptabilite') && !isModEnabled('accounting') && !isModEnabled('asset') && !isModEnabled('intracommreport')) {
accessforbidden();
}
if (empty($user->rights->compta->resultat->lire) && empty($user->rights->accounting->comptarapport->lire) && empty($user->rights->accounting->mouvements->lire) && empty($user->rights->asset->read) && empty($user->rights->intracommreport->read)) {
@@ -86,7 +86,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print ''.$langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")."\n";
print "
";
-} elseif (!empty($conf->accounting->enabled)) {
+} elseif (isModEnabled('accounting')) {
$step = 0;
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
@@ -165,7 +165,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print $s;
print "
\n";
- if (!empty($conf->tax->enabled)) {
+ if (isModEnabled('tax')) {
$textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'';
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
@@ -173,7 +173,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print $s;
print "
\n";
}
- if (!empty($conf->expensereport->enabled)) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
+ if (isModEnabled('expensereport')) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
$s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'', $s);
@@ -212,7 +212,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print $s;
print "
\n";
- if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled)) {
+ if (isModEnabled('expensereport') || isModEnabled('deplacement')) {
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n";
$s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'', $s);
diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php
index 27ffb681ae0..f3049206389 100644
--- a/htdocs/accountancy/journal/bankjournal.php
+++ b/htdocs/accountancy/journal/bankjournal.php
@@ -83,7 +83,7 @@ $now = dol_now();
$action = GETPOST('action', 'aZ09');
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php
index dbd1c892086..d38e49c390e 100644
--- a/htdocs/accountancy/journal/expensereportsjournal.php
+++ b/htdocs/accountancy/journal/expensereportsjournal.php
@@ -58,7 +58,7 @@ if ($in_bookkeeping == '') {
$now = dol_now();
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php
index e4c292d2670..70741aca5d1 100644
--- a/htdocs/accountancy/journal/purchasesjournal.php
+++ b/htdocs/accountancy/journal/purchasesjournal.php
@@ -61,7 +61,7 @@ $hookmanager->initHooks(array('purchasesjournal'));
$parameters = array();
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php
index 599eeb627b5..107dda05f4a 100644
--- a/htdocs/accountancy/journal/sellsjournal.php
+++ b/htdocs/accountancy/journal/sellsjournal.php
@@ -63,7 +63,7 @@ $hookmanager->initHooks(array('sellsjournal'));
$parameters = array();
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php
index af32b85d8fa..d737925f2c3 100644
--- a/htdocs/accountancy/journal/variousjournal.php
+++ b/htdocs/accountancy/journal/variousjournal.php
@@ -83,7 +83,7 @@ if (!is_array($journal_data)) {
}
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php
index 05d32d0cec5..306b88d11ea 100644
--- a/htdocs/accountancy/supplier/card.php
+++ b/htdocs/accountancy/supplier/card.php
@@ -42,7 +42,7 @@ $codeventil = GETPOST('codeventil', 'int');
$id = GETPOST('id', 'int');
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php
index c142361155d..1edbe83eefb 100644
--- a/htdocs/accountancy/supplier/lines.php
+++ b/htdocs/accountancy/supplier/lines.php
@@ -89,7 +89,7 @@ if (!$sortorder) {
$formaccounting = new FormAccounting($db);
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php
index f274a5432dc..d14beb84cc2 100644
--- a/htdocs/accountancy/supplier/list.php
+++ b/htdocs/accountancy/supplier/list.php
@@ -106,7 +106,7 @@ $accountingAccount = new AccountingAccount($db);
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {