Aggiornamento modifiche preOrdini
This commit is contained in:
@@ -427,8 +427,16 @@ module.exports.convertAfterImport = async function (idapp, dataObjects) {
|
||||
|
||||
const arrprod = await Product.find({ idapp }).lean();
|
||||
for (const prod of arrprod) {
|
||||
let setta = false;
|
||||
await this.singlerecconvert_AfterImport(prod);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports.singlerecconvert_AfterImport = async function (idapp, prod) {
|
||||
|
||||
let setta = false;
|
||||
|
||||
try {
|
||||
// Impostazioni Base:
|
||||
let objtoset = {
|
||||
idapp,
|
||||
@@ -506,10 +514,17 @@ module.exports.convertAfterImport = async function (idapp, dataObjects) {
|
||||
}
|
||||
|
||||
if (setta) {
|
||||
await Product.findOneAndUpdate({ _id: prod._id }, { $set: objtoset })
|
||||
const ris = await Product.findOneAndUpdate({ _id: ObjectID(prod._id) }, { $set: objtoset })
|
||||
|
||||
if (ris) {
|
||||
console.log('ris', ris);
|
||||
}
|
||||
|
||||
// const campodarimuovere = 'producer_name';
|
||||
// await Product.findOneAndUpdate({ _id: prod._id }, { $unset: { [campodarimuovere]: 1 } })
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Err', e);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user