Use isModEnabled

This commit is contained in:
Alexandre SPANGARO 2022-08-24 10:26:27 +02:00
parent a75cf794e5
commit 71acad3a81

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if (!empty($conf->categorie->enabled)) {
if (isModEnabled('categorie')) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
}
@ -42,7 +42,7 @@ if (!empty($conf->categorie->enabled)) {
$langs->loadLangs(array("companies", "compta", "accountancy", "products"));
// Security check
if (empty($conf->accounting->enabled)) {
if (!isModEnabled('accounting')) {
accessforbidden();
}
if (empty($user->rights->accounting->bind->write)) {
@ -522,7 +522,7 @@ if ($resql) {
// Filter on categories
$moreforfilter = '';
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
if (isModEnabled('categorie') && $user->rights->categorie->lire) {
$moreforfilter .= '<div class="divsearchfield">';
$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 .= '<div class="divsearchfield">';
$moreforfilter .= '<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts"'.($show_childproducts ? 'checked="checked"' : '').'>';
$moreforfilter .= ' <label for="search_show_childproducts">'.$langs->trans('ShowChildProducts').'</label>';