salix/db/routines/stock/triggers/inbound_beforeInsert.sql

16 lines
343 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `stock`.`inbound_beforeInsert`
BEFORE INSERT ON `inbound`
FOR EACH ROW
BEGIN
SET NEW.isPicked = NEW.isPicked OR NEW.dated < util.VN_CURDATE();
CALL visible_log(
NEW.isPicked,
NEW.warehouseFk,
NEW.itemFk,
NEW.quantity
);
END$$
DELIMITER ;