Hotfix: refs #7213 ticket_isTooLittle group by addressFk
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Carlos Andrés 2024-08-27 17:39:54 +02:00
parent 9a2351b958
commit 1ec9e5bf09
2 changed files with 7 additions and 8 deletions

View File

@ -20,13 +20,12 @@ BEGIN
)
SELECT (SUM(IFNULL(sv.litros, 0)) < vc.minTicketVolume
AND SUM(IFNULL(t.totalWithoutVat, 0)) < vc.minTicketValue) INTO vIsTooLittle
FROM vn.ticket t
JOIN tickets ts ON ts.addressFk = t.addressFk
JOIN vn.volumeConfig vc
FROM tickets ts
JOIN vn.ticket t ON t.addressFk = ts.addressFk
LEFT JOIN vn.saleVolume sv ON sv.ticketFk = t.id
JOIN vn.volumeConfig vc
WHERE t.shipped BETWEEN ts.dated AND util.dayEnd(ts.dated)
AND sv.litros > 0
AND t.totalWithoutVat > 0;
AND ticket_isProblemCalcNeeded(t.id);
RETURN vIsTooLittle;
END$$

View File

@ -17,9 +17,9 @@ BEGIN
FROM vn.ticket
WHERE id = vSelf
)
SELECT vSelf ticketFk,
ticket_isTooLittle(vSelf) hasProblem,
ticket_isProblemCalcNeeded(vSelf) isProblemCalcNeeded
SELECT t.id ticketFk,
ticket_isTooLittle(t.id) hasProblem,
ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
FROM vn.ticket t
JOIN tickets ts ON ts.addressFk = t.addressFk
WHERE t.shipped BETWEEN ts.dated AND util.dayEnd(ts.dated);