diff --git a/db/routines/vn/triggers/ticket_beforeUpdate.sql b/db/routines/vn/triggers/ticket_beforeUpdate.sql index 72831bc3d..34b6711ff 100644 --- a/db/routines/vn/triggers/ticket_beforeUpdate.sql +++ b/db/routines/vn/triggers/ticket_beforeUpdate.sql @@ -8,13 +8,16 @@ BEGIN SET NEW.editorFk = account.myUser_getId(); IF NOT (NEW.routeFk <=> OLD.routeFk) THEN - INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id - FROM vn.route r - WHERE r.isOk = FALSE - AND r.id IN (OLD.routeFk,NEW.routeFk) - AND r.created >= util.VN_CURDATE() - GROUP BY r.id; + IF NEW.isSigned THEN + CALL util.throw('A signed ticket cannot be rerouted'); + END IF; + INSERT IGNORE INTO routeRecalc(routeFk) + SELECT id + FROM `route` + WHERE NOT isOk + AND id IN (OLD.routeFk, NEW.routeFk) + AND created >= util.VN_CURDATE() + GROUP BY id; END IF; IF NOT (DATE(NEW.shipped) <=> DATE(OLD.shipped)) THEN