2024-05-13 07:54:27 +00:00
|
|
|
DELIMITER $$
|
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
|
|
PROCEDURE `vn`.`ticket_setProblemTaxDataChecked`(vSelf INT)
|
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Update the problem of tickets, depending on whether
|
|
|
|
* the client taxDataCheched is verified or not
|
|
|
|
*
|
2024-05-13 11:31:58 +00:00
|
|
|
* @param vSelf Id ticket, if NULL all tickets
|
2024-05-13 07:54:27 +00:00
|
|
|
*/
|
|
|
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
|
|
|
(INDEX(ticketFk))
|
|
|
|
ENGINE = MEMORY
|
|
|
|
SELECT t.id ticketFk, IF(c.isTaxDataChecked, FALSE, TRUE) hasProblem
|
|
|
|
FROM ticket t
|
|
|
|
JOIN client c ON c.id = t.clientFk
|
|
|
|
WHERE t.shipped >= util.midnight()
|
|
|
|
AND (c.id = vClientFk OR vClientFk IS NULL);
|
|
|
|
|
|
|
|
CALL ticket_setProblem('isTaxDataChecked');
|
|
|
|
|
|
|
|
DROP TEMPORARY TABLE tmp.ticket;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|