From 3e8be18473e7ca7ebfd8cbc2edb29b7a3e029740 Mon Sep 17 00:00:00 2001 From: Surya Paolo Date: Thu, 11 Apr 2024 17:12:21 +0200 Subject: [PATCH] =?UTF-8?q?-=20fix=20quantit=C3=A0=20corretta=20sulla=20em?= =?UTF-8?q?ail=20e=20dimensione=20dell'immagine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 6 +- emails/ecommerce/makeorder/it/html.pug | 8 +- .../order_confirmed/it/html consegnato.pug | 168 ------------------ emails/ecommerce/order_confirmed/it/html.pug | 7 +- emails/ecommerce/order_consegnato/it/html.pug | 7 +- logtrans.txt | 14 +- src/server/models/user.js | 9 + src/server/router/users_router.js | 2 + 8 files changed, 43 insertions(+), 178 deletions(-) delete mode 100755 emails/ecommerce/order_confirmed/it/html consegnato.pug diff --git a/.env.development b/.env.development index 5c92bba..82a8e8c 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/emails/ecommerce/makeorder/it/html.pug b/emails/ecommerce/makeorder/it/html.pug index 84fb48f..1ea49dc 100755 --- a/emails/ecommerce/makeorder/it/html.pug +++ b/emails/ecommerce/makeorder/it/html.pug @@ -76,9 +76,9 @@ html - var qty = rec.order.quantity - var qtypreordered = rec.order.quantitypreordered if (rec.order.product.productInfo.sfuso && rec.order.product.productInfo.weight) - qtypreordered = (qtypreordered * rec.order.product.productInfo.weight); - else - qtypreordered = qtypreordered + ' x ' + rec.order.product.productInfo.weight; + - qtypreordered = qtypreordered * rec.order.product.productInfo.weight + else if (rec.order.product.productInfo.weight) + - qtypreordered = qtypreordered + ' x ' + rec.order.product.productInfo.weight - var unit = rec.order.product.productInfo.unitstr - index = index + 1 @@ -92,7 +92,7 @@ html table(cellpadding="0", cellspacing="0", summary="", border="0") tr td - img(src=baseimg + img, alt="", width="150" height="150") + img(src=baseimg + img, alt="", width="150") td(class="column", valign="top") table(cellpadding="0", cellspacing="0", summary="", border="0") diff --git a/emails/ecommerce/order_confirmed/it/html consegnato.pug b/emails/ecommerce/order_confirmed/it/html consegnato.pug deleted file mode 100755 index b8b5e74..0000000 --- a/emails/ecommerce/order_confirmed/it/html consegnato.pug +++ /dev/null @@ -1,168 +0,0 @@ -doctype html -html - head - title Ordine n. #{ordernumber} Consegnato - - //- import css/scss stylesheets - //- these file names will be replace by gulp with proper css file paths - link(rel="stylesheet", href="../sass/basic.scss") - link(rel="stylesheet", href="../sass/one/styles.scss") - - //- embdedded css allowed, but not sass - style. - .red { - background-color: #E84C50; - } - - .full-width { - width: 100%; - } - - body(yahoofix, style="background: #ffffff") - - var baseimg = baseurl + '/'; - span(id='body_style', style='display:block') - table(cellpadding="10", cellspacing="0", width="600", align="center") - tr - td(class="whitespace", height="10") - p   - - if (orders.items && orders.items.length > 0) - - var mystorehouse = orders.items[0].order.storehouse - else - - var mystorehouse = null - - tr - td(class="emailContainer", valign="top") - - - var mioheader = mystorehouse.email_html_header - if (mioheader) - p!= mioheader - else - p Ciao #{name}, - - p L'ordine n. #{ordernumber} è stato Consegnato correttamente ! - - if (orders.items[0].order.quantitypreordered > 0) - - var miomakeorder = mystorehouse.email_html_GAS_order_consegnato - else - - var miomakeorder = mystorehouse.email_html_order_consegnato - - if (miomakeorder) - p!= miomakeorder - - - var totalPrice = orders.totalPrice - - var note = orders.note - - var index = 0 - - each rec in orders.items - - var descr = rec.order.product.productInfo.name - - var img = rec.order.product.productInfo.img - - var price = rec.order.product.price - - var after_price = rec.order.product.after_price - if (rec.order.gasordine) - - var gasordine = rec.order.gasordine.name - else - - var gasordine = '' - - var qty = rec.order.product.quantity - - var qtypreordered = rec.order.quantitypreordered - - var TotalPriceProduct = rec.order.TotalPriceProductstr - - index = index + 1 - - table(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center") - tr - td(class="column", valign="center" width="40") - p.boldhigh #{index}. - - td(class="column sectionArticleImage", valign="top" width="150") - table(cellpadding="0", cellspacing="0", summary="", border="0") - tr - td - img(src=baseimg + img, alt="", width="150" height="150") - td(class="column", valign="top") - - table(cellpadding="0", cellspacing="0", summary="", border="0") - if (qtypreordered > 0) - tr - td(class="sectionContent", valign="top") - p Gas Ordine: #{gasordine} - p   - tr - td(class="sectionContentTitle boldhigh", valign="top") - p #{descr} - tr - td(class="sectionContent", valign="top") - p Prezzo: #{price} € #{after_price} - if (qty > 0) - tr - td(class="sectionContent", valign="top") - p Quantità: #{qty} - if (qtypreordered > 0) - tr - td(class="sectionContent", valign="top") - p Quantità Prenotata: #{qtypreordered} - tr - td(class="sectionContent", valign="top") - p Totale: #{TotalPriceProduct} € - - if (note) - p Note Aggiuntive: #{note} - - p.sectionContentTitle.boldhigh.sectionTotal Totale Ordine: #{totalPrice} € - tr - td(class="whitespace", height="10") - - tr - td - - var miofooter = mystorehouse.email_html_footer - if (miofooter) - p!= miofooter - else - p Grazie Mille - - table.footer(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center") - tr - td(class="whitespace", height="10") - p   - tr - td.firma - p!= dataemail.firma - - tr - td.disclaimer - p!= dataemail.disclaimer_out - - tr - td.bottom - p!= dataemail.disc_bottom_out - - tr - td(class="whitespace", height="10") - p   - -style(type="text/css"). - html, body { - padding: 0; - margin: 0; - } - - p { - font-size: 1rem; - } - - - .divbtn { - display: flex; - align-items: center; - justify-content: center; - } - - .btn-lg { - padding: 5px; - margin: 5px; - font-size: 26px; - cursor: pointer; - color: white; - background: #027be3 !important; - border-radius: 28px; - - } diff --git a/emails/ecommerce/order_confirmed/it/html.pug b/emails/ecommerce/order_confirmed/it/html.pug index ba511b3..ab75787 100755 --- a/emails/ecommerce/order_confirmed/it/html.pug +++ b/emails/ecommerce/order_confirmed/it/html.pug @@ -71,6 +71,11 @@ html - var gasordine = '' - var qty = rec.order.product.quantity - var qtypreordered = rec.order.quantitypreordered + if (rec.order.product.productInfo.sfuso && rec.order.product.productInfo.weight) + - qtypreordered = qtypreordered * rec.order.product.productInfo.weight + else if (rec.order.product.productInfo.weight) + - qtypreordered = qtypreordered + ' x ' + rec.order.product.productInfo.weight + - var unit = rec.order.product.productInfo.unitstr - var TotalPriceProduct = rec.order.TotalPriceProductstr - index = index + 1 @@ -84,7 +89,7 @@ html table(cellpadding="0", cellspacing="0", summary="", border="0") tr td - img(src=baseimg + img, alt="", width="150" height="150") + img(src=baseimg + img, alt="", width="150") td(class="column", valign="top") table(cellpadding="0", cellspacing="0", summary="", border="0") diff --git a/emails/ecommerce/order_consegnato/it/html.pug b/emails/ecommerce/order_consegnato/it/html.pug index 964062b..127693f 100755 --- a/emails/ecommerce/order_consegnato/it/html.pug +++ b/emails/ecommerce/order_consegnato/it/html.pug @@ -70,6 +70,11 @@ html - var gasordine = '' - var qty = rec.order.product.quantity - var qtypreordered = rec.order.quantitypreordered + if (rec.order.product.productInfo.sfuso && rec.order.product.productInfo.weight) + - qtypreordered = qtypreordered * rec.order.product.productInfo.weight + else if (rec.order.product.productInfo.weight) + - qtypreordered = qtypreordered + ' x ' + rec.order.product.productInfo.weight + - var unit = rec.order.product.productInfo.unitstr - var TotalPriceProduct = rec.order.TotalPriceProductstr - index = index + 1 @@ -83,7 +88,7 @@ html table(cellpadding="0", cellspacing="0", summary="", border="0") tr td - img(src=baseimg + img, alt="", width="150" height="150") + img(src=baseimg + img, alt="", width="150") td(class="column", valign="top") table(cellpadding="0", cellspacing="0", summary="", border="0") diff --git a/logtrans.txt b/logtrans.txt index 3048212..6b7667f 100644 --- a/logtrans.txt +++ b/logtrans.txt @@ -164,4 +164,16 @@ SuryaArena: 14 RIS] Sab 17/02 ORE 15:03: [Circuito RIS Bologna]: Inviate Monete da paoloar77 a SuryaArena 2 RIS [causale: ] Saldi: paoloar77: 20 RIS] -SuryaArena: 16 RIS] \ No newline at end of file +SuryaArena: 16 RIS] +Gio 11/04 ORE 16:54: [Euro]: Inviate Monete da paoloar77 a piuchebuono 110 € [causale: Pagato Ordine n.236] +Saldi: +paoloar77: -246.8 €] +piuchebuono: 2181.0999999999985 €] +Gio 11/04 ORE 16:55: [Euro]: Inviate Monete da paoloar77 a piuchebuono 110 € [causale: Pagato Ordine n.235] +Saldi: +paoloar77: -356.8 €] +piuchebuono: 2291.0999999999985 €] +Gio 11/04 ORE 16:57: [Euro]: Inviate Monete da paoloar77 a piuchebuono 110 € [causale: Pagato Ordine n.234] +Saldi: +paoloar77: -466.8 €] +piuchebuono: 2401.0999999999985 €] \ No newline at end of file diff --git a/src/server/models/user.js b/src/server/models/user.js index e750e01..cfadfea 100755 --- a/src/server/models/user.js +++ b/src/server/models/user.js @@ -1661,6 +1661,15 @@ UserSchema.methods.removeToken = function (token) { }); }; +// # Rimuove tutti i tokens di tutti gli utenti con idapp +UserSchema.statics.SvuotaTuttiGliAccessiOnlineConToken = async function (idapp) { + const User = this; + + return await User.updateMany({ idapp }, + { $set: { tokens: [] } }); +}; + + UserSchema.statics.getEmailByUsername = async function (idapp, username) { const User = this; diff --git a/src/server/router/users_router.js b/src/server/router/users_router.js index e4b69bb..eb60262 100755 --- a/src/server/router/users_router.js +++ b/src/server/router/users_router.js @@ -1359,6 +1359,8 @@ async function eseguiDbOp(idapp, mydata, locale, req, res) { { $set: { news_on: true } }, { new: false }); + } else if (mydata.dbop === 'SvuotaTuttiGliAccessiOnlineConToken') { + await User.SvuotaTuttiGliAccessiOnlineConToken(idapp); } else if (mydata.dbop === 'removeRegulations') { await Circuit.updateMany({}, { $set: { regulation: '' } });