From eced03f69bc10fdca1deeced089fa7de82cc33d8 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 24 Apr 2024 11:40:24 +0200 Subject: [PATCH] fix(ticket_getMovable): refs #7225 stock add ifnull --- db/routines/vn/procedures/ticket_canAdvance.sql | 6 +++--- db/routines/vn/procedures/ticket_getMovable.sql | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/db/routines/vn/procedures/ticket_canAdvance.sql b/db/routines/vn/procedures/ticket_canAdvance.sql index ab6a27364..d1ca7b5e2 100644 --- a/db/routines/vn/procedures/ticket_canAdvance.sql +++ b/db/routines/vn/procedures/ticket_canAdvance.sql @@ -124,8 +124,8 @@ BEGIN ) dest ON dest.addressFk = origin.addressFk WHERE origin.hasStock; - DROP TEMPORARY TABLE IF EXISTS - tmp.itemList, - tmp.itemMinacum; + DROP TEMPORARY TABLE IF EXISTS + tmp.itemList, + tmp.itemMinacum; END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/ticket_getMovable.sql b/db/routines/vn/procedures/ticket_getMovable.sql index d7bcf517b..512151bd4 100644 --- a/db/routines/vn/procedures/ticket_getMovable.sql +++ b/db/routines/vn/procedures/ticket_getMovable.sql @@ -38,7 +38,7 @@ BEGIN s.discount, i.image, i.subName, - il.stock + IFNULL(im.amount, 0) AS movable + IFNULL(il.stock,0) + IFNULL(im.amount, 0) AS movable FROM ticket t JOIN sale s ON s.ticketFk = t.id JOIN item i ON i.id = s.itemFk @@ -48,8 +48,8 @@ BEGIN WHERE t.id = vTicketFk; DROP TEMPORARY TABLE IF EXISTS - tmp.itemList, - tmp.itemMinacum; + tmp.itemList, + tmp.itemMinacum; END$$ DELIMITER ;