insert into messages_messages (msg_id, owner_id, community_id, subject, msg_content) values (:msg_id,:owner_id,:community_id,:subject,:message) insert into messages_recipients (msg_id, party_id) values (:msg_id,:party_id) insert into messages_recipients_roles (msg_id, rel_id) values (:msg_id,$rel_type) insert into messages_user_messages (msg_id, user_id, folder_id, new_p,parent_id) values (:msg_id,:party_id,0,'t',:msg_id) select save_sent_p from messages_options where user_id = :user_id insert into messages_user_messages (msg_id, user_id, folder_id, new_p,parent_id) values (:msg_id,:owner_id,1,'t',:msg_id) update messages_user_messages set new_p = 't' where msg_id = :msg_id select attachment_id, attachment_item_id from messages_attachments where msg_id = :msg_id_old $attachment_ids_clause insert into messages_messages (msg_id, owner_id, community_id, subject, msg_content) values (:msg_id,:owner_id,:community_id,:subject,:message) insert into messages_messages (msg_id, owner_id, community_id, subject, msg_content,parent_id) values (:msg_id,:owner_id,:community_id,:subject,:message,:general_parent_id) insert into messages_recipients (msg_id, party_id) values ($msg_id,$party_id) insert into messages_recipients_roles (msg_id, rel_id) values (:msg_id,$rel_type) insert into messages_user_messages (msg_id, user_id, folder_id, new_p,parent_id) values (:msg_id,:party_id,0,'t',:msg_id) insert into messages_user_messages (msg_id, user_id, folder_id, new_p,parent_id) values (:msg_id,:owner_id,1,'t',:msg_id) select save_sent_p from messages_options where user_id = :user_id insert into messages_attachments values (:msg_id,:attachment_id,:attachment_item_id) insert into messages_user_messages (msg_id, user_id, folder_id, new_p,parent_id) values (:msg_id,:owner_id,1,'t',:parent_id) insert into messages_user_messages (msg_id, user_id, folder_id, new_p,parent_id) values (:msg_id,:party_id,0,'t',:parent_id) delete from messages_user_messages where msg_id in ( select um.msg_id from (select parent_id,msg_id from messages_user_messages where folder_id = :folder_id and msg_id = parent_id) um, (select msg_id,to_char(sent_date, 'DD-MM-YYYY') as sent_date from messages_messages where sent_date < (SELECT sysdate - :limit_days_in_trash FROM dual)) m where um.msg_id = m.msg_id ) select msg_id, user_id from messages_user_messages where folder_id = :folder_id select subject from messages_messages where msg_id = :msg_id_old select user_id from dotlrn_member_rels_approved where community_id = :community_id and rel_type in ($rel_types) select user_id from dotlrn_member_rels_approved where community_id = :community_id and rel_type in ($rel_types) select msg_content, owner_id, subject, sent_date, to_char(sent_date, 'HH24:MI:SS') as time from messages_messages where msg_id in (select msg_id from messages_user_messages where user_id = :user_id and folder_id not in ($not_folder_ids) and parent_id = :parent_id) and msg_id <= :msg_id order by msg_id desc select '{name:"'||name.party_name||'", p:"'||name.person_id||'"}' from (select persons.first_names||' '||persons.last_name as party_name, persons.person_id from persons,dotlrn_member_rels_approved where dotlrn_member_rels_approved.community_id = :community_id and dotlrn_member_rels_approved.user_id = persons.person_id order by party_name) as name