Use isModEnabled
This commit is contained in:
parent
419a307b2b
commit
eb55b307c0
@ -391,7 +391,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
} elseif (!$error) {
|
||||
$labelfieldmissing = $langs->transnoentitiesnoconv("QtyToShip");
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$labelfieldmissing .= '/'.$langs->transnoentitiesnoconv("Warehouse");
|
||||
}
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $labelfieldmissing), null, 'errors');
|
||||
@ -739,7 +739,7 @@ if (empty($reshook)) {
|
||||
unset($_POST[$qty]);
|
||||
}
|
||||
}
|
||||
} elseif (empty($conf->stock->enabled) && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated.
|
||||
} elseif (!isModEnabled('stock') && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated.
|
||||
$qty = "qtyl".$line_id;
|
||||
$line->id = $line_id;
|
||||
$line->qty = GETPOST($qty, 'int');
|
||||
@ -865,7 +865,7 @@ if ($action == 'create') {
|
||||
$author = new User($db);
|
||||
$author->fetch($object->user_author_id);
|
||||
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$entrepot = new Entrepot($db);
|
||||
}
|
||||
|
||||
@ -1077,7 +1077,7 @@ if ($action == 'create') {
|
||||
}
|
||||
print '<span id="autoreset" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans("Reset"), 'eraser').'</span>';
|
||||
print '</td>';
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
if (empty($conf->productbatch->enabled)) {
|
||||
print '<td class="left">'.$langs->trans("Warehouse").' ('.$langs->trans("Stock").')</td>';
|
||||
} else {
|
||||
@ -1212,7 +1212,7 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
$warehouseObject = null;
|
||||
if (count($warehousePicking) == 1 || !($line->fk_product > 0) || empty($conf->stock->enabled)) { // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection
|
||||
if (count($warehousePicking) == 1 || !($line->fk_product > 0) || !isModEnabled('stock')) { // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection
|
||||
print '<!-- Case warehouse already known or product not a predefined product -->';
|
||||
//ship from preselected location
|
||||
$stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0); // Convert to number
|
||||
@ -1240,7 +1240,7 @@ if ($action == 'create') {
|
||||
print '</td>';
|
||||
|
||||
// Stock
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
print '<td class="left">';
|
||||
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Type of product need stock change ?
|
||||
// Show warehouse combo list
|
||||
@ -1423,7 +1423,7 @@ if ($action == 'create') {
|
||||
print '</td>';
|
||||
|
||||
// Stock
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
print '<td class="left">';
|
||||
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
||||
print $tmpwarehouseObject->getNomUrl(0).' ';
|
||||
@ -2045,7 +2045,7 @@ if ($action == 'create') {
|
||||
}
|
||||
if ($action == 'editline') {
|
||||
$editColspan = 3;
|
||||
if (empty($conf->stock->enabled)) {
|
||||
if (!isModEnabled('stock')) {
|
||||
$editColspan--;
|
||||
}
|
||||
if (empty($conf->productbatch->enabled)) {
|
||||
@ -2057,7 +2057,7 @@ if ($action == 'create') {
|
||||
} else {
|
||||
print $langs->trans("QtyShipped").' - ';
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
print $langs->trans("WarehouseSource").' - ';
|
||||
}
|
||||
if (isModEnabled('productbatch')) {
|
||||
@ -2070,7 +2070,7 @@ if ($action == 'create') {
|
||||
} else {
|
||||
print '<td class="center linecolqtyshipped">'.$langs->trans("QtyShipped").'</td>';
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
print '<td class="left linecolwarehousesource">'.$langs->trans("WarehouseSource").'</td>';
|
||||
}
|
||||
|
||||
@ -2255,7 +2255,7 @@ if ($action == 'create') {
|
||||
print $shipment_static->getNomUrl(1);
|
||||
print ' - '.$shipmentline_var['qty_shipped'];
|
||||
$htmltext = $langs->trans("DateValidation").' : '.(empty($shipmentline_var['date_valid']) ? $langs->trans("Draft") : dol_print_date($shipmentline_var['date_valid'], 'dayhour'));
|
||||
if (!empty($conf->stock->enabled) && $shipmentline_var['warehouse'] > 0) {
|
||||
if (isModEnabled('stock') && $shipmentline_var['warehouse'] > 0) {
|
||||
$warehousestatic->fetch($shipmentline_var['warehouse']);
|
||||
$htmltext .= '<br>'.$langs->trans("FromLocation").' : '.$warehousestatic->getNomUrl(1, '', 0, 1);
|
||||
}
|
||||
@ -2292,7 +2292,7 @@ if ($action == 'create') {
|
||||
// Batch number managment
|
||||
print '<td>'.$formproduct->selectLotStock('', 'batchl'.$line_id.'_0', '', 1, 0, $lines[$i]->fk_product).'</td>';
|
||||
print '</tr>';
|
||||
} elseif (!empty($conf->stock->enabled)) {
|
||||
} elseif (isModEnabled('stock')) {
|
||||
if ($lines[$i]->fk_product > 0) {
|
||||
if ($lines[$i]->entrepot_id > 0) {
|
||||
print '<!-- case edit 2 -->';
|
||||
@ -2331,7 +2331,7 @@ if ($action == 'create') {
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
} elseif (empty($conf->stock->enabled) && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated.
|
||||
} elseif (!isModEnabled('stock') && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated.
|
||||
print '<!-- case edit 6 -->';
|
||||
print '<tr>';
|
||||
// Qty to ship or shipped
|
||||
@ -2349,7 +2349,7 @@ if ($action == 'create') {
|
||||
print '<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.' '.$unit_order.'</td>';
|
||||
|
||||
// Warehouse source
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
print '<td class="linecolwarehousesource left">';
|
||||
if ($lines[$i]->entrepot_id > 0) {
|
||||
$entrepot = new Entrepot($db);
|
||||
@ -2452,7 +2452,7 @@ if ($action == 'create') {
|
||||
if (isModEnabled('productbatch')) {
|
||||
$colspan++;
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
$colspan++;
|
||||
}
|
||||
|
||||
|
||||
@ -707,7 +707,7 @@ class Expedition extends CommonObject
|
||||
}
|
||||
|
||||
// If stock increment is done on sending (recommanded choice)
|
||||
if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) {
|
||||
if (!$error && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
|
||||
$langs->load("agenda");
|
||||
@ -913,7 +913,7 @@ class Expedition extends CommonObject
|
||||
$line->rang = $orderline->rang;
|
||||
$line->product_type = $orderline->product_type;
|
||||
|
||||
if (!empty($conf->stock->enabled) && !empty($orderline->fk_product)) {
|
||||
if (isModEnabled('stock') && !empty($orderline->fk_product)) {
|
||||
$fk_product = $orderline->fk_product;
|
||||
|
||||
if (!($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS)) {
|
||||
@ -2150,7 +2150,7 @@ class Expedition extends CommonObject
|
||||
$this->status = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback
|
||||
|
||||
// If stock increment is done on closing
|
||||
if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
|
||||
if (!$error && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
|
||||
$langs->load("agenda");
|
||||
@ -2327,7 +2327,7 @@ class Expedition extends CommonObject
|
||||
$this->billed = 0;
|
||||
|
||||
// If stock increment is done on closing
|
||||
if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
|
||||
if (!$error && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
|
||||
$langs->load("agenda");
|
||||
|
||||
@ -38,7 +38,7 @@ if (isModEnabled('project')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||
}
|
||||
if (isModEnabled("propal")) {
|
||||
@ -431,7 +431,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
print '</tr>';
|
||||
|
||||
// Warehouse
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
|
||||
if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
print '<tr><td>';
|
||||
@ -642,7 +642,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
print '<th class="center">'.$langs->trans("QtyOrdered").'</th>';
|
||||
print '<th class="center">'.$langs->trans("QtyShipped").'</th>';
|
||||
print '<th class="center">'.$langs->trans("KeepToShip").'</th>';
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
print '<th class="center">'.$langs->trans("RealStock").'</th>';
|
||||
} else {
|
||||
print '<th> </th>';
|
||||
@ -794,7 +794,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
$product->load_stock('warehouseopen');
|
||||
}
|
||||
|
||||
if ($objp->fk_product > 0 && ($type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && !empty($conf->stock->enabled)) {
|
||||
if ($objp->fk_product > 0 && ($type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && isModEnabled('stock')) {
|
||||
print '<td class="center">';
|
||||
print $product->stock_reel;
|
||||
if ($product->stock_reel < $toBeShipped[$objp->fk_product]) {
|
||||
@ -858,7 +858,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Bouton expedier sans gestion des stocks
|
||||
if (empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) {
|
||||
if (!isModEnabled('stock') && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) {
|
||||
if ($user->rights->expedition->creer) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/card.php?action=create&origin=commande&object_id='.$id.'">'.$langs->trans("CreateShipment").'</a>';
|
||||
if ($toBeShippedTotal <= 0) {
|
||||
@ -874,11 +874,11 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
// Bouton expedier avec gestion des stocks
|
||||
|
||||
if (!empty($conf->stock->enabled) && $object->statut == Commande::STATUS_DRAFT) {
|
||||
if (isModEnabled('stock') && $object->statut == Commande::STATUS_DRAFT) {
|
||||
print $langs->trans("ValidateOrderFirstBeforeShipment");
|
||||
}
|
||||
|
||||
if (!empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) {
|
||||
if (isModEnabled('stock') && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) {
|
||||
if ($user->rights->expedition->creer) {
|
||||
//print load_fiche_titre($langs->trans("CreateShipment"));
|
||||
print '<div class="tabsAction">';
|
||||
@ -896,7 +896,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
//print '<tr>';
|
||||
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
//print '<td>';
|
||||
print $langs->trans("WarehouseSource");
|
||||
//print '</td>';
|
||||
|
||||
@ -93,7 +93,7 @@ if ($idprod > 0) {
|
||||
}
|
||||
|
||||
// After best supplier prices and before costprice
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
if (isModEnabled('stock')) {
|
||||
// Add price for pmp
|
||||
$price = $producttmp->pmp;
|
||||
if (empty($price) && !empty($conf->global->PRODUCT_USE_SUB_COST_PRICES_IF_COST_PRICE_EMPTY)) {
|
||||
|
||||
@ -1097,7 +1097,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
}
|
||||
|
||||
// If stock is incremented on validate order, we must increment it
|
||||
if (!$error && $movetoapprovestatus && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)) {
|
||||
if (!$error && $movetoapprovestatus && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
$langs->load("agenda");
|
||||
|
||||
@ -2085,7 +2085,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
}
|
||||
|
||||
// If module stock is enabled and the stock increase is done on purchase order dispatching
|
||||
if (!$error && $entrepot > 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
|
||||
if (!$error && $entrepot > 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
|
||||
$mouv = new MouvementStock($this->db);
|
||||
if ($product > 0) {
|
||||
// $price should take into account discount (except if option STOCK_EXCLUDE_DISCOUNT_FOR_PMP is on)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user