Advertisement
cdsatrian

autoresponse

Feb 4th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.84 KB | None | 0 0
  1. DELIMITER $$
  2. CREATE TRIGGER cek_broadcast
  3. AFTER INSERT ON inbox
  4. FOR EACH ROW BEGIN
  5. SET @sender = (SELECT modem FROM modem WHERE type='sender' AND status='aktif' LIMIT 1);
  6. IF (SUBSTRING_INDEX(NEW.TextDecoded, ' ', 2) = 'REG ALL') THEN
  7.   INSERT INTO outbox ( DestinationNumber, Coding, TextDecoded, CreatorID )
  8.   SELECT Number,'Default_No_Compression',NEW.TextDecoded,@sender FROM pbk ORDER BY ID ASC;
  9. ELSE
  10.   IF (SUBSTRING_INDEX(NEW.TextDecoded, ' ', 2) = 'REG GROUP') THEN
  11.     INSERT INTO outbox ( DestinationNumber, Coding, TextDecoded, CreatorID )
  12.     SELECT Number,'Default_No_Compression',NEW.TextDecoded,@sender
  13.       FROM user_group
  14.         LEFT JOIN pbk ON user_group.id_pbk=pbk.ID
  15.         LEFT JOIN pbk_groups ON pbk_groups.ID=user_group.id_pbk_groups
  16.       ORDER BY user_group.id_group ASC;  
  17.   END IF;
  18. END IF;
  19. END $$
  20.  
  21. DELIMITER ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement