feat: refs #3199 Added more scopes ticket_recalcByScope
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Guillermo Bonet 2024-05-14 07:52:21 +02:00
parent b13c7c0db6
commit 4d7ac901c6
1 changed files with 13 additions and 4 deletions

View File

@ -14,10 +14,19 @@ BEGIN
DECLARE vTicketFk INT; DECLARE vTicketFk INT;
DECLARE cTickets CURSOR FOR DECLARE cTickets CURSOR FOR
SELECT id FROM ticket SELECT DISTINCT t.id
WHERE refFk IS NULL FROM ticket t
AND ((vScope = 'client' AND clientFk = vId) JOIN sale s ON s.ticketFk = t.id
OR (vScope = 'address' AND addressFk = vId)); JOIN itemTaxCountry itc ON itc.itemFk = s.itemFk
WHERE t.refFk IS NULL
DATE(t.shipped) > util.VN_CURDATE()
AND (
(vScope = 'client' AND t.clientFk = vId)
OR (vScope = 'address' AND t.addressFk = vId)
OR (vScope = 'item' AND itc.itemFk = vId)
OR (vScope = 'country' AND itc.countryFk = vId)
OR (vScope = 'taxClass' AND itc.taxClassFk = vId)
);
DECLARE CONTINUE HANDLER FOR NOT FOUND DECLARE CONTINUE HANDLER FOR NOT FOUND
SET vDone = TRUE; SET vDone = TRUE;