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

17 lines
378 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`shelving_BEFORE_UPDATE`
BEFORE UPDATE ON `shelving`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
IF NEW.code = "" THEN
CALL util.throw('NOT_EMPTY_CODE_ALLOWED');
END IF;
IF NOT(OLD.parkingFk <=> NEW.parkingFK) THEN
SET NEW.isMoving = FALSE;
END IF;
END$$
DELIMITER ;