From 9cbcd70d4d838d033cb7c57de9c832e133100a63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 26 Feb 2024 15:44:34 +0100 Subject: [PATCH] feat: comprobaciones facturas contabilizadas refs #6932 --- db/routines/vn/triggers/entry_beforeUpdate.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/db/routines/vn/triggers/entry_beforeUpdate.sql b/db/routines/vn/triggers/entry_beforeUpdate.sql index a97a90a3d..60b83002c 100644 --- a/db/routines/vn/triggers/entry_beforeUpdate.sql +++ b/db/routines/vn/triggers/entry_beforeUpdate.sql @@ -42,5 +42,10 @@ BEGIN CALL supplier_checkIsActive(NEW.supplierFk); SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk); END IF; + + IF NOT (NEW.travelFk <=> OLD.travelFk) + OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN + SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk); + END IF; END$$ DELIMITER ;