diff --git a/.env.development b/.env.development
index 3136acd..61bd7e9 100644
--- a/.env.development
+++ b/.env.development
@@ -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
diff --git a/src/server/locales/it.json b/src/server/locales/it.json
index 4aafc6b..8681dd7 100644
--- a/src/server/locales/it.json
+++ b/src/server/locales/it.json
@@ -6,7 +6,9 @@
"Hosp": "Ospitalità",
"Good: %s": "Bene: %s",
"Service: %s": "Servizio: %s",
- "Hosp: %s": "Ospitalità: %s",
+ "NEW_GOOD": "❇️ %s ha aggiunto un nuovo Bene: \n%s",
+ "NEW_SERVICE": "❇️ %s ha aggiunto un nuovo Servizio: \n%s",
+ "NEW_HOSP": "❇️ %s ha aggiunto una nuova Ospitalità: \n%s",
"NEW_EVENT": "❇️ %s ha aggiunto un nuovo Evento: \n%s\n%s\n%s",
"NEW_EVENT_TELEGRAM": "%s\n\n❇️ %s\n\n%s\n\n%s",
"NEW_ANNUNCIO_TELEGRAM": "❇️ %s\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) !
Contatta l'Assistenza Tecnica.": "🚫 Ti è stato rifiutato l'accesso. Probabilmente l'username con cui ti sei registrato non ti conosce. (%s) !
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"
-}
\ No newline at end of file
+ "✅ Hai Abilitato l'accesso alla App a %s !": "✅ Hai Abilitato l'accesso alla App a %s !"
+}
diff --git a/src/server/models/sendnotif.js b/src/server/models/sendnotif.js
index a6ee829..8afa622 100755
--- a/src/server/models/sendnotif.js
+++ b/src/server/models/sendnotif.js
@@ -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';
diff --git a/src/server/router/admin_router.js b/src/server/router/admin_router.js
index 64e9704..089b387 100755
--- a/src/server/router/admin_router.js
+++ b/src/server/router/admin_router.js
@@ -151,11 +151,11 @@ 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);
}
-
+
}
for (const campoobj of arrcampi_product) {
@@ -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;
diff --git a/src/server/tools/general.js b/src/server/tools/general.js
index f9df4e3..c59a7f7 100755
--- a/src/server/tools/general.js
+++ b/src/server/tools/general.js
@@ -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) {
diff --git a/src/server/tools/shared_nodejs.js b/src/server/tools/shared_nodejs.js
index 3aafd40..5108615 100755
--- a/src/server/tools/shared_nodejs.js
+++ b/src/server/tools/shared_nodejs.js
@@ -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: [