From 6c00efae895790e83d0541bf6212215c3c0b3e30 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Sun, 17 Nov 2024 17:57:54 +0100 Subject: [PATCH 1/2] feat: refs #7289 #7289 apply option 1 --- loopback/locale/en.json | 4 +++- loopback/locale/es.json | 6 ++++-- modules/ticket/back/methods/ticket/transferSales.js | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 95f6ff326..86ebebc89 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -244,5 +244,7 @@ "Invalid or expired verification code": "Invalid or expired verification code", "There are tickets for this area, delete them first": "There are tickets for this area, delete them first", "ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}", - "Payment method is required": "Payment method is required" + "Payment method is required": "Payment method is required", + "Sales already moved": "Sales already moved" + } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 37976c0ea..a68fcc4e4 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -387,5 +387,7 @@ "There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero", "There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén", "ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}", - "The web user's email already exists": "El correo del usuario web ya existe" -} \ No newline at end of file + "The web user's email already exists": "El correo del usuario web ya existe", + "Sales already moved": "Ya han sido transferidas", + "Línea ya ha sido transferida": "Línea ya ha sido transferida" +} diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index 5f5fdde67..bc3c467d7 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -80,6 +80,9 @@ module.exports = Self => { const hasClaimedSales = await models.ClaimBeginning.findOne({where: {saleFk: {inq: saleIds}}}); if (ticketId != id && hasClaimedSales) throw new UserError(`Can't transfer claimed sales`); + const missingSales = sales.some(({id}) => !map.has(id)); + if (missingSales) + throw new UserError($t('Sales already moved')); for (const sale of sales) { const originalSale = map.get(sale.id); From 9558d030ff8baa3b1d2a81af61f5b5e692fc4199 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 18 Nov 2024 10:10:30 +0100 Subject: [PATCH 2/2] feat: refs #7289 #7289 remove bad translation --- loopback/locale/es.json | 3 +-- modules/ticket/back/methods/ticket/transferSales.js | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index a68fcc4e4..8bf9f31c4 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -388,6 +388,5 @@ "There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén", "ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}", "The web user's email already exists": "El correo del usuario web ya existe", - "Sales already moved": "Ya han sido transferidas", - "Línea ya ha sido transferida": "Línea ya ha sido transferida" + "Sales already moved": "Ya han sido transferidas" } diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index bc3c467d7..580a8e1f7 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -80,6 +80,7 @@ module.exports = Self => { const hasClaimedSales = await models.ClaimBeginning.findOne({where: {saleFk: {inq: saleIds}}}); if (ticketId != id && hasClaimedSales) throw new UserError(`Can't transfer claimed sales`); + const missingSales = sales.some(({id}) => !map.has(id)); if (missingSales) throw new UserError($t('Sales already moved'));