diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index d520c82bf35..9f86922aa5c 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -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->hasRight('categorie', 'lire')) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { $moreforfilter .= '
'; $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/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 3c83e03ee55..9720399fb5e 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -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/index.php b/htdocs/accountancy/index.php index f6f86461d9b..58f74759b14 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 (!$user->hasRight('compta', 'resultat', 'lire') && !$user->hasRight('accounting', 'comptarapport', 'lire') && !$user->hasRight('accounting', 'mouvements', 'lire') && !$user->hasRight('asset', 'read') && !$user->hasRight('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/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index 265931c0265..502249907e8 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -179,7 +179,7 @@ abstract class ActionsAdherentCardCommon if ($action == 'view' || $action == 'edit' || $action == 'delete') { // Emailing - if (!empty($conf->mailing->enabled)) { + if (isModEnabled('mailing')) { $langs->load("mails"); $this->tpl['nb_emailing'] = $this->object->getNbOfEMailings(); } diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index c311bf80d1d..63527452fe1 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -58,7 +58,7 @@ $userid = GETPOST('userid', 'int'); $socid = GETPOST('socid', 'int'); $ref = GETPOST('ref', 'alpha'); -if (!empty($conf->mailmanspip->enabled)) { +if (isModEnabled('mailmanspip')) { include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; $langs->load('mailmanspip'); @@ -475,7 +475,7 @@ if (empty($reshook)) { $object->phone_perso = $phone_perso; $object->phone_mobile = $phone_mobile; $object->socialnetworks = array(); - if (!empty($conf->socialnetworks->enabled)) { + if (isModEnabled('socialnetworks')) { foreach ($socialnetworks as $key => $value) { if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') { $object->socialnetworks[$key] = GETPOST("member_".$key, 'alphanohtml'); @@ -1089,7 +1089,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("PhoneMobile").''; print ''.img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"').''; - if (!empty($conf->socialnetworks->enabled)) { + if (isModEnabled('socialnetworks')) { foreach ($socialnetworks as $key => $value) { if (!$value['active']) { break; @@ -1110,7 +1110,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print "\n"; // Categories - if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { print ''.$form->editfieldkey("Categories", 'memcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1); print img_picto('', 'category').$form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); @@ -1331,7 +1331,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("PhoneMobile").''; print ''.img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"').'phone_mobile).'">'; - if (!empty($conf->socialnetworks->enabled)) { + if (isModEnabled('socialnetworks')) { foreach ($socialnetworks as $key => $value) { if (!$value['active']) { break; @@ -1359,7 +1359,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print "\n"; // Categories - if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { print ''.$form->editfieldkey("Categories", 'memcats', '', $object, 0).''; print ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1); @@ -1376,7 +1376,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Third party Dolibarr - if (!empty($conf->societe->enabled)) { + if (isModEnabled('societe')) { print ''.$langs->trans("LinkedToDolibarrThirdParty").''; if ($object->socid) { $company = new Societe($db); @@ -1449,12 +1449,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $formquestion = array( array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login) ); - if (!empty($conf->societe->enabled) && $object->socid > 0) { + if (isModEnabled('societe') && $object->socid > 0) { $object->fetch_thirdparty(); $formquestion[] = array('label' => $langs->trans("UserWillBe"), 'type' => 'radio', 'name' => 'internalorexternal', 'default'=>'external', 'values' => array('external'=>$langs->trans("External").' - '.$langs->trans("LinkedToDolibarrThirdParty").' '.$object->thirdparty->getNomUrl(1, '', 0, 1), 'internal'=>$langs->trans("Internal"))); } $text = ''; - if (!empty($conf->societe->enabled) && $object->socid <= 0) { + if (isModEnabled('societe') && $object->socid <= 0) { $text .= $langs->trans("UserWillBeInternalUser").'
'; } $text .= $langs->trans("ConfirmCreateLogin"); @@ -1541,10 +1541,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($object->email) { $formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (getDolGlobalString('ADHERENT_DEFAULT_SENDINFOBYMAIL') ? true : false)); } - if (!empty($conf->mailman->enabled) && !empty($conf->global->ADHERENT_USE_MAILMAN)) { + if (isModEnabled('mailman') && !empty($conf->global->ADHERENT_USE_MAILMAN)) { $formquestion[] = array('type'=>'other', 'label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"), 'value'=>''); } - if (!empty($conf->mailman->enabled) && !empty($conf->global->ADHERENT_USE_SPIP)) { + if (isModEnabled('mailman') && !empty($conf->global->ADHERENT_USE_SPIP)) { $formquestion[] = array('type'=>'other', 'label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"), 'value'=>''); } print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ValidateMember"), $langs->trans("ConfirmValidateMember"), "confirm_valid", $formquestion, 'yes', 1, 220); @@ -1692,7 +1692,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { $rowspan++; } - if (!empty($conf->societe->enabled)) { + if (isModEnabled('societe')) { $rowspan++; } @@ -1783,7 +1783,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Tags / Categories - if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { print ''; print ''."\n"; print ''."\n"; print ''."\n"; print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); @@ -1813,7 +1813,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; // Third party Dolibarr - if (!empty($conf->societe->enabled)) { + if (isModEnabled('societe')) { print '
'; $editenable = $user->rights->adherent->creer; print $form->editfieldkey('LinkedToDolibarrThirdParty', 'thirdparty', '', $object, $editenable); @@ -1951,7 +1951,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Create third party - if (!empty($conf->societe->enabled) && !$object->socid) { + if (isModEnabled('societe') && !$object->socid) { if ($user->rights->societe->creer) { if (Adherent::STATUS_DRAFT != $object->statut) { print ''.$langs->trans("CreateDolibarrThirdParty").''."\n"; @@ -1977,7 +1977,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Action SPIP - if (!empty($conf->mailmanspip->enabled) && !empty($conf->global->ADHERENT_USE_SPIP)) { + if (isModEnabled('mailmanspip') && !empty($conf->global->ADHERENT_USE_SPIP)) { $isinspip = $mailmanspip->is_in_spip($object); if ($isinspip == 1) { @@ -2034,7 +2034,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { */ // Show online payment link - $useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)); + $useonlinepayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox')); if ($useonlinepayment) { print '
'; diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 3fa4c4b3e7f..c19fa40c2bc 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -89,7 +89,7 @@ $arrayfields = array( 'd.firstname'=>array('label'=>"Firstname", 'checked'=>1), 'd.login'=>array('label'=>"Login", 'checked'=>1), 't.libelle'=>array('label'=>"Label", 'checked'=>1), - 'd.bank'=>array('label'=>"BankAccount", 'checked'=>1, 'enabled'=>(!empty($conf->banque->enabled))), + 'd.bank'=>array('label'=>"BankAccount", 'checked'=>1, 'enabled'=>(isModEnabled('banque'))), /*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0), 'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/ 'c.dateadh'=>array('label'=>"DateSubscription", 'checked'=>1, 'position'=>100), diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 52926cf1b19..3221738bcd3 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -184,7 +184,7 @@ if (!empty($triggers)) { } //print 'module='.$module.' code='.$trigger['code'].'
'; - if (!empty($conf->$module->enabled)) { + if (isModEnabled('module')) { // Discard special case: If option FICHINTER_CLASSIFY_BILLED is not set, we discard both trigger FICHINTER_CLASSIFY_BILLED and FICHINTER_CLASSIFY_UNBILLED if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) { continue; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 79aa081ddef..166c24f2188 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -206,7 +206,7 @@ $job->fetch(0, 'ActionComm', 'sendEmailsReminder'); // AGENDA REMINDER EMAIL print '
'.$langs->trans('AGENDA_REMINDER_EMAIL', $langs->transnoentities("Module2300Name")); -if (!empty($conf->cron->enabled)) { +if (isModEnabled('cron')) { if (!empty($conf->global->AGENDA_REMINDER_EMAIL)) { if ($job->id > 0) { if ($job->status == $job::STATUS_ENABLED) { @@ -219,7 +219,7 @@ print ' '."\n"; -if (empty($conf->cron->enabled)) { +if (!isModEnabled('cron')) { print ''.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Module2300Name")).''; } else { if (empty($conf->global->AGENDA_REMINDER_EMAIL)) {