salix/db/routines/vn/triggers/ticket_afterUpdate.sql

17 lines
344 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` TRIGGER `vn`.`ticket_afterUpdate`
AFTER UPDATE ON `ticket`
FOR EACH ROW
BEGIN
IF NEW.routeFk <> OLD.routeFk THEN
UPDATE expedition
SET hasNewRoute = TRUE
WHERE ticketFk = NEW.id;
IF NEW.cmrFk THEN
CALL ticket_doCmr(NEW.id);
END IF;
END IF;
END$$
DELIMITER ;