diff --git a/db/changes/233001/00-setDeleted_acl.sql b/db/changes/233001/00-setDeleted_acl.sql new file mode 100644 index 000000000..1030965dd --- /dev/null +++ b/db/changes/233001/00-setDeleted_acl.sql @@ -0,0 +1,6 @@ +UPDATE `salix`.`ACL` + SET principalId='salesperson' + WHERE + model='Ticket' + AND property='setDeleted' + AND accessType='WRITE'; diff --git a/modules/ticket/back/methods/ticket/specs/transferSales.spec.js b/modules/ticket/back/methods/ticket/specs/transferSales.spec.js index 562688917..61c788b64 100644 --- a/modules/ticket/back/methods/ticket/specs/transferSales.spec.js +++ b/modules/ticket/back/methods/ticket/specs/transferSales.spec.js @@ -5,6 +5,8 @@ describe('sale transferSales()', () => { const userId = 1101; const activeCtx = { accessToken: {userId: userId}, + headers: {origin: ''}, + __: value => value }; const ctx = {req: activeCtx}; diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index 0eee50d5f..00fc02f38 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -96,11 +96,8 @@ module.exports = Self => { } const isTicketEmpty = await models.Ticket.isEmpty(id, myOptions); - if (isTicketEmpty) { - await originalTicket.updateAttributes({ - isDeleted: true - }, myOptions); - } + if (isTicketEmpty) + await models.Ticket.setDeleted(ctx, id, myOptions); if (tx) await tx.commit();