- Sistemato link pdf che ogni volta che si aggiorna prendeva il PDF dalla cache...
- Raccolta Cataloghi, procedura che li AUTO genera in automatico.
This commit is contained in:
@@ -823,7 +823,7 @@ exports.updateLocalDb = async (tableContent, options) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reccateg.idArgomento) {
|
if (!reccateg?.idArgomento) {
|
||||||
// Se non c'è l'argomento, allora lo cerco nel DB
|
// Se non c'è l'argomento, allora lo cerco nel DB
|
||||||
const recarg = await T_Web_Argomenti.findOne({ Descrizione: reccateg.name }).lean();
|
const recarg = await T_Web_Argomenti.findOne({ Descrizione: reccateg.name }).lean();
|
||||||
reccateg.idArgomento = recarg.IdArgomento;
|
reccateg.idArgomento = recarg.IdArgomento;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const { ObjectId } = require('mongodb');
|
|||||||
const Gasordine = require('../models/gasordine');
|
const Gasordine = require('../models/gasordine');
|
||||||
|
|
||||||
const Order = require('../models/order');
|
const Order = require('../models/order');
|
||||||
const OrderClass = require('../modules/orderclass');
|
const OrderClass = require('../modules/OrderClass');
|
||||||
|
|
||||||
const Scontistica = require('../models/scontistica');
|
const Scontistica = require('../models/scontistica');
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,22 @@ class CronMod {
|
|||||||
await genPdf.launch();
|
await genPdf.launch();
|
||||||
|
|
||||||
return await genPdf.generatePdfFromIdCatalog(mydata.options);
|
return await genPdf.generatePdfFromIdCatalog(mydata.options);
|
||||||
|
} else if (mydata.dbop === 'GeneraPdfRaccolta') {
|
||||||
|
|
||||||
|
const genPdf = new GenPdf(idapp);
|
||||||
|
|
||||||
|
await genPdf.launch();
|
||||||
|
|
||||||
|
return await genPdf.generatePdfFromIdRaccolta(mydata.options);
|
||||||
|
} else if (mydata.dbop === 'onlinePdfRaccolta') {
|
||||||
|
|
||||||
|
const genPdf = new GenPdf(idapp);
|
||||||
|
|
||||||
|
await genPdf.launch();
|
||||||
|
|
||||||
|
mydata.options.idapp = idapp;
|
||||||
|
|
||||||
|
return await genPdf.onlinePdfFromIdRaccolta(mydata.options);
|
||||||
} else if (mydata.dbop === 'ReplaceAllCircuits') {
|
} else if (mydata.dbop === 'ReplaceAllCircuits') {
|
||||||
// ++ Replace All Circuitname with 'Circuito RIS %s'
|
// ++ Replace All Circuitname with 'Circuito RIS %s'
|
||||||
await Circuit.replaceAllCircuitNames(idapp);
|
await Circuit.replaceAllCircuitNames(idapp);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ const tools = require('../tools/general');
|
|||||||
const shared_consts = require('../tools/shared_nodejs');
|
const shared_consts = require('../tools/shared_nodejs');
|
||||||
|
|
||||||
const { compress } = require('compress-pdf');
|
const { compress } = require('compress-pdf');
|
||||||
|
const { RaccoltaCataloghi } = require('../models/raccoltacataloghi');
|
||||||
|
|
||||||
class GenPdf {
|
class GenPdf {
|
||||||
constructor(idapp) {
|
constructor(idapp) {
|
||||||
@@ -210,7 +211,6 @@ class GenPdf {
|
|||||||
|
|
||||||
// Assicurati che la directory output esista
|
// Assicurati che la directory output esista
|
||||||
const outputDir = path.dirname(outputFile);
|
const outputDir = path.dirname(outputFile);
|
||||||
const fs = require('fs').promises;
|
|
||||||
try {
|
try {
|
||||||
await fs.mkdir(outputDir, { recursive: true });
|
await fs.mkdir(outputDir, { recursive: true });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -387,6 +387,49 @@ class GenPdf {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async generatePdfFromIdRaccolta(options) {
|
||||||
|
try {
|
||||||
|
if (!options) {
|
||||||
|
console.error('Opzioni non passate !');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const raccolta = await RaccoltaCataloghi.findById(options.idRaccolta);
|
||||||
|
if (raccolta) {
|
||||||
|
for (const catalogo of raccolta.lista_cataloghi) {
|
||||||
|
await this.generatePdfFromIdCatalog({
|
||||||
|
...options,
|
||||||
|
idCatalog: catalogo._id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('err', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async onlinePdfFromIdRaccolta(options) {
|
||||||
|
try {
|
||||||
|
if (!options) {
|
||||||
|
console.error('Opzioni non passate !');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const raccolta = await RaccoltaCataloghi.findById(options.idRaccolta);
|
||||||
|
if (raccolta) {
|
||||||
|
for (const catalogo of raccolta.lista_cataloghi) {
|
||||||
|
await this.onlinePdfFromIdCatalog({
|
||||||
|
...options,
|
||||||
|
id_catalog: catalogo._id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('err', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async onlinePdfFromIdCatalog(options) {
|
||||||
|
const risout = await GenPdf.onlinePdf(options);
|
||||||
|
}
|
||||||
|
|
||||||
async generatePdfFromIdCatalog(options) {
|
async generatePdfFromIdCatalog(options) {
|
||||||
try {
|
try {
|
||||||
if (!options) {
|
if (!options) {
|
||||||
@@ -435,13 +478,36 @@ class GenPdf {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
const ris = {
|
||||||
fileout: filenamerelative,
|
fileout: filenamerelative,
|
||||||
fileout_compressed: filenamerelative_compressed,
|
fileout_compressed: filenamerelative_compressed,
|
||||||
filesize: await tools.getSizeFile(fullnamepath),
|
filesize: await tools.getSizeFile(fullnamepath),
|
||||||
filesize_compressed: await tools.getSizeFile(fullnamepath_compr),
|
filesize_compressed: await tools.getSizeFile(fullnamepath_compr),
|
||||||
error: '',
|
error: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (catalog) {
|
||||||
|
if (stampa) {
|
||||||
|
catalog.pdf_generato_stampa = ris.fileout;
|
||||||
|
catalog.pdf_generato_stampa_compressed = ris.fileout_compressed;
|
||||||
|
|
||||||
|
catalog.pdf_generato_stampa_size = ris.filesize;
|
||||||
|
catalog.pdf_generato_stampa_compr_size = ris.filesize_compressed;
|
||||||
|
|
||||||
|
catalog.data_generato_stampa = tools.getDateNow();
|
||||||
|
} else {
|
||||||
|
catalog.pdf_generato_compressed = ris.fileout_compressed;
|
||||||
|
catalog.pdf_generato = ris.fileout;
|
||||||
|
|
||||||
|
catalog.pdf_generato_size = ris.filesize;
|
||||||
|
catalog.pdf_generato_compr_size = ris.filesize_compressed;
|
||||||
|
|
||||||
|
catalog.data_generato = tools.getDateNow();
|
||||||
|
}
|
||||||
|
await catalog.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ris;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Errore durante la generazione del PDF dal catalogo ID:', error);
|
console.error('Errore durante la generazione del PDF dal catalogo ID:', error);
|
||||||
return {
|
return {
|
||||||
@@ -481,6 +547,81 @@ class GenPdf {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async onlinePdf(options) {
|
||||||
|
const idapp = options.idapp;
|
||||||
|
const id_catalog = options.id_catalog;
|
||||||
|
const id_raccolta = options.id_raccolta;
|
||||||
|
const stampa = options.stampa;
|
||||||
|
const compresso = options.compresso;
|
||||||
|
let mydir = '';
|
||||||
|
let risout = {};
|
||||||
|
|
||||||
|
try {
|
||||||
|
let myrec = null;
|
||||||
|
|
||||||
|
// Aggiorna il PDF OnLine, copiando il file da Generato a OnLine
|
||||||
|
if (id_catalog) {
|
||||||
|
myrec = await Catalog.findOne({ _id: id_catalog });
|
||||||
|
} else if (id_raccolta) {
|
||||||
|
myrec = await RaccoltaCataloghi.findOne({ _id: id_raccolta });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (myrec) {
|
||||||
|
mydir = tools.getdirByIdApp(idapp) + '/';
|
||||||
|
// const baseurl = this.getHostByIdApp(idapp);
|
||||||
|
|
||||||
|
if (stampa) {
|
||||||
|
myrec.pdf_online_stampa = myrec.pdf_generato_stampa?.replace('_generato', '');
|
||||||
|
} else {
|
||||||
|
myrec.pdf_online = myrec.pdf_generato?.replace('_generato', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
const myfile = stampa ? myrec.pdf_generato_stampa : myrec.pdf_generato;
|
||||||
|
|
||||||
|
|
||||||
|
if (myfile && (await tools.isFileExistsAsync(mydir + myfile))) {
|
||||||
|
// Aggiorna il PDF OnLine, copiando il file da Generato a OnLine
|
||||||
|
let fileOrigin = mydir + (stampa ? myrec.pdf_generato_stampa : myrec.pdf_generato);
|
||||||
|
|
||||||
|
if (compresso) {
|
||||||
|
let fileInCompressed = tools.removeFileExtension(fileOrigin) + `_compressed.pdf`;
|
||||||
|
// Se esiste allora prende questo COmpresso !
|
||||||
|
if (await tools.isFileExistsAsync(fileInCompressed)) {
|
||||||
|
fileOrigin = fileInCompressed;
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const fileDest = mydir + (stampa ? myrec.pdf_online_stampa : myrec.pdf_online);
|
||||||
|
const fileDestNoDir = stampa ? myrec.pdf_online_stampa : myrec.pdf_online;
|
||||||
|
// copia il file
|
||||||
|
await fs.copyFile(fileOrigin, fileDest);
|
||||||
|
|
||||||
|
if (stampa) {
|
||||||
|
myrec.pdf_online_stampa_size = await tools.getSizeFile(fileDest);
|
||||||
|
} else {
|
||||||
|
myrec.pdf_online_size = await tools.getSizeFile(fileDest);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stampa) {
|
||||||
|
myrec.data_online_stampa = myrec.data_generato_stampa;
|
||||||
|
} else {
|
||||||
|
myrec.data_online = myrec.data_generato;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggiorna il record
|
||||||
|
await myrec.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
risout = { record: myrec._doc };
|
||||||
|
}
|
||||||
|
|
||||||
|
return risout;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Err Online-pdf', e.message);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = GenPdf;
|
module.exports = GenPdf;
|
||||||
|
|||||||
@@ -436,7 +436,6 @@ class Macro {
|
|||||||
console.log('numrec', numrec);
|
console.log('numrec', numrec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let rimuoviTabellePerIniziare = false;
|
let rimuoviTabellePerIniziare = false;
|
||||||
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
@@ -467,16 +466,16 @@ class Macro {
|
|||||||
.filter(([isbn, products]) => products.length > 1)
|
.filter(([isbn, products]) => products.length > 1)
|
||||||
.map(([isbn]) => isbn);
|
.map(([isbn]) => isbn);
|
||||||
|
|
||||||
recproducts = recproducts.filter(product => isbnConMultipliRecord.includes(product.Ean13));
|
recproducts = recproducts.filter((product) => isbnConMultipliRecord.includes(product.Ean13));
|
||||||
|
|
||||||
console.log(`Trovati ${isbnConMultipliRecord.length} record con ISBN duplicati: ${isbnConMultipliRecord.join(', ')}`);
|
console.log(
|
||||||
|
`Trovati ${isbnConMultipliRecord.length} record con ISBN duplicati: ${isbnConMultipliRecord.join(', ')}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const recproduct of recproducts) {
|
for (const recproduct of recproducts) {
|
||||||
await this.elaboraProdotto(recproduct, opt);
|
await this.elaboraProdotto(recproduct, opt);
|
||||||
|
|
||||||
|
|
||||||
const sku = recproduct.IdArticolo;
|
const sku = recproduct.IdArticolo;
|
||||||
|
|
||||||
if (sku) {
|
if (sku) {
|
||||||
@@ -859,44 +858,52 @@ class Macro {
|
|||||||
* Gestisce le categorie e sottocategorie del prodotto.
|
* Gestisce le categorie e sottocategorie del prodotto.
|
||||||
*/
|
*/
|
||||||
async gestisciCategorie(productInfo, product) {
|
async gestisciCategorie(productInfo, product) {
|
||||||
if (product.DescrArgomento) {
|
try {
|
||||||
productInfo.idCatProds = [];
|
if (product.DescrArgomento) {
|
||||||
const reccateg = await CatProd.findOne({ idapp: this.idapp, name: product.DescrArgomento });
|
|
||||||
let nuovaCategoria = null;
|
|
||||||
if (!reccateg) {
|
|
||||||
nuovaCategoria = new CatProd({ idapp: this.idapp, name: product.DescrArgomento });
|
|
||||||
await nuovaCategoria.save();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!reccateg.idArgomento) {
|
|
||||||
// Se non c'è l'argomento, allora lo cerco nel DB
|
|
||||||
const recarg = await T_Web_Argomenti.findOne({ Descrizione: product.DescrArgomento }).lean();
|
|
||||||
reccateg.idArgomento = recarg.IdArgomento;
|
|
||||||
await reccateg.save();
|
|
||||||
}
|
|
||||||
|
|
||||||
const myriscat = reccateg?._id || (nuovaCategoria ? nuovaCategoria._id : null);
|
|
||||||
if (myriscat) productInfo.idCatProds.push(myriscat);
|
|
||||||
} else {
|
|
||||||
if (product.categories) {
|
|
||||||
// const arrcat = product.categories.trim().split(',');
|
|
||||||
const arrcat = product.categories.trim().split(',');
|
|
||||||
productInfo.idCatProds = [];
|
productInfo.idCatProds = [];
|
||||||
|
const reccateg = await CatProd.findOne({ idapp: this.idapp, name: product.DescrArgomento });
|
||||||
|
let nuovaCategoria = null;
|
||||||
|
if (!reccateg) {
|
||||||
|
nuovaCategoria = new CatProd({ idapp: this.idapp, name: product.DescrArgomento });
|
||||||
|
await nuovaCategoria.save();
|
||||||
|
}
|
||||||
|
|
||||||
for (const mycat of arrcat) {
|
|
||||||
const mycatstr = mycat.trim();
|
if (!reccateg?.idArgomento && product.DescrArgomento) {
|
||||||
const reccateg = await CatProd.findOne({ idapp: this.idapp, name: mycatstr }).lean();
|
// Se non c'è l'argomento, allora lo cerco nel DB
|
||||||
|
const recarg = await T_Web_Argomenti.findOne({ Descrizione: product.DescrArgomento }).lean();
|
||||||
let nuovaCategoria = null;
|
if (recarg) {
|
||||||
if (!reccateg) {
|
reccateg.idArgomento = recarg.IdArgomento;
|
||||||
nuovaCategoria = new CatProd({ idapp: this.idapp, name: mycatstr });
|
await reccateg.save();
|
||||||
await nuovaCategoria.save();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const myriscat = reccateg?._id || (nuovaCategoria ? nuovaCategoria._id : null);
|
|
||||||
if (myriscat) productInfo.idCatProds.push(myriscat);
|
const myriscat = reccateg?._id || (nuovaCategoria ? nuovaCategoria._id : null);
|
||||||
|
if (myriscat) productInfo.idCatProds.push(myriscat);
|
||||||
|
} else {
|
||||||
|
if (product.categories) {
|
||||||
|
// const arrcat = product.categories.trim().split(',');
|
||||||
|
const arrcat = product.categories.trim().split(',');
|
||||||
|
productInfo.idCatProds = [];
|
||||||
|
|
||||||
|
for (const mycat of arrcat) {
|
||||||
|
const mycatstr = mycat.trim();
|
||||||
|
const reccateg = await CatProd.findOne({ idapp: this.idapp, name: mycatstr }).lean();
|
||||||
|
|
||||||
|
let nuovaCategoria = null;
|
||||||
|
if (!reccateg) {
|
||||||
|
nuovaCategoria = new CatProd({ idapp: this.idapp, name: mycatstr });
|
||||||
|
await nuovaCategoria.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
const myriscat = reccateg?._id || (nuovaCategoria ? nuovaCategoria._id : null);
|
||||||
|
if (myriscat) productInfo.idCatProds.push(myriscat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Errore gestisciCategorie:', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -513,7 +513,7 @@ async function ConvertPDF_Generatore(options, instampa) {
|
|||||||
let marginLeft = instampa ? parseFloat(options.print_left) : 0;
|
let marginLeft = instampa ? parseFloat(options.print_left) : 0;
|
||||||
|
|
||||||
if (instampa) {
|
if (instampa) {
|
||||||
suffisso_filename = '-stampabile_generato';
|
suffisso_filename = '_stampabile_generato';
|
||||||
} else {
|
} else {
|
||||||
suffisso_filename = '_generato';
|
suffisso_filename = '_generato';
|
||||||
}
|
}
|
||||||
@@ -614,72 +614,13 @@ async function ConvertPDF_Generatore(options, instampa) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
router.post('/online-pdf', authenticate, async (req, res) => {
|
router.post('/online-pdf', authenticate, async (req, res) => {
|
||||||
console.log('/online-pdf');
|
console.log('/online-pdf');
|
||||||
|
|
||||||
idapp = req.body.idapp;
|
|
||||||
id_catalog = req.body.id_catalog;
|
|
||||||
id_raccolta = req.body.id_raccolta;
|
|
||||||
stampa = req.body.stampa;
|
|
||||||
compresso = req.body.compresso;
|
|
||||||
let mydir = '';
|
|
||||||
let risout = {};
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let myrec = null;
|
const risout = await GenPdf.onlinePdf(req.body);
|
||||||
|
|
||||||
// Aggiorna il PDF OnLine, copiando il file da Generato a OnLine
|
|
||||||
if (id_catalog) {
|
|
||||||
myrec = await Catalog.findOne({ _id: id_catalog });
|
|
||||||
} else if (id_raccolta) {
|
|
||||||
myrec = await RaccoltaCataloghi.findOne({ _id: id_raccolta });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myrec) {
|
|
||||||
mydir = tools.getdirByIdApp(idapp) + '/';
|
|
||||||
// const baseurl = this.getHostByIdApp(idapp);
|
|
||||||
|
|
||||||
if (stampa) {
|
|
||||||
myrec.pdf_online_stampa = myrec.pdf_generato_stampa.replace('_generato', '');
|
|
||||||
} else {
|
|
||||||
myrec.pdf_online = myrec.pdf_generato?.replace('_generato', '');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Aggiorna il PDF OnLine, copiando il file da Generato a OnLine
|
|
||||||
let fileOrigin = mydir + (stampa ? myrec.pdf_generato_stampa : myrec.pdf_generato);
|
|
||||||
|
|
||||||
if (compresso) {
|
|
||||||
let fileInCompressed = tools.removeFileExtension(fileOrigin) + `_compressed.pdf`;
|
|
||||||
// Se esiste allora prende questo COmpresso !
|
|
||||||
if (await tools.isFileExistsAsync(fileInCompressed)) {
|
|
||||||
fileOrigin = fileInCompressed;
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const fileDest = mydir + (stampa ? myrec.pdf_online_stampa : myrec.pdf_online);
|
|
||||||
const fileDestNoDir = stampa ? myrec.pdf_online_stampa : myrec.pdf_online;
|
|
||||||
// copia il file
|
|
||||||
await fs.promises.copyFile(fileOrigin, fileDest);
|
|
||||||
|
|
||||||
if (stampa) {
|
|
||||||
myrec.pdf_online_stampa_size = await tools.getSizeFile(fileDest);
|
|
||||||
} else {
|
|
||||||
myrec.pdf_online_size = await tools.getSizeFile(fileDest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stampa) {
|
|
||||||
myrec.data_online_stampa = myrec.data_generato_stampa;
|
|
||||||
} else {
|
|
||||||
myrec.data_online = myrec.data_generato;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Aggiorna il record
|
|
||||||
await myrec.save();
|
|
||||||
|
|
||||||
risout = { record: myrec._doc };
|
|
||||||
}
|
|
||||||
|
|
||||||
// risout
|
|
||||||
|
|
||||||
return res.status(200).send(risout);
|
return res.status(200).send(risout);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -687,6 +628,7 @@ router.post('/online-pdf', authenticate, async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
async function JoinPDFCatalogs(cataloghi, options, outputFile, stampa) {
|
async function JoinPDFCatalogs(cataloghi, options, outputFile, stampa) {
|
||||||
try {
|
try {
|
||||||
// Per ogni catalogo prendi il suo PDF Generato
|
// Per ogni catalogo prendi il suo PDF Generato
|
||||||
@@ -769,7 +711,7 @@ router.post('/join-pdf', authenticate, async (req, res) => {
|
|||||||
|
|
||||||
if (options.stampa) {
|
if (options.stampa) {
|
||||||
outputFileStampa =
|
outputFileStampa =
|
||||||
path.join(full_dir_out, path.basename(tools.removeFileExtension(outputFile))) + '-stampabile.pdf';
|
path.join(full_dir_out, path.basename(tools.removeFileExtension(outputFile))) + '_stampabile.pdf';
|
||||||
// Creazione file per STAMPA
|
// Creazione file per STAMPA
|
||||||
const ris_stampa = await JoinPDFCatalogs(cataloghi, options, outputFileStampa, true);
|
const ris_stampa = await JoinPDFCatalogs(cataloghi, options, outputFileStampa, true);
|
||||||
if (ris_stampa) {
|
if (ris_stampa) {
|
||||||
@@ -805,7 +747,7 @@ router.post('/join-pdf', authenticate, async (req, res) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
raccolta.save();
|
await raccolta.save();
|
||||||
|
|
||||||
risout = { raccolta: raccolta._doc };
|
risout = { raccolta: raccolta._doc };
|
||||||
}
|
}
|
||||||
@@ -1978,7 +1920,6 @@ async function importaCatalogo(data) {
|
|||||||
|
|
||||||
let nontrovati = 0;
|
let nontrovati = 0;
|
||||||
|
|
||||||
|
|
||||||
for (const product of dataObjects) {
|
for (const product of dataObjects) {
|
||||||
let isnuovo = false;
|
let isnuovo = false;
|
||||||
let setta = false;
|
let setta = false;
|
||||||
|
|||||||
@@ -6206,4 +6206,10 @@ module.exports = {
|
|||||||
fixFilePath(myfilepath) {
|
fixFilePath(myfilepath) {
|
||||||
return myfilepath.replace(/\\/g, '/');
|
return myfilepath.replace(/\\/g, '/');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getDateNow() {
|
||||||
|
const mydate = new Date();
|
||||||
|
return mydate;
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1070,9 +1070,12 @@ module.exports = {
|
|||||||
// modifiche ai campi se necessario, per esempio:
|
// modifiche ai campi se necessario, per esempio:
|
||||||
path: newpath,
|
path: newpath,
|
||||||
title: title || newpath,
|
title: title || newpath,
|
||||||
|
subtitle: '',
|
||||||
inmenu: false,
|
inmenu: false,
|
||||||
active: true,
|
active: true,
|
||||||
date_updated: new Date(),
|
date_updated: new Date(),
|
||||||
|
isTemplate: false,
|
||||||
|
author_username: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
// Salva il nuovo record di Page
|
// Salva il nuovo record di Page
|
||||||
@@ -1112,7 +1115,7 @@ module.exports = {
|
|||||||
|
|
||||||
const newElems = await MyElem.find({ idPage: newPage._id }).lean();
|
const newElems = await MyElem.find({ idPage: newPage._id }).lean();
|
||||||
|
|
||||||
console.log('Duplicazione completata con successo.');
|
// console.log('Duplicazione completata con successo.');
|
||||||
const newPageOut = await MyPage.findById(newPage._id).lean();
|
const newPageOut = await MyPage.findById(newPage._id).lean();
|
||||||
|
|
||||||
return { newPage: newPageOut, newElems };
|
return { newPage: newPageOut, newElems };
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.2.54
|
1.2.56
|
||||||
Reference in New Issue
Block a user