refs #6915 test_master24_8 #2067

Merged
alexm merged 561 commits from test_master24_8 into master 2024-02-22 07:31:34 +00:00
3 changed files with 9 additions and 6 deletions
Showing only changes of commit e0de498f65 - Show all commits

View File

@ -206,5 +206,6 @@
"Incorrect pin": "Incorrect pin.",
"The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified",
"Name should be uppercase": "Name should be uppercase",
"You cannot update these fields": "You cannot update these fields"
"You cannot update these fields": "You cannot update these fields",
"CountryFK cannot be empty": "CountryFK cannot be empty"
}

View File

@ -340,5 +340,6 @@
"Name should be uppercase": "El nombre debe ir en mayúscula",
"Bank entity must be specified": "La entidad bancaria es obligatoria",
"An email is necessary": "Es necesario un email",
"You cannot update these fields": "No puedes actualizar estos campos"
"You cannot update these fields": "No puedes actualizar estos campos",
"CountryFK cannot be empty": "CountryFK cannot be empty"
}

View File

@ -1,3 +1,4 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('driverRouteEmail', {
description: 'Sends the driver route email with an attached PDF',
@ -47,10 +48,10 @@ module.exports = Self => {
account = await models.Account.findById(workerFk);
}
if (user?.active && !account) ctx.args.recipient = reportMail;
else if (user?.active && account) ctx.args.recipient = user.emailUser().email;
else // throws an error?
if (user?.active && account) ctx.args.recipient = user.emailUser().email;
else ctx.args.recipient = reportMail;
Self.sendTemplate(ctx, 'driver-route');
if (!ctx.args.recipient) throw new UserError('An email is necessary');
Self.sendTemplate(ctx, 'driver-route');
};
};