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

16 lines
460 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`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 ;