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 ;
