1 PACKAGE BODY PA_INSTALL AS
2 /* $Header: PAXINSB.pls 120.2.12010000.2 2009/06/23 23:57:07 cklee ship $ */
3
4 CRL_INSTALLED BOOLEAN :=NULL ;
5 -- ==========================================================================
6 -- = FUNCTION is_pji_installed
7 -- This function is used to indicate if Utilization Consolidation
8 -- patch is applied or not. If the function returns 'Y' then
9 -- it means the PJI utilization model is implemented, otherwise
10 -- old PJR utilization model is used. This API is used to alter
11 -- menu's and concurrent programs with different PA responsibilities
12 -- ==========================================================================
13
14 FUNCTION is_pji_installed RETURN VARCHAR2
15 IS
16 l_pji_installed VARCHAR2(2);
17 l_meaning VARCHAR2(80);
18 BEGIN
19
20 SELECT meaning
21 INTO l_meaning
22 FROM fnd_lookup_values
23 WHERE lookup_type = 'PA_RES_UTIL_DEF_PERIOD_TYPES'
24 AND lookup_code = 'GE'
25 and view_application_id = 275 -- 06/23/09 cklee fixed bug: 6708599
26 AND language = 'US';
27
28 IF l_meaning like 'Enterprise%' THEN
29 l_pji_installed := 'Y';
30 ELSE
31 l_pji_installed := 'N';
32 END IF;
33
34 return(l_pji_installed);
35
36 /* Bug : 3558604
37
38 select count(*)
39 into l_count
40 from fnd_tables
41 where application_id = 1292
42 and rownum = 1
43 ;
44
45 if (l_count = 0 ) then
46 l_pji_installed := 'N';
47 else
48 l_pji_installed := 'Y';
49 end if;
50 return(l_pji_installed); */
51
52 EXCEPTION
53 when OTHERS then
54 return('N');
55 END is_pji_installed;
56
57 -- ==========================================================================
58 -- = FUNCTION is_pji_licensed
59 -- ==========================================================================
60
61 FUNCTION is_pji_licensed RETURN VARCHAR2
62 IS
63 x_pji_installed VARCHAR2(2);
64 x_status VARCHAR2(1) :=NULL ;
65 BEGIN
66
67 select p.status
68 into x_status
69 from fnd_product_installations p
70 where p.application_id = (select a.application_id
71 from fnd_application a
72 where a.application_short_name = 'PJI'
73 )
74 ;
75
76 if (x_status = 'N' OR x_status is null) then
77 x_pji_installed := 'N';
78 else
79 x_pji_installed := 'Y';
80 end if;
81 return(x_pji_installed);
82
83 EXCEPTION
84 when OTHERS then
85 return('N');
86 END is_pji_licensed;
87
88 -- ==========================================================================
89 -- = FUNCTION is_billing_licensed
90 -- ==========================================================================
91
92 FUNCTION is_billing_licensed RETURN VARCHAR2
93 IS
94 x_pa_billing_installed VARCHAR2(2);
95 BEGIN
96
97 if (fnd_profile.value('PA_BILLING_LICENSED') = 'Y') then
98 x_pa_billing_installed := 'Y';
99 else
100 x_pa_billing_installed := 'N';
101 end if;
102 return(x_pa_billing_installed);
103
104 EXCEPTION
105 when OTHERS then
106 return('N');
107 END is_billing_licensed;
108
109 -- ==========================================================================
110 -- = FUNCTION is_prm_licensed
111 -- ==========================================================================
112
113 FUNCTION is_prm_licensed RETURN VARCHAR2
114 IS
115 x_pa_prm_licensed VARCHAR2(2);
116
117 BEGIN
118
119 if (fnd_profile.value('PA_PRM_LICENSED') = 'Y') then
120 x_pa_prm_licensed := 'Y';
121 else
122 x_pa_prm_licensed := 'N';
123 end if;
124 return(x_pa_prm_licensed);
125
126 EXCEPTION
127 when OTHERS then
128 return('N');
129 END is_prm_licensed;
130
131 -- ==========================================================================
132 -- = FUNCTION is_costing_licensed
133 -- ==========================================================================
134
135 FUNCTION is_costing_licensed RETURN VARCHAR2
136 IS
137 x_pa_costing_installed VARCHAR2(2);
138 l_status fnd_product_installations.status%type;
139 BEGIN
140
141 select status
142 into l_status
143 from fnd_product_installations
144 where application_id = 275;
145
146 if ( l_status = 'I') then
147 x_pa_costing_installed := 'Y';
148 else
149 x_pa_costing_installed := 'N';
150 end if;
151
152 return(x_pa_costing_installed);
153
154 EXCEPTION
155 when OTHERS then
156 return('N');
157 END is_costing_licensed;
158
159 FUNCTION is_product_installed(p_product_short_name IN VARCHAR2)
160 RETURN BOOLEAN
161 is
162 cursor get_application_id is
163 select application_id
164 from fnd_application
165 where application_short_name = p_product_short_name;
166 x_application_id fnd_application.application_id%TYPE;
167
168 Cursor get_installation_status is
169 select nvl(status,'N') from fnd_product_installations
170 where application_id = x_application_id;
171
172 x_status fnd_product_installations.status%TYPE;
173
174 Begin
175 IF p_product_short_name = 'IPA' then
176 if CRL_INSTALLED IS NULL then
177 if fnd_profile.value('PA_CRL_LICENSED')='Y' then
178 CRL_INSTALLED := TRUE ;
179 else
180 CRL_INSTALLED := FALSE ;
181 end if;
182 end if ;
183 return CRL_INSTALLED ;
184 ELSE
185 -- Get the Application_id from the application short name
186 open get_application_id;
187 fetch get_application_id into x_application_id;
188 if(get_application_id%NOTFOUND) then
189 close get_application_id;
190 return FALSE;
191 end if;
192 close get_application_id;
193 -- Get the application_status I - Installed, S - Installed in shared mode, N - Not Installed
194 open get_installation_status;
195 fetch get_installation_status into x_status;
196 if(get_installation_status%NOTFOUND) then
197 close get_installation_status;
198 return FALSE;
199 end if;
200 close get_installation_status;
201
202 if(x_status <> 'N') then
203 return TRUE;
204 else
205 return FALSE;
206 end if;
207 END IF;
208 end is_product_installed;
209
210
211 -- ==========================================================================
212 -- = FUNCTION is_pjt_licensed
213 -- ==========================================================================
214
215 FUNCTION is_pjt_licensed RETURN VARCHAR2
216 IS
217 x_pa_pjt_licensed VARCHAR2(2);
218
219 BEGIN
220
221 return 'Y';
222
223 -- if (fnd_profile.value('PA_PJT_LICENSED') = 'Y') then
224 -- x_pa_pjt_licensed := 'Y';
225 -- else
226 -- x_pa_pjt_licensed := 'N';
227 -- end if;
228 -- return(x_pa_pjt_licensed);
229
230 EXCEPTION
231 when OTHERS then
232 return('N');
233 END is_pjt_licensed;
234
235
236 -- ==========================================================================
237 -- = FUNCTION is_utilization_implemented
238 -- ==========================================================================
239
240 FUNCTION is_utilization_implemented RETURN VARCHAR2
241 IS
242 l_utilization_implemented varchar2(1):= 'N';
243 BEGIN
244 /*
245 ** Check if Utilization is enabled in the system settings
246 ** and also if the PJI load program has been run.
247 */
248 SELECT 'Y' is_pji_setup
249 INTO l_utilization_implemented
250 FROM pji_system_settings
251 WHERE
252 organization_structure_id IS NOT NULL
253 AND org_structure_version_id IS NOT NULL
254 AND config_util_flag='Y'
255 AND EXISTS (
256 SELECT 'Y' is_pji_load_program_run
257 FROM
258 pji_system_parameters
259 WHERE NAME = 'LAST_PJI_EXTR_DATE');
260
261 RETURN l_utilization_implemented;
262
263 EXCEPTION
264 WHEN NO_DATA_FOUND THEN
265 RETURN l_utilization_implemented;
266 WHEN OTHERS THEN
267 /*
268 ** retaining this for backward compatibility
269 */
270 RETURN 'N';
271 END is_utilization_implemented;
272
273 -- ==========================================================================
274 -- = FUNCTION is_ord_mgmt_installed
275 -- ==========================================================================
276 FUNCTION is_ord_mgmt_installed RETURN VARCHAR2
277 IS
278 x_ord_mgmt_installed VARCHAR2(6);
279 x_status VARCHAR2(1) :=NULL ;
280 BEGIN
281
282 select p.status
283 into x_status
284 from fnd_product_installations p
285 where p.application_id = (select a.application_id
286 from fnd_application a
287 where a.application_short_name = 'ONT'
288 ) ;
289
290 if (x_status = 'N' OR x_status is null) then
291 x_ord_mgmt_installed := 'N';
292 else
293 x_ord_mgmt_installed := 'Y';
294 end if;
295 return(x_ord_mgmt_installed);
296
297 EXCEPTION
298 when OTHERS then
299 return('N');
300 END is_ord_mgmt_installed;
301 END PA_INSTALL;