Use isModEnabled
This commit is contained in:
parent
d7d5199689
commit
419a307b2b
@ -154,7 +154,7 @@ class modCategorie extends DolibarrModules
|
||||
if (!empty($conf->bank->enabled)) {
|
||||
$typeexample .= ($typeexample ? " / " : "")."8=Bank line";
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$typeexample .= ($typeexample ? " / " : "")."9=Warehouse";
|
||||
}
|
||||
if (isModEnabled('agenda')) {
|
||||
|
||||
@ -214,7 +214,7 @@ class modProduct extends DolibarrModules
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) {
|
||||
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('e.ref'=>'DefaultWarehouse', 'p.tobatch'=>'ManageLotSerial', 'p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
|
||||
}
|
||||
if (isModEnabled('barcode')) {
|
||||
@ -252,7 +252,7 @@ class modProduct extends DolibarrModules
|
||||
'p.tva_tx'=>'Numeric',
|
||||
'p.datec'=>'Date', 'p.tms'=>'Date'
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('e.ref'=>'Text', 'p.tobatch'=>'Numeric', 'p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
|
||||
}
|
||||
if (isModEnabled('barcode')) {
|
||||
@ -271,7 +271,7 @@ class modProduct extends DolibarrModules
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
|
||||
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
|
||||
}
|
||||
if (isModEnabled('barcode')) {
|
||||
@ -286,7 +286,7 @@ class modProduct extends DolibarrModules
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
|
||||
$this->export_dependencies_array[$r] = array('category'=>'p.rowid');
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
|
||||
}
|
||||
if (isModEnabled('barcode')) {
|
||||
@ -316,7 +316,7 @@ class modProduct extends DolibarrModules
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc';
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e ON e.rowid = p.fk_default_warehouse';
|
||||
}
|
||||
$this->export_sql_end[$r] .= ' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
|
||||
@ -409,7 +409,7 @@ class modProduct extends DolibarrModules
|
||||
'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell",
|
||||
'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
|
||||
}
|
||||
if (isModEnabled('barcode')) {
|
||||
@ -425,7 +425,7 @@ class modProduct extends DolibarrModules
|
||||
'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
|
||||
'p.datec'=>'Date', 'p.tms'=>'Date'
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
|
||||
}
|
||||
if (isModEnabled('barcode')) {
|
||||
@ -441,7 +441,7 @@ class modProduct extends DolibarrModules
|
||||
'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct",
|
||||
'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct"
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct'));
|
||||
}
|
||||
if (isModEnabled('barcode')) {
|
||||
@ -601,7 +601,7 @@ class modProduct extends DolibarrModules
|
||||
'p.recuperableonly' => '^[0|1]$',
|
||||
);
|
||||
|
||||
if (!empty($conf->stock->enabled)) {//if Stock module enabled
|
||||
if (isModEnabled('stock')) {//if Stock module enabled
|
||||
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
|
||||
'p.fk_default_warehouse'=>'DefaultWarehouse',
|
||||
'p.tobatch'=>'ManageLotSerial',
|
||||
@ -710,7 +710,7 @@ class modProduct extends DolibarrModules
|
||||
'p.finished' => '0 (raw material) / 1 (finished goods), matches field "code" in dictionary table "'.MAIN_DB_PREFIX.'c_product_nature"'
|
||||
);
|
||||
//clauses copied from import_fields_array
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$import_sample = array_merge($import_sample, array(
|
||||
'p.tobatch'=>"0 (don't use) / 1 (use batch) / 2 (use serial number)",
|
||||
'p.seuil_stock_alerte' => '',
|
||||
|
||||
@ -179,7 +179,7 @@ class modService extends DolibarrModules
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || !empty($conf->margin->enabled)) {
|
||||
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
|
||||
}
|
||||
if (isModEnabled('barcode')) {
|
||||
@ -215,7 +215,7 @@ class modService extends DolibarrModules
|
||||
'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric',
|
||||
'p.datec'=>'Date', 'p.tms'=>'Date'
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
|
||||
}
|
||||
if (isModEnabled('barcode')) {
|
||||
@ -234,7 +234,7 @@ class modService extends DolibarrModules
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
|
||||
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
|
||||
}
|
||||
if (isModEnabled('barcode')) {
|
||||
@ -249,7 +249,7 @@ class modService extends DolibarrModules
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
|
||||
$this->export_dependencies_array[$r] = array('category'=>'p.rowid');
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
|
||||
}
|
||||
if (isModEnabled('barcode')) {
|
||||
@ -368,7 +368,7 @@ class modService extends DolibarrModules
|
||||
'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell",
|
||||
'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
|
||||
}
|
||||
if (isModEnabled('barcode')) {
|
||||
@ -384,7 +384,7 @@ class modService extends DolibarrModules
|
||||
'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
|
||||
'p.datec'=>'Date', 'p.tms'=>'Date'
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
|
||||
}
|
||||
if (isModEnabled('barcode')) {
|
||||
@ -400,7 +400,7 @@ class modService extends DolibarrModules
|
||||
'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct",
|
||||
'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct"
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct'));
|
||||
}
|
||||
if (isModEnabled('barcode')) {
|
||||
@ -548,7 +548,7 @@ class modService extends DolibarrModules
|
||||
'p.recuperableonly' => '^[0|1]$',
|
||||
);
|
||||
|
||||
if (!empty($conf->stock->enabled)) {//if Stock module enabled
|
||||
if (isModEnabled('stock')) {//if Stock module enabled
|
||||
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
|
||||
'p.fk_default_warehouse'=>'DefaultWarehouse',
|
||||
'p.tobatch'=>'ManageLotSerial',
|
||||
@ -656,7 +656,7 @@ class modService extends DolibarrModules
|
||||
'p.finished' => '0 (raw material) / 1 (finished goods), matches field "code" in dictionary table "'.MAIN_DB_PREFIX.'c_product_nature"'
|
||||
);
|
||||
//clauses copied from import_fields_array
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$import_sample = array_merge($import_sample, array(
|
||||
'p.seuil_stock_alerte' => '',
|
||||
'p.pmp' => '0',
|
||||
|
||||
@ -41,7 +41,7 @@ if (empty($object) || !is_object($object)) {
|
||||
exit;
|
||||
}
|
||||
$usemargins = 0;
|
||||
if (!empty($conf->margin->enabled) && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) {
|
||||
if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) {
|
||||
$usemargins = 1;
|
||||
}
|
||||
if (!isset($dateSelector)) {
|
||||
@ -184,7 +184,7 @@ if ($nolinesbefore) {
|
||||
$freelines = true;
|
||||
$forceall = 1; // We always force all type for free lines (module product or service means we use predefined product or service)
|
||||
if ($object->element == 'contrat') {
|
||||
if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) {
|
||||
if (!isModEnabled('product') && !isModEnabled('service') && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) {
|
||||
$forceall = -1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set
|
||||
} elseif (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) {
|
||||
$forceall = 3;
|
||||
@ -196,7 +196,7 @@ if ($nolinesbefore) {
|
||||
if ($forceall >= 0 && (isModEnabled("product") || isModEnabled("service"))) {
|
||||
echo '<label for="prod_entry_mode_free">';
|
||||
echo '<input type="radio" class="prod_entry_mode_free" name="prod_entry_mode" id="prod_entry_mode_free" value="free"';
|
||||
//echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : ((empty($forceall) && (empty($conf->product->enabled) || empty($conf->service->enabled)))?' checked':'') );
|
||||
//echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : ((empty($forceall) && (!isModEnabled('product') || !isModEnabled('service')))?' checked':'') );
|
||||
echo ((GETPOST('prod_entry_mode', 'alpha') == 'free' || !empty($conf->global->MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT)) ? ' checked' : '');
|
||||
echo '> ';
|
||||
// Show type selector
|
||||
@ -207,7 +207,7 @@ if ($nolinesbefore) {
|
||||
echo '<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">';
|
||||
// Show type selector
|
||||
if ($forceall >= 0) {
|
||||
if (empty($conf->product->enabled) || empty($conf->service->enabled)) {
|
||||
if (!isModEnabled('product') || !isModEnabled('service')) {
|
||||
echo $langs->trans("Type");
|
||||
} else {
|
||||
echo $langs->trans("FreeLineOfType");
|
||||
@ -230,17 +230,17 @@ if ($nolinesbefore) {
|
||||
$labelforradio = '';
|
||||
if (empty($conf->dol_optimize_smallscreen)) {
|
||||
if (empty($senderissupplier)) {
|
||||
if (isModEnabled("product") && empty($conf->service->enabled)) {
|
||||
if (isModEnabled("product") && !isModEnabled('service')) {
|
||||
$labelforradio = $langs->trans('PredefinedProductsToSell');
|
||||
} elseif ((empty($conf->product->enabled) && isModEnabled("service")) || ($object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS))) {
|
||||
} elseif ((!isModEnabled('product') && isModEnabled('service')) || ($object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS))) {
|
||||
$labelforradio = $langs->trans('PredefinedServicesToSell');
|
||||
} else {
|
||||
$labelforradio = $langs->trans('PredefinedProductsAndServicesToSell');
|
||||
}
|
||||
} else {
|
||||
if (isModEnabled("product") && empty($conf->service->enabled)) {
|
||||
if (isModEnabled("product") && !isModEnabled('service')) {
|
||||
$labelforradio = $langs->trans('PredefinedProductsToPurchase');
|
||||
} elseif (empty($conf->product->enabled) && isModEnabled("service")) {
|
||||
} elseif (!isModEnabled('product') && isModEnabled('service')) {
|
||||
$labelforradio = $langs->trans('PredefinedServicesToPurchase');
|
||||
} else {
|
||||
$labelforradio = $langs->trans('PredefinedProductsAndServicesToPurchase');
|
||||
@ -338,7 +338,7 @@ if ($nolinesbefore) {
|
||||
}
|
||||
if (isModEnabled("product") || isModEnabled("service")) {
|
||||
echo '<br>';
|
||||
if (!empty($conf->variants->enabled)) {
|
||||
if (isModEnabled('variants')) {
|
||||
echo '<div id="attributes_box"></div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ if (isModEnabled("product") || isModEnabled("service")) {
|
||||
if (!empty($conf->expedition_bon->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||
}
|
||||
if (isModEnabled('project')) {
|
||||
@ -104,7 +104,7 @@ if ($action == 'add') {
|
||||
$object->commande_id = GETPOST("commande_id", 'int');
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
|
||||
if (!$conf->expedition_bon->enabled && !empty($conf->stock->enabled)) {
|
||||
if (!$conf->expedition_bon->enabled && isModEnabled('stock')) {
|
||||
$expedition->entrepot_id = GETPOST('entrepot_id', 'int');
|
||||
}
|
||||
|
||||
@ -491,7 +491,7 @@ if ($action == 'create') {
|
||||
print '<td colspan="3">'.$object->getLibStatut(4)."</td>\n";
|
||||
print '</tr>';*/
|
||||
|
||||
if (!$conf->expedition_bon->enabled && !empty($conf->stock->enabled)) {
|
||||
if (!$conf->expedition_bon->enabled && isModEnabled('stock')) {
|
||||
// Entrepot
|
||||
$entrepot = new Entrepot($db);
|
||||
$entrepot->fetch($object->entrepot_id);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user