Bug #657 mandar una notificacion al comercial de un cliente falla
This commit is contained in:
parent
0f14bf9d27
commit
3fafadf5c8
|
@ -69,6 +69,8 @@ module.exports = function(Self) {
|
||||||
let ctx = {req: {accessToken: accessToken}};
|
let ctx = {req: {accessToken: accessToken}};
|
||||||
let insurance = await Self.findById(data.id, filter);
|
let insurance = await Self.findById(data.id, filter);
|
||||||
let customer = insurance.classification().customer();
|
let customer = insurance.classification().customer();
|
||||||
|
|
||||||
|
if (!customer.salesPerson()) return;
|
||||||
let salesPerson = customer.salesPerson().user().name;
|
let salesPerson = customer.salesPerson().user().name;
|
||||||
let grade = data.grade ? `(Grado ${data.grade})` : '(Sin grado)';
|
let grade = data.grade ? `(Grado ${data.grade})` : '(Sin grado)';
|
||||||
let message = {
|
let message = {
|
||||||
|
@ -78,7 +80,7 @@ module.exports = function(Self) {
|
||||||
Self.app.models.Message.send(salesPerson, message, ctx);
|
Self.app.models.Message.send(salesPerson, message, ctx);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update from transaction misses ctx accessToken.
|
// Update from transaction misses ctx accessToken.
|
||||||
// Fixed passing accessToken from method messageSend()
|
// Fixed passing accessToken from method messageSend()
|
||||||
Self.observe('after save', async function(ctx) {
|
Self.observe('after save', async function(ctx) {
|
||||||
if (ctx.options.accessToken)
|
if (ctx.options.accessToken)
|
||||||
|
|
Loading…
Reference in New Issue