X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=mysql%2Fcore_notify_trigger_after_update.sql;h=4297371b80965748fbc84edb302174d40d380386;hp=6f4a37df06a2bb6ad1883a3270daa3d8310b3ae5;hb=HEAD;hpb=ec774994494088243c8f548451e7853557c26295 diff --git a/mysql/core_notify_trigger_after_update.sql b/mysql/core_notify_trigger_after_update.sql index 6f4a37df..07bdc833 100644 --- a/mysql/core_notify_trigger_after_update.sql +++ b/mysql/core_notify_trigger_after_update.sql @@ -6,9 +6,18 @@ DELIMITER $$ CREATE TRIGGER core_notify_trigger_after_update - BEFORE UPDATE ON core_notify + AFTER UPDATE ON core_notify FOR EACH ROW BEGIN - DECLARE mid INT(11); - IF (@DISABLE_TRIGGER IS NULL AND @DISABLE_TRIGGER_{$tbl} IS NULL ) THEN - \ No newline at end of file + -- make sure that act_start does not get modified if sent is set. + IF (OLD.sent IS NOT NULL AND OLD.sent > '1500-01-01 00:00:00') + AND ( NEW.act_start != OLD.act_start OR NEW.act_when != OLD.act_when ) THEN + UPDATE `Error: Can not update core_notify action dates after its sent` SET x = 1; + END IF; + END; +$$ + + +DELIMITER ; + + \ No newline at end of file