- aggiornato la versione STAMPA, che non funzionava
This commit is contained in:
@@ -419,7 +419,7 @@ async function deleteOldMyElems(idapp) {
|
||||
|
||||
/**
|
||||
* Trova tutte le schede template associate a pagine di idapp.
|
||||
* Restituisce un array di oggetti con le seguenti proprietà:
|
||||
* Restituisce un array di ogge tti con le seguenti proprietà:
|
||||
* - scheda: l'oggetto scheda, con proprietà come _id, name, isTemplate
|
||||
* - idPageOrig: l'idPage originale associata alla scheda
|
||||
*
|
||||
@@ -484,7 +484,7 @@ MyElemSchema.statics.findallSchedeTemplate = async function (idapp) {
|
||||
|
||||
if (resultWithTitles.length > 0) {
|
||||
console.log('Duplicati e titoli delle pagine:', JSON.stringify(resultWithTitles, null, 2));
|
||||
await deleteOldMyElems(idapp);
|
||||
// await deleteOldMyElems(idapp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,9 @@ const MyPageSchema = new Schema({
|
||||
only_admin: {
|
||||
type: Boolean,
|
||||
},
|
||||
only_collab: {
|
||||
type: Boolean,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
},
|
||||
@@ -211,6 +214,7 @@ MyPageSchema.statics.findOnlyStruttRec = async function (idapp) {
|
||||
isTemplate: 1,
|
||||
only_residenti: 1,
|
||||
only_admin: 1,
|
||||
only_collab: 1,
|
||||
inmenu: 1,
|
||||
submenu: 1,
|
||||
iconsize: 1,
|
||||
@@ -239,6 +243,7 @@ MyPageSchema.statics.findInternalPages = async function (idapp) {
|
||||
onlyif_logged: 1,
|
||||
only_residenti: 1,
|
||||
only_admin: 1,
|
||||
only_collab: 1,
|
||||
}).lean();
|
||||
|
||||
return result;
|
||||
|
||||
@@ -701,6 +701,7 @@ router.post('/join-pdf', authenticate, async (req, res) => {
|
||||
options.mydir = tools.getdirByIdApp(idapp);
|
||||
|
||||
try {
|
||||
|
||||
const mydirpath = tools.getdirByIdApp(options.idapp);
|
||||
const full_dir_out = tools.fixFilePath(path.join(mydirpath, options.dir_out));
|
||||
await fs.promises.mkdir(full_dir_out, { recursive: true });
|
||||
@@ -752,7 +753,7 @@ router.post('/join-pdf', authenticate, async (req, res) => {
|
||||
if (options.stampa) {
|
||||
raccolta.pdf_online_stampa_size = size;
|
||||
} else {
|
||||
raccolta.pdf_online = size;
|
||||
raccolta.pdf_online_size = size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -764,7 +765,7 @@ router.post('/join-pdf', authenticate, async (req, res) => {
|
||||
// risout
|
||||
|
||||
return res.status(200).send(risout);
|
||||
} catch (e) {
|
||||
} catch (e) {5
|
||||
console.error('Err join-pdf', e.message);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1016,7 +1016,7 @@ async function importPage(req, idapp, jsonString) {
|
||||
const table = globalTables.getTableByTableName(tableName);
|
||||
|
||||
if (tableName === 'mypages') {
|
||||
if (User.isEditor(req.user.perm) || User.isCommerciale(req.user.perm)) {
|
||||
if (User.isAdmin(req.user.perm) || User.isEditor(req.user.perm) || User.isCommerciale(req.user.perm) || User.isCollaboratore(req.user.perm)) {
|
||||
for (const page of myexp.mypages) {
|
||||
const { ImportedRecords, newId } = await upsertRecord(table, page, idapp);
|
||||
if (!newIdPage && newId) {
|
||||
|
||||
Reference in New Issue
Block a user