fix: refs #7213 componentLack y setRisk #2820
|
@ -14,7 +14,7 @@ BEGIN
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT vSelf saleFk,
|
SELECT vSelf saleFk,
|
||||||
sale_hasComponentLack(vSelf) hasProblem,
|
sale_hasComponentLack(vSelf) hasProblem,
|
||||||
ticket_isProblemCalcNeeded(ticketFk) isProblemCalcNeeded
|
(ticket_isProblemCalcNeeded(ticketFk) AND quantity > 0) isProblemCalcNeeded
|
||||||
FROM sale
|
FROM sale
|
||||||
WHERE id = vSelf;
|
WHERE id = vSelf;
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ BEGIN
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT saleFk,
|
SELECT saleFk,
|
||||||
sale_hasComponentLack(saleFk) hasProblem,
|
sale_hasComponentLack(saleFk) hasProblem,
|
||||||
ticket_isProblemCalcNeeded(ticketFk) isProblemCalcNeeded
|
(ticket_isProblemCalcNeeded(ticketFk) AND quantity > 0) isProblemCalcNeeded
|
||||||
FROM (
|
FROM (
|
||||||
SELECT s.id saleFk, s.ticketFk
|
SELECT s.id saleFk, s.ticketFk, s.quantity
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||||
|
|
|
@ -85,7 +85,7 @@ BEGIN
|
||||||
UPDATE ticket t
|
UPDATE ticket t
|
||||||
JOIN tTicketRisk tr ON tr.ticketFk = t.id
|
JOIN tTicketRisk tr ON tr.ticketFk = t.id
|
||||||
SET t.risk = NULL
|
SET t.risk = NULL
|
||||||
WHERE tr.isProblemCalcNeeded
|
WHERE NOT tr.isProblemCalcNeeded
|
||||||
ORDER BY t.id;
|
ORDER BY t.id;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tTicketRisk;
|
DROP TEMPORARY TABLE tTicketRisk;
|
||||||
|
|
Loading…
Reference in New Issue