diff --git a/.env.development b/.env.development
index 9d44ff0..2498e7b 100644
--- a/.env.development
+++ b/.env.development
@@ -1,12 +1,12 @@
-DATABASE=test_PiuCheBuono
+DATABASE=test_FreePlanet
UDB=paofreeplanet
PDB=mypassword@1A
SEND_EMAIL=0
SEND_EMAIL_ORDERS=1
PORT=3000
-appTelegram_TEST=["1","17"]
-appTelegram=["1","17"]
-appTelegram_DEVELOP=["17"]
+appTelegram_TEST=["1","13"]
+appTelegram=["1","13"]
+appTelegram_DEVELOP=["13"]
DOMAIN=mongodb://localhost:27017/
AUTH_MONGODB=1
MONGODB_USER=admin
@@ -40,7 +40,4 @@ FTPSERVER_USER=ftpusrsrv_
FTPSERVER_PWD=ftpmypwd@1A_
AUTH_NEW_SITES=123123123
SCRIPTS_DIR=admin_scripts
-CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
-MIAB_HOST=box.lamiaposta.org
-MIAB_ADMIN_EMAIL=admin@lamiaposta.org
-MIAB_ADMIN_PASSWORD=passpao1pabox@1A
\ No newline at end of file
+CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
\ No newline at end of file
diff --git a/docs/libro1.htm b/docs/libro1.htm
new file mode 100644
index 0000000..f519da6
--- /dev/null
+++ b/docs/libro1.htm
@@ -0,0 +1,429 @@
+
+
+
+
+
+ Link Page
+
+
+
+
+ Links
+
+
+ Articles di 22467 :
+
[
+ {
+ "Id": "258787",
+ "IdArticolo": "22467",
+ "Ean13": "9788828510147",
+ "Titolo": "Le Stelle Cadranno dal Cielo?",
+ "ListaAutori": "17",
+ "ListaArgomenti": "9",
+ "IdStatoProdotto": "34",
+ "PrezzoIvato": "24.9000",
+ "IdMarchioEditoriale": "1",
+ "IdCollana": "73",
+ "DataPubblicazione": "2025-01-14 00:00:00.000",
+ "IdTipologia": "1",
+ "IdTipoFormato": "1",
+ "Misure": "cm 13,5x20,5",
+ "Pagine": "192",
+ "Sottotitolo": "Non \u00e8 una catastrofe ma la Rivelazione dell'Universo reale",
+ "Durata": "",
+ "Numero": "",
+ "Edizione": "Dicembre 2024",
+ "Ristampa": "",
+ "DataInizioCampagna": "2024-11-07 00:00:00.000",
+ "DataFineCampagna": "2099-12-31 00:00:00.000",
+ "ScontoCampagna": "5.00",
+ "PrezzoIvatoScontatoCampagna": "23.6550",
+ "DataOra": "2024-12-19 09:24:01.593",
+ "Enabled": "0",
+ "IDTagGruppo": "0",
+ "Utente": "FLANZA-NOTE",
+ "PercIva": ".00",
+ "IdTitoloOriginale": "13415",
+ "EnabledAlFresco": "1",
+ "CodEdizione": "16",
+ "FasciaEta": null,
+ "FasciaEta2": null,
+ "data": "2024-12-19 09:24:01.593",
+ "DescrizioneStatoProdotto": "In prevendita",
+ "Codice": "22467",
+ "QtaDisponibile": "-6"
+ }
+]Product:
+
{
+ "id": 74617,
+ "name": "Le stelle cadranno dal cielo? - Nuovo",
+ "slug": "le-stelle-cadranno-dal-cielo-nuovo",
+ "permalink": "https:\/\/www.fioredellavita.it\/le-stelle-cadranno-dal-cielo\/?attribute_pa_versione=nuovo",
+ "date_created": "2024-12-19T15:26:11",
+ "date_created_gmt": "2024-12-19T14:26:11",
+ "date_modified": "2024-12-20T13:02:31",
+ "date_modified_gmt": "2024-12-20T12:02:31",
+ "type": "variation",
+ "status": "publish",
+ "featured": false,
+ "catalog_visibility": "visible",
+ "description": "",
+ "short_description": "",
+ "sku": "22467",
+ "price": "23.6550",
+ "regular_price": "24.9000",
+ "sale_price": "23.6550",
+ "date_on_sale_from": "2024-11-07T00:00:00",
+ "date_on_sale_from_gmt": "2024-11-06T23:00:00",
+ "date_on_sale_to": "2099-12-31T23:59:59",
+ "date_on_sale_to_gmt": "2099-12-31T22:59:59",
+ "on_sale": true,
+ "purchasable": true,
+ "total_sales": "0",
+ "virtual": false,
+ "downloadable": false,
+ "downloads": [],
+ "download_limit": -1,
+ "download_expiry": -1,
+ "external_url": "",
+ "button_text": "",
+ "tax_status": "taxable",
+ "tax_class": "",
+ "manage_stock": true,
+ "stock_quantity": 10000,
+ "backorders": "no",
+ "backorders_allowed": false,
+ "backordered": false,
+ "low_stock_amount": null,
+ "sold_individually": false,
+ "weight": "",
+ "dimensions": {
+ "length": "",
+ "width": "",
+ "height": ""
+ },
+ "shipping_required": true,
+ "shipping_taxable": true,
+ "shipping_class": "",
+ "shipping_class_id": 0,
+ "reviews_allowed": false,
+ "average_rating": "0.00",
+ "rating_count": 0,
+ "upsell_ids": [],
+ "cross_sell_ids": [],
+ "parent_id": 70642,
+ "purchase_note": "",
+ "categories": [],
+ "tags": [],
+ "images": [
+ {
+ "id": 73623,
+ "date_created": "2024-11-20T11:12:29",
+ "date_created_gmt": "2024-11-20T09:12:29",
+ "date_modified": "2024-12-20T14:02:31",
+ "date_modified_gmt": "2024-12-20T12:02:31",
+ "src": "https:\/\/i0.wp.com\/www.fioredellavita.it\/wp-content\/uploads\/2024\/09\/le-stella-cadranno-dal-cielo-copertina-web.jpg?fit=450%2C624&ssl=1",
+ "name": "le-stella-cadranno-dal-cielo-copertina-web",
+ "alt": "\"Le stelle cadranno dal cielo?\""
+ }
+ ],
+ "attributes": [
+ {
+ "id": 6,
+ "name": "Versione",
+ "slug": "pa_versione",
+ "option": "Nuovo"
+ }
+ ],
+ "default_attributes": [],
+ "variations": [],
+ "grouped_products": [],
+ "menu_order": 0,
+ "price_html": "24,90€<\/span><\/bdi><\/span><\/del> Il prezzo originale era: 24,90€.<\/span>23,66€<\/span><\/bdi><\/span><\/ins>Il prezzo attuale \u00e8: 23,66€.<\/span>",
+ "related_ids": [],
+ "meta_data": [
+ {
+ "id": 1521527,
+ "key": "ISBN",
+ "value": "9788828510147"
+ },
+ {
+ "id": 1521528,
+ "key": "misure",
+ "value": "cm 13,5x20,5"
+ },
+ {
+ "id": 1521529,
+ "key": "formato",
+ "value": "Brossura"
+ },
+ {
+ "id": 1521530,
+ "key": "pagine",
+ "value": "192"
+ },
+ {
+ "id": 1521531,
+ "key": "edizione",
+ "value": "Dicembre 2024"
+ },
+ {
+ "id": 1521532,
+ "key": "DataPubblicazione",
+ "value": "1736809200"
+ },
+ {
+ "id": 1521533,
+ "key": "DataPubbStr",
+ "value": "14\/01\/2025"
+ },
+ {
+ "id": 1521535,
+ "key": "_wpro_variable_is_preorder",
+ "value": "yes"
+ },
+ {
+ "id": 1521536,
+ "key": "_is_pre_order",
+ "value": "yes"
+ },
+ {
+ "id": 1521537,
+ "key": "_pre_order_date",
+ "value": "2025-01-14"
+ },
+ {
+ "id": 1521538,
+ "key": "_wpro_date_label_variable",
+ "value": "Prenotalo per riceverlo entro il 14 gennaio 2025"
+ },
+ {
+ "id": 1521539,
+ "key": "_wpro_no_date_label_variable",
+ "value": ""
+ },
+ {
+ "id": 1521540,
+ "key": "_wpro_manage_price_variable",
+ "value": ""
+ },
+ {
+ "id": 1521541,
+ "key": "_wpro_price_variable",
+ "value": ""
+ },
+ {
+ "id": 1521542,
+ "key": "_wpro_label_variable",
+ "value": "Pre Ordinalo!"
+ },
+ {
+ "id": 1521543,
+ "key": "_wpro_price_type_variable",
+ "value": "manual"
+ },
+ {
+ "id": 1521544,
+ "key": "_wpro_amount_price_variable",
+ "value": "fixed"
+ },
+ {
+ "id": 1521545,
+ "key": "_wpro_date_variable",
+ "value": "2025-01-14"
+ },
+ {
+ "id": 1521546,
+ "key": "_wpro_time_variable",
+ "value": ""
+ },
+ {
+ "id": 1521547,
+ "key": "_rank_math_gtin_code",
+ "value": ""
+ },
+ {
+ "id": 1521680,
+ "key": "_ywpo_preorder",
+ "value": "yes"
+ },
+ {
+ "id": 1521681,
+ "key": "_ywpo_availability_date_mode",
+ "value": "date"
+ },
+ {
+ "id": 1521682,
+ "key": "_ywpo_for_sale_date",
+ "value": "2025-01-14"
+ },
+ {
+ "id": 1521683,
+ "key": "_ywpo_price_mode",
+ "value": "default"
+ },
+ {
+ "id": 1521684,
+ "key": "_ywpo_preorder_price",
+ "value": "0"
+ },
+ {
+ "id": 1521685,
+ "key": "_ywpo_preorder_discount_percentage",
+ "value": ""
+ },
+ {
+ "id": 1521686,
+ "key": "_ywpo_preorder_discount_fixed",
+ "value": ""
+ },
+ {
+ "id": 1521687,
+ "key": "_ywpo_preorder_increase_percentage",
+ "value": ""
+ },
+ {
+ "id": 1521688,
+ "key": "_ywpo_preorder_increase_fixed",
+ "value": ""
+ },
+ {
+ "id": 1521711,
+ "key": "woo_feed_availability_date_var",
+ "value": "2025-01-14"
+ }
+ ],
+ "stock_status": "instock",
+ "has_options": false,
+ "post_password": "",
+ "global_unique_id": "",
+ "jetpack_sharing_enabled": true,
+ "jetpack-related-posts": [],
+ "builder_content": "",
+ "_links": {
+ "self": [
+ {
+ "href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/74617",
+ "targetHints": {
+ "allow": [
+ "GET",
+ "POST",
+ "PUT",
+ "PATCH",
+ "DELETE"
+ ]
+ }
+ }
+ ],
+ "collection": [
+ {
+ "href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products"
+ }
+ ],
+ "up": [
+ {
+ "href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/70642"
+ }
+ ]
+ }
+}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/libro2.htm b/docs/libro2.htm
new file mode 100644
index 0000000..0775ef1
--- /dev/null
+++ b/docs/libro2.htm
@@ -0,0 +1,403 @@
+
+
+
+
+
+ Link Page
+
+
+
+
+ Links
+
+
+ Articles di 22753 :
+
[
+ {
+ "Id": "258799",
+ "IdArticolo": "22753",
+ "Ean13": "9788865934883",
+ "Titolo": "La Storia di Flumeide e la Bambina",
+ "ListaAutori": "4184",
+ "ListaArgomenti": "6",
+ "IdStatoProdotto": "34",
+ "PrezzoIvato": "13.0000",
+ "IdMarchioEditoriale": "34",
+ "IdCollana": "1033",
+ "DataPubblicazione": "2025-01-21 00:00:00.000",
+ "IdTipologia": "1",
+ "IdTipoFormato": "1",
+ "Misure": "cm 28x19",
+ "Pagine": "32",
+ "Sottotitolo": "Una fiaba per grandi",
+ "Durata": "",
+ "Numero": "",
+ "Edizione": "Gennaio 2025",
+ "Ristampa": "",
+ "DataInizioCampagna": "2024-11-15 00:00:00.000",
+ "DataFineCampagna": "2099-11-15 00:00:00.000",
+ "ScontoCampagna": "5.00",
+ "PrezzoIvatoScontatoCampagna": "12.3500",
+ "DataOra": "2024-12-19 11:16:13.993",
+ "Enabled": "0",
+ "IDTagGruppo": "0",
+ "Utente": "AZANGHERI-NOTE",
+ "PercIva": ".00",
+ "IdTitoloOriginale": "13664",
+ "EnabledAlFresco": "1",
+ "CodEdizione": "1",
+ "FasciaEta": "Genitori",
+ "FasciaEta2": "Ragazze e ragazzi",
+ "data": "2024-12-19 11:16:13.993",
+ "DescrizioneStatoProdotto": "In prevendita",
+ "Codice": "22753",
+ "QtaDisponibile": "-2"
+ }
+]Product:
+
{
+ "id": 73612,
+ "name": "La storia di Flumeide e la bambina - Nuovo",
+ "slug": "la-storia-di-flumeide-e-la-bambina-nuovo",
+ "permalink": "https:\/\/www.fioredellavita.it\/?post_type=product&p=73611&attribute_pa_versione=nuovo",
+ "date_created": "2024-11-20T04:49:10",
+ "date_created_gmt": "2024-11-20T03:49:10",
+ "date_modified": "2024-12-20T12:56:24",
+ "date_modified_gmt": "2024-12-20T11:56:24",
+ "type": "variation",
+ "status": "publish",
+ "featured": false,
+ "catalog_visibility": "visible",
+ "description": "",
+ "short_description": "",
+ "sku": "22753",
+ "price": "12.3500",
+ "regular_price": "13.0000",
+ "sale_price": "12.3500",
+ "date_on_sale_from": "2024-11-15T00:00:00",
+ "date_on_sale_from_gmt": "2024-11-14T23:00:00",
+ "date_on_sale_to": "2099-11-15T23:59:59",
+ "date_on_sale_to_gmt": "2099-11-15T22:59:59",
+ "on_sale": true,
+ "purchasable": true,
+ "total_sales": "0",
+ "virtual": false,
+ "downloadable": false,
+ "downloads": [],
+ "download_limit": -1,
+ "download_expiry": -1,
+ "external_url": "",
+ "button_text": "",
+ "tax_status": "taxable",
+ "tax_class": "",
+ "manage_stock": true,
+ "stock_quantity": 10000,
+ "backorders": "no",
+ "backorders_allowed": false,
+ "backordered": false,
+ "low_stock_amount": null,
+ "sold_individually": false,
+ "weight": "",
+ "dimensions": {
+ "length": "",
+ "width": "",
+ "height": ""
+ },
+ "shipping_required": true,
+ "shipping_taxable": true,
+ "shipping_class": "",
+ "shipping_class_id": 0,
+ "reviews_allowed": false,
+ "average_rating": "0.00",
+ "rating_count": 0,
+ "upsell_ids": [],
+ "cross_sell_ids": [],
+ "parent_id": 73611,
+ "purchase_note": "",
+ "categories": [],
+ "tags": [],
+ "images": [],
+ "attributes": [
+ {
+ "id": 6,
+ "name": "Versione",
+ "slug": "pa_versione",
+ "option": "Nuovo"
+ }
+ ],
+ "default_attributes": [],
+ "variations": [],
+ "grouped_products": [],
+ "menu_order": 1,
+ "price_html": "13,00€<\/span><\/bdi><\/span><\/del> Il prezzo originale era: 13,00€.<\/span>12,35€<\/span><\/bdi><\/span><\/ins>Il prezzo attuale \u00e8: 12,35€.<\/span>",
+ "related_ids": [],
+ "meta_data": [
+ {
+ "id": 1501793,
+ "key": "ISBN",
+ "value": "9788865934883"
+ },
+ {
+ "id": 1501794,
+ "key": "misure",
+ "value": "cm 28x19"
+ },
+ {
+ "id": 1501795,
+ "key": "formato",
+ "value": "Brossura"
+ },
+ {
+ "id": 1501796,
+ "key": "pagine",
+ "value": "32"
+ },
+ {
+ "id": 1501798,
+ "key": "_wpro_variable_is_preorder",
+ "value": "yes"
+ },
+ {
+ "id": 1501799,
+ "key": "_is_pre_order",
+ "value": "yes"
+ },
+ {
+ "id": 1521636,
+ "key": "_pre_order_date",
+ "value": "2025-01-21"
+ },
+ {
+ "id": 1521637,
+ "key": "_wpro_date_label_variable",
+ "value": "Prenotalo per riceverlo entro il 21 gennaio 2025"
+ },
+ {
+ "id": 1521638,
+ "key": "_wpro_no_date_label_variable",
+ "value": ""
+ },
+ {
+ "id": 1521639,
+ "key": "_wpro_manage_price_variable",
+ "value": ""
+ },
+ {
+ "id": 1521640,
+ "key": "_wpro_price_variable",
+ "value": ""
+ },
+ {
+ "id": 1521641,
+ "key": "_wpro_label_variable",
+ "value": "Pre Ordinalo!"
+ },
+ {
+ "id": 1521642,
+ "key": "_wpro_price_type_variable",
+ "value": "manual"
+ },
+ {
+ "id": 1521643,
+ "key": "_wpro_amount_price_variable",
+ "value": "fixed"
+ },
+ {
+ "id": 1521644,
+ "key": "_wpro_date_variable",
+ "value": "2025-01-21"
+ },
+ {
+ "id": 1521645,
+ "key": "_wpro_time_variable",
+ "value": ""
+ },
+ {
+ "id": 1521646,
+ "key": "_rank_math_gtin_code",
+ "value": ""
+ },
+ {
+ "id": 1521698,
+ "key": "_ywpo_preorder",
+ "value": "yes"
+ },
+ {
+ "id": 1521699,
+ "key": "_ywpo_availability_date_mode",
+ "value": "date"
+ },
+ {
+ "id": 1521700,
+ "key": "_ywpo_for_sale_date",
+ "value": "1736809200"
+ },
+ {
+ "id": 1521701,
+ "key": "_ywpo_price_mode",
+ "value": "default"
+ },
+ {
+ "id": 1521702,
+ "key": "_ywpo_preorder_price",
+ "value": "0"
+ },
+ {
+ "id": 1521703,
+ "key": "_ywpo_preorder_discount_percentage",
+ "value": ""
+ },
+ {
+ "id": 1521704,
+ "key": "_ywpo_preorder_discount_fixed",
+ "value": ""
+ },
+ {
+ "id": 1521705,
+ "key": "_ywpo_preorder_increase_percentage",
+ "value": ""
+ },
+ {
+ "id": 1521706,
+ "key": "_ywpo_preorder_increase_fixed",
+ "value": ""
+ },
+ {
+ "id": 1521707,
+ "key": "edizione",
+ "value": ""
+ }
+ ],
+ "stock_status": "instock",
+ "has_options": false,
+ "post_password": "",
+ "global_unique_id": "",
+ "jetpack_sharing_enabled": true,
+ "jetpack-related-posts": [],
+ "builder_content": "",
+ "_links": {
+ "self": [
+ {
+ "href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/73612",
+ "targetHints": {
+ "allow": [
+ "GET",
+ "POST",
+ "PUT",
+ "PATCH",
+ "DELETE"
+ ]
+ }
+ }
+ ],
+ "collection": [
+ {
+ "href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products"
+ }
+ ],
+ "up": [
+ {
+ "href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/73611"
+ }
+ ]
+ }
+}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/emails/risricevuti/it/html.pug b/emails/risricevuti/it/html.pug
index bad1efc..0b071a5 100755
--- a/emails/risricevuti/it/html.pug
+++ b/emails/risricevuti/it/html.pug
@@ -13,7 +13,9 @@ if causale
p
p Commento di #{mittente}: #{causale}
p
-p Apri #{nomeapp} per vedere il tuo nuovo saldo.
+p Apri
+ strong #{nomeapp}
+ span per vedere il tuo nuovo saldo.
p
p Cordiali Saluti
p Supporto #{nomeapp}
diff --git a/src/server/locales/it.json b/src/server/locales/it.json
index a7f0d95..efc5d92 100644
--- a/src/server/locales/it.json
+++ b/src/server/locales/it.json
@@ -51,8 +51,11 @@
"FRIEND_UNBLOCKED_YOU": "Hai riattivato %s.",
"CIRCUIT_ACCEPT_NEWENTRY": "❇️👥 🧍♂️ Abilita Fiducia a %s nel '%s':",
"CIRCUIT_ACCEPT_NEWENTRY_BYGROUP": "❇️👥 🧍♂️ Abilita Fiducia nel Circuito al gruppo %s:",
+ "CIRCUIT_ACCEPT_NEWENTRY_CIRC": "❇️👥 🧍♂️ Fai entrare a %s nel '%s':",
+ "CIRCUIT_ACCEPT_NEWENTRY_BYGROUP_CIRC": "❇️👥 🧍♂️ Fai entrare nel Circuito al gruppo %s:",
"CIRCUIT_OPEN_RISITALIA": "Apri il Circuito RIS Italia e chiedi di entrare",
"CIRCUIT_REQUEST_TO_ENTER": "%s è entrato nel %s (con %s iscritti) ed è in attesa di essere abilitato alla Fiducia\n🙎🏻♂️ Invitato da %s",
+ "CIRCUIT_REQUEST_TO_ENTER_ASKMANAGER": "%s ha fatto richiesta di entrare nel %s (con %s iscritti)\n🙎🏻♂️ Invitato da %s",
"CIRCUIT_ADMINS": "Gli amministratori del circuito sono %s:\n%s",
"CIRCUIT_WHERE_IS_PRESENT": "\nAttualmente è presente in: %s",
"CIRCUIT_REQUEST_TO_ENTER_WITH_GROUP": "il gruppo %s ha chiesto di entrare nel %s (con %s iscritti)",
diff --git a/src/server/middleware/authenticate.js b/src/server/middleware/authenticate.js
index 59bf7b4..b729750 100755
--- a/src/server/middleware/authenticate.js
+++ b/src/server/middleware/authenticate.js
@@ -63,7 +63,7 @@ const authenticate = (req, res, next) => {
}).catch((e) => {
if (e === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
- return res.status(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED).send();
+ return res.status(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED).send();
}
tools.mylog("ERR authenticate invalid Token =", e);
res.status(server_constants.RIS_CODE_HTTP_INVALID_TOKEN).send();
@@ -90,14 +90,18 @@ const authenticate_noerror = (req, res, next) => {
req.access = access;
req.code = ris.code;
}
- // Vai avanti ad eseguire il codice, in ogni modo !
- next();
+ if (ris.code === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
+ return res.status(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED).send();
+ } else {
+ // Vai avanti ad eseguire il codice, in ogni modo !
+ next();
+ }
}).catch((e) => {
req.user = null;
req.token = null;
req.access = null;
req.code = 0;
-
+
// Continua comunque !
next();
});
diff --git a/src/server/models/account.js b/src/server/models/account.js
index 626df6b..356cc28 100755
--- a/src/server/models/account.js
+++ b/src/server/models/account.js
@@ -235,11 +235,11 @@ AccountSchema.statics.addtoSaldo = async function (myaccount, amount, mitt) {
myaccount.totTransato = 0;
}
myaccount.totTransato += Math.abs(amount);
-
+
if (!myaccount.numtransactions)
myaccount.numtransactions = 0;
myaccount.numtransactions++;
-
+
myaccount.date_updated = new Date();
myaccountupdate.saldo = myaccount.saldo;
@@ -255,7 +255,9 @@ AccountSchema.statics.addtoSaldo = async function (myaccount, amount, mitt) {
// Calcola Saldo Pendente !
await myaccount.calcPending(true);
- return ris;
+ const recupdated = await Account.findOne({ _id: myaccount.id });
+
+ return recupdated;
}
} catch (e) {
@@ -322,8 +324,9 @@ AccountSchema.statics.getAccountByUsernameAndCircuitId = async function (idapp,
});
if (contocom) {
- myaccount.fidoConcesso = shared_consts.CIRCUIT_PARAMS.SCOPERTO_MIN_CONTO_COMUNITARIO;
- myaccount.qta_maxConcessa = shared_consts.CIRCUIT_PARAMS.SCOPERTO_MAX_CONTO_COMUNITARIO;
+ myaccount.fidoConcesso = mycircuit.fido_scoperto_default_contocom || shared_consts.CIRCUIT_PARAMS.SCOPERTO_MIN_CONTO_COMUNITARIO;
+ myaccount.qta_maxConcessa = mycircuit.qta_max_default_contocom || shared_consts.CIRCUIT_PARAMS.SCOPERTO_MAX_CONTO_COMUNITARIO;
+
} else {
if (!mycircuit.fido_scoperto_default_grp)
mycircuit.fido_scoperto_default_grp = shared_consts.CIRCUIT_PARAMS.SCOPERTO_MIN_GRP;
@@ -343,7 +346,13 @@ AccountSchema.statics.getAccountByUsernameAndCircuitId = async function (idapp,
myaccount.fidoConcesso = 0;
}
- return await myaccount.save();
+ let acc = await myaccount.save();
+
+ if (mycircuit.creditodiPartenza && mycircuit.creditodiPartenza > 0) {
+ acc = await Account.addtoSaldo(acc, mycircuit.creditodiPartenza, false);
+ }
+
+ return acc;
}
return myaccount;
@@ -605,8 +614,12 @@ AccountSchema.statics.SetMinMaxPersonali = async function (idapp, fidoConcesso,
}
});
- // Se aggiorno questi dati, allora devo aggiornare anche gli account del RIS Nazionale
- await Account.updateAccountCircuitoNazionaleByLimiti(idapp, circuitId, fidoConcesso, qta_maxConcessa);
+ const circuit = await Circuit.findOne({ _id: circuitId });
+
+ if (!circuit.circuitoIndipendente) {
+ // Se aggiorno questi dati, e non è un Circuito Indipendente, allora devo aggiornare anche gli account del RIS Nazionale
+ await Account.updateAccountCircuitoNazionaleByLimiti(idapp, circuitId, fidoConcesso, qta_maxConcessa);
+ }
} else {
const ris = await Account.updateMany({ idapp, fidoConcesso: { $gt: 0 }, username: { "$nin": [null, ""] } },
@@ -690,9 +703,9 @@ AccountSchema.statics.updateAccountCircuitoNazionaleByLimiti = async function (i
} catch (e) {
console.error('updateAccountCircuitoNazionaleByLimiti', e);
}
-
+
return false;
-
+
};
AccountSchema.statics.canEditAccountAdmins = async function (username, id) {
@@ -736,7 +749,7 @@ AccountSchema.statics.removeAdminOfAccount = async function (idapp, username, ci
// Rimuovi l'account
AccountSchema.statics.removeAccount = async function (accountId) {
- return await Account.deleteOne({ _id: accountId});
+ return await Account.deleteOne({ _id: accountId });
};
AccountSchema.statics.updateSaldoAndTransato_AllAccounts = async function (idapp) {
diff --git a/src/server/models/catprod.js b/src/server/models/catprod.js
index 158f8ca..ba667b0 100755
--- a/src/server/models/catprod.js
+++ b/src/server/models/catprod.js
@@ -19,6 +19,9 @@ const CatProdSchema = new Schema({
name: {
type: String,
},
+ descr_estesa: {
+ type: String,
+ },
img: {
type: String,
},
diff --git a/src/server/models/circuit.js b/src/server/models/circuit.js
index d6364e5..8fca7d9 100755
--- a/src/server/models/circuit.js
+++ b/src/server/models/circuit.js
@@ -229,6 +229,22 @@ const CircuitSchema = new Schema({
type: Boolean,
default: false,
},
+ askManagerToEnter: {
+ type: Boolean,
+ default: false,
+ },
+ sendEmailAfterAskingToEnter: {
+ type: Boolean,
+ default: false,
+ },
+ circuitoIndipendente: {
+ type: Boolean,
+ default: false,
+ },
+ creditodiPartenza: {
+ type: Number,
+ default: 0,
+ },
});
CircuitSchema.pre('save', async function (next) {
@@ -300,8 +316,15 @@ CircuitSchema.statics.getWhatToShow = function (idapp, username) {
qta_max_default: 1,
fido_scoperto_default_grp: 1,
qta_max_default_grp: 1,
+ fido_scoperto_default_contocom: 1,
+ qta_max_default_contocom: 1,
deperimento: 1,
showAlways: 1,
+ ignoreLimits: 1,
+ askManagerToEnter: 1,
+ sendEmailAfterAskingToEnter: 1,
+ circuitoIndipendente: 1,
+ creditodiPartenza: 1,
transactionsEnabled: 1,
status: 1,
valuta_per_euro: 1,
@@ -359,6 +382,11 @@ CircuitSchema.statics.getWhatToShow_Unknown = function (idapp, username) {
regulation: 1,
numMembers: 1,
showAlways: 1,
+ ignoreLimits: 1,
+ askManagerToEnter: 1,
+ sendEmailAfterAskingToEnter: 1,
+ circuitoIndipendente: 1,
+ creditodiPartenza: 1,
systemUserId: 1,
founderUserId: 1,
nome_valuta: 1,
@@ -367,6 +395,8 @@ CircuitSchema.statics.getWhatToShow_Unknown = function (idapp, username) {
fido_scoperto_default: 1,
fido_scoperto_default_grp: 1,
qta_max_default_grp: 1,
+ fido_scoperto_default_contocom: 1,
+ qta_max_default_contocom: 1,
qta_max_default: 1,
valuta_per_euro: 1,
symbol: 1,
@@ -1093,6 +1123,9 @@ CircuitSchema.statics.createCircuitIfNotExist = async function (req, idapp, prov
totCircolante: 0,
date_created: new Date(),
admins: [{ username: useradmin }],
+ askManagerToEnter: false,
+ sendEmailAfterAskingToEnter: false,
+ circuitoIndipendente: false,
});
myrec = await circ.save();
diff --git a/src/server/models/collana.js b/src/server/models/collana.js
new file mode 100755
index 0000000..c8468fd
--- /dev/null
+++ b/src/server/models/collana.js
@@ -0,0 +1,60 @@
+mongoose = require('mongoose').set('debug', false)
+const Schema = mongoose.Schema;
+
+const tools = require('../tools/general');
+
+mongoose.Promise = global.Promise;
+mongoose.level = "F";
+
+// Resolving error Unknown modifier: $pushAll
+mongoose.plugin(schema => {
+ schema.options.usePushEach = true
+});
+
+const CollanaSchema = new Schema({
+ idapp: {
+ type: String,
+ },
+ idCollana: {
+ type: Number,
+ },
+ descrizione: {
+ type: String,
+ },
+ Descrizione_Estesa: {
+ type: String,
+ },
+ dataOra: {
+ type: Date,
+ },
+ enabled: {
+ type: Boolean,
+ },
+ enabledAlFresco: {
+ type: Boolean,
+ },
+
+});
+
+var Collana = module.exports = mongoose.model('Collana', CollanaSchema);
+
+module.exports.getFieldsForSearch = function () {
+ return [
+ { field: 'descrizione', type: tools.FieldType.string },
+ ]
+};
+
+module.exports.executeQueryTable = function (idapp, params) {
+ params.fieldsearch = this.getFieldsForSearch();
+ return tools.executeQueryTable(this, idapp, params);
+};
+
+module.exports.findAllIdApp = async function (idapp) {
+ const myfind = { idapp };
+
+ return await Collana.find(myfind).sort({name: 1, surname: 1});
+};
+
+module.exports.createIndexes((err) => {
+ if (err) throw err;
+});
diff --git a/src/server/models/myelem.js b/src/server/models/myelem.js
index 4fc0576..b20d54f 100755
--- a/src/server/models/myelem.js
+++ b/src/server/models/myelem.js
@@ -58,8 +58,11 @@ const catalogo = new Schema(
//++AddCATALOGO_FIELDS
productTypes: [{ type: Number }],
excludeproductTypes: [{ type: Number }],
- Editore: [{ type: String }],
- sort: { type: Number },
+ editore: [{ type: String }],
+ argomenti: [{ type: String }],
+ idCollana: { type: Number },
+ sort_field: { type: String },
+ sort_dir: { type: Number },
pdf: { type: Boolean },
pdf_filename: { type: String },
printable: { type: Boolean },
@@ -282,7 +285,7 @@ MyElemSchema.statics.SetIdPageInsteadThePah = async function (idapp) {
for (const [path, id] of Object.entries(pathToIdMap)) {
if (path) {
await MyElem.updateMany(
- { idapp },
+ { idapp },
{ path: path }, // Condizione per aggiornare dove il path corrisponde
{
$set: {
@@ -329,7 +332,7 @@ MyElemSchema.statics.SetIdPageInsteadThePah = async function (idapp) {
for (const [oldpath, id] of Object.entries(pathToIdMap2)) {
await MyElem.updateMany(
- { idapp },
+ { idapp },
{ oldpath: oldpath }, // Condizione per aggiornare dove il path corrisponde
{
$set: { idPage: id }
@@ -358,7 +361,7 @@ MyElemSchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
- const arrrec = await MyElem.find(myfind).sort({ order: 1 });
+ const arrrec = await MyElem.find(myfind).lean().sort({ order: 1 });
return arrrec;
};
@@ -368,32 +371,68 @@ MyElemSchema.statics.findallSchedeTemplate = async function (idapp) {
try {
- const ris = await MyElem.find({ idapp });
+ const ris = await MyElem.find({ idapp }).lean();
- // Estrai le schede che hanno isTemplate = true
const schedeTemplate = ris.flatMap(elem =>
- elem.catalogo && elem.catalogo.arrSchede ? elem.catalogo.arrSchede.filter(scheda => scheda.scheda?.isTemplate) : []
+ elem.catalogo && elem.catalogo.arrSchede ?
+ elem.catalogo.arrSchede
+ .filter(scheda => scheda.scheda?.isTemplate)
+ .map(scheda => ({
+ ...scheda, // mantieni i dati originali della scheda
+ idPageOrig: elem.idPage // aggiungi l'idPage
+ }))
+ : []
);
- /*
- // Trova tutti i documenti in cui idapp corrisponde e contiene schede con isTemplate = true
- const ris = await MyElem.find(
- { idapp },
- { 'catalogo.arrSchede': { $elemMatch: { isTemplate: true } } }
- ).populate('catalogo.arrSchede');
-
- // Estrai solo le schede che hanno isTemplate = true
- const schedeTemplate = ris.flatMap(elem =>
- elem.catalogo.arrSchede.filter(scheda => scheda.isTemplate)
- );
- */
-
return schedeTemplate;
} catch (e) {
console.error('Err', e);
}
};
+// Ricerca tra tutte le schede, contenute in catalogo, se esiste un nome di template uguale,
+// se non lo trova allora è quello giusto per crearne uno nuovo
+MyElemSchema.statics.getNewFreeNameTemplate = async function (idapp, idPageOrig, nomeTemplate) {
+ const MyElem = this;
+
+ try {
+ const ris = await MyElem.find(
+ {
+ idapp,
+ 'catalogo.arrSchede.scheda.isTemplate': true,
+ 'catalogo.arrSchede.scheda.idPage': { $ne: idPageOrig }
+ },
+ {
+ 'catalogo.arrSchede.scheda.name': 1,
+ 'catalogo.arrSchede.scheda.isTemplate': 1,
+ 'catalogo.arrSchede.scheda.idPage': 1
+ });
+
+ const existingNames = new Set(
+ ris.flatMap(elem =>
+ elem.catalogo?.arrSchede?.filter(scheda =>
+ scheda.scheda?.isTemplate &&
+ scheda.scheda?.idPage !== idPageOrig
+ )
+ .map(scheda => scheda.scheda?.name) || []
+ )
+ );
+
+ let ind = 2;
+ let newNameTemplate;
+
+ do {
+ newNameTemplate = `${nomeTemplate}_copia_${ind}`;
+ ind++;
+ } while (existingNames.has(newNameTemplate) && ind <= 1000);
+
+ return newNameTemplate;
+ } catch (e) {
+ console.error('Err', e);
+ throw e; // Propagate the error
+ }
+};
+
const MyElem = mongoose.model('MyElem', MyElemSchema);
MyElem.createIndexes((err) => {
diff --git a/src/server/models/myscheda.js b/src/server/models/myscheda.js
index 8bb2320..e6022f5 100755
--- a/src/server/models/myscheda.js
+++ b/src/server/models/myscheda.js
@@ -129,8 +129,11 @@ const scheletroScheda = {
productTypes: [{ type: Number }],
excludeproductTypes: [{ type: Number }],
editore: [{ type: String }],
+ argomenti: [{ type: String }],
+ idCollana: { type: Number },
author: { type: String },
- sort: { type: Number },
+ sort_field: { type: String },
+ sort_dir: { type: Number },
arrProdottiSpeciali: [{ type: String }],
};
@@ -149,11 +152,7 @@ MySchedaSchema.statics.executeQueryTable = function (idapp, params, user) {
};
MySchedaSchema.statics.findAllIdApp = async function (idapp) {
- const MyScheda = this;
- const myfind = { idapp };
-
- return await MyScheda.find(myfind);
};
const MyScheda = mongoose.model('MyScheda', MySchedaSchema);
diff --git a/src/server/models/productInfo.js b/src/server/models/productInfo.js
index 54bf702..8344d9a 100755
--- a/src/server/models/productInfo.js
+++ b/src/server/models/productInfo.js
@@ -119,6 +119,7 @@ const productInfoSchema = new Schema({
type: String,
},
idAuthors: [{ type: Schema.Types.ObjectId, ref: 'Author' }],
+ idCollana: { type: Schema.Types.ObjectId, ref: 'Collana' },
idPublisher: { type: Schema.Types.ObjectId, ref: 'Publisher' },
collezione: {
type: String,
@@ -138,7 +139,9 @@ const productInfoSchema = new Schema({
},
totVen: Number,
+ totFat: Number,
vLast3M: Number,
+ fatLast3M: Number,
vLast6M: Number,
vLastY: Number,
vLast2Y: Number,
@@ -218,6 +221,14 @@ module.exports.findAllIdApp = async function (idapp, code, id) {
as: 'authors'
}
},
+ {
+ $lookup: {
+ from: 'collanas',
+ localField: 'idCollana',
+ foreignField: '_id',
+ as: 'collana'
+ }
+ },
{
$lookup: {
from: 'publishers',
diff --git a/src/server/models/sendnotif.js b/src/server/models/sendnotif.js
index 697b19d..030cc53 100755
--- a/src/server/models/sendnotif.js
+++ b/src/server/models/sendnotif.js
@@ -402,6 +402,8 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
destinatario += ' (' + username_mittente + ')'
}
+ const circuit = await Circuit.findOne({ name: circuitname });
+
if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_NEW_REC) {
newdescr = i18n.__('CIRCUIT_CREATED', sender, recnotif.paramsObj.circuitnameDest);
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_SETFIDO) {
@@ -470,7 +472,12 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
} else {
newdescr = i18n.__('CIRCUIT_REQUEST_TO_ENTER', sender, '' + recnotif.paramsObj.circuitnameDest + '', numuserincircuit, aportador_solidario);
+ if (circuit.askManagerToEnter)
+ newdescr = i18n.__('CIRCUIT_REQUEST_TO_ENTER_ASKMANAGER', sender, '' + recnotif.paramsObj.circuitnameDest + '', numuserincircuit, aportador_solidario);
+
}
+
+
const myadmins = await Circuit.getListAdmins(recnotif.idapp, recnotif.paramsObj.circuitnameDest);
recnotif.textaddTelegram += '\n' + i18n.__('CIRCUIT_ADMINS', myadmins.num, myadmins.str);
recnotif.textaddTelegram += '\n' + i18n.__('CIRCUIT_WHERE_IS_PRESENT', await Circuit.getListCircuitsByUsername(recnotif.idapp, sender, recnotif.extrarec.groupname));
diff --git a/src/server/models/subcatprod.js b/src/server/models/subcatprod.js
index 5c40fe3..7c0466f 100755
--- a/src/server/models/subcatprod.js
+++ b/src/server/models/subcatprod.js
@@ -22,6 +22,9 @@ const SubCatProdSchema = new Schema({
name: {
type: String,
},
+ descr_estesa: {
+ type: String,
+ },
img: {
type: String,
},
diff --git a/src/server/models/user.js b/src/server/models/user.js
index 241a99e..b9b7d55 100755
--- a/src/server/models/user.js
+++ b/src/server/models/user.js
@@ -3014,6 +3014,7 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
}
} else if (cmd === shared_consts.CIRCUITCMD.SET) {
+
if (groupname) {
const foundIfCircuitInGroup = await MyGroup.ifCircuitAlreadyInGroup(idapp, groupname, circuitname);
@@ -3044,6 +3045,10 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
};
ris = await User.updateOne({ idapp, username: usernameOrig }, update);
+ // Elimina la richiesta:
+ update = { $pull: { req_users: { username: { $in: [usernameOrig] } } } };
+ await Circuit.updateOne({ idapp, name: circuitname }, update);
+
// Elimina eventualmente se era bloccato:
update = { $pull: { refused_users: { username: { $in: [usernameOrig] } } } };
await Circuit.updateOne({ idapp, name: circuitname }, update);
@@ -3138,9 +3143,16 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
},
});
+ const thiscircuit = await Circuit.findOne({
+ idapp,
+ name: circuitname,
+ });
+
if (value) {
- // Aggiungi intanto l'utente al Circuito (senza fido)
- ris = await this.addCircuitToUser(idapp, usernameOrig, circuitname, false);
+ if (!thiscircuit.askManagerToEnter) {
+ // Aggiungi intanto l'utente al Circuito (senza fido)
+ ris = await this.addCircuitToUser(idapp, usernameOrig, circuitname, false);
+ }
if (!foundIfAlreadyAskCircuit) {
update = {
@@ -3151,10 +3163,11 @@ UserSchema.statics.setCircuitCmd = async function (idapp, usernameOrig, circuitn
},
},
};
- // Aggiungi la richiesta per ottenere il fido
+ // Aggiungi la richiesta per ottenere il fido (o per entrare nel circuito)
ris = await Circuit.updateOne({ idapp, name: circuitname }, update);
}
+
if (ris) {
// Invia una notifica alla persona
await tools.sendNotificationByCircuit(idapp, usernameOrig, circuitname, cmd, true, true, username_action, extrarec);
diff --git a/src/server/router/admin_router.js b/src/server/router/admin_router.js
index 7a8db33..d761fdd 100755
--- a/src/server/router/admin_router.js
+++ b/src/server/router/admin_router.js
@@ -17,6 +17,7 @@ const ImportaDescr = require('../models/importadescr');
const ImportaIsbn = require('../models/importaisbn');
const ProductInfo = require('../models/productInfo');
const CatProd = require('../models/catprod');
+const Collana = require('../models/collana');
const Author = require('../models/author');
const Publisher = require('../models/publisher');
const SubCatProd = require('../models/subcatprod');
@@ -842,6 +843,7 @@ router.post('/import', authenticate, async (req, res) => {
let risupdate = await ProductInfo.updateMany({ idapp }, {
$set: {
totVen: 0,
+ totFat: 0,
vLast3M: 0,
vLast6M: 0,
vLastY: 0,
@@ -873,6 +875,8 @@ router.post('/import', authenticate, async (req, res) => {
// split versioneGM in array with separated ","
let arrversGM = versGM.split(",").map(x => x.trim());
+ const recproductInfoAttuale = await ProductInfo.findOne({ idapp, code: productInfo.code });
+
let productInfo = {
idapp: product.idapp,
code: product.isbn ? product.isbn : product.code,
@@ -882,13 +886,29 @@ router.post('/import', authenticate, async (req, res) => {
// name: product.title,
totVen: product.totVen || 0,
+ totFat: product.totFat || 0,
vLast3M: product.vLast3M || 0,
+ fatLast3M: product.fatLast3M || 0,
vLast6M: product.vLast6M || 0,
vLastY: product.vLastY || 0,
vLast2Y: product.vLast2Y || 0,
rank3M: product.rank3M || 0,
rank6M: product.rank6M || 0,
rank1Y: product.rank1Y || 0,
+
+ }
+
+ // Aggiorna la collana solo se non è stata già impostata nel record attuale
+ if (recproductInfoAttuale && !recproductInfoAttuale.idCollana && product.DescrizioneCollana) {
+ productInfo.idCollana = product.IdCollana;
+
+ reccollana = await Collana.findOne({ idapp, idCollana }).lean();
+ if (!reccollana) {
+ // Non esiste questa collana, quindi la creo !
+ reccoll = new Collana({ idapp, idCollana: product.IdCollana, descrizione: product.DescrizioneCollana });
+ ris = await reccoll.save();
+ }
+
}
if (product.DataPubblicazione) {
@@ -902,7 +922,7 @@ router.post('/import', authenticate, async (req, res) => {
// Update ProductInfo
- let risrecInfo = await ProductInfo.findOneAndUpdate({ code: productInfo.code }, { $set: productInfo }, { new: true, upsert: false });
+ let risrecInfo = await ProductInfo.findOneAndUpdate({ idapp, code: productInfo.code }, { $set: productInfo }, { new: true, upsert: false });
if (risrecInfo) {
imported++;
if (imported % 100 === 0)
@@ -1023,7 +1043,7 @@ router.post('/import', authenticate, async (req, res) => {
name: product.title,
description: product.description,
short_descr: product.short_descr,
- publisher: product.Editore,
+ publisher: product.editore,
collezione: product.Collezione,
// author: product.Autore ? product.Autore : '',
link: product.link ? product.link : '',
diff --git a/src/server/router/circuits_router.js b/src/server/router/circuits_router.js
index 539a9c8..1c48e8d 100755
--- a/src/server/router/circuits_router.js
+++ b/src/server/router/circuits_router.js
@@ -72,6 +72,10 @@ router.post('/load', authenticate, async (req, res) => {
}
*/
+ if (data === null) {
+ data = null;
+ }
+
const users_in_circuit = await Circuit.getUsersSingleCircuit(idapp, req.user.username, data.name, data._id);
data = await getCircuitRecAdminsInfo(idapp, data);
diff --git a/src/server/router/index_router.js b/src/server/router/index_router.js
index 4d67345..1241d59 100755
--- a/src/server/router/index_router.js
+++ b/src/server/router/index_router.js
@@ -75,6 +75,7 @@ const SubCatProd = require('../models/subcatprod');
const Gasordine = require('../models/gasordine');
const Product = require('../models/product');
const Author = require('../models/author');
+const Collana = require('../models/collana');
const Publisher = require('../models/publisher');
const ProductInfo = require('../models/productInfo');
const Scontistica = require('../models/scontistica');
@@ -856,11 +857,27 @@ async function duplicatePage(pageId, newpath) {
// Duplica ogni elemento utilizzando il nuovo idPath
const duplicates = elemsToDuplicate.map(elem => {
+
+ const catalogo = elem.catalogo;
+
+ for (const recscheda of catalogo.arrSchede) {
+ if (recscheda.scheda?.isTemplate) {
+ // Se è un template allora devo mettergli un altro ID !
+ recscheda.scheda._id = new mongoose.Types.ObjectId();
+ // recscheda.scheda.name = getNewFreeNameTemplate(recscheda.scheda?.name)
+ }
+ }
+
+ let newelem = { ...elem };
+
+ elem.catalogo = { ...catalogo };
+
const newElem = new MyElem({
...elem, // Copia le proprietà dell'elemento
_id: new mongoose.Types.ObjectId(), // Genera un nuovo ID
idPage: newPage._id.toString() // Imposta il nuovo campo IdPage
});
+
return newElem;
});
@@ -1827,6 +1844,7 @@ function load(req, res, version) {
let storehouses = Storehouse.findAllIdApp(idapp);
let providers = Provider.findAllIdApp(idapp);
let catprods = Product.getArrCatProds(idapp, shared_consts.PROD.BOTTEGA);
+ let collane = Collana.findAllIdApp(idapp);
let catprods_gas = Product.getArrCatProds(idapp, shared_consts.PROD.GAS);
let subcatprods = SubCatProd.findAllIdApp(idapp);
let gasordines = Gasordine.findAllIdApp(idapp);
@@ -1939,6 +1957,7 @@ function load(req, res, version) {
authors,
publishers,
myschedas,
+ collane,
]).then((arrdata) => {
// console.table(arrdata);
let myuser = req.user;
@@ -2034,6 +2053,7 @@ function load(req, res, version) {
authors: arrdata[49],
publishers: arrdata[50],
myschedas: arrdata[51],
+ collane: arrdata[52],
});
const prova = 1;
diff --git a/src/server/sendemail.js b/src/server/sendemail.js
index f5480d4..31ff63e 100755
--- a/src/server/sendemail.js
+++ b/src/server/sendemail.js
@@ -312,6 +312,7 @@ module.exports = {
dataemail: await this.getdataemail(idapp),
locale: lang,
nomeapp: tools.getNomeAppByIdApp(idapp),
+ strlinksito: tools.getHostByIdApp(idapp),
emailto: emailto,
qty: myrec.qty,
mittente: decode(myrec.mittente),
@@ -338,6 +339,7 @@ module.exports = {
dataemail: await this.getdataemail(idapp),
locale: lang,
nomeapp: tools.getNomeAppByIdApp(idapp),
+ strlinksito: tools.getHostByIdApp(idapp),
emailto: emailto,
msgbooking: '',
participants: '',
@@ -432,6 +434,7 @@ module.exports = {
dataemail: await this.getdataemail(idapp),
locale: lang,
nomeapp: tools.getNomeAppByIdApp(idapp),
+ strlinksito: tools.getHostByIdApp(idapp),
event: recbooking.infoevent,
participants: '',
participantsLunch: '',
@@ -470,6 +473,7 @@ module.exports = {
dataemail: await this.getdataemail(idapp),
locale: lang,
nomeapp: tools.getNomeAppByIdApp(idapp),
+ strlinksito: tools.getHostByIdApp(idapp),
usernameorig: user.name + ' ' + user.surname,
message: tools.convertTexttoHtml(recmsg.message),
infoevent: recmsg.source.infoevent,
@@ -529,6 +533,7 @@ module.exports = {
dataemail: await this.getdataemail(idapp),
locale: lang,
nomeapp: tools.getNomeAppByIdApp(idapp),
+ strlinksito: tools.getHostByIdApp(idapp),
usernameorig: user.name + ' ' + user.surname,
};
@@ -558,6 +563,7 @@ module.exports = {
dataemail: await this.getdataemail(idapp),
locale: lang,
nomeapp: tools.getNomeAppByIdApp(idapp),
+ strlinksito: tools.getHostByIdApp(idapp),
};
mylocalsconf = this.setParamsForTemplate(user, mylocalsconf);
@@ -795,6 +801,7 @@ module.exports = {
idapp,
locale: lang,
nomeapp: tools.getNomeAppByIdApp(idapp),
+ strlinksito: tools.getHostByIdApp(idapp),
orders,
baseurl: tools.getHostByIdApp(idapp),
dataemail: await this.getdataemail(idapp),
@@ -830,6 +837,7 @@ module.exports = {
idapp,
locale: lang,
nomeapp: tools.getNomeAppByIdApp(idapp),
+ strlinksito: tools.getHostByIdApp(idapp),
orders,
baseurl: tools.getHostByIdApp(idapp),
dataemail: await this.getdataemail(idapp),
@@ -875,6 +883,7 @@ module.exports = {
idapp,
locale: lang,
nomeapp: tools.getNomeAppByIdApp(idapp),
+ strlinksito: tools.getHostByIdApp(idapp),
arrevents: myarrevents,
baseurl: tools.getHostByIdApp(idapp),
dataemail: await this.getdataemail(idapp),
@@ -1030,6 +1039,7 @@ module.exports = {
idapp,
locale: lang,
nomeapp: tools.getNomeAppByIdApp(idapp),
+ strlinksito: tools.getHostByIdApp(idapp),
arrevents: myarrevents,
name: 'TestNome',
surname: 'TestCognome',
@@ -1067,6 +1077,7 @@ module.exports = {
idapp,
locale: userto.lang,
nomeapp: tools.getNomeAppByIdApp(idapp),
+ strlinksito: tools.getHostByIdApp(idapp),
name: userto.name,
surname: userto.surname,
emailto: myemail,
diff --git a/src/server/telegram/telegrambot.js b/src/server/telegram/telegrambot.js
index 87cbcb5..78f6a53 100755
--- a/src/server/telegram/telegrambot.js
+++ b/src/server/telegram/telegrambot.js
@@ -1009,6 +1009,44 @@ const MyTelegramBot = {
]);
send_notif = true;
}
+ } else if (myfunc === shared_consts.CallFunz.RICHIESTA_CIRCUIT) {
+
+ if (groupname) {
+ msg_notifpush = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY_BYGROUP_CIRC', locale: langdest }, groupname);
+ domanda = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY_BYGROUP_CIRC', locale: langdest }, groupname) + '
' + struserinfomsg;
+
+ keyb = cl.getInlineKeyboard(myuser.lang, [
+ {
+ text: '✅ Fai entrare a ' + groupname,
+ callback_data: InlineConferma.RISPOSTA_SI + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + '' + tools.SEP +
+ groupid + tools.SEP + groupname,
+ },
+ /*{
+ text: '🚫 Rifiuta ' + groupname,
+ callback_data: InlineConferma.RISPOSTA_NO + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + '' + tools.SEP +
+ groupid + tools.SEP + groupname,
+ },*/
+ ]);
+ send_notif = true;
+
+ } else {
+ msg_notifpush = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY_CIRC', locale: langdest }, myuser.username, name);
+ domanda = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY_CIRC', locale: langdest }, myuser.username, name) + '
' + struserinfomsg;
+
+ keyb = cl.getInlineKeyboard(myuser.lang, [
+ {
+ text: '✅ Fai entrare a ' + myuser.username,
+ callback_data: InlineConferma.RISPOSTA_SI + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + '' + tools.SEP +
+ groupid,
+ },
+ /*{
+ text: '🚫 Rifiuta ' + myuser.username,
+ callback_data: InlineConferma.RISPOSTA_NO + myfunc + tools.SEP + myuser.username + tools.SEP + '' + tools.SEP + '' + tools.SEP +
+ groupid,
+ }, */
+ ]);
+ send_notif = true;
+ }
}
// Invia Msg
@@ -4603,10 +4641,15 @@ if (true) {
} else if (data.action === InlineConferma.RISPOSTA_SI + shared_consts.CallFunz.RICHIESTA_FIDO) {
if (circuit) {
- cmd = shared_consts.CIRCUITCMD.SETFIDO;
- // Aggiungilo nel Circuito
- // await User.setCircuitCmd(user.idapp, data.username, circuit.name, cmd, 0, username_action, { groupname: data.groupname });
// Abiglitagli il Fido
+ cmd = shared_consts.CIRCUITCMD.SETFIDO;
+ await User.setCircuitCmd(user.idapp, data.username, circuit.name, cmd, 0, username_action, { groupname: data.groupname });
+ }
+ } else if (data.action === InlineConferma.RISPOSTA_SI + shared_consts.CallFunz.RICHIESTA_CIRCUIT) {
+
+ if (circuit) {
+ // Aggiungilo nel Circuito
+ cmd = shared_consts.CIRCUITCMD.SET;
await User.setCircuitCmd(user.idapp, data.username, circuit.name, cmd, 0, username_action, { groupname: data.groupname });
}
} else if (data.action === InlineConferma.RISPOSTA_NO + shared_consts.CallFunz.RICHIESTA_CIRCUIT) {
diff --git a/src/server/tools/general.js b/src/server/tools/general.js
index e03d4ae..4ffd84d 100755
--- a/src/server/tools/general.js
+++ b/src/server/tools/general.js
@@ -1234,7 +1234,12 @@ module.exports = {
typeid = shared_consts.TypeNotifs.ID_CIRCUIT_REQUEST_TO_ENTER;
// paramsObj.options = MessageOptions.Notify_OnlyToNotifinApp + MessageOptions.Notify_ByBotTelegram;
const myuserdata = await User.getUserShortDataByUsername(idapp, username_action);
- telegrambot.askConfirmationUser(idapp, shared_consts.CallFunz.RICHIESTA_FIDO, myuserdata, usernameDest, circuitname,
+ let cmdrichiesta = shared_consts.CallFunz.RICHIESTA_FIDO;
+ if (mycircuit && mycircuit.askManagerToEnter) {
+ cmdrichiesta = shared_consts.CallFunz.RICHIESTA_CIRCUIT;
+ }
+
+ telegrambot.askConfirmationUser(idapp, cmdrichiesta, myuserdata, usernameDest, circuitname,
myreccircuit._id, '', extrarec.groupname);
onlysave = false;
} else if (cmd === shared_consts.CIRCUITCMD.ADDADMIN) {
diff --git a/src/server/tools/globalTables.js b/src/server/tools/globalTables.js
index 3799255..b8184bd 100755
--- a/src/server/tools/globalTables.js
+++ b/src/server/tools/globalTables.js
@@ -68,6 +68,7 @@ const Gasordine = require('../models/gasordine');
const Scontistica = require('../models/scontistica');
const Department = require('../models/department');
const CatProd = require('../models/catprod');
+const Collana = require('../models/collana');
const CatAI = require('../models/catai');
const QueryAI = require('../models/queryai');
const SubCatProd = require('../models/subcatprod');
@@ -130,6 +131,8 @@ module.exports = {
mytable = Category;
else if (tablename === 'catprods')
mytable = CatProd;
+ else if (tablename === 'collanas')
+ mytable = Collana;
else if (tablename === 'catais')
mytable = CatAI;
else if (tablename === 'queryais')
@@ -777,5 +780,14 @@ module.exports = {
return null;
},
+ checkIfTokenExpired(req, res) {
+ let ret = null;
+
+ if (true) {
+ res.status(408).send({});
+
+ }
+ }
+
};
diff --git a/src/server/tools/shared_nodejs.js b/src/server/tools/shared_nodejs.js
index 7383c5b..eb94d16 100755
--- a/src/server/tools/shared_nodejs.js
+++ b/src/server/tools/shared_nodejs.js
@@ -830,11 +830,17 @@ module.exports = {
deperimento: 1,
showAlways: 1,
ignoreLimits: 1,
+ askManagerToEnter: 1,
+ sendEmailAfterAskingToEnter: 1,
+ circuitoIndipendente: 1,
+ creditodiPartenza: 1,
status: 1,
transactionsEnabled: 1,
qta_max_default: 1,
fido_scoperto_default_grp: 1,
qta_max_default_grp: 1,
+ fido_scoperto_default_contocom: 1,
+ qta_max_default_contocom: 1,
valuta_per_euro: 1,
symbol: 1,
idCity: 1,