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