DBA Data[Home] [Help]

PACKAGE BODY: APPS.PA_INSTALL

Source


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