DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_PCV_BUS

Source


1 Package Body irc_pcv_bus as
2 /* $Header: irpcvrhi.pkb 120.0 2005/10/03 14:59:01 rbanda noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  irc_pcv_bus.';  -- Global package name
9 --
10 -- The following two global variables are only to be
11 -- used by the return_legislation_code function.
12 --
13 g_legislation_code            varchar2(150)  default null;
14 g_prof_area_criteria_value_id number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_prof_area_criteria_value_id          in number
22   ,p_associated_column1                   in varchar2 default null
23   ) is
24   --
25   -- Declare local variables
26   --
27   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
28   --
29 begin
30   --
31   hr_utility.set_location('Entering:'|| l_proc, 10);
32   --
33   -- Ensure that all the mandatory parameter are not null
34   --
35   hr_api.mandatory_arg_error
36     (p_api_name           => l_proc
37     ,p_argument           => 'prof_area_criteria_value_id'
38     ,p_argument_value     => p_prof_area_criteria_value_id
39     );
40   --
41   hr_utility.set_location(' Leaving:'|| l_proc, 20);
42   --
43 end set_security_group_id;
44 --
45 --  ---------------------------------------------------------------------------
46 --  |---------------------< return_legislation_code >-------------------------|
47 --  ---------------------------------------------------------------------------
48 --
49 Function return_legislation_code
50   (p_prof_area_criteria_value_id          in     number
51   )
52   Return Varchar2 Is
53   --
54   -- Declare local variables
55   --
56   l_legislation_code  varchar2(150) := 'NONE';
57   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
58   --
59 Begin
60   --
61   hr_utility.set_location('Entering:'|| l_proc, 10);
62   --
63   -- Ensure that all the mandatory parameter are not null
64   --
65   hr_api.mandatory_arg_error
66     (p_api_name           => l_proc
67     ,p_argument           => 'prof_area_criteria_value_id'
68     ,p_argument_value     => p_prof_area_criteria_value_id
69     );
70   --
71   hr_utility.set_location(' Leaving:'|| l_proc, 40);
72   return l_legislation_code;
73 end return_legislation_code;
74 --
75 -- ----------------------------------------------------------------------------
76 -- |-----------------------< chk_non_updateable_args >------------------------|
77 -- ----------------------------------------------------------------------------
78 -- {Start Of Comments}
79 --
80 -- Description:
81 --   This procedure is used to ensure that non updateable attributes have
82 --   not been updated. If an attribute has been updated an error is generated.
83 --
84 -- Pre Conditions:
85 --   g_old_rec has been populated with details of the values currently in
86 --   the database.
87 --
88 -- In Arguments:
89 --   p_rec has been populated with the updated values the user would like the
90 --   record set to.
91 --
92 -- Post Success:
93 --   Processing continues if all the non updateable attributes have not
94 --   changed.
95 --
96 -- Post Failure:
97 --   An application error is raised if any of the non updatable attributes
98 --   have been altered.
99 --
100 -- {End Of Comments}
101 -- ----------------------------------------------------------------------------
102 Procedure chk_non_updateable_args
103   (p_effective_date               in date
104   ,p_rec in irc_pcv_shd.g_rec_type
105   ) IS
106 --
107   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
108 --
109 Begin
110   --
111   -- Only proceed with the validation if a row exists for the current
112   -- record in the HR Schema.
113   --
114   IF NOT irc_pcv_shd.api_updating
115       (p_prof_area_criteria_value_id       => p_rec.prof_area_criteria_value_id
116       ,p_object_version_number             => p_rec.object_version_number
117       ) THEN
118      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
119      fnd_message.set_token('PROCEDURE ', l_proc);
120      fnd_message.set_token('STEP ', '5');
121      fnd_message.raise_error;
122   END IF;
123   --
124   -- Add checks to ensure non-updateable args have
125   --            not been updated.
126   --
127   if p_rec.prof_area_criteria_value_id <>
128        irc_pcv_shd.g_old_rec.prof_area_criteria_value_id then
129      hr_api.argument_changed_error
130      (p_api_name   => l_proc
131      ,p_argument   => 'PROF_AREA_CRITERIA_VALUE_ID'
132      ,p_base_table => irc_pcv_shd.g_tab_nam
133      );
134   end if;
135   --
136   if p_rec.search_criteria_id <>
137        irc_pcv_shd.g_old_rec.search_criteria_id then
138      hr_api.argument_changed_error
139      (p_api_name   => l_proc
140      ,p_argument   => 'SEARCH_CRITERIA_ID'
141      ,p_base_table => irc_pcv_shd.g_tab_nam
142      );
143   end if;
144   --
145 End chk_non_updateable_args;
146 --
147 -- ----------------------------------------------------------------------------
148 -- |------------------------< chk_search_criteria_id >------------------------|
149 -- ----------------------------------------------------------------------------
150 -- {Start Of Comments}
151 --
152 -- Description:
153 --   This procedure is used to ensure that search criteria id exists in
154 --   IRC_SEARCH_CRITERIA
155 --
156 -- Pre Conditions:
157 --
158 -- In Arguments:
159 --   p_search_criteria_id
160 --
161 -- Post Success:
162 --   Processing continues if search criteria id is valid
163 --
164 -- Post Failure:
165 --   An application error is raised if search criteria id is invalid
166 --
167 -- {End Of Comments}
168 -- ----------------------------------------------------------------------------
169 Procedure chk_search_criteria_id
170   (p_search_criteria_id     in irc_prof_area_criteria_values.search_criteria_id%TYPE
171   ) IS
172 --
173   l_proc       varchar2(72) := g_package || 'chk_search_criteria_id';
174   l_search_criteria_id varchar2(1);
175 --
176   cursor csr_search_criteria is
177     select null from irc_search_criteria isc
178     where isc.search_criteria_id = p_search_criteria_id;
179 --
180 begin
181   hr_utility.set_location('Entering:'||l_proc,10);
182   -- Check that search_criteria_id is not null.
183   hr_api.mandatory_arg_error
184     (p_api_name           => l_proc
185     ,p_argument           => 'SEARCH_CRITERIA_ID'
186     ,p_argument_value     => p_search_criteria_id
187     );
188   --
189   hr_utility.set_location(l_proc,20);
190   if p_search_criteria_id is not null then
191     -- Check that search_criteria_id exists in irc_search_criteria.
192     hr_utility.set_location(l_proc,30);
193     open csr_search_criteria;
194     fetch csr_search_criteria into l_search_criteria_id;
195     hr_utility.set_location(l_proc,40);
196     if csr_search_criteria%NOTFOUND then
197       close csr_search_criteria;
198       fnd_message.set_name('PER','IRC_412226_INV_SRCH_CRITERIA');
199       fnd_message.raise_error;
200     end if;
201   end if;
202   close csr_search_criteria;
203   --
204   hr_utility.set_location(' Leaving:'||l_proc,50);
205   exception
206    when app_exception.application_exception then
207     if hr_multi_message.exception_add
208        (p_associated_column1 =>
209          'IRC_PROF_AREA_CRITERIA_VALUES.SEARCH_CRITERIA_ID'
210        ) then
211       hr_utility.set_location(' Leaving:'||l_proc,60);
212       raise;
213     end if;
214   hr_utility.set_location(' Leaving:'||l_proc,70);
215 end chk_search_criteria_id;
216 --
217 -- ----------------------------------------------------------------------------
218 -- |------------------------< chk_professional_area >-------------------------|
219 -- ----------------------------------------------------------------------------
220 -- {Start Of Comments}
221 --
222 -- Description:
223 --   This procedure is used to ensure that professional area exists in
224 --   hr_lookups
225 --
226 -- Pre Conditions:
227 --   g_old_rec has been populated with details of the values currently in
228 --   the database.
229 --
230 -- In Arguments:
231 --  p_professional_area
232 --  p_effective_date
233 --  p_prof_area_criteria_value_id
234 --  p_object_version_number
235 --
236 -- Post Success:
237 --   Processing continues if professional_area is valid.
238 --
239 -- Post Failure:
240 --   An application error is raised if professional_area is invalid.
241 --
242 -- {End Of Comments}
243 -- ----------------------------------------------------------------------------
244 Procedure chk_professional_area
245   (p_professional_area             in irc_prof_area_criteria_values.professional_area%TYPE
246   ,p_effective_date                in date
247   ,p_prof_area_criteria_value_id   in irc_prof_area_criteria_values.prof_area_criteria_value_id%TYPE
248   ,p_object_version_number in irc_prof_area_criteria_values.object_version_number%TYPE
249   ) IS
250 --
251   l_proc              varchar2(72) := g_package || 'chk_professional_area';
252   l_api_updating      boolean;
253   l_ret               boolean;
254 --
255 begin
256   hr_utility.set_location('Entering:'||l_proc,10);
257   --
258   hr_api.mandatory_arg_error
259     (p_api_name           => l_proc
260     ,p_argument           => 'PROFESSIONAL_AREA'
261     ,p_argument_value     => p_professional_area
262     );
263   --
264   hr_utility.set_location(l_proc,20);
265   if p_professional_area is not null then
266     -- Check that professional_area exists in hr_lookups
267     hr_utility.set_location(l_proc,30);
268     l_ret := hr_api.not_exists_in_hr_lookups(
269                                      p_effective_date => p_effective_date
270                                     ,p_lookup_type    => 'IRC_PROFESSIONAL_AREA'
271                                     ,p_lookup_code    => p_professional_area);
272     if l_ret = true then
273       fnd_message.set_name('PER','IRC_412022_BAD_PROF_AREA');
274       fnd_message.raise_error;
275     end if;
276   end if;
277   --
278   hr_utility.set_location(' Leaving:'||l_proc,40);
279   exception
280    when app_exception.application_exception then
281     if hr_multi_message.exception_add
282        (p_associated_column1 => 'IRC_PROF_AREA_CRITERIA_VALUES.PROFESSIONAL_AREA'
283        ) then
284       hr_utility.set_location(' Leaving:'||l_proc,50);
285       raise;
286     end if;
287   hr_utility.set_location(' Leaving:'||l_proc,60);
288 end chk_professional_area;
289 --
290 -- ----------------------------------------------------------------------------
291 -- |---------------------------< insert_validate >----------------------------|
292 -- ----------------------------------------------------------------------------
293 Procedure insert_validate
294   (p_effective_date               in date
295   ,p_rec                          in irc_pcv_shd.g_rec_type
296   ) is
297 --
298   l_proc  varchar2(72) := g_package||'insert_validate';
299 --
300 Begin
301   hr_utility.set_location('Entering:'||l_proc, 5);
302   --
303   -- Call all supporting business operations
304   --
305   --
306   -- No business group context.  HR_STANDARD_LOOKUPS used for validation.
307   --
308   -- Validate Dependent Attributes
309   --
310   hr_utility.set_location(l_proc, 20);
311   hr_api.mandatory_arg_error
312     (p_api_name           => l_proc
313     ,p_argument           => 'EFFECTIVE_DATE'
314     ,p_argument_value     => p_effective_date
315     );
316   --
317   hr_utility.set_location(l_proc, 30);
318   chk_search_criteria_id
319     (p_search_criteria_id => p_rec.search_criteria_id
320     );
321   --
322   hr_utility.set_location(l_proc, 40);
323   irc_pcv_bus.chk_professional_area(
324         p_professional_area           => p_rec.professional_area
325        ,p_effective_date              => p_effective_date
326        ,p_prof_area_criteria_value_id => p_rec.prof_area_criteria_value_id
327        ,p_object_version_number       => p_rec.object_version_number
328        );
329   --
330   hr_utility.set_location(' Leaving:'||l_proc, 10);
331 End insert_validate;
332 --
333 -- ----------------------------------------------------------------------------
334 -- |---------------------------< update_validate >----------------------------|
335 -- ----------------------------------------------------------------------------
336 Procedure update_validate
337   (p_effective_date               in date
338   ,p_rec                          in irc_pcv_shd.g_rec_type
339   ) is
340 --
341   l_proc  varchar2(72) := g_package||'update_validate';
342 --
343 Begin
344   hr_utility.set_location('Entering:'||l_proc, 5);
345   --
346   -- Call all supporting business operations
347   --
348   --
349   -- No business group context.  HR_STANDARD_LOOKUPS used for validation.
350   --
351   -- Validate Dependent Attributes
352   --
353   chk_non_updateable_args
354     (p_effective_date              => p_effective_date
355       ,p_rec              => p_rec
356     );
357   --
358   hr_utility.set_location(' Leaving:'||l_proc, 10);
359 End update_validate;
360 --
361 -- ----------------------------------------------------------------------------
362 -- |---------------------------< delete_validate >----------------------------|
363 -- ----------------------------------------------------------------------------
364 Procedure delete_validate
365   (p_rec                          in irc_pcv_shd.g_rec_type
366   ) is
367 --
368   l_proc  varchar2(72) := g_package||'delete_validate';
369 --
370 Begin
371   hr_utility.set_location('Entering:'||l_proc, 5);
372   --
373   -- Call all supporting business operations
374   --
375   hr_utility.set_location(' Leaving:'||l_proc, 10);
376 End delete_validate;
377 --
378 end irc_pcv_bus;