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

16 lines
464 B
MySQL
Raw Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`receipt_afterUpdate`
AFTER UPDATE ON `receipt`
FOR EACH ROW
BEGIN
IF NEW.isConciliate = FALSE AND NEW.payed > OLD.payed THEN
CALL mail_insert(
'finanzas@verdnatura.es',
NULL,
CONCAT('Cambios de recibos del cliente: ', NEW.clientFk),
CONCAT('Se ha cambiado el recibo: ', NEW.Id, ' de ', OLD.payed, ' a ', NEW.payed)
);
END IF;
END$$
DELIMITER ;