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

View File

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