DBA Data[Home] [Help]

PACKAGE BODY: APPS.POR_REDIRECT

Source


1 PACKAGE BODY POR_REDIRECT AS
2 /* $Header: PORRDIRB.pls 115.38 2004/02/12 00:17:01 tolick ship $*/
3 
4 PROCEDURE REQSERVER(x_source varchar2 default null, -- not used
5                     x_menuFunction varchar2 default null, -- not used
6                     x_responsibilityID varchar2 default null,
7                     x_object varchar2 default null,
8                     x_doc_id number default null,
9                     x_org_id number default null,
10                     x_requester_id number default null,
11             		    x_exp_receipt_date varchar2 default null,
12                     x_param varchar2 default null)
13 IS
14 	l_hostname VARCHAR2(500)     :=NULL;
15 	l_function VARCHAR2(500)     :=NULL;
16 	l_parameter VARCHAR2(500)    :=NULL;
17 	l_redirect_url VARCHAR2(2000):=NULL;
18 	l_progress VARCHAR2(3)       :='000';
19 	l_application_id  NUMBER := NULL;
20 	l_responsibilityID VARCHAR2(80) :=NULL;
21         l_oapb VARCHAR2(25) := '&OAPB=ICX_POR_IP_BRAND';
22         l_wip_entity_id_index NUMBER;
23         l_wip_entity_id VARCHAR2(30);
24         l_oper_seq_num_index NUMBER;
25         l_oper_seq_num VARCHAR2(30);
26 	e_reqserver_not_set EXCEPTION;
27         e_object_not_supported EXCEPTION;
28 
29 
30 
31 BEGIN
32 
33   l_progress :='001';
34 
35   --Obtain the responsibility id from the session if it is null
36 
37   IF  x_responsibilityID is null THEN
38     l_responsibilityID := icx_sec.getID(icx_sec.PV_RESPONSIBILITY_ID);
39   ELSE
40     l_responsibilityID := x_responsibilityID;
41   END IF;
42 
43   BEGIN
44 		select  application_id
45 		into    l_application_id
46 		from    fnd_responsibility
47 		where   responsibility_id = l_responsibilityID;
48       EXCEPTION
49 		WHEN OTHERS THEN
50 		l_application_id := NULL;
51   END;
52 
53 	/* id application id is set to null, then site level profile is
54        returned */
55   l_hostname := fnd_profile.value_specific('APPS_FRAMEWORK_AGENT',NULL,l_responsibilityid,l_application_id);
56 
57   IF l_hostname is NULL THEN
58     RAISE e_reqserver_not_set;
59   END IF;
60 
61   l_progress :='002';
62 
63   l_function := '/OA_HTML/OA.jsp?OAFunc=ICX_POR_LAUNCH_IP';
64 
65   -- from approver checkout notification
66   IF (x_object = 'Order') THEN
67     l_progress :='003';
68     l_parameter := 'porReqHeaderId=' || to_char(x_doc_id) || '&' ||
69       'porMode=approverLoad';
70 
71   -- from view req notification
72   ELSIF (x_object = 'ReqsQueryOrder') THEN
73     l_progress :='004';
74     l_parameter := 'porReqHeaderId=' || to_char(x_doc_id) || '&' ||
75       'porMode=viewReq';
76 
77   -- from confirm receipt notification
78   ELSIF (x_object = 'ConfirmReceipt') THEN
79     l_progress :='005';
80     l_parameter := 'porOrderHeaderId=' ||to_char(x_doc_id) || '&' ||
81       'porMode=confirmReceipt' ;
82 
83     IF (x_requester_id is not null) THEN
84       l_parameter := l_parameter || '&' || 'porRequesterId=' ||to_char(x_requester_id) || '&';
85     END IF;
86 
87     IF (x_exp_receipt_date is not null) THEN
88       l_parameter := l_parameter || 'porExpectedDate=' ||x_exp_receipt_date|| '&';
89     END IF;
90 
91     IF (x_param is not null) THEN
92       l_parameter := l_parameter || 'porOrderTypeCode=' || x_param || '&';
93     END IF;
94 
95     l_parameter := l_parameter ||  'porDestOrgId=' || x_org_id;
96 
97   -- from EAM forms
98   ELSIF (x_object = 'AppsServlet') THEN
99     l_progress :='006';
100 
101     l_parameter := 'porMode=eamForms';
102 
103     l_wip_entity_id_index := INSTR(x_param, '*@_wipEntityId%3d');
104 
105     l_oper_seq_num_index := INSTR(x_param, '*@_operationSeqNum%3d');
106 
107     IF (l_wip_entity_id_index <> 0 AND l_oper_seq_num_index <> 0) THEN
108       l_wip_entity_id := SUBSTR(x_param, l_wip_entity_id_index + 17,
109         l_oper_seq_num_index - l_wip_entity_id_index - 17);
110 
111       l_oper_seq_num := SUBSTR(x_param, l_oper_seq_num_index + 21,
112         LENGTH(x_param) - l_oper_seq_num_index - 20);
113 
114       l_parameter := l_parameter || '&porWipEntityId=' || l_wip_entity_id ||
115         '&porOperSeqNumber=' || l_oper_seq_num;
116 
117     END IF;
118 
119   ELSE
120     RAISE e_object_not_supported;
121 
122   END IF;
123 
124   l_progress :='010';
125 
126   l_redirect_url:= l_hostname || l_function || '&' || l_parameter || l_oapb;
127 
128   htp.p('<html><body onload="window.location.replace('''|| l_redirect_url || ''');">' ||
129     '</body></html>');
130 
131   EXCEPTION
132     WHEN e_reqserver_not_set THEN
133       htp.p('por_redirect.reqserver '|| 'reqserver_not_set exception ' ||
134       l_progress || ' ' || sqlerrm);
135 
136     WHEN e_object_not_supported THEN
137       htp.p('por_redirect.reqserver '|| 'object_not_supported exception ' ||
138       l_progress || ' x_object=' || x_object);
139 
140     WHEN OTHERS THEN
141       htp.p('por_redirect.reqserver '|| l_progress || ' '|| sqlerrm);
142 END;
143 
144 PROCEDURE process_navigator_redirect IS
145   l_redirect_url varchar2(2000):=NULL;
146   l_function VARCHAR2(500)     :=NULL;
147   l_hostname varchar2(500)     :=NULL;
148   l_progress varchar2(3)       :='000';
149   l_application_id  NUMBER:= NULL;
150   e_reqserver_not_set exception;
151 BEGIN
152 
153   select application_id into l_application_id from fnd_application
154   where application_short_name = 'ICX';
155 
156   l_hostname := fnd_profile.value_specific('APPS_FRAMEWORK_AGENT',NULL,NULL,l_application_id);
157 
158   IF l_hostname is NULL THEN
159     RAISE e_reqserver_not_set;
160   END IF;
161 
162   l_function := '/OA_HTML/OA.jsp?OAFunc=ICX_POR_LAUNCH_IP&porMode=accessHomePage';
163 
164   l_redirect_url:= l_hostname || l_function;
165 
166   htp.p('<html><body onload="window.location.replace('''|| l_redirect_url || ''');">' ||
167     '</body></html>');
168 
169 EXCEPTION
170   WHEN E_REQSERVER_NOT_SET THEN
171 		htp.p('por_redirect.reqserver '|| 'reqserver_not_set exception ' ||
172 		l_progress || ' '|| sqlerrm);
173 
174   WHEN OTHERS THEN
175     NULL;
176 
177 END process_navigator_redirect;
178 
179 
180 END POR_REDIRECT;