diff --git a/db/changes/10270-wisemen/02-triggerReceipt.sql b/db/changes/10270-wisemen/02-triggerReceipt.sql new file mode 100644 index 000000000..9b08a302f --- /dev/null +++ b/db/changes/10270-wisemen/02-triggerReceipt.sql @@ -0,0 +1,17 @@ +DROP TRIGGER IF EXISTS vn.receipt_beforInsert; + +DELIMITER $$ +$$ +CREATE TRIGGER receipt_beforInsert +BEFORE INSERT +ON receipt FOR EACH ROW +BEGIN + SELECT isAutoConciliated INTO @isAutoConciliated + FROM accounting a + JOIN accountingType at2 ON at2.id = a.accountingTypeFk + WHERE a.id =NEW.bankFk; + + SET NEW.isConciliate = @isAutoConciliated; +END +$$ +DELIMITER ;