salix/db/routines/vn/procedures/ticket_setTaxDataCheckedPro...

22 lines
560 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost`
PROCEDURE `vn`.`ticket_setTaxDataCheckedProblemAll`()
proc: BEGIN
/**
* Update the problem of all tickets, depending on whether
* the client taxDataCheched is verified or not
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
(INDEX(ticketFk))
ENGINE = MEMORY
SELECT t.id ticketFk, FALSE hasProblem
FROM ticket t
JOIN client c ON c.id = t.clientFk
WHERE t.shipped >= util.midnight();
CALL ticket_getTaxDataCheckedProblem();
DROP TEMPORARY TABLE tmp.ticket;
END$$
DELIMITER ;