From 2c79056f3464b4f526a72143567f948e7e4a831f Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 19 Jul 2023 13:44:04 +0200 Subject: [PATCH] refs #5976 error extended --- loopback/locale/en.json | 3 ++- loopback/locale/es.json | 2 +- modules/route/front/roadmap/index/index.js | 2 -- modules/ticket/back/methods/ticket/setDeleted.js | 4 ++-- modules/ticket/back/methods/ticket/transferSales.js | 12 ++++-------- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 030afbe9e..dde24ddc6 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -178,5 +178,6 @@ "The renew period has not been exceeded": "The renew period has not been exceeded", "You can not use the same password": "You can not use the same password", "Valid priorities": "Valid priorities: %d", - "Negative basis of tickets": "Negative basis of tickets: {{ticketsIds}}" + "Negative basis of tickets": "Negative basis of tickets: {{ticketsIds}}", + "This ticket cannot be left empty.": "This ticket cannot be left empty. %s" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 16b0af7f5..c12b980fa 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -306,5 +306,5 @@ "Valid priorities": "Prioridades válidas: %d", "Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}", "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado", - "This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %d" + "This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s" } diff --git a/modules/route/front/roadmap/index/index.js b/modules/route/front/roadmap/index/index.js index 3ffc5b4b1..c5f5ef9d1 100644 --- a/modules/route/front/roadmap/index/index.js +++ b/modules/route/front/roadmap/index/index.js @@ -46,8 +46,6 @@ class Controller extends Section { } deleteRoadmaps() { - console.log(this.checked); - for (const roadmap of this.checked) { this.$http.delete(`Roadmaps/${roadmap.id}`) .then(() => this.$.model.refresh()) diff --git a/modules/ticket/back/methods/ticket/setDeleted.js b/modules/ticket/back/methods/ticket/setDeleted.js index 46c0add6b..878cce056 100644 --- a/modules/ticket/back/methods/ticket/setDeleted.js +++ b/modules/ticket/back/methods/ticket/setDeleted.js @@ -41,8 +41,8 @@ module.exports = Self => { const isEditable = await Self.isEditable(ctx, id, myOptions); - throw new UserError(`The sales of this ticket can't be modified`); - // if (!isEditable) + if (!isEditable) + throw new UserError(`The sales of this ticket can't be modified`); // Check if ticket has refunds const ticketRefunds = await models.TicketRefund.find({ diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index 2e4bf023d..de52e2f18 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -79,9 +79,9 @@ module.exports = Self => { const saleIds = sales.map(sale => sale.id); - // const hasClaimedSales = await models.ClaimBeginning.findOne({where: {saleFk: {inq: saleIds}}}); - // if (ticketId != id && hasClaimedSales) - // throw new UserError(`Can't transfer claimed sales`); + const hasClaimedSales = await models.ClaimBeginning.findOne({where: {saleFk: {inq: saleIds}}}); + if (ticketId != id && hasClaimedSales) + throw new UserError(`Can't transfer claimed sales`); for (const sale of sales) { const originalSale = map.get(sale.id); @@ -101,14 +101,11 @@ module.exports = Self => { try { await models.Ticket.setDeleted(ctx, id, myOptions); } catch (e) { - console.log('e:', e); - console.log('e.message:', e.message); - console.log('e translation:', $t(e.message, {})); if (e.statusCode === 400) { throw new UserError( `This ticket cannot be left empty.`, 'TRANSFER_SET_DELETED', - $t(e.message) + $t(e.message, ...e.translateArgs) ); } throw e; @@ -120,7 +117,6 @@ module.exports = Self => { return {id: ticketId}; } catch (e) { if (tx) await tx.rollback(); - console.log('e.UserError:', e); throw e; } };