refs #6199 fix(sale_quantity): add isReduction
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
cf856a585b
commit
247aa5af2a
|
@ -81,13 +81,14 @@ module.exports = Self => {
|
|||
ctx.options);
|
||||
|
||||
const [itemInfo] = await models.Sale.rawSql(`SELECT available FROM tmp.ticketCalculateItem`, null, ctx.options);
|
||||
const available = itemInfo?.available;
|
||||
|
||||
if ((!isReduction && !itemInfo?.available) || itemInfo.available < quantityAdded)
|
||||
if ((!isReduction && !available) || available < quantityAdded)
|
||||
throw new UserError(`This item is not available`);
|
||||
|
||||
if (await models.ACL.checkAccessAcl(ctx, 'Ticket', 'isRoleAdvanced', '*')) return;
|
||||
|
||||
if (newQuantity < item.minQuantity && newQuantity != itemInfo?.available)
|
||||
if (newQuantity < item.minQuantity && newQuantity != available)
|
||||
throw new UserError('The amount cannot be less than the minimum');
|
||||
|
||||
if (ctx.isNewInstance || isReduction) return;
|
||||
|
|
Loading…
Reference in New Issue