- aggiornato sistema per inviare le newsletter !

This commit is contained in:
Surya Paolo
2024-02-08 01:34:30 +01:00
parent 2151502d30
commit dacfc5a844
8 changed files with 223 additions and 85 deletions

View File

@@ -4044,6 +4044,26 @@ module.exports = {
return msg;
},
getUnsubsribeUrl(mylocalsconf) {
if (mylocalsconf) {
const baseurl = this.getHostByIdApp(mylocalsconf.idapp);
const urlunsibscribe = baseurl + '/unsubscribe?em=' + mylocalsconf.hashemail + '&mc=' + mylocalsconf.dataemail.mailchimpactive +
'&email=' + mylocalsconf.emailto;
return urlunsibscribe;
}
return '';
},
getUnsubsribeUrl_User(user) {
if (user && user.email) {
const hash = this.getHash(user.email + user.username);
return this.getHostByIdApp(user.idapp) + '/unsubscribe_user?em=' + hash + '&email=' + user.email;
}
return '';
},
async convertSpecialTags(user, msg) {
try {
if (!msg)
@@ -4060,6 +4080,9 @@ module.exports = {
msg = await this.checkStr(msg, '{time_exp_reg}', user, 1);
msg = msg.replace('{name}', user.name ? user.name : user.username);
msg = msg.replace('{surname}', user.surname ? user.surname : '');
let out = myvar.replace('{urlunsubscribe_user}', this.getUnsubsribeUrl_User(user));
msg = msg.replace('{aportador_solidario}', user.aportador_solidario ? user.aportador_solidario : '');
if (!!user.profile.link_payment)
msg = msg.replace('{link_paypalme}', user.profile.link_payment);
@@ -4413,7 +4436,7 @@ module.exports = {
getWeightAndUnitByText(text) {
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
@@ -4466,13 +4489,13 @@ module.exports = {
if (valstr === '' || valstr === undefined)
valstr = '0';
valstr = valstr + '';
valstr = valstr.replace(',', '.');
return parseFloat(valstr);
},
convertPriceEurToValue(inputString) {
inputString = this.removeescape(this.addslashes(inputString))
if (inputString === '')