8179-testToMaster #3176
|
@ -85,16 +85,11 @@ module.exports = Self => {
|
|||
const updatedClaim = await claim.updateAttributes(args, myOptions);
|
||||
|
||||
const salesPerson = claim.client().salesPersonUser();
|
||||
if (salesPerson) {
|
||||
if (changedPickup && updatedClaim.pickup)
|
||||
await notifyPickUp(ctx, salesPerson.id, claim);
|
||||
|
||||
if (args.claimStateFk) {
|
||||
const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
|
||||
await notifyStateChange(ctx, salesPerson.id, claim, newState.description);
|
||||
if (newState.code == 'canceled')
|
||||
await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
|
||||
}
|
||||
if (salesPerson && args.claimStateFk) {
|
||||
const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
|
||||
await notifyStateChange(ctx, salesPerson.id, claim, newState.description);
|
||||
if (newState.code == 'canceled')
|
||||
await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
|
||||
}
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
@ -119,18 +114,4 @@ module.exports = Self => {
|
|||
});
|
||||
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