fix: refs #6850 remove notifyPickUp #3132
|
@ -85,17 +85,12 @@ module.exports = Self => {
|
||||||
const updatedClaim = await claim.updateAttributes(args, myOptions);
|
const updatedClaim = await claim.updateAttributes(args, myOptions);
|
||||||
|
|
||||||
const salesPerson = claim.client().salesPersonUser();
|
const salesPerson = claim.client().salesPersonUser();
|
||||||
if (salesPerson) {
|
if (salesPerson && args.claimStateFk) {
|
||||||
if (changedPickup && updatedClaim.pickup)
|
|
||||||
await notifyPickUp(ctx, salesPerson.id, claim);
|
|
||||||
|
|
||||||
if (args.claimStateFk) {
|
|
||||||
const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
|
const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
|
||||||
await notifyStateChange(ctx, salesPerson.id, claim, newState.description);
|
await notifyStateChange(ctx, salesPerson.id, claim, newState.description);
|
||||||
if (newState.code == 'canceled')
|
if (newState.code == 'canceled')
|
||||||
await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
|
await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
|
@ -119,18 +114,4 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
await models.Chat.sendCheckingPresence(ctx, workerId, message);
|
await models.Chat.sendCheckingPresence(ctx, workerId, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function notifyPickUp(ctx, workerId, claim) {
|
|
||||||
const models = Self.app.models;
|
|
||||||
const url = await models.Url.getUrl();
|
|
||||||
const $t = ctx.req.__; // $translate
|
|
||||||
|
|
||||||
const message = $t('Claim will be picked', {
|
|
||||||
claimId: claim.id,
|
|
||||||
clientName: claim.client().name,
|
|
||||||
claimUrl: `${url}claim/${claim.id}/summary`,
|
|
||||||
claimPickup: $t(claim.pickup)
|
|
||||||
});
|
|
||||||
await models.Chat.sendCheckingPresence(ctx, workerId, message);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue