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

15 lines
486 B
MySQL
Raw Permalink Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entry_beforeInsert`
BEFORE INSERT ON `entry`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
CALL supplier_checkIsActive(NEW.supplierFk);
SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk);
SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk);
2024-05-16 13:34:45 +00:00
IF NEW.travelFk IS NOT NULL THEN
2024-05-17 06:16:50 +00:00
CALL travel_throwAwb(NEW.travelFk);
END IF;
END$$
DELIMITER ;