2
0
forked from Wavyzz/dolibarr

use isModEnabled

This commit is contained in:
Frédéric FRANCE
2023-06-29 14:04:39 +02:00
parent f058a6fc46
commit e74d8fa54d
8 changed files with 17 additions and 17 deletions

View File

@@ -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),

View File

@@ -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)),

View File

@@ -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;

View File

@@ -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",

View File

@@ -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",

View File

@@ -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;

View File

@@ -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,),

View File

@@ -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");