From b6420b639c6374be54c73892909aa2f6a2743cbb Mon Sep 17 00:00:00 2001 From: ivanm Date: Sun, 22 Sep 2024 08:12:59 +0200 Subject: [PATCH 1/2] feat: refs #7880 modify hedera.order_confirmWithUser --- .../hedera/procedures/order_confirmWithUser.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/db/routines/hedera/procedures/order_confirmWithUser.sql b/db/routines/hedera/procedures/order_confirmWithUser.sql index 2b033b704..f9280d4d3 100644 --- a/db/routines/hedera/procedures/order_confirmWithUser.sql +++ b/db/routines/hedera/procedures/order_confirmWithUser.sql @@ -111,6 +111,16 @@ BEGIN CALL util.throw('ORDER_EMPTY'); END IF; + -- Check if any product has a quantity of 0 + SELECT COUNT(*) INTO vHasRows + FROM orderRow + WHERE orderFk = vSelf + AND amount = 0; + + IF vHasRows THEN + CALL util.throw('Remove lines with quantity = 0 before confirming'); + END IF; + -- Crea los tickets del pedido OPEN vDates; lDates: LOOP -- 2.40.1 From d43f96096383ecca8dbf1d345c6edf6ceeebbc78 Mon Sep 17 00:00:00 2001 From: ivanm Date: Tue, 8 Oct 2024 17:31:47 +0200 Subject: [PATCH 2/2] feat: refs #7880 requested modifications and translations --- .../hedera/procedures/order_confirmWithUser.sql | 7 ++++--- db/versions/11293-brownHydrangea/00-firstScript.sql | 11 +++++++++++ loopback/locale/en.json | 3 ++- loopback/locale/es.json | 3 ++- loopback/locale/fr.json | 6 +++--- loopback/locale/pt.json | 4 ++-- 6 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 db/versions/11293-brownHydrangea/00-firstScript.sql diff --git a/db/routines/hedera/procedures/order_confirmWithUser.sql b/db/routines/hedera/procedures/order_confirmWithUser.sql index f9280d4d3..c09baf4b3 100644 --- a/db/routines/hedera/procedures/order_confirmWithUser.sql +++ b/db/routines/hedera/procedures/order_confirmWithUser.sql @@ -12,6 +12,7 @@ BEGIN * @param vUser The user identifier */ DECLARE vHasRows BOOL; + DECLARE vHasZeroRows BOOL; DECLARE vDone BOOL; DECLARE vWarehouseFk INT; DECLARE vShipment DATE; @@ -112,13 +113,13 @@ BEGIN END IF; -- Check if any product has a quantity of 0 - SELECT COUNT(*) INTO vHasRows + SELECT COUNT(*) INTO vHasZeroRows FROM orderRow WHERE orderFk = vSelf AND amount = 0; - IF vHasRows THEN - CALL util.throw('Remove lines with quantity = 0 before confirming'); + IF vHasZeroRows THEN + CALL util.throw('orderLinesWithZero'); END IF; -- Crea los tickets del pedido diff --git a/db/versions/11293-brownHydrangea/00-firstScript.sql b/db/versions/11293-brownHydrangea/00-firstScript.sql new file mode 100644 index 000000000..8c97db0fc --- /dev/null +++ b/db/versions/11293-brownHydrangea/00-firstScript.sql @@ -0,0 +1,11 @@ +INSERT INTO hedera.message(code, description) + VALUES ('orderLinesWithZero','Remove lines with quantity 0 before confirming'); + +INSERT INTO hedera.messageI18n(code, lang, description) + VALUES ('orderLinesWithZero','es','Eliminar líneas con cantidad 0 antes de confirmar'); + +INSERT INTO hedera.messageI18n(code, lang, description) + VALUES ('orderLinesWithZero','fr','Supprimer les lignes avec la quantité 0 avant de confirmer'); + +INSERT INTO hedera.messageI18n(code, lang, description) + VALUES ('orderLinesWithZero','pt','Remova as linhas com quantidade 0 antes de confirmar'); \ No newline at end of file diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 352e08826..251628c56 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -240,5 +240,6 @@ "The height must be greater than 50cm": "The height must be greater than 50cm", "The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm", "This postcode already exists": "This postcode already exists", - "This buyer has already made a reservation for this date": "This buyer has already made a reservation for this date" + "This buyer has already made a reservation for this date": "This buyer has already made a reservation for this date", + "orderLinesWithZero": "Remove lines with quantity 0 before confirming" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 49c44a4d8..1b2d9c76b 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -378,5 +378,6 @@ "The maximum height of the wagon is 200cm": "La altura máxima es 200cm", "The entry does not have stickers": "La entrada no tiene etiquetas", "Too many records": "Demasiados registros", - "This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha" + "This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha", + "orderLinesWithZero": "Eliminar líneas con cantidad 0 antes de confirmar" } \ No newline at end of file diff --git a/loopback/locale/fr.json b/loopback/locale/fr.json index 601fe35f5..1e8cbefba 100644 --- a/loopback/locale/fr.json +++ b/loopback/locale/fr.json @@ -123,7 +123,7 @@ "Added sale to ticket": "J'ai ajouté la ligne suivante au ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}", "Changed sale discount": "J'ai changé le rabais des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", "Created claim": "J'ai créé la réclamation [{{claimId}}]({{{claimUrl}}}) des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Changed sale price": " le prix de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* du ticket [{{ticketId}}]({{{ticketUrl}}})",, + "Changed sale price": " le prix de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* du ticket [{{ticketId}}]({{{ticketUrl}}})", "Changed sale quantity": "J'ai changé {{changes}} du ticket [{{ticketId}}]({{{ticketUrl}}})", "Changes in sales": "la quantité de {{itemId}} {{concept}} de {{oldQuantity}} ➔ {{newQuantity}}", "State": "État", @@ -361,6 +361,6 @@ "The invoices have been created but the PDFs could not be generated": "La facture a été émise mais le PDF n'a pas pu être généré", "It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré", "Cannot send mail": "Impossible d'envoyer le mail", - "Original invoice not found": "Facture originale introuvable" - + "Original invoice not found": "Facture originale introuvable", + "orderLinesWithZero": "Supprimer les lignes avec la quantité 0 avant de confirmer" } diff --git a/loopback/locale/pt.json b/loopback/locale/pt.json index 6425db9ed..fa70f06e8 100644 --- a/loopback/locale/pt.json +++ b/loopback/locale/pt.json @@ -360,6 +360,6 @@ "It was not able to create the invoice": "Não foi possível criar a fatura", "The invoices have been created but the PDFs could not be generated": "Foi faturado, mas o PDF não pôde ser gerado", "It has been invoiced but the PDF of refund not be generated": "Foi faturado mas não foi gerado o PDF do reembolso", - "Original invoice not found": "Fatura original não encontrada" - + "Original invoice not found": "Fatura original não encontrada", + "orderLinesWithZero": "Remova as linhas com quantidade 0 antes de confirmar" } -- 2.40.1