\n";
@@ -1160,7 +1166,7 @@
var errortab3 = [];
var errortab4 = [];
- function barcodescannerjs(){
+ function barcodescannerjs() {
console.log("We catch inputs in scanner box");
jQuery("#scantoolmessage").text();
@@ -1177,11 +1183,11 @@ function barcodescannerjs(){
errortab3 = [];
errortab4 = [];
- textarray = textarray.filter(function(value){
+ textarray = textarray.filter(function(value) {
return value != "";
});
- if(textarray.some((element) => element != "")){
- $(".qtydispatchinput").each(function(){
+ if (textarray.some((element) => element != "")) {
+ $(".qtydispatchinput").each(function() {
id = $(this).attr(\'id\');
idarray = id.split(\'_\');
idproduct = idarray[2];
@@ -1192,7 +1198,7 @@ function barcodescannerjs(){
productbarcode = $("#product_"+idproduct).attr(\'data-barcode\');
console.log(productbarcode);
productbatchcode = $("#lot_number_"+id).val();
- if(productbatchcode == undefined){
+ if (productbatchcode == undefined) {
productbatchcode = "";
}
console.log(productbatchcode);
@@ -1200,25 +1206,25 @@ function barcodescannerjs(){
if (barcodemode != "barcodeforproduct") {
tabproduct.forEach(product=>{
console.log("product.Batch="+product.Batch+" productbatchcode="+productbatchcode);
- if(product.Batch != "" && product.Batch == productbatchcode){
+ if (product.Batch != "" && product.Batch == productbatchcode) {
console.log("duplicate batch code found for batch code "+productbatchcode);
duplicatedbatchcode.push(productbatchcode);
}
})
}
productinput = $("#qty_"+id).val();
- if(productinput == ""){
+ if (productinput == "") {
productinput = 0
}
tabproduct.push({\'Id\':id,\'Warehouse\':warehouse,\'Barcode\':productbarcode,\'Batch\':productbatchcode,\'Qty\':productinput,\'fetched\':false});
});
console.log("Loop on each record entered in the textarea");
- textarray.forEach(function(element,index){
+ textarray.forEach(function(element,index) {
console.log("Process record element="+element+" id="+id);
var verify_batch = false;
var verify_barcode = false;
- switch(barcodemode){
+ switch(barcodemode) {
case "barcodeforautodetect":
verify_barcode = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,warehousetouse,selectaddorreplace,"barcode",true);
verify_batch = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,warehousetouse,selectaddorreplace,"lotserial",true);
@@ -1249,12 +1255,12 @@ function barcodescannerjs(){
if (Object.keys(errortab1).length < 1 && Object.keys(errortab2).length < 1 && Object.keys(errortab3).length < 1) {
tabproduct.forEach(product => {
- if(product.Qty!=0){
- if(product.hasOwnProperty("reelqty")){
+ if (product.Qty!=0) {
+ if (product.hasOwnProperty("reelqty")) {
idprod = $("td[data-idproduct=\'"+product.fk_product+"\']").attr("id");
idproduct = idprod.split("_")[1];
console.log("We create a new line for product_"+idproduct);
- if(product.Barcode != null){
+ if (product.Barcode != null) {
modedispatch = "dispatch";
} else {
modedispatch = "batch";
@@ -1266,7 +1272,7 @@ function barcodescannerjs(){
$("#qty_"+(nbrTrs-1)+"_"+idproduct).val(product.Qty);
$("#entrepot_"+(nbrTrs-1)+"_"+idproduct).val(product.Warehouse);
- if(modedispatch == "batch"){
+ if (modedispatch == "batch") {
$("#lot_number_"+(nbrTrs-1)+"_"+idproduct).val(product.Batch);
}
@@ -1317,7 +1323,7 @@ function barcodescannerjs(){
}
/* This methode is called by parent barcodescannerjs() */
- function barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,warehousetouse,selectaddorreplace,mode,autodetect=false){
+ function barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,warehousetouse,selectaddorreplace,mode,autodetect=false) {
BarcodeIsInProduct=0;
newproductrow=0
result=false;
@@ -1327,13 +1333,13 @@ function barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,ware
type: \'POST\',
async: false,
success: function(response) {
- if (response.status == "success"){
+ if (response.status == "success") {
console.log(response.message);
- if(!newproductrow){
+ if (!newproductrow) {
newproductrow = response.object;
}
}else{
- if (mode!="lotserial" && autodetect==false && !errortab4.includes(element)){
+ if (mode!="lotserial" && autodetect==false && !errortab4.includes(element)) {
errortab4.push(element);
console.error(response.message);
}
@@ -1344,18 +1350,18 @@ function barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,ware
},
});
console.log("Product "+(index+=1)+": "+element);
- if(mode == "barcode"){
+ if (mode == "barcode") {
testonproduct = product.Barcode
- }else if (mode == "lotserial"){
+ }else if (mode == "lotserial") {
testonproduct = product.Batch
}
testonwarehouse = product.Warehouse;
- if(testonproduct == element && testonwarehouse == warehousetouse){
- if(selectaddorreplace == "add"){
+ if (testonproduct == element && testonwarehouse == warehousetouse) {
+ if (selectaddorreplace == "add") {
productqty = parseInt(product.Qty,10);
product.Qty = productqty + parseInt(barcodeproductqty,10);
- }else if(selectaddorreplace == "replace"){
- if(product.fetched == false){
+ }else if (selectaddorreplace == "replace") {
+ if (product.fetched == false) {
product.Qty = barcodeproductqty
product.fetched=true
}else{
@@ -1366,11 +1372,11 @@ function barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,ware
BarcodeIsInProduct+=1;
}
})
- if(BarcodeIsInProduct==0 && newproductrow!=0){
+ if (BarcodeIsInProduct==0 && newproductrow!=0) {
tabproduct.push({\'Id\':tabproduct.length-1,\'Warehouse\':newproductrow.fk_warehouse,\'Barcode\':mode=="barcode"?element:null,\'Batch\':mode=="lotserial"?element:null,\'Qty\':barcodeproductqty,\'fetched\':true,\'reelqty\':newproductrow.reelqty,\'fk_product\':newproductrow.fk_product,\'mode\':mode});
result = true;
}
- if(BarcodeIsInProduct > 0){
+ if (BarcodeIsInProduct > 0) {
result = true;
}
return result;
@@ -1394,7 +1400,7 @@ function barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,ware
$("#autoreset").click(function() {
console.log("we click on autoreset");
- $(".autoresettr").each(function(){
+ $(".autoresettr").each(function() {
id = $(this).attr("name");
idtab = id.split("_");
console.log("we process line "+id+" "+idtab);
@@ -1417,8 +1423,8 @@ function barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,ware
return false;
});
- $("#resetalltoexpected").click(function(){
- $(".qtydispatchinput").each(function(){
+ $("#resetalltoexpected").click(function() {
+ $(".qtydispatchinput").each(function() {
console.log("We reset to expected "+$(this).attr("id")+" qty to dispatch");
$(this).val($(this).data("expected"));
});
diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang
index 3fbe6417b08e3..316c829b7da4e 100644
--- a/htdocs/langs/en_US/products.lang
+++ b/htdocs/langs/en_US/products.lang
@@ -435,3 +435,7 @@ AllowStockMovementVariantParentHelp=By default, a parent of a variant is a virtu
ConfirmSetToDraftInventory=Are you sure you want to go back to Draft status? The quantities currently set in the inventory will be reset.
WarningLineProductNotToSell=Product or service "%s" is not to sell and was cloned
PriceLabel=Price label
+StockableProduct=Stock management
+StockableProductDescription=If this option is enabled, the stock modification for this element is retained. If disabled, the stock modification for this element is not retained.
+StockDisabled=Stock disabled
+StockEnabled=Stock enabled
diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang
index 71d4214c8a5fc..f47172723a6dd 100644
--- a/htdocs/langs/en_US/sendings.lang
+++ b/htdocs/langs/en_US/sendings.lang
@@ -66,6 +66,7 @@ NoLineGoOnTabToAddSome=No line, go on tab "%s" to add
CreateInvoiceForThisCustomerFromSendings=Bill sendings
IfValidateInvoiceIsNoSendingStayUnbilled=If invoice validation is 'No', the sending will remain to status 'Unbilled' until the invoice is validated.
OptionToSetSendingBilledNotEnabled=Option from module Workflow, to set sending to 'Billed' automatically when invoice is validated, is not enabled, so you will have to set the status of sendings to 'Billed' manually after the invoice has been generated.
+NoWarehouseInBase=No warehouse in base
# Sending methods
# ModelDocument
diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang
index f9ae44a96b99c..5fc57191ffeac 100644
--- a/htdocs/langs/fr_FR/products.lang
+++ b/htdocs/langs/fr_FR/products.lang
@@ -435,3 +435,7 @@ AllowStockMovementVariantParentHelp=Par défaut, un parent d'une variante est un
ConfirmSetToDraftInventory=Êtes-vous sûr de vouloir revenir à l'état de brouillon ? Les quantités actuellement définies dans l'inventaire seront réinitialisées.
WarningLineProductNotToSell=Le produit ou le service "%s" n'est pas à vendre et a été cloné.
PriceLabel=Étiquette de prix
+StockableProduct=Activer la gestion des stocks
+StockableProductDescription=Si cette option est désactivée, la modification du stock pour cet élément n'est pas prise en compte. Les mouvements de stock ne seront pas pris en compte dans les commandes client, commande fournisseur, expédition, réception, ordre de fabrication. Dans les faits, cette option se comporte comme une activation/désactivation du module stock mais à l'échelle du produit/service
+StockDisabled=Stock désactivé
+StockEnabled=Stock activé
\ No newline at end of file
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index c418ac59c21a0..b894f6ea1ac15 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -632,6 +632,9 @@
$object->fk_unit = null;
}
+ // managed_in_stock
+ $object->stockable_product = ($type == 0 || ($type == 1 && !empty($conf->global->STOCK_SUPPORTS_SERVICES))) ? 1 : 0;
+
$accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
$accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra', 'alpha');
$accountancy_code_sell_export = GETPOST('accountancy_code_sell_export', 'alpha');
@@ -810,6 +813,9 @@
$object->fk_default_bom = 0;
}
+ // managed_in_stock
+ $object->stockable_product = GETPOSTISSET('stockable_product');
+
$units = GETPOSTINT('units');
if ($units > 0) {
$object->fk_unit = $units;
@@ -1983,7 +1989,7 @@
$(document).ready(function() {
console.log($("#statusBatchWarning"))
$("#status_batch").on("change", function() {
- if ($("#status_batch")[0].value == 0){
+ if ($("#status_batch")[0].value == 0) {
$("#statusBatchMouvToGlobal").show()
} else {
$("#statusBatchMouvToGlobal").hide()
@@ -1997,7 +2003,7 @@
$(document).ready(function() {
console.log($("#statusBatchWarning"))
$("#status_batch").on("change", function() {
- if ($("#status_batch")[0].value == 2){
+ if ($("#status_batch")[0].value == 2) {
$("#statusBatchWarning").show()
} else {
$("#statusBatchWarning").hide()
@@ -2151,6 +2157,10 @@
print '';
print '';
*/
+
+ print '