feat: refs #3199 Requested changes
gitea/salix/pipeline/pr-dev Build queued... Details

This commit is contained in:
Guillermo Bonet 2024-08-20 10:59:05 +02:00
parent a995d80b46
commit d0f1362f85
1 changed files with 4 additions and 4 deletions

View File

@ -16,16 +16,16 @@ BEGIN
DECLARE cTickets CURSOR FOR DECLARE cTickets CURSOR FOR
SELECT DISTINCT t.id SELECT DISTINCT t.id
FROM ticket t FROM ticket t
LEFT JOIN tItemCalc tic ON tic.id = t.id LEFT JOIN tItems ti ON ti.id = t.id
WHERE t.refFk IS NULL WHERE t.refFk IS NULL
AND ((vScope = 'client' AND t.clientFk = vId) AND ((vScope = 'client' AND t.clientFk = vId)
OR (vScope = 'address' AND t.addressFk = vId) OR (vScope = 'address' AND t.addressFk = vId)
OR (vScope = 'item' AND tic.id) OR (vScope = 'item' AND ti.id)
); );
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
CREATE OR REPLACE TEMPORARY TABLE tItemCalc CREATE OR REPLACE TEMPORARY TABLE tItems
SELECT DISTINCT t.id SELECT DISTINCT t.id
FROM ticket t FROM ticket t
JOIN sale s ON s.ticketFk = t.id JOIN sale s ON s.ticketFk = t.id
@ -46,6 +46,6 @@ BEGIN
END LOOP; END LOOP;
CLOSE cTickets; CLOSE cTickets;
DROP TEMPORARY TABLE tItemCalc; DROP TEMPORARY TABLE tItems;
END$$ END$$
DELIMITER ; DELIMITER ;