- edit campi prodotti
- edit ordini
This commit is contained in:
@@ -360,7 +360,7 @@ router.post('/:userId/ordercartstatus', authenticate, async function (req, res,
|
||||
const { User } = require('../models/user');
|
||||
|
||||
|
||||
let orderCart = await OrdersCart.findOne({ idapp, _id: order_id }).lean();
|
||||
let orderscart = 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!
|
||||
@@ -368,19 +368,19 @@ router.post('/:userId/ordercartstatus', authenticate, async function (req, res,
|
||||
}
|
||||
|
||||
try {
|
||||
if (!!orderCart) {
|
||||
if (!!orderscart) {
|
||||
|
||||
let fields_to_update = { status };
|
||||
|
||||
await OrdersCart.findOneAndUpdate({ _id: order_id }, { $set: fields_to_update }
|
||||
, { new: false })
|
||||
.then(async (ris) => {
|
||||
const userDest = await User.findById(orderCart.userId).lean();
|
||||
const userDest = await User.findById(ordersCart.userId).lean();
|
||||
|
||||
if (ris) {
|
||||
|
||||
// Aggiorna gli Stati Interni !
|
||||
orderCart = await OrdersCart.updateCmd(orderCart, status, true, options);
|
||||
ordersCart = await OrdersCart.updateCmd(ordersCart, status, true, options);
|
||||
|
||||
let ordertype = '';
|
||||
|
||||
@@ -393,7 +393,7 @@ router.post('/:userId/ordercartstatus', authenticate, async function (req, res,
|
||||
}
|
||||
|
||||
if (ordertype !== '') {
|
||||
sendemail.sendEmail_Order(userDest.lang, idapp, orderCart, userDest, ordertype, status)
|
||||
sendemail.sendEmail_Order(userDest.lang, idapp, ordersCart, userDest, ordertype, status)
|
||||
.then((ris) => {
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user