fix: refs #6850 remove notifyPickUp #3132

Merged
carlossa merged 5 commits from 6850-removeChandgeUpdateClaim into dev 2024-10-21 12:31:32 +00:00
1 changed files with 5 additions and 24 deletions

View File

@ -85,16 +85,11 @@ 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) const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
await notifyPickUp(ctx, salesPerson.id, claim); await notifyStateChange(ctx, salesPerson.id, claim, newState.description);
if (newState.code == 'canceled')
if (args.claimStateFk) { await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
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(); 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);
}
}; };