15 lines
488 B
SQL
15 lines
488 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`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);
|
|
IF NEW.travelFk IS NOT NULL THEN
|
|
CALL travel_throwAwb(NEW.travelFk);
|
|
END IF;
|
|
END$$
|
|
DELIMITER ;
|