diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index ca5757dc452..1db1afd124c 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -487,24 +487,24 @@ $tabcond[1] = (isModEnabled("societe")); $tabcond[2] = true; $tabcond[3] = true; $tabcond[4] = true; -$tabcond[5] = (isModEnabled("societe") || !empty($conf->adherent->enabled)); +$tabcond[5] = (isModEnabled("societe") || isModEnabled('adherent')); $tabcond[6] = isModEnabled('agenda'); -$tabcond[7] = !empty($conf->tax->enabled); +$tabcond[7] = isModEnabled('tax'); $tabcond[8] = isModEnabled("societe"); $tabcond[9] = true; $tabcond[10] = true; $tabcond[11] = (isModEnabled("societe")); -$tabcond[12] = (!empty($conf->commande->enabled) || isModEnabled("propal") || isModEnabled('facture') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice") || isModEnabled("supplier_order")); -$tabcond[13] = (!empty($conf->commande->enabled) || isModEnabled("propal") || isModEnabled('facture') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice") || isModEnabled("supplier_order")); +$tabcond[12] = (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice") || isModEnabled("supplier_order")); +$tabcond[13] = (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice") || isModEnabled("supplier_order")); $tabcond[14] = (isModEnabled("product") && (!empty($conf->ecotax->enabled) || !empty($conf->global->MAIN_SHOW_ECOTAX_DICTIONNARY))); $tabcond[15] = true; $tabcond[16] = (isModEnabled("societe") && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)); -$tabcond[17] = (!empty($conf->deplacement->enabled) || !empty($conf->expensereport->enabled)); +$tabcond[17] = (isModEnabled('deplacement') || isModEnabled('expensereport')); $tabcond[18] = isModEnabled("expedition") || isModEnabled("reception"); $tabcond[19] = isModEnabled("societe"); $tabcond[20] = (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order"); $tabcond[21] = isModEnabled("propal"); -$tabcond[22] = (!empty($conf->commande->enabled) || isModEnabled("propal")); +$tabcond[22] = (isModEnabled('commande') || isModEnabled("propal")); $tabcond[23] = true; $tabcond[24] = isModEnabled('resource'); $tabcond[25] = isModEnabled('website'); @@ -517,15 +517,15 @@ $tabcond[30] = isModEnabled('label'); $tabcond[32] = (isModEnabled('holiday') || isModEnabled('hrm')); $tabcond[33] = isModEnabled('hrm'); $tabcond[34] = isModEnabled('hrm'); -$tabcond[35] = !empty($conf->expensereport->enabled) && !empty($conf->global->MAIN_USE_EXPENSE_IK); -$tabcond[36] = !empty($conf->expensereport->enabled) && !empty($conf->global->MAIN_USE_EXPENSE_IK); +$tabcond[35] = isModEnabled('expensereport') && !empty($conf->global->MAIN_USE_EXPENSE_IK); +$tabcond[36] = isModEnabled('expensereport') && !empty($conf->global->MAIN_USE_EXPENSE_IK); $tabcond[37] = isModEnabled("product"); $tabcond[38] = isModEnabled('socialnetworks'); $tabcond[39] = (isModEnabled("societe") && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)); $tabcond[40] = (isModEnabled("societe") && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)); $tabcond[41] = isModEnabled('intracommreport'); $tabcond[42] = isModEnabled("product"); -$tabcond[43] = isModEnabled("product") && !empty($conf->productbatch->enabled) && $conf->global->MAIN_FEATURES_LEVEL >= 2; +$tabcond[43] = isModEnabled("product") && isModEnabled('productbatch') && $conf->global->MAIN_FEATURES_LEVEL >= 2; $tabcond[44] = isModEnabled('asset'); // List of help for fields (no more used, help is defined into tabcomplete) diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 04048ac83db..3c15fc9f48f 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -63,10 +63,10 @@ $conditions = array( 'NOTE_PRIVATE' => 1, 'SOCIETE' => 1, 'PRODUCTDESC' => (isModEnabled("product") || isModEnabled("service")), - 'DETAILS' => (isModEnabled('facture') || isModEnabled("propal") || !empty($conf->commande->enabled) || !empty($conf->supplier_proposal->enabled) || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")), + 'DETAILS' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande') || !empty($conf->supplier_proposal->enabled) || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")), 'USERSIGN' => 1, 'MAILING' => !empty($conf->mailing->enabled), - 'MAIL' => (isModEnabled('facture') || isModEnabled("propal") || !empty($conf->commande->enabled)), + 'MAIL' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande')), 'TICKET' => !empty($conf->ticket->enabled), ); // Picto diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 7f60b2260d7..a60f3f407d1 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -45,7 +45,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; // Load translation files required by the page $langsArray=array("errors", "admin", "mails", "languages"); -if (!empty($conf->adherent->enabled)) { +if (isModEnabled('adherent')) { $langsArray[]='members'; } if (!empty($conf->eventorganization->enabled)) { @@ -179,7 +179,7 @@ $elementList = array(); $elementList['all'] = '-- '.dol_escape_htmltag($langs->trans("All")).' --'; $elementList['none'] = '-- '.dol_escape_htmltag($langs->trans("None")).' --'; $elementList['user'] = img_picto('', 'user', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToUser')); -if (!empty($conf->adherent->enabled) && !empty($user->rights->adherent->lire)) { +if (isModEnabled('adherent') && !empty($user->rights->adherent->lire)) { $elementList['member'] = img_picto('', 'object_member', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToMember')); } if (!empty($conf->recruitment->enabled) && !empty($user->rights->recruitment->recruitmentjobposition->read)) { @@ -194,7 +194,7 @@ if (!empty($conf->project->enabled)) { if (isModEnabled("propal") && !empty($user->rights->propal->lire)) { $elementList['propal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendProposal')); } -if (!empty($conf->commande->enabled) && !empty($user->rights->commande->lire)) { +if (isModEnabled('commande') && !empty($user->rights->commande->lire)) { $elementList['order_send'] = img_picto('', 'order', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendOrder')); } if (isModEnabled('facture') && !empty($user->rights->facture->lire)) { @@ -224,7 +224,7 @@ if (!empty($conf->contrat->enabled) && !empty($user->rights->contrat->lire)) { if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) { $elementList['ticket_send'] = img_picto('', 'ticket', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToTicket')); } -if (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire)) { +if (isModEnabled('expensereport') && !empty($user->rights->expensereport->lire)) { $elementList['expensereport_send'] = img_picto('', 'trip', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToExpenseReport')); } if (isModEnabled('agenda')) { diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index ade62c29081..4103c8cd354 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -180,7 +180,7 @@ $formproduct = new FormProduct($db); $disabled = ''; -if (!empty($conf->productbatch->enabled)) { +if (isModEnabled('productbatch')) { $langs->load("productbatch"); $disabled = ' disabled'; print info_admin($langs->trans("WhenProductBatchModuleOnOptionAreForced")); @@ -226,7 +226,7 @@ $found++; print ''; print ''.$langs->trans("DeStockOnValidateOrder").''; print ''; -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1); } else { @@ -763,7 +763,7 @@ print "\n"; print "\n"; /* Disabled. Would be better to be managed with a user cookie -if (!empty($conf->productbatch->enabled)) { +if (isModEnabled('productbatch')) { print ''; print '' . $langs->trans("ShowAllBatchByDefault") . ''; print ''; diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index e1899b35a56..c4a8790896e 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -62,13 +62,13 @@ $workflowcodes = array( 'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array( 'family'=>'create', 'position'=>10, - 'enabled'=>(isModEnabled("propal") && !empty($conf->commande->enabled)), + 'enabled'=>(isModEnabled("propal") && isModEnabled('commande')), 'picto'=>'order' ), 'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array( 'family'=>'create', 'position'=>20, - 'enabled'=>(!empty($conf->commande->enabled) && isModEnabled('facture')), + 'enabled'=>(isModEnabled('commande') && isModEnabled('facture')), 'picto'=>'bill' ), 'WORKFLOW_TICKET_CREATE_INTERVENTION' => array ( @@ -84,7 +84,7 @@ $workflowcodes = array( 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array( 'family'=>'classify_proposal', 'position'=>30, - 'enabled'=>(isModEnabled("propal") && !empty($conf->commande->enabled)), + 'enabled'=>(isModEnabled("propal") && isModEnabled('commande')), 'picto'=>'propal', 'warning'=>'' ), @@ -100,19 +100,19 @@ $workflowcodes = array( 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array( // when shipping validated 'family'=>'classify_order', 'position'=>40, - 'enabled'=>(isModEnabled("expedition") && !empty($conf->commande->enabled)), + 'enabled'=>(isModEnabled("expedition") && isModEnabled('commande')), 'picto'=>'order' ), 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED'=>array( // when shipping closed 'family'=>'classify_order', 'position'=>41, - 'enabled'=>(isModEnabled("expedition") && !empty($conf->commande->enabled)), + 'enabled'=>(isModEnabled("expedition") && isModEnabled('commande')), 'picto'=>'order' ), 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array( 'family'=>'classify_order', 'position'=>42, - 'enabled'=>(isModEnabled('facture') && !empty($conf->commande->enabled)), + 'enabled'=>(isModEnabled('facture') && isModEnabled('commande')), 'picto'=>'order', 'warning'=>'' ), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card. diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 3ab2b63ad3f..ea9e5efca76 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -179,7 +179,7 @@ class BlockedLog } */ - if (!empty($conf->adherent->enabled)) { + if (isModEnabled('adherent')) { $this->trackedevents['MEMBER_SUBSCRIPTION_CREATE'] = 'logMEMBER_SUBSCRIPTION_CREATE'; $this->trackedevents['MEMBER_SUBSCRIPTION_MODIFY'] = 'logMEMBER_SUBSCRIPTION_MODIFY'; $this->trackedevents['MEMBER_SUBSCRIPTION_DELETE'] = 'logMEMBER_SUBSCRIPTION_DELETE'; diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index db9f28c7763..50aaca466e2 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -201,7 +201,7 @@ class CActionComm if ($obj->module == 'invoice' && isModEnabled('facture') && !empty($user->rights->facture->lire)) { $qualified = 1; } - if ($obj->module == 'order' && !empty($conf->commande->enabled) && empty($user->rights->commande->lire)) { + if ($obj->module == 'order' && isModEnabled('commande') && empty($user->rights->commande->lire)) { $qualified = 1; } if ($obj->module == 'propal' && isModEnabled("propal") && !empty($user->rights->propale->lire)) { diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 3e388677605..267b84285ee 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -47,7 +47,7 @@ if (isModEnabled('facture')) { if (isModEnabled("propal")) { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; } -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; } if (isModEnabled("expedition")) { @@ -56,7 +56,7 @@ if (isModEnabled("expedition")) { if (!empty($conf->contrat->enabled)) { require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; } -if (!empty($conf->adherent->enabled)) { +if (isModEnabled('adherent')) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; } if (!empty($conf->ficheinter->enabled)) { @@ -69,7 +69,7 @@ $langs->loadLangs(array('companies', 'banks')); if (!empty($conf->contrat->enabled)) { $langs->load("contracts"); } -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { $langs->load("orders"); } if (isModEnabled("expedition")) { @@ -510,7 +510,7 @@ if ($object->id > 0) { } if ($object->client) { - if (!empty($conf->commande->enabled) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)) { + if (isModEnabled('commande') && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)) { print ''."\n"; print ''; print ''; @@ -621,7 +621,7 @@ if ($object->id > 0) { include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; // Module Adherent - if (!empty($conf->adherent->enabled)) { + if (isModEnabled('adherent')) { $langs->load("members"); $langs->load("users"); @@ -718,7 +718,7 @@ if ($object->id > 0) { } } - if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->rights->commande->lire) { // Box commandes $tmp = $object->getOutstandingOrders(); $outstandingOpened = $tmp['opened']; @@ -913,7 +913,7 @@ if ($object->id > 0) { /* * Latest orders */ - if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->rights->commande->lire) { $param =""; $sql = "SELECT s.nom, s.rowid"; @@ -1553,7 +1553,7 @@ if ($object->id > 0) { print '
'.$langs->trans("AddProp").'
'; } - if (!empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status == 1) { + if (isModEnabled('commande') && $user->rights->commande->creer && $object->status == 1) { $langs->load("orders"); print '
'.$langs->trans("AddOrder").'
'; } @@ -1570,7 +1570,7 @@ if ($object->id > 0) { // Add invoice if ($user->socid == 0) { - if (!empty($conf->deplacement->enabled) && $object->status == 1) { + if (isModEnabled('deplacement') && $object->status == 1) { $langs->load("trips"); print '
'.$langs->trans("AddTrip").'
'; } @@ -1581,7 +1581,7 @@ if ($object->id > 0) { } else { $langs->loadLangs(array("orders", "bills")); - if (!empty($conf->commande->enabled)) { + if (isModEnabled('commande')) { if ($object->client != 0 && $object->client != 2) { if (!empty($orders2invoice) && $orders2invoice > 0) { print '
'.$langs->trans("CreateInvoiceForThisCustomer").'
'; diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 9eb37d80799..419f85cb28f 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -96,7 +96,7 @@ if (isModEnabled("propal")) { if (!empty($conf->supplier_proposal->enabled)) { $supplierproposalstatic = new SupplierProposal($db); } -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { $orderstatic = new Commande($db); } if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) { @@ -323,7 +323,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa * Draft customer orders */ -if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { +if (isModEnabled('commande') && $user->rights->commande->lire) { $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.total_tva, c.total_ttc, c.fk_statut as status"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; @@ -1007,7 +1007,7 @@ if (isModEnabled("propal") && $user->rights->propal->lire) { /* * Opened (validated) order */ -if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { +if (isModEnabled('commande') && $user->rights->commande->lire) { $sql = "SELECT c.rowid as commandeid, c.total_ttc, c.total_ht, c.total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed"; $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 e02ff5d8875..a0b181230fa 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1792,7 +1792,7 @@ if ($action == 'create') { // Delivery delay print ''.$langs->trans('AvailabilityPeriod'); - if (!empty($conf->commande->enabled)) { + if (isModEnabled('commande')) { print ' ('.$langs->trans('AfterOrder').')'; } print ''; @@ -2441,7 +2441,7 @@ if ($action == 'create') { // Delivery delay print ''; print ''; @@ -1498,7 +1498,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; } - if (!empty($conf->commande->enabled) || isModEnabled("expedition")) { + if (isModEnabled('commande') || isModEnabled("expedition")) { print ''; } // Customer orders - if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->rights->commande->lire) { $nblines++; $ret = $product->load_stats_commande($socid); if ($ret < 0) { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 8e514a505bf..ba71d22b7f8 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -125,9 +125,9 @@ 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") || !empty($conf->commande->enabled) + || isModEnabled("propal") || isModEnabled('commande') || isModEnabled('facture') || !empty($conf->contrat->enabled) - || !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled) || !empty($conf->stock->enabled)) { + || !empty($conf->ficheinter->enabled) || isModEnabled('agenda') || isModEnabled('deplacement') || !empty($conf->stock->enabled)) { $nbElements = 0; // Enable caching of thirdrparty count Contacts $cachekey = 'count_elements_project_'.$project->id; @@ -141,7 +141,7 @@ function project_prepare_head(Project $project, $moreparam = '') if (isModEnabled("propal")) { $nbElements += $project->getElementCount('propal', 'propal'); } - if (!empty($conf->commande->enabled)) { + if (isModEnabled('commande')) { $nbElements += $project->getElementCount('order', 'commande'); } if (isModEnabled('facture')) { @@ -171,10 +171,10 @@ function project_prepare_head(Project $project, $moreparam = '') if (!empty($conf->mrp->enabled)) { $nbElements += $project->getElementCount('mrp', 'mrp_mo', 'fk_project'); } - if (!empty($conf->deplacement->enabled)) { + if (isModEnabled('deplacement')) { $nbElements += $project->getElementCount('trip', 'deplacement'); } - if (!empty($conf->expensereport->enabled)) { + if (isModEnabled('expensereport')) { $nbElements += $project->getElementCount('expensereport', 'expensereport'); } if (!empty($conf->don->enabled)) { @@ -183,7 +183,7 @@ function project_prepare_head(Project $project, $moreparam = '') if (!empty($conf->loan->enabled)) { $nbElements += $project->getElementCount('loan', 'loan'); } - if (!empty($conf->tax->enabled)) { + if (isModEnabled('tax')) { $nbElements += $project->getElementCount('chargesociales', 'chargesociales'); } if (!empty($conf->project->enabled)) { diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 19578ec9fe3..aef55e09bd6 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -143,7 +143,7 @@ function user_prepare_head(User $object) if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read)) || (isModEnabled('hrm') && !empty($user->rights->hrm->employee->read)) - || (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) + || (isModEnabled('expensereport') && !empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) || (isModEnabled('holiday') && !empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->readall)) ) { // Bank diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 2e31bdef7db..73606987d9d 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -136,7 +136,7 @@ class modCategorie extends DolibarrModules if (isModEnabled("societe")) { $typeexample .= ($typeexample ? " / " : "")."2=Customer-Prospect"; } - if (!empty($conf->adherent->enabled)) { + if (isModEnabled('adherent')) { $typeexample .= ($typeexample ? " / " : "")."3=Member"; } if (isModEnabled("societe")) { @@ -297,7 +297,7 @@ class modCategorie extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_3_'.Categorie::$MAP_ID_TO_CODE[3]; $this->export_label[$r] = 'CatMemberList'; $this->export_icon[$r] = $this->picto; - $this->export_enabled[$r] = '!empty($conf->adherent->enabled)'; + $this->export_enabled[$r] = 'isModEnabled('adherent')'; $this->export_permission[$r] = array(array("categorie", "lire"), array("adherent", "export")); $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname'); $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.lastname'=>'Text', 'p.firstname'=>'Text'); @@ -527,7 +527,7 @@ class modCategorie extends DolibarrModules } // 3 Members - if (!empty($conf->adherent->enabled)) { + if (isModEnabled('adherent')) { $r++; $this->import_code[$r] = $this->rights_class.'_3_'.Categorie::$MAP_ID_TO_CODE[3]; $this->import_label[$r] = "CatMembersLinks"; // Translation key diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 7aa9abb3bff..87ea6303742 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -266,7 +266,7 @@ class modStock extends DolibarrModules $this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')'; // Export stock including batch number - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { $langs->load("productbatch"); // This request is same than previous but without field ps.stock (real stock in warehouse) and with link to subtable productbatch @@ -340,7 +340,7 @@ class modStock extends DolibarrModules 'p.rowid'=>"product", 'p.ref'=>"product", 'p.fk_product_type'=>"product", 'p.label'=>"product", 'p.description'=>"product", 'p.note'=>"product", 'p.price'=>"product", 'p.tva_tx'=>'product', 'p.tosell'=>"product", 'p.tobuy'=>"product", 'p.duration'=>"product", 'p.datec'=>'product', 'p.tms'=>'product' ); // We define here only fields that use another icon that the one defined into export_icon - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { $this->export_fields_array[$r]['sm.batch'] = 'Batch'; $this->export_TypeFields_array[$r]['sm.batch'] = 'Text'; $this->export_entities_array[$r]['sm.batch'] = 'movement'; 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 420dfd61909..beec387020a 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 @@ -46,7 +46,7 @@ if (isModEnabled('facture')) { if (isModEnabled('facture')) { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; } -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; } if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice")) { @@ -61,7 +61,7 @@ if (!empty($conf->contrat->enabled)) { if (!empty($conf->ficheinter->enabled)) { require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; } -if (!empty($conf->deplacement->enabled)) { +if (isModEnabled('deplacement')) { require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; } if (isModEnabled('agenda')) { 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 8433aaa6331..07bd3ee03ab 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 @@ -47,7 +47,7 @@ if (isModEnabled('facture')) { if (isModEnabled('facture')) { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; } -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; } if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice")) { @@ -62,7 +62,7 @@ if (!empty($conf->contrat->enabled)) { if (!empty($conf->ficheinter->enabled)) { require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; } -if (!empty($conf->deplacement->enabled)) { +if (isModEnabled('deplacement')) { require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; } if (isModEnabled('agenda')) { diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index 7722698593c..87a6bcf0e38 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -531,7 +531,7 @@ class pdf_eagle extends ModelePdfStockTransfer $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut // Lot / série - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { $pdf->SetXY($this->posxlot, $curY); $pdf->MultiCell(($this->posxweightvol - $this->posxlot), 3, $object->lines[$i]->batch, '', 'C'); } @@ -813,7 +813,7 @@ class pdf_eagle extends ModelePdfStockTransfer $pdf->MultiCell($this->posxlot - $this->posxdesc, 2, $outputlangs->transnoentities("Description"), '', 'L'); } - if (!empty($conf->productbatch->enabled) && $this->atLeastOneBatch) { + if (isModEnabled('productbatch') && $this->atLeastOneBatch) { $pdf->line($this->posxlot - 1, $tab_top, $this->posxlot - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxlot, $tab_top + 1); diff --git a/htdocs/core/tpl/onlinepaymentlinks.tpl.php b/htdocs/core/tpl/onlinepaymentlinks.tpl.php index 657d32a0a36..1615dbe87ed 100644 --- a/htdocs/core/tpl/onlinepaymentlinks.tpl.php +++ b/htdocs/core/tpl/onlinepaymentlinks.tpl.php @@ -30,7 +30,7 @@ print ''.$langs->trans("FollowingUrlAreAvailableToMakePayments").':
'.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount", $servicename).':
'; print ''.getOnlinePaymentUrl(1, 'free')."

