- aggiunto note 'note_ordine_gas'
- corretto bug
This commit is contained in:
@@ -108,7 +108,7 @@ async function completaSettaggioProduct_AndProductInfo(arrcampi_productInfo, arr
|
||||
productInfo._id = precid;
|
||||
else
|
||||
delete productInfo._id;
|
||||
|
||||
|
||||
productInfo.code = preccode;
|
||||
}
|
||||
}
|
||||
@@ -472,6 +472,7 @@ router.post('/import', authenticate, async (req, res) => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!rec.hasOwnProperty('active')) {
|
||||
product.active = true;
|
||||
}
|
||||
@@ -508,6 +509,13 @@ router.post('/import', authenticate, async (req, res) => {
|
||||
recGas = await Gasordine.findOne({ idapp, name: rec.gas_name }).lean();
|
||||
}
|
||||
|
||||
if (recGas) {
|
||||
if (rec.hasOwnProperty('note_ordine_gas')) {
|
||||
const note_ordine_gas = rec['note_ordine_gas'];
|
||||
await Gasordine.findOneAndUpdate({ _id: recGas._id }, { $set: { note_ordine_gas } });
|
||||
}
|
||||
}
|
||||
|
||||
let recProductExist = null;
|
||||
let queryprod = { idProductInfo: product.idProductInfo };
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ router.post('/:userId', authenticate, async function (req, res, next) {
|
||||
} else if (subqty) {
|
||||
myord = await newCart.subqty(order);
|
||||
} else {
|
||||
const ind = newCart.addItem(order);
|
||||
const ind = await newCart.addItem(order);
|
||||
const arrord = await Order.getTotalOrderById(order._id);
|
||||
myord = arrord ? arrord[0] : null;
|
||||
}
|
||||
@@ -104,7 +104,8 @@ router.post('/:userId', authenticate, async function (req, res, next) {
|
||||
return res.send({ code: server_constants.RIS_CODE_ERR, cart: null, myord: null, msgerr: 'Non è possibile acquistare nello stesso ordine, su negozi differenti!' });
|
||||
}
|
||||
} else {
|
||||
await newCart.updatecarttotals(true);
|
||||
newCart.updatecarttotals(true);
|
||||
await newCart.updateExtraOrder();
|
||||
const arrord = await Order.getTotalOrderById(order._id);
|
||||
myord = arrord ? arrord[0] : null;
|
||||
}
|
||||
@@ -162,7 +163,7 @@ router.delete('/:userId', authenticate, async function (req, res) {
|
||||
// Rimuovere l'id sul Carrello
|
||||
|
||||
let newCart = CartClass.constructByCart(mycart);
|
||||
newCart.removeItem(orderId);
|
||||
await newCart.removeItem(orderId);
|
||||
let carttot = null;
|
||||
const cart = await Cart.updateCartByCartId(mycart._id, newCart.generateModel());
|
||||
|
||||
@@ -276,6 +277,7 @@ router.post('/:userId/createorderscart', authenticate, async function (req, res,
|
||||
totalQty: mycart.totalQty,
|
||||
totalPrice: mycart.totalPrice,
|
||||
totalPriceCalc: mycart.totalPriceCalc,
|
||||
note_ordine_gas: mycart.note_ordine_gas,
|
||||
userId,
|
||||
status,
|
||||
note,
|
||||
|
||||
@@ -851,10 +851,9 @@ router.patch('/chval', authenticate, async (req, res) => {
|
||||
|
||||
// tools.mylogshow('PATCH CHVAL: ', id, fieldsvalue);
|
||||
|
||||
req.user.perm = 0;
|
||||
|
||||
// If I change my record...
|
||||
if (((!User.isAdmin(req.user.perm)
|
||||
if ((
|
||||
(!User.isAdmin(req.user.perm)
|
||||
&& !User.isManager(req.user.perm)
|
||||
&& !User.isEditor(req.user.perm)
|
||||
&& !User.isFacilitatore(req.user.perm))
|
||||
|
||||
Reference in New Issue
Block a user