Hotfix-midnight-determinist #2548

Merged
carlosap merged 3 commits from Hotfix-midnight-determinist into master 2024-06-07 14:22:05 +00:00
7 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`midnight`()
RETURNS datetime
NOT DETERMINISTIC
DETERMINISTIC
READS SQL DATA
BEGIN

View File

@ -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

View File

@ -18,7 +18,7 @@ BEGIN
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
WHERE t.shipped >= util.midnight()
WHERE t.shipped >= util.VN_CURDATE()
AND (vComponentFk IS NULL OR sc.componentFk = vComponentFk)
GROUP BY s.id) sub;

View File

@ -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 (vClientFk IS NULL OR t.clientFk = vClientFk);
UPDATE tmp.ticket t

View File

@ -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

View File

@ -14,7 +14,7 @@ BEGIN
SELECT t.id ticketFk, IF(c.isTaxDataChecked, FALSE, TRUE) hasProblem
FROM ticket t
JOIN client c ON c.id = t.clientFk
WHERE t.shipped >= util.midnight()
WHERE t.shipped >= util.VN_CURDATE()
AND (c.id = vClientFk OR vClientFk IS NULL);
CALL ticket_setProblem('isTaxDataChecked');

View File

@ -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