aggiornato stockQta quando l'ordine viene evaso
This commit is contained in:
@@ -281,7 +281,7 @@ router.post('/:userId/ordercartstatus', authenticate, async function (req, res,
|
||||
const user = req.user;
|
||||
let status = req.body.status;
|
||||
|
||||
const orderCart = await OrdersCart.find({ idapp, _id: order_id });
|
||||
const orderCart = await OrdersCart.findOne({ idapp, _id: order_id }).lean();
|
||||
|
||||
if ((userId !== String(req.user._id)) && !User.isManager(req.user.perm)) {
|
||||
// I'm trying to write something not mine!
|
||||
@@ -303,7 +303,7 @@ router.post('/:userId/ordercartstatus', authenticate, async function (req, res,
|
||||
await OrdersCart.updateCmd(orderCart, status, true);
|
||||
|
||||
let ordertype = '';
|
||||
|
||||
|
||||
if (status === shared_consts.OrderStatus.ORDER_CONFIRMED) {
|
||||
ordertype = 'order_confirmed';
|
||||
} else if (status === shared_consts.OrderStatus.COMPLETED) {
|
||||
@@ -313,7 +313,7 @@ router.post('/:userId/ordercartstatus', authenticate, async function (req, res,
|
||||
}
|
||||
|
||||
if (ordertype !== '') {
|
||||
sendemail.sendEmail_Order(user.lang, idapp, orderCart[0], user, ordertype)
|
||||
sendemail.sendEmail_Order(user.lang, idapp, orderCart, user, ordertype)
|
||||
.then((ris) => {
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user