feat: refs #7740 Ticket before update added restriction #2770

Merged
guillermo merged 1 commits from 7740-ticketSignRoute into dev 2024-07-22 12:02:19 +00:00
1 changed files with 10 additions and 7 deletions

View File

@ -8,13 +8,16 @@ BEGIN
SET NEW.editorFk = account.myUser_getId(); SET NEW.editorFk = account.myUser_getId();
IF NOT (NEW.routeFk <=> OLD.routeFk) THEN IF NOT (NEW.routeFk <=> OLD.routeFk) THEN
INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) IF NEW.isSigned THEN
SELECT r.id CALL util.throw('A signed ticket cannot be rerouted');
FROM vn.route r END IF;
WHERE r.isOk = FALSE INSERT IGNORE INTO routeRecalc(routeFk)
AND r.id IN (OLD.routeFk,NEW.routeFk) SELECT id
AND r.created >= util.VN_CURDATE() FROM `route`
GROUP BY r.id; WHERE NOT isOk
AND id IN (OLD.routeFk, NEW.routeFk)
AND created >= util.VN_CURDATE()
GROUP BY id;
END IF; END IF;
IF NOT (DATE(NEW.shipped) <=> DATE(OLD.shipped)) THEN IF NOT (DATE(NEW.shipped) <=> DATE(OLD.shipped)) THEN