[Home] [Help]
PACKAGE BODY: APPS.FND_CONC_CONNECT
Source
1 package body FND_CONC_CONNECT as
2 /* $Header: AFCPUTOB.pls 120.3.12020000.2 2012/07/13 20:47:31 pferguso ship $ */
3
4
5 function get_domain(web_agent in varchar2) return varchar2 is
6 pos number;
7 l_domain_count number;
8 server_name varchar2(240);
9 cookie_domain varchar2(240);
10
11 begin
12 -- strip file path from base URL
13 pos := instr(web_agent, '/', 1, 3);
14 if ( pos > 0 ) then
15 server_name := substr( web_agent, 1, pos -1 );
16 end if;
17
18 pos := instr( server_name, ':', 1, 2);
19 if ( pos > 0 ) then
20 server_name := substr( server_name, 1, pos - 1);
21 end if;
22
23 pos := instr( server_name, '//', 1, 1);
24 if ( pos > 0 ) then
25 server_name := substr( server_name, pos +1, length(server_name) );
26 end if;
27
28 l_domain_count := instr(server_name,'.',-1,2);
29
30 if l_domain_count > 0
31 then
32 l_domain_count := instr(server_name,'.',1,1);
33 server_name := substr(server_name,l_domain_count,length(server_name));
34 l_domain_count := instr(server_name,'.',-1,3);
35 IF l_domain_count > 0 THEN
36 server_name := substr(server_name,l_domain_count,length(server_name));
37 END IF;
38 cookie_domain := server_name;
39 else
40 cookie_domain := '';
41 end if;
42
43 return cookie_domain;
44
45 end;
46
47 procedure srs_url( function_name in varchar2,
48 c_name in out nocopy varchar2,
49 c_domain in out nocopy varchar2,
50 c_value in out nocopy varchar2,
51 oa_url in out nocopy varchar2,
52 parameters in varchar2) is
53
54 l_session number;
55 encrypt_func varchar2(30);
56 web_agent varchar2(2000);
57 resp_appl_id number;
58 resp_id number;
59 func_id number;
60 l_user_id number;
61 l_sec_grp_id number;
62 l_func varchar2(30);
63 no_sys_priv exception;
64 no_function exception;
65 begin
66
67 l_user_id := fnd_global.user_id;
68 l_sec_grp_id := fnd_global.SECURITY_GROUP_ID;
69 l_session := icx_sec.createSession(l_user_id);
70
71 fnd_profile.get('APPS_WEB_AGENT', web_agent);
72
73 if ( length(web_agent) > 0 ) then
74 if ( substr(web_agent,-1, 1) <> '/') then
75 web_agent := web_agent || '/';
76 end if;
77 end if;
78
79 if ( l_session > 0 ) then
80
81 c_name := icx_sec.getsessioncookiename;
82
83 -- bug#:2218603, getsessioncookiedomain raising exception
84 begin
85 c_domain := icx_sec.getsessioncookiedomain;
86 exception
87 when others then
88 c_domain := '';
89 end;
90
91 c_value := icx_call.encrypt3(l_session);
92
93 if ((c_domain is NULL) or (c_domain = '') or (c_domain = '-1')) then
94 c_domain := get_domain(web_agent);
95 end if;
96
97 begin
98
99 -- select r.application_id,
100 -- r.responsibility_id
101 -- into resp_appl_id,
102 -- resp_id
103 -- from fnd_responsibility r,
104 -- fnd_user_resp_groups u
105 -- where u.user_id = l_user_id
106 -- and u.responsibility_id = r.responsibility_id
107 -- and u.responsibility_application_id = r.application_id
108 -- and r.responsibility_key='SYSTEM_ADMINISTRATION'
109 -- and r.version = 'W'
110 -- and r.start_date <= sysdate
111 -- and (r.end_date is null or r.end_date > sysdate)
112 -- and u.start_date <= sysdate
113 -- and (u.end_date is null or u.end_date > sysdate);
114 --
115 -- bug5007493
116 -- performance update
117
118 -- bug 5693125
119 -- Replaced WF_LOCAL_USER_ROLES in the query with WF_LOCAL_ROLES and WF_USER_ROLES
120
121 select r.application_id, r.responsibility_id
122 into resp_appl_id, resp_id
123 from fnd_responsibility r,
124 fnd_user u, wf_user_roles wur,wf_local_roles wr
125 where r.responsibility_key = 'SYSTEM_ADMINISTRATION'
126 and r.responsibility_id = wur.role_orig_system_id
127 and r.application_id = (select application_id
128 from fnd_application
129 where application_short_name =/* Val between 1st and 2nd separator */
130 replace(
131 substr(WUR.ROLE_NAME,
132 INSTR(WUR.ROLE_NAME, '|', 1, 1)+1,
133 ( INSTR(WUR.ROLE_NAME, '|', 1, 2)
134 -INSTR(WUR.ROLE_NAME, '|', 1, 1)-1)
135 )
136 ,'%col', ':')
137 )
138 and wur.role_orig_system = 'FND_RESP'
139 and wur.partition_id = 2
140 and u.user_id = l_user_id
141 and wur.user_name = u.user_name
142 and wur.role_name=wr.name
143 and wur.role_orig_system=wr.orig_system
144 and wur.role_orig_system_id=wr.orig_system_id
145 and r.version = 'W'
146 and r.start_date <= sysdate
147 and (r.end_date is null or r.end_date > sysdate)
148 and (wr.start_date is null or (trunc(wr.start_date) <= trunc(sysdate)))
149 and (wr.expiration_date is null or (trunc(wr.expiration_date) <= trunc(sysdate)))
150 and u.start_date <= sysdate
151 and (u.end_date is null or u.end_date > sysdate);
152
153 exception
154 when no_data_found then
155 raise no_sys_priv;
156 when others then
157 raise;
158
159 end;
160
161 -- if function_name is not passed then use default FNDCPSRSSSWA
162 if ( function_name is null ) then
163 l_func := 'FNDCPSRSSSWA';
164 else
165 l_func := function_name;
166 end if;
167
168 begin
169 select function_id
170 into func_id
171 from fnd_form_functions
172 where function_name = l_func;
173
174 exception
175 when no_data_found then
176 raise no_function;
177 when others then
178 raise;
179
180 end;
181
182 -- encrypt_func := icx_call.encrypt2(resp_appl_id||'*'||resp_id||'*'||fnd_global.security_group_id||'*'||func_id||'*9999**]', l_session);
183
184
185 -- oa_url := web_agent || 'OracleApps.RF?F=' || encrypt_func;
186 oa_url := icx_sec.createRFURL(p_function_id=> func_id,
187 p_application_id=>resp_appl_id,
188 p_responsibility_id=>resp_id,
189 p_security_group_id=>l_sec_grp_id,
190 p_session_id=>l_session,
191 p_parameters=>parameters);
192
193
194 commit;
195
196 end if;
197
198 exception
199 when no_sys_priv then
200 fnd_message.set_name('FND', 'CONC-NO ICX SYSTEM ADMIN PRIV');
201 when no_function then
202 fnd_message.set_name('FND', 'CONC-FUNCTION NOT AVAILABLE');
203 fnd_message.set_token('FUNCTION', l_func, FALSE);
204 when others then
205 fnd_message.set_name ('FND', 'SQL-Generic error');
206 fnd_message.set_token ('ERRNO', sqlcode, FALSE);
207 fnd_message.set_token ('REASON', sqlerrm, FALSE);
208 fnd_message.set_token ('ROUTINE', 'FND_CONC_CONNECT: srs_url', FALSE);
209 end;
210
211 end FND_CONC_CONNECT;