#7896 - 24.36 Dev To Test #2884
|
@ -14,10 +14,17 @@ 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
|
||||||
|
AND 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)
|
||||||
|
);
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
||||||
SET vDone = TRUE;
|
SET vDone = TRUE;
|
||||||
|
|
Loading…
Reference in New Issue