[Home] [Help]
PACKAGE BODY: APPS.AP_WEB_INFRASTRUCTURE_PKG
Source
1 PACKAGE BODY AP_WEB_INFRASTRUCTURE_PKG AS
2 /* $Header: apwinfrb.pls 120.11 2005/10/02 20:15:50 albowicz ship $ */
3
4 -- Global variables
5 c_imagePath varchar2(100) := null;
6 c_HTMLPath varchar2(100) := null;
7 c_CSSPath varchar2(100) := null;
8 c_dcdName varchar2(100):= null;
9 c_langCode varchar2(100):= null;
10 c_dateFormat varchar2(100):=null;
11 c_enableNewTaxFields BOOLEAN := FALSE;
12
13
14 /*
15 Written by:
16 Quan Le
17 Purpose:
18 To initialize all data for the current session.
19 Output:
20 None
21 Input Output:
22 None
23 Assumption:
24 None.
25 Date:
26 4/10/99
27 */
28 PROCEDURE initAll IS
29 l_debugInfo varchar2(240) := 'Get language code';
30 l_languageCode varchar2(10) ;
31 BEGIN
32 c_imagePath := '/OA_MEDIA/';
33 c_HTMLPath := '/OA_HTML/';
34 -- c_CSSPath := '/OA_HTML/US/';
35
36 l_debugInfo := 'Get dcdName';
37 -- c_dcdName := owa_util.get_cgi_env('SCRIPT_NAME');
38 c_dcdName := rtrim(FND_WEB_CONFIG.PLSQL_AGENT, '/'); -- bug 1960936
39
40 -- Bug 3629683 : Replacing the calls to icx_sec.getID since they
41 -- are causing a problem in Japanese language.
42 -- c_langCode := icx_sec.getID(icx_sec.PV_LANGUAGE_CODE);
43 -- c_dateFormat := icx_sec.getID(icx_sec.PV_DATE_FORMAT);
44
45 SELECT LANGUAGE_CODE
46 INTO l_languageCode
47 FROM FND_LANGUAGES
48 WHERE INSTALLED_FLAG = 'B';
49
50 c_langCode := nvl(icx_sec.g_language_code, l_languageCode);
51 c_dateFormat := nvl(icx_sec.g_date_format,icx_sec.getNLS_PARAMETER('NLS_DATE_FORMAT'));
52
53 c_enableNewTaxFields := FALSE;
54
55 -- Bug 1505282
56 c_CSSPath := '/OA_HTML/' || c_langCode || '/';
57
58 EXCEPTION
59 WHEN OTHERS THEN
60 BEGIN
61 FND_MESSAGE.SET_NAME('SQLAP','AP_DEBUG');
62 FND_MESSAGE.SET_TOKEN('ERROR',SQLERRM);
63 FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE', 'initAll');
64 FND_MESSAGE.SET_TOKEN('DEBUG_INFO',l_debugInfo);
65 AP_WEB_UTILITIES_PKG.DisplayException(fnd_message.get);
66 END;
67 END initAll;
68
69 /*
70 Written by:
71 Quan Le
72 Purpose:
73 To return the path by the current session.
74 Output:
75 None
76 Input Output:
77 None
78 Assumption:
79 None.
80 Date:
81 4/10/99
82 */
83 FUNCTION getImagePath RETURN VARCHAR2
84 IS
85 BEGIN
86 return c_imagePath;
87 END getImagePath;
88
89 FUNCTION getHTMLPath RETURN VARCHAR2
90 IS
91 BEGIN
92 return c_HTMLPath;
93 END getHTMLPath;
94
95 FUNCTION getCSSPath RETURN VARCHAR2
96 IS
97 BEGIN
98 return c_CSSPath;
99 END getCSSPath;
100
101 FUNCTION getDCDName RETURN VARCHAR2
102 IS
103 BEGIN
104 return c_dcdName;
105 END getDCDName;
106
107 FUNCTION getLangCode RETURN VARCHAR2
108 IS
109 BEGIN
110 return c_langCode;
111 END getLangCode;
112
113 FUNCTION getDateFormat RETURN VARCHAR2
114 IS
115 BEGIN
116 return c_dateFormat;
117 END getDateFormat;
118
119 FUNCTION getEnableNewTaxFields RETURN BOOLEAN
120 IS
121 BEGIN
122 return c_enableNewTaxFields;
123 END getEnableNewTaxFields;
124
125 PROCEDURE JumpIntoFunction(p_id IN NUMBER,
126 p_mode IN VARCHAR2,
127 p_url OUT NOCOPY VARCHAR2) IS
128 l_org_id AP_WEB_DB_EXPRPT_PKG.expHdr_orgID;
129 l_function_code VARCHAR2(30);
130 l_debug_info VARCHAR2(200);
131 l_item_type VARCHAR2(100) := 'APEXP';
132 l_submit_from_oie VARCHAR2(1);
133
134 BEGIN
135
136 ---------------------------------
137 l_debug_info := 'Mode = EXPENSE REPORT';
138 ---------------------------------
139 IF (p_mode = 'EXPENSE REPORT') THEN
140
141 -- for bug 1652106
142 -- get org id from item attribute instead of from report header
143
144 ---------------------------------
145 l_debug_info := 'Getting ORG_ID';
146 ---------------------------------
147 begin
148 l_org_id := WF_ENGINE.GetItemAttrNumber(l_item_type,
149 p_id,
150 'ORG_ID');
151
152 exception
153 when others then
154 if (wf_core.error_name = 'WFENG_ITEM_ATTR') then
155 -- ORG_ID item attribute doesn't exist, need to add it
156 WF_ENGINE.AddItemAttr(l_item_type, p_id, 'ORG_ID');
157 IF (AP_WEB_DB_EXPRPT_PKG.GetOrgIdByReportHeaderId(
158 p_id,
159 l_org_id) <> TRUE ) THEN
160 l_org_id := NULL;
161 END IF;
162
163 WF_ENGINE.SetItemAttrNumber(l_item_type,
164 p_id,
165 'ORG_ID',
166 l_org_ID);
167 else
168 raise;
169 end if;
170
171 end;
172
173 ---------------------------------
174 l_debug_info := 'Getting SUBMIT_FROM_OIE';
175 ---------------------------------
176 begin
177 l_submit_from_oie := WF_ENGINE.GetItemAttrText(l_item_type,
178 p_id,
179 'SUBMIT_FROM_OIE');
180 exception
181 when others then
182 if (wf_core.error_name = 'WFENG_ITEM_ATTR') then
183 -- SUBMIT_FROM_OIE item attribute doesn't exist, need to add it
184 WF_ENGINE.AddItemAttr(l_item_type, p_id, 'SUBMIT_FROM_OIE');
185 else
186 raise;
187 end if;
188
189 end;
190
191 /* Bug 2694616 : Removed reference to ICX_OIE_OPEN_EXP */
192 if (l_submit_from_oie <> AP_WEB_EXPENSE_WF.C_SUBMIT_FROM_OIE) then
193 -----------------------------------------------
194 l_debug_info := 'use ICX_AP_WEB_OPEN_EXP function';
195 -----------------------------------------------
196 l_function_code := 'ICX_AP_WEB_OPEN_EXP';
197 end if;
198
199 ELSIF (p_mode = 'PCARD EMP VERI') THEN
200 -- chiho:p-card related, ignored:
201 SELECT distinct(nvl(fl.org_id,fd.org_id))
202 INTO l_org_id
203 FROM ap_expense_feed_lines_all fl,
204 ap_expense_feed_dists_all fd
205 WHERE fl.employee_verification_id = p_id
206 OR (fd.feed_line_id = fl.feed_line_id AND
207 fd.employee_verification_id = p_id);
208
209 l_function_code := 'ICX_AP_WEB_OPEN_PCARD_TRANS';
210
211 ELSIF (p_mode = 'PCARD MANAGER APPR') THEN
212 -- chiho:p-card related, ignored:
213 SELECT distinct(org_id)
214 INTO l_org_id
215 FROM ap_expense_feed_dists_all
216 WHERE manager_approval_id = p_id;
217
218 l_function_code := 'ICX_AP_WEB_OPEN_PCARD_TRANS';
219
220 END IF;
221
222 -----------------------------------------------
223 l_debug_info := 'If OIE then strip url and append OA.jsp call';
224 -----------------------------------------------
225 /* Bug 2694616 : Added JSP: to the url being formed. */
226
227 if (p_mode = 'EXPENSE REPORT' and
228 l_submit_from_oie = AP_WEB_EXPENSE_WF.C_SUBMIT_FROM_OIE) then
229 /*
230 strip url and append OA.jsp call for Expense Lines page
231 */
232 /* Bug 2832919 : Added parameter retainAM=Y */
233 /* Bug 4082366 : Added parameter OIERefreshAM=Y */
234 p_url := 'JSP:/OA_HTML/OA.jsp?akRegionCode=OIEMAINPAGE'
235 ||'&' || 'akRegionApplicationId=200'
236 ||'&' || 'CurrentPage=OIEConfirmPage'
237 ||'&' || 'retainAM=Y'
238 ||'&' || 'OIERefreshAM=Y'
239 ||'&' || 'startFrom=WF'
240 ||'&' || 'ReportHeaderId='||p_id
241 ||'&' || 'NtfId=-' || '&' || '#NID-';
242 else
243 -----------------------------------------------
244 l_debug_info := 'Calling ICX JumpIntoFunction';
245 -----------------------------------------------
246 p_url := ICX_SEC.jumpIntoFunction(
247 p_application_id => 200,
248 p_function_code => l_function_code,
249 p_parameter1 => to_char(p_id),
250 p_parameter2 => p_mode,
251 p_parameter11 => to_char(l_org_id));
252
253 end if;
254
255 EXCEPTION
256 WHEN OTHERS THEN
257 Wf_Core.Context('AP_WEB_INFRASTRUCTURE_PKG', 'JumpIntoFunction',
258 'APEXP', to_char(p_id), to_char(0), l_debug_info);
259 raise;
260 END JumpIntoFunction;
261
262 PROCEDURE ICXSetOrgContext(p_session_id IN VARCHAR2,
263 p_org_id IN VARCHAR2) IS
264 l_debug_info VARCHAR2(200);
265 BEGIN
266
267 ----------------------------------------------
268 l_debug_info := 'Calling ICX Set_Org_context';
269 ----------------------------------------------
270 icx_sec.set_org_context(p_session_id, icx_call.decrypt(p_org_id));
271
272 EXCEPTION
273 WHEN OTHERS THEN
274 Wf_Core.Context('AP_WEB_INFRASTRUCTURE_PKG', 'ICXGetOrgContext',
275 'APEXP', null , to_char(0), l_debug_info);
276 raise;
277 END ICXSetOrgContext;
278
279
280
281
282 FUNCTION GetICXApplicationId RETURN NUMBER IS
283 BEGIN
284 return 178;
285 END GetICXApplicationId;
286
287 function validateSession(p_func in varchar2 default null,
288 p_commit in boolean default TRUE,
289 p_update in boolean default TRUE) return boolean is
290
291 begin
292
293 return icx_sec.validatesession(p_func, '', p_commit, p_update);
294
295 -- return true;
296
297 end;
298
299 --------------------------------------------------------------------------
300 FUNCTION GetDirectionAttribute RETURN VARCHAR2 IS
301 --------------------------------------------------------------------------
302 l_sDirection VARCHAR2(20);
303
304 BEGIN
305 -- Obtain direction
306 -- Defined to be 'LTR' for now. This is a placeholder until cabo or
307 -- ICX comes up with an api that determines the direction from the
308 -- given language.
309 l_sDirection := 'LTR';
310
311 RETURN (l_sDirection);
312 END GetDirectionAttribute;
313
314
315 BEGIN
316 -- initialize all the data
317 --Bug 3426625:Call FND_GLOBAL.Apps_Initialize before all initialization.
318
319 FND_GLOBAL.Apps_Initialize(FND_GLOBAL.USER_ID,
320 FND_GLOBAL.RESP_ID,
321 FND_GLOBAL.RESP_APPL_ID);
322 initAll;
323
324 END AP_WEB_INFRASTRUCTURE_PKG;