aggiornamenti vari. prima di VITE

This commit is contained in:
Surya Paolo
2025-02-25 18:13:01 +01:00
parent f8de205cf6
commit 57679fe649
25 changed files with 1595 additions and 708 deletions

View File

@@ -313,6 +313,84 @@ module.exports.replaceProductImgToImageFile = async function (abilitaserver) {
};
/**
* @typedef {Object} Article
* @property {bigint} Id
* @property {number} IdArticolo
* @property {string} Ean13
* @property {string} Titolo
* @property {string} ListaAutori
* @property {string} ListaArgomenti
* @property {number} IdStatoProdotto
* @property {number} PrezzoIvato
* @property {number} IdMarchioEditoriale
* @property {number} IdCollana
* @property {Date} DataPubblicazione
* @property {number} IdTipologia
* @property {number} IdTipoFormato
* @property {string} Misure
* @property {string} Pagine
* @property {string} Sottotitolo
* @property {string} Durata
* @property {string} Numero
* @property {string} Edizione
* @property {string} Ristampa
* @property {Date} DataInizioCampagna
* @property {Date} DataFineCampagna
* @property {number} ScontoCampagna
* @property {number} PrezzoIvatoScontatoCampagna
* @property {Date} DataOra
* @property {boolean} Enabled
* @property {number} IDTagGruppo
* @property {string} Utente
* @property {number} PercIva
* @property {number} IdTitoloOriginale
* @property {boolean} EnabledAlFresco
* @property {number} CodEdizione
* @property {string} FasciaEta
* @property {string} DescrizioneStatoProdotto
* @property {string} DescrizioneTipologia
* @property {string} DescrizioneFormato
* @property {string} DescrizioneCollana
* @property {string} DescrArgomento
* @property {string} AutoriCompleti
* @property {string} CasaEditrice
*/
/**
* Aggiorna il prodotto basandosi su un articolo
* @param {Article} article - Dati dell'articolo da aggiornare
* @param {boolean} creanew
* @returns {Promise<void>}
*/
module.exports.aggiornaProductFromGMArticle = async function (article, creanew) {
const ProductInfo = this;
try {
if (article) {
// cerca se esiste sul db locale
let findrec = this.find({ sku: article.IdArticolo }).lean();
if (findrec) {
// Articolo Trovato !
} else {
// articolo inesistente, lo vuoi creare ?
if (creanew) {
findrec = null;
}
}
if (findrec) {
}
}
} catch (e) {
console.error('Error aggiornaProductFromGMArticle:', err);
}
};
module.exports.correggiProductTypes = async function () {
const ProductInfo = this;
const bulkOps = [];

View File

@@ -241,9 +241,12 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
tag = 'newhosp';
tablerec = 'myhosps';
}
let eventobj = await tools.getAnnuncioForTelegram(recnotif.myrectableorig, tablerec, mydescr, userorig, true);
// newdescr = eventobj.descrperNotif;
recnotif.textcontent_Telegram = eventobj.newdescrtelegram;
if (recnotif.myrectableorig) {
let eventobj = await tools.getAnnuncioForTelegram(recnotif.myrectableorig, tablerec, mydescr, userorig, true);
recnotif.textcontent_Telegram = eventobj.newdescrtelegram;
} else {
recnotif.textcontent_Telegram = newdescr;
}
recnotif.linkaddTelegram = '';
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_EVENTS) {
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYBACHECAS, true) + myidrec;