feat: refs #7704 Fix
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-07-11 11:10:01 +02:00
parent 823756d71a
commit 2e48263636
1 changed files with 5 additions and 5 deletions

View File

@ -83,19 +83,19 @@ module.exports = Self => {
const [itemInfo] = await models.Sale.rawSql(`SELECT available FROM tmp.ticketCalculateItem`, null, ctx.options);
const available = itemInfo?.available;
// if ((!isReduction && !available) || available < quantityAdded)
// throw new UserError(`This item is not available`);
if ((!isReduction && !available) || available < quantityAdded)
throw new UserError(`This item is not available`);
if (await models.ACL.checkAccessAcl(ctx, 'Ticket', 'isRoleAdvanced', '*')) return;
const today = new Date();
const now = Date.vnNew();
const minQuantity = await models.ItemMinimumQuantity.findOne({
fields: ['quantity'],
where: {
itemFk: itemId,
started: {lte: today},
started: {lte: now},
or: [
{ended: {gte: today}},
{ended: {gte: now}},
{ended: null}
],
// eslint-disable-next-line no-dupe-keys