- Editor Pagine Elementi: Sezione, Righe, Colonne, Elementi. (rows, columns, elems)
This commit is contained in:
@@ -4,6 +4,8 @@ const Schema = mongoose.Schema;
|
|||||||
const tools = require('../tools/general');
|
const tools = require('../tools/general');
|
||||||
const { ObjectId } = require('mongodb');
|
const { ObjectId } = require('mongodb');
|
||||||
|
|
||||||
|
const shared_consts = require('../tools/shared_nodejs');
|
||||||
|
|
||||||
const { MySchedaSchema, IDimensioni, IImg, IText, IAreaDiStampa } = require('../models/myscheda');
|
const { MySchedaSchema, IDimensioni, IImg, IText, IAreaDiStampa } = require('../models/myscheda');
|
||||||
|
|
||||||
mongoose.Promise = global.Promise;
|
mongoose.Promise = global.Promise;
|
||||||
@@ -92,7 +94,7 @@ const catalogo = new Schema({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const MyElemSchema = new Schema({
|
const MySingleElemSchema = {
|
||||||
idapp: {
|
idapp: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
@@ -102,6 +104,9 @@ const MyElemSchema = new Schema({
|
|||||||
/*oldpath: {
|
/*oldpath: {
|
||||||
type: String,
|
type: String,
|
||||||
},*/
|
},*/
|
||||||
|
idElemParent: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
idPage: { type: String },
|
idPage: { type: String },
|
||||||
type: {
|
type: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@@ -257,8 +262,26 @@ const MyElemSchema = new Schema({
|
|||||||
date_updated: {
|
date_updated: {
|
||||||
type: Date,
|
type: Date,
|
||||||
},
|
},
|
||||||
|
};
|
||||||
|
|
||||||
children: { type: Array, default: undefined },
|
const MyElemSchema = new Schema({
|
||||||
|
...MySingleElemSchema,
|
||||||
|
// Aggiungi rows e columns
|
||||||
|
rows: {
|
||||||
|
type: [
|
||||||
|
{
|
||||||
|
...MySingleElemSchema,
|
||||||
|
columns: {
|
||||||
|
type: [
|
||||||
|
{
|
||||||
|
...MySingleElemSchema,
|
||||||
|
elems: [MySingleElemSchema],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
MyElemSchema.pre('save', async function (next) {
|
MyElemSchema.pre('save', async function (next) {
|
||||||
@@ -551,6 +574,24 @@ MyElemSchema.statics.getNewFreeNameTemplate = async function (idapp, idPageOrig,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MyElemSchema.statics.findParentElem = async function (idapp, idElemParent) {
|
||||||
|
try {
|
||||||
|
let myelemParent = null;
|
||||||
|
|
||||||
|
myelemParent = await this.findOne({
|
||||||
|
idapp,
|
||||||
|
rows: {
|
||||||
|
$elemMatch: { columns: { $elemMatch: { _id: idElemParent } } },
|
||||||
|
},
|
||||||
|
}).lean();
|
||||||
|
|
||||||
|
return myelemParent;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Err', e);
|
||||||
|
throw e; // Propagate the error
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const MyElem = mongoose.model('MyElem', MyElemSchema);
|
const MyElem = mongoose.model('MyElem', MyElemSchema);
|
||||||
|
|
||||||
MyElem.createIndexes()
|
MyElem.createIndexes()
|
||||||
|
|||||||
@@ -314,33 +314,33 @@ router.get('/test1', authenticate_noerror, async (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.post('/settable', authenticate, async (req, res) => {
|
router.post('/settable', authenticate, async (req, res) => {
|
||||||
const params = req.body;
|
|
||||||
const mytable = globalTables.getTableByTableName(params.table);
|
|
||||||
|
|
||||||
let mydata = req.body.data;
|
|
||||||
let extrarec = {};
|
|
||||||
if (mydata && mydata.hasOwnProperty('extrarec')) {
|
|
||||||
extrarec = mydata['extrarec'];
|
|
||||||
delete mydata['extrarec'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mydata === undefined) {
|
|
||||||
console.error('MYDATA VUOTO !');
|
|
||||||
return res.status(400).send('Mydata VUOTO');
|
|
||||||
}
|
|
||||||
|
|
||||||
const fieldsvalue = { ALL: 1 };
|
|
||||||
|
|
||||||
mydata.idapp = req.user.idapp;
|
|
||||||
const idapp = mydata.idapp;
|
|
||||||
|
|
||||||
if (req.user && req.user.username) {
|
|
||||||
User.setOnLine(req.user.idapp, req.user.username);
|
|
||||||
}
|
|
||||||
|
|
||||||
let consentito = false;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const params = req.body;
|
||||||
|
const mytable = globalTables.getTableByTableName(params.table);
|
||||||
|
|
||||||
|
let mydata = req.body.data;
|
||||||
|
let extrarec = {};
|
||||||
|
if (mydata && mydata.hasOwnProperty('extrarec')) {
|
||||||
|
extrarec = mydata['extrarec'];
|
||||||
|
delete mydata['extrarec'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mydata === undefined) {
|
||||||
|
console.error('MYDATA VUOTO !');
|
||||||
|
return res.status(400).send('Mydata VUOTO');
|
||||||
|
}
|
||||||
|
|
||||||
|
const fieldsvalue = { ALL: 1 };
|
||||||
|
|
||||||
|
mydata.idapp = req.user?.idapp;
|
||||||
|
const idapp = mydata.idapp;
|
||||||
|
|
||||||
|
if (req.user && req.user.username) {
|
||||||
|
User.setOnLine(req.user.idapp, req.user.username);
|
||||||
|
}
|
||||||
|
|
||||||
|
let consentito = false;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
User.isAdmin(req.user.perm) ||
|
User.isAdmin(req.user.perm) ||
|
||||||
User.isManager(req.user.perm) ||
|
User.isManager(req.user.perm) ||
|
||||||
@@ -1214,6 +1214,58 @@ router.patch('/setlang', authenticate, async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function toObjId(id) {
|
||||||
|
try {
|
||||||
|
return Types.ObjectId.isValid(id) ? new Types.ObjectId(id) : id;
|
||||||
|
} catch {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function updateElemInsideColumn({ idapp, id, mydata }) {
|
||||||
|
const { fieldsvalue = {} } = mydata || {};
|
||||||
|
|
||||||
|
// 1) id della colonna parent (dove si trova l'elemento da aggiornare)
|
||||||
|
let idElemParent = null;
|
||||||
|
if (fieldsvalue && fieldsvalue.idElemParent) {
|
||||||
|
idElemParent = fieldsvalue.idElemParent;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2) recupera il documento parent "top-level" (es. section) che contiene la colonna
|
||||||
|
const myelemParent = await MyElem.findParentElem(idapp, idElemParent);
|
||||||
|
if (!myelemParent) {
|
||||||
|
return { ok: false, msg: 'Parent non trovato' };
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3) costruisci il $set campo-per-campo
|
||||||
|
// path target: rows.$[].columns.$[col].elems.$[el].<campo>
|
||||||
|
const setOps = {};
|
||||||
|
for (const [key, value] of Object.entries(fieldsvalue)) {
|
||||||
|
if (key === '_id') continue; // non tocchiamo l'_id
|
||||||
|
setOps[`rows.$[].columns.$[col].elems.$[el].${key}`] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Se non c’è nulla da settare, esci pulito
|
||||||
|
if (Object.keys(setOps).length === 0) {
|
||||||
|
return { ok: true, msg: 'Nulla da aggiornare' };
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4) esegui l’update
|
||||||
|
const filter = { _id: toObjId(myelemParent._id) };
|
||||||
|
const update = { $set: setOps };
|
||||||
|
const options = {
|
||||||
|
arrayFilters: [{ 'col._id': toObjId(idElemParent) }, { 'el._id': toObjId(id) }],
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = await MyElem.updateOne(filter, update, options);
|
||||||
|
|
||||||
|
return {
|
||||||
|
ok: result?.matchedCount > 0,
|
||||||
|
modified: result?.modifiedCount || 0,
|
||||||
|
result,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
router.patch('/chval', authenticate, async (req, res) => {
|
router.patch('/chval', authenticate, async (req, res) => {
|
||||||
// const idapp = req.body.idapp;
|
// const idapp = req.body.idapp;
|
||||||
const id = req.body.data.id;
|
const id = req.body.data.id;
|
||||||
@@ -1328,162 +1380,177 @@ router.patch('/chval', authenticate, async (req, res) => {
|
|||||||
fieldsvalue = { [`arrvariazioni.0.${chiave}`]: valore };
|
fieldsvalue = { [`arrvariazioni.0.${chiave}`]: valore };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return await mytable
|
if (mydata.table === 'myelems' && mydata.fieldsvalue.idElemParent) {
|
||||||
.findByIdAndUpdate(id, { $set: fieldsvalue }, { new: true })
|
// se è un myelem, allora cerca l'id anche sugli elementi contenuti in elems, (sotto rows e columns)
|
||||||
.then(async (rec) => {
|
// quindi devo aggiornare quell'elemento in elems
|
||||||
// tools.mylogshow(' REC TO MODIFY: ', rec);
|
|
||||||
if (!rec) {
|
|
||||||
return res.status(404).send();
|
|
||||||
} else {
|
|
||||||
let addmsg = '';
|
|
||||||
|
|
||||||
if (mydata.notifBot) {
|
const risult = await updateElemInsideColumn({ idapp, id, mydata });
|
||||||
// Send Notification to the BOT
|
|
||||||
await telegrambot.sendMsgTelegram(idapp, mydata.notifBot.un, mydata.notifBot.txt);
|
|
||||||
if (!!addmsg) await telegrambot.sendMsgTelegram(idapp, mydata.notifBot.un, addmsg);
|
|
||||||
let addtext = '[Msg Inviato a ' + mydata.notifBot.un + ']:' + '\n' + mydata.notifBot.txt;
|
|
||||||
telegrambot.sendMsgTelegramToTheManagers(idapp, addtext, true);
|
|
||||||
|
|
||||||
if (!!flotta) tools.writeFlottaLog(idapp, addtext, flotta.riga, flotta.col_prima);
|
if (risult.ok) {
|
||||||
}
|
res.send({ code: server_constants.RIS_CODE_OK, msg: '' });
|
||||||
|
}
|
||||||
|
|
||||||
if (mydata.table === 'accounts') {
|
/*return await mytable.findByIdAndUpdate(id, { $set: fieldsvalue }, { new: true }).then(async (rec) => {
|
||||||
let msg = '';
|
res.send({ code: server_constants.RIS_CODE_OK, msg: '' });
|
||||||
if (rec.circuitId) circuit = await Circuit.getCircuitByCircuitId(rec.circuitId);
|
});*/
|
||||||
|
} else {
|
||||||
|
return await mytable
|
||||||
|
.findByIdAndUpdate(id, { $set: fieldsvalue }, { new: true })
|
||||||
|
.then(async (rec) => {
|
||||||
|
// tools.mylogshow(' REC TO MODIFY: ', rec);
|
||||||
|
if (!rec) {
|
||||||
|
return res.status(404).send();
|
||||||
|
} else {
|
||||||
|
let addmsg = '';
|
||||||
|
|
||||||
let dest = rec.groupname ? rec.groupname : rec.username;
|
if (mydata.notifBot) {
|
||||||
let valprec = 0;
|
// Send Notification to the BOT
|
||||||
|
await telegrambot.sendMsgTelegram(idapp, mydata.notifBot.un, mydata.notifBot.txt);
|
||||||
|
if (!!addmsg) await telegrambot.sendMsgTelegram(idapp, mydata.notifBot.un, addmsg);
|
||||||
|
let addtext = '[Msg Inviato a ' + mydata.notifBot.un + ']:' + '\n' + mydata.notifBot.txt;
|
||||||
|
telegrambot.sendMsgTelegramToTheManagers(idapp, addtext, true);
|
||||||
|
|
||||||
if ('saldo' in fieldsvalue) {
|
if (!!flotta) tools.writeFlottaLog(idapp, addtext, flotta.riga, flotta.col_prima);
|
||||||
valprec = precRec && precRec.saldo ? precRec.saldo : 0;
|
|
||||||
msg = i18n.__(
|
|
||||||
'SALDO_VARIATO',
|
|
||||||
circuit.name,
|
|
||||||
req.user.username,
|
|
||||||
dest,
|
|
||||||
valprec,
|
|
||||||
fieldsvalue.saldo,
|
|
||||||
circuit.symbol
|
|
||||||
);
|
|
||||||
} else if ('fidoConcesso' in fieldsvalue) {
|
|
||||||
valprec = precRec && precRec.fidoConcesso ? precRec.fidoConcesso : 0;
|
|
||||||
msg = i18n.__(
|
|
||||||
'FIDOCONCESSO_VARIATO',
|
|
||||||
circuit.name,
|
|
||||||
req.user.username,
|
|
||||||
dest,
|
|
||||||
valprec,
|
|
||||||
fieldsvalue.fidoConcesso,
|
|
||||||
circuit.symbol
|
|
||||||
);
|
|
||||||
} else if ('qta_maxConcessa' in fieldsvalue) {
|
|
||||||
valprec = precRec && precRec.qta_maxConcessa ? precRec.qta_maxConcessa : 0;
|
|
||||||
msg = i18n.__(
|
|
||||||
'QTAMAX_VARIATO',
|
|
||||||
circuit.name,
|
|
||||||
req.user.username,
|
|
||||||
dest,
|
|
||||||
valprec,
|
|
||||||
fieldsvalue.qta_maxConcessa,
|
|
||||||
circuit.symbol
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg) {
|
if (mydata.table === 'accounts') {
|
||||||
telegrambot.sendMsgTelegramToTheManagers(idapp, msg);
|
|
||||||
telegrambot.sendMsgTelegramToTheAdminsOfCircuit(idapp, circuit.path, msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mydata.table === 'users') {
|
|
||||||
if ('profile.resid_province' in fieldsvalue) {
|
|
||||||
const card = fieldsvalue.hasOwnProperty('profile.resid_card') ? fieldsvalue['profile.resid_card'] : '';
|
|
||||||
// Controlla se esiste il Circuito di questa provincia, se non esiste lo crea!
|
|
||||||
await Circuit.createCircuitIfNotExist(req, idapp, fieldsvalue['profile.resid_province'], card);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (camporequisiti) {
|
|
||||||
await User.checkIfSbloccatiRequisiti(idapp, allData, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('aportador_solidario' in fieldsvalue) {
|
|
||||||
let ind_order_ingr = mydata.ind_order_ingr;
|
|
||||||
// SERVE SE CI METTO LE MINUSCOLE/MAIUSCOLE SBAGLIATE in invitante_username!
|
|
||||||
const myuserfound = await User.findByUsername(idapp, fieldsvalue.aportador_solidario, false);
|
|
||||||
if (!!myuserfound) {
|
|
||||||
if (!!myuserfound._id && !myuserfound.deleted) {
|
|
||||||
const aportador = await User.getUsernameById(idapp, myuserfound._id);
|
|
||||||
fieldsvalue.aportador_solidario = aportador;
|
|
||||||
//Aggiorna record !
|
|
||||||
await mytable.findByIdAndUpdate(id, { $set: fieldsvalue });
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
res.send({
|
|
||||||
code: server_constants.RIS_CODE_ERR,
|
|
||||||
msg: 'Non aggiornato',
|
|
||||||
});
|
|
||||||
res.status(400).send();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if ('deleted' in fieldsvalue) {
|
|
||||||
let msg = '';
|
let msg = '';
|
||||||
if (fieldsvalue.deleted) msg = 'cancellato (nascosto)';
|
if (rec.circuitId) circuit = await Circuit.getCircuitByCircuitId(rec.circuitId);
|
||||||
else msg = 'Ripristinato';
|
|
||||||
|
|
||||||
await telegrambot.sendMsgTelegramToTheManagers(
|
let dest = rec.groupname ? rec.groupname : rec.username;
|
||||||
idapp,
|
let valprec = 0;
|
||||||
`L\'utente ` +
|
|
||||||
tools.getNomeCognomeEUserNameByUser(rec) +
|
|
||||||
` è stato ${msg} da ` +
|
|
||||||
tools.getNomeCognomeEUserNameByUser(req.user)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (await tools.ModificheConsentite(req, mydata.table, fieldsvalue)) {
|
if ('saldo' in fieldsvalue) {
|
||||||
let msg = '';
|
valprec = precRec && precRec.saldo ? precRec.saldo : 0;
|
||||||
if (mydata.table === 'users') {
|
msg = i18n.__(
|
||||||
if ('aportador_solidario' in fieldsvalue) {
|
'SALDO_VARIATO',
|
||||||
const nomecognomenuovo = await User.getNameSurnameByUsername(idapp, fieldsvalue.aportador_solidario);
|
circuit.name,
|
||||||
const nomecognomeas = await User.getNameSurnameByUsername(idapp, rec.aportador_solidario);
|
req.user.username,
|
||||||
msg =
|
dest,
|
||||||
`Variato l'invitante di ` +
|
valprec,
|
||||||
tools.getNomeCognomeEUserNameByUser(rec) +
|
fieldsvalue.saldo,
|
||||||
'\nmodificato da ' +
|
circuit.symbol
|
||||||
tools.getNomeCognomeEUserNameByUser(req.user) +
|
);
|
||||||
' \n' +
|
} else if ('fidoConcesso' in fieldsvalue) {
|
||||||
'Prima: ' +
|
valprec = precRec && precRec.fidoConcesso ? precRec.fidoConcesso : 0;
|
||||||
nomecognomeas +
|
msg = i18n.__(
|
||||||
' (' +
|
'FIDOCONCESSO_VARIATO',
|
||||||
rec.aportador_solidario +
|
circuit.name,
|
||||||
')\n' +
|
req.user.username,
|
||||||
'Dopo: ' +
|
dest,
|
||||||
nomecognomenuovo +
|
valprec,
|
||||||
' (' +
|
fieldsvalue.fidoConcesso,
|
||||||
fieldsvalue.aportador_solidario +
|
circuit.symbol
|
||||||
') ]';
|
);
|
||||||
|
} else if ('qta_maxConcessa' in fieldsvalue) {
|
||||||
|
valprec = precRec && precRec.qta_maxConcessa ? precRec.qta_maxConcessa : 0;
|
||||||
|
msg = i18n.__(
|
||||||
|
'QTAMAX_VARIATO',
|
||||||
|
circuit.name,
|
||||||
|
req.user.username,
|
||||||
|
dest,
|
||||||
|
valprec,
|
||||||
|
fieldsvalue.qta_maxConcessa,
|
||||||
|
circuit.symbol
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Metti l'iniziale
|
if (msg) {
|
||||||
if (!(await User.AportadorOrig(id))) {
|
telegrambot.sendMsgTelegramToTheManagers(idapp, msg);
|
||||||
await mytable.findByIdAndUpdate(
|
telegrambot.sendMsgTelegramToTheAdminsOfCircuit(idapp, circuit.path, msg);
|
||||||
id,
|
|
||||||
{ $set: { aportador_iniziale: fieldsvalue.aportador_solidario } },
|
|
||||||
{ new: false }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg !== '') telegrambot.sendMsgTelegramToTheManagers(idapp, msg);
|
if (mydata.table === 'users') {
|
||||||
}
|
if ('profile.resid_province' in fieldsvalue) {
|
||||||
|
const card = fieldsvalue.hasOwnProperty('profile.resid_card') ? fieldsvalue['profile.resid_card'] : '';
|
||||||
|
// Controlla se esiste il Circuito di questa provincia, se non esiste lo crea!
|
||||||
|
await Circuit.createCircuitIfNotExist(req, idapp, fieldsvalue['profile.resid_province'], card);
|
||||||
|
}
|
||||||
|
|
||||||
res.send({ code: server_constants.RIS_CODE_OK, msg: '' });
|
if (camporequisiti) {
|
||||||
}
|
await User.checkIfSbloccatiRequisiti(idapp, allData, id);
|
||||||
})
|
}
|
||||||
.catch((e) => {
|
|
||||||
tools.mylogserr('Error patch USER: ', e.message);
|
if ('aportador_solidario' in fieldsvalue) {
|
||||||
res.status(400).send();
|
let ind_order_ingr = mydata.ind_order_ingr;
|
||||||
});
|
// SERVE SE CI METTO LE MINUSCOLE/MAIUSCOLE SBAGLIATE in invitante_username!
|
||||||
|
const myuserfound = await User.findByUsername(idapp, fieldsvalue.aportador_solidario, false);
|
||||||
|
if (!!myuserfound) {
|
||||||
|
if (!!myuserfound._id && !myuserfound.deleted) {
|
||||||
|
const aportador = await User.getUsernameById(idapp, myuserfound._id);
|
||||||
|
fieldsvalue.aportador_solidario = aportador;
|
||||||
|
//Aggiorna record !
|
||||||
|
await mytable.findByIdAndUpdate(id, { $set: fieldsvalue });
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
res.send({
|
||||||
|
code: server_constants.RIS_CODE_ERR,
|
||||||
|
msg: 'Non aggiornato',
|
||||||
|
});
|
||||||
|
res.status(400).send();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if ('deleted' in fieldsvalue) {
|
||||||
|
let msg = '';
|
||||||
|
if (fieldsvalue.deleted) msg = 'cancellato (nascosto)';
|
||||||
|
else msg = 'Ripristinato';
|
||||||
|
|
||||||
|
await telegrambot.sendMsgTelegramToTheManagers(
|
||||||
|
idapp,
|
||||||
|
`L\'utente ` +
|
||||||
|
tools.getNomeCognomeEUserNameByUser(rec) +
|
||||||
|
` è stato ${msg} da ` +
|
||||||
|
tools.getNomeCognomeEUserNameByUser(req.user)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (await tools.ModificheConsentite(req, mydata.table, fieldsvalue)) {
|
||||||
|
let msg = '';
|
||||||
|
if (mydata.table === 'users') {
|
||||||
|
if ('aportador_solidario' in fieldsvalue) {
|
||||||
|
const nomecognomenuovo = await User.getNameSurnameByUsername(idapp, fieldsvalue.aportador_solidario);
|
||||||
|
const nomecognomeas = await User.getNameSurnameByUsername(idapp, rec.aportador_solidario);
|
||||||
|
msg =
|
||||||
|
`Variato l'invitante di ` +
|
||||||
|
tools.getNomeCognomeEUserNameByUser(rec) +
|
||||||
|
'\nmodificato da ' +
|
||||||
|
tools.getNomeCognomeEUserNameByUser(req.user) +
|
||||||
|
' \n' +
|
||||||
|
'Prima: ' +
|
||||||
|
nomecognomeas +
|
||||||
|
' (' +
|
||||||
|
rec.aportador_solidario +
|
||||||
|
')\n' +
|
||||||
|
'Dopo: ' +
|
||||||
|
nomecognomenuovo +
|
||||||
|
' (' +
|
||||||
|
fieldsvalue.aportador_solidario +
|
||||||
|
') ]';
|
||||||
|
|
||||||
|
// Metti l'iniziale
|
||||||
|
if (!(await User.AportadorOrig(id))) {
|
||||||
|
await mytable.findByIdAndUpdate(
|
||||||
|
id,
|
||||||
|
{ $set: { aportador_iniziale: fieldsvalue.aportador_solidario } },
|
||||||
|
{ new: false }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (msg !== '') telegrambot.sendMsgTelegramToTheManagers(idapp, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
res.send({ code: server_constants.RIS_CODE_OK, msg: '' });
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
tools.mylogserr('Error patch USER: ', e.message);
|
||||||
|
res.status(400).send();
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
tools.mylogserr('Error chval: ', e.message);
|
tools.mylogserr('Error chval: ', e.message);
|
||||||
res.status(400).send();
|
res.status(400).send();
|
||||||
|
|||||||
@@ -1229,6 +1229,72 @@ module.exports = {
|
|||||||
SCONTI_APPLICA: {
|
SCONTI_APPLICA: {
|
||||||
NESSUNO: 0,
|
NESSUNO: 0,
|
||||||
A_TUTTI: 1,
|
A_TUTTI: 1,
|
||||||
}
|
},
|
||||||
|
|
||||||
|
ELEMTYPE: {
|
||||||
|
TITLE: 5,
|
||||||
|
MARGINI: 6,
|
||||||
|
CARD: 7,
|
||||||
|
IMGTITLE: 8,
|
||||||
|
IMGPOSTER: 9,
|
||||||
|
TEXT: 10,
|
||||||
|
HTML: 20,
|
||||||
|
IMAGE: 30,
|
||||||
|
IMAGEUPLOAD: 35,
|
||||||
|
SEPARATOR: 40,
|
||||||
|
VIDEO: 50,
|
||||||
|
PAGE: 55,
|
||||||
|
PAGEINTRO: 58,
|
||||||
|
CALENDAR: 70,
|
||||||
|
CAROUSEL_IDISCIPLINE: 80,
|
||||||
|
CAROUSEL_HOME: 85,
|
||||||
|
CHECK_EMAIL: 100,
|
||||||
|
CAROUSEL_IMGS: 110,
|
||||||
|
OPENSTREETMAP: 120,
|
||||||
|
MAINVIEW: 130,
|
||||||
|
CHECKAPPRUNNING: 135,
|
||||||
|
DASHBOARD: 140,
|
||||||
|
DASHGROUP: 145,
|
||||||
|
MOVEMENTS: 148,
|
||||||
|
CSENDRISTO: 150,
|
||||||
|
STATUSREG: 160,
|
||||||
|
CHECKIFISLOGGED: 170,
|
||||||
|
INFO_VERSION: 180,
|
||||||
|
BOTT_CONDIVIDI: 190,
|
||||||
|
BOTT_CHAT_TERRITORIALE: 192,
|
||||||
|
BUTTON: 195,
|
||||||
|
PRESENTAZIONE: 200,
|
||||||
|
MYACTIVITIES: 205,
|
||||||
|
NOTIFATTOP: 210,
|
||||||
|
CHART: 220,
|
||||||
|
CHECKNEWVERSION: 230,
|
||||||
|
CHECKTESTENV: 240,
|
||||||
|
BTN_REG: 250,
|
||||||
|
BTN_REG_BYBOT: 255,
|
||||||
|
REGISTRATION: 258,
|
||||||
|
BTN_LOGIN: 260,
|
||||||
|
FOOTER: 270,
|
||||||
|
PROFILETUTORIAL: 280,
|
||||||
|
VISUVIDEOPROMOANDPDF: 290,
|
||||||
|
ECOMMERCE: 300,
|
||||||
|
CATALOGO: 310,
|
||||||
|
RACCOLTA: 315,
|
||||||
|
TOOLSAI: 320,
|
||||||
|
CHATBOT: 325,
|
||||||
|
MAPPA: 350,
|
||||||
|
MAPPAUTENTI: 360,
|
||||||
|
MAPPACOMUNI: 370,
|
||||||
|
MAPPAGETCOORDINATE: 380,
|
||||||
|
EDITADDRESSBYCOORD: 390,
|
||||||
|
GRID_ORIZ: 400,
|
||||||
|
QRCODE: 410,
|
||||||
|
CATALOGLIST: 420,
|
||||||
|
SEARCHPRODUCT: 430,
|
||||||
|
RACCOLTE_CATALOGHI: 450,
|
||||||
|
STAT_PAGES: 460,
|
||||||
|
SECTION: 1000,
|
||||||
|
ROW: 1100,
|
||||||
|
COLUMN: 1200,
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user