- posso fare upload dell'immagine del prodotto dalla lista
- corretto import dati
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
DATABASE=test_FreePlanet
|
||||
DATABASE=test_PiuCheBuono
|
||||
UDB=paofreeplanet
|
||||
PDB=mypassword@1A
|
||||
SEND_EMAIL=0
|
||||
SEND_EMAIL_ORDERS=1
|
||||
PORT=3000
|
||||
appTelegram_TEST=["1","13"]
|
||||
appTelegram=["1","13"]
|
||||
appTelegram_TEST=["1","17"]
|
||||
appTelegram=["1","17"]
|
||||
DOMAIN=mongodb://localhost:27017/
|
||||
AUTH_MONGODB=true
|
||||
MONGODB_USER=admin
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
"Hosp": "Ospitalità",
|
||||
"Good: %s": "Bene: %s",
|
||||
"Service: %s": "Servizio: %s",
|
||||
"Hosp: %s": "Ospitalità: %s",
|
||||
"NEW_GOOD": "❇️ <strong>%s</strong> ha aggiunto un nuovo Bene: \n<strong>%s</strong>",
|
||||
"NEW_SERVICE": "❇️ <strong>%s</strong> ha aggiunto un nuovo Servizio: \n<strong>%s</strong>",
|
||||
"NEW_HOSP": "❇️ <strong>%s</strong> ha aggiunto una nuova Ospitalità: \n<strong>%s</strong>",
|
||||
"NEW_EVENT": "❇️ <strong>%s</strong> ha aggiunto un nuovo Evento: \n%s\n<strong>%s</strong>\n%s",
|
||||
"NEW_EVENT_TELEGRAM": "%s\n\n❇️ <strong>%s</strong>\n\n%s\n\n%s",
|
||||
"NEW_ANNUNCIO_TELEGRAM": "❇️ <strong>%s</strong>\n\n%s\n\n%s",
|
||||
@@ -116,7 +118,5 @@
|
||||
"🚫 Hai rifiutato l'accesso alla App di RISO da parte di %s!": "🚫 Hai rifiutato l'accesso alla App di RISO da parte di %s!",
|
||||
"🚫 Ti è stato rifiutato l'accesso. Probabilmente l'username con cui ti sei registrato non ti conosce. (%s) !<br>Contatta l'Assistenza Tecnica.": "🚫 Ti è stato rifiutato l'accesso. Probabilmente l'username con cui ti sei registrato non ti conosce. (%s) !<br>Contatta l'Assistenza Tecnica.",
|
||||
"🚫 %s ha rifiutato l'accesso alla App a %s !": "🚫 %s ha rifiutato l'accesso alla App a %s !",
|
||||
"✅ Hai Abilitato l'accesso alla App a %s !": "✅ Hai Abilitato l'accesso alla App a %s !",
|
||||
"Good %s": "Good %s",
|
||||
"NEW_SERVICE": "NEW_SERVICE"
|
||||
"✅ Hai Abilitato l'accesso alla App a %s !": "✅ Hai Abilitato l'accesso alla App a %s !"
|
||||
}
|
||||
@@ -224,7 +224,7 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
||||
let eventobj = await tools.getAnnuncioForTelegram(recnotif.myrectableorig, tablerec, mydescr, userorig, true);
|
||||
newdescr = eventobj.newdescr;
|
||||
recnotif.textcontent_Telegram = eventobj.newdescrtelegram;
|
||||
recnotif.linkaddTelegram = i18n.__('SHOW_POST');
|
||||
recnotif.linkaddTelegram = '';
|
||||
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_EVENTS) {
|
||||
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYBACHECAS, true) + myidrec;
|
||||
tag = 'newevent';
|
||||
|
||||
@@ -151,9 +151,9 @@ function extractArrayDataFromCSV(idapp, rec) {
|
||||
arrcampi_product = getValoriAndIndice_Product(null);
|
||||
|
||||
for (const campoobj of arrcampi_productInfo) {
|
||||
if (rec.hasOwnProperty(campoobj)) {
|
||||
let myval = rec[campoobj];
|
||||
productInfo[campoobj] = myval === 'TRUE' ? true : (myval === 'FALSE' ? false : myval);
|
||||
if (rec.hasOwnProperty(campoobj.name)) {
|
||||
let myval = tools.ripulisciCampo(rec[campoobj.name]);
|
||||
productInfo[campoobj.name] = (myval === 'TRUE' || myval.toUpperCase() === 'SI') ? true : ((myval === 'FALSE' || myval.toUpperCase() === 'NO') ? false : myval);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -198,13 +198,14 @@ router.post('/import', authenticate, async (req, res) => {
|
||||
|
||||
try {
|
||||
const liste = require('../data/liste');
|
||||
let dataObjects = null;
|
||||
|
||||
if (cmd === shared_consts.Cmd.CITIES_SERVER) {
|
||||
return await City.insertMany(liste.Comuni).then((ris) => {
|
||||
return res.status(200).send(true);
|
||||
});
|
||||
} else if (cmd === shared_consts.Cmd.INVENTARIO) {
|
||||
let dataObjects = JSON.parse(`[${data.arrdata}]`);
|
||||
dataObjects = JSON.parse(`[${data.arrdata}]`);
|
||||
let updated = 0;
|
||||
let imported = 0;
|
||||
let errors = 0;
|
||||
@@ -222,7 +223,7 @@ router.post('/import', authenticate, async (req, res) => {
|
||||
|
||||
|
||||
} else if (cmd === shared_consts.Cmd.PRODUCTS) {
|
||||
let dataObjects = JSON.parse(`[${data.arrdata}]`);
|
||||
dataObjects = JSON.parse(`[${data.arrdata}]`);
|
||||
|
||||
let updated = 0;
|
||||
let imported = 0;
|
||||
@@ -379,8 +380,15 @@ router.post('/import', authenticate, async (req, res) => {
|
||||
}
|
||||
} else if (cmd === shared_consts.Cmd.PRODUCTS_V2) {
|
||||
let mydata = `[${data.arrdata}]`;
|
||||
let cleanmydata = mydata.replace(/\n/g, '');
|
||||
let arrrec = JSON.parse(cleanmydata);
|
||||
dataObjects = mydata.replace(/\n/g, '');
|
||||
let arrrec = [];
|
||||
try {
|
||||
arrrec = JSON.parse(dataObjects);
|
||||
} catch (e) {
|
||||
console.error("Errore durante l'analisi del JSON:", e);
|
||||
arrrec = [];
|
||||
}
|
||||
|
||||
let updated = 0;
|
||||
let imported = 0;
|
||||
let errors = 0;
|
||||
|
||||
@@ -475,6 +475,7 @@ module.exports = {
|
||||
listimages: 1024,
|
||||
exact: 2048,
|
||||
image: 3000,
|
||||
image_and_filename: 3100,
|
||||
nationality: 4096,
|
||||
intcode: 5000,
|
||||
multioption: 6000,
|
||||
@@ -4734,7 +4735,7 @@ module.exports = {
|
||||
const result = [];
|
||||
|
||||
text = text.replace(",", ".");
|
||||
const regex = /^(\d+\.?\d*)\s*(ml|gr|l|kg)\s*$/; // Aggiunto un punto dopo \d+ per accettare anche i numeri con la virgola
|
||||
const regex = /^(\d+\.?\d*)\s*(ml|gr|l|kg|uova)\s*$/; // Aggiunto un punto dopo \d+ per accettare anche i numeri con la virgola
|
||||
|
||||
const match = regex.exec(text);
|
||||
if (match) {
|
||||
@@ -4778,7 +4779,30 @@ module.exports = {
|
||||
},
|
||||
|
||||
removeescape(inputString) {
|
||||
return inputString.replace('\\', '').replace(/"/g, '')
|
||||
// return inputString.replace(/\\/g, '').replace(/"/g, '');
|
||||
if (inputString)
|
||||
return inputString.replace(/\\/g, '').replace(/"/g, '');
|
||||
else
|
||||
return '';
|
||||
},
|
||||
|
||||
escapeQuotes(stringa) {
|
||||
if (stringa)
|
||||
return stringa.replace(/"/g, '\\"');
|
||||
else
|
||||
return '';
|
||||
},
|
||||
|
||||
replaceQuotesWithSingleQuotes(jsonString) {
|
||||
if (jsonString)
|
||||
return jsonString.replace(/"/g, "'");
|
||||
else
|
||||
return '';
|
||||
},
|
||||
|
||||
ripulisciCampo(stringa) {
|
||||
let mystr = this.replaceQuotesWithSingleQuotes(stringa);
|
||||
return mystr;
|
||||
},
|
||||
|
||||
convertToNumeroVirgola(valstr) {
|
||||
|
||||
@@ -407,6 +407,11 @@ module.exports = {
|
||||
short: 'p',
|
||||
value: 10,
|
||||
},
|
||||
{
|
||||
label: 'Uova',
|
||||
short: 'uova',
|
||||
value: 15,
|
||||
},
|
||||
],
|
||||
|
||||
|
||||
@@ -974,25 +979,29 @@ module.exports = {
|
||||
],
|
||||
},
|
||||
|
||||
CAMPI_TYPE: {
|
||||
STRING: 1,
|
||||
},
|
||||
|
||||
CAMPI_PRODUCTINFO: [
|
||||
'name',
|
||||
'code',
|
||||
'description',
|
||||
'link_scheda',
|
||||
'idCatProds',
|
||||
'idSubCatProds',
|
||||
'weight',
|
||||
'weight_lordo',
|
||||
'unit',
|
||||
'unit_lordo',
|
||||
'size',
|
||||
'vegan',
|
||||
'sfuso',
|
||||
'img',
|
||||
'link',
|
||||
'ingredienti',
|
||||
'valori_nutrizionali',
|
||||
'note',
|
||||
{name: 'name', type: ''},
|
||||
{name: 'code', type: ''},
|
||||
{name: 'description', type: 1},
|
||||
{name: 'link_scheda', type: ''},
|
||||
{name: 'idCatProds', type: ''},
|
||||
{name: 'idSubCatProds', type: ''},
|
||||
{name: 'weight', type: ''},
|
||||
{name: 'weight_lordo', type: ''},
|
||||
{name: 'unit', type: ''},
|
||||
{name: 'unit_lordo', type: ''},
|
||||
{name: 'size', type: ''},
|
||||
{name: 'vegan', type: ''},
|
||||
{name: 'sfuso', type: ''},
|
||||
{name: 'img', type: ''},
|
||||
{name: 'link', type: ''},
|
||||
{name: 'ingredienti', type: ''},
|
||||
{name: 'valori_nutrizionali', type: ''},
|
||||
{name: 'note', type: ''},
|
||||
],
|
||||
|
||||
CAMPI_PRODUCT: [
|
||||
|
||||
Reference in New Issue
Block a user