From 10d2d4c9c4de6c3642f415cbe93fad694cc7a8fa Mon Sep 17 00:00:00 2001 From: ivanm Date: Tue, 26 Nov 2024 18:01:49 +0100 Subject: [PATCH] fix: hotfix entry_splitByShelving --- db/routines/vn/procedures/entry_splitByShelving.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/entry_splitByShelving.sql b/db/routines/vn/procedures/entry_splitByShelving.sql index 3201900e6..f5de36098 100644 --- a/db/routines/vn/procedures/entry_splitByShelving.sql +++ b/db/routines/vn/procedures/entry_splitByShelving.sql @@ -23,12 +23,13 @@ BEGIN LEAST(bb.stickers, FLOOR(ish.visible / ish.packing)) ishStickers, bb.stickers buyStickers FROM itemShelving ish + JOIN shelving sh ON sh.id = ish.shelvingFk JOIN (SELECT b.id, b.itemFk, b.stickers FROM buy b WHERE b.entryFk = vFromEntryFk ORDER BY b.stickers DESC LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk - WHERE ish.shelvingFk = vShelvingCode COLLATE utf8_general_ci + WHERE sh.code = vShelvingCode COLLATE utf8_general_ci AND NOT ish.isSplit GROUP BY ish.id;