From 7b61e129ffd63448e899494f843988a913a39b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Thu, 9 Jul 2020 13:24:56 +0200 Subject: [PATCH] HOTFIX: Change claim claimed quantity --- modules/claim/back/models/claim-beginning.js | 3 ++- modules/claim/front/detail/index.js | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/modules/claim/back/models/claim-beginning.js b/modules/claim/back/models/claim-beginning.js index 19e5eb4eb..681aaebc7 100644 --- a/modules/claim/back/models/claim-beginning.js +++ b/modules/claim/back/models/claim-beginning.js @@ -22,7 +22,8 @@ module.exports = Self => { async function claimIsEditable(ctx) { const loopBackContext = LoopBackContext.getCurrentContext(); 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) throw new UserError(`The current claim can't be modified`); diff --git a/modules/claim/front/detail/index.js b/modules/claim/front/detail/index.js index 7719a9fc9..c97f3bd47 100644 --- a/modules/claim/front/detail/index.js +++ b/modules/claim/front/detail/index.js @@ -22,16 +22,25 @@ class Controller extends Section { }; } - set salesClaimed(value) { - this._salesClaimed = value; + get claim() { + return this._claim; + } + + set claim(value) { + this._claim = value; if (value) { - this.calculateTotals(); this.isClaimEditable(); this.isTicketEditable(); } } + set salesClaimed(value) { + this._salesClaimed = value; + + if (value) this.calculateTotals(); + } + get salesClaimed() { return this._salesClaimed; }