Commit 9c74eac6 by Alexis Aoun

adaptation de la detection price to weight à couchdb

parent 54954ebe
...@@ -176,23 +176,26 @@ function update_distant_orders() { ...@@ -176,23 +176,26 @@ function update_distant_orders() {
function price_to_weight_confirmed_callback (foundProduct, scannedProduct) { function price_to_weight_confirmed_callback (foundProduct, scannedProduct) {
return function price_to_weight_confirmed() { return function price_to_weight_confirmed() {
let newQty = null;
if (priceToWeightIsCorrect) { if (priceToWeightIsCorrect) {
foundProduct.data.product_qty = scannedProduct.qty; newQty = scannedProduct.qty;
} else { } else {
var tmp = Number((scannedProduct.value/document.getElementById("new_price_to_weight").value).toFixed(3)); let tmp = Number((scannedProduct.value/document.getElementById("new_price_to_weight").value).toFixed(3));
if (isFinite(tmp)) { if (isFinite(tmp)) {
foundProduct.data.product_qty = tmp; newQty = tmp;
} }
} }
if (foundProduct.data !== null && isFinite(tmp)) { if (foundProduct.data !== null && newQty != null) {
editProductInfo(foundProduct.data, foundProduct.data.product_qty);
if (foundProduct.place === 'to_process') { if (foundProduct.place === 'to_process') {
let row = table_to_process.row($('#'+foundProduct.data.product_id[0])); let row = table_to_process.row($('#'+foundProduct.data.product_id[0]));
remove_from_toProcess(row, foundProduct.data); remove_from_toProcess(row, foundProduct.data);
} }
editing_product = foundProduct.data;
editProductInfo(foundProduct.data, newQty);
editing_product = null;
resetPopUpButtons(); resetPopUpButtons();
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment