7525-devToTest #2542
|
@ -68,7 +68,6 @@ module.exports = Self => {
|
|||
fields: ['family', 'minQuantity'],
|
||||
where: {id: itemId},
|
||||
}, ctx.options);
|
||||
|
||||
if (item.family == 'EMB') 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;
|
||||
|
||||
// WIP: Check if is owner
|
||||
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)
|
||||
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