feat: refs #7704 Major changes #2717

Merged
guillermo merged 18 commits from 7704-itemMinimalQuantity into dev 2024-07-12 07:43:46 +00:00
1 changed files with 5 additions and 5 deletions
Showing only changes of commit 2e48263636 - Show all commits

View File

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

ticket .shipped

ticket .shipped
or: [ or: [
{ended: {gte: today}}, {ended: {gte: now}},
{ended: null} {ended: null}
], ],
// eslint-disable-next-line no-dupe-keys // eslint-disable-next-line no-dupe-keys