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

17 lines
375 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`shelving_beforeUpdate`
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 ;