HOTFIX: Change claim claimed quantity
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2020-07-09 13:24:56 +02:00
parent 3a8d5c192c
commit 7b61e129ff
2 changed files with 14 additions and 4 deletions

View File

@ -22,7 +22,8 @@ module.exports = Self => {
async function claimIsEditable(ctx) { async function claimIsEditable(ctx) {
const loopBackContext = LoopBackContext.getCurrentContext(); const loopBackContext = LoopBackContext.getCurrentContext();
const httpCtx = {req: loopBackContext.active}; const httpCtx = {req: loopBackContext.active};
const isEditable = await Self.app.models.Claim.isEditable(httpCtx, ctx.where.id); const claimBeginning = await Self.findById(ctx.where.id);
const isEditable = await Self.app.models.Claim.isEditable(httpCtx, claimBeginning.claimFk);
if (!isEditable) if (!isEditable)
throw new UserError(`The current claim can't be modified`); throw new UserError(`The current claim can't be modified`);

View File

@ -22,16 +22,25 @@ class Controller extends Section {
}; };
} }
set salesClaimed(value) { get claim() {
this._salesClaimed = value; return this._claim;
}
set claim(value) {
this._claim = value;
if (value) { if (value) {
this.calculateTotals();
this.isClaimEditable(); this.isClaimEditable();
this.isTicketEditable(); this.isTicketEditable();
} }
} }
set salesClaimed(value) {
this._salesClaimed = value;
if (value) this.calculateTotals();
}
get salesClaimed() { get salesClaimed() {
return this._salesClaimed; return this._salesClaimed;
} }