diff --git a/loopback/locale/en.json b/loopback/locale/en.json
index f9fe40488..1e0607813 100644
--- a/loopback/locale/en.json
+++ b/loopback/locale/en.json
@@ -59,7 +59,7 @@
"Swift / BIC can't be empty": "Swift / BIC can't be empty",
"Bought units from buy request": "Bought {{quantity}} units of {{concept}} [{{itemId}}]({{{urlItem}}}) for the ticket id [{{ticketId}}]({{{url}}})",
"MESSAGE_INSURANCE_CHANGE": "I have changed the insurence credit of client [{{clientName}} ({{clientId}})]({{{url}}}) to *{{credit}} €*",
- "MESSAGE_CHANGED_PAYMETHOD": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})",
+ "Changed client paymethod": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})",
"Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})",
"Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked",
"Claim state has changed to incomplete": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *incomplete*",
diff --git a/loopback/locale/es.json b/loopback/locale/es.json
index b11365577..cef64b43a 100644
--- a/loopback/locale/es.json
+++ b/loopback/locale/es.json
@@ -123,7 +123,7 @@
"Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios",
"Bought units from buy request": "Se ha comprado {{quantity}} unidades de {{concept}} [{{itemId}}]({{{urlItem}}}) para el ticket id [{{ticketId}}]({{{url}}})",
"MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*",
- "MESSAGE_CHANGED_PAYMETHOD": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
+ "Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
"Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})",
"Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*",
"Claim state has changed to incomplete": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *incompleta*",
diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js
index e1de363b2..035074210 100644
--- a/modules/client/back/models/client.js
+++ b/modules/client/back/models/client.js
@@ -253,25 +253,28 @@ module.exports = Self => {
const salesPersonId = instance.salesPersonFk;
if (salesPersonId) {
+ // Send email to client
+ if (instance.email) {
+ const worker = await models.EmailUser.findById(salesPersonId);
+ const params = {
+ authorization: authorization,
+ recipientId: instance.id,
+ recipient: instance.email,
+ replyTo: worker.email
+ };
+ await got.get(`${origin}/api/email/payment-update`, {
+ query: params
+ });
+ }
+
const fullUrl = `${origin}/#!/client/${instance.id}/billing-data`;
- const message = $t('MESSAGE_CHANGED_PAYMETHOD', {
+ const message = $t('Changed client paymethod', {
clientId: instance.id,
clientName: instance.name,
url: fullUrl
});
await models.Chat.sendCheckingPresence(httpCtx, salesPersonId, message);
}
-
- // Send email to client
- if (!instance.email) return;
- const params = {
- authorization: authorization,
- recipientId: instance.id,
- recipient: instance.email
- };
- await got.get(`${origin}/api/email/payment-update`, {
- query: params
- });
}
const workerIdBefore = oldInstance.salesPersonFk;
diff --git a/modules/client/front/sample/create/index.html b/modules/client/front/sample/create/index.html
index f941e885a..e6733a656 100644
--- a/modules/client/front/sample/create/index.html
+++ b/modules/client/front/sample/create/index.html
@@ -32,6 +32,13 @@
info="Its only used when sample is sent">
+
+
+
+
{
+ const [worker] = res && res.data;
+ this.clientSample.replyTo = worker.email;
+ });
+ }
}
+
Controller.$inject = ['$element', '$scope'];
ngModule.vnComponent('vnClientSampleCreate', {