3:
4:
5: /*** Globals for notifications ***/
6: g_acc_table_name CONSTANT VARCHAR2(30) := 'JTM_WF_NOTIFICATIONS_ACC';
7: g_publication_item_name CONSTANT JTM_HOOK_UTIL_PKG.t_publication_item_list :=
8: JTM_HOOK_UTIL_PKG.t_publication_item_list('WF_NOTIFICATIONS');
9: g_table_name CONSTANT VARCHAR2(30) := 'WF_NOTIFICATIONS';
10: g_pk1_name CONSTANT VARCHAR2(30) := 'NOTIFICATION_ID';
11: g_debug_level NUMBER;
4:
5: /*** Globals for notifications ***/
6: g_acc_table_name CONSTANT VARCHAR2(30) := 'JTM_WF_NOTIFICATIONS_ACC';
7: g_publication_item_name CONSTANT JTM_HOOK_UTIL_PKG.t_publication_item_list :=
8: JTM_HOOK_UTIL_PKG.t_publication_item_list('WF_NOTIFICATIONS');
9: g_table_name CONSTANT VARCHAR2(30) := 'WF_NOTIFICATIONS';
10: g_pk1_name CONSTANT VARCHAR2(30) := 'NOTIFICATION_ID';
11: g_debug_level NUMBER;
12:
37: r_mobile c_mobile%ROWTYPE;
38:
39: l_ret_value BOOLEAN;
40: BEGIN
41: g_debug_level := JTM_HOOK_UTIL_PKG.Get_Debug_Level;
42:
43: IF g_debug_level = JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL THEN
44: jtm_message_log_pkg.Log_Msg
45: ( p_notification_id
39: l_ret_value BOOLEAN;
40: BEGIN
41: g_debug_level := JTM_HOOK_UTIL_PKG.Get_Debug_Level;
42:
43: IF g_debug_level = JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL THEN
44: jtm_message_log_pkg.Log_Msg
45: ( p_notification_id
46: , g_table_name
47: , 'Entering function REPLICATE_RECORD'
44: jtm_message_log_pkg.Log_Msg
45: ( p_notification_id
46: , g_table_name
47: , 'Entering function REPLICATE_RECORD'
48: , JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL);
49: END IF;
50:
51: l_ret_value := FALSE;
52: OPEN c_notification( p_notification_id );
55: /*check if recipient is a valid mobile user*/
56: OPEN c_mobile( r_notification.recipient_role );
57: FETCH c_mobile INTO r_mobile;
58: IF c_mobile%FOUND THEN
59: l_ret_value := JTM_HOOK_UTIL_PKG.isMobileFSresource(r_mobile.resource_id);
60: END IF;
61: CLOSE c_mobile;
62:
63: /*If recipient is not mobile, check if sender is*/
65: OPEN c_mobile( r_notification.text_value );
66: FETCH c_mobile INTO r_mobile;
67: IF c_mobile%FOUND THEN
68: /*Check if sender is a valid mobile user*/
69: l_ret_value := JTM_HOOK_UTIL_PKG.isMobileFSresource(r_mobile.resource_id);
70: END IF;
71: CLOSE c_mobile;
72: IF l_ret_value = FALSE THEN
73: IF g_debug_level >= JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_MEDIUM THEN
69: l_ret_value := JTM_HOOK_UTIL_PKG.isMobileFSresource(r_mobile.resource_id);
70: END IF;
71: CLOSE c_mobile;
72: IF l_ret_value = FALSE THEN
73: IF g_debug_level >= JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_MEDIUM THEN
74: jtm_message_log_pkg.Log_Msg
75: ( p_notification_id
76: , g_table_name
77: , 'Notification '||p_notification_id||' is not for a valid mobile field service user.'
74: jtm_message_log_pkg.Log_Msg
75: ( p_notification_id
76: , g_table_name
77: , 'Notification '||p_notification_id||' is not for a valid mobile field service user.'
78: , JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_MEDIUM);
79: END IF;
80: END IF;
81: END IF;
82: ELSE
79: END IF;
80: END IF;
81: END IF;
82: ELSE
83: IF g_debug_level = JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_MEDIUM THEN
84: jtm_message_log_pkg.Log_Msg
85: ( p_notification_id
86: , g_table_name
87: , 'Notification '||p_notification_id||' is not an open CS_MSGS/FYI_MESSAGE'
84: jtm_message_log_pkg.Log_Msg
85: ( p_notification_id
86: , g_table_name
87: , 'Notification '||p_notification_id||' is not an open CS_MSGS/FYI_MESSAGE'
88: , JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_MEDIUM);
89: END IF;
90: END IF;
91: CLOSE c_notification;
92:
89: END IF;
90: END IF;
91: CLOSE c_notification;
92:
93: IF g_debug_level = JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL THEN
94: jtm_message_log_pkg.Log_Msg
95: ( p_notification_id
96: , g_table_name
97: , 'Leaving function REPLICATE_RECORD'
94: jtm_message_log_pkg.Log_Msg
95: ( p_notification_id
96: , g_table_name
97: , 'Leaving function REPLICATE_RECORD'
98: , JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL);
99: END IF;
100:
101: RETURN l_ret_value;
102: END REPLICATE_RECORD;
135:
136: r_get_sender c_get_sender%ROWTYPE;
137:
138: BEGIN
139: g_debug_level := JTM_HOOK_UTIL_PKG.Get_Debug_Level;
140: IF g_debug_level = JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL THEN
141: jtm_message_log_pkg.Log_Msg
142: ( p_notification_id
143: , g_table_name
136: r_get_sender c_get_sender%ROWTYPE;
137:
138: BEGIN
139: g_debug_level := JTM_HOOK_UTIL_PKG.Get_Debug_Level;
140: IF g_debug_level = JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL THEN
141: jtm_message_log_pkg.Log_Msg
142: ( p_notification_id
143: , g_table_name
144: , 'Entering Procedure INSERT_NOTIFICATION'
141: jtm_message_log_pkg.Log_Msg
142: ( p_notification_id
143: , g_table_name
144: , 'Entering Procedure INSERT_NOTIFICATION'
145: , JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL);
146: END IF;
147:
148: l_replicate := REPLICATE_RECORD( p_notification_id );
149: IF l_replicate THEN
150: /*First check if mail is for mobile user */
151: OPEN c_get_recipient( p_notification_id );
152: FETCH c_get_recipient INTO r_get_recipient;
153: IF c_get_recipient%FOUND THEN
154: IF JTM_HOOK_UTIL_PKG.isMobileFSresource(r_get_recipient.resource_id) THEN
155: JTM_HOOK_UTIL_PKG.Insert_Acc
156: ( p_publication_item_names => g_publication_item_name
157: , p_acc_table_name => g_acc_table_name
158: , p_pk1_name => g_pk1_name
151: OPEN c_get_recipient( p_notification_id );
152: FETCH c_get_recipient INTO r_get_recipient;
153: IF c_get_recipient%FOUND THEN
154: IF JTM_HOOK_UTIL_PKG.isMobileFSresource(r_get_recipient.resource_id) THEN
155: JTM_HOOK_UTIL_PKG.Insert_Acc
156: ( p_publication_item_names => g_publication_item_name
157: , p_acc_table_name => g_acc_table_name
158: , p_pk1_name => g_pk1_name
159: , p_pk1_num_value => p_notification_id
167: /*Check if sender also needs this record*/
168: OPEN c_get_sender( p_notification_id );
169: FETCH c_get_sender INTO r_get_sender;
170: IF c_get_sender%FOUND THEN
171: IF JTM_HOOK_UTIL_PKG.isMobileFSresource(r_get_sender.resource_id) THEN
172: JTM_HOOK_UTIL_PKG.Insert_Acc
173: ( p_publication_item_names => g_publication_item_name
174: , p_acc_table_name => g_acc_table_name
175: , p_pk1_name => g_pk1_name
168: OPEN c_get_sender( p_notification_id );
169: FETCH c_get_sender INTO r_get_sender;
170: IF c_get_sender%FOUND THEN
171: IF JTM_HOOK_UTIL_PKG.isMobileFSresource(r_get_sender.resource_id) THEN
172: JTM_HOOK_UTIL_PKG.Insert_Acc
173: ( p_publication_item_names => g_publication_item_name
174: , p_acc_table_name => g_acc_table_name
175: , p_pk1_name => g_pk1_name
176: , p_pk1_num_value => p_notification_id
183: END IF;
184: CLOSE c_get_sender;
185: END IF;
186:
187: IF g_debug_level = JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL THEN
188: jtm_message_log_pkg.LOG_MSG
189: ( p_notification_id
190: , g_table_name
191: , 'Leaving Procedure INSERT_NOTIFICATION'
188: jtm_message_log_pkg.LOG_MSG
189: ( p_notification_id
190: , g_table_name
191: , 'Leaving Procedure INSERT_NOTIFICATION'
192: , JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL);
193: END IF;
194:
195: END INSERT_NOTIFICATION;
196: