7525-devToTest #2542

Merged
alexm merged 231 commits from 7525-devToTest into test 2024-06-04 07:59:34 +00:00
1 changed files with 1 additions and 11 deletions
Showing only changes of commit fc606f7e36 - Show all commits

View File

@ -68,7 +68,6 @@ module.exports = Self => {
fields: ['family', 'minQuantity'], fields: ['family', 'minQuantity'],
where: {id: itemId}, where: {id: itemId},
}, ctx.options); }, ctx.options);
if (item.family == 'EMB') return; if (item.family == 'EMB') return;
if (await models.ACL.checkAccessAcl(ctx, 'Sale', 'isInPreparing', '*')) return; if (await models.ACL.checkAccessAcl(ctx, 'Sale', 'isInPreparing', '*')) return;
@ -89,16 +88,7 @@ module.exports = Self => {
if (await models.ACL.checkAccessAcl(ctx, 'Ticket', 'isRoleAdvanced', '*')) return; if (await models.ACL.checkAccessAcl(ctx, 'Ticket', 'isRoleAdvanced', '*')) return;
// WIP: Check if is owner if (newQuantity < item.minQuantity && newQuantity != available)
const ticketCollection = await models.TicketCollection.findOne({
include: {relation: 'collection', fields: ['workerFk']},
where: {ticketFk: ticketId}
}, ctx.options);
// if(!res) look in SaleGroup.(ask for Sergio to make fixtures for this case)
const isOwner = res.collection.workerFk === ctx.req.accessToken.userId;
if (newQuantity < item.minQuantity && newQuantity != available && !isOwner)
throw new UserError('The amount cannot be less than the minimum'); throw new UserError('The amount cannot be less than the minimum');
if (ctx.isNewInstance || isReduction) return; if (ctx.isNewInstance || isReduction) return;