diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index f997c44ef6e..dd4748a99f1 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -68,7 +68,7 @@ $conditions = array( 'USERSIGN' => 1, 'MAILING' => isModEnabled('mailing'), 'MAIL' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande')), - 'TICKET' => !empty($conf->ticket->enabled), + 'TICKET' => isModEnabled('ticket'), ); // Picto $picto = array( diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 0daf46c2588..02eef8a00d3 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -207,7 +207,7 @@ if (isModEnabled("expedition")) { if (isModEnabled("reception")) { $elementList['reception_send'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendReception')); } -if (!empty($conf->ficheinter->enabled)) { +if (isModEnabled('ficheinter')) { $elementList['fichinter_send'] = img_picto('', 'intervention', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendIntervention')); } if (isModEnabled('supplier_proposal')) { @@ -222,7 +222,7 @@ if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->facture-> if (isModEnabled('contrat') && !empty($user->rights->contrat->lire)) { $elementList['contract'] = img_picto('', 'contract', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendContract')); } -if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) { +if (isModEnabled('ticket') && !empty($user->rights->ticket->read)) { $elementList['ticket_send'] = img_picto('', 'ticket', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToTicket')); } if (isModEnabled('expensereport') && !empty($user->rights->expensereport->lire)) { diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 824643093ad..10f32eed97d 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -75,7 +75,7 @@ $workflowcodes = array( 'WORKFLOW_TICKET_CREATE_INTERVENTION' => array ( 'family'=>'create', 'position'=>25, - 'enabled'=>(!empty($conf->ticket->enabled) && !empty($conf->ficheinter->enabled)), + 'enabled'=>(isModEnabled('ticket') && isModEnabled('ficheinter')), 'picto'=>'ticket' ), @@ -133,7 +133,7 @@ $workflowcodes = array( 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION'=>array( 'family'=>'classify_supplier_order', 'position'=>63, - 'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && (isModEnabled("reception")) && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled))), + 'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && (isModEnabled("reception")) && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !isModEnabled('supplier_order'))), 'picto'=>'supplier_order', 'warning'=>'' ), @@ -141,7 +141,7 @@ $workflowcodes = array( 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED'=>array( 'family'=>'classify_supplier_order', 'position'=>64, - 'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && (isModEnabled("reception")) && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled))), + 'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && (isModEnabled("reception")) && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !isModEnabled('supplier_order'))), 'picto'=>'supplier_order', 'warning'=>'' ), @@ -174,13 +174,13 @@ $workflowcodes = array( 'WORKFLOW_TICKET_LINK_CONTRACT' => array( 'family' => 'link_ticket', 'position' => 75, - 'enabled' => !empty($conf->ticket->enabled) && !empty($conf->contract->enabled), + 'enabled' => isModEnabled('ticket') && !empty($conf->contract->enabled), 'picto' => 'ticket' ), 'WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS' => array( 'family' => 'link_ticket', 'position' => 76, - 'enabled' => !empty($conf->ticket->enabled) && !empty($conf->contract->enabled), + 'enabled' => isModEnabled('ticket') && !empty($conf->contract->enabled), 'picto' => 'ticket' ), ); diff --git a/htdocs/asset/agenda.php b/htdocs/asset/agenda.php index 4d1e6d4be56..b40ed122ec6 100644 --- a/htdocs/asset/agenda.php +++ b/htdocs/asset/agenda.php @@ -128,7 +128,7 @@ if ($object->id > 0) { $help_url = 'EN:Module_Agenda_En'; llxHeader('', $title, $help_url); - if (!empty($conf->notification->enabled)) { + if (isModEnabled('notification')) { $langs->load("mails"); } $head = assetPrepareHead($object); diff --git a/htdocs/asset/model/agenda.php b/htdocs/asset/model/agenda.php index e0a463ec112..17fb19fe565 100644 --- a/htdocs/asset/model/agenda.php +++ b/htdocs/asset/model/agenda.php @@ -130,7 +130,7 @@ if ($object->id > 0) { $help_url = 'EN:Module_Agenda_En'; llxHeader('', $title, $help_url); - if (!empty($conf->notification->enabled)) { + if (isModEnabled('notification')) { $langs->load("mails"); } $head = assetModelPrepareHead($object); diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index d6e1517344a..15af4a532fa 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -165,7 +165,7 @@ class BlockedLog */ // Donation - if (!empty($conf->don->enabled)) { + if (isModEnabled('don')) { $this->trackedevents['DON_VALIDATE'] = 'logDON_VALIDATE'; $this->trackedevents['DON_DELETE'] = 'logDON_DELETE'; //$this->trackedevents['DON_SENTBYMAIL']='logDON_SENTBYMAIL'; diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index ac3f672ad33..0c0ede5d30f 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -130,7 +130,7 @@ if ($object->id > 0) { $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Agenda'; llxHeader('', $title, $help_url); - if (!empty($conf->notification->enabled)) { + if (isModEnabled('notification')) { $langs->load("mails"); } $head = bomPrepareHead($object); diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 294d57fea9c..af4050f455f 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -353,7 +353,7 @@ if (empty($reshook)) { } $text = $langs->trans('ConfirmValidateBom', $numref); - /*if (! empty($conf->notification->enabled)) + /*if (isModEnabled('notification')) { require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; $notify = new Notify($db); @@ -362,7 +362,7 @@ if (empty($reshook)) { }*/ $formquestion = array(); - if (!empty($conf->bom->enabled)) { + if (isModEnabled('bom')) { $langs->load("mrp"); $forcecombo = 0; if ($conf->browser->name == 'ie') { @@ -381,7 +381,7 @@ if (empty($reshook)) { // Confirmation of closing if ($action == 'close') { $text = $langs->trans('ConfirmCloseBom', $object->ref); - /*if (! empty($conf->notification->enabled)) + /*if (isModEnabled('notification')) { require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; $notify = new Notify($db); @@ -390,7 +390,7 @@ if (empty($reshook)) { }*/ $formquestion = array(); - if (!empty($conf->bom->enabled)) { + if (isModEnabled('bom')) { $langs->load("mrp"); $forcecombo = 0; if ($conf->browser->name == 'ie') { @@ -409,7 +409,7 @@ if (empty($reshook)) { // Confirmation of reopen if ($action == 'reopen') { $text = $langs->trans('ConfirmReopenBom', $object->ref); - /*if (! empty($conf->notification->enabled)) + /*if (isModEnabled('notification')) { require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; $notify = new Notify($db); @@ -418,7 +418,7 @@ if (empty($reshook)) { }*/ $formquestion = array(); - if (!empty($conf->bom->enabled)) { + if (isModEnabled('bom')) { $langs->load("mrp"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $forcecombo = 0; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 1eca4555e91..f6ae06b1f7f 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -60,7 +60,7 @@ if (isModEnabled('contrat')) { if (isModEnabled('adherent')) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; } -if (!empty($conf->ficheinter->enabled)) { +if (isModEnabled('ficheinter')) { require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; } @@ -82,10 +82,10 @@ if (isModEnabled('facture')) { if (isModEnabled('project')) { $langs->load("projects"); } -if (!empty($conf->ficheinter->enabled)) { +if (isModEnabled('ficheinter')) { $langs->load("interventions"); } -if (!empty($conf->notification->enabled)) { +if (isModEnabled('notification')) { $langs->load("mails"); } @@ -545,7 +545,7 @@ if ($object->id > 0) { } // Warehouse - if (!empty($conf->stock->enabled) && !empty($conf->global->SOCIETE_ASK_FOR_WAREHOUSE)) { + if (isModEnabled('stock') && !empty($conf->global->SOCIETE_ASK_FOR_WAREHOUSE)) { $langs->load('stocks'); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); @@ -1231,7 +1231,7 @@ if ($object->id > 0) { /* * Latest interventions */ - if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) { + if (isModEnabled('ficheinter') && $user->rights->ficheinter->lire) { $sql = "SELECT s.nom, s.rowid, f.rowid as id, f.ref, f.fk_statut, f.duree as duration, f.datei as startdate, f.entity"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f"; $sql .= " WHERE f.fk_soc = s.rowid"; @@ -1564,7 +1564,7 @@ if ($object->id > 0) { print '
'.$langs->trans("AddContract").'
'; } - if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer && $object->status == 1) { + if (isModEnabled('ficheinter') && $user->rights->ficheinter->creer && $object->status == 1) { $langs->load("fichinter"); print '
'.$langs->trans("AddIntervention").'
'; } diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 01f3bba9eff..27f9b91a9d7 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; -if (!empty($conf->ficheinter->enabled)) { +if (isModEnabled('ficheinter')) { require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; } @@ -104,7 +104,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO $supplierorderstatic = new CommandeFournisseur($db); } -if (!empty($conf->ficheinter->enabled)) { +if (isModEnabled('ficheinter')) { $fichinterstatic = new Fichinter($db); } @@ -519,7 +519,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO /* * Draft interventionals */ -if (!empty($conf->ficheinter->enabled)) { +if (isModEnabled('ficheinter')) { $sql = "SELECT f.rowid, f.ref, s.nom as name, f.fk_statut"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 5a92ff25695..5b2d7197eb7 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -55,7 +55,7 @@ if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } -if (!empty($conf->variants->enabled)) { +if (isModEnabled('variants')) { require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; } @@ -976,7 +976,7 @@ if (empty($reshook)) { $error++; } - if (!$error && !empty($conf->variants->enabled) && $prod_entry_mode != 'free') { + if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') { if ($combinations = GETPOST('combinations', 'array')) { //Check if there is a product with the given combination $prodcomb = new ProductCombination($db); @@ -1696,7 +1696,7 @@ if ($action == 'create') { if ($soc->fk_warehouse > 0) { $warehouse_id = $soc->fk_warehouse; } - if (!empty($conf->stock->enabled) && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { + if (isModEnabled('stock') && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) { $warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE; } @@ -1836,7 +1836,7 @@ if ($action == 'create') { } // Warehouse - if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { + if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); print ''.$langs->trans('Warehouse').''; @@ -2209,7 +2209,7 @@ if ($action == 'create') { } } - if (!empty($conf->notification->enabled)) { + if (isModEnabled('notification')) { require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; $notify = new Notify($db); $formquestion = array_merge($formquestion, array( @@ -2248,7 +2248,7 @@ if ($action == 'create') { } $text = $langs->trans('ConfirmValidateProp', $numref); - if (!empty($conf->notification->enabled)) { + if (isModEnabled('notification')) { require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; $notify = new Notify($db); $text .= '
'; @@ -2520,7 +2520,7 @@ if ($action == 'create') { } // Warehouse - if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { + if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { $langs->load('stocks'); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); @@ -2880,7 +2880,7 @@ if ($action == 'create') { } // Create an intervention - if (isModEnabled("service") && !empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) { + if (isModEnabled("service") && isModEnabled('ficheinter') && $object->statut == Propal::STATUS_SIGNED) { if ($usercancreateintervention) { $langs->load("interventions"); print ''.$langs->trans("AddIntervention").''; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 576c4ed31fa..63399aa7a34 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1095,7 +1095,7 @@ if ($resql) { $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle, (empty($conf->dol_optimize_smallscreen) ? 'maxwidth300 widthcentpercentminusx' : 'maxwidth250 widthcentpercentminusx')); $moreforfilter .= ''; } - if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { + if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); $moreforfilter .= '
'; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index ead1d09b44b..ddaaa57eeba 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -58,7 +58,7 @@ if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } -if (!empty($conf->variants->enabled)) { +if (isModEnabled('variants')) { require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; } @@ -66,10 +66,10 @@ if (!empty($conf->variants->enabled)) { // Load translation files required by the page $langs->loadLangs(array('orders', 'sendings', 'companies', 'bills', 'propal', 'deliveries', 'products', 'other')); -if (!empty($conf->incoterm->enabled)) { +if (isModEnabled('incoterm')) { $langs->load('incoterm'); } -if (!empty($conf->margin->enabled)) { +if (isModEnabled('margin')) { $langs->load('margins'); } if (isModEnabled('productbatch')) { @@ -603,7 +603,7 @@ if (empty($reshook)) { $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } } - } elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) { + } elseif ($action == 'set_incoterms' && isModEnabled('incoterm')) { // Set incoterm $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); if ($result < 0) { @@ -724,7 +724,7 @@ if (empty($reshook)) { $error++; } - if (!$error && !empty($conf->variants->enabled) && $prod_entry_mode != 'free') { + if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') { if ($combinations = GETPOST('combinations', 'array')) { //Check if there is a product with the given combination $prodcomb = new ProductCombination($db); @@ -1242,7 +1242,7 @@ if (empty($reshook)) { } // Check parameters - if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { + if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { if (!$idwarehouse || $idwarehouse == -1) { $error++; setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); @@ -1262,7 +1262,7 @@ if (empty($reshook)) { if ( GETPOST('generate_deposit', 'alpha') == 'on' && !empty($deposit_percent_from_payment_terms) - && !empty($conf->facture->enabled) && !empty($user->rights->facture->creer) + && isModEnabled('facture') && !empty($user->rights->facture->creer) ) { require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; @@ -1336,7 +1336,7 @@ if (empty($reshook)) { } // Check parameters - if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { + if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { if (!$idwarehouse || $idwarehouse == -1) { $error++; setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); @@ -1384,7 +1384,7 @@ if (empty($reshook)) { } // Check parameters - if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { + if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { if (!$idwarehouse || $idwarehouse == -1) { $error++; setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); @@ -1705,7 +1705,7 @@ if ($action == 'create' && $usercancreate) { if ($soc->fk_warehouse > 0) { $warehouse_id = $soc->fk_warehouse; } - if (!empty($conf->stock->enabled) && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { + if (isModEnabled('stock') && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) { $warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE; } @@ -1838,7 +1838,7 @@ if ($action == 'create' && $usercancreate) { } // Warehouse - if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { + if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); print ''.$langs->trans('Warehouse').''; @@ -2062,7 +2062,7 @@ if ($action == 'create' && $usercancreate) { } $text = $langs->trans('ConfirmValidateOrder', $numref); - if (!empty($conf->notification->enabled)) { + if (isModEnabled('notification')) { require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; $notify = new Notify($db); $text .= '
'; @@ -2077,7 +2077,7 @@ if ($action == 'create' && $usercancreate) { } $formquestion = array(); - if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { + if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); @@ -2231,7 +2231,7 @@ if ($action == 'create' && $usercancreate) { $text = $langs->trans('ConfirmUnvalidateOrder', $object->ref); $formquestion = array(); - if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { + if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); @@ -2270,7 +2270,7 @@ if ($action == 'create' && $usercancreate) { $text = $langs->trans('ConfirmCancelOrder', $object->ref); $formquestion = array(); - if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { + if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $qualified_for_stock_change) { $langs->load("stocks"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); @@ -2483,7 +2483,7 @@ if ($action == 'create' && $usercancreate) { } // Warehouse - if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { + if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { $langs->load('stocks'); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); @@ -2827,7 +2827,7 @@ if ($action == 'create' && $usercancreate) { } // Create intervention - if (!empty($conf->ficheinter->enabled)) { + if (isModEnabled('ficheinter')) { $langs->load("interventions"); if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 6d0693d6346..aa7a7f11a55 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -514,7 +514,7 @@ class Commande extends CommonOrder if (!$error) { // If stock is incremented on validate order, we must increment it - if ($result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { + if ($result >= 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); @@ -642,7 +642,7 @@ class Commande extends CommonOrder } // If stock is decremented on validate order, we must reincrement it - if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { + if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { $result = 0; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; @@ -827,7 +827,7 @@ class Commande extends CommonOrder dol_syslog(get_class($this)."::cancel", LOG_DEBUG); if ($this->db->query($sql)) { // If stock is decremented on validate order, we must reincrement it - if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { + if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER == 1) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 89831fbd929..5cde78cd09f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1305,7 +1305,7 @@ if ($resql) { print $langs->trans('ValidateInvoices'); print ''; print ''; - if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { + if (isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { print $form->selectyesno('validate_invoices', 0, 1, 1); print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')'; } else { @@ -1371,7 +1371,7 @@ if ($resql) { $moreforfilter .= '
'; } // If Stock is enabled - if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { + if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); $moreforfilter .= '
'; @@ -2385,7 +2385,7 @@ if ($resql) { // Show shippable Icon (this creates subloops, so may be slow) if (!empty($arrayfields['shippable']['checked'])) { print ''; - if (!empty($show_shippable_command) && !empty($conf->stock->enabled)) { + if (!empty($show_shippable_command) && isModEnabled('stock')) { if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) { $generic_commande->getLinesArray(); // Load array ->lines $generic_commande->loadExpeditions(); // Load array ->expeditions diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 7e9264614cd..ea371e804f3 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -601,7 +601,7 @@ if (isModEnabled('multicompany') && is_object($mc)) { print '
'; // Project filter -if (!empty($conf->projet->enabled)) { +if (isModEnabled('projet')) { $formproject = new FormProjets($db); $langs->load('projects'); print ''.$langs->trans('Project').":"; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3c407a834e6..767958e1c4d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4119,7 +4119,7 @@ if ($action == 'create') { } $text = $langs->trans('ConfirmValidateBill', $numref); - if (!empty($conf->notification->enabled)) { + if (isModEnabled('notification')) { require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; $notify = new Notify($db); $text .= '
'; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a286e93b9d0..67d5568e438 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1012,7 +1012,7 @@ class Facture extends CommonInvoice // else we get the best supplier price if ($conf->global->MARGIN_TYPE == 'costprice' && !empty($producttmp->cost_price)) { $buyprice = $producttmp->cost_price; - } elseif (!empty($conf->stock->enabled) && ($conf->global->MARGIN_TYPE == 'costprice' || $conf->global->MARGIN_TYPE == 'pmp') && !empty($producttmp->pmp)) { + } elseif (isModEnabled('stock') && ($conf->global->MARGIN_TYPE == 'costprice' || $conf->global->MARGIN_TYPE == 'pmp') && !empty($producttmp->pmp)) { $buyprice = $producttmp->pmp; } else { if ($producttmp->find_min_price_product_fournisseur($_facrec->lines[$i]->fk_product) > 0) { @@ -2655,7 +2655,7 @@ class Facture extends CommonInvoice } // If we decrease stock on invoice validation, we increase back if a warehouse id was provided - if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse != -1) { + if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse != -1) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); @@ -3162,7 +3162,7 @@ class Facture extends CommonInvoice $result = $this->thirdparty->set_as_client(); // If active we decrement the main product and its components at invoice validation - if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse > 0) { + if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse > 0) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); @@ -3475,7 +3475,7 @@ class Facture extends CommonInvoice } // If we decrease stock on invoice validation, we increase back - if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { + if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index ff18b06c44a..fcab597d43a 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -170,7 +170,7 @@ if ($object->thirdparty->client) { } } -if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) { +if (isModEnabled('ficheinter') && $user->rights->ficheinter->lire) { $elementTypeArray['fichinter'] = $langs->transnoentitiesnoconv('Interventions'); } diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index dc67ccc87d4..bf75a3350a7 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -87,7 +87,7 @@ if ($id > 0) { /* * Affichage onglets */ - if (!empty($conf->notification->enabled)) { + if (isModEnabled('notification')) { $langs->load("mails"); } diff --git a/htdocs/contact/project.php b/htdocs/contact/project.php index 2c5ffb78e5d..571fa57e428 100644 --- a/htdocs/contact/project.php +++ b/htdocs/contact/project.php @@ -68,7 +68,7 @@ if ($id) { } llxHeader('', $title); - if (!empty($conf->notification->enabled)) { + if (isModEnabled('notification')) { $langs->load("mails"); } $head = contact_prepare_head($object); diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 928dff1aea6..d46f2cb24a7 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -138,7 +138,7 @@ if ($id > 0) { } llxHeader('', $title); - if (!empty($conf->notification->enabled)) { + if (isModEnabled('notification')) { $langs->load("mails"); } $head = contract_prepare_head($object); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 6ab6b6943a7..95997812e4a 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -912,12 +912,12 @@ if ($action == 'remove_file') { if (!$error && $massaction == 'validate' && $permissiontoadd) { $objecttmp = new $objectclass($db); - if (($objecttmp->element == 'facture' || $objecttmp->element == 'invoice') && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { + if (($objecttmp->element == 'facture' || $objecttmp->element == 'invoice') && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { $langs->load("errors"); setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); $error++; } - if ($objecttmp->element == 'invoice_supplier' && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) { + if ($objecttmp->element == 'invoice_supplier' && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) { $langs->load("errors"); setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); $error++; diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 4be56eee072..f928ebd7c6f 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -64,7 +64,7 @@ class box_produits_alerte_stock extends ModeleBoxes $this->db = $db; $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); - $tmpentry = array('enabled'=>((isModEnabled("product") || isModEnabled("service")) && !empty($conf->stock->enabled)), 'perms'=>!empty($user->rights->stock->lire), 'module'=>'product|service|stock'); + $tmpentry = array('enabled'=>((isModEnabled("product") || isModEnabled("service")) && isModEnabled('stock')), 'perms'=>!empty($user->rights->stock->lire), 'module'=>'product|service|stock'); $showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal); $this->hidden = ($showmode != 1); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 14236b5e332..7913c1d1ef7 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2313,7 +2313,7 @@ class Form } $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); - if (!empty($conf->variants->enabled) && is_array($selected_combinations)) { + if (isModEnabled('variants') && is_array($selected_combinations)) { // Code to automatically insert with javascript the select of attributes under the select of product // when a parent of variant has been selected. $out .= ' @@ -2944,7 +2944,7 @@ class Form if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { $opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqup="'.$objp->price_by_qty_unitprice.'" data-pbqbase="'.$objp->price_by_qty_price_base_type.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"'; } - if (!empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { + if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { if (!empty($user->rights->stock->lire)) { if ($objp->stock > 0) { $opt .= ' class="product_line_stock_ok"'; @@ -3101,7 +3101,7 @@ class Form $outdefault_vat_code = $objp->default_vat_code; } - if (!empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { + if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { if (!empty($user->rights->stock->lire)) { $opt .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); @@ -3486,7 +3486,7 @@ class Form } } - if (!empty($conf->stock->enabled) && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { + if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { $novirtualstock = ($showstockinlist == 2); if (!empty($user->rights->stock->lire)) { @@ -8614,7 +8614,7 @@ class Form } } elseif ($objecttype == 'ficheinter') { $tplpath = 'fichinter'; - if (empty($conf->ficheinter->enabled)) { + if (!isModEnabled('ficheinter')) { continue; // Do not show if module disabled } } elseif ($objecttype == 'invoice_supplier') { diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 915a5083ce8..5f27cbf3477 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -1026,7 +1026,7 @@ class FormCompany extends Form public function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '', $allowempty = '') { global $conf, $langs; - if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->fournisseur->enabled)) { + if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && !isModEnabled('fournisseur')) { return '' ; } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index aa54b3f330c..a2abdbb7cc6 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1634,7 +1634,7 @@ class FormMail extends Form if (isModEnabled('adherent')) { $tmparray['__SECUREKEYPAYMENT_MEMBER__'] = 'SecureKeyPAYMENTUniquePerMember'; } - if (!empty($conf->don->enabled)) { + if (isModEnabled('don')) { $tmparray['__SECUREKEYPAYMENT_DONATION__'] = 'SecureKeyPAYMENTUniquePerDonation'; } if (isModEnabled('facture')) { @@ -1651,7 +1651,7 @@ class FormMail extends Form if (isModEnabled('adherent')) { $tmparray['__ONLINEPAYMENTLINK_MEMBER__'] = 'OnlinePaymentLinkUniquePerMember'; } - if (!empty($conf->don->enabled)) { + if (isModEnabled('don')) { $tmparray['__ONLINEPAYMENTLINK_DONATION__'] = 'OnlinePaymentLinkUniquePerDonation'; } if (isModEnabled('facture')) { diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index e079cd431dd..948af4e2868 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -92,7 +92,7 @@ function contact_prepare_head(Contact $object) } // Related items - if (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || !empty($conf->ficheinter->enabled) || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { + if (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || isModEnabled('ficheinter') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { $head[$tab][0] = DOL_URL_ROOT.'/contact/consumption.php?id='.$object->id; $head[$tab][1] = $langs->trans("Referers"); $head[$tab][2] = 'consumption'; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 92a0255d76d..0ad7f6d6eb6 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2948,7 +2948,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, if (($fuser->rights->stock->{$lire} || $fuser->rights->stock->movement->{$lire} || $fuser->rights->stock->mouvement->{$lire}) || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $original_file = $conf->stock->multidir_output[$entity].'/movement/'.$original_file; } } elseif ($modulepart == 'contract' && !empty($conf->contrat->multidir_output[$entity])) { diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 6b66c8d68e7..c65013722d4 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -157,7 +157,7 @@ function ordersupplier_prepare_head(CommandeFournisseur $object) $h++; } - if (!empty($conf->stock->enabled) && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) { + if (isModEnabled('stock') && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) { $langs->load("stocks"); $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$object->id; $head[$h][1] = $langs->trans("OrderDispatch"); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 90bf079f687..a6b76fdc909 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7404,7 +7404,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__MEMBER_NOTE_PRIVATE__'] = '__MEMBER_NOTE_PRIVATE__';*/ } // add variables subtitutions ticket - if (!empty($conf->ticket->enabled) && (!is_object($object) || $object->element == 'ticket')) { + if (isModEnabled('ticket') && (!is_object($object) || $object->element == 'ticket')) { $substitutionarray['__TICKET_TRACKID__'] = '__TICKET_TRACKID__'; $substitutionarray['__TICKET_SUBJECT__'] = '__TICKET_SUBJECT__'; $substitutionarray['__TICKET_TYPE__'] = '__TICKET_TYPE__'; diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 0d2edb4805e..da6a6c5e1f8 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -94,7 +94,7 @@ function product_prepare_head($object) $h++; } - if (!empty($conf->variants->enabled) && ($object->isProduct() || $object->isService())) { + if (isModEnabled('variants') && ($object->isProduct() || $object->isService())) { global $db; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; @@ -115,7 +115,7 @@ function product_prepare_head($object) } if ($object->isProduct() || ($object->isService() && !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { // If physical product we can stock (or service with option) - if (!empty($conf->stock->enabled) && $user->rights->stock->lire) { + if (isModEnabled('stock') && $user->rights->stock->lire) { $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$object->id; $head[$h][1] = $langs->trans("Stock"); $head[$h][2] = 'stock'; @@ -547,7 +547,7 @@ function show_stats_for_company($product, $socid) } // BOM - if (!empty($conf->bom->enabled) && $user->rights->bom->read) { + if (isModEnabled('bom') && $user->rights->bom->read) { $nblines++; $ret = $product->load_stats_bom($socid); if ($ret < 0) { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 22668a16be4..81c27deee76 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -127,7 +127,7 @@ function project_prepare_head(Project $project, $moreparam = '') if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) || isModEnabled("propal") || isModEnabled('commande') || isModEnabled('facture') || isModEnabled('contrat') - || !empty($conf->ficheinter->enabled) || isModEnabled('agenda') || isModEnabled('deplacement') || !empty($conf->stock->enabled)) { + || isModEnabled('ficheinter') || isModEnabled('agenda') || isModEnabled('deplacement') || isModEnabled('stock')) { $nbElements = 0; // Enable caching of thirdrparty count Contacts $cachekey = 'count_elements_project_'.$project->id; @@ -135,7 +135,7 @@ function project_prepare_head(Project $project, $moreparam = '') if (!is_null($dataretrieved)) { $nbElements = $dataretrieved; } else { - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $nbElements += $project->getElementCount('stock', 'entrepot', 'fk_project'); } if (isModEnabled("propal")) { @@ -162,7 +162,7 @@ function project_prepare_head(Project $project, $moreparam = '') if (isModEnabled('contrat')) { $nbElements += $project->getElementCount('contract', 'contrat'); } - if (!empty($conf->ficheinter->enabled)) { + if (isModEnabled('ficheinter')) { $nbElements += $project->getElementCount('intervention', 'fichinter'); } if (isModEnabled("expedition")) { @@ -177,7 +177,7 @@ function project_prepare_head(Project $project, $moreparam = '') if (isModEnabled('expensereport')) { $nbElements += $project->getElementCount('expensereport', 'expensereport'); } - if (!empty($conf->don->enabled)) { + if (isModEnabled('don')) { $nbElements += $project->getElementCount('donation', 'don'); } if (!empty($conf->loan->enabled)) { @@ -189,7 +189,7 @@ function project_prepare_head(Project $project, $moreparam = '') if (isModEnabled('project')) { $nbElements += $project->getElementCount('project_task', 'projet_task'); } - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $nbElements += $project->getElementCount('stock_mouvement', 'stock'); } if (!empty($conf->salaries->enabled)) { diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 8e3c4f7112c..ffc455ab5f1 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -276,7 +276,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') print ''.$langs->trans("DateCreation").''; print ''.$langs->trans("DateDeliveryPlanned").''; print ''.$langs->trans("QtyPreparedOrShipped").''; - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { print ''.$langs->trans("Warehouse").''; } /*TODO Add link to expeditiondet_batch @@ -385,7 +385,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') print ''.$objp->qty_shipped.''; // Warehouse - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { print ''; if ($objp->warehouse_id > 0) { $warehousestatic->fetch($objp->warehouse_id); diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index f6690935416..9eb65532afc 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -107,7 +107,7 @@ function user_prepare_head(User $object) } // Notifications - if ($user->socid == 0 && !empty($conf->notification->enabled)) { + if ($user->socid == 0 && isModEnabled('notification')) { $nbNote = 0; $sql = "SELECT COUNT(n.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n"; diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index e44d8b59374..0cf58098967 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -162,7 +162,7 @@ class modBanque extends DolibarrModules "s.nom"=>"company", "s.code_compta"=>"company", "s.code_compta_fournisseur"=>"company" ); $this->export_special_array[$r] = array('-b.amount'=>'NULLIFNEG', 'b.amount'=>'NULLIFNEG'); - if ((empty($conf->fournisseur->enabled) && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled) || empty($conf->supplier_invoice->enabled)) { + if ((!isModEnabled('fournisseur') && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !isModEnabled('supplier_order') || !isModEnabled('supplier_invoice')) { unset($this->export_fields_array[$r]['s.code_compta_fournisseur']); unset($this->export_entities_array[$r]['s.code_compta_fournisseur']); } diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 96f84ecc198..4a8680502ae 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -154,7 +154,7 @@ class modCategorie extends DolibarrModules if (!empty($conf->bank->enabled)) { $typeexample .= ($typeexample ? " / " : "")."8=Bank line"; } - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $typeexample .= ($typeexample ? " / " : "")."9=Warehouse"; } if (isModEnabled('agenda')) { @@ -180,7 +180,7 @@ class modCategorie extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_0_'.Categorie::$MAP_ID_TO_CODE[0]; $this->export_label[$r] = 'CatProdList'; $this->export_icon[$r] = $this->picto; - $this->export_enabled[$r] = 'isModEnabled("product") || !empty($conf->service->enabled)'; + $this->export_enabled[$r] = 'isModEnabled("product") || isModEnabled("service")'; $this->export_permission[$r] = array(array("categorie", "lire"), array("produit", "export")); $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref', 'p.label'=>'Label'); $this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 'p.label'=>'Text'); diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 2023a5e2695..8d6a5fe0508 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -214,7 +214,7 @@ class modProduct extends DolibarrModules if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); } - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('e.ref'=>'DefaultWarehouse', 'p.tobatch'=>'ManageLotSerial', 'p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue')); } if (isModEnabled('barcode')) { @@ -252,7 +252,7 @@ class modProduct extends DolibarrModules 'p.tva_tx'=>'Numeric', 'p.datec'=>'Date', 'p.tms'=>'Date' ); - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('e.ref'=>'Text', 'p.tobatch'=>'Numeric', 'p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric')); } if (isModEnabled('barcode')) { @@ -271,7 +271,7 @@ class modProduct extends DolibarrModules if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) { $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category')); } - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product')); } if (isModEnabled('barcode')) { @@ -286,7 +286,7 @@ class modProduct extends DolibarrModules if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) { $this->export_dependencies_array[$r] = array('category'=>'p.rowid'); } - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product')); } if (isModEnabled('barcode')) { @@ -316,7 +316,7 @@ class modProduct extends DolibarrModules if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc'; } - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e ON e.rowid = p.fk_default_warehouse'; } $this->export_sql_end[$r] .= ' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')'; @@ -409,7 +409,7 @@ class modProduct extends DolibarrModules 'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell", 'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification' ); - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue')); } if (isModEnabled('barcode')) { @@ -425,7 +425,7 @@ class modProduct extends DolibarrModules 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", 'p.datec'=>'Date', 'p.tms'=>'Date' ); - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric')); } if (isModEnabled('barcode')) { @@ -441,7 +441,7 @@ class modProduct extends DolibarrModules 'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct", 'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct" ); - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct')); } if (isModEnabled('barcode')) { @@ -601,7 +601,7 @@ class modProduct extends DolibarrModules 'p.recuperableonly' => '^[0|1]$', ); - if (!empty($conf->stock->enabled)) {//if Stock module enabled + if (isModEnabled('stock')) {//if Stock module enabled $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array( 'p.fk_default_warehouse'=>'DefaultWarehouse', 'p.tobatch'=>'ManageLotSerial', @@ -710,7 +710,7 @@ class modProduct extends DolibarrModules 'p.finished' => '0 (raw material) / 1 (finished goods), matches field "code" in dictionary table "'.MAIN_DB_PREFIX.'c_product_nature"' ); //clauses copied from import_fields_array - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $import_sample = array_merge($import_sample, array( 'p.tobatch'=>"0 (don't use) / 1 (use batch) / 2 (use serial number)", 'p.seuil_stock_alerte' => '', diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index a6bfdd47433..7c8a88a5c7e 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -179,7 +179,7 @@ class modService extends DolibarrModules if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice')); } - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue')); } if (isModEnabled('barcode')) { @@ -215,7 +215,7 @@ class modService extends DolibarrModules 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.datec'=>'Date', 'p.tms'=>'Date' ); - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric')); } if (isModEnabled('barcode')) { @@ -234,7 +234,7 @@ class modService extends DolibarrModules if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) { $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category')); } - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product')); } if (isModEnabled('barcode')) { @@ -249,7 +249,7 @@ class modService extends DolibarrModules if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) { $this->export_dependencies_array[$r] = array('category'=>'p.rowid'); } - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product')); } if (isModEnabled('barcode')) { @@ -368,7 +368,7 @@ class modService extends DolibarrModules 'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell", 'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification' ); - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue')); } if (isModEnabled('barcode')) { @@ -384,7 +384,7 @@ class modService extends DolibarrModules 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", 'p.datec'=>'Date', 'p.tms'=>'Date' ); - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric')); } if (isModEnabled('barcode')) { @@ -400,7 +400,7 @@ class modService extends DolibarrModules 'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct", 'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct" ); - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct')); } if (isModEnabled('barcode')) { @@ -548,7 +548,7 @@ class modService extends DolibarrModules 'p.recuperableonly' => '^[0|1]$', ); - if (!empty($conf->stock->enabled)) {//if Stock module enabled + if (isModEnabled('stock')) {//if Stock module enabled $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array( 'p.fk_default_warehouse'=>'DefaultWarehouse', 'p.tobatch'=>'ManageLotSerial', @@ -656,7 +656,7 @@ class modService extends DolibarrModules 'p.finished' => '0 (raw material) / 1 (finished goods), matches field "code" in dictionary table "'.MAIN_DB_PREFIX.'c_product_nature"' ); //clauses copied from import_fields_array - if (!empty($conf->stock->enabled)) { + if (isModEnabled('stock')) { $import_sample = array_merge($import_sample, array( 'p.seuil_stock_alerte' => '', 'p.pmp' => '0', diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 5bc5c7da6cf..f5d26ed03ae 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -413,7 +413,7 @@ class modSociete extends DolibarrModules 't.libelle'=>"company", 's.entity'=>'company', ); // We define here only fields that use another picto - if (empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { + if (!isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { unset($this->export_fields_array[$r]['s.code_fournisseur']); unset($this->export_entities_array[$r]['s.code_fournisseur']); } diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 29050c6b780..8a8a4e373b7 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -58,7 +58,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO if (isModEnabled('contrat')) { require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; } -if (!empty($conf->ficheinter->enabled)) { +if (isModEnabled('ficheinter')) { require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; } if (isModEnabled('deplacement')) { diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 35f00912143..73d1d4e3d12 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -59,7 +59,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO if (isModEnabled('contrat')) { require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; } -if (!empty($conf->ficheinter->enabled)) { +if (isModEnabled('ficheinter')) { require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; } if (isModEnabled('deplacement')) { diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index a7eb433a021..70b684a387d 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -41,7 +41,7 @@ if (empty($object) || !is_object($object)) { exit; } $usemargins = 0; -if (!empty($conf->margin->enabled) && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) { +if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) { $usemargins = 1; } if (!isset($dateSelector)) { @@ -184,7 +184,7 @@ if ($nolinesbefore) { $freelines = true; $forceall = 1; // We always force all type for free lines (module product or service means we use predefined product or service) if ($object->element == 'contrat') { - if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) { + if (!isModEnabled('product') && !isModEnabled('service') && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) { $forceall = -1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set } elseif (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) { $forceall = 3; @@ -196,7 +196,7 @@ if ($nolinesbefore) { if ($forceall >= 0 && (isModEnabled("product") || isModEnabled("service"))) { echo '