hotfix: midnight deterministis refs #7213
This commit is contained in:
parent
3b4cbe9e6c
commit
f2b443021f
|
@ -1,7 +1,7 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`midnight`()
|
||||
RETURNS datetime
|
||||
NOT DETERMINISTIC
|
||||
DETERMINISTIC
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ BEGIN
|
|||
DECLARE vIsTooLittle TINYINT(1);
|
||||
|
||||
SELECT (SUM(IFNULL(sv.litros, 0)) < vc.minTicketVolume
|
||||
OR IFNULL(t.totalWithoutVat, 0) < vc.minTicketValue) INTO vIsTooLittle
|
||||
AND IFNULL(t.totalWithoutVat, 0) < vc.minTicketValue) INTO vIsTooLittle
|
||||
FROM ticket t
|
||||
LEFT JOIN saleVolume sv ON sv.ticketFk = t.id
|
||||
JOIN volumeConfig vc
|
||||
|
|
|
@ -13,7 +13,7 @@ BEGIN
|
|||
ENGINE = MEMORY
|
||||
SELECT t.id ticketFk, FALSE hasProblem
|
||||
FROM ticket t
|
||||
WHERE t.shipped >= util.midnight()
|
||||
WHERE t.shipped >= util.VN_CURDATE()
|
||||
AND (vSelf IS NULL OR t.id = vSelf);
|
||||
|
||||
UPDATE tmp.ticket t
|
||||
|
|
|
@ -16,7 +16,7 @@ BEGIN
|
|||
SELECT t.id ticketFk
|
||||
FROM vn.ticket t
|
||||
LEFT JOIN vn.sale s ON s.ticketFk = t.id
|
||||
WHERE t.shipped >= util.midnight()
|
||||
WHERE t.shipped >= util.VN_CURDATE()
|
||||
AND (s.itemFk = vItemFk OR vItemFk IS NULL)
|
||||
GROUP BY t.id
|
||||
)SELECT ticketFk, ticket_isTooLittle(ticketFk) hasProblem
|
||||
|
|
Loading…
Reference in New Issue