Corretto Duplicazione Sito (es: da 1 a 14)
This commit is contained in:
@@ -91,32 +91,36 @@ SettingsSchema.statics.DuplicateAllRecords = async function (idapporig, idappdes
|
||||
SettingsSchema.statics.findAllIdApp = async function (idapp, serv, crypted = false) {
|
||||
const Settings = this;
|
||||
|
||||
let myfind = '';
|
||||
if (serv) {
|
||||
myfind = {idapp, serv };
|
||||
} else
|
||||
myfind = { idapp };
|
||||
try {
|
||||
let myfind = '';
|
||||
if (serv) {
|
||||
myfind = {idapp, serv};
|
||||
} else
|
||||
myfind = {idapp};
|
||||
|
||||
// myfind = {...myfind, $or: [{ crypted: { $exists: false } }, { crypted: { $exists: true, $eq: crypted } }]};
|
||||
// myfind = {...myfind, $or: [{ crypted: { $exists: false } }, { crypted: { $exists: true, $eq: crypted } }]};
|
||||
|
||||
const arrorig = await Settings.find(myfind, (err, arrrec) => {
|
||||
return arrrec
|
||||
});
|
||||
const arrorig = await Settings.find(myfind).lean();
|
||||
|
||||
let myarr = []
|
||||
let myarr = []
|
||||
|
||||
if (!crypted) {
|
||||
arrorig.forEach((rec) => {
|
||||
if (rec.crypted) {
|
||||
rec._doc.value_str = ''
|
||||
if (!crypted) {
|
||||
for (let rec of arrorig) {
|
||||
if (rec.crypted) {
|
||||
rec.value_str = ''
|
||||
}
|
||||
myarr.push({...rec});
|
||||
}
|
||||
myarr.push({...rec._doc});
|
||||
})
|
||||
} else {
|
||||
myarr = [...arrorig];
|
||||
} else {
|
||||
myarr = [...arrorig];
|
||||
}
|
||||
|
||||
return myarr;
|
||||
}catch (e) {
|
||||
console.error('Settings: findAllIdApp', e);
|
||||
return null;
|
||||
}
|
||||
|
||||
return myarr;
|
||||
};
|
||||
|
||||
SettingsSchema.statics.setKeyNum = async function (idapp, key, value) {
|
||||
|
||||
Reference in New Issue
Block a user