Aggiungere "San Marino" e suoi comuni
Corretto Filtro a mano della ricerca Creare filtro ricerca per trovare la sottocategoria o categoria -> Skill e SubSkill
This commit is contained in:
@@ -1199,6 +1199,36 @@ module.exports = {
|
||||
return query;
|
||||
},
|
||||
|
||||
getFilterParam: function(filter, fieldsearch) {
|
||||
let myregexp = {};
|
||||
myregexp = new RegExp(filter.trim().replace(' ', '|'), 'ig');
|
||||
|
||||
let query = [];
|
||||
|
||||
const myfilters = [];
|
||||
for (const rec of fieldsearch){
|
||||
let data = {};
|
||||
if (rec.type === this.FieldType.exact) {
|
||||
data[rec.field] = filter.trim();
|
||||
} else if (rec.type === this.FieldType.string) {
|
||||
data[rec.field] = myregexp;
|
||||
} else if ((rec.type === this.FieldType.number) ||
|
||||
(rec.type === this.FieldType.hours)) {
|
||||
data[rec.field] = parseFloat(filter.trim());
|
||||
}
|
||||
if (data)
|
||||
myfilters.push(data);
|
||||
}
|
||||
|
||||
if (myfilters.length > 0) {
|
||||
query = [
|
||||
{$match: {$or: myfilters}},
|
||||
];
|
||||
}
|
||||
|
||||
return query;
|
||||
},
|
||||
|
||||
getQueryTable: function(idapp, params) {
|
||||
|
||||
if (typeof params.startRow !== 'number') {
|
||||
@@ -1212,27 +1242,10 @@ module.exports = {
|
||||
let query = [];
|
||||
|
||||
if (params.filter && params.fieldsearch) {
|
||||
|
||||
let myregexp = {};
|
||||
myregexp = new RegExp(params.filter.trim().replace(' ', '|'), 'ig');
|
||||
|
||||
const myfilters = [];
|
||||
params.fieldsearch.forEach((rec) => {
|
||||
const data = {};
|
||||
if (rec.type === this.FieldType.exact) {
|
||||
data[rec.field] = params.filter.trim();
|
||||
} else if (rec.type === this.FieldType.string) {
|
||||
data[rec.field] = myregexp;
|
||||
} else if ((rec.type === this.FieldType.number) ||
|
||||
(rec.type === this.FieldType.hours)) {
|
||||
data[rec.field] = parseFloat(params.filter.trim());
|
||||
}
|
||||
myfilters.push(data);
|
||||
});
|
||||
|
||||
query = [
|
||||
{$match: {$or: myfilters}},
|
||||
];
|
||||
const querytemp = this.getFilterParam(params.filter, params.fieldsearch);
|
||||
if (querytemp){
|
||||
query = [...query, ...querytemp]
|
||||
}
|
||||
}
|
||||
|
||||
let filtriadded = [];
|
||||
@@ -1505,6 +1518,13 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
|
||||
if (params.filter && params.fieldsearch_last) {
|
||||
const querytemp = this.getFilterParam(params.filter, params.fieldsearch_last);
|
||||
if (querytemp){
|
||||
query = [...query, ...querytemp]
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// VECCHIA VERSIONE
|
||||
const q1 = this.getLookup(params, 1);
|
||||
@@ -2447,6 +2467,7 @@ module.exports = {
|
||||
|
||||
sulServer() {
|
||||
return process.env.LOCALE !== '1'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user