Errore in visualizzazione degli eventi ! non si vedevano piu!
This commit is contained in:
@@ -32,6 +32,18 @@ span Abilita le Newsletter? :
|
||||
strong #{iscritto.newsletter_on}<br>
|
||||
span Metodo di Pagamento :
|
||||
strong #{metodo_pagamento}<br>
|
||||
span Motivazioni sul perchè intendi iscriverti alla CNM:
|
||||
strong #{iscritto.motivazioni}<br>
|
||||
span Descrivi le tue competenze e professionalità:
|
||||
strong #{iscritto.competenze_professionalita}<br>
|
||||
span Cosa potresti offrire?:
|
||||
strong #{iscritto.cosa_potrei_offrire}<br>
|
||||
span Cosa vorresti ricevere? (cosa ti aspetti?):
|
||||
strong #{iscritto.cosa_vorrei_ricevere}<br>
|
||||
span Scrivi altre eventuali informazioni o comunicazioni:
|
||||
strong #{iscritto.altre_comunicazioni}<br>
|
||||
span Come ci hai conosciuto?:
|
||||
strong #{iscritto.come_ci_hai_conosciuto}<br>
|
||||
p <br>Saluti
|
||||
|
||||
style(type="text/css").
|
||||
|
||||
@@ -2,7 +2,7 @@ const mongoose = require('mongoose');
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
mongoose.level = 'F';
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
@@ -12,7 +12,7 @@ const { Settings } = require('./settings');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
schema.options.usePushEach = true;
|
||||
});
|
||||
|
||||
const MyEventSchema = new Schema({
|
||||
@@ -121,7 +121,8 @@ const MyEventSchema = new Schema({
|
||||
note: {
|
||||
type: String,
|
||||
},
|
||||
pagefooter: [{
|
||||
pagefooter: [
|
||||
{
|
||||
type: String,
|
||||
}],
|
||||
deleted: {
|
||||
@@ -141,36 +142,47 @@ const MyEventSchema = new Schema({
|
||||
MyEventSchema.statics.findAllIdApp = function(socioresidente, idapp) {
|
||||
const Event = this;
|
||||
|
||||
let query = []
|
||||
let query = [];
|
||||
|
||||
if (socioresidente) {
|
||||
query = [
|
||||
{
|
||||
$match: {
|
||||
idapp,
|
||||
}
|
||||
}
|
||||
]
|
||||
$or: [
|
||||
{deleted: {$exists: false}},
|
||||
{deleted: {$exists: true, $eq: false}}],
|
||||
},
|
||||
},
|
||||
];
|
||||
} else {
|
||||
query = [
|
||||
{
|
||||
$match: {
|
||||
idapp,
|
||||
$and: [
|
||||
{
|
||||
$or: [
|
||||
{ $or: [{ internal: { $exists: false } }, { internal: { $exists: true, $eq: false } }] },
|
||||
{deleted: {$exists: false}},
|
||||
{deleted: {$exists: true, $eq: false}},
|
||||
],
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
$or: [
|
||||
{internal: {$exists: false}},
|
||||
{internal: {$exists: true, $eq: false}}],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
query.push({ $sort: { dateTimeStart: 1 } })
|
||||
query.push({$sort: {dateTimeStart: 1}});
|
||||
|
||||
return Event
|
||||
.aggregate(query)
|
||||
.then((arrrec) => {
|
||||
return arrrec
|
||||
})
|
||||
return Event.aggregate(query).then((arrrec) => {
|
||||
return arrrec;
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
@@ -180,70 +192,76 @@ MyEventSchema.statics.getLastEvents = async function (idapp) {
|
||||
const lastn = await Settings.getValDbSettings(idapp, 'SHOW_LAST_N_EV', 1);
|
||||
|
||||
const query = [
|
||||
{ $match: { idapp, dateTimeStart: { $gte: tools.IncDateNow(-1000 * 60 * 60 * 24) } } },
|
||||
{
|
||||
$match: {
|
||||
idapp,
|
||||
dateTimeStart: {$gte: tools.IncDateNow(-1000 * 60 * 60 * 24)},
|
||||
$or: [
|
||||
{deleted: {$exists: false}},
|
||||
{deleted: {$exists: true, $eq: false}}],
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'operators',
|
||||
localField: 'teacher',
|
||||
foreignField: 'username',
|
||||
as: 'op1'
|
||||
}
|
||||
as: 'op1',
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'operators',
|
||||
localField: 'teacher2',
|
||||
foreignField: 'username',
|
||||
as: 'op2'
|
||||
}
|
||||
as: 'op2',
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'operators',
|
||||
localField: 'teacher3',
|
||||
foreignField: 'username',
|
||||
as: 'op3'
|
||||
}
|
||||
as: 'op3',
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'operators',
|
||||
localField: 'teacher4',
|
||||
foreignField: 'username',
|
||||
as: 'op4'
|
||||
}
|
||||
as: 'op4',
|
||||
},
|
||||
{ "$addFields": { "contribtype": { "$toObjectId": "$contribtype" } } },
|
||||
},
|
||||
{'$addFields': {'contribtype': {'$toObjectId': '$contribtype'}}},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'contribtypes',
|
||||
localField: 'contribtype',
|
||||
foreignField: '_id',
|
||||
as: 'contrib'
|
||||
}
|
||||
as: 'contrib',
|
||||
},
|
||||
{ $sort: { dateTimeStart: 1 } }
|
||||
},
|
||||
{$sort: {dateTimeStart: 1}},
|
||||
];
|
||||
|
||||
return Event
|
||||
.aggregate(query)
|
||||
.then((arrrec) => {
|
||||
return Event.aggregate(query).then((arrrec) => {
|
||||
// console.table(arrrec);
|
||||
if (lastn > 0) {
|
||||
return arrrec.slice(0, lastn);
|
||||
} else {
|
||||
return arrrec
|
||||
return arrrec;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
MyEventSchema.statics.getFieldsForSearch = function() {
|
||||
return [{ field: 'short_tit', type: tools.FieldType.string },
|
||||
return [
|
||||
{field: 'short_tit', type: tools.FieldType.string},
|
||||
{field: 'title', type: tools.FieldType.string},
|
||||
{field: 'teacher', type: tools.FieldType.string},
|
||||
{ field: 'details', type: tools.FieldType.string }]
|
||||
{field: 'details', type: tools.FieldType.string}];
|
||||
};
|
||||
|
||||
MyEventSchema.statics.executeQueryTable = function(idapp, params) {
|
||||
@@ -256,7 +274,6 @@ if (tools.INITDB_FIRSTIME) {
|
||||
// MyEventSchema.index({ short_tit: 'text', title: 'text', teacher: 'text', details: 'text' });
|
||||
}
|
||||
|
||||
|
||||
const MyEvent = mongoose.model('MyEvent', MyEventSchema);
|
||||
|
||||
module.exports = {MyEvent};
|
||||
|
||||
@@ -203,9 +203,9 @@ module.exports = {
|
||||
|
||||
tools.sendNotifToAdmin('Nuova Registrazione Utente: ' + mylocalsconf.name + ' ' + mylocalsconf.surname + ' (' + mylocalsconf.username + ')');
|
||||
|
||||
if (tools.isManagAndAdminDifferent(idapp)) {
|
||||
this.sendEmail_base('admin/registration/' + tools.LANGADMIN, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
||||
}
|
||||
// if (tools.isManagAndAdminDifferent(idapp)) {
|
||||
// this.sendEmail_base('admin/registration/' + tools.LANGADMIN, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
||||
// }
|
||||
},
|
||||
sendEmail_IscrizioneConacreis: async function (lang, emailto, iscritto, idapp) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user