';
diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php
index a5e83155f03..a23f3127ca8 100644
--- a/htdocs/admin/stock.php
+++ b/htdocs/admin/stock.php
@@ -209,7 +209,7 @@ $found = 0;
print '
';
print '| '.$langs->trans("DeStockOnBill").' | ';
print '';
-if (!empty($conf->facture->enabled)) {
+if (isModEnabled('facture')) {
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_BILL', array(), null, 0, 0, 0, 2, 1);
} else {
diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php
index 0da79845d14..75f2badfda5 100644
--- a/htdocs/admin/supplier_order.php
+++ b/htdocs/admin/supplier_order.php
@@ -464,8 +464,7 @@ print " |
\n";
// Ask for payment bank during supplier order
/* Kept as hidden for the moment
-if ($conf->banque->enabled)
-{
+if (isModEnabled('banque')) {
print '
| ';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").' | | ';
@@ -521,7 +520,7 @@ print ' |
';
print '| '.$langs->trans("UseDispatchStatus").' | ';
print ' | ';
print '';
-if ($conf->reception->enabled) {
+if (isModEnabled('reception')) {
print ''.$langs->trans("FeatureNotAvailableWithReceptionModule").'';
} else {
if ($conf->use_javascript_ajax) {
diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php
index 77dea6f23ab..c409d6a500b 100644
--- a/htdocs/admin/tools/dolibarr_import.php
+++ b/htdocs/admin/tools/dolibarr_import.php
@@ -189,7 +189,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
$param .= " -U ".$dolibarr_main_db_user;
$paramcrypted = $param;
$paramclear = $param;
- /*if (! empty($dolibarr_main_db_pass))
+ /*if (!empty($dolibarr_main_db_pass))
{
$paramcrypted.=" -p".preg_replace('/./i','*',$dolibarr_main_db_pass);
$paramclear.=" -p".$dolibarr_main_db_pass;
diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php
index a68f49e36e3..47e6e87a244 100644
--- a/htdocs/admin/workflow.php
+++ b/htdocs/admin/workflow.php
@@ -68,7 +68,7 @@ $workflowcodes = array(
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array(
'family'=>'create',
'position'=>20,
- 'enabled'=>(!empty($conf->commande->enabled) && !empty($conf->facture->enabled)),
+ 'enabled'=>(!empty($conf->commande->enabled) && isModEnabled('facture')),
'picto'=>'bill'
),
'WORKFLOW_TICKET_CREATE_INTERVENTION' => array (
@@ -91,7 +91,7 @@ $workflowcodes = array(
'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array(
'family'=>'classify_proposal',
'position'=>31,
- 'enabled'=>(!empty($conf->propal->enabled) && !empty($conf->facture->enabled)),
+ 'enabled'=>(!empty($conf->propal->enabled) && isModEnabled('facture')),
'picto'=>'propal',
'warning'=>''
),
@@ -112,7 +112,7 @@ $workflowcodes = array(
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array(
'family'=>'classify_order',
'position'=>42,
- 'enabled'=>(!empty($conf->facture->enabled) && !empty($conf->commande->enabled)),
+ 'enabled'=>(isModEnabled('facture') && !empty($conf->commande->enabled)),
'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.
@@ -165,7 +165,7 @@ $workflowcodes = array(
'WORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE' => array(
'family' => 'classify_shipping',
'position' => 90,
- 'enabled' => ! empty($conf->expedition->enabled) && ! empty($conf->facture->enabled),
+ 'enabled' => !empty($conf->expedition->enabled) && !empty($conf->facture->enabled),
'picto' => 'shipment'
),
@@ -173,13 +173,13 @@ $workflowcodes = array(
'WORKFLOW_TICKET_LINK_CONTRACT' => array(
'family' => 'link_ticket',
'position' => 75,
- 'enabled' => ! empty($conf->ticket->enabled) && ! empty($conf->contract->enabled),
+ 'enabled' => !empty($conf->ticket->enabled) && !empty($conf->contract->enabled),
'picto' => 'ticket'
),
'WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS' => array(
'family' => 'link_ticket',
'position' => 76,
- 'enabled' => ! empty($conf->ticket->enabled) && ! empty($conf->contract->enabled),
+ 'enabled' => !empty($conf->ticket->enabled) && !empty($conf->contract->enabled),
'picto' => 'ticket'
),
);
diff --git a/htdocs/asset/agenda.php b/htdocs/asset/agenda.php
index 49a0c215701..3d40cf62328 100644
--- a/htdocs/asset/agenda.php
+++ b/htdocs/asset/agenda.php
@@ -179,7 +179,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 {
@@ -189,7 +189,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/asset/model/agenda.php b/htdocs/asset/model/agenda.php
index a915f540ce9..f1db3030dc2 100644
--- a/htdocs/asset/model/agenda.php
+++ b/htdocs/asset/model/agenda.php
@@ -181,7 +181,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 {
@@ -191,7 +191,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/barcode/codeinit.php b/htdocs/barcode/codeinit.php
index 1a5f99b27ee..b4e365fe018 100644
--- a/htdocs/barcode/codeinit.php
+++ b/htdocs/barcode/codeinit.php
@@ -188,7 +188,7 @@ print '';
print ' ';
// For thirdparty
-if ($conf->societe->enabled) {
+if (isModEnabled('societe')) {
$nbno = $nbtotal = 0;
print load_fiche_titre($langs->trans("BarcodeInitForThirdparties"), '', 'company');
diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php
index ef4ca462008..ea5069cb840 100644
--- a/htdocs/blockedlog/class/blockedlog.class.php
+++ b/htdocs/blockedlog/class/blockedlog.class.php
@@ -140,7 +140,7 @@ class BlockedLog
$this->trackedevents = array();
- if (!empty($conf->facture->enabled)) {
+ if (isModEnabled('facture')) {
$this->trackedevents['BILL_VALIDATE'] = 'logBILL_VALIDATE';
$this->trackedevents['BILL_DELETE'] = 'logBILL_DELETE';
$this->trackedevents['BILL_SENTBYMAIL'] = 'logBILL_SENTBYMAIL';
diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php
index 4bc9095a57e..bce63ed0625 100644
--- a/htdocs/bom/bom_agenda.php
+++ b/htdocs/bom/bom_agenda.php
@@ -220,7 +220,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 {
@@ -230,7 +230,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/bom/bom_card.php b/htdocs/bom/bom_card.php
index addb955bffc..a5c9dd5cf68 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -638,7 +638,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Create MO
- if ($conf->mrp->enabled) {
+ if (isModEnabled('mrp')) {
if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write)) {
print 'id).'">'.$langs->trans("CreateMO").''."\n";
}
diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php
index 8dd6b008045..d2b089491a7 100644
--- a/htdocs/comm/action/class/cactioncomm.class.php
+++ b/htdocs/comm/action/class/cactioncomm.class.php
@@ -198,7 +198,7 @@ class CActionComm
//var_dump($obj->type.' '.$obj->module.' '); var_dump($user->rights->facture->lire);
$qualified = 0;
// Special cases
- if ($obj->module == 'invoice' && !empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
+ 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)) {
diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index d0cb4d7be2f..4005ba45e65 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -40,10 +40,8 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
-if (!empty($conf->facture->enabled)) {
+if (isModEnabled('facture')) {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
-}
-if (!empty($conf->facture->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
}
if (!empty($conf->propal->enabled)) {
@@ -77,7 +75,7 @@ if (!empty($conf->commande->enabled)) {
if (!empty($conf->expedition->enabled)) {
$langs->load("sendings");
}
-if (!empty($conf->facture->enabled)) {
+if (isModEnabled('facture')) {
$langs->load("bills");
}
if (!empty($conf->projet->enabled)) {
@@ -741,7 +739,7 @@ if ($object->id > 0) {
}
}
- if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
+ if (isModEnabled('facture') && $user->rights->facture->lire) {
// Box factures
$tmp = $object->getOutstandingBills('customer', 0);
$outstandingOpened = $tmp['opened'];
@@ -1311,7 +1309,7 @@ if ($object->id > 0) {
/*
* Latest invoices templates
*/
- if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
+ if (isModEnabled('facture') && $user->rights->facture->lire) {
$sql = 'SELECT f.rowid as id, f.titre as ref';
$sql .= ', f.total_ht';
$sql .= ', f.total_tva';
@@ -1406,7 +1404,7 @@ if ($object->id > 0) {
/*
* Latest invoices
*/
- if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
+ if (isModEnabled('facture') && $user->rights->facture->lire) {
$sql = 'SELECT f.rowid as facid, f.ref, f.type';
$sql .= ', f.total_ht';
$sql .= ', f.total_tva';
@@ -1569,7 +1567,7 @@ if ($object->id > 0) {
print '';
}
- if (!empty($conf->facture->enabled) && $object->status == 1) {
+ if (isModEnabled('facture') && $object->status == 1) {
if (empty($user->rights->facture->creer)) {
print '';
} else {
@@ -1597,7 +1595,7 @@ if ($object->id > 0) {
}
// Add action
- if (!empty($conf->agenda->enabled) && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1) {
+ if (isModEnabled('agenda') && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1) {
if ($user->rights->agenda->myactions->create) {
print '';
} else {
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index cc35cfc65a9..10ab441f442 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -696,7 +696,7 @@ if (empty($reshook)) {
if (
!$error && GETPOST('statut', 'int') == $object::STATUS_SIGNED && GETPOST('generate_deposit', 'alpha') == 'on'
- && ! empty($deposit_percent_from_payment_terms) && ! empty($conf->facture->enabled) && ! empty($user->rights->facture->creer)
+ && ! empty($deposit_percent_from_payment_terms) && isModEnabled('facture') && !empty($user->rights->facture->creer)
) {
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
@@ -2001,7 +2001,7 @@ if ($action == 'create') {
$deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
- if (! empty($deposit_percent_from_payment_terms) && ! empty($conf->facture->enabled) && ! empty($user->rights->facture->creer)) {
+ if (!empty($deposit_percent_from_payment_terms) && isModEnabled('facture') && ! empty($user->rights->facture->creer)) {
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
$object->fetchObjectLinked();
@@ -2801,7 +2801,7 @@ if ($action == 'create') {
// Create an invoice and classify billed
if ($object->statut == Propal::STATUS_SIGNED && empty($conf->global->PROPOSAL_ARE_NOT_BILLABLE)) {
- if (!empty($conf->facture->enabled) && $usercancreateinvoice) {
+ if (isModEnabled('facture') && $usercancreateinvoice) {
print ''.$langs->trans("CreateBill").'';
}
diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php
index 0bcf2662a44..e63aee6f240 100644
--- a/htdocs/comm/prospect/index.php
+++ b/htdocs/comm/prospect/index.php
@@ -169,7 +169,7 @@ print '';
/*
* Actions commerciales a faire
*/
-if (!empty($conf->agenda->enabled)) {
+if (isModEnabled('agenda')) {
show_array_actions_to_do(10);
}
diff --git a/htdocs/comm/recap-client.php b/htdocs/comm/recap-client.php
index ee32c0dd016..da37fe1048c 100644
--- a/htdocs/comm/recap-client.php
+++ b/htdocs/comm/recap-client.php
@@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
// Load translation files required by the page
$langs->load("companies");
-if (!empty($conf->facture->enabled)) {
+if (isModEnabled('facture')) {
$langs->load("bills");
}
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index c0aae93dff9..1432d1f132f 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1753,7 +1753,7 @@ if ($action == 'create' && $usercancreate) {
}
// Shipping Method
- if (!empty($conf->expedition->enabled)) {
+ if (isModEnabled('expedition')) {
print ' | '.$langs->trans('SendingMethod').' | ';
print img_picto('', 'object_dolly', 'class="pictofixedwidth"');
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx');
@@ -2383,7 +2383,7 @@ if ($action == 'create' && $usercancreate) {
print ' | ';
// Shipping Method
- if (!empty($conf->expedition->enabled)) {
+ if (isModEnabled('expedition')) {
print ' ';
$editenable = $usercancreate;
print $form->editfieldkey("SendingMethod", 'shippingmethod', '', $object, $editenable);
@@ -2758,11 +2758,11 @@ if ($action == 'create' && $usercancreate) {
// Ship
$numshipping = 0;
- if (!empty($conf->expedition->enabled)) {
+ if (isModEnabled('expedition')) {
$numshipping = $object->nb_expedition();
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
- if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->creer)) {
+ if ((isModEnabled('expedition_bon') && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->creer)) {
if ($user->rights->expedition->creer) {
print dolGetButtonAction('', $langs->trans('CreateShipment'), 'default', DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id, '');
} else {
@@ -2782,7 +2782,7 @@ if ($action == 'create' && $usercancreate) {
// Create bill and Classify billed
// Note: Even if module invoice is not enabled, we should be able to use button "Classified billed"
if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) {
- if (!empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
+ if (isModEnabled('facture') && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
print dolGetButtonAction('', $langs->trans('CreateBill'), 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&token='.newToken().'&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, '');
}
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index cdabf9f2a5a..1e4c4d2e78a 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -1928,7 +1928,7 @@ if ($resql) {
print $getNomUrl_cache[$obj->socid];
// If module invoices enabled and user with invoice creation permissions
- if (!empty($conf->facture->enabled) && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) {
+ if (isModEnabled('facture') && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) {
if ($user->rights->facture->creer) {
if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
print ' ';
diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php
index 8f61261bc11..996ad22fbce 100644
--- a/htdocs/compta/accounting-files.php
+++ b/htdocs/compta/accounting-files.php
@@ -127,7 +127,7 @@ if (empty($entity)) {
$error = 0;
$listofchoices = array(
- 'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills', 'enabled' => !empty($conf->facture->enabled), 'perms' => !empty($user->rights->facture->lire)),
+ 'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills', 'enabled' => isModEnabled('facture'), 'perms' => !empty($user->rights->facture->lire)),
'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills', 'enabled' => !empty($conf->supplier_invoice->enabled), 'perms' => !empty($user->rights->fournisseur->facture->lire)),
'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips', 'enabled' => !empty($conf->expensereport->enabled), 'perms' => !empty($user->rights->expensereport->lire)),
'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation', 'enabled' => !empty($conf->don->enabled), 'perms' => !empty($user->rights->don->lire)),
diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php
index ce373bbf5b5..c08cf54ab4e 100644
--- a/htdocs/compta/bank/card.php
+++ b/htdocs/compta/bank/card.php
@@ -541,7 +541,7 @@ if ($action == 'create') {
print '| '.$langs->trans($bickey).' | ';
print ' | ';
- if ($conf->paymentbybanktransfer->enabled) {
+ if (isModEnabled('paymentbybanktransfer')) {
print '| '.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").' | ';
print ' ';
print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
@@ -778,14 +778,14 @@ if ($action == 'create') {
}
print ' | ';
- if ($conf->prelevement->enabled) {
+ if (isModEnabled('prelevement')) {
print '| '.$form->textwithpicto($langs->trans("ICS"), $langs->trans("ICS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("StandingOrder")).')').' | ';
print ''.$object->ics.' | ';
print ' ';
}
// TODO ICS is not used with bank transfer !
- if ($conf->paymentbybanktransfer->enabled) {
+ if (isModEnabled('paymentbybanktransfer')) {
print '| '.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').' | ';
print ''.$object->ics_transfer.' | ';
print ' ';
@@ -1083,12 +1083,12 @@ if ($action == 'create') {
print '| '.$langs->trans($bickey).' | ';
print ' | ';
- if (!empty($conf->prelevement->enabled)) {
+ if (isModEnabled('prelevement')) {
print '| '.$form->textwithpicto($langs->trans("ICS"), $langs->trans("ICS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("StandingOrder")).')').' | ';
print ' | ';
}
- if (!empty($conf->paymentbybanktransfer->enabled)) {
+ if (!empty(isModEnabled('paymentbybanktransfer'))) {
print '| '.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').' | ';
print ' | ';
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index a2c22d7f878..5993bd39a7c 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -5415,7 +5415,7 @@ class Facture extends CommonInvoice
$langs->load("bills");
- if (empty($conf->facture->enabled)) { // Should not happen. If module disabled, cron job should not be visible.
+ if (!isModEnabled('facture')) { // Should not happen. If module disabled, cron job should not be visible.
$this->output .= $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Facture"));
return 0;
}
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index def6318ed95..93b73d8ddd4 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -121,7 +121,7 @@ print '';
// Latest modified customer invoices
-if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
+if (isModEnabled('facture') && !empty($user->rights->facture->lire)) {
$langs->load("boxes");
$tmpinvoice = new Facture($db);
@@ -582,7 +582,7 @@ if (!empty($conf->tax->enabled) && !empty($user->rights->tax->charges->lire)) {
/*
* Customers orders to be billed
*/
-if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user->rights->commande->lire && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
+if (isModEnabled('facture') && !empty($conf->commande->enabled) && $user->rights->commande->lire && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
$commandestatic = new Commande($db);
$langs->load("orders");
diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php
index 8b2bf351094..4bd79a3c0d5 100644
--- a/htdocs/compta/recap-compta.php
+++ b/htdocs/compta/recap-compta.php
@@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
// Load translation files required by the page
$langs->load("companies");
-if (!empty($conf->facture->enabled)) {
+if (isModEnabled('facture')) {
$langs->load("bills");
}
@@ -116,7 +116,7 @@ if ($id > 0) {
dol_banner_tab($object, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 1);
print dol_get_fiche_end();
- if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
+ if (isModEnabled('facture') && $user->rights->facture->lire) {
// Invoice list
print load_fiche_titre($langs->trans("CustomerPreview"));
diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php
index 68068dec866..719b1deb29a 100644
--- a/htdocs/compta/resultat/index.php
+++ b/htdocs/compta/resultat/index.php
@@ -212,7 +212,7 @@ if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') {
$subtotal_ht = 0;
$subtotal_ttc = 0;
-if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
+if (isModEnabled('facture') && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
if ($modecompta == 'CREANCES-DETTES') {
$sql = "SELECT sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
@@ -269,7 +269,7 @@ if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mod
// Nothing from this table
}
-if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
+if (isModEnabled('facture') && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
// On ajoute les paiements clients anciennes version, non lies par paiement_facture
if ($modecompta != 'CREANCES-DETTES') {
$sql = "SELECT sum(p.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
@@ -324,7 +324,7 @@ if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mod
$subtotal_ht = 0;
$subtotal_ttc = 0;
-if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
+if (isModEnabled('facture') && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
if ($modecompta == 'CREANCES-DETTES') {
$sql = "SELECT sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php
index 35d5028e938..2b8f40b3aba 100644
--- a/htdocs/compta/stats/cabyuser.php
+++ b/htdocs/compta/stats/cabyuser.php
@@ -484,7 +484,7 @@ if (count($amount)) {
if (!empty($conf->commande->enabled) && $key > 0) {
print ' '.img_picto($langs->trans("OrderStats"), "stats").' ';
}
- if (!empty($conf->facture->enabled) && $key > 0) {
+ if (isModEnabled('facture') && $key > 0) {
print ' '.img_picto($langs->trans("InvoiceStats"), "stats").' ';
}
print ' | ';
diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php
index 1df7ae4db62..320efa36ed6 100644
--- a/htdocs/compta/stats/casoc.php
+++ b/htdocs/compta/stats/casoc.php
@@ -658,7 +658,7 @@ if (count($amount)) {
if (!empty($conf->commande->enabled) && $key > 0) {
print ' '.img_picto($langs->trans("OrderStats"), "stats").' ';
}
- if (!empty($conf->facture->enabled) && $key > 0) {
+ if (isModEnabled('facture') && $key > 0) {
print ' '.img_picto($langs->trans("InvoiceStats"), "stats").' ';
}
print '';
diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php
index 98b6ccea3b1..5f07922b2e4 100644
--- a/htdocs/contact/agenda.php
+++ b/htdocs/contact/agenda.php
@@ -252,7 +252,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$out = '';
$newcardbutton = '';
- if (!empty($conf->agenda->enabled)) {
+ if (isModEnabled('agenda')) {
$permok = $user->rights->agenda->myactions->create;
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') {
@@ -267,7 +267,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
}
- 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))) {
print ' ';
$param = '&id='.$id;
diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php
index 195a4d028f4..a72ea3d7d21 100644
--- a/htdocs/contact/canvas/actions_contactcard_common.class.php
+++ b/htdocs/contact/canvas/actions_contactcard_common.class.php
@@ -206,7 +206,7 @@ abstract class ActionsContactCardCommon
$this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_contrat ? $this->object->ref_contrat : $langs->trans("NoContactForAnyContract");
$i++;
}
- if (!empty($conf->facture->enabled)) {
+ if (isModEnabled('facture')) {
$this->tpl['contact_element'][$i]['linked_element_label'] = $langs->trans("ContactForInvoices");
$this->tpl['contact_element'][$i]['linked_element_value'] = $this->object->ref_facturation ? $this->object->ref_facturation : $langs->trans("NoContactForAnyInvoice");
$i++;
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index cd12fd12150..30189680bc7 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -1241,7 +1241,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' ';
}
- if (!empty($conf->facture->enabled)) {
+ if (isModEnabled('facture')) {
print ' | '.$langs->trans("ContactForInvoices").' | ';
print $object->ref_facturation ? $object->ref_facturation : (''.$langs->trans("NoContactForAnyInvoice").'');
print ' | ';
@@ -1511,7 +1511,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' |
';
}
- if (!empty($conf->facture->enabled)) {
+ if (isModEnabled('facture')) {
print '
| '.$langs->trans("ContactForInvoices").' | ';
print $object->ref_facturation ? $object->ref_facturation : $langs->trans("NoContactForAnyInvoice");
print ' |
';
diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php
index b7fc682d2c6..41a6a74dd4b 100644
--- a/htdocs/contact/consumption.php
+++ b/htdocs/contact/consumption.php
@@ -159,7 +159,7 @@ if ($object->thirdparty->client) {
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders');
}
- if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
+ if (isModEnabled('facture') && $user->rights->facture->lire) {
$elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices');
}
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php
index d654ac38d9f..70761162153 100644
--- a/htdocs/contrat/agenda.php
+++ b/htdocs/contrat/agenda.php
@@ -243,7 +243,7 @@ if ($id > 0) {
$newcardbutton = '';
- if (!empty($conf->agenda->enabled)) {
+ if (isModEnabled('agenda')) {
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
$backtopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
$out = '&origin='.$object->element.'&originid='.$object->id.'&backtopage='.urlencode($backtopage);
@@ -251,7 +251,7 @@ if ($id > 0) {
}
}
- 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))) {
print '
';
$param = '&id='.$id;
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index d17f5399679..3202d8598d0 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -2071,7 +2071,7 @@ if ($action == 'create') {
}
}
- if (!empty($conf->facture->enabled) && $object->statut > 0) {
+ if (isModEnabled('facture') && $object->statut > 0) {
$langs->load("bills");
if ($user->rights->facture->creer) {
print dolGetButtonAction($langs->trans('CreateBill'), '', 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params);
diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php
index 1f3ccf70f3a..530457f45fa 100644
--- a/htdocs/contrat/services_list.php
+++ b/htdocs/contrat/services_list.php
@@ -486,7 +486,7 @@ $morefilter = '';
$moreforfilter = '';
// If the user can view categories of products
-if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) {
+if (isModEnabled('categorie') && ($user->rights->produit->lire || $user->rights->service->lire)) {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
$tmptitle = $langs->trans('IncludingProductWithTag');
diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php
index b90f3c8ebd0..a4fbbd16c58 100644
--- a/htdocs/core/actions_addupdatedelete.inc.php
+++ b/htdocs/core/actions_addupdatedelete.inc.php
@@ -137,7 +137,7 @@ if ($action == 'add' && !empty($permissiontoadd)) {
$result = $object->create($user);
if ($result > 0) {
// Creation OK
- if ($conf->categorie->enabled && method_exists($object, 'setCategories')) {
+ if (isModEnabled('categorie') && method_exists($object, 'setCategories')) {
$categories = GETPOST('categories', 'array:int');
$object->setCategories($categories);
}
@@ -244,7 +244,7 @@ if ($action == 'update' && !empty($permissiontoadd)) {
}
}
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
$categories = GETPOST('categories', 'array');
if (method_exists($object, 'setCategories')) {
$object->setCategories($categories);
diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php
index ae4f7c41515..de69e19c3e2 100644
--- a/htdocs/core/ajax/selectsearchbox.php
+++ b/htdocs/core/ajax/selectsearchbox.php
@@ -105,7 +105,7 @@ if (!empty($conf->commande->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUS
if (!empty($conf->expedition->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->rights->expedition->lire) {
$arrayresult['searchintoshipment'] = array('position'=>80, 'img'=>'object_shipment', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('', 'object_shipment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
-if (!empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire) {
+if (isModEnabled('facture') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire) {
$arrayresult['searchintoinvoice'] = array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
@@ -120,7 +120,7 @@ if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_S
}
// Customer payments
-if (!empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire) {
+if (isModEnabled('facture') && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire) {
$arrayresult['searchintocustomerpayments'] = array(
'position'=>170,
'img'=>'object_payment',
diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php
index 02b5070a96c..ea43eff12fc 100644
--- a/htdocs/core/boxes/box_activity.php
+++ b/htdocs/core/boxes/box_activity.php
@@ -62,7 +62,7 @@ class box_activity extends ModeleBoxes
// FIXME: Pb into some status
$this->enabled = ($conf->global->MAIN_FEATURES_LEVEL); // Not enabled by default due to bugs (see previous comments)
- $this->hidden = !((!empty($conf->facture->enabled) && $user->rights->facture->lire)
+ $this->hidden = !((isModEnabled('facture') && $user->rights->facture->lire)
|| (!empty($conf->commande->enabled) && $user->rights->commande->lire)
|| (!empty($conf->propal->enabled) && $user->rights->propale->lire)
);
@@ -278,7 +278,7 @@ class box_activity extends ModeleBoxes
// list the summary of the bills
- if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
+ if (isModEnabled('facture') && $user->rights->facture->lire) {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$facturestatic = new Facture($this->db);
diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php
index 24be4100dab..28461e07de5 100644
--- a/htdocs/core/boxes/box_dolibarr_state_board.php
+++ b/htdocs/core/boxes/box_dolibarr_state_board.php
@@ -126,7 +126,7 @@ class box_dolibarr_state_board extends ModeleBoxes
'services' => !empty($conf->service->enabled) && $user->rights->service->lire,
'proposals' => !empty($conf->propal->enabled) && $user->rights->propale->lire,
'orders' => !empty($conf->commande->enabled) && $user->rights->commande->lire,
- 'invoices' => !empty($conf->facture->enabled) && $user->rights->facture->lire,
+ 'invoices' => isModEnabled('facture') && $user->rights->facture->lire,
'donations' => !empty($conf->don->enabled) && $user->rights->don->lire,
'contracts' => !empty($conf->contrat->enabled) && $user->rights->contrat->lire,
'interventions' => !empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire,
diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php
index adcc750a6a8..afed778912f 100644
--- a/htdocs/core/boxes/box_graph_product_distribution.php
+++ b/htdocs/core/boxes/box_graph_product_distribution.php
@@ -60,7 +60,7 @@ class box_graph_product_distribution extends ModeleBoxes
$this->db = $db;
$this->hidden = !(
- (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire))
+ (isModEnabled('facture') && !empty($user->rights->facture->lire))
|| (!empty($conf->commande->enabled) && !empty($user->rights->commande->lire))
|| (!empty($conf->propal->enabled) && !empty($user->rights->propale->lire))
);
@@ -107,7 +107,7 @@ class box_graph_product_distribution extends ModeleBoxes
$showinvoicenb = 1;
$showordernb = 1;
}
- if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) {
+ if (!isModEnabled('facture') || empty($user->rights->facture->lire)) {
$showinvoicenb = 0;
}
if (empty($conf->propal->enabled) || empty($user->rights->propale->lire)) {
@@ -278,7 +278,7 @@ class box_graph_product_distribution extends ModeleBoxes
}
- if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
+ if (isModEnabled('facture') && !empty($user->rights->facture->lire)) {
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($showinvoicenb) {
$langs->load("bills");
@@ -372,7 +372,7 @@ class box_graph_product_distribution extends ModeleBoxes
if (!empty($conf->commande->enabled) || !empty($user->rights->commande->lire)) {
$stringtoshow .= ' '.$langs->trans("ForCustomersOrders");
}
- if (!empty($conf->facture->enabled) || !empty($user->rights->facture->lire)) {
+ if (isModEnabled('facture') || !empty($user->rights->facture->lire)) {
$stringtoshow .= ' '.$langs->trans("ForCustomersInvoices");
$stringtoshow .= ' ';
}
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index c7651c81d26..9f34fa3a15f 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -2066,7 +2066,7 @@ class ExtraFields
} elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) {
$value_arr = GETPOST("options_".$key, 'array'); // check if an array
if (!empty($value_arr)) {
- $value_key = implode($value_arr, ',');
+ $value_key = implode(',', $value_arr);
} else {
$value_key = '';
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index ca5be02b1d9..56990effeb2 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -8502,13 +8502,13 @@ class Form
// To work with non standard path
if ($objecttype == 'facture') {
$tplpath = 'compta/'.$element;
- if (empty($conf->facture->enabled)) {
+ if (!isModEnabled('facture')) {
continue; // Do not show if module disabled
}
} elseif ($objecttype == 'facturerec') {
$tplpath = 'compta/facture';
$tplname = 'linkedobjectblockForRec';
- if (empty($conf->facture->enabled)) {
+ if (!isModEnabled('facture')) {
continue; // Do not show if module disabled
}
} elseif ($objecttype == 'propal') {
@@ -8644,12 +8644,12 @@ class Form
'label'=>'LinkToOrder',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'),
'invoice'=>array(
- 'enabled'=>(!empty($conf->facture->enabled) ? $conf->facture->enabled : 0),
+ 'enabled'=>isModEnabled('facture'),
'perms'=>1,
'label'=>'LinkToInvoice',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
'invoice_template'=>array(
- 'enabled'=>(!empty($conf->facture->enabled) ? $conf->facture->enabled : 0),
+ 'enabled'=>isModEnabled('facture'),
'perms'=>1,
'label'=>'LinkToTemplateInvoice',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php
index 1bc009491d1..242c1476736 100644
--- a/htdocs/core/class/html.formactions.class.php
+++ b/htdocs/core/class/html.formactions.class.php
@@ -226,7 +226,7 @@ class FormActions
}
$newcardbutton = '';
- if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create)) {
+ if (isModEnabled('agenda') && !empty($user->rights->agenda->myactions->create)) {
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create&token='.newToken().'&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')).'&origin='.urlencode($typeelement).'&originid='.((int) $object->id).((!empty($object->socid) && $object->socid > 0) ? '&socid='.((int) $object->socid) : ((!empty($socid) && $socid > 0) ? '&socid='.((int) $socid) : '')).($projectid > 0 ? '&projectid='.((int) $projectid) : '').($taskid > 0 ? '&taskid='.((int) $taskid) : '').'&backtopage='.urlencode($urlbacktopage);
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url);
}
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 9d87b63cbb8..27ef700cd09 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -396,7 +396,7 @@ class FormMail extends Form
// Define output language
$outputlangs = $langs;
$newlang = '';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
+ if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) {
$newlang = $this->param['langsmodels'];
}
if (!empty($newlang)) {
@@ -585,7 +585,10 @@ class FormMail extends Form
}
// Add also company main email
- $liste['company'] = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
+ if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL)) {
+ $liste['company'] = !empty($conf->global->MAIN_INFO_SOCIETE_NOM)?$conf->global->MAIN_INFO_SOCIETE_NOM:$conf->global->MAIN_INFO_SOCIETE_MAIL;
+ $liste['company'].=' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
+ }
// Add also email aliases if there is some
$listaliases = array(
@@ -1541,7 +1544,7 @@ class FormMail extends Form
$extrafields->fetch_name_optionals_label($product->table_element, true);
- if (is_array($extrafields->attributes[$product->table_element]['label']) && count($extrafields->attributes[$product->table_element]['label']) > 0) {
+ if (!empty($extrafields->attributes[$product->table_element]['label']) && is_array($extrafields->attributes[$product->table_element]['label']) && count($extrafields->attributes[$product->table_element]['label']) > 0) {
foreach ($extrafields->attributes[$product->table_element]['label'] as $key => $label) {
$substit_line['__PRODUCT_EXTRAFIELD_'.strtoupper($key).'__'] = $product->array_options['options_'.$key];
}
@@ -1619,7 +1622,7 @@ class FormMail extends Form
if (!empty($conf->don->enabled)) {
$tmparray['__SECUREKEYPAYMENT_DONATION__'] = 'SecureKeyPAYMENTUniquePerDonation';
}
- if (!empty($conf->facture->enabled)) {
+ if (isModEnabled('facture')) {
$tmparray['__SECUREKEYPAYMENT_INVOICE__'] = 'SecureKeyPAYMENTUniquePerInvoice';
}
if (!empty($conf->commande->enabled)) {
@@ -1636,7 +1639,7 @@ class FormMail extends Form
if (!empty($conf->don->enabled)) {
$tmparray['__ONLINEPAYMENTLINK_DONATION__'] = 'OnlinePaymentLinkUniquePerDonation';
}
- if (!empty($conf->facture->enabled)) {
+ if (isModEnabled('facture')) {
$tmparray['__ONLINEPAYMENTLINK_INVOICE__'] = 'OnlinePaymentLinkUniquePerInvoice';
}
if (!empty($conf->commande->enabled)) {
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index 31a48f38cf4..957026c2180 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -433,7 +433,7 @@ class FormTicket
}
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_TICKET, '', 'parent', 64, 0, 1);
diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php
index b085ce49db0..17a8b7c1231 100644
--- a/htdocs/core/lib/admin.lib.php
+++ b/htdocs/core/lib/admin.lib.php
@@ -1712,7 +1712,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu
print 'mymailmanlist
';
print 'mymailmanlist1,mymailmanlist2
';
print 'TYPE:Type1:mymailmanlist1,TYPE:Type2:mymailmanlist2
';
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print 'CATEG:Categ1:mymailmanlist1,CATEG:Categ2:mymailmanlist2
';
}
print '
';
@@ -1744,7 +1744,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu
print "\n";
} elseif ($obj->type == 'html') {
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor = new DolEditor('constvalue'.(empty($strictw3c) ? '' : ($strictw3c == 3 ? '_'.$const : '[]')), $obj->value, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
+ $doleditor = new DolEditor('constvalue'.(empty($strictw3c) ? '' : ($strictw3c == 3 ? '_'.$const : '[]')), $obj->value, '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%');
$doleditor->Create();
} elseif ($obj->type == 'yesno') {
print $form->selectyesno('constvalue'.(empty($strictw3c) ? '' : ($strictw3c == 3 ? '_'.$const : '[]')), $obj->value, 1);
@@ -1991,14 +1991,14 @@ function email_admin_prepare_head()
$head[$h][2] = 'common';
$h++;
- if (!empty($conf->mailing->enabled)) {
+ if (isModEnabled('mailing')) {
$head[$h][0] = DOL_URL_ROOT."/admin/mails_emailing.php";
$head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing", $langs->transnoentitiesnoconv("EMailing"));
$head[$h][2] = 'common_emailing';
$h++;
}
- if (!empty($conf->ticket->enabled)) {
+ if (isModEnabled('ticket')) {
$head[$h][0] = DOL_URL_ROOT."/admin/mails_ticket.php";
$head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing", $langs->transnoentitiesnoconv("Ticket"));
$head[$h][2] = 'common_ticket';
diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php
index 6feee8c35d5..0f7334345fa 100644
--- a/htdocs/core/lib/agenda.lib.php
+++ b/htdocs/core/lib/agenda.lib.php
@@ -92,7 +92,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', !$canedit, '', '', '0', false, 'minwidth100 maxwidth500 widthcentpercentminusxx');
print '
';
- if (!empty($conf->resource->enabled)) {
+ if (isModEnabled('resource')) {
include_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
$formresource = new FormResource($db);
@@ -104,14 +104,14 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
}
}
- if (!empty($conf->societe->enabled) && !empty($user->rights->societe->lire)) {
+ if (isModEnabled('societe') && !empty($user->rights->societe->lire)) {
print '';
print img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth inline-block"');
print $form->select_company($socid, 'search_socid', '', ' ', 0, 0, null, 0, 'minwidth100 maxwidth500');
print '
';
}
- if (!empty($conf->projet->enabled) && !empty($user->rights->projet->lire)) {
+ if (isModEnabled('projet') && !empty($user->rights->projet->lire)) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
$formproject = new FormProjets($db);
@@ -423,7 +423,7 @@ function actions_prepare_head($object)
$h++;
// Tab to link resources
- if ($conf->resource->enabled) {
+ if (isModEnabled('resource')) {
include_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
$resource = new DolResource($db);
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 4938d20c3c4..896921ac436 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -128,7 +128,7 @@ function societe_prepare_head(Societe $object)
}
}
$supplier_module_enabled = 0;
- if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
+ if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
$supplier_module_enabled = 1;
}
if ($supplier_module_enabled == 1 && $object->fournisseur && !empty($user->rights->fournisseur->lire)) {
@@ -171,7 +171,7 @@ function societe_prepare_head(Societe $object)
}
// Tab to link resources
- if (!empty($conf->resource->enabled) && !empty($conf->global->RESOURCE_ON_THIRDPARTIES)) {
+ if (isModEnabled('resource') && !empty($conf->global->RESOURCE_ON_THIRDPARTIES)) {
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=societe&element_id='.$object->id;
$head[$h][1] = $langs->trans("Resources");
$head[$h][2] = 'resources';
@@ -179,7 +179,7 @@ function societe_prepare_head(Societe $object)
}
// Related items
- if ((!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
+ if ((isModEnabled('commande') || isModEnabled('propal') || isModEnabled('facture') || isModEnabled('ficheinter') || (isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
&& empty($conf->global->THIRDPARTIES_DISABLE_RELATED_OBJECT_TAB)) {
$head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Referers");
@@ -195,7 +195,7 @@ function societe_prepare_head(Societe $object)
$title = $langs->trans("PaymentModes");
- if (!empty($conf->stripe->enabled)) {
+ if (isModEnabled('stripe')) {
//$langs->load("stripe");
//$title = $langs->trans("BankAccountsAndGateways");
@@ -215,7 +215,7 @@ function societe_prepare_head(Societe $object)
$sql = "SELECT COUNT(n.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as n";
$sql .= " WHERE n.fk_soc = ".((int) $object->id);
- if (empty($conf->stripe->enabled)) {
+ if (!isModEnabled('stripe')) {
$sql .= " AND n.stripe_card_ref IS NULL";
} else {
$sql .= " AND (n.stripe_card_ref IS NULL OR (n.stripe_card_ref IS NOT NULL AND n.status = ".((int) $servicestatus)."))";
@@ -229,7 +229,7 @@ function societe_prepare_head(Societe $object)
dol_print_error($db);
}
- //if (! empty($conf->stripe->enabled) && $nbBankAccount > 0) $nbBankAccount = '...'; // No way to know exact number
+ //if (isModEnabled('stripe') && $nbBankAccount > 0) $nbBankAccount = '...'; // No way to know exact number
$head[$h][0] = DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.urlencode($object->id);
$head[$h][1] = $title;
@@ -242,7 +242,7 @@ function societe_prepare_head(Societe $object)
$h++;
}
- if (!empty($conf->website->enabled) && (!empty($conf->global->WEBSITE_USE_WEBSITE_ACCOUNTS)) && (!empty($user->rights->societe->lire))) {
+ if (isModEnabled('website') && (!empty($conf->global->WEBSITE_USE_WEBSITE_ACCOUNTS)) && (!empty($user->rights->societe->lire))) {
$head[$h][0] = DOL_URL_ROOT.'/societe/website.php?id='.urlencode($object->id);
$head[$h][1] = $langs->trans("WebSiteAccounts");
$nbNote = 0;
@@ -285,7 +285,7 @@ function societe_prepare_head(Societe $object)
if ($user->socid == 0) {
// Notifications
- if (!empty($conf->notification->enabled)) {
+ if (isModEnabled('notification')) {
$nbNotif = 0;
// Enable caching of thirdparty count notifications
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
@@ -361,7 +361,7 @@ function societe_prepare_head(Societe $object)
$head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Events");
- 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))) {
$nbEvent = 0;
// Enable caching of thirdrparty count actioncomm
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
@@ -1283,7 +1283,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
print '
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -58,11 +59,11 @@ if ($action == 'presend') {
// Define output language
$outputlangs = $langs;
$newlang = '';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
- $newlang = GETPOST('lang_id', 'aZ09');
- }
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
+ if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
+ if (GETPOST('lang_id', 'aZ09')) {
+ $newlang = GETPOST('lang_id', 'aZ09');
+ }
}
if (!empty($newlang)) {
@@ -212,7 +213,14 @@ if ($action == 'presend') {
$formmail->setSubstitFromObject($object, $langs);
}
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object);
- $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '
' : '';
+ $substitutionarray['__CHECK_READ__'] = "";
+ if (is_object($object) && is_object($object->thirdparty)) {
+ $checkRead= '
global->MAILING_EMAIL_UNSUBSCRIBE_KEY)?urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY):"");
+ $checkRead.='" width="1" height="1" style="width:1px;height:1px" border="0"/>';
+ $substitutionarray['__CHECK_READ__'] = $checkRead;
+ }
$substitutionarray['__PERSONALIZED__'] = ''; // deprecated
$substitutionarray['__CONTACTCIVNAME__'] = '';
$parameters = array(
diff --git a/htdocs/core/tpl/onlinepaymentlinks.tpl.php b/htdocs/core/tpl/onlinepaymentlinks.tpl.php
index 06d93e5ea5f..e40f360051e 100644
--- a/htdocs/core/tpl/onlinepaymentlinks.tpl.php
+++ b/htdocs/core/tpl/onlinepaymentlinks.tpl.php
@@ -52,7 +52,7 @@ if (!empty($conf->commande->enabled)) {
}
print '
';
}
-if (!empty($conf->facture->enabled)) {
+if (isModEnabled('facture')) {
print '';
print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':
';
print ''.getOnlinePaymentUrl(1, 'invoice')."
\n";
diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
index 1d46aec1008..8bd1e0d647d 100644
--- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
+++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
@@ -91,7 +91,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
// Order to invoice
if ($action == 'ORDER_CLOSE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
- if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE)) {
+ if (isModEnabled('facture') && !empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE)) {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$newobject = new Facture($this->db);
diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php
index 3b906883c00..51a3f7ced7b 100644
--- a/htdocs/ecm/index_auto.php
+++ b/htdocs/ecm/index_auto.php
@@ -325,7 +325,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
if (!empty($conf->commande->enabled)) {
$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 (!empty($conf->facture->enabled)) {
+ if (isModEnabled('facture')) {
$rowspan++; $sectionauto[] = array('position'=>60, 'level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices")));
}
if (!empty($conf->supplier_proposal->enabled)) {
diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php
index 42b8efba42f..a6782317802 100644
--- a/htdocs/ecm/search.php
+++ b/htdocs/ecm/search.php
@@ -128,7 +128,7 @@ if (!empty($conf->contrat->enabled)) {
if (!empty($conf->commande->enabled)) {
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders")));
}
-if (!empty($conf->facture->enabled)) {
+if (isModEnabled('facture')) {
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices")));
}
if (!empty($conf->supplier_proposal->enabled)) {
diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php
index 0d14811ef67..0d5991bb0ac 100644
--- a/htdocs/eventorganization/conferenceorbooth_card.php
+++ b/htdocs/eventorganization/conferenceorbooth_card.php
@@ -299,7 +299,7 @@ if (!empty($withproject)) {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
print $form->showCategories($projectstatic->id, Categorie::TYPE_PROJECT, 1);
print " |
";
diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php
index 67cb2c659ee..da6c0f8ee04 100644
--- a/htdocs/eventorganization/conferenceorbooth_contact.php
+++ b/htdocs/eventorganization/conferenceorbooth_contact.php
@@ -282,7 +282,7 @@ if (!empty($withproject)) {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
print $form->showCategories($projectstatic->id, Categorie::TYPE_PROJECT, 1);
print " |
";
diff --git a/htdocs/eventorganization/conferenceorbooth_document.php b/htdocs/eventorganization/conferenceorbooth_document.php
index 742585ffb16..739e6f81036 100644
--- a/htdocs/eventorganization/conferenceorbooth_document.php
+++ b/htdocs/eventorganization/conferenceorbooth_document.php
@@ -257,7 +257,7 @@ if (!empty($withproject)) {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
print $form->showCategories($projectstatic->id, Categorie::TYPE_PROJECT, 1);
print " |
";
diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php
index 6d42d881ab8..958d1ab897d 100644
--- a/htdocs/eventorganization/conferenceorbooth_list.php
+++ b/htdocs/eventorganization/conferenceorbooth_list.php
@@ -382,7 +382,7 @@ if ($projectid > 0) {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
print $form->showCategories($project->id, Categorie::TYPE_PROJECT, 1);
print " |
";
diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php
index c60c0418d43..b02edfc4a34 100644
--- a/htdocs/eventorganization/conferenceorboothattendee_card.php
+++ b/htdocs/eventorganization/conferenceorboothattendee_card.php
@@ -327,7 +327,7 @@ if (!empty($withproject)) {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
print $form->showCategories($projectstatic->id, 'project', 1);
print " |
";
diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php
index 878b1baf992..972e546255f 100644
--- a/htdocs/eventorganization/conferenceorboothattendee_list.php
+++ b/htdocs/eventorganization/conferenceorboothattendee_list.php
@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
-if ($conf->categorie->enabled) {
+if (isModEnabled('categorie')) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
}
@@ -510,7 +510,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
print $form->showCategories($projectstatic->id, 'project', 1);
print " |
";
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index d341f293827..af508cf3291 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -2477,7 +2477,7 @@ if ($action == 'create') {
// TODO add alternative status
// 0=draft, 1=validated, 2=billed, we miss a status "delivered" (only available on order)
if ($object->statut == Expedition::STATUS_CLOSED && $user->rights->expedition->creer) {
- if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ?
+ if (isModEnabled('facture') && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ?
print dolGetButtonAction('', $langs->trans('ClassifyUnbilled'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, '');
} else {
print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, '');
@@ -2496,7 +2496,7 @@ if ($action == 'create') {
}
// Create bill
- if (!empty($conf->facture->enabled) && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED)) {
+ if (isModEnabled('facture') && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED)) {
if ($user->rights->facture->creer) {
// TODO show button only if (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))
// If we do that, we must also make this option official.
@@ -2514,7 +2514,7 @@ if ($action == 'create') {
if ($user->rights->expedition->creer && $object->statut > 0 && !$object->billed) {
$label = "Close"; $paramaction = 'classifyclosed'; // = Transferred/Received
// Label here should be "Close" or "ClassifyBilled" if we decided to make bill on shipments instead of orders
- if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ?
+ if (isModEnabled('facture') && !empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ?
$label = "ClassifyBilled";
$paramaction = 'classifybilled';
}
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index 6e2bee75e6e..4b7686449c7 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -40,7 +40,7 @@ if (!empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
-if ($conf->contrat->enabled) {
+if (isModEnabled('contrat')) {
require_once DOL_DOCUMENT_ROOT."/core/class/html.formcontract.class.php";
require_once DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php";
}
@@ -928,7 +928,7 @@ if ($action == 'create') {
}
// Contract
- if ($conf->contrat->enabled) {
+ if (isModEnabled('contrat')) {
$langs->load("contracts");
print '| '.$langs->trans("Contract").' | ';
$numcontrat = $formcontract->select_contract($soc->id, GETPOST('contratid', 'int'), 'contratid', 0, 1, 1);
@@ -1659,7 +1659,7 @@ if ($action == 'create') {
}
// Invoicing
- if (!empty($conf->facture->enabled) && $object->statut > Fichinter::STATUS_DRAFT) {
+ if (isModEnabled('facture') && $object->statut > Fichinter::STATUS_DRAFT) {
$langs->load("bills");
if ($object->statut < Fichinter::STATUS_BILLED) {
if ($user->rights->facture->creer) {
diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php
index 8ad44d198a8..2d649589282 100644
--- a/htdocs/fourn/card.php
+++ b/htdocs/fourn/card.php
@@ -881,7 +881,7 @@ if ($object->id > 0) {
}
// Add action
- if (!empty($conf->agenda->enabled) && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1) {
+ if (isModEnabled('agenda') && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1) {
if ($user->rights->agenda->myactions->create) {
print dolGetButtonAction('', $langs->trans('AddAction'), 'default', DOL_URL_ROOT.'/comm/action/card.php?action=create&socid='.$object->id, '');
} else {
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 6ab316edb56..0417554f8fd 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -2573,7 +2573,7 @@ if ($action == 'create') {
}
// Create bill
- //if (! empty($conf->facture->enabled))
+ //if (isModEnabled('facture'))
//{
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) { // statut 2 means approved, 7 means canceled
if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
@@ -2584,7 +2584,7 @@ if ($action == 'create') {
// Classify billed manually (need one invoice if module invoice is on, no condition on invoice if not)
if ($usercancreate && $object->statut >= 2 && $object->statut != 7 && $object->billed != 1) { // statut 2 means approved
- if (empty($conf->facture->enabled)) {
+ if (!isModEnabled('facture')) {
print 'id.'&action=classifybilled&token='.newToken().'">'.$langs->trans("ClassifyBilled").'';
} else {
if (!empty($object->linkedObjectsIds['invoice_supplier'])) {
diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php
index 6c64672ee84..728986f5a88 100644
--- a/htdocs/fourn/commande/info.php
+++ b/htdocs/fourn/commande/info.php
@@ -201,7 +201,7 @@ if ($permok) {
print '';
-if (!empty($conf->agenda->enabled)) {
+if (isModEnabled('agenda')) {
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
print ' id).'">'.$langs->trans("AddAction").'';
} else {
diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php
index 87a09043a62..8d2d234dd43 100644
--- a/htdocs/hrm/evaluation_agenda.php
+++ b/htdocs/hrm/evaluation_agenda.php
@@ -198,7 +198,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 {
@@ -208,7 +208,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/hrm/index.php b/htdocs/hrm/index.php
index c573b78ed51..1160ee0fc14 100644
--- a/htdocs/hrm/index.php
+++ b/htdocs/hrm/index.php
@@ -343,11 +343,11 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme
$sql.= " rp.rowid as jobid, rp.ref as jobref, rp.label";
$sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as rp ON rc.fk_recruitmentjobposition = rp.rowid";
- if ($conf->societe->enabled && empty($user->rights->societe->client->voir) && !$socid) {
+ if (isModEnabled('societe') && empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE rc.entity IN (".getEntity($staticrecruitmentcandidature->element).")";
- if ($conf->societe->enabled && empty($user->rights->societe->client->voir) && !$socid) {
+ if (isModEnabled('societe') && empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND rp.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
diff --git a/htdocs/hrm/job_agenda.php b/htdocs/hrm/job_agenda.php
index 0d966e67416..b8008f009ea 100644
--- a/htdocs/hrm/job_agenda.php
+++ b/htdocs/hrm/job_agenda.php
@@ -189,14 +189,14 @@ if ($object->id > 0) {
}
- if (!empty($conf->agenda->enabled)) {
+ if (isModEnabled('agenda')) {
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
}
}
- 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/hrm/position_agenda.php b/htdocs/hrm/position_agenda.php
index fda60a29259..24f2d9e32ef 100644
--- a/htdocs/hrm/position_agenda.php
+++ b/htdocs/hrm/position_agenda.php
@@ -197,7 +197,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 {
@@ -207,7 +207,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/hrm/skill_agenda.php b/htdocs/hrm/skill_agenda.php
index d73271a4f26..e1947741bde 100644
--- a/htdocs/hrm/skill_agenda.php
+++ b/htdocs/hrm/skill_agenda.php
@@ -191,7 +191,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 {
@@ -201,7 +201,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/index.php b/htdocs/index.php
index 5593eaffacf..08b818bac63 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -156,7 +156,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
// Number of actions to do (late)
- if (!empty($conf->agenda->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_AGENDA) && $user->rights->agenda->myactions->read) {
+ if (isModEnabled('agenda') && empty($conf->global->MAIN_DISABLE_BLOCK_AGENDA) && $user->rights->agenda->myactions->read) {
include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$board = new ActionComm($db);
$dashboardlines[$board->element] = $board->load_board($user);
@@ -229,7 +229,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
}
// Number of invoices customers (paid)
- if (!empty($conf->facture->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_CUSTOMER) && $user->rights->facture->lire) {
+ if (isModEnabled('facture') && empty($conf->global->MAIN_DISABLE_BLOCK_CUSTOMER) && $user->rights->facture->lire) {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$board = new Facture($db);
$dashboardlines[$board->element] = $board->load_board($user);
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 4a9705c8ae7..30e7b45d198 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -2011,7 +2011,7 @@ function migrate_modeles($db, $langs, $conf)
dolibarr_install_syslog("upgrade2::migrate_modeles");
- if (!empty($conf->facture->enabled)) {
+ if (isModEnabled('facture')) {
include_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
$modellist = ModelePDFFactures::liste_modeles($db);
if (count($modellist) == 0) {
diff --git a/htdocs/knowledgemanagement/knowledgerecord_agenda.php b/htdocs/knowledgemanagement/knowledgerecord_agenda.php
index 81750e720c7..003faa326d5 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_agenda.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_agenda.php
@@ -218,7 +218,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 {
@@ -228,7 +228,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/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php
index 0c7ed519042..e9c58bf31a4 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_card.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_card.php
@@ -411,7 +411,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print ' | '.$langs->trans("Categories").' | ';
print $form->showCategories($object->id, Categorie::TYPE_KNOWLEDGEMANAGEMENT, 1);
print " | ";
diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang
index 820339e6875..349cb42fbab 100644
--- a/htdocs/langs/en_US/languages.lang
+++ b/htdocs/langs/en_US/languages.lang
@@ -93,6 +93,7 @@ Language_nl_BE=Dutch (Belgium)
Language_nl_NL=Dutch
Language_pl_PL=Polish
Language_pt_AO=Portuguese (Angola)
+Language_pt_MZ=Portuguese (Mozambique)
Language_pt_BR=Portuguese (Brazil)
Language_pt_PT=Portuguese
Language_ro_MD=Romanian (Moldavia)
diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php
index 37ab6194da5..e6f560d7a42 100644
--- a/htdocs/loan/class/loan.class.php
+++ b/htdocs/loan/class/loan.class.php
@@ -224,15 +224,15 @@ class Loan extends CommonObject
$this->error = "ErrorBadParameter";
return -2;
}
- if (($conf->accounting->enabled) && empty($this->account_capital)) {
+ if (isModEnabled('accounting') && empty($this->account_capital)) {
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("LoanAccountancyCapitalCode"));
return -2;
}
- if (($conf->accounting->enabled) && empty($this->account_insurance)) {
+ if (isModEnabled('accounting') && empty($this->account_insurance)) {
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("LoanAccountancyInsuranceCode"));
return -2;
}
- if (($conf->accounting->enabled) && empty($this->account_interest)) {
+ if (isModEnabled('accounting') && empty($this->account_interest)) {
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("LoanAccountancyInterestCode"));
return -2;
}
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index c5ef90a0ecd..076ab0dbc6a 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -376,7 +376,7 @@ if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) {
register_shutdown_function('dol_shutdown');
// Load debugbar
-if (!empty($conf->debugbar->enabled) && !GETPOST('dol_use_jmobile') && empty($_SESSION['dol_use_jmobile'])) {
+if (isModEnabled('debugbar') && !GETPOST('dol_use_jmobile') && empty($_SESSION['dol_use_jmobile'])) {
global $debugbar;
include_once DOL_DOCUMENT_ROOT.'/debugbar/class/DebugBar.php';
$debugbar = new DolibarrDebugBar();
@@ -1752,7 +1752,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
if (!$disablejs && !empty($conf->use_javascript_ajax)) {
// CKEditor
- if (empty($disableforlogin) && (!empty($conf->fckeditor->enabled) && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor') && !defined('DISABLE_CKEDITOR')) || defined('FORCE_CKEDITOR')) {
+ if (empty($disableforlogin) && (isModEnabled('fckeditor') && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor') && !defined('DISABLE_CKEDITOR')) || defined('FORCE_CKEDITOR')) {
print ''."\n";
$pathckeditor = DOL_URL_ROOT.'/includes/ckeditor/ckeditor/';
$jsckeditor = 'ckeditor.js';
@@ -1780,7 +1780,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
// Browser notifications (if NOREQUIREMENU is on, it is mostly a page for popup, so we do not enable notif too. We hide also for public pages).
if (!defined('NOBROWSERNOTIF') && !defined('NOREQUIREMENU') && !defined('NOLOGIN')) {
$enablebrowsernotif = false;
- if (!empty($conf->agenda->enabled) && !empty($conf->global->AGENDA_REMINDER_BROWSER)) {
+ if (isModEnabled('agenda') && !empty($conf->global->AGENDA_REMINDER_BROWSER)) {
$enablebrowsernotif = true;
}
if ($conf->browser->layout == 'phone') {
@@ -1959,7 +1959,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
}
// Link to module builder
- if (!empty($conf->modulebuilder->enabled)) {
+ if (isModEnabled('modulebuilder')) {
$text = ' ';
//$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
$text .= '';
@@ -2445,7 +2445,7 @@ function printDropdownQuickadd()
"title" => "NewBill@bills",
"name" => "Bill@bills",
"picto" => "object_bill",
- "activation" => !empty($conf->facture->enabled) && $user->rights->facture->creer, // vs hooking
+ "activation" => isModEnabled('facture') && $user->rights->facture->creer, // vs hooking
"position" => 50,
),
array(
diff --git a/htdocs/modulebuilder/admin/setup.php b/htdocs/modulebuilder/admin/setup.php
index e7c42578bd6..08791b8324a 100644
--- a/htdocs/modulebuilder/admin/setup.php
+++ b/htdocs/modulebuilder/admin/setup.php
@@ -26,7 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
global $conf, $langs, $user, $db;
$langs->loadLangs(array("admin", "other", "modulebuilder"));
-if (!$user->admin || empty($conf->modulebuilder->enabled)) {
+if (!$user->admin || !isModEnabled('modulebuilder')) {
accessforbidden();
}
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 10a040ca7e5..68aa224423c 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -73,7 +73,7 @@ $objectname = dol_sanitizeFileName(GETPOST('objectname', 'alpha'));
$dicname = dol_sanitizeFileName(GETPOST('dicname', 'alpha'));
// Security check
-if (empty($conf->modulebuilder->enabled)) {
+if (!isModEnabled('modulebuilder')) {
accessforbidden();
}
if (!$user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) {
diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php
index b40092f93a7..164af332ed8 100644
--- a/htdocs/modulebuilder/template/myobject_agenda.php
+++ b/htdocs/modulebuilder/template/myobject_agenda.php
@@ -279,7 +279,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 {
@@ -289,7 +289,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/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php
index e1b19d87ad0..3317ddcfd43 100644
--- a/htdocs/mrp/mo_agenda.php
+++ b/htdocs/mrp/mo_agenda.php
@@ -218,7 +218,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 {
@@ -228,7 +228,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/partnership/partnership_agenda.php b/htdocs/partnership/partnership_agenda.php
index 4c68a83d4e2..9930093e6be 100644
--- a/htdocs/partnership/partnership_agenda.php
+++ b/htdocs/partnership/partnership_agenda.php
@@ -218,7 +218,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 {
@@ -228,7 +228,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/product/agenda.php b/htdocs/product/agenda.php
index b595bd3b9cb..8ec76640871 100644
--- a/htdocs/product/agenda.php
+++ b/htdocs/product/agenda.php
@@ -187,7 +187,7 @@ if ($id > 0 || $ref) {
$out = '';
$morehtmlcenter = '';
- if (!empty($conf->agenda->enabled)) {
+ if (isModEnabled('agenda')) {
$permok = $user->rights->agenda->myactions->create;
if ((!empty($objproduct->id) || !empty($objcon->id)) && $permok) {
if (get_class($objproduct) == 'Product') {
@@ -200,7 +200,7 @@ if ($id > 0 || $ref) {
$morehtmlcenter = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', $linktocreatetimeBtnStatus);
}
- 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))) {
print ' ';
$param = '&id='.$id;
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 3b8b19a335c..a1b450f7a0c 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -56,7 +56,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.class.php'
if (!empty($conf->propal->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
}
-if (!empty($conf->facture->enabled)) {
+if (isModEnabled('facture')) {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
}
if (!empty($conf->commande->enabled)) {
@@ -76,7 +76,7 @@ $langs->loadLangs(array('products', 'other'));
if (!empty($conf->stock->enabled)) {
$langs->load("stocks");
}
-if (!empty($conf->facture->enabled)) {
+if (isModEnabled('facture')) {
$langs->load("bills");
}
if (!empty($conf->productbatch->enabled)) {
@@ -2127,7 +2127,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Tags-Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1);
$c = new Categorie($db);
@@ -2632,7 +2632,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print ' | | '.$langs->trans("Categories").' | ';
print $form->showCategories($object->id, Categorie::TYPE_PRODUCT, 1);
print " | ";
@@ -2814,7 +2814,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action ==
}
// Factures
- if (!empty($conf->facture->enabled) && $user->rights->facture->creer) {
+ if (isModEnabled('facture') && $user->rights->facture->creer) {
$invoice = new Facture($db);
$langs->load("bills");
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 9358eb9c60d..5a7990cd0a7 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -3479,6 +3479,81 @@ class Product extends CommonObject
}
}
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Charge tableau des stats facture recurrentes pour le produit/service
+ *
+ * @param int $socid Id societe
+ * @return int Array of stats in $this->stats_facture, <0 if ko or >0 if ok
+ */
+ public function load_stats_facturerec($socid = 0)
+ {
+ // phpcs:enable
+ global $db, $conf, $user, $hookmanager;
+
+ $sql = "SELECT COUNT(DISTINCT f.fk_soc) as nb_customers, COUNT(DISTINCT f.rowid) as nb,";
+ $sql .= " COUNT(fd.rowid) as nb_rows, SUM('fd.qty') as qty";
+ $sql .= " FROM ".MAIN_DB_PREFIX."facturedet_rec as fd";
+ $sql .= ", ".MAIN_DB_PREFIX."facture_rec as f";
+ $sql .= ", ".MAIN_DB_PREFIX."societe as s";
+ if (empty($user->rights->societe->client->voir) && !$socid) {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
+ $sql .= " WHERE f.rowid = fd.fk_facture";
+ $sql .= " AND f.fk_soc = s.rowid";
+ $sql .= " AND f.entity IN (".getEntity('invoice').")";
+ $sql .= " AND fd.fk_product = ".((int) $this->id);
+ if (empty($user->rights->societe->client->voir) && !$socid) {
+ $sql .= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
+ }
+ //$sql.= " AND f.fk_statut != 0";
+ if ($socid > 0) {
+ $sql .= " AND f.fk_soc = ".((int) $socid);
+ }
+
+ $result = $this->db->query($sql);
+ if ($result) {
+ $obj = $this->db->fetch_object($result);
+ $this->stats_facturerec['customers'] = $obj->nb_customers;
+ $this->stats_facturerec['nb'] = $obj->nb;
+ $this->stats_facturerec['rows'] = $obj->nb_rows;
+ $this->stats_facturerec['qty'] = $obj->qty ? $obj->qty : 0;
+
+ // if it's a virtual product, maybe it is in invoice by extension
+ if (!empty($conf->global->PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC)) {
+ $TFather = $this->getFather();
+ if (is_array($TFather) && !empty($TFather)) {
+ foreach ($TFather as &$fatherData) {
+ $pFather = new Product($this->db);
+ $pFather->id = $fatherData['id'];
+ $qtyCoef = $fatherData['qty'];
+
+ if ($fatherData['incdec']) {
+ $pFather->load_stats_facture($socid);
+
+ $this->stats_facturerec['customers'] += $pFather->stats_facturerec['customers'];
+ $this->stats_facturerec['nb'] += $pFather->stats_facturerec['nb'];
+ $this->stats_facturerec['rows'] += $pFather->stats_facturerec['rows'];
+ $this->stats_facturerec['qty'] += $pFather->stats_facturerec['qty'] * $qtyCoef;
+ }
+ }
+ }
+ }
+
+ $parameters = array('socid' => $socid);
+ $reshook = $hookmanager->executeHooks('loadStatsCustomerInvoiceRec', $parameters, $this, $action);
+ if ($reshook > 0) {
+ $this->stats_facturerec = $hookmanager->resArray['stats_facturerec'];
+ }
+
+ return 1;
+ } else {
+ $this->error = $this->db->error();
+ return -1;
+ }
+ }
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge tableau des stats facture pour le produit/service
diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php
index 8d9188f1965..b77997fcfc7 100644
--- a/htdocs/product/stats/card.php
+++ b/htdocs/product/stats/card.php
@@ -206,7 +206,7 @@ if ($result || !($id > 0)) {
print ' |
';
// Tag
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
$moreforfilter .= img_picto($langs->trans("Categories"), 'category', 'class="pictofixedwidth"');
$moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ', 1, 1, 'widthcentpercentminusx maxwidth400');
@@ -303,49 +303,49 @@ if ($result || !($id > 0)) {
}
}
- if ($conf->propal->enabled) {
+ if (isModEnabled('propal')) {
$graphfiles['propal'] = array('modulepart'=>'productstats_proposals',
'file' => $object->id.'/propal12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsProposals") : $langs->transnoentitiesnoconv("NumberOfProposals")));
}
- if ($conf->supplier_proposal->enabled) {
+ if (isModEnabled('supplier_proposal')) {
$graphfiles['proposalssuppliers'] = array('modulepart'=>'productstats_proposalssuppliers',
'file' => $object->id.'/proposalssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsSupplierProposals") : $langs->transnoentitiesnoconv("NumberOfSupplierProposals")));
}
- if ($conf->order->enabled) {
+ if (isModEnabled('order')) {
$graphfiles['orders'] = array('modulepart'=>'productstats_orders',
'file' => $object->id.'/orders12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsCustomerOrders") : $langs->transnoentitiesnoconv("NumberOfCustomerOrders")));
}
- if ($conf->supplier_order->enabled) {
+ if (isModEnabled('supplier_order')) {
$graphfiles['orderssuppliers'] = array('modulepart'=>'productstats_orderssuppliers',
'file' => $object->id.'/orderssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsSupplierOrders") : $langs->transnoentitiesnoconv("NumberOfSupplierOrders")));
}
- if ($conf->facture->enabled) {
+ if (isModEnabled('facture')) {
$graphfiles['invoices'] = array('modulepart'=>'productstats_invoices',
'file' => $object->id.'/invoices12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsCustomerInvoices") : $langs->transnoentitiesnoconv("NumberOfCustomerInvoices")));
}
- if ($conf->supplier_invoice->enabled) {
+ if (isModEnabled('supplier_invoice')) {
$graphfiles['invoicessuppliers'] = array('modulepart'=>'productstats_invoicessuppliers',
'file' => $object->id.'/invoicessuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsSupplierInvoices") : $langs->transnoentitiesnoconv("NumberOfSupplierInvoices")));
}
- if ($conf->contrat->enabled) {
+ if (isModEnabled('contrat')) {
$graphfiles['contracts'] = array('modulepart'=>'productstats_contracts',
'file' => $object->id.'/contracts12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsContracts") : $langs->transnoentitiesnoconv("NumberOfContracts")));
}
- if ($conf->mrp->enabled) {
+ if (isModEnabled('mrp')) {
$graphfiles['mrp'] = array('modulepart'=>'productstats_mrp',
'file' => $object->id.'/mos12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.($search_year > 0 ? '_year'.$search_year : '').'.png',
'label' => ($mode == 'byunit' ? $langs->transnoentitiesnoconv("NumberOfUnitsMos") : $langs->transnoentitiesnoconv("NumberOfMos")));
diff --git a/htdocs/product/stats/facturerec.php b/htdocs/product/stats/facturerec.php
new file mode 100644
index 00000000000..b71c24d75cb
--- /dev/null
+++ b/htdocs/product/stats/facturerec.php
@@ -0,0 +1,313 @@
+
+ * Copyright (C) 2004-2016 Laurent Destailleur
+ * Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2014 Juanjo Menent
+ * Copyright (C) 2014 Florian Henry
+ * Copyright (C) 2022 Eric Seigne
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/product/stats/facturerec.php
+ * \ingroup product service template facture
+ * \brief Page of template invoice statistics for a product
+ */
+
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
+require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
+
+// Load translation files required by the page
+$langs->loadLangs(array('companies', 'bills', 'products', 'supplier_proposal'));
+
+$id = GETPOST('id', 'int');
+$ref = GETPOST('ref', 'alpha');
+
+// Security check
+$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
+$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
+$socid = '';
+if (!empty($user->socid)) {
+ $socid = $user->socid;
+}
+
+// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$hookmanager->initHooks(array('productstatsinvoice'));
+
+$showmessage = GETPOST('showmessage');
+
+// Load variable for pagination
+$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$sortfield = GETPOST('sortfield', 'aZ09comma');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
+if (empty($page) || $page == -1) {
+ $page = 0;
+} // If $page is not defined, or '' or -1
+$offset = $limit * $page;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+if (!$sortorder) {
+ $sortorder = "DESC";
+}
+if (!$sortfield) {
+ $sortfield = "f.datec";
+}
+
+$search_month = GETPOST('search_month', 'int');
+$search_year = GETPOST('search_year', 'int');
+
+if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
+ $search_month = '';
+ $search_year = '';
+}
+
+$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
+
+
+/*
+ * View
+ */
+
+$invoicestatic = new FactureRec($db);
+$societestatic = new Societe($db);
+
+$form = new Form($db);
+$formother = new FormOther($db);
+
+if ($id > 0 || !empty($ref)) {
+ $product = new Product($db);
+ $result = $product->fetch($id, $ref);
+
+ $object = $product;
+
+ $parameters = array('id'=>$id);
+ $reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
+ if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+ }
+
+ $title = $langs->trans('ProductServiceCard');
+ $helpurl = '';
+ $shortlabel = dol_trunc($object->label, 16);
+ if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) {
+ $title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Referers');
+ $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
+ }
+ if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) {
+ $title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Referers');
+ $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
+ }
+
+ llxHeader('', $title, $helpurl);
+
+ if ($result > 0) {
+ $head = product_prepare_head($product);
+ $titre = $langs->trans("CardProduct".$product->type);
+ $picto = ($product->type == Product::TYPE_SERVICE ? 'service' : 'product');
+ print dol_get_fiche_head($head, 'referers', $titre, -1, $picto);
+
+ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
+ if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+ }
+
+ $linkback = ''.$langs->trans("BackToList").'';
+
+ $shownav = 1;
+ if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) {
+ $shownav = 0;
+ }
+
+ dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
+
+ print '';
+
+ print ' ';
+ print ' ';
+
+ $nboflines = show_stats_for_company($product, $socid);
+
+ print " ";
+
+ print ' ';
+ print '';
+
+ print dol_get_fiche_end();
+
+ if ($showmessage && $nboflines > 1) {
+ print ''.$langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers")).'';
+ } elseif ($user->rights->facture->lire) {
+ $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
+ $sql .= "f.titre, f.datec, f.rowid as facid,";
+ $sql .= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used
+ if (empty($user->rights->societe->client->voir) && !$socid) {
+ $sql .= ", sc.fk_soc, sc.fk_user ";
+ }
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
+ $sql .= ", ".MAIN_DB_PREFIX."facture_rec as f";
+ $sql .= ", ".MAIN_DB_PREFIX."facturedet_rec as d";
+ if (empty($user->rights->societe->client->voir) && !$socid) {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
+ $sql .= " WHERE f.fk_soc = s.rowid";
+ $sql .= " AND f.entity IN (".getEntity('invoice').")";
+ $sql .= " AND d.fk_facture = f.rowid";
+ $sql .= " AND d.fk_product = ".((int) $product->id);
+ if (!empty($search_month)) {
+ $sql .= ' AND MONTH(f.datec) IN ('.$db->sanitize($search_month).')';
+ }
+ if (!empty($search_year)) {
+ $sql .= ' AND YEAR(f.datec) IN ('.$db->sanitize($search_year).')';
+ }
+ if (empty($user->rights->societe->client->voir) && !$socid) {
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
+ }
+ if ($socid) {
+ $sql .= " AND f.fk_soc = ".((int) $socid);
+ }
+ $sql .= $db->order($sortfield, $sortorder);
+
+ // Calcul total qty and amount for global if full scan list
+ $total_ht = 0;
+ $total_qty = 0;
+
+ // Count total nb of records
+ $totalofrecords = '';
+ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
+ $result = $db->query($sql);
+ $totalofrecords = $db->num_rows($result);
+ }
+
+ $sql .= $db->plimit($limit + 1, $offset);
+
+ $result = $db->query($sql);
+ if ($result) {
+ $num = $db->num_rows($result);
+
+ if ($limit > 0 && $limit != $conf->liste_limit) {
+ $option .= '&limit='.urlencode($limit);
+ }
+ if (!empty($id)) {
+ $option .= '&id='.$product->id;
+ }
+ if (!empty($search_month)) {
+ $option .= '&search_month='.urlencode($search_month);
+ }
+ if (!empty($search_year)) {
+ $option .= '&search_year='.urlencode($search_year);
+ }
+
+ print '';
+ } else {
+ dol_print_error($db);
+ }
+ $db->free($result);
+ }
+ }
+} else {
+ dol_print_error();
+}
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index 252763ef43b..2b8ee3db6a4 100644
--- a/htdocs/product/stock/card.php
+++ b/htdocs/product/stock/card.php
@@ -545,7 +545,7 @@ if ($action == 'create') {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
print $form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1);
print " | ";
@@ -919,7 +919,7 @@ if ($action == 'create') {
}
// Tags-Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE, '', 'parent', 64, 0, 1);
$c = new Categorie($db);
diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php
index 2ad77fca49e..775e07d6118 100644
--- a/htdocs/product/stock/movement_list.php
+++ b/htdocs/product/stock/movement_list.php
@@ -903,7 +903,7 @@ if ($object->id > 0) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print ' | | '.$langs->trans("Categories").' | ';
print $form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1);
print " | ";
diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php
index f649e46cc27..6523d66552f 100644
--- a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php
+++ b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php
@@ -214,7 +214,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 {
@@ -224,7 +224,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);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php
index 0c97674191e..2a61d44eb9e 100644
--- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php
+++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php
@@ -592,7 +592,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$morehtmlref = '';
// Thirdparty
- if ($conf->societe->enabled) {
+ if (isModEnabled('societe')) {
$morehtmlref .= $langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '').' ';
}
// Project
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index 4f7cb3ce7a0..813dccf8a73 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -602,7 +602,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
}
// Thirdparty
- if ($conf->societe->enabled) {
+ if (isModEnabled('societe')) {
print ' | ';
print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ? '' : '');
print $langs->trans("ThirdParty");
@@ -898,7 +898,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
print ' | ';
// Thirdparty
- if ($conf->societe->enabled) {
+ if (isModEnabled('societe')) {
print '| ';
print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ? '' : '');
print $langs->trans("ThirdParty");
@@ -1001,7 +1001,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
print ' | ';
// Tags-Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT, '', 'parent', 64, 0, 1);
$c = new Categorie($db);
@@ -1170,7 +1170,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
print ' | ';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
print " | ";
@@ -1326,7 +1326,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
$langs->load("orders");
print dolGetButtonAction('', $langs->trans('CreateOrder'), 'default', DOL_URL_ROOT.'/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid, '');
}
- if (!empty($conf->facture->enabled) && $user->rights->facture->creer) {
+ if (isModEnabled('facture') && $user->rights->facture->creer) {
$langs->load("bills");
print dolGetButtonAction('', $langs->trans('CreateBill'), 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid, '');
}
diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php
index 3bea4b5db03..997f45a39d0 100644
--- a/htdocs/projet/comment.php
+++ b/htdocs/projet/comment.php
@@ -167,7 +167,7 @@ print nl2br($object->description);
print ' |
';
// Categories
-if ($conf->categorie->enabled) {
+if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
print " |
";
diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php
index 3230c325039..be130572704 100644
--- a/htdocs/projet/contact.php
+++ b/htdocs/projet/contact.php
@@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
-if ($conf->categorie->enabled) {
+if (isModEnabled('categorie')) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
}
@@ -421,7 +421,7 @@ if ($id > 0 || !empty($ref)) {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
print " |
";
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index caad4374da0..fb4011ada8c 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -42,7 +42,7 @@ if (!empty($conf->stock->enabled)) {
if (!empty($conf->propal->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
}
-if (!empty($conf->facture->enabled)) {
+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';
}
@@ -73,7 +73,7 @@ if (!empty($conf->deplacement->enabled)) {
if (!empty($conf->expensereport->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
}
-if (!empty($conf->agenda->enabled)) {
+if (isModEnabled('agenda')) {
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
}
if (!empty($conf->don->enabled)) {
@@ -104,7 +104,7 @@ if (!empty($conf->mrp->enabled)) {
// Load translation files required by the page
$langs->loadLangs(array('projects', 'companies', 'suppliers', 'compta'));
-if (!empty($conf->facture->enabled)) {
+if (isModEnabled('facture')) {
$langs->load("bills");
}
if (!empty($conf->commande->enabled)) {
@@ -343,7 +343,7 @@ print nl2br($object->description);
print '';
// Categories
-if ($conf->categorie->enabled) {
+if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
print " |
";
diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php
index c0dd96537a6..dda13754d31 100644
--- a/htdocs/projet/ganttview.php
+++ b/htdocs/projet/ganttview.php
@@ -216,7 +216,7 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '| '.$langs->trans("Categories").' | ';
print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
print " |
";
diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php
index 9b0544bccf6..19897bf2859 100644
--- a/htdocs/projet/info.php
+++ b/htdocs/projet/info.php
@@ -167,7 +167,7 @@ if ($permok) {
//print '';
$morehtmlcenter = '';
-if (!empty($conf->agenda->enabled)) {
+if (isModEnabled('agenda')) {
$addActionBtnRight = !empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create);
$morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight);
}
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index c08880e44ea..410b637f3e6 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -648,7 +648,7 @@ if ($id > 0 || !empty($ref)) {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '
| '.$langs->trans("Categories").' | ';
print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
print " |
";
diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php
index e2686ded9f2..82628d5136b 100644
--- a/htdocs/projet/tasks/comment.php
+++ b/htdocs/projet/tasks/comment.php
@@ -258,7 +258,7 @@ if ($id > 0 || !empty($ref)) {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '
| '.$langs->trans("Categories").' | ';
print $form->showCategories($projectstatic->id, 'project', 1);
print " |
";
diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php
index 327d8783256..9718a0ffccb 100644
--- a/htdocs/projet/tasks/contact.php
+++ b/htdocs/projet/tasks/contact.php
@@ -289,7 +289,7 @@ if ($id > 0 || !empty($ref)) {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '
| '.$langs->trans("Categories").' | ';
print $form->showCategories($projectstatic->id, 'project', 1);
print " |
";
diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php
index 0e520989d8c..bd696e90434 100644
--- a/htdocs/projet/tasks/document.php
+++ b/htdocs/projet/tasks/document.php
@@ -245,7 +245,7 @@ if ($object->id > 0) {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '
| '.$langs->trans("Categories").' | ';
print $form->showCategories($projectstatic->id, 'project', 1);
print " |
";
diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php
index 652b195afd4..206a92afb36 100644
--- a/htdocs/projet/tasks/note.php
+++ b/htdocs/projet/tasks/note.php
@@ -235,7 +235,7 @@ if ($object->id > 0) {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '
| '.$langs->trans("Categories").' | ';
print $form->showCategories($projectstatic->id, 'project', 1);
print " |
";
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 9fce4072183..5b0f097d22f 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -333,7 +333,7 @@ if ($id > 0 || !empty($ref)) {
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '
| '.$langs->trans("Categories").' | ';
print $form->showCategories($projectstatic->id, 'project', 1);
print " |
";
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index 4c7a65c9d54..f47eb2a49d3 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -869,7 +869,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '
| '.$langs->trans("Categories").' | ';
print $form->showCategories($projectstatic->id, 'project', 1);
print " |
";
diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php
index 5553ee464c7..c0b88736ce3 100644
--- a/htdocs/public/payment/paymentok.php
+++ b/htdocs/public/payment/paymentok.php
@@ -533,11 +533,11 @@ if ($ispaymentok) {
$emetteur_banque = '';
// Define default choice for complementary actions
$option = '';
- if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) {
+ if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) {
$option = 'bankviainvoice';
} elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && !empty($conf->banque->enabled)) {
$option = 'bankdirect';
- } elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) {
+ } elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) {
$option = 'invoiceonly';
}
if (empty($option)) {
@@ -927,7 +927,7 @@ if ($ispaymentok) {
}
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
- if (!empty($conf->facture->enabled)) {
+ if (isModEnabled('facture')) {
if (!empty($FinalPaymentAmt) && $paymentTypeId > 0 ) {
include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
$invoice = new Facture($db);
diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php
index 243135fbf6a..241a8427e8f 100644
--- a/htdocs/reception/card.php
+++ b/htdocs/reception/card.php
@@ -2084,7 +2084,7 @@ if ($action == 'create') {
// TODO add alternative status
// 0=draft, 1=validated, 2=billed, we miss a status "delivered" (only available on order)
if ($object->statut == Reception::STATUS_CLOSED && $user->rights->reception->creer) {
- if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) { // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ?
+ if (isModEnabled('facture') && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) { // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ?
print '
id.'&action=reopen&token='.newToken().'">'.$langs->trans("ClassifyUnbilled").'';
} else {
print '
id.'&action=reopen&token='.newToken().'">'.$langs->trans("ReOpen").'';
diff --git a/htdocs/recruitment/recruitmentcandidature_agenda.php b/htdocs/recruitment/recruitmentcandidature_agenda.php
index 74a48994f71..54ac648d1d0 100644
--- a/htdocs/recruitment/recruitmentcandidature_agenda.php
+++ b/htdocs/recruitment/recruitmentcandidature_agenda.php
@@ -218,7 +218,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 {
@@ -228,7 +228,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/recruitment/recruitmentindex.php b/htdocs/recruitment/recruitmentindex.php
index b4d943584cd..f028f2f8243 100644
--- a/htdocs/recruitment/recruitmentindex.php
+++ b/htdocs/recruitment/recruitmentindex.php
@@ -331,11 +331,11 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme
$sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms, s.status, COUNT(rc.rowid) as nbapplications";
$sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as s";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc ON rc.fk_recruitmentjobposition = s.rowid";
- if ($conf->societe->enabled && empty($user->rights->societe->client->voir) && !$socid) {
+ if (isModEnabled('societe') && empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.entity IN (".getEntity($staticrecruitmentjobposition->element).")";
- if ($conf->societe->enabled && empty($user->rights->societe->client->voir) && !$socid) {
+ if (isModEnabled('societe') && empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
@@ -402,11 +402,11 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme
$sql = "SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status";
$sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as s ON rc.fk_recruitmentjobposition = s.rowid";
- if ($conf->societe->enabled && empty($user->rights->societe->client->voir) && !$socid) {
+ if (isModEnabled('societe') && empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE rc.entity IN (".getEntity($staticrecruitmentjobposition->element).")";
- if ($conf->societe->enabled && empty($user->rights->societe->client->voir) && !$socid) {
+ if (isModEnabled('societe') && empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
diff --git a/htdocs/recruitment/recruitmentjobposition_agenda.php b/htdocs/recruitment/recruitmentjobposition_agenda.php
index 45c84005743..1391ddb132d 100644
--- a/htdocs/recruitment/recruitmentjobposition_agenda.php
+++ b/htdocs/recruitment/recruitmentjobposition_agenda.php
@@ -217,7 +217,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 {
@@ -227,7 +227,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/resource/agenda.php b/htdocs/resource/agenda.php
index 363f334a7eb..cb13ce78e7d 100644
--- a/htdocs/resource/agenda.php
+++ b/htdocs/resource/agenda.php
@@ -164,7 +164,7 @@ if ($object->id > 0) {
print dol_get_fiche_end();
- 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/societe/agenda.php b/htdocs/societe/agenda.php
index bebe542a6f9..89b69bda83c 100644
--- a/htdocs/societe/agenda.php
+++ b/htdocs/societe/agenda.php
@@ -157,13 +157,13 @@ if ($socid > 0) {
}
$newcardbutton = '';
- if (!empty($conf->agenda->enabled)) {
+ if (isModEnabled('agenda')) {
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
}
}
- 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))) {
print '
';
$param = '&socid='.urlencode($socid);
diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php
index 5f997a37e9c..f74758296a9 100644
--- a/htdocs/societe/consumption.php
+++ b/htdocs/societe/consumption.php
@@ -168,7 +168,7 @@ if ($object->client) {
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders');
}
- if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
+ if (isModEnabled('facture') && $user->rights->facture->lire) {
$elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices');
}
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
@@ -199,13 +199,13 @@ if ($object->fournisseur) {
$obj = $db->fetch_object($resql);
$nbCmdsFourn = $obj->nb;
$thirdTypeArray['supplier'] = $langs->trans("supplier");
- if (($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) {
+ if ((isModEnabled('fournisseur') && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) {
$elementTypeArray['supplier_invoice'] = $langs->transnoentitiesnoconv('SuppliersInvoices');
}
- if (($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire)) {
+ if ((isModEnabled('fournisseur') && $user->rights->fournisseur->commande->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire)) {
$elementTypeArray['supplier_order'] = $langs->transnoentitiesnoconv('SuppliersOrders');
}
- if ($conf->supplier_proposal->enabled && $user->rights->supplier_proposal->lire) {
+ if (isModEnabled('supplier_proposal') && $user->rights->supplier_proposal->lire) {
$elementTypeArray['supplier_proposal'] = $langs->transnoentitiesnoconv('SupplierProposals');
}
}
diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php
index 597fc4b80ea..f4637186b4d 100644
--- a/htdocs/societe/index.php
+++ b/htdocs/societe/index.php
@@ -118,16 +118,16 @@ $result = $db->query($sql);
if ($result) {
while ($objp = $db->fetch_object($result)) {
$found = 0;
- if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) {
+ if (isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS) && ($objp->client == 2 || $objp->client == 3)) {
$found = 1; $third['prospect']++;
}
- if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) {
+ if (isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS) && ($objp->client == 1 || $objp->client == 3)) {
$found = 1; $third['customer']++;
}
- if ((($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $objp->fournisseur) {
+ if (((isModEnabled('fournisseur') && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled('supplier_order') && $user->rights->supplier_order->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $objp->fournisseur) {
$found = 1; $third['supplier']++;
}
- if (!empty($conf->societe->enabled) && $objp->client == 0 && $objp->fournisseur == 0) {
+ if (isModEnabled('societe') && $objp->client == 0 && $objp->fournisseur == 0) {
$found = 1; $third['other']++;
}
if ($found) {
@@ -144,16 +144,16 @@ $thirdpartygraph .= '
| '.$langs->trans("St
if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) + (round($third['customer']) ? 1 : 0) + (round($third['supplier']) ? 1 : 0) + (round($third['other']) ? 1 : 0) >= 2)) {
$thirdpartygraph .= ' |
|---|
| ';
$dataseries = array();
- if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) {
+ if (isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) {
$dataseries[] = array($langs->trans("Prospects"), round($third['prospect']));
}
- if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) {
+ if (isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) {
$dataseries[] = array($langs->trans("Customers"), round($third['customer']));
}
- if ((($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) {
+ if ((($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled('supplier_order') && $user->rights->supplier_order->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) {
$dataseries[] = array($langs->trans("Suppliers"), round($third['supplier']));
}
- if (!empty($conf->societe->enabled)) {
+ if (isModEnabled('societe')) {
$dataseries[] = array($langs->trans("Others"), round($third['other']));
}
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
@@ -167,18 +167,18 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) +
$thirdpartygraph .= $dolgraph->show();
$thirdpartygraph .= ' |
'."\n";
} else {
- if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) {
+ if (isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) {
$statstring = "
";
$statstring .= '| '.$langs->trans("Prospects").' | '.round($third['prospect']).' | ';
$statstring .= "
";
}
- if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) {
+ if (isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) {
$statstring .= "
";
$statstring .= '| '.$langs->trans("Customers").' | '.round($third['customer']).' | ';
$statstring .= "
";
}
$statstring2 = '';
- if (((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) {
+ if (((isModEnabled('societe') && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled('supplier_order') && $user->rights->supplier_order->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) {
$statstring2 = "
";
$statstring2 .= '| '.$langs->trans("Suppliers").' | '.round($third['supplier']).' | ';
$statstring2 .= "
";
diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php
index e2ac40f8770..d623e5699de 100644
--- a/htdocs/societe/paymentmodes.php
+++ b/htdocs/societe/paymentmodes.php
@@ -784,7 +784,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders');
}
- if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
+ if (isModEnabled('facture') && $user->rights->facture->lire) {
$elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices');
}
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
@@ -838,16 +838,16 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$obj = $db->fetch_object($resql);
$nbFactsClient = $obj->nb;
$thirdTypeArray['customer'] = $langs->trans("customer");
- if ($conf->propal->enabled && $user->rights->propal->lire) {
+ if (isModEnabled('propal') && $user->rights->propal->lire) {
$elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals');
}
- if ($conf->commande->enabled && $user->rights->commande->lire) {
+ if (isModEnabled('commande') && $user->rights->commande->lire) {
$elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders');
}
- if ($conf->facture->enabled && $user->rights->facture->lire) {
+ if (isModEnabled('facture') && $user->rights->facture->lire) {
$elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices');
}
- if ($conf->contrat->enabled && $user->rights->contrat->lire) {
+ if (isModEnabled('contrat') && $user->rights->contrat->lire) {
$elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts');
}
}
diff --git a/htdocs/theme/md/main_menu_fa_icons.inc.php b/htdocs/theme/md/main_menu_fa_icons.inc.php
index 34827384139..0e0b144d187 100644
--- a/htdocs/theme/md/main_menu_fa_icons.inc.php
+++ b/htdocs/theme/md/main_menu_fa_icons.inc.php
@@ -22,8 +22,8 @@
font-size: 1.5em;
}
-div.mainmenu {
- background-image: none !important;
+div.mainmenu.menu {
+ background-image: none;
}
div.mainmenu.menu::before {
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index efa2eba0999..a527aca93bf 100755
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -1125,7 +1125,7 @@ if ($action == 'create' || $action == 'presend') {
print '
';
// Categories
- if ($conf->categorie->enabled) {
+ if (isModEnabled('categorie')) {
print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '
';
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index 3ac3727af13..e1314f369a0 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -2871,7 +2871,7 @@ class Ticket extends CommonObject
$sql = "SELECT p.rowid, p.ref, p.datec as datec";
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as p";
- if ($conf->societe->enabled && empty($user->rights->societe->client->voir) && !$user->socid) {
+ if (isModEnabled('societe') && empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = " AND";
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index f0b362b383e..254a3ea9e75 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -1154,7 +1154,7 @@ if ($action == 'create' || $action == 'adduserldap') {
}
// User color
- if (!empty($conf->agenda->enabled)) {
+ if (isModEnabled('agenda')) {
print '| '.$langs->trans("ColorUser").' | ';
print '';
print $formother->selectColor(GETPOSTISSET('color') ?GETPOST('color', 'alphanohtml') : $object->color, 'color', null, 1, '', 'hideifnotset');
@@ -1605,7 +1605,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print '';
// Color user
- if (!empty($conf->agenda->enabled)) {
+ if (isModEnabled('agenda')) {
print '| '.$langs->trans("ColorUser").' | ';
print '';
print $formother->showColor($object->color, '');
@@ -2544,7 +2544,7 @@ if ($action == 'create' || $action == 'adduserldap') {
}
// User color
- if (!empty($conf->agenda->enabled)) {
+ if (isModEnabled('agenda')) {
print ' | | '.$langs->trans("ColorUser").' | ';
print '';
if ($caneditfield) {
diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php
index f92afe53a4f..c2ea42e6c6a 100644
--- a/htdocs/user/param_ihm.php
+++ b/htdocs/user/param_ihm.php
@@ -204,7 +204,7 @@ if (!empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled))
if (!empty($conf->adherent->enabled)) {
$tmparray['adherents/index.php?mainmenu=members&leftmenu='] = 'MembersArea';
}
-if (!empty($conf->agenda->enabled)) {
+if (isModEnabled('agenda')) {
$tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = 'Agenda';
}
if (!empty($conf->ticket->enabled)) {
diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php
index efa7d43a269..e40ed6aa2e7 100644
--- a/test/phpunit/FactureTest.php
+++ b/test/phpunit/FactureTest.php
@@ -83,7 +83,7 @@ class FactureTest extends PHPUnit\Framework\TestCase
{
global $conf,$user,$langs,$db;
- if (empty($conf->facture->enabled)) {
+ if (!isModEnabled('facture')) {
print __METHOD__." module customer invoice must be enabled.\n"; die(1);
}
if (! empty($conf->ecotaxdeee->enabled)) {
| |