(- Booking not available if is in the past
- Delete record only if "Active Edit" is on - Image stretch width reduced. - Signin more dense) - Email also to Manager person - added "Reply-To" in the header of the email.
This commit is contained in:
@@ -29,13 +29,16 @@ function checkifSendEmail() {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
sendEmail_base: function (template, username, to, mylocalsconf) {
|
||||
sendEmail_base: function (template, username, to, mylocalsconf, replyTo) {
|
||||
|
||||
// console.log("check EMAIL :" + checkifSendEmail());
|
||||
|
||||
const email = new Email({
|
||||
message: {
|
||||
from: process.env.EMAIL_FROM, // sender address
|
||||
headers: {
|
||||
'Reply-To': replyTo
|
||||
}
|
||||
},
|
||||
send: checkifSendEmail(),
|
||||
preview: !checkifSendEmail(),
|
||||
@@ -48,6 +51,7 @@ module.exports = {
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
email
|
||||
.send({
|
||||
template: template,
|
||||
@@ -60,7 +64,7 @@ module.exports = {
|
||||
.catch(console.error);
|
||||
},
|
||||
|
||||
sendEmail_Normale: function (to, subject, html) {
|
||||
sendEmail_Normale: function (to, subject, html, replyTo) {
|
||||
|
||||
// setup e-mail data with unicode symbols
|
||||
var mailOptions = {
|
||||
@@ -71,6 +75,9 @@ module.exports = {
|
||||
html: html,
|
||||
};
|
||||
|
||||
if (replyTo)
|
||||
mailOptions['reply-to'] = replyTo;
|
||||
|
||||
if (process.env.SEND_EMAIL === 1) {
|
||||
console.log("SEND EMAIL smtpTransport");
|
||||
// send mail with defined transport object
|
||||
@@ -88,21 +95,21 @@ module.exports = {
|
||||
transport_preview.sendMail(mailOptions).then(console.log).catch(console.error);
|
||||
}
|
||||
},
|
||||
getHostByIdApp: function (idapp) {
|
||||
if (idapp === 1) {
|
||||
let siteport = (process.env.PORT_APP1 !== "0") ? (':' + process.env.PORT_APP1) : "";
|
||||
return process.env.URLBASE_APP1 + siteport;
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
},
|
||||
// getHostByIdApp: function (idapp) {
|
||||
// if (idapp === 1) {
|
||||
// let siteport = (process.env.PORT_APP1 !== "0") ? (':' + process.env.PORT_APP1) : "";
|
||||
// return process.env.URLBASE_APP1 + siteport;
|
||||
// } else {
|
||||
// return ""
|
||||
// }
|
||||
// },
|
||||
|
||||
getlinkReg: function (idapp, idreg) {
|
||||
strlinkreg = this.getHostByIdApp(idapp) + process.env.LINKVERIF_REG + `?idapp=${idapp}&idlink=${idreg}`;
|
||||
strlinkreg = tools.getHostByIdApp(idapp) + process.env.LINKVERIF_REG + `?idapp=${idapp}&idlink=${idreg}`;
|
||||
return strlinkreg;
|
||||
},
|
||||
getlinkRequestNewPassword: function (idapp, user, tokenforgot) {
|
||||
strlinkreg = this.getHostByIdApp(idapp) + "/#" + process.env.LINK_REQUEST_NEWPASSWORD + `?idapp=${idapp}&username=${user}&=tokenforgot=${tokenforgot}`;
|
||||
strlinkreg = tools.getHostByIdApp(idapp) + "/#" + process.env.LINK_REQUEST_NEWPASSWORD + `?idapp=${idapp}&username=${user}&=tokenforgot=${tokenforgot}`;
|
||||
return strlinkreg;
|
||||
},
|
||||
sendEmail_Registration: function (lang, emailto, user, idapp, idreg) {
|
||||
@@ -120,10 +127,14 @@ module.exports = {
|
||||
emailto: emailto,
|
||||
};
|
||||
|
||||
this.sendEmail_base('registration/' + lang, user, emailto, mylocalsconf);
|
||||
this.sendEmail_base('registration/' + lang, user, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
|
||||
|
||||
// Send to the Admin an Email
|
||||
this.sendEmail_base('admin/registration/' + lang, user, tools.getAdminEmailByIdApp(idapp), mylocalsconf);
|
||||
this.sendEmail_base('admin/registration/' + lang, user, tools.getAdminEmailByIdApp(idapp), mylocalsconf, '');
|
||||
|
||||
if (tools.getManagerEmailByIdApp(idapp) !== '' && tools.isManagAndAdminDifferent(idapp)) {
|
||||
this.sendEmail_base('admin/registration/' + lang, user, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
||||
}
|
||||
},
|
||||
sendEmail_RequestNewPassword: function (lang, emailto, idapp, tokenforgot) {
|
||||
|
||||
@@ -135,7 +146,7 @@ module.exports = {
|
||||
emailto: emailto,
|
||||
};
|
||||
|
||||
this.sendEmail_base('resetpwd/' + lang, user, emailto, mylocalsconf);
|
||||
this.sendEmail_base('resetpwd/' + lang, user, emailto, mylocalsconf, '');
|
||||
},
|
||||
|
||||
sendEmail_Booking: function (res, lang, emailto, user, idapp, recbooking) {
|
||||
@@ -165,10 +176,15 @@ module.exports = {
|
||||
texthtml = 'makebooking';
|
||||
}
|
||||
|
||||
this.sendEmail_base('booking/'+texthtml+'/' + lang, user, emailto, mylocalsconf);
|
||||
this.sendEmail_base('booking/'+texthtml+'/' + lang, user, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
|
||||
|
||||
// Send Email also to the Admin
|
||||
this.sendEmail_base('admin/'+texthtml+'/' + lang, user, tools.getAdminEmailByIdApp(idapp), mylocalsconf);
|
||||
this.sendEmail_base('admin/'+texthtml+'/' + lang, user, tools.getAdminEmailByIdApp(idapp), mylocalsconf, '');
|
||||
|
||||
if (tools.getManagerEmailByIdApp(idapp) !== '' && tools.isManagAndAdminDifferent(idapp)) {
|
||||
this.sendEmail_base('admin/'+texthtml+'/' + lang, user, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
sendEmail_CancelBooking: function (res, lang, emailto, user, idapp, recbooking) {
|
||||
@@ -189,10 +205,14 @@ module.exports = {
|
||||
if (recbooking.numpeople > 1)
|
||||
mylocalsconf.participants = recbooking.numpeople.toString() + ' ' + res.__("partecipanti");
|
||||
|
||||
this.sendEmail_base('booking/cancelbooking/' + lang, user, emailto, mylocalsconf);
|
||||
this.sendEmail_base('booking/cancelbooking/' + lang, user, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
|
||||
|
||||
// Send Email also to the Admin
|
||||
this.sendEmail_base('admin/cancelbooking/' + lang, user, tools.getAdminEmailByIdApp(idapp), mylocalsconf);
|
||||
this.sendEmail_base('admin/cancelbooking/' + lang, user, tools.getAdminEmailByIdApp(idapp), mylocalsconf, '');
|
||||
|
||||
if (tools.getManagerEmailByIdApp(idapp) !== '' && tools.isManagAndAdminDifferent(idapp)) {
|
||||
this.sendEmail_base('admin/cancelbooking/' + lang, user, tools.getManagerEmailByIdApp(idapp), mylocalsconf, '');
|
||||
}
|
||||
},
|
||||
|
||||
sendEmail_Msg: function (res, lang, emailto, user, idapp, recbooking) {
|
||||
@@ -211,8 +231,8 @@ module.exports = {
|
||||
event: recbooking.infoevent,
|
||||
};
|
||||
|
||||
this.sendEmail_base('msg/sendmsg/' + lang, user, emailto, mylocalsconf);
|
||||
|
||||
this.sendEmail_base('msg/sendmsg/' + lang, user, emailto, mylocalsconf, tools.getreplyToEmailByIdApp(idapp));
|
||||
|
||||
// Send Email also to the Admin
|
||||
// this.sendEmail_base('admin/sendmsg/' + lang, user, tools.getAdminEmailByIdApp(idapp), mylocalsconf);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user