2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_beforeUpdate`
|
|
|
|
BEFORE UPDATE ON `travel`
|
|
|
|
FOR EACH ROW
|
|
|
|
BEGIN
|
|
|
|
SET NEW.editorFk = account.myUser_getId();
|
2024-01-30 14:07:13 +00:00
|
|
|
|
2024-01-15 11:31:03 +00:00
|
|
|
IF NOT (NEW.landed <=> OLD.landed)
|
|
|
|
OR NOT (NEW.shipped <=> OLD.shipped) THEN
|
|
|
|
CALL travel_checkDates(NEW.shipped, NEW.landed);
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
IF NOT (NEW.isReceived <=> OLD.isReceived) THEN
|
|
|
|
CALL travel_checkPackaging(NEW.id);
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
IF NOT (NEW.warehouseInFk <=> OLD.warehouseInFk) THEN
|
|
|
|
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
|
|
|
|
END IF;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|