7525-devToTest #2542
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue