Merge pull request '3449-client check businesTypeFk before clientCredit insert' (#832) from 3449-client_credit into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #832 Reviewed-by: Carlos Jimenez Ruiz <carlosjr@verdnatura.es>
This commit is contained in:
commit
48e22f7762
|
@ -374,11 +374,14 @@ module.exports = Self => {
|
|||
throw new UserError(`You don't have enough privileges to set this credit amount`);
|
||||
}
|
||||
|
||||
await models.ClientCredit.create({
|
||||
amount: changes.credit,
|
||||
clientFk: finalState.id,
|
||||
workerFk: userId
|
||||
}, ctx.options);
|
||||
const client = await models.Client.findById(finalState.id, null, ctx.options);
|
||||
if (client.businessTypeFk) {
|
||||
await models.ClientCredit.create({
|
||||
amount: changes.credit,
|
||||
clientFk: finalState.id,
|
||||
workerFk: userId
|
||||
}, ctx.options);
|
||||
}
|
||||
};
|
||||
|
||||
const app = require('vn-loopback/server/server');
|
||||
|
|
Loading…
Reference in New Issue