28 lines
653 B
SQL
28 lines
653 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entry_afterUpdate`
|
|
AFTER UPDATE ON `entry`
|
|
FOR EACH ROW
|
|
BEGIN
|
|
IF NOT(NEW.id <=> OLD.id)
|
|
OR NOT(NEW.travelFk <=> OLD.travelFk)
|
|
OR NOT(NEW.isRaid <=> OLD.isRaid) THEN
|
|
CALL stock.log_add('entry', NEW.id, OLD.id);
|
|
END IF;
|
|
|
|
IF NOT (NEW.travelFk <=> OLD.travelFk) THEN
|
|
CALL travel_requestRecalc(OLD.travelFk);
|
|
CALL travel_requestRecalc(NEW.travelFk);
|
|
END IF;
|
|
|
|
|
|
IF NOT (NEW.travelFk <=> OLD.travelFk) THEN
|
|
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
|
|
SELECT b.id
|
|
FROM buy b
|
|
WHERE b.entryFk = NEW.id;
|
|
|
|
CALL buy_checkItem();
|
|
END IF;
|
|
END$$
|
|
DELIMITER ;
|