\n"; -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { print '
'; print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder", $servicename).':
'; print ''.getOnlinePaymentUrl(1, 'order')."
\n"; @@ -96,7 +96,7 @@ if (!empty($conf->contrat->enabled)) { } print '
'; } -if (!empty($conf->adherent->enabled)) { +if (isModEnabled('adherent')) { print '
'; print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':
'; print ''.getOnlinePaymentUrl(1, 'membersubscription')."
\n"; diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 9a8414c7a69..49f2873f472 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -71,7 +71,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers // Proposals to order if ($action == 'PROPAL_CLOSE_SIGNED') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) { + if (isModEnabled('commande') && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) { $object->fetchObjectLinked(); if (!empty($object->linkedObjectsIds['commande'])) { setEventMessages($langs->trans("OrderExists"), null, 'warnings'); @@ -142,7 +142,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); // First classify billed the order to allow the proposal classify process - if (!empty($conf->commande->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) { + if (isModEnabled('commande') && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) { $object->fetchObjectLinked('', 'commande', $object->id, $object->element); if (!empty($object->linkedObjects)) { $totalonlinkedelements = 0; @@ -272,7 +272,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers if ($action == 'BILL_PAYED') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER)) { + if (isModEnabled('commande') && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER)) { $object->fetchObjectLinked('', 'commande', $object->id, $object->element); if (!empty($object->linkedObjects)) { $totalonlinkedelements = 0; @@ -296,7 +296,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers if (($action == 'SHIPPING_VALIDATE') || ($action == 'SHIPPING_CLOSED')) { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->commande->enabled) && isModEnabled("expedition") && !empty($conf->workflow->enabled) && + if (isModEnabled('commande') && isModEnabled("expedition") && !empty($conf->workflow->enabled) && ( (!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING) && ($action == 'SHIPPING_VALIDATE')) || (!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED) && ($action == 'SHIPPING_CLOSED')) diff --git a/htdocs/datapolicy/admin/setup.php b/htdocs/datapolicy/admin/setup.php index 8f25461eb64..26b71ce60e1 100644 --- a/htdocs/datapolicy/admin/setup.php +++ b/htdocs/datapolicy/admin/setup.php @@ -50,7 +50,7 @@ if (!empty($conf->global->DATAPOLICY_USE_SPECIFIC_DELAY_FOR_CONTACT)) { 'DATAPOLICY_CONTACT_FOURNISSEUR'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), ); } -if (!empty($conf->adherent->enabled)) { +if (isModEnabled('adherent')) { $arrayofparameters['Member'] = array( 'DATAPOLICY_ADHERENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'member', 'class="pictofixedwidth"')), ); diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 108f81751b3..40d73b0f298 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -308,7 +308,7 @@ if ($action == 'create') { // Create. Seems to no be used * Delivery */ - if ($typeobject == 'commande' && $expedition->origin_id > 0 && !empty($conf->commande->enabled)) { + if ($typeobject == 'commande' && $expedition->origin_id > 0 && isModEnabled('commande')) { $objectsrc = new Commande($db); $objectsrc->fetch($expedition->origin_id); } @@ -400,7 +400,7 @@ if ($action == 'create') { // Create. Seems to no be used */ // Document origine - if ($typeobject == 'commande' && $expedition->origin_id && !empty($conf->commande->enabled)) { + if ($typeobject == 'commande' && $expedition->origin_id && isModEnabled('commande')) { print '
'; $order = new Commande($db); $order->fetch($expedition->origin_id); diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 9af06f87541..55f6293a9d2 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; if (isModEnabled("propal")) { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; } -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; } diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index c37ce4690f4..c7a4a570a5c 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -322,7 +322,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) { if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('position'=>40, 'level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts"))); } - if (!empty($conf->commande->enabled)) { + if (isModEnabled('commande')) { $rowspan++; $sectionauto[] = array('position'=>50, 'level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders"))); } if (isModEnabled('facture')) { @@ -338,7 +338,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) { if (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_invoice")) { $rowspan++; $sectionauto[] = array('position'=>90, 'level'=>1, 'module'=>'invoice_supplier', 'test'=>(isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_invoice")), 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices"))); } - if (!empty($conf->tax->enabled)) { + if (isModEnabled('tax')) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('position'=>100, 'level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions"))); $rowspan++; $sectionauto[] = array('position'=>110, 'level'=>1, 'module'=>'tax-vat', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("VAT"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("VAT"))); @@ -355,7 +355,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) { $langs->load("interventions"); $rowspan++; $sectionauto[] = array('position'=>150, 'level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions"))); } - if (!empty($conf->expensereport->enabled)) { + if (isModEnabled('expensereport')) { $langs->load("trips"); $rowspan++; $sectionauto[] = array('position'=>160, 'level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports"))); } diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index 7572dd3f3d8..ac986ad00f4 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -125,7 +125,7 @@ if (isModEnabled("propal")) { if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts"))); } -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders"))); } if (isModEnabled('facture')) { @@ -140,7 +140,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice")) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice")), 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices"))); } -if (!empty($conf->tax->enabled)) { +if (isModEnabled('tax')) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions"))); } if (!empty($conf->project->enabled)) { @@ -149,7 +149,7 @@ if (!empty($conf->project->enabled)) { if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions"))); } -if (!empty($conf->expensereport->enabled)) { +if (isModEnabled('expensereport')) { $langs->load("trips"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports"))); } if (isModEnabled('holiday')) { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 3a0a9869571..333c93fdfd7 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -53,7 +53,7 @@ if (isModEnabled("product") || isModEnabled("service")) { if (isModEnabled("propal")) { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; } -if (!empty($conf->productbatch->enabled)) { +if (isModEnabled('productbatch')) { require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; } if (!empty($conf->project->enabled)) { @@ -67,7 +67,7 @@ $langs->loadLangs(array("sendings", "companies", "bills", 'deliveries', 'orders' if (!empty($conf->incoterm->enabled)) { $langs->load('incoterm'); } -if (!empty($conf->productbatch->enabled)) { +if (isModEnabled('productbatch')) { $langs->load('productbatch'); } @@ -258,7 +258,7 @@ if (empty($reshook)) { $stockLocation = "ent1".$i."_0"; $qty = "qtyl".$i; - if (!empty($conf->productbatch->enabled) && $objectsrc->lines[$i]->product_tobatch) { // If product need a batch number + if (isModEnabled('productbatch') && $objectsrc->lines[$i]->product_tobatch) { // If product need a batch number if (GETPOSTISSET($batch)) { //shipment line with batch-enable product $qty .= '_'.$j; @@ -875,7 +875,7 @@ if ($action == 'create') { // Ref print '
'; - if (!empty($conf->commande->enabled)) { + if (isModEnabled('commande')) { print $form->textwithpicto($langs->trans('AvailabilityPeriod'), $langs->trans('AvailabilityPeriod').' ('.$langs->trans('AfterOrder').')'); } else { print $langs->trans('AvailabilityPeriod'); @@ -2826,7 +2826,7 @@ if ($action == 'create') { } // Create a sale order - if (!empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) { + if (isModEnabled('commande') && $object->statut == Propal::STATUS_SIGNED) { if ($usercancreateorder) { print ''.$langs->trans("AddOrder").''; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index b97bf147dbb..c5b00c3c41e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -71,7 +71,7 @@ if (!empty($conf->incoterm->enabled)) { if (!empty($conf->margin->enabled)) { $langs->load('margins'); } -if (!empty($conf->productbatch->enabled)) { +if (isModEnabled('productbatch')) { $langs->load('productbatch'); } diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 57f61f3d9f7..9ee103911f7 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -92,7 +92,7 @@ if ($tmp) { /* * Draft orders */ -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { $sql = "SELECT c.rowid, c.ref, s.nom as name, s.rowid as socid"; $sql .= ", s.client"; $sql .= ", s.code_client"; @@ -244,7 +244,7 @@ $max = 10; /* * Orders to process */ -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid"; $sql .= ", s.client"; $sql .= ", s.code_client"; @@ -333,7 +333,7 @@ if (!empty($conf->commande->enabled)) { /* * Orders that are in process */ -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid"; $sql .= ", s.client"; $sql .= ", s.code_client"; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 4ba2f410cc9..84dafaba2e8 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2389,7 +2389,7 @@ if ($resql) { $stock_order = 0; $stock_order_supplier = 0; if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { // What about other options ? - if (!empty($conf->commande->enabled)) { + if (isModEnabled('commande')) { if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) { $generic_product->load_stats_commande(0, '1,2'); $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty']; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 839a61b2413..f9c6f4edd3e 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2321,7 +2321,7 @@ if (empty($reshook)) { if (!$error) { // Add batchinfo if the detail_batch array is defined - if (!empty($conf->productbatch->enabled) && !empty($lines[$i]->detail_batch) && is_array($lines[$i]->detail_batch) && !empty($conf->global->INVOICE_INCUDE_DETAILS_OF_LOTS_SERIALS)) { + if (isModEnabled('productbatch') && !empty($lines[$i]->detail_batch) && is_array($lines[$i]->detail_batch) && !empty($conf->global->INVOICE_INCUDE_DETAILS_OF_LOTS_SERIALS)) { $langs->load('productbatch'); foreach ($lines[$i]->detail_batch as $batchline) { $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty', $batchline->qty).' '; diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 2c7ac145b78..a0834139bd2 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -191,7 +191,7 @@ abstract class ActionsContactCardCommon $this->object->load_ref_elements(); - if (!empty($conf->commande->enabled)) { + if (isModEnabled('commande')) { $this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForOrders"); $this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_commande ? $this->object->ref_commande : $langs->trans("NoContactForAnyOrder"); $i++; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index ff7c0051a29..d3b050e5e0b 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1225,7 +1225,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $object->load_ref_elements(); - if (!empty($conf->commande->enabled)) { + if (isModEnabled('commande')) { print '
'.$langs->trans("ContactForOrders").''; print $object->ref_commande ? $object->ref_commande : (''.$langs->trans("NoContactForAnyOrder").''); print '
'; if (isModEnabled("expedition")) { print $langs->trans("ContactForOrdersOrShipments"); diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index fff1ba17644..569a155cc99 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -159,7 +159,7 @@ if ($object->thirdparty->client) { if (isModEnabled("propal") && $user->rights->propal->lire) { $elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals'); } - if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->rights->commande->lire) { $elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders'); } if (isModEnabled('facture') && $user->rights->facture->lire) { diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 439f312bef6..564122f3137 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2116,7 +2116,7 @@ if ($action == 'create') { } } - if (!empty($conf->commande->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices) { + if (isModEnabled('commande') && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices) { $langs->load("orders"); if ($user->rights->commande->creer) { print dolGetButtonAction($langs->trans('CreateOrder'), '', 'default', DOL_URL_ROOT.'/commande/card.php?action=create&token='.newToken().'&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params); diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 12656518efc..20c2e814d82 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -189,7 +189,7 @@ class box_activity extends ModeleBoxes } // list the summary of the orders - if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->rights->commande->lire) { include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $commandestatic = new Commande($this->db); diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 42a77f14b9c..92a8b471e5f 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -214,7 +214,7 @@ class box_graph_product_distribution extends ModeleBoxes } } - if (!empty($conf->commande->enabled) && !empty($user->rights->commande->lire)) { + if (isModEnabled('commande') && !empty($user->rights->commande->lire)) { // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showordernb) { $langs->load("orders"); @@ -369,7 +369,7 @@ class box_graph_product_distribution extends ModeleBoxes $stringtoshow .= ' '.$langs->trans("ForProposals"); $stringtoshow .= ' '; } - if (!empty($conf->commande->enabled) || !empty($user->rights->commande->lire)) { + if (isModEnabled('commande') || !empty($user->rights->commande->lire)) { $stringtoshow .= ' '.$langs->trans("ForCustomersOrders"); } if (isModEnabled('facture') || !empty($user->rights->facture->lire)) { diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index 23542999b47..2e25da59564 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -68,7 +68,7 @@ class box_members_by_type extends ModeleBoxes $this->enabled = 0; // disabled for external users } - $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire); + $this->hidden = !(isModEnabled('adherent') && $user->rights->adherent->lire); } /** diff --git a/htdocs/core/boxes/box_members_last_modified.php b/htdocs/core/boxes/box_members_last_modified.php index 91ce3c93c36..52bc75e1fd1 100644 --- a/htdocs/core/boxes/box_members_last_modified.php +++ b/htdocs/core/boxes/box_members_last_modified.php @@ -67,7 +67,7 @@ class box_members_last_modified extends ModeleBoxes $this->enabled = 0; // disabled for external users } - $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire); + $this->hidden = !(isModEnabled('adherent') && $user->rights->adherent->lire); } /** diff --git a/htdocs/core/boxes/box_members_last_subscriptions.php b/htdocs/core/boxes/box_members_last_subscriptions.php index 39ae0140ca4..b5472b979a2 100644 --- a/htdocs/core/boxes/box_members_last_subscriptions.php +++ b/htdocs/core/boxes/box_members_last_subscriptions.php @@ -67,7 +67,7 @@ class box_members_last_subscriptions extends ModeleBoxes $this->enabled = 0; // disabled for external users } - $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire); + $this->hidden = !(isModEnabled('adherent') && $user->rights->adherent->lire); } /** diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php index 479d2424f09..716b8ed0482 100644 --- a/htdocs/core/boxes/box_members_subscriptions_by_year.php +++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php @@ -67,7 +67,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes $this->enabled = 0; // disabled for external users } - $this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire); + $this->hidden = !(isModEnabled('adherent') && $user->rights->adherent->lire); } /** diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index f12acbe1901..0c5aa54b5ca 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1630,7 +1630,7 @@ class FormMail extends Form if ($onlinepaymentenabled && !empty($conf->global->PAYMENT_SECURITY_TOKEN)) { $tmparray['__SECUREKEYPAYMENT__'] = $conf->global->PAYMENT_SECURITY_TOKEN; if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { - if (!empty($conf->adherent->enabled)) { + if (isModEnabled('adherent')) { $tmparray['__SECUREKEYPAYMENT_MEMBER__'] = 'SecureKeyPAYMENTUniquePerMember'; } if (!empty($conf->don->enabled)) { @@ -1639,7 +1639,7 @@ class FormMail extends Form if (isModEnabled('facture')) { $tmparray['__SECUREKEYPAYMENT_INVOICE__'] = 'SecureKeyPAYMENTUniquePerInvoice'; } - if (!empty($conf->commande->enabled)) { + if (isModEnabled('commande')) { $tmparray['__SECUREKEYPAYMENT_ORDER__'] = 'SecureKeyPAYMENTUniquePerOrder'; } if (!empty($conf->contrat->enabled)) { @@ -1647,7 +1647,7 @@ class FormMail extends Form } //Online payement link - if (!empty($conf->adherent->enabled)) { + if (isModEnabled('adherent')) { $tmparray['__ONLINEPAYMENTLINK_MEMBER__'] = 'OnlinePaymentLinkUniquePerMember'; } if (!empty($conf->don->enabled)) { @@ -1656,7 +1656,7 @@ class FormMail extends Form if (isModEnabled('facture')) { $tmparray['__ONLINEPAYMENTLINK_INVOICE__'] = 'OnlinePaymentLinkUniquePerInvoice'; } - if (!empty($conf->commande->enabled)) { + if (isModEnabled('commande')) { $tmparray['__ONLINEPAYMENTLINK_ORDER__'] = 'OnlinePaymentLinkUniquePerOrder'; } if (!empty($conf->contrat->enabled)) { diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index ad9c47f4c48..ad5c07e9a7e 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 (!empty($conf->commande->enabled) || 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') || !empty($conf->ficheinter->enabled) || (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 32526574294..42d0d96f7a9 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2933,7 +2933,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, if (($fuser->rights->produit->{$lire} ) || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { $original_file = $conf->productbatch->multidir_output[$entity].'/'.$original_file; } } elseif ($modulepart == 'movement' || $modulepart == 'mouvement') { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 53204c4cc41..a0e57c173c8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2976,7 +2976,7 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64, $newemail .= img_warning($langs->trans("ErrorBadEMail", $email)); } - if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { + if (($cid || $socid) && isModEnabled('agenda') && $user->rights->agenda->myactions->create) { $type = 'AC_EMAIL'; $link = ''; if (!empty($conf->global->AGENDA_ADDACTIONFOREMAIL)) { @@ -3082,7 +3082,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor $htmllink .= '?chat" alt="'.$langs->trans("Chat").' '.$value.'" title="'.dol_escape_htmltag($langs->trans("Chat").' '.$value).'">'; $htmllink .= ''; $htmllink .= ''; - if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { + if (($cid || $socid) && isModEnabled('agenda') && $user->rights->agenda->myactions->create) { $addlink = 'AC_SKYPE'; $link = ''; if (!empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) { @@ -7371,7 +7371,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__THIRDPARTY_NOTE_PUBLIC__'] = '__THIRDPARTY_NOTE_PUBLIC__'; $substitutionarray['__THIRDPARTY_NOTE_PRIVATE__'] = '__THIRDPARTY_NOTE_PRIVATE__'; } - if (!empty($conf->adherent->enabled) && (!is_object($object) || $object->element == 'adherent')) { + if (isModEnabled('adherent') && (!is_object($object) || $object->element == 'adherent')) { $substitutionarray['__MEMBER_ID__'] = '__MEMBER_ID__'; $substitutionarray['__MEMBER_CIVILITY__'] = '__MEMBER_CIVILITY__'; $substitutionarray['__MEMBER_FIRSTNAME__'] = '__MEMBER_FIRSTNAME__'; diff --git a/htdocs/core/lib/ldap.lib.php b/htdocs/core/lib/ldap.lib.php index 7e173bd269e..94e14a90267 100644 --- a/htdocs/core/lib/ldap.lib.php +++ b/htdocs/core/lib/ldap.lib.php @@ -64,14 +64,14 @@ function ldap_prepare_head() $h++; } - if (!empty($conf->adherent->enabled) && !empty($conf->global->LDAP_MEMBER_ACTIVE)) { + if (isModEnabled('adherent') && !empty($conf->global->LDAP_MEMBER_ACTIVE)) { $head[$h][0] = DOL_URL_ROOT."/admin/ldap_members.php"; $head[$h][1] = $langs->trans("LDAPMembersSynchro"); $head[$h][2] = 'members'; $h++; } - if (!empty($conf->adherent->enabled) && !empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE)) { + if (isModEnabled('adherent') && !empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE)) { $head[$h][0] = DOL_URL_ROOT."/admin/ldap_members_types.php"; $head[$h][1] = $langs->trans("LDAPMembersTypesSynchro"); $head[$h][2] = 'memberstypes'; diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 9a5e9ae56a5..9128be56ea1 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -42,7 +42,7 @@ function commande_prepare_head(Commande $object) $h = 0; $head = array(); - if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->rights->commande->lire) { $head[$h][0] = DOL_URL_ROOT.'/commande/card.php?id='.$object->id; $head[$h][1] = $langs->trans("CustomerOrder"); $head[$h][2] = 'order'; diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index a1446bf6964..710b2462afa 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -417,7 +417,7 @@ function show_stats_for_company($product, $socid) print '
'.$langs->trans("RefOrder").'
'; - if ($origin == 'commande' && !empty($conf->commande->enabled)) { + if ($origin == 'commande' && isModEnabled('commande')) { print $langs->trans("RefOrder"); } if ($origin == 'propal' && isModEnabled("propal")) { @@ -1033,7 +1033,7 @@ if ($action == 'create') { $i = 0; while ($i < $numAsked) { print 'jQuery("#qtyl'.$i.'").val(jQuery("#qtyasked'.$i.'").val() - jQuery("#qtydelivered'.$i.'").val());'."\n"; - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { print 'jQuery("#qtyl'.$i.'_'.$i.'").val(jQuery("#qtyasked'.$i.'").val() - jQuery("#qtydelivered'.$i.'").val());'."\n"; } $i++; @@ -1552,7 +1552,7 @@ if ($action == 'create') { if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $disabled = ''; - if (!empty($conf->productbatch->enabled) && $product->hasbatch()) { + if (isModEnabled('productbatch') && $product->hasbatch()) { $disabled = 'disabled="disabled"'; } if ($warehouse_selected_id <= 0) { // We did not force a given warehouse, so we won't have no warehouse to change qty. @@ -1714,7 +1714,7 @@ if ($action == 'create') { $totalVolume = $tmparray['volume']; - if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) { + if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { $objectsrc = new Commande($db); $objectsrc->fetch($object->$typeobject->id); } @@ -1779,7 +1779,7 @@ if ($action == 'create') { print ''; // Linked documents - if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) { + if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { print ''; print ''; @@ -2062,7 +2062,7 @@ if ($action == 'create') { print ''; } - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { print ''; } } @@ -2358,7 +2358,7 @@ if ($action == 'create') { } // Batch number managment - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { if (isset($lines[$i]->detail_batch)) { print ''; print '
'; print $langs->trans("RefOrder").''; @@ -2048,7 +2048,7 @@ if ($action == 'create') { if (!empty($conf->stock->enabled)) { print $langs->trans("WarehouseSource").' - '; } - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { print $langs->trans("Batch"); } print ''.$langs->trans("WarehouseSource").''.$langs->trans("Batch").''; @@ -2437,7 +2437,7 @@ if ($action == 'create') { if ($origin && $origin_id > 0) { $colspan++; } - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { $colspan++; } if (!empty($conf->stock->enabled)) { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index ec7d7ff3cab..b1a767e197d 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -965,7 +965,7 @@ class Expedition extends CommonObject } // If product need a batch number, we should not have called this function but addline_batch instead. - if (!empty($conf->productbatch->enabled) && !empty($orderline->fk_product) && !empty($orderline->product_tobatch)) { + if (isModEnabled('productbatch') && !empty($orderline->fk_product) && !empty($orderline->product_tobatch)) { $this->error = 'ADDLINE_WAS_CALLED_INSTEAD_OF_ADDLINEBATCH'; return -4; } @@ -1716,7 +1716,7 @@ class Expedition extends CommonObject } // Detail of batch - if (!empty($conf->productbatch->enabled) && $obj->line_id > 0 && $obj->product_tobatch > 0) { + if (isModEnabled('productbatch') && $obj->line_id > 0 && $obj->product_tobatch > 0) { $newdetailbatch = $shipmentlinebatch->fetchAll($obj->line_id, $obj->fk_product); if (is_array($newdetailbatch)) { diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index 112d35a63aa..cdf6a982054 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -53,7 +53,7 @@ if ($id > 0 || !empty($ref)) { } // Linked documents - if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) { + if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { $objectsrc = new Commande($db); $objectsrc->fetch($object->$typeobject->id); } @@ -196,7 +196,7 @@ if ($id > 0 || !empty($ref)) { print ''; // Linked documents - if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) { + if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { print ''; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index c794a227afa..b90b03a06cb 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonorder.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -if (!empty($conf->productbatch->enabled)) { +if (isModEnabled('productbatch')) { require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; } require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index cbf961b8ff9..25b26c75852 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -1173,7 +1173,7 @@ class ProductFournisseur extends Product $label .= '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; if ($this->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { $langs->load("productbatch"); $label .= "
".$langs->trans("ManageLotSerial").': '.$this->getLibStatut(0, 2); } diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 2f0f7966679..c7baf022d8e 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -46,7 +46,7 @@ if (!empty($conf->project->enabled)) { // Load translation files required by the page $langs->loadLangs(array("bills", "orders", "sendings", "companies", "deliveries", "products", "stocks", "receptions")); -if (!empty($conf->productbatch->enabled)) { +if (isModEnabled('productbatch')) { $langs->load('productbatch'); } @@ -721,7 +721,7 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { print ''; if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''; @@ -820,7 +820,7 @@ if ($id > 0 || !empty($ref)) { $linktoprod = $tmpproduct->getNomUrl(1); $linktoprod .= ' - '.$objp->label."\n"; - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { if ($objp->tobatch) { // Product print ''; - if (!empty($conf->productbatch->enabled) && $objp->tobatch > 0) { + if (isModEnabled('productbatch') && $objp->tobatch > 0) { $type = 'batch'; print ''; // Qty to dispatch @@ -981,7 +981,7 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; print ''; print ''; - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { print ''; if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''; @@ -1227,7 +1227,7 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { if ($objp->batch) { include_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; $lot = new Productlot($db); diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index dfa47df91a3..a86783db2d3 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -37,10 +37,10 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -if (!empty($conf->deplacement->enabled)) { +if (isModEnabled('deplacement')) { require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; } -if (!empty($conf->expensereport->enabled)) { +if (isModEnabled('expensereport')) { require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; } if (!empty($conf->recruitment->enabled)) { @@ -116,11 +116,11 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is usel $langs->load("holiday"); $listofsearchfields['search_holiday'] = array('text'=>'TitreRequestCP'); } - if (!empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) { + if (isModEnabled('deplacement') && $user->rights->deplacement->lire) { $langs->load("trips"); $listofsearchfields['search_deplacement'] = array('text'=>'ExpenseReport'); } - if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) { + if (isModEnabled('expensereport') && $user->rights->expensereport->lire) { $langs->load("trips"); $listofsearchfields['search_expensereport'] = array('text'=>'ExpenseReport'); } @@ -270,7 +270,7 @@ if (isModEnabled('holiday') && $user->rights->holiday->read) { // Latest expense report -if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) { +if (isModEnabled('expensereport') && $user->rights->expensereport->lire) { $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut as user_status, u.photo,"; $sql .= " x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as x, ".MAIN_DB_PREFIX."user as u"; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index a7216b6ad72..02b3ce48ca4 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -2024,7 +2024,7 @@ function migrate_modeles($db, $langs, $conf) } } - if (!empty($conf->commande->enabled)) { + if (isModEnabled('commande')) { include_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php'; $modellist = ModelePDFCommandes::liste_modeles($db); if (count($modellist) == 0) { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 6a0fda06cb0..989e856b690 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2432,7 +2432,7 @@ function printDropdownQuickadd() "title" => "MenuNewMember@members", "name" => "Adherent@members", "picto" => "object_member", - "activation" => !empty($conf->adherent->enabled) && $user->hasRight("adherent", "write"), // vs hooking + "activation" => isModEnabled('adherent') && $user->hasRight("adherent", "write"), // vs hooking "position" => 5, ), array( @@ -2465,7 +2465,7 @@ function printDropdownQuickadd() "title" => "NewOrder@orders", "name" => "Order@orders", "picto" => "object_order", - "activation" => !empty($conf->commande->enabled) && $user->hasRight("commande", "write"), // vs hooking + "activation" => isModEnabled('commande') && $user->hasRight("commande", "write"), // vs hooking "position" => 40, ), array( diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index 1384852ace8..19533e05c06 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -119,9 +119,9 @@ $arrayfields = array( 'm.datem'=>array('label'=>"Date", 'checked'=>1, 'position'=>2), 'p.ref'=>array('label'=>"ProductRef", 'checked'=>1, 'css'=>'maxwidth100', 'position'=>3), 'p.label'=>array('label'=>"ProductLabel", 'checked'=>0, 'position'=>5), - 'm.batch'=>array('label'=>"BatchNumberShort", 'checked'=>1, 'position'=>8, 'enabled'=>(!empty($conf->productbatch->enabled))), - 'pl.eatby'=>array('label'=>"EatByDate", 'checked'=>0, 'position'=>9, 'enabled'=>(!empty($conf->productbatch->enabled))), - 'pl.sellby'=>array('label'=>"SellByDate", 'checked'=>0, 'position'=>10, 'enabled'=>(!empty($conf->productbatch->enabled))), + 'm.batch'=>array('label'=>"BatchNumberShort", 'checked'=>1, 'position'=>8, 'enabled'=>(isModEnabled('productbatch'))), + 'pl.eatby'=>array('label'=>"EatByDate", 'checked'=>0, 'position'=>9, 'enabled'=>(isModEnabled('productbatch'))), + 'pl.sellby'=>array('label'=>"SellByDate", 'checked'=>0, 'position'=>10, 'enabled'=>(isModEnabled('productbatch'))), 'e.ref'=>array('label'=>"Warehouse", 'checked'=>1, 'position'=>100, 'enabled'=>(!($id > 0))), // If we are on specific warehouse, we hide it 'm.fk_user_author'=>array('label'=>"Author", 'checked'=>0, 'position'=>120), 'm.inventorycode'=>array('label'=>"InventoryCodeShort", 'checked'=>1, 'position'=>130), diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 0f734df6ae9..88788da8b43 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -278,7 +278,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Warehouse"), $tmpproduct->ref), null, 'errors'); $error++; } - if (!empty($conf->productbatch->enabled) && $tmpproduct->status_batch && (!GETPOST('batchtoproduce-'.$line->id.'-'.$i))) { + if (isModEnabled('productbatch') && $tmpproduct->status_batch && (!GETPOST('batchtoproduce-'.$line->id.'-'.$i))) { $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Batch"), $tmpproduct->ref), null, 'errors'); $error++; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 5f0159ce567..d9b943fb40f 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -62,7 +62,7 @@ if (isModEnabled("propal")) { if (isModEnabled('facture')) { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; } -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; } if (!empty($conf->accounting->enabled)) { @@ -82,7 +82,7 @@ if (!empty($conf->stock->enabled)) { if (isModEnabled('facture')) { $langs->load("bills"); } -if (!empty($conf->productbatch->enabled)) { +if (isModEnabled('productbatch')) { $langs->load("productbatch"); } @@ -1353,7 +1353,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Batch number management - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { print ''; print ''; print ''; - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { print ''; @@ -944,7 +944,7 @@ if ($object->id > 0) { print ''; - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { print ''; @@ -1022,7 +1022,7 @@ if ($object->id > 0) { print $product_static->getNomUrl(1).' - '.$product_static->label; print ''; - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { print '"; print ''; print ''; - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { print ''; /*if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''; @@ -204,7 +204,7 @@ if ($resql) { print '\n"; - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { print ''; diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index 32c95537947..c31bbbc3101 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -44,7 +44,7 @@ if (!empty($conf->project->enabled)) { // Load translation files required by the page $langs->loadLangs(array('products', 'stocks', 'orders')); -if (!empty($conf->productbatch->enabled)) { +if (isModEnabled('productbatch')) { $langs->load("productbatch"); } @@ -106,9 +106,9 @@ $arrayfields = array( 'm.datem'=>array('label'=>$langs->trans("Date"), 'checked'=>1), 'p.ref'=>array('label'=>$langs->trans("ProductRef"), 'checked'=>1, 'css'=>'maxwidth100'), 'p.label'=>array('label'=>$langs->trans("ProductLabel"), 'checked'=>1), - 'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(!empty($conf->productbatch->enabled))), - 'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(!empty($conf->productbatch->enabled))), - 'pl.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(!empty($conf->productbatch->enabled))), + 'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(isModEnabled('productbatch'))), + 'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(isModEnabled('productbatch'))), + 'pl.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(isModEnabled('productbatch'))), 'e.ref'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1, 'enabled'=>(!($id > 0))), // If we are on specific warehouse, we hide it 'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0), 'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1), @@ -273,7 +273,7 @@ if ($action == "transfert_stock" && !$cancel) { $action = 'transfert'; } - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { $product = new Product($db); $result = $product->fetch($product_id); diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 9f097e1c4e3..d2639000270 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -45,7 +45,7 @@ if (!empty($conf->project->enabled)) { // Load translation files required by the page $langs->loadLangs(array('products', 'stocks', 'orders')); -if (!empty($conf->productbatch->enabled)) { +if (isModEnabled('productbatch')) { $langs->load("productbatch"); } @@ -125,9 +125,9 @@ $arrayfields = array( 'm.datem'=>array('label'=>"Date", 'checked'=>1, 'position'=>2), 'p.ref'=>array('label'=>"ProductRef", 'checked'=>1, 'css'=>'maxwidth100', 'position'=>3), 'p.label'=>array('label'=>"ProductLabel", 'checked'=>0, 'position'=>5), - 'm.batch'=>array('label'=>"BatchNumberShort", 'checked'=>1, 'position'=>8, 'enabled'=>(!empty($conf->productbatch->enabled))), - 'pl.eatby'=>array('label'=>"EatByDate", 'checked'=>0, 'position'=>9, 'enabled'=>(!empty($conf->productbatch->enabled))), - 'pl.sellby'=>array('label'=>"SellByDate", 'checked'=>0, 'position'=>10, 'enabled'=>(!empty($conf->productbatch->enabled))), + 'm.batch'=>array('label'=>"BatchNumberShort", 'checked'=>1, 'position'=>8, 'enabled'=>(isModEnabled('productbatch'))), + 'pl.eatby'=>array('label'=>"EatByDate", 'checked'=>0, 'position'=>9, 'enabled'=>(isModEnabled('productbatch'))), + 'pl.sellby'=>array('label'=>"SellByDate", 'checked'=>0, 'position'=>10, 'enabled'=>(isModEnabled('productbatch'))), 'e.ref'=>array('label'=>"Warehouse", 'checked'=>1, 'position'=>100, 'enabled'=>(!($id > 0))), // If we are on specific warehouse, we hide it 'm.fk_user_author'=>array('label'=>"Author", 'checked'=>0, 'position'=>120), 'm.inventorycode'=>array('label'=>"InventoryCodeShort", 'checked'=>1, 'position'=>130), @@ -448,7 +448,7 @@ if ($action == "transfert_stock" && !$cancel) { $action = 'transfert'; } - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { $product = new Product($db); $result = $product->fetch($product_id); diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 51b12d4a6b1..ca3624fe147 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productstockentrepot.class.php'; -if (!empty($conf->productbatch->enabled)) { +if (isModEnabled('productbatch')) { require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; } if (!empty($conf->project->enabled)) { @@ -56,7 +56,7 @@ if (!empty($conf->variants->enabled)) { // Load translation files required by the page $langs->loadlangs(array('products', 'suppliers', 'orders', 'bills', 'stocks', 'sendings', 'margins')); -if (!empty($conf->productbatch->enabled)) { +if (isModEnabled('productbatch')) { $langs->load("productbatch"); } @@ -248,7 +248,7 @@ if ($action == "correct_stock" && !$cancel) { $action = 'correction'; } - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { $object = new Product($db); $result = $object->fetch($id); @@ -345,7 +345,7 @@ if ($action == "transfert_stock" && !$cancel) { $error++; $action = 'transfert'; } - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { $object = new Product($db); $result = $object->fetch($id); @@ -761,7 +761,7 @@ if ($id > 0 || $ref) { $found = 0; $helpondiff = ''.$langs->trans("StockDiffPhysicTeoric").':
'; // Number of customer orders running - if (!empty($conf->commande->enabled)) { + if (isModEnabled('commande')) { if ($found) { $helpondiff .= '
'; } else { @@ -959,7 +959,7 @@ if (!$variants) { print ''; print ''; - if ((!empty($conf->productbatch->enabled)) && $object->hasbatch()) { + if ((isModEnabled('productbatch')) && $object->hasbatch()) { $colspan = 3; print ''; } - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { print ''; if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''; @@ -1216,7 +1216,7 @@ if ($action == 'create') { print ''; } - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { if (!empty($product->status_batch)) { print ''; if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { @@ -1358,7 +1358,7 @@ if ($action == 'create') { $totalVolume = $tmparray['volume']; - if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) { + if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { $objectsrc = new Commande($db); $objectsrc->fetch($object->$typeobject->id); } @@ -1427,7 +1427,7 @@ if ($action == 'create') { print '
'; $objectsrc = new Commande($db); $objectsrc->fetch($object->$typeobject->id); diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index c8fc0ff35be..a6a6a1b0e3b 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -51,7 +51,7 @@ if ($id > 0 || !empty($ref)) { } // Linked documents - if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) { + if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { $objectsrc = new Commande($db); $objectsrc->fetch($object->$typeobject->id); } diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 7234e54e8f1..9d5c5b70fe4 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -if (!empty($conf->adherent->enabled)) { +if (isModEnabled('adherent')) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; } if (!empty($conf->categorie->enabled)) { @@ -353,7 +353,7 @@ if ($object->id > 0) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; // Module Adherent - if (!empty($conf->adherent->enabled)) { + if (isModEnabled('adherent')) { $langs->load("members"); $langs->load("users"); print '
'.$langs->trans("LinkedToDolibarrMember").'
'.$langs->trans("Description").''.$langs->trans("batch_number").''.$langs->trans("SellByDate").''; @@ -869,7 +869,7 @@ if ($id > 0 || !empty($ref)) { // Already dispatched print ''.$products_dispatched[$objp->rowid].''; print ''; - if (!empty($conf->productbatch->enabled) && $objp->tobatch > 0) { + if (isModEnabled('productbatch') && $objp->tobatch > 0) { $type = 'batch'; print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine('.$i.', \''.$type.'\')"'); } else { @@ -1162,7 +1162,7 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans("Product").''.$langs->trans("DateCreation").''.$langs->trans("DateDeliveryPlanned").''.$langs->trans("batch_number").''.$langs->trans("SellByDate").''.dol_print_date($db->jdate($objp->datec), 'day').''.dol_print_date($db->jdate($objp->date_delivery), 'day').'
'.$langs->trans("ManageLotSerial").''; $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial")); print $form->selectarray('status_batch', $statutarray, GETPOST('status_batch')); @@ -2368,7 +2368,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Batch number management (to batch) - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { print '
'.$langs->trans("ManageLotSerial").''; print $object->getLibStatut(0, 2); @@ -2823,7 +2823,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == } // Commande - if (!empty($conf->commande->enabled) && $user->rights->commande->creer) { + if (isModEnabled('commande') && $user->rights->commande->creer) { $commande = new Commande($db); $langs->load("orders"); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 1a157ed9171..360709dc5a0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4943,7 +4943,7 @@ class Product extends CommonObject $label .= '
'.$langs->trans('ProductLabel').': '.$this->label; } if ($this->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { $langs->load("productbatch"); $label .= "
".$langs->trans("ManageLotSerial").': '.$this->getLibStatut(0, 2); } @@ -5141,7 +5141,7 @@ class Product extends CommonObject $labelStatus = $labelStatusShort = ''; $langs->load('products'); - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { $langs->load("productbatch"); } @@ -5456,7 +5456,7 @@ class Product extends CommonObject //dol_syslog("load_virtual_stock"); - if (!empty($conf->commande->enabled)) { + if (isModEnabled('commande')) { $result = $this->load_stats_commande(0, '1,2', 1); if ($result < 0) { dol_print_error($this->db, $this->error); diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index f7b3ddd5ac6..c1ef43c5c02 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -348,7 +348,7 @@ if (empty($reshook)) { $error++; setEventMessages($langs->trans("FieldCannotBeNegative", $langs->transnoentitiesnoconv("RealQty")), null, 'errors'); } - if (!$error && !empty($conf->productbatch->enabled)) { + if (!$error && isModEnabled('productbatch')) { $tmpproduct = new Product($db); $result = $tmpproduct->fetch($fk_product); @@ -608,7 +608,7 @@ if ($object->id > 0) { if (!empty($conf->use_javascript_ajax)) { if ($permissiontoadd) { // Link to launch scan tool - if (isModEnabled('barcode') || !empty($conf->productbatch->enabled)) { + if (isModEnabled('barcode') || isModEnabled('productbatch')) { print ''.img_picto('', 'barcode', 'class="paddingrightonly"').$langs->trans("UpdateByScaning").''; } @@ -906,7 +906,7 @@ if ($object->id > 0) { print '
'.$langs->trans("Warehouse").''.$langs->trans("Product").''; print $langs->trans("Batch"); print ''; print $form->select_produits((GETPOSTISSET('fk_product') ? GETPOST('fk_product', 'int') : $object->fk_product), 'fk_product', '', 0, 0, -1, 2, '', 0, null, 0, '1', 0, 'maxwidth300'); print ''; print ''; print ''; $batch_static = new Productlot($db); $res = $batch_static->fetch(0, $product_static->id, $obj->batch); @@ -1039,7 +1039,7 @@ if ($object->id > 0) { $valuetoshow = $obj->qty_stock; // For inventory not yet close, we overwrite with the real value in stock now if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) { - if (!empty($conf->productbatch->enabled) && $product_static->hasbatch()) { + if (isModEnabled('productbatch') && $product_static->hasbatch()) { $valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->detail_batch[$obj->batch]->qty; } else { $valuetoshow = $product_static->stock_warehouse[$obj->fk_warehouse]->real; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 38c3c0c80ea..dcea4f4b8f7 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -49,7 +49,7 @@ if (!empty($conf->categorie->enabled)) { // Load translation files required by the page $langs->loadLangs(array('products', 'stocks', 'suppliers', 'companies', 'margins')); -if (!empty($conf->productbatch->enabled)) { +if (isModEnabled('productbatch')) { $langs->load("productbatch"); } @@ -238,7 +238,7 @@ $arrayfields = array( 'p.desiredstock'=>array('label'=>"DesiredStock", 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>51), 'p.stock'=>array('label'=>"PhysicalStock", 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES))), 'position'=>52), 'stock_virtual'=>array('label'=>"VirtualStock", 'checked'=>1, 'enabled'=>(!empty($conf->stock->enabled) && $user->rights->stock->lire && ($contextpage != 'servicelist' || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && $virtualdiffersfromphysical), 'position'=>53), - 'p.tobatch'=>array('label'=>"ManageLotSerial", 'checked'=>0, 'enabled'=>(!empty($conf->productbatch->enabled)), 'position'=>60), + 'p.tobatch'=>array('label'=>"ManageLotSerial", 'checked'=>0, 'enabled'=>(isModEnabled('productbatch')), 'position'=>60), 'p.fk_country'=>array('label'=>"Country", 'checked'=>0, 'position'=>100), 'p.fk_state'=>array('label'=>"State", 'checked'=>0, 'position'=>101), $alias_product_perentity . '.accountancy_code_sell'=>array('label'=>"ProductAccountancySellCode", 'checked'=>0, 'enabled'=>empty($conf->global->PRODUCT_DISABLE_ACCOUNTING), 'position'=>400), diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 5653a564b9e..8edb3be32da 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -272,7 +272,7 @@ class MouvementStock extends CommonObject } // Test if product require batch data. If yes, and there is not or values are not correct, we throw an error. - if (!empty($conf->productbatch->enabled) && $product->hasbatch() && !$skip_batch) { + if (isModEnabled('productbatch') && $product->hasbatch() && !$skip_batch) { if (empty($batch)) { $langs->load("errors"); $this->errors[] = $langs->transnoentitiesnoconv("ErrorTryToMakeMoveOnProductRequiringBatchData", $product->ref); @@ -384,7 +384,7 @@ class MouvementStock extends CommonObject // Check if stock is enough when qty is < 0 // Note that qty should be > 0 with type 0 or 3, < 0 with type 1 or 2. if ($movestock && $qty < 0 && empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) { - if (!empty($conf->productbatch->enabled) && $product->hasbatch() && !$skip_batch) { + if (isModEnabled('productbatch') && $product->hasbatch() && !$skip_batch) { $foundforbatch = 0; $qtyisnotenough = 0; @@ -544,7 +544,7 @@ class MouvementStock extends CommonObject } // Update detail of stock for the lot. - if (!$error && !empty($conf->productbatch->enabled) && $product->hasbatch() && !$skip_batch) { + if (!$error && isModEnabled('productbatch') && $product->hasbatch() && !$skip_batch) { if ($id_product_batch > 0) { $result = $this->createBatch($id_product_batch, $qty); } else { @@ -596,7 +596,7 @@ class MouvementStock extends CommonObject // End call triggers // Check unicity for serial numbered equipments once all movement were done. - if (!$error && !empty($conf->productbatch->enabled) && $product->hasbatch() && !$skip_batch) { + if (!$error && isModEnabled('productbatch') && $product->hasbatch() && !$skip_batch) { if ($product->status_batch == 2 && $qty > 0) { // We check only if we increased qty if ($this->getBatchCount($fk_product, $batch) > 1) { $error++; diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index 6efe9f0d9e8..0f9deb92772 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -164,7 +164,7 @@ if ($resql) { print "
'.$langs->trans("LastMovements", min($num, $max)).''.$langs->trans("Product").''.$langs->trans("Batch").''.$langs->trans("SellByDate").''; print $producttmp->getNomUrl(1); print "'; print $tmplotstatic->getNomUrl(0, 'nolink'); print '
'; if (!empty($conf->use_javascript_ajax)) { @@ -1029,7 +1029,7 @@ if (!$variants) { // Warehouse print ''; print $entrepotstatic->getNomUrl(1); - if (!empty($conf->use_javascript_ajax) && !empty($conf->productbatch->enabled) && $object->hasbatch()) { + if (!empty($conf->use_javascript_ajax) && isModEnabled('productbatch') && $object->hasbatch()) { print ''; print (empty($conf->global->STOCK_SHOW_ALL_BATCH_BY_DEFAULT) ? '(+)' : '(-)'); print ''; @@ -1096,7 +1096,7 @@ if (!$variants) { $totalvalue = $totalvalue + ($object->pmp * $obj->reel); $totalvaluesell = $totalvaluesell + ($object->price * $obj->reel); // Batch Detail - if ((!empty($conf->productbatch->enabled)) && $object->hasbatch()) { + if ((isModEnabled('productbatch')) && $object->hasbatch()) { $details = Productbatch::findAll($db, $obj->product_stock_id, 0, $object->id); if ($details < 0) { dol_print_error($db); diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php index 89ba063e8d7..842aa83bd07 100644 --- a/htdocs/product/stock/productlot_document.php +++ b/htdocs/product/stock/productlot_document.php @@ -85,7 +85,7 @@ if ($id || $ref) { $object->fetch($id, $productid, $batch); $object->ref = $object->batch; // Old system for document management ( it uses $object->ref) - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart); $filearray = dol_dir_list($upload_dir, "files"); if (empty($filearray)) { diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index f2821eab8ce..1eb8a444d8a 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -413,7 +413,7 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entre $sql .= ', s.fk_product'; if ($usevirtualstock) { - if (!empty($conf->commande->enabled)) { + if (isModEnabled('commande')) { $sqlCommandesCli = "(SELECT ".$db->ifsql("SUM(cd1.qty) IS NULL", "0", "SUM(cd1.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL $sqlCommandesCli .= " FROM ".MAIN_DB_PREFIX."commandedet as cd1, ".MAIN_DB_PREFIX."commande as c1"; $sqlCommandesCli .= " WHERE c1.rowid = cd1.fk_commande AND c1.entity IN (".getEntity(!empty($conf->global->STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE) ? 'stock' : 'commande').")"; diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index f2ecfa1d73c..819fa404d52 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -93,7 +93,7 @@ print '
'.$langs->trans("NumberOfUnit").''; // Serial / Eat-by date -if (!empty($conf->productbatch->enabled) && +if (isModEnabled('productbatch') && (($object->element == 'product' && $object->hasbatch()) || ($object->element == 'stock')) ) { diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 246ae6b7ba8..bc182efa3f2 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1348,7 +1348,7 @@ if ($action == 'create' && $user->rights->projet->creer) { $langs->load("propal"); print dolGetButtonAction('', $langs->trans('AddProp'), 'default', DOL_URL_ROOT.'/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid, '', 1, array('isDropDown' => true)); } - if (!empty($conf->commande->enabled) && $user->rights->commande->creer) { + if (isModEnabled('commande') && $user->rights->commande->creer) { $langs->load("orders"); print dolGetButtonAction('', $langs->trans('CreateOrder'), 'default', DOL_URL_ROOT.'/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid, '', 1, array('isDropDown' => true)); } @@ -1376,7 +1376,7 @@ if ($action == 'create' && $user->rights->projet->creer) { $langs->load("contracts"); print dolGetButtonAction('', $langs->trans('AddContract'), 'default', DOL_URL_ROOT.'/contrat/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid, '', 1, array('isDropDown' => true)); } - if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->creer) { + if (isModEnabled('expensereport') && $user->rights->expensereport->creer) { $langs->load("trips"); print dolGetButtonAction('', $langs->trans('AddTrip'), 'default', DOL_URL_ROOT.'/expensereport/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid, '', 1, array('isDropDown' => true)); } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index a96ba8c2819..57583a538fb 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -46,7 +46,7 @@ if (isModEnabled('facture')) { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; } -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; } if (!empty($conf->supplier_proposal->enabled)) { @@ -67,10 +67,10 @@ if (!empty($conf->ficheinter->enabled)) { if (isModEnabled("expedition")) { require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; } -if (!empty($conf->deplacement->enabled)) { +if (isModEnabled('deplacement')) { require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; } -if (!empty($conf->expensereport->enabled)) { +if (isModEnabled('expensereport')) { require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; } if (isModEnabled('agenda')) { @@ -86,7 +86,7 @@ if (!empty($conf->loan->enabled)) { if (!empty($conf->stock->enabled)) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; } -if (!empty($conf->tax->enabled)) { +if (isModEnabled('tax')) { require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; } if (isModEnabled("banque")) { @@ -107,7 +107,7 @@ $langs->loadLangs(array('projects', 'companies', 'suppliers', 'compta')); if (isModEnabled('facture')) { $langs->load("bills"); } -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { $langs->load("orders"); } if (isModEnabled("propal")) { @@ -116,10 +116,10 @@ if (isModEnabled("propal")) { if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); } -if (!empty($conf->deplacement->enabled)) { +if (isModEnabled('deplacement')) { $langs->load("trips"); } -if (!empty($conf->expensereport->enabled)) { +if (isModEnabled('expensereport')) { $langs->load("trips"); } if (!empty($conf->don->enabled)) { diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index e3532fb6471..8964cca8c19 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -109,7 +109,7 @@ if ($id > 0 || !empty($ref)) { } $object->info($object->id); } -$agenda = (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) ? '/'.$langs->trans("Agenda") : ''; +$agenda = (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) ? '/'.$langs->trans("Agenda") : ''; $title = $langs->trans('Events').$agenda.' - '.$object->ref.' '.$object->name; if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info"); diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 00f534a388c..6ca72ea2d97 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -54,7 +54,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; } -if (!empty($conf->productbatch->enabled)) { +if (isModEnabled('productbatch')) { require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; } if (!empty($conf->project->enabled)) { @@ -67,7 +67,7 @@ $langs->loadLangs(array("receptions", "companies", "bills", 'deliveries', 'order if (!empty($conf->incoterm->enabled)) { $langs->load('incoterm'); } -if (!empty($conf->productbatch->enabled)) { +if (isModEnabled('productbatch')) { $langs->load('productbatch'); } @@ -626,7 +626,7 @@ if (empty($reshook)) { $line->qty = GETPOST($qty, 'int'); $line->comment = GETPOST($comment, 'alpha'); - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { $batch = "batch".$line_id; $dlc = "dlc".$line_id; $dluo = "dluo".$line_id; @@ -1041,7 +1041,7 @@ if ($action == 'create') { if (!empty($conf->stock->enabled)) { print ''.$langs->trans("Warehouse").' ('.$langs->trans("Stock").')'.$langs->trans("batch_number").''.$langs->trans("SellByDate").'
'; // Linked documents - if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) { + if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { print ''; print ''; @@ -1721,7 +1721,7 @@ if ($action == 'create') { print ''; } - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { print ''; } } @@ -1957,7 +1957,7 @@ if ($action == 'create') { } // Batch number managment - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { if (isset($lines[$i]->batch)) { print ''; print ' -adherent->enabled)) { ?> + diff --git a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php index bfbf6271711..98979c917d4 100644 --- a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php @@ -174,7 +174,7 @@ if ($this->control->tpl['action_delete']) { -adherent->enabled)) { ?> + diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index d5ccb96eaf7..331fb58ae9c 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -47,7 +47,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -if (!empty($conf->adherent->enabled)) { +if (isModEnabled('adherent')) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; } if (!empty($conf->accounting->enabled)) { @@ -68,7 +68,7 @@ if (! empty($conf->eventorganization->enabled)) { $langs->loadLangs(array("companies", "commercial", "bills", "banks", "users")); -if (!empty($conf->adherent->enabled)) { +if (isModEnabled('adherent')) { $langs->load("members"); } if (!empty($conf->categorie->enabled)) { @@ -3035,7 +3035,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; // Module Adherent - if (!empty($conf->adherent->enabled)) { + if (isModEnabled('adherent')) { $langs->load("members"); print ''; print '\n"; // Expense report validator - if (!empty($conf->expensereport->enabled)) { + if (isModEnabled('expensereport')) { print '\n"; // Expense report validator - if (!empty($conf->expensereport->enabled)) { + if (isModEnabled('expensereport')) { print '\n"; // Expense report validator - if (!empty($conf->expensereport->enabled)) { + if (isModEnabled('expensereport')) { print ''; print '\n"; // Expense report validator - if (!empty($conf->expensereport->enabled)) { + if (isModEnabled('expensereport')) { print ''; print '
'; print $langs->trans("RefOrder").''; @@ -1700,7 +1700,7 @@ if ($action == 'create') { if (!empty($conf->stock->enabled)) { print $langs->trans("WarehouseSource").' - '; } - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { print $langs->trans("Batch"); } print ''.$langs->trans("WarehouseSource").''.$langs->trans("Batch").''; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index ceb71624292..85071a49b94 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonincoterm.class.php'; if (isModEnabled("propal")) { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; } -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; } @@ -849,7 +849,7 @@ class Reception extends CommonObject // Check batch is set $product = new Product($this->db); $product->fetch($fk_product); - if (!empty($conf->productbatch->enabled)) { + if (isModEnabled('productbatch')) { $langs->load("errors"); if (!empty($product->status_batch) && empty($batch)) { $this->error = $langs->trans('ErrorProductNeedBatchNumber', $product->ref); diff --git a/htdocs/reception/note.php b/htdocs/reception/note.php index fadf222aa3e..cb2c84ebd76 100644 --- a/htdocs/reception/note.php +++ b/htdocs/reception/note.php @@ -51,7 +51,7 @@ if ($id > 0 || !empty($ref)) { } // Linked documents - if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) { + if ($typeobject == 'commande' && $object->$typeobject->id && isModEnabled('commande')) { $objectsrc = new Commande($db); $objectsrc->fetch($object->$typeobject->id); } diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 5a26946913c..e71ee255981 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -342,7 +342,7 @@ abstract class ActionsCardCommon } // Linked member - if (!empty($conf->adherent->enabled)) { + if (isModEnabled('adherent')) { $langs->load("members"); $adh = new Adherent($this->db); $result = $adh->fetch('', '', $this->object->id); diff --git a/htdocs/societe/canvas/company/tpl/card_view.tpl.php b/htdocs/societe/canvas/company/tpl/card_view.tpl.php index 0c6f2caf1e1..d1ba18f82fd 100644 --- a/htdocs/societe/canvas/company/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_view.tpl.php @@ -247,7 +247,7 @@ for ($i = 1; $i <= 4; $i++) { control->tpl['sales_representatives']; ?>
trans("LinkedToDolibarrMember"); ?> control->tpl['linked_member']; ?>control->tpl['sales_representatives']; ?>
trans("LinkedToDolibarrMember"); ?> control->tpl['linked_member']; ?>
'.$langs->trans("LinkedToDolibarrMember").''; @@ -3108,7 +3108,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); - if (!empty($conf->adherent->enabled)) { + if (isModEnabled('adherent')) { $adh = new Adherent($db); $result = $adh->fetch('', '', $object->id); if ($result == 0 && ($object->client == 1 || $object->client == 3) && !empty($conf->global->MEMBER_CAN_CONVERT_CUSTOMERS_TO_MEMBERS)) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ee2d71f6d12..3f7bb239c51 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -214,8 +214,8 @@ class Societe extends CommonObject 'mode_reglement_supplier' =>array('type'=>'integer', 'label'=>'Mode reglement supplier', 'enabled'=>1, 'visible'=>-1, 'position'=>305), 'cond_reglement_supplier' =>array('type'=>'integer', 'label'=>'Cond reglement supplier', 'enabled'=>1, 'visible'=>-1, 'position'=>308), 'outstanding_limit' =>array('type'=>'double(24,8)', 'label'=>'OutstandingBill', 'enabled'=>1, 'visible'=>-1, 'position'=>310, 'isameasure'=>1), - 'order_min_amount' =>array('type'=>'double(24,8)', 'label'=>'Order min amount', 'enabled'=>'!empty($conf->commande->enabled) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)', 'visible'=>-1, 'position'=>315, 'isameasure'=>1), - 'supplier_order_min_amount' =>array('type'=>'double(24,8)', 'label'=>'Supplier order min amount', 'enabled'=>'!empty($conf->commande->enabled) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)', 'visible'=>-1, 'position'=>320, 'isameasure'=>1), + 'order_min_amount' =>array('type'=>'double(24,8)', 'label'=>'Order min amount', 'enabled'=>'isModEnabled('commande') && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)', 'visible'=>-1, 'position'=>315, 'isameasure'=>1), + 'supplier_order_min_amount' =>array('type'=>'double(24,8)', 'label'=>'Supplier order min amount', 'enabled'=>'isModEnabled('commande') && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)', 'visible'=>-1, 'position'=>320, 'isameasure'=>1), 'fk_shipping_method' =>array('type'=>'integer', 'label'=>'Fk shipping method', 'enabled'=>1, 'visible'=>-1, 'position'=>330), 'tva_assuj' =>array('type'=>'tinyint(4)', 'label'=>'Tva assuj', 'enabled'=>1, 'visible'=>-1, 'position'=>335), 'localtax1_assuj' =>array('type'=>'tinyint(4)', 'label'=>'Localtax1 assuj', 'enabled'=>1, 'visible'=>-1, 'position'=>340), @@ -1561,7 +1561,7 @@ class Societe extends CommonObject if (!$error && $nbrowsaffected) { // Update information on linked member if it is an update - if (!$nosyncmember && !empty($conf->adherent->enabled)) { + if (!$nosyncmember && isModEnabled('adherent')) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; dol_syslog(get_class($this)."::update update linked member"); diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 53408fd00ff..a8f250f29d5 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -170,7 +170,7 @@ if ($object->client) { if (isModEnabled("propal") && $user->rights->propal->lire) { $elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals'); } - if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->rights->commande->lire) { $elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders'); } if (isModEnabled('facture') && $user->rights->facture->lire) { diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index 1bc64658735..14c1347c98c 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -if (!empty($conf->adherent->enabled)) { +if (isModEnabled('adherent')) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; } diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 5b9bd1046ef..f22a5fb440b 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -791,7 +791,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if (isModEnabled("propal") && $user->rights->propal->lire) { $elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals'); } - if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->rights->commande->lire) { $elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders'); } if (isModEnabled('facture') && $user->rights->facture->lire) { diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index a061933ba11..1767973a001 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -205,7 +205,7 @@ if ($id > 0 || !empty($ref)) { } // additionnal list with adherents of company - if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire) { + if (isModEnabled('adherent') && $user->rights->adherent->lire) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 0dd8a7f9d08..2c6dd47b234 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php'; if (isModEnabled('holiday')) { require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; } -if (!empty($conf->expensereport->enabled)) { +if (isModEnabled('expensereport')) { require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; } if (!empty($conf->salaries->enabled)) { @@ -361,7 +361,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print "
'; $text = $langs->trans("ForceUserExpenseValidator"); print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); @@ -691,7 +691,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac } // Latest expense report - if (!empty($conf->expensereport->enabled) && + if (isModEnabled('expensereport') && ($user->rights->expensereport->readall || ($user->rights->expensereport->lire && $object->id == $user->id)) ) { $exp = new ExpenseReport($db); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 45d7c91a8bb..7ae7bb70566 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -51,7 +51,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; if (!empty($conf->ldap->enabled)) { require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; } -if (!empty($conf->adherent->enabled)) { +if (isModEnabled('adherent')) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; } if (!empty($conf->categorie->enabled)) { @@ -950,7 +950,7 @@ if ($action == 'create' || $action == 'adduserldap') { print "
'; $text = $langs->trans("ForceUserExpenseValidator"); print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); @@ -1498,7 +1498,7 @@ if ($action == 'create' || $action == 'adduserldap') { print "
'; $text = $langs->trans("ForceUserExpenseValidator"); print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); @@ -1707,7 +1707,7 @@ if ($action == 'create' || $action == 'adduserldap') { } // Module Adherent - if (!empty($conf->adherent->enabled)) { + if (isModEnabled('adherent')) { $langs->load("members"); print '
'.$langs->trans("LinkedToDolibarrMember").''; @@ -2239,7 +2239,7 @@ if ($action == 'create' || $action == 'adduserldap') { print "
'; $text = $langs->trans("ForceUserExpenseValidator"); print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); @@ -2629,7 +2629,7 @@ if ($action == 'create' || $action == 'adduserldap') { } // Module Adherent - if (!empty($conf->adherent->enabled)) { + if (isModEnabled('adherent')) { $langs->load("members"); print '
'.$langs->trans("LinkedToDolibarrMember").''; diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 6d5a27cd8ba..1df44179461 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -192,19 +192,19 @@ if (isModEnabled("societe")) { if (!empty($conf->project->enabled)) { $tmparray['projet/index.php?mainmenu=project&leftmenu='] = 'ProjectsArea'; } -if (isModEnabled('holiday') || !empty($conf->expensereport->enabled)) { +if (isModEnabled('holiday') || isModEnabled('expensereport')) { $tmparray['hrm/index.php?mainmenu=hrm&leftmenu='] = 'HRMArea'; // TODO Complete list with first level of menus } if (isModEnabled("product") || isModEnabled("service")) { $tmparray['product/index.php?mainmenu=products&leftmenu='] = 'ProductsAndServicesArea'; } -if (isModEnabled("propal") || !empty($conf->commande->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->contrat->enabled)) { +if (isModEnabled("propal") || isModEnabled('commande') || !empty($conf->ficheinter->enabled) || !empty($conf->contrat->enabled)) { $tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = 'CommercialArea'; } if (!empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled)) { $tmparray['compta/index.php?mainmenu=compta&leftmenu='] = 'AccountancyTreasuryArea'; } -if (!empty($conf->adherent->enabled)) { +if (isModEnabled('adherent')) { $tmparray['adherents/index.php?mainmenu=members&leftmenu='] = 'MembersArea'; } if (isModEnabled('agenda')) { diff --git a/htdocs/webhook/target_agenda.php b/htdocs/webhook/target_agenda.php index ccc61d806af..a8d110eb081 100644 --- a/htdocs/webhook/target_agenda.php +++ b/htdocs/webhook/target_agenda.php @@ -227,7 +227,7 @@ if ($object->id > 0) { print '
'; - if (!empty($conf->agenda->enabled)) { + if (isModEnabled('agenda')) { if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { print ''.$langs->trans("AddAction").''; } else { @@ -237,7 +237,7 @@ if ($object->id > 0) { print '
'; - if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { $param = '&id='.$object->id.'&socid='.$socid; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); diff --git a/htdocs/webservices/admin/index.php b/htdocs/webservices/admin/index.php index 97b8a4768a0..79d222f7e84 100644 --- a/htdocs/webservices/admin/index.php +++ b/htdocs/webservices/admin/index.php @@ -103,10 +103,10 @@ $webservices = array( 'thirdparty' => 'isModEnabled("societe")', 'contact' => 'isModEnabled("societe")', 'productorservice' => '(isModEnabled("product") || isModEnabled("service"))', - 'order' => '!empty($conf->commande->enabled)', + 'order' => 'isModEnabled('commande')', 'invoice' => 'isModEnabled("facture")', 'supplier_invoice' => 'isModEnabled("fournisseur")', - 'actioncomm' => '!empty($conf->agenda->enabled)', + 'actioncomm' => 'isModEnabled('agenda')', 'category' => '!empty($conf->categorie->enabled)', 'project' => '!empty($conf->project->enabled)', 'other' => ''