From e74d8fa54dcbd0feb0f480e204bbad4204327725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 29 Jun 2023 14:04:39 +0200 Subject: [PATCH] use isModEnabled --- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/list_det.php | 2 +- htdocs/compta/resultat/clientfourn.php | 2 +- .../doc/doc_generic_project_odt.modules.php | 16 ++++++++-------- .../modules/project/doc/pdf_beluga.modules.php | 6 +++--- ...ace_50_modNotification_Notification.class.php | 2 +- htdocs/mrp/class/mo.class.php | 2 +- htdocs/reception/class/reception.class.php | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 40ea890c846..0df5d4ba61c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -337,7 +337,7 @@ class Propal extends CommonObject 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180), 'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185), 'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190), - 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>191), + 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'isModEnabled("stock")', 'visible'=>-1, 'position'=>191), 'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>195), 'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>0, 'position'=>200), // deprecated 'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>205), diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 38553e3770f..9aa5aad7176 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -200,7 +200,7 @@ $arrayfields = array( 'c.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>100), 'c.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>105), 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110), - 'c.fk_warehouse'=>array('label'=>'Warehouse', 'checked'=>0, 'enabled'=>(empty($conf->stock->enabled) && empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER) ? 0 : 1), 'position'=>110), + 'c.fk_warehouse'=>array('label'=>'Warehouse', 'checked'=>0, 'enabled'=>(!isModEnabled('stock') && empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER) ? 0 : 1), 'position'=>110), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116), 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)), diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 5d4a3eea67f..0a969dd3e79 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -1275,7 +1275,7 @@ if ($modecompta == 'BOOKKEEPING') { $subtotal_ht = 0; $subtotal_ttc = 0; - if ($conf->tax->enabled && ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES')) { + if (isModEnabled('tax') && ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES')) { if ($modecompta == 'CREANCES-DETTES') { // VAT to pay $amount = 0; 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 4a94dc85521..2ab0b10dbdc 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 @@ -990,52 +990,52 @@ class doc_generic_project_odt extends ModelePDFProjects 'class' => 'Fichinter', 'table' => 'fichinter', 'disableamount' => 1, - 'test' => $conf->ficheinter->enabled && $user->hasRight('ficheinter', 'lire') + 'test' => isModEnabled('ficheinter') && $user->hasRight('ficheinter', 'lire') ), 'shipping' => array( 'title' => "ListShippingAssociatedProject", 'class' => 'Expedition', 'table' => 'expedition', 'disableamount' => 1, - 'test' => $conf->expedition->enabled && $user->rights->expedition->lire + 'test' => isModEnabled('expedition') && $user->rights->expedition->lire ), 'trip' => array( 'title' => "ListTripAssociatedProject", 'class' => 'Deplacement', 'table' => 'deplacement', 'disableamount' => 1, - 'test' => $conf->deplacement->enabled && $user->rights->deplacement->lire + 'test' => isModEnabled('deplacement') && $user->rights->deplacement->lire ), 'expensereport' => array( 'title' => "ListExpenseReportsAssociatedProject", 'class' => 'ExpenseReportLine', 'table' => 'expensereport_det', - 'test' => $conf->expensereport->enabled && $user->rights->expensereport->lire + 'test' => isModEnabled('expensereport') && $user->rights->expensereport->lire ), 'donation' => array( 'title' => "ListDonationsAssociatedProject", 'class' => 'Don', 'table' => 'don', - 'test' => $conf->don->enabled && $user->rights->don->lire + 'test' => isModEnabled('don') && $user->rights->don->lire ), 'loan' => array( 'title' => "ListLoanAssociatedProject", 'class' => 'Loan', 'table' => 'loan', - 'test' => $conf->loan->enabled && $user->rights->loan->read + 'test' => isModEnabled('loan') && $user->rights->loan->read ), 'chargesociales' => array( 'title' => "ListSocialContributionAssociatedProject", 'class' => 'ChargeSociales', 'table' => 'chargesociales', 'urlnew' => DOL_URL_ROOT.'/compta/sociales/card.php?action=create&projectid='.$object->id, - 'test' => $conf->tax->enabled && $user->rights->tax->charges->lire + 'test' => isModEnabled('tax') && $user->rights->tax->charges->lire ), 'stock_mouvement' => array( 'title' => "ListMouvementStockProject", 'class' => 'MouvementStock', 'table' => 'stock_mouvement', - 'test' => ($conf->stock->enabled && $user->rights->stock->mouvement->lire && !empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW)) + 'test' => (isModEnabled('stock') && $user->rights->stock->mouvement->lire && !empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW)) ), 'agenda' => array( 'title' => "ListActionsAssociatedProject", diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index b4ee7ec83b0..1823f68b835 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -427,7 +427,7 @@ class pdf_beluga extends ModelePDFProjects 'table'=>'fichinter', 'datefieldname'=>'date_valid', 'disableamount'=>1, - 'test'=>$conf->ficheinter->enabled && $user->hasRight('ficheinter', 'lire'), + 'test'=>isModEnabled('ficheinter') && $user->hasRight('ficheinter', 'lire'), 'lang'=>'interventions'), 'trip'=>array( 'name'=>"TripsAndExpenses", @@ -437,7 +437,7 @@ class pdf_beluga extends ModelePDFProjects 'datefieldname'=>'dated', 'margin'=>'minus', 'disableamount'=>1, - 'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire, + 'test'=>isModEnabled('deplacement') && $user->rights->deplacement->lire, 'lang'=>'trip'), 'expensereport'=>array( 'name'=>"ExpensesReports", @@ -447,7 +447,7 @@ class pdf_beluga extends ModelePDFProjects 'datefieldname'=>'dated', 'margin'=>'minus', 'disableamount'=>1, - 'test'=>$conf->expensereport->enabled && $user->rights->expensereport->lire, + 'test'=>isModEnabled('expensereport') && $user->rights->expensereport->lire, 'lang'=>'trip'), 'agenda'=>array( 'name'=>"Agenda", diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index f788b402247..1aa21dbd1ba 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -145,7 +145,7 @@ class InterfaceNotification extends DolibarrTriggers $qualified = 0; } elseif ($element == 'member' && !isModEnabled('adherent')) { $qualified = 0; - } elseif (($element == 'expense_report' || $element == 'expensereport') && empty($conf->expensereport->enabled)) { + } elseif (($element == 'expense_report' || $element == 'expensereport') && !isModEnabled('expensereport')) { $qualified = 0; } elseif (!in_array($element, array('order_supplier', 'invoice_supplier', 'withdraw', 'shipping', 'member', 'expense_report', 'expensereport')) && empty($conf->$element->enabled)) { $qualified = 0; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index b703dcc0531..e200b221c15 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -105,7 +105,7 @@ class Mo extends CommonObject 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'2', 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200', 'alwayseditable'=>1), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'isModEnabled("societe")', 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax150'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>51, 'notnull'=>-1, 'index'=>1, 'css'=>'minwidth200 maxwidth400', 'csslist'=>'tdoverflowmax100'), - 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>'$conf->stock->enabled', 'visible'=>1, 'position'=>52, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax200'), + 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>'isModEnabled("stock")', 'visible'=>1, 'position'=>52, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax200'), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'notnull'=>-1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 5281e890cc5..6ab3bcecbdd 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1024,7 +1024,7 @@ class Reception extends CommonObject $this->db->begin(); // Stock control - if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_RECEPTION && $this->statut > 0) { + if (isModEnabled('stock') && $conf->global->STOCK_CALCULATE_ON_RECEPTION && $this->statut > 0) { require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"; $langs->load("agenda");