1 PACKAGE BODY JTF_RS_TEAM_USAGE_VUHK AS
2 -- $Header: cntmusgb.pls 120.1 2005/08/03 15:21:58 mblum noship $
3
4 -- helper procedure for the MOAC session context
5 PROCEDURE restore_context(p_acc_mode VARCHAR2,
6 p_org_id NUMBER) IS
7 BEGIN
8 IF p_acc_mode IS NOT NULL then
9 mo_global.set_policy_context(p_acc_mode, p_org_id);
10 END IF;
11 END restore_context;
12
13 PROCEDURE create_team_usage_post
14 (P_TEAM_USAGE_ID IN NUMBER,
15 P_TEAM_ID IN NUMBER,
16 P_USAGE IN VARCHAR2,
17 X_RETURN_STATUS OUT NOCOPY VARCHAR2) IS
18
19 t_team_name cn_comp_teams.name%type;
20 t_start_date_active cn_comp_teams.start_date_active%type;
21 t_end_date_active cn_comp_teams.end_date_active%type;
22 l_event_log_id number;
23 l_orig_org_id NUMBER;
24 l_orig_acc_mode VARCHAR2(1);
25
26 -- get team info
27 CURSOR c_team_info IS
28 select name, start_date_active, end_date_active
29 from cn_comp_teams
30 where comp_team_id = P_TEAM_ID;
31
32 -- get orgs
33 CURSOR get_orgs IS
34 SELECT org_id
35 FROM cn_repositories_all
36 WHERE status = 'A';
37
38 BEGIN
39 X_RETURN_STATUS := fnd_api.g_ret_sts_success;
40
41 IF fnd_profile.value('CN_MARK_EVENTS') <> 'Y' THEN
42 RETURN;
43 END IF;
44
45 -- store MOAC session info in local variables
46 l_orig_org_id := mo_global.get_current_org_id;
47 l_orig_acc_mode := mo_global.get_access_mode;
48
49 -- loop through orgs
50 FOR o IN get_orgs LOOP
51 mo_global.set_policy_context('S', o.org_id);
52
53 -- if this is not a sales_comp team, dont have to process it
54 OPEN c_team_info;
55 FETCH c_team_info INTO t_team_name, t_start_date_active, t_end_date_active;
56 IF (c_team_info%notfound) THEN
57 CLOSE c_team_info;
58 ELSE
59 CLOSE c_team_info;
60
61 cn_mark_events_pkg.mark_notify_team
62 (P_TEAM_ID => p_team_id,
63 P_TEAM_EVENT_NAME => 'CHANGE_TEAM_ADD_REP',
64 P_TEAM_NAME => t_team_name,
65 P_START_DATE_ACTIVE => t_start_date_active,
66 P_END_DATE_ACTIVE => t_end_date_active,
67 P_EVENT_LOG_ID => NULL,
68 p_org_id => o.org_id);
69 END IF;
70 END LOOP;
71
72 -- restore context
73 restore_context(l_orig_acc_mode, l_orig_org_id);
74 END create_team_usage_post;
75
76 PROCEDURE delete_team_usage_pre
77 (P_TEAM_ID IN NUMBER,
78 P_USAGE IN VARCHAR2,
79 X_RETURN_STATUS OUT NOCOPY VARCHAR2) IS
80
81 t_team_name cn_comp_teams.name%type;
82 t_start_date_active cn_comp_teams.start_date_active%type;
83 t_end_date_active cn_comp_teams.end_date_active%type;
84 l_event_log_id number;
85 l_orig_org_id NUMBER;
86 l_orig_acc_mode VARCHAR2(1);
87
88 -- get team info
89 CURSOR c_team_info IS
90 select name, start_date_active, end_date_active
91 from cn_comp_teams
92 where comp_team_id = P_TEAM_ID;
93
94 CURSOR get_orgs IS
95 SELECT org_id
96 FROM cn_repositories_all
97 WHERE status = 'A';
98
99 BEGIN
100 X_RETURN_STATUS := fnd_api.g_ret_sts_success;
101
102 IF fnd_profile.value('CN_MARK_EVENTS') <> 'Y' THEN
103 RETURN;
104 END IF;
105
106 -- store MOAC session info in local variables
107 l_orig_org_id := mo_global.get_current_org_id;
108 l_orig_acc_mode := mo_global.get_access_mode;
109
110 -- loop through orgs
111 FOR o IN get_orgs LOOP
112 mo_global.set_policy_context('S', o.org_id);
113
114 OPEN c_team_info;
115 FETCH c_team_info INTO t_team_name, t_start_date_active, t_end_date_active;
116 IF (c_team_info%notfound) THEN
117 CLOSE c_team_info;
118 ELSE
119 CLOSE c_team_info;
120
121 cn_mark_events_pkg.mark_notify_team
122 (P_TEAM_ID => p_team_id,
123 P_TEAM_EVENT_NAME => 'CHANGE_TEAM_DEL_REP',
124 P_TEAM_NAME => t_team_name,
125 P_START_DATE_ACTIVE => t_start_date_active,
126 P_END_DATE_ACTIVE => t_end_date_active,
127 P_EVENT_LOG_ID => NULL,
128 p_org_id => o.org_id);
129 END IF;
130 END LOOP;
131
132 -- restore context
133 restore_context(l_orig_acc_mode, l_orig_org_id);
134 END delete_team_usage_pre;
135
136 PROCEDURE create_team_usage_pre
137 (P_TEAM_ID IN NUMBER,
138 P_USAGE IN VARCHAR2,
139 X_RETURN_STATUS OUT NOCOPY VARCHAR2) IS
140 BEGIN
141 x_return_status := fnd_api.g_ret_sts_success;
142 END create_team_usage_pre;
143
144 PROCEDURE delete_team_usage_post
145 (P_TEAM_ID IN NUMBER,
146 P_USAGE IN VARCHAR2,
147 X_RETURN_STATUS OUT NOCOPY VARCHAR2) IS
148 BEGIN
149 x_return_status := fnd_api.g_ret_sts_success;
150 END delete_team_usage_post;
151
152 END jtf_rs_team_usage_vuhk;
153