[Home] [Help]
PACKAGE BODY: APPS.PER_RET_BUS
Source
1 Package Body per_ret_bus as
2 /* $Header: peretrhi.pkb 115.1 2002/12/06 11:29:20 eumenyio noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_ret_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_cagr_retained_right_id number default null;
15 --
16 -- ---------------------------------------------------------------------------
17 -- |----------------------< set_security_group_id >--------------------------|
18 -- ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21 (p_cagr_retained_right_id in number
22 ) is
23 --
24 -- Declare cursor
25 --
26 cursor csr_sec_grp is
27 select pbg.security_group_id
28 from per_business_groups pbg
29 , per_cagr_retained_rights ret
30 where ret.cagr_retained_right_id = p_cagr_retained_right_id
31 and pbg.business_group_id = ret.business_group_id;
32 --
33 -- Declare local variables
34 --
35 l_security_group_id number;
36 l_proc varchar2(72) := g_package||'set_security_group_id';
37 --
38 begin
39 --
40 hr_utility.set_location('Entering:'|| l_proc, 10);
41 --
42 -- Ensure that all the mandatory parameter are not null
43 --
44 hr_api.mandatory_arg_error
45 (p_api_name => l_proc
46 ,p_argument => 'cagr_retained_right_id'
47 ,p_argument_value => p_cagr_retained_right_id
48 );
49 --
50 open csr_sec_grp;
51 fetch csr_sec_grp into l_security_group_id;
52 --
53 if csr_sec_grp%notfound then
54 --
55 close csr_sec_grp;
56 --
57 -- The primary key is invalid therefore we must error
58 --
59 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
60 fnd_message.raise_error;
61 --
62 end if;
63 close csr_sec_grp;
64 --
65 -- Set the security_group_id in CLIENT_INFO
66 --
67 hr_api.set_security_group_id
68 (p_security_group_id => l_security_group_id
69 );
70 --
71 hr_utility.set_location(' Leaving:'|| l_proc, 20);
72 --
73 end set_security_group_id;
74 --
75 -- ---------------------------------------------------------------------------
76 -- |---------------------< return_legislation_code >-------------------------|
77 -- ---------------------------------------------------------------------------
78 --
79 Function return_legislation_code
80 (p_cagr_retained_right_id in number
81 )
82 Return Varchar2 Is
83 --
84 -- Declare cursor
85 --
86 cursor csr_leg_code is
87 select pbg.legislation_code
88 from per_business_groups pbg
89 , per_cagr_retained_rights ret
90 where ret.cagr_retained_right_id = p_cagr_retained_right_id
91 and pbg.business_group_id (+) = ret.business_group_id;
92 --
93 -- Declare local variables
94 --
95 l_legislation_code varchar2(150);
96 l_proc varchar2(72) := g_package||'return_legislation_code';
97 --
98 Begin
99 --
100 hr_utility.set_location('Entering:'|| l_proc, 10);
101 --
102 -- Ensure that all the mandatory parameter are not null
103 --
104 hr_api.mandatory_arg_error
105 (p_api_name => l_proc
106 ,p_argument => 'cagr_retained_right_id'
107 ,p_argument_value => p_cagr_retained_right_id
108 );
109 --
110 if ( nvl(per_ret_bus.g_cagr_retained_right_id, hr_api.g_number)
111 = p_cagr_retained_right_id) then
112 --
113 -- The legislation code has already been found with a previous
114 -- call to this function. Just return the value in the global
115 -- variable.
116 --
117 l_legislation_code := per_ret_bus.g_legislation_code;
118 hr_utility.set_location(l_proc, 20);
119 else
120 --
121 -- The ID is different to the last call to this function
122 -- or this is the first call to this function.
123 --
124 open csr_leg_code;
125 fetch csr_leg_code into l_legislation_code;
126 --
127 if csr_leg_code%notfound then
128 --
129 -- The primary key is invalid therefore we must error
130 --
131 close csr_leg_code;
132 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
133 fnd_message.raise_error;
134 end if;
135 hr_utility.set_location(l_proc,30);
136 --
137 -- Set the global variables so the values are
138 -- available for the next call to this function.
139 --
140 close csr_leg_code;
141 per_ret_bus.g_cagr_retained_right_id := p_cagr_retained_right_id;
142 per_ret_bus.g_legislation_code := l_legislation_code;
143 end if;
144 hr_utility.set_location(' Leaving:'|| l_proc, 40);
145 return l_legislation_code;
146 end return_legislation_code;
147 --
148 -- ----------------------------------------------------------------------------
149 -- |-----------------------< chk_non_updateable_args >------------------------|
150 -- ----------------------------------------------------------------------------
151 -- {Start Of Comments}
152 --
153 -- Description:
154 -- This procedure is used to ensure that non updateable attributes have
155 -- not been updated. If an attribute has been updated an error is generated.
156 --
157 -- Pre Conditions:
158 -- g_old_rec has been populated with details of the values currently in
159 -- the database.
160 --
161 -- In Arguments:
162 -- p_rec has been populated with the updated values the user would like the
163 -- record set to.
164 --
165 -- Post Success:
166 -- Processing continues if all the non updateable attributes have not
167 -- changed.
168 --
169 -- Post Failure:
170 -- An application error is raised if any of the non updatable attributes
171 -- have been altered.
172 --
173 -- {End Of Comments}
174 -- ----------------------------------------------------------------------------
175 Procedure chk_non_updateable_args
176 (p_effective_date in date
177 ,p_rec in per_ret_shd.g_rec_type
178 ) IS
179 --
180 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
181 l_error EXCEPTION;
182 l_argument varchar2(30);
183 --
184 Begin
185 --
186 -- Only proceed with the validation if a row exists for the current
187 -- record in the HR Schema.
188 --
189 IF NOT per_ret_shd.api_updating
190 (p_cagr_retained_right_id => p_rec.cagr_retained_right_id
191 ,p_object_version_number => p_rec.object_version_number
192 ) THEN
193 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
194 fnd_message.set_token('PROCEDURE ', l_proc);
195 fnd_message.set_token('STEP ', '5');
196 fnd_message.raise_error;
197 END IF;
198 --
199 -- Checks to ensure non-updateable args have
200 -- not been updated.
201 --
202 if nvl(p_rec.cagr_entitlement_result_id, hr_api.g_number) <>
203 nvl(per_ret_shd.g_old_rec.cagr_entitlement_result_id
204 ,hr_api.g_number) then
205 l_argument := 'cagr_entitlement_result_id';
206 raise l_error;
207 end if;
208
209 if nvl(p_rec.assignment_id, hr_api.g_number) <>
210 nvl(per_ret_shd.g_old_rec.assignment_id
211 ,hr_api.g_number) then
212 l_argument := 'assignment_id';
213 raise l_error;
214 end if;
215
216 if nvl(p_rec.start_date, hr_api.g_date) <>
217 nvl(per_ret_shd.g_old_rec.start_date
218 ,hr_api.g_date) then
219 l_argument := 'start_date';
220 raise l_error;
221 end if;
222
223 if nvl(p_rec.collective_agreement_id, hr_api.g_number) <>
224 nvl(per_ret_shd.g_old_rec.collective_agreement_id
225 ,hr_api.g_number) then
226 l_argument := 'collective_agreement_id';
227 raise l_error;
228 end if;
229
230 if nvl(p_rec.cagr_entitlement_item_id, hr_api.g_number) <>
231 nvl(per_ret_shd.g_old_rec.cagr_entitlement_item_id
232 ,hr_api.g_number) then
233 l_argument := 'cagr_entitlement_item_id';
234 raise l_error;
235 end if;
236
237 if nvl(p_rec.element_type_id, hr_api.g_number) <>
238 nvl(per_ret_shd.g_old_rec.element_type_id
239 ,hr_api.g_number) then
240 l_argument := 'element_type_id';
241 raise l_error;
242 end if;
243
244 if nvl(p_rec.input_value_id, hr_api.g_number) <>
245 nvl(per_ret_shd.g_old_rec.input_value_id
246 ,hr_api.g_number) then
247 l_argument := 'input_value_id';
248 raise l_error;
249 end if;
250
251 if nvl(p_rec.cagr_api_id, hr_api.g_number) <>
252 nvl(per_ret_shd.g_old_rec.cagr_api_id
253 ,hr_api.g_number) then
254 l_argument := 'cagr_api_id';
255 raise l_error;
256 end if;
257
258 if nvl(p_rec.cagr_api_param_id, hr_api.g_number) <>
259 nvl(per_ret_shd.g_old_rec.cagr_api_param_id
260 ,hr_api.g_number) then
261 l_argument := 'cagr_api_param_id';
262 raise l_error;
263 end if;
264
265 if nvl(p_rec.category_name, hr_api.g_varchar2) <>
266 nvl(per_ret_shd.g_old_rec.category_name
267 ,hr_api.g_varchar2) then
268 l_argument := 'category_name';
269 raise l_error;
270 end if;
271
272 if nvl(p_rec.freeze_flag, hr_api.g_varchar2) <>
273 nvl(per_ret_shd.g_old_rec.freeze_flag
274 ,hr_api.g_varchar2) then
275 l_argument := 'freeze_flag';
276 raise l_error;
277 end if;
278
279 if nvl(p_rec.cagr_entitlement_id, hr_api.g_number) <>
280 nvl(per_ret_shd.g_old_rec.cagr_entitlement_id
281 ,hr_api.g_number) then
282 l_argument := 'cagr_entitlement_id';
283 raise l_error;
284 end if;
285
286 if nvl(p_rec.cagr_entitlement_line_id, hr_api.g_number) <>
287 nvl(per_ret_shd.g_old_rec.cagr_entitlement_line_id
288 ,hr_api.g_number) then
289 l_argument := 'cagr_entitlement_line_id';
290 raise l_error;
291 end if;
292
293 if nvl(p_rec.value, hr_api.g_varchar2) <>
294 nvl(per_ret_shd.g_old_rec.value
295 ,hr_api.g_varchar2) then
296 l_argument := 'value';
297 raise l_error;
298 end if;
299
300 if nvl(p_rec.units_of_measure, hr_api.g_varchar2) <>
301 nvl(per_ret_shd.g_old_rec.units_of_measure
302 ,hr_api.g_varchar2) then
303 l_argument := 'units_of_measure';
304 raise l_error;
305 end if;
306
307 if nvl(p_rec.grade_spine_id, hr_api.g_number) <>
308 nvl(per_ret_shd.g_old_rec.grade_spine_id
309 ,hr_api.g_number) then
310 l_argument := 'grade_spine_id';
311 raise l_error;
312 end if;
313
314 if nvl(p_rec.parent_spine_id, hr_api.g_number) <>
315 nvl(per_ret_shd.g_old_rec.parent_spine_id
316 ,hr_api.g_number) then
317 l_argument := 'parent_spine_id';
318 raise l_error;
319 end if;
320
321 if nvl(p_rec.step_id , hr_api.g_number) <>
322 nvl(per_ret_shd.g_old_rec.step_id
323 ,hr_api.g_number) then
324 l_argument := 'step_id ';
325 raise l_error;
326 end if;
327
328 if nvl(p_rec.oipl_id, hr_api.g_number) <>
329 nvl(per_ret_shd.g_old_rec.oipl_id
330 ,hr_api.g_number) then
331 l_argument := 'oipl_id';
332 raise l_error;
333 end if;
334
335 if nvl(p_rec.column_type, hr_api.g_varchar2) <>
336 nvl(per_ret_shd.g_old_rec.column_type
337 ,hr_api.g_varchar2) then
338 l_argument := 'column_type';
339 raise l_error;
340 end if;
341
342 if nvl(p_rec.column_size, hr_api.g_number) <>
343 nvl(per_ret_shd.g_old_rec.column_size
344 ,hr_api.g_number) then
345 l_argument := 'column_size';
346 raise l_error;
347 end if;
348
349 if nvl(p_rec.business_group_id, hr_api.g_number) <>
350 nvl(per_ret_shd.g_old_rec.business_group_id
351 ,hr_api.g_number) then
352 l_argument := 'business_group_id';
353 raise l_error;
354 end if;
355
356 if nvl(p_rec.eligy_prfl_id, hr_api.g_number) <>
357 nvl(per_ret_shd.g_old_rec.eligy_prfl_id
358 ,hr_api.g_number) then
359 l_argument := 'eligy_prfl_id';
360 raise l_error;
361 end if;
362
363 if nvl(p_rec.formula_id, hr_api.g_number) <>
364 nvl(per_ret_shd.g_old_rec.formula_id
365 ,hr_api.g_number) then
366 l_argument := 'formula_id';
367 raise l_error;
368 end if;
369
370 if nvl(p_rec.flex_value_set_id, hr_api.g_number) <>
371 nvl(per_ret_shd.g_old_rec.flex_value_set_id
372 ,hr_api.g_number) then
373 l_argument := 'flex_value_set_id';
374 raise l_error;
375 end if;
376
377
378 EXCEPTION
379 WHEN l_error THEN
380 hr_api.argument_changed_error
381 (p_api_name => l_proc
382 ,p_argument => l_argument);
383 WHEN OTHERS THEN
384 RAISE;
385 End chk_non_updateable_args;
386 --
387 -- ----------------------------------------------------------------------------
388 -- |---------------------------< insert_validate >----------------------------|
389 -- ----------------------------------------------------------------------------
390 Procedure insert_validate
391 (p_effective_date in date
392 ,p_rec in per_ret_shd.g_rec_type
393 ) is
394 --
395 l_proc varchar2(72) := g_package||'insert_validate';
396 --
397 Begin
398 hr_utility.set_location('Entering:'||l_proc, 5);
399 --
400 -- Call all supporting business operations
401 --
402 -- ensure lookup validation fires when BG is not null
403 --
404 if p_rec.business_group_id is not null then
405 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
406 end if;
407
408
409 --
410 --
411 hr_utility.set_location(' Leaving:'||l_proc, 10);
412 End insert_validate;
413 --
414 -- ----------------------------------------------------------------------------
415 -- |---------------------------< update_validate >----------------------------|
416 -- ----------------------------------------------------------------------------
417 Procedure update_validate
418 (p_effective_date in date
419 ,p_rec in per_ret_shd.g_rec_type
420 ) is
421 --
422 l_proc varchar2(72) := g_package||'update_validate';
423 --
424 Begin
425 hr_utility.set_location('Entering:'||l_proc, 5);
426 --
427 -- Call all supporting business operations
428 --
429 if p_rec.business_group_id is not null then
430 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
431 end if;
432 --
433 chk_non_updateable_args
434 (p_effective_date => p_effective_date
435 ,p_rec => p_rec
436 );
437 --
438 --
439 hr_utility.set_location(' Leaving:'||l_proc, 10);
440 End update_validate;
441 --
442 -- ----------------------------------------------------------------------------
443 -- |---------------------------< delete_validate >----------------------------|
444 -- ----------------------------------------------------------------------------
445 Procedure delete_validate
446 (p_rec in per_ret_shd.g_rec_type
447 ) is
448 --
449 l_proc varchar2(72) := g_package||'delete_validate';
450 --
451 Begin
452 hr_utility.set_location('Entering:'||l_proc, 5);
453 --
454 -- Call all supporting business operations
455 --
456 hr_utility.set_location(' Leaving:'||l_proc, 10);
457 End delete_validate;
458 --
459 end per_ret_bus;