Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DELIMITER $$
- CREATE TRIGGER cek_broadcast
- AFTER INSERT ON inbox
- FOR EACH ROW BEGIN
- SET @sender = (SELECT modem FROM modem WHERE type='sender' AND status='aktif' LIMIT 1);
- IF (SUBSTRING_INDEX(NEW.TextDecoded, ' ', 2) = 'REG ALL') THEN
- INSERT INTO outbox ( DestinationNumber, Coding, TextDecoded, CreatorID )
- SELECT Number,'Default_No_Compression',NEW.TextDecoded,@sender FROM pbk ORDER BY ID ASC;
- ELSE
- IF (SUBSTRING_INDEX(NEW.TextDecoded, ' ', 2) = 'REG GROUP') THEN
- INSERT INTO outbox ( DestinationNumber, Coding, TextDecoded, CreatorID )
- SELECT Number,'Default_No_Compression',NEW.TextDecoded,@sender
- FROM user_group
- LEFT JOIN pbk ON user_group.id_pbk=pbk.ID
- LEFT JOIN pbk_groups ON pbk_groups.ID=user_group.id_pbk_groups
- ORDER BY user_group.id_group ASC;
- END IF;
- END IF;
- END $$
- DELIMITER ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement