';
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/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/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/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 4defa77f428..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 {
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/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 9ec8bca22a4..1432d1f132f 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -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/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/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/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/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/html.form.class.php b/htdocs/core/class/html.form.class.php
index c5c9f7164ec..4fa721abf81 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -8501,13 +8501,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') {
@@ -8643,12 +8643,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.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index ad6a6c12508..a6c16329ff9 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1618,7 +1618,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)) {
@@ -1635,7 +1635,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/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php
index 60c53ee7abc..8ade2200724 100644
--- a/htdocs/core/lib/contact.lib.php
+++ b/htdocs/core/lib/contact.lib.php
@@ -92,7 +92,7 @@ function contact_prepare_head(Contact $object)
}
// Related items
- if (!empty($conf->commande->enabled) || !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 (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || isModEnabled('facture') || !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)) {
$head[$tab][0] = DOL_URL_ROOT.'/contact/consumption.php?id='.$object->id;
$head[$tab][1] = $langs->trans("Referers");
$head[$tab][2] = 'consumption';
diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php
index 786483e257b..580e30db650 100644
--- a/htdocs/core/lib/invoice.lib.php
+++ b/htdocs/core/lib/invoice.lib.php
@@ -254,7 +254,7 @@ function supplier_invoice_rec_prepare_head($object)
function getNumberInvoicesPieChart($mode)
{
global $conf, $db, $langs, $user;
- if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
+ if (isModEnabled('facture') && !empty($user->rights->facture->lire)) {
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
$now = date_create(date('Y-m-d', dol_now()));
@@ -882,7 +882,7 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
$result = '';
- if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
+ if (isModEnabled('facture') && !empty($user->rights->facture->lire)) {
$tmpinvoice = new Facture($db);
$sql = "SELECT f.rowid, f.ref, f.fk_statut as status, f.datef, f.type, f.total_ht, f.total_tva, f.total_ttc, f.paye, f.tms";
diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index 12e1128ddfc..8c05307eedd 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -450,7 +450,7 @@ function show_stats_for_company($product, $socid)
print '';
}
// Customer invoices
- if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
+ if (isModEnabled('facture') && $user->rights->facture->lire) {
$nblines++;
$ret = $product->load_stats_facture($socid);
if ($ret < 0) {
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index a2168eb7280..bcc6fde98c8 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -126,7 +126,7 @@ function project_prepare_head(Project $project, $moreparam = '')
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
|| !empty($conf->propal->enabled) || !empty($conf->commande->enabled)
- || !empty($conf->facture->enabled) || !empty($conf->contrat->enabled)
+ || isModEnabled('facture') || !empty($conf->contrat->enabled)
|| !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled) || !empty($conf->stock->enabled)) {
$nbElements = 0;
// Enable caching of thirdrparty count Contacts
@@ -144,10 +144,10 @@ function project_prepare_head(Project $project, $moreparam = '')
if (!empty($conf->commande->enabled)) {
$nbElements += $project->getElementCount('order', 'commande');
}
- if (!empty($conf->facture->enabled)) {
+ if (isModEnabled('facture')) {
$nbElements += $project->getElementCount('invoice', 'facture');
}
- if (!empty($conf->facture->enabled)) {
+ if (isModEnabled('facture')) {
$nbElements += $project->getElementCount('invoice_predefined', 'facture_rec');
}
if (!empty($conf->supplier_proposal->enabled)) {
diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
index 35979503d15..10b78673cf5 100644
--- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
+++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
@@ -40,10 +40,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.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->facture->enabled)) {
+if (isModEnabled('facture')) {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
}
if (!empty($conf->commande->enabled)) {
diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
index d439ae32ce5..3702b1c8452 100644
--- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
+++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
@@ -41,10 +41,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.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->facture->enabled)) {
+if (isModEnabled('facture')) {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
}
if (!empty($conf->commande->enabled)) {
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/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 9d76d46cc97..4b7686449c7 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -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/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/index.php b/htdocs/index.php
index d9bab584948..08b818bac63 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -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/main.inc.php b/htdocs/main.inc.php
index 1261ee66b89..076ab0dbc6a 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -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/product/card.php b/htdocs/product/card.php
index 1f63b5071bb..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)) {
@@ -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/projet/card.php b/htdocs/projet/card.php
index 6cc761d0ade..813dccf8a73 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -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/element.php b/htdocs/projet/element.php
index b8fe8572eb6..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';
}
@@ -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)) {
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/societe/consumption.php b/htdocs/societe/consumption.php
index bd4aacc3931..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) {
diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php
index 90be0b25850..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) {
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)) {