2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` TRIGGER `vn`.`item_beforeInsert`
|
2024-01-15 11:31:03 +00:00
|
|
|
BEFORE INSERT ON `item`
|
|
|
|
FOR EACH ROW
|
|
|
|
BEGIN
|
|
|
|
DECLARE vItemPackingType VARCHAR(1);
|
|
|
|
|
|
|
|
SET NEW.editorFk = account.myUser_getId();
|
|
|
|
|
|
|
|
IF NEW.itemPackingTypeFk IS NULL THEN
|
|
|
|
SELECT itemPackingTypeFk INTO vItemPackingType
|
|
|
|
FROM vn.itemType it
|
|
|
|
WHERE id = NEW.typeFk;
|
|
|
|
|
|
|
|
SET NEW.itemPackingTypeFk = vItemPackingType;
|
|
|
|
END IF;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|