2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketStateToday_setState`(vTicketFk INT, vStateCode VARCHAR(45))
|
|
|
|
BEGIN
|
2024-06-05 06:05:46 +00:00
|
|
|
|
2024-01-15 11:31:03 +00:00
|
|
|
/* Modifica el estado de un ticket de hoy
|
2024-06-05 06:05:46 +00:00
|
|
|
*
|
2024-01-15 11:31:03 +00:00
|
|
|
* @param vTicketFk el id del ticket
|
|
|
|
* @param vStateCode estado a modificar del ticket
|
2024-06-05 06:05:46 +00:00
|
|
|
*
|
2024-01-15 11:31:03 +00:00
|
|
|
*/
|
2024-06-05 06:05:46 +00:00
|
|
|
|
2024-01-15 11:31:03 +00:00
|
|
|
DECLARE vAlertLevel INT;
|
2024-06-05 06:05:46 +00:00
|
|
|
DECLARE vAlertLevelPacked INT;
|
|
|
|
|
|
|
|
SELECT s.alertLevel, al.id
|
|
|
|
INTO vAlertLevel, vAlertLevelPacked
|
|
|
|
FROM state s
|
|
|
|
JOIN ticketStateToday tst ON tst.state = s.id
|
|
|
|
JOIN alertLevel al ON al.code = 'PACKED'
|
2024-01-25 16:33:54 +00:00
|
|
|
WHERE tst.ticketFk = vTicketFk
|
2024-01-15 11:31:03 +00:00
|
|
|
LIMIT 1;
|
2024-06-05 06:05:46 +00:00
|
|
|
|
|
|
|
IF vAlertLevel < vAlertLevelPacked THEN
|
|
|
|
|
2024-01-15 11:31:03 +00:00
|
|
|
CALL vn.ticket_setState(vTicketFk, vStateCode);
|
2024-06-05 06:05:46 +00:00
|
|
|
|
2024-01-15 11:31:03 +00:00
|
|
|
END IF;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|