27 lines
835 B
MySQL
27 lines
835 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplier_afterUpdate`
|
||
|
BEFORE UPDATE ON `supplier`
|
||
|
FOR EACH ROW
|
||
|
BEGIN
|
||
|
IF NEW.id <> OLD.id
|
||
|
OR NOT (NEW.name <=> OLD.name)
|
||
|
OR NOT (NEW.street <=> OLD.street)
|
||
|
OR NOT (NEW.account <=> OLD.account)
|
||
|
OR NOT (NEW.nif <=> OLD.nif)
|
||
|
OR NOT (NEW.isVies <=> OLD.isVies)
|
||
|
OR NOT (NEW.provinceFk <=> OLD.provinceFk)
|
||
|
OR NOT (NEW.countryFk <=> OLD.countryFk)
|
||
|
OR NOT (NEW.postCode <=> OLD.postCode)
|
||
|
OR NOT (NEW.city <=> OLD.city)
|
||
|
OR NOT (NEW.taxTypeSageFk <=> OLD.taxTypeSageFk)
|
||
|
OR NOT (NEW.transactionTypeSageFk <=> OLD.transactionTypeSageFk)
|
||
|
OR NOT (NEW.withholdingSageFk <=> OLD.withholdingSageFk) THEN
|
||
|
|
||
|
UPDATE sage.clientSupplier
|
||
|
SET isSync = FALSE
|
||
|
WHERE idClientSupplier IN (NEW.id, OLD.id)
|
||
|
AND `type` = 'P';
|
||
|
END IF;
|
||
|
END$$
|
||
|
DELIMITER ;
|