25 lines
753 B
MySQL
25 lines
753 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `hedera`.`order_afterUpdate`
|
||
|
AFTER UPDATE ON `order`
|
||
|
FOR EACH ROW
|
||
|
BEGIN
|
||
|
CALL stock.log_add('order', NEW.id, OLD.id);
|
||
|
|
||
|
IF !(OLD.address_id <=> NEW.address_id)
|
||
|
OR !(OLD.company_id <=> NEW.company_id)
|
||
|
OR !(OLD.customer_id <=> NEW.customer_id) THEN
|
||
|
CALL order_requestRecalc(NEW.id);
|
||
|
END IF;
|
||
|
|
||
|
IF !(OLD.address_id <=> NEW.address_id) AND NEW.address_id = 2850 THEN
|
||
|
-- Fallo que se actualiza no se sabe como tickets en este cliente
|
||
|
CALL vn.mail_insert(
|
||
|
'jgallego@verdnatura.es',
|
||
|
'noreply@verdnatura.es',
|
||
|
'Actualizada order al address 2850',
|
||
|
CONCAT(account.myUser_getName(), ' ha creado la order ',NEW.id)
|
||
|
);
|
||
|
END IF;
|
||
|
END$$
|
||
|
DELIMITER ;
|