[Home] [Help]
PACKAGE BODY: APPS.BEN_CEP_BUS
Source
1 Package Body ben_CEP_bus as
2 /* $Header: beceprhi.pkb 120.0 2005/05/28 01:00:07 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_CEP_bus.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_prtn_elig_prfl_id >------|
12 -- ----------------------------------------------------------------------------
13 --
14 -- Description
15 -- This procedure is used to check that the primary key for the table
16 -- is created properly. It should be null on insert and
17 -- should not be able to be updated.
18 --
19 -- Pre Conditions
20 -- None.
21 --
22 -- In Parameters
23 -- prtn_elig_prfl_id PK of record being inserted or updated.
24 -- effective_date Effective Date of session
25 -- object_version_number Object version number of record being
26 -- inserted or updated.
27 --
28 -- Post Success
29 -- Processing continues
30 --
31 -- Post Failure
32 -- Errors handled by the procedure
33 --
34 -- Access Status
35 -- Internal table handler use only.
36 --
37 Procedure chk_prtn_elig_prfl_id(p_prtn_elig_prfl_id in number,
38 p_effective_date in date,
39 p_object_version_number in number) is
40 --
41 l_proc varchar2(72) := g_package||'chk_prtn_elig_prfl_id';
42 l_api_updating boolean;
43 --
44 Begin
45 --
46 hr_utility.set_location('Entering:'||l_proc, 5);
47 --
48 l_api_updating := ben_CEP_shd.api_updating
49 (p_effective_date => p_effective_date,
50 p_prtn_elig_prfl_id => p_prtn_elig_prfl_id,
51 p_object_version_number => p_object_version_number);
52 --
53 if (l_api_updating
54 and nvl(p_prtn_elig_prfl_id,hr_api.g_number)
55 <> ben_CEP_shd.g_old_rec.prtn_elig_prfl_id) then
56 --
57 -- raise error as PK has changed
58 --
59 ben_CEP_shd.constraint_error('BEN_PRTN_ELIG_PRFL_PK');
60 --
61 elsif not l_api_updating then
62 --
63 -- check if PK is null
64 --
65 if p_prtn_elig_prfl_id is not null then
66 --
67 -- raise error as PK is not null
68 --
69 ben_CEP_shd.constraint_error('BEN_PRTN_ELIG_PRFL_PK');
70 --
71 end if;
72 --
73 end if;
74 --
75 hr_utility.set_location('Leaving:'||l_proc, 10);
76 --
77 End chk_prtn_elig_prfl_id;
78 --
79 -- ----------------------------------------------------------------------------
80 -- |------< chk_mndtry_flag >------|
81 -- ----------------------------------------------------------------------------
82 --
83 -- Description
84 -- This procedure is used to check that the lookup value is valid.
85 --
86 -- Pre Conditions
87 -- None.
88 --
89 -- In Parameters
90 -- prtn_elig_prfl_id PK of record being inserted or updated.
91 -- mndtry_flag Value of lookup code.
92 -- effective_date effective date
93 -- object_version_number Object version number of record being
94 -- inserted or updated.
95 --
96 -- Post Success
97 -- Processing continues
98 --
99 -- Post Failure
100 -- Error handled by procedure
101 --
102 -- Access Status
103 -- Internal table handler use only.
104 --
105 Procedure chk_mndtry_flag(p_prtn_elig_prfl_id in number,
106 p_mndtry_flag in varchar2,
107 p_effective_date in date,
108 p_object_version_number in number) is
109 --
110 l_proc varchar2(72) := g_package||'chk_mndtry_flag';
111 l_api_updating boolean;
112 --
113 Begin
114 --
115 hr_utility.set_location('Entering:'||l_proc, 5);
116 --
117 l_api_updating := ben_CEP_shd.api_updating
118 (p_prtn_elig_prfl_id => p_prtn_elig_prfl_id,
119 p_effective_date => p_effective_date,
120 p_object_version_number => p_object_version_number);
121 --
122 if (l_api_updating
123 and p_mndtry_flag
124 <> nvl(ben_CEP_shd.g_old_rec.mndtry_flag,hr_api.g_varchar2)
125 or not l_api_updating)
126 and p_mndtry_flag is not null then
127 --
128 -- check if value of lookup falls within lookup type.
129 --
130 if hr_api.not_exists_in_hr_lookups
131 (p_lookup_type => 'YES_NO',
132 p_lookup_code => p_mndtry_flag,
133 p_effective_date => p_effective_date) then
134 --
135 -- raise error as does not exist as lookup
136 -- Changed to raise 91628
137 fnd_message.set_name('BEN', 'BEN_91628_LOOKUP_TYPE_GENERIC');
138 fnd_message.set_token('FIELD', 'p_mndtry_flag');
139 fnd_message.set_token('VALUE', p_mndtry_flag);
140 fnd_message.set_token('TYPE', 'YES_NO');
141 fnd_message.raise_error;
142
143 --hr_utility.set_message(801,'MNDTRY_FLAG_NOT_EXIST');
144 --hr_utility.raise_error;
145 --
146 end if;
147 --
148 end if;
149 --
150 hr_utility.set_location('Leaving:'||l_proc,10);
151 --
152 end chk_mndtry_flag;
153 --
154 --
155 -- ----------------------------------------------------------------------------
156 -- |------< chk_cmpscore_flag >------|
157 -- ----------------------------------------------------------------------------
158 --
159 -- Description
160 -- This procedure is used to check that the lookup value is valid.
161 --
162 -- Pre Conditions
163 -- None.
164 --
165 -- In Parameters
166 -- prtn_elig_prfl_id PK of record being inserted or updated.
167 -- compute_score_flag Value of lookup code.
168 -- effective_date effective date
169 -- object_version_number Object version number of record being
170 -- inserted or updated.
171 --
172 -- Post Success
173 -- Processing continues
174 --
175 -- Post Failure
176 -- Error handled by procedure
177 --
178 -- Access Status
179 -- Internal table handler use only.
180 --
181 Procedure chk_cmpscore_flag(p_prtn_elig_prfl_id in number,
182 p_compute_score_flag in varchar2,
183 p_effective_date in date,
184 p_object_version_number in number) is
185 --
186 l_proc varchar2(72) := g_package||'chk_cmpscore_flag';
187 l_api_updating boolean;
188 --
189 Begin
190 --
191 hr_utility.set_location('Entering:'||l_proc, 5);
192 --
193 l_api_updating := ben_CEP_shd.api_updating
194 (p_prtn_elig_prfl_id => p_prtn_elig_prfl_id,
195 p_effective_date => p_effective_date,
196 p_object_version_number => p_object_version_number);
197 --
198 if (l_api_updating
199 and p_compute_score_flag
200 <> nvl(ben_CEP_shd.g_old_rec.compute_score_flag,hr_api.g_varchar2)
201 or not l_api_updating)
202 and p_compute_score_flag is not null then
203 --
204 -- check if value of lookup falls within lookup type.
205 --
206 if hr_api.not_exists_in_hr_lookups
207 (p_lookup_type => 'YES_NO',
208 p_lookup_code => p_compute_score_flag,
209 p_effective_date => p_effective_date) then
210 --
211 -- raise error as does not exist as lookup
212 fnd_message.set_name('BEN', 'BEN_91628_LOOKUP_TYPE_GENERIC');
213 fnd_message.set_token('FIELD', 'p_compute_score_flag');
214 fnd_message.set_token('VALUE', p_compute_score_flag);
215 fnd_message.set_token('TYPE', 'YES_NO');
216 fnd_message.raise_error;
217
218 --
219 end if;
220 --
221 end if;
222 --
223 hr_utility.set_location('Leaving:'||l_proc,10);
224 --
225 end chk_cmpscore_flag;
226 --
227 --
228 -- ----------------------------------------------------------------------------
229 -- |------< chk_eligy_prfl_id >------|
230 -- ----------------------------------------------------------------------------
231 --
232 -- Description
233 -- This procedure checks that profile id is unique for a plan
234 --
235 -- Pre-Conditions
236 -- None.
237 --
238 -- In Parameters
239 -- p_prtn_elig_prfl_id PK
240 -- p_eligy_prfl_id ID of FK column
241 --
242 -- p_effective_date session date
243 -- p_object_version_number object version number
244 --
245 -- Post Success
246 -- Processing continues
247 --
248 -- Post Failure
249 -- Error raised.
250 --
251 -- Access Status
252 -- Internal table handler use only.
253 --
254 Procedure chk_eligy_prfl_id(
255 p_prtn_elig_prfl_id in number,
256 p_eligy_prfl_id in number,
257 p_prtn_elig_id in number,
258 p_validation_start_date in date,
259 p_validation_end_date in date,
260 p_effective_date in date,
261 p_business_group_id in number,
262 p_object_version_number in number) is
263 --
264 l_proc varchar2(72) := g_package||'chk_eligy_prfl_id';
265 l_api_updating boolean;
266 l_exists varchar2(1);
267 --
268 cursor c1 is
269 select null
270 from ben_prtn_elig_prfl_f
271 where eligy_prfl_id = p_eligy_prfl_id
272 and prtn_elig_id = p_prtn_elig_id
273 and prtn_elig_prfl_id <> nvl(p_prtn_elig_prfl_id, hr_api.g_number)
274 and business_group_id + 0 = p_business_group_id
275 and p_validation_start_date <= effective_end_date
276 and p_validation_end_date >= effective_start_date
277 ;
278 --
279 --
280 Begin
281 --
282 hr_utility.set_location('Entering:'||l_proc,5);
283 --
284 l_api_updating := ben_cep_shd.api_updating
285 (p_prtn_elig_prfl_id => p_prtn_elig_prfl_id,
286 p_effective_date => p_effective_date,
287 p_object_version_number => p_object_version_number);
288 --
289 if (l_api_updating
290 and nvl(p_eligy_prfl_id, hr_api.g_number)
291 <> nvl(ben_cep_shd.g_old_rec.eligy_prfl_id, hr_api.g_number)
292 or not l_api_updating) then
293 --
294 --
295 open c1;
296 fetch c1 into l_exists;
297 if c1%found then
298 close c1;
299 --
300 -- raise error as this beneficiary already exists for this enrt rslt
301 --
302 fnd_message.set_name('BEN', 'BEN_91720_DUP_ELIGY_PRFL');
303 fnd_message.raise_error;
304 --
305 end if;
306 close c1;
307 --
308 end if;
309 --
310 hr_utility.set_location('Leaving:'||l_proc,10);
311 --
312 End chk_eligy_prfl_id;
313 --
314 -- bug 3876692
315 --
316 -- ----------------------------------------------------------------------------
317 -- |------< chk_flx_impt_extnce >------|
318 -- ----------------------------------------------------------------------------
319 --
320 -- Description
321 -- This procedure checks if plan type is flex or imputed shell or not.
322 --
323 -- Pre-Conditions
324 -- None.
325 --
326 -- In Parameters
327 -- p_prtn_elig_id of FK column
328 -- p_effective_date session date
329 --
330 -- Post Success
331 -- Processing continues
332 --
333 -- Post Failure
334 -- Error raised.
335 --
336 -- Access Status
337 -- Internal table handler use only.
338 --
339 Procedure chk_flx_impt_extnce(
340 p_prtn_elig_id in number,
341 p_effective_date in date) is
342 --
343 l_proc varchar2(72) := g_package||'chk_flx_impt_extnce';
344 l_exists varchar2(1);
345 --
346 cursor c1 is
347 select null
351 and (p.invk_flx_cr_pl_flag = 'Y'
348 from ben_prtn_elig_f prtn, ben_pl_f p
349 where prtn.prtn_elig_id = p_prtn_elig_id
350 and prtn.pl_id = p.pl_id
352 or
353 p.imptd_incm_calc_cd is not null)
354 and p_effective_date between prtn.effective_start_date
355 and prtn.effective_end_date
356 and p_effective_date between p.effective_start_date
357 and p.effective_end_date;
358 --
359 cursor c2 is
360 select null
361 from ben_prtn_elig_f epa, ben_pl_f pln, ben_plip_f plip
362 where epa.prtn_elig_id = p_prtn_elig_id
363 and epa.plip_id = plip.plip_id
364 and plip.pl_id = pln.pl_id
365 and (pln.invk_flx_cr_pl_flag = 'Y'
366 or
367 pln.imptd_incm_calc_cd is not null)
368 and p_effective_date between epa.effective_start_date
369 and epa.effective_end_date
370 and p_effective_date between pln.effective_start_date
371 and pln.effective_end_date
372 and p_effective_date between plip.effective_start_date
373 and plip.effective_end_date;
374 --
375 Begin
376 --
377 hr_utility.set_location('Entering:'||l_proc,5);
378 --
379 open c1;
380 fetch c1 into l_exists;
381 if c1%found then
382 close c1;
383 --
384 -- raise error as insert or update is not allowed when plan
385 -- is flex or imputed shell type
386 --
387 fnd_message.set_name('BEN','BEN_94046_PLN_INS_VAL');
388 fnd_message.raise_error;
389 --
390 else
391 --
392 close c1;
393 open c2;
394 fetch c2 into l_exists;
395 if c2%found then
396 close c2;
397 --
398 -- raise error as insert or update is not allowed when plan
399 -- is flex or imputed shell type
400 --
401 fnd_message.set_name('BEN','BEN_94046_PLN_INS_VAL');
402 fnd_message.raise_error;
403 --
404 end if;
405 close c2;
406 --
407 end if;
408 --
409 hr_utility.set_location('Leaving:'||l_proc,10);
410 --
411 End chk_flx_impt_extnce;
412 --
413 --
414 -- ----------------------------------------------------------------------------
415 -- |--------------------------< dt_update_validate >--------------------------|
416 -- ----------------------------------------------------------------------------
417 -- {Start Of Comments}
418 --
419 -- Description:
420 -- This procedure is used for referential integrity of datetracked
421 -- parent entities when a datetrack update operation is taking place
422 -- and where there is no cascading of update defined for this entity.
423 --
424 -- Prerequisites:
425 -- This procedure is called from the update_validate.
426 --
427 -- In Parameters:
428 --
429 -- Post Success:
430 -- Processing continues.
431 --
432 -- Post Failure:
433 --
434 -- Developer Implementation Notes:
435 -- This procedure should not need maintenance unless the HR Schema model
436 -- changes.
437 --
438 -- Access Status:
439 -- Internal Row Handler Use Only.
440 --
441 -- {End Of Comments}
442 -- ----------------------------------------------------------------------------
443 Procedure dt_update_validate
444 (p_eligy_prfl_id in number default hr_api.g_number,
445 p_prtn_elig_id in number default hr_api.g_number,
446 p_datetrack_mode in varchar2,
447 p_validation_start_date in date,
448 p_validation_end_date in date) Is
449 --
450 l_proc varchar2(72) := g_package||'dt_update_validate';
451 l_integrity_error Exception;
452 l_table_name all_tables.table_name%TYPE;
453 --
454 Begin
455 hr_utility.set_location('Entering:'||l_proc, 5);
456 --
457 -- Ensure that the p_datetrack_mode argument is not null
458 --
459 hr_api.mandatory_arg_error
460 (p_api_name => l_proc,
461 p_argument => 'datetrack_mode',
462 p_argument_value => p_datetrack_mode);
463 --
464 -- Only perform the validation if the datetrack update mode is valid
465 --
466 If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
467 --
468 --
469 -- Ensure the arguments are not null
470 --
471 hr_api.mandatory_arg_error
472 (p_api_name => l_proc,
473 p_argument => 'validation_start_date',
474 p_argument_value => p_validation_start_date);
475 --
476 hr_api.mandatory_arg_error
477 (p_api_name => l_proc,
478 p_argument => 'validation_end_date',
479 p_argument_value => p_validation_end_date);
480 --
481 If ((nvl(p_eligy_prfl_id, hr_api.g_number) <> hr_api.g_number) and
482 NOT (dt_api.check_min_max_dates
483 (p_base_table_name => 'ben_eligy_prfl_f',
484 p_base_key_column => 'eligy_prfl_id',
485 p_base_key_value => p_eligy_prfl_id,
486 p_from_date => p_validation_start_date,
487 p_to_date => p_validation_end_date))) Then
488 l_table_name := 'ben_eligy_prfl_f';
492 NOT (dt_api.check_min_max_dates
489 Raise l_integrity_error;
490 End If;
491 If ((nvl(p_prtn_elig_id, hr_api.g_number) <> hr_api.g_number) and
493 (p_base_table_name => 'ben_prtn_elig_f',
494 p_base_key_column => 'prtn_elig_id',
495 p_base_key_value => p_prtn_elig_id,
496 p_from_date => p_validation_start_date,
497 p_to_date => p_validation_end_date))) Then
498 l_table_name := 'ben_prtn_elig_f';
499 Raise l_integrity_error;
500 End If;
501 --
502 End If;
503 --
504 hr_utility.set_location(' Leaving:'||l_proc, 10);
505 Exception
506 When l_integrity_error Then
507 --
508 -- A referential integrity check was violated therefore
509 -- we must error
510 --
511 hr_utility.set_message(801, 'HR_7216_DT_UPD_INTEGRITY_ERR');
512 hr_utility.set_message_token('TABLE_NAME', l_table_name);
513 hr_utility.raise_error;
514 When Others Then
515 --
516 -- An unhandled or unexpected error has occurred which
517 -- we must report
518 --
519 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
520 hr_utility.set_message_token('PROCEDURE', l_proc);
521 hr_utility.set_message_token('STEP','15');
522 hr_utility.raise_error;
523 End dt_update_validate;
524 --
525 -- ----------------------------------------------------------------------------
526 -- |--------------------------< dt_delete_validate >--------------------------|
527 -- ----------------------------------------------------------------------------
528 -- {Start Of Comments}
529 --
530 -- Description:
531 -- This procedure is used for referential integrity of datetracked
532 -- child entities when either a datetrack DELETE or ZAP is in operation
533 -- and where there is no cascading of delete defined for this entity.
534 -- For the datetrack mode of DELETE or ZAP we must ensure that no
535 -- datetracked child rows exist between the validation start and end
536 -- dates.
537 --
538 -- Prerequisites:
539 -- This procedure is called from the delete_validate.
540 --
541 -- In Parameters:
542 --
543 -- Post Success:
544 -- Processing continues.
545 --
546 -- Post Failure:
547 -- If a row exists by determining the returning Boolean value from the
548 -- generic dt_api.rows_exist function then we must supply an error via
549 -- the use of the local exception handler l_rows_exist.
550 --
551 -- Developer Implementation Notes:
552 -- This procedure should not need maintenance unless the HR Schema model
553 -- changes.
554 --
555 -- Access Status:
556 -- Internal Row Handler Use Only.
557 --
558 -- {End Of Comments}
559 -- ----------------------------------------------------------------------------
560 Procedure dt_delete_validate
561 (p_prtn_elig_prfl_id in number,
562 p_datetrack_mode in varchar2,
563 p_validation_start_date in date,
564 p_validation_end_date in date) Is
565 --
566 l_proc varchar2(72) := g_package||'dt_delete_validate';
567 l_rows_exist Exception;
568 l_table_name all_tables.table_name%TYPE;
569 --
570 Begin
571 hr_utility.set_location('Entering:'||l_proc, 5);
572 --
573 -- Ensure that the p_datetrack_mode argument is not null
574 --
575 hr_api.mandatory_arg_error
576 (p_api_name => l_proc,
577 p_argument => 'datetrack_mode',
578 p_argument_value => p_datetrack_mode);
579 --
580 -- Only perform the validation if the datetrack mode is either
581 -- DELETE or ZAP
582 --
583 If (p_datetrack_mode = 'DELETE' or
584 p_datetrack_mode = 'ZAP') then
585 --
586 --
587 -- Ensure the arguments are not null
588 --
589 hr_api.mandatory_arg_error
590 (p_api_name => l_proc,
591 p_argument => 'validation_start_date',
592 p_argument_value => p_validation_start_date);
593 --
594 hr_api.mandatory_arg_error
595 (p_api_name => l_proc,
596 p_argument => 'validation_end_date',
597 p_argument_value => p_validation_end_date);
598 --
599 hr_api.mandatory_arg_error
600 (p_api_name => l_proc,
601 p_argument => 'prtn_elig_prfl_id',
602 p_argument_value => p_prtn_elig_prfl_id);
603 --
604 /*
605 Since the eligy_prfl_rl is not the child of
606 prtn_elig_prfl , there is no need for the
607 validation
608
609 If (dt_api.rows_exist
610 (p_base_table_name => 'ben_eligy_prfl_rl_f',
611 p_base_key_column => 'eligy_prfl_rl_id',
612 p_base_key_value => p_prtn_elig_prfl_id,
613 p_from_date => p_validation_start_date,
614 p_to_date => p_validation_end_date)) Then
615 l_table_name := 'ben_eligy_prfl_rl_f';
616 Raise l_rows_exist;
617 End If;
618 */
619 --
620 End If;
621 --
622 hr_utility.set_location(' Leaving:'||l_proc, 10);
623 Exception
624 When l_rows_exist Then
625 --
626 -- A referential integrity check was violated therefore
627 -- we must error
628 --
629 hr_utility.set_message(801, 'HR_7215_DT_CHILD_EXISTS');
630 hr_utility.set_message_token('TABLE_NAME', l_table_name);
631 hr_utility.raise_error;
632 When Others Then
633 --
634 -- An unhandled or unexpected error has occurred which
635 -- we must report
636 --
637 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
638 hr_utility.set_message_token('PROCEDURE', l_proc);
639 hr_utility.set_message_token('STEP','15');
640 hr_utility.raise_error;
641 End dt_delete_validate;
645 -- ----------------------------------------------------------------------------
642 --
643 -- ----------------------------------------------------------------------------
644 -- |---------------------------< insert_validate >----------------------------|
646 Procedure insert_validate
647 (p_rec in ben_CEP_shd.g_rec_type,
648 p_effective_date in date,
649 p_datetrack_mode in varchar2,
650 p_validation_start_date in date,
651 p_validation_end_date in date) is
652 --
653 l_proc varchar2(72) := g_package||'insert_validate';
654 --
655 Begin
656 hr_utility.set_location('Entering:'||l_proc, 5);
657 --
658 -- Call all supporting business operations
659 --
660 --
661 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
662 --
663 chk_prtn_elig_prfl_id
664 (p_prtn_elig_prfl_id => p_rec.prtn_elig_prfl_id,
665 p_effective_date => p_effective_date,
666 p_object_version_number => p_rec.object_version_number);
667 --
668 chk_mndtry_flag
669 (p_prtn_elig_prfl_id => p_rec.prtn_elig_prfl_id,
670 p_mndtry_flag => p_rec.mndtry_flag,
671 p_effective_date => p_effective_date,
672 p_object_version_number => p_rec.object_version_number);
673 --
674 chk_cmpscore_flag
675 (p_prtn_elig_prfl_id => p_rec.prtn_elig_prfl_id,
676 p_compute_score_flag => p_rec.compute_score_flag,
677 p_effective_date => p_effective_date,
678 p_object_version_number => p_rec.object_version_number);
679 --
680
681 chk_eligy_prfl_id(p_prtn_elig_prfl_id => p_rec.prtn_elig_prfl_id,
682 p_eligy_prfl_id => p_rec.eligy_prfl_id,
683 p_prtn_elig_id => p_rec.prtn_elig_id,
684 p_validation_start_date => p_validation_start_date,
685 p_validation_end_date => p_validation_end_date,
686 p_effective_date => p_effective_date,
687 p_business_group_id => p_rec.business_group_id,
688 p_object_version_number => p_rec.object_version_number);
689 --
690 -- bug 3876692
691 --
692 chk_flx_impt_extnce(p_prtn_elig_id => p_rec.prtn_elig_id,
693 p_effective_date => p_effective_date);
694 --
695 hr_utility.set_location(' Leaving:'||l_proc, 10);
696 End insert_validate;
697 --
698 -- ----------------------------------------------------------------------------
699 -- |---------------------------< update_validate >----------------------------|
700 -- ----------------------------------------------------------------------------
701 Procedure update_validate
702 (p_rec in ben_CEP_shd.g_rec_type,
703 p_effective_date in date,
704 p_datetrack_mode in varchar2,
705 p_validation_start_date in date,
706 p_validation_end_date in date) is
707 --
708 l_proc varchar2(72) := g_package||'update_validate';
709 --
710 Begin
711 hr_utility.set_location('Entering:'||l_proc, 5);
712 --
713 -- Call all supporting business operations
714 --
715 --
716 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
717 --
718 chk_prtn_elig_prfl_id
719 (p_prtn_elig_prfl_id => p_rec.prtn_elig_prfl_id,
720 p_effective_date => p_effective_date,
721 p_object_version_number => p_rec.object_version_number);
722 --
723 chk_mndtry_flag
724 (p_prtn_elig_prfl_id => p_rec.prtn_elig_prfl_id,
725 p_mndtry_flag => p_rec.mndtry_flag,
726 p_effective_date => p_effective_date,
727 p_object_version_number => p_rec.object_version_number);
728 --
729 chk_cmpscore_flag
730 (p_prtn_elig_prfl_id => p_rec.prtn_elig_prfl_id,
731 p_compute_score_flag => p_rec.compute_score_flag,
732 p_effective_date => p_effective_date,
733 p_object_version_number => p_rec.object_version_number);
734 --
735 chk_eligy_prfl_id(p_prtn_elig_prfl_id => p_rec.prtn_elig_prfl_id,
736 p_eligy_prfl_id => p_rec.eligy_prfl_id,
737 p_prtn_elig_id => p_rec.prtn_elig_id,
738 p_validation_start_date => p_validation_start_date,
739 p_validation_end_date => p_validation_end_date,
740 p_effective_date => p_effective_date,
741 p_business_group_id => p_rec.business_group_id,
742 p_object_version_number => p_rec.object_version_number);
743 --
744 --
745 -- Call the datetrack update integrity operation
746 --
747 dt_update_validate
748 (p_eligy_prfl_id => p_rec.eligy_prfl_id,
749 p_prtn_elig_id => p_rec.prtn_elig_id,
750 p_datetrack_mode => p_datetrack_mode,
751 p_validation_start_date => p_validation_start_date,
752 p_validation_end_date => p_validation_end_date);
753 --
754 -- bug 3876692
755 --
756 chk_flx_impt_extnce(p_prtn_elig_id => p_rec.prtn_elig_id,
757 p_effective_date => p_effective_date);
758 --
759 hr_utility.set_location(' Leaving:'||l_proc, 10);
760 End update_validate;
761 --
762 -- ----------------------------------------------------------------------------
763 -- |---------------------------< delete_validate >----------------------------|
764 -- ----------------------------------------------------------------------------
765 Procedure delete_validate
766 (p_rec in ben_CEP_shd.g_rec_type,
767 p_effective_date in date,
768 p_datetrack_mode in varchar2,
769 p_validation_start_date in date,
770 p_validation_end_date in date) is
771 --
772 l_proc varchar2(72) := g_package||'delete_validate';
773 --
774 Begin
775 hr_utility.set_location('Entering:'||l_proc, 5);
776 --
777 -- Call all supporting business operations
778 --
779 dt_delete_validate
780 (p_datetrack_mode => p_datetrack_mode,
781 p_validation_start_date => p_validation_start_date,
782 p_validation_end_date => p_validation_end_date,
783 p_prtn_elig_prfl_id => p_rec.prtn_elig_prfl_id);
784 --
785 hr_utility.set_location(' Leaving:'||l_proc, 10);
786 End delete_validate;
787 --
788 --
789 -- ---------------------------------------------------------------------------
790 -- |---------------------< return_legislation_code >-------------------------|
791 -- ---------------------------------------------------------------------------
792 --
793 function return_legislation_code
794 (p_prtn_elig_prfl_id in number) return varchar2 is
795 --
796 -- Declare cursor
797 --
798 cursor csr_leg_code is
799 select a.legislation_code
800 from per_business_groups a,
801 ben_prtn_elig_prfl_f b
802 where b.prtn_elig_prfl_id = p_prtn_elig_prfl_id
803 and a.business_group_id = b.business_group_id;
804 --
805 -- Declare local variables
806 --
807 l_legislation_code varchar2(150);
808 l_proc varchar2(72) := g_package||'return_legislation_code';
809 --
810 begin
811 --
812 hr_utility.set_location('Entering:'|| l_proc, 10);
813 --
814 -- Ensure that all the mandatory parameter are not null
815 --
816 hr_api.mandatory_arg_error(p_api_name => l_proc,
817 p_argument => 'prtn_elig_prfl_id',
818 p_argument_value => p_prtn_elig_prfl_id);
819 --
820 open csr_leg_code;
821 --
822 fetch csr_leg_code into l_legislation_code;
823 --
824 if csr_leg_code%notfound then
825 --
826 close csr_leg_code;
827 --
828 -- The primary key is invalid therefore we must error
829 --
830 hr_utility.set_message(801,'HR_7220_INVALID_PRIMARY_KEY');
831 hr_utility.raise_error;
832 --
833 end if;
834 --
835 close csr_leg_code;
836 --
837 hr_utility.set_location(' Leaving:'|| l_proc, 20);
838 --
839 return l_legislation_code;
840 --
841 end return_legislation_code;
842 --
843 end ben_CEP_bus;