From 8e2770aa565c647c4a2720384e0f04524fcff0c5 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 26 Mar 2024 16:27:49 +0100 Subject: [PATCH] feat: refs #7141 --- db/routines/vn/procedures/sale_replaceItem.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/sale_replaceItem.sql b/db/routines/vn/procedures/sale_replaceItem.sql index 79997d989..51c6f6c08 100644 --- a/db/routines/vn/procedures/sale_replaceItem.sql +++ b/db/routines/vn/procedures/sale_replaceItem.sql @@ -78,7 +78,8 @@ BEGIN SELECT price INTO vNewPrice FROM tmp.ticketComponentPrice - WHERE (vQuantity % `grouping` = 0); + ORDER BY (vQuantity % `grouping`) ASC + LIMIT 1; IF vNewPrice IS NULL THEN CALL util.throw('price retrieval failed');