From 37fabc38bd99da9b6d8755fc59306424586b1cb2 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 6 Sep 2024 14:56:14 +0200 Subject: [PATCH] fix(hedera): refs #7931 PROC order_addItem NULL available fix, translations added --- .../hedera/procedures/order_addItem.sql | 6 +++++- .../11217-greenDracena/00-hederaMessages.sql | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 db/versions/11217-greenDracena/00-hederaMessages.sql diff --git a/db/routines/hedera/procedures/order_addItem.sql b/db/routines/hedera/procedures/order_addItem.sql index 204dcb6bf..1470ddf35 100644 --- a/db/routines/hedera/procedures/order_addItem.sql +++ b/db/routines/hedera/procedures/order_addItem.sql @@ -47,11 +47,15 @@ BEGIN FROM tmp.zoneGetShipped WHERE warehouseFk = vWarehouse; - SELECT IFNULL(available, 0) INTO vAvailable + SELECT available INTO vAvailable FROM tmp.ticketLot WHERE warehouseFk = vWarehouse AND itemFk = vItem; + IF vAvailable IS NULL THEN + SET vAvailable = 0; + END IF; + IF vAmount > vAvailable THEN CALL util.throw ('ORDER_ROW_UNAVAILABLE'); END IF; diff --git a/db/versions/11217-greenDracena/00-hederaMessages.sql b/db/versions/11217-greenDracena/00-hederaMessages.sql new file mode 100644 index 000000000..f6c9bdce3 --- /dev/null +++ b/db/versions/11217-greenDracena/00-hederaMessages.sql @@ -0,0 +1,19 @@ +INSERT INTO hedera.message (code,description) + VALUES ('ORDER_ROW_UNAVAILABLE','The ordered quantity exceeds the available'); +INSERT INTO hedera.message (code,description) + VALUES ('AMOUNT_NOT_MATCH_GROUPING','The quantity ordered does not match the grouping'); + +INSERT INTO hedera.messageI18n (code,lang,description) + VALUES ('ORDER_ROW_UNAVAILABLE','es','La cantidad pedida excede el disponible'); +INSERT INTO hedera.messageI18n (code,lang,description) + VALUES ('AMOUNT_NOT_MATCH_GROUPING','es','La cantidad pedida no coincide con el agrupado'); + +INSERT INTO hedera.messageI18n (code,lang,description) + VALUES ('ORDER_ROW_UNAVAILABLE','fr','La quantité demandée dépasse ce qui est disponible'); +INSERT INTO hedera.messageI18n (code,lang,description) + VALUES ('AMOUNT_NOT_MATCH_GROUPING','fr','La quantité commandée ne correspond pas au regroupement'); + +INSERT INTO hedera.messageI18n (code,lang,description) + VALUES ('ORDER_ROW_UNAVAILABLE','pt','A quantidade de entrega excede a disponibilidade'); +INSERT INTO hedera.messageI18n (code,lang,description) + VALUES ('AMOUNT_NOT_MATCH_GROUPING','pt','A quantidade solicitada não corresponde ao agrupamento');