possibilità di modificare un ordine, e anche i totali

This commit is contained in:
Surya Paolo
2024-01-15 22:19:26 +01:00
parent 79ca364e84
commit 3183825137
7 changed files with 121 additions and 49 deletions

View File

@@ -1330,6 +1330,22 @@ async function eseguiDbOp(idapp, mydata, locale, req, res) {
} catch (e) {
console.error('Err:', e);
}
} else if (mydata.dbop === 'CopyPriceToCalc') {
try {
const arrrec = await OrdersCart.find({}).lean();
for (const rec of arrrec) {
await OrdersCart.findByIdAndUpdate(rec._id, { $set: { totalPriceCalc: rec.totalPrice } })
}
const arrrec2 = await Order.find({}).lean();
for (const rec of arrrec2) {
await Order.findByIdAndUpdate(rec._id, { $set: { TotalPriceProductCalc: rec.TotalPriceProduct } })
}
} catch (e) {
console.error('Err:', e);
}
} else if (mydata.dbop === 'dropAllCarts') {