Use isModEnabled

This commit is contained in:
Alexandre SPANGARO 2022-09-25 22:57:35 +02:00
parent 8b093784ea
commit a44dcdb562
4 changed files with 6 additions and 6 deletions

View File

@ -91,7 +91,7 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|| !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)
|| !empty($conf->mrp->enabled)) { || isModEnabled('mrp')) {
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs. $virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
} }

View File

@ -821,7 +821,7 @@ if ($id > 0 || $ref) {
} }
// Number of product in production // Number of product in production
if (!empty($conf->mrp->enabled)) { if (isModEnabled('mrp')) {
if ($found) { if ($found) {
$helpondiff .= '<br>'; $helpondiff .= '<br>';
} else { } else {

View File

@ -111,7 +111,7 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|| !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)
|| !empty($conf->mrp->enabled)) { || isModEnabled('mrp')) {
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs. $virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
} }
@ -459,7 +459,7 @@ if ($usevirtualstock) {
$sqlReceptionFourn = '0'; $sqlReceptionFourn = '0';
} }
if (!empty($conf->mrp->enabled)) { if (isModEnabled('mrp')) {
$sqlProductionToConsume = "(SELECT GREATEST(0, ".$db->ifsql("SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').") IS NULL", "0", "SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').")").") as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL $sqlProductionToConsume = "(SELECT GREATEST(0, ".$db->ifsql("SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').") IS NULL", "0", "SUM(".$db->ifsql("mp5.role = 'toconsume'", 'mp5.qty', '- mp5.qty').")").") as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
$sqlProductionToConsume .= " FROM ".MAIN_DB_PREFIX."mrp_mo as mm5,"; $sqlProductionToConsume .= " FROM ".MAIN_DB_PREFIX."mrp_mo as mm5,";
$sqlProductionToConsume .= " ".MAIN_DB_PREFIX."mrp_production as mp5"; $sqlProductionToConsume .= " ".MAIN_DB_PREFIX."mrp_production as mp5";

View File

@ -99,7 +99,7 @@ if (!empty($conf->salaries->enabled)) {
if (isModEnabled('categorie')) { if (isModEnabled('categorie')) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
} }
if (!empty($conf->mrp->enabled)) { if (isModEnabled('mrp')) {
require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
} }
@ -132,7 +132,7 @@ if (!empty($conf->loan->enabled)) {
if (!empty($conf->salaries->enabled)) { if (!empty($conf->salaries->enabled)) {
$langs->load("salaries"); $langs->load("salaries");
} }
if (!empty($conf->mrp->enabled)) { if (isModEnabled('mrp')) {
$langs->load("mrp"); $langs->load("mrp");
} }
if (isModEnabled('eventorganization')) { if (isModEnabled('eventorganization')) {