[Home] [Help]
PACKAGE BODY: APPS.BEN_DOP_BUS
Source
1 Package Body ben_dop_bus as
2 /* $Header: bedoprhi.pkb 120.2 2006/03/30 23:59:20 gsehgal noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_dop_bus.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_dpnt_cvrd_othr_pgm_rt_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 -- dpnt_cvrd_othr_pgm_rt_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_dpnt_cvrd_othr_pgm_rt_id(p_dpnt_cvrd_othr_pgm_rt_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_dpnt_cvrd_othr_pgm_rt_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_dop_shd.api_updating
49 (p_effective_date => p_effective_date,
50 p_dpnt_cvrd_othr_pgm_rt_id => p_dpnt_cvrd_othr_pgm_rt_id,
51 p_object_version_number => p_object_version_number);
52 --
53 if (l_api_updating
54 and nvl(p_dpnt_cvrd_othr_pgm_rt_id,hr_api.g_number)
55 <> ben_dop_shd.g_old_rec.dpnt_cvrd_othr_pgm_rt_id) then
56 --
57 -- raise error as PK has changed
58 --
59 ben_dop_shd.constraint_error('BEN_DPNT_CVRD_OTHR_PGM_RT_PK');
60 --
61 elsif not l_api_updating then
62 --
63 -- check if PK is null
64 --
65 if p_dpnt_cvrd_othr_pgm_rt_id is not null then
66 --
67 -- raise error as PK is not null
68 --
69 ben_dop_shd.constraint_error('BEN_DPNT_CVRD_OTHR_PGM_RT_PK');
70 --
71 end if;
72 --
73 end if;
74 --
75 hr_utility.set_location('Leaving:'||l_proc, 10);
76 --
77 End chk_dpnt_cvrd_othr_pgm_rt_id;
78 --
79 -- ----------------------------------------------------------------------------
80 -- |------< chk_enrl_det_dt_cd >------|
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 -- dpnt_cvrd_othr_pgm_rt_id PK of record being inserted or updated.
91 -- enrl_det_dt_cd 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_enrl_det_dt_cd(p_dpnt_cvrd_othr_pgm_rt_id in number,
106 p_enrl_det_dt_cd 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_enrl_det_dt_cd';
111 l_api_updating boolean;
112 --
113 Begin
114 --
115 hr_utility.set_location('Entering:'||l_proc, 5);
116 --
117 l_api_updating := ben_dop_shd.api_updating
118 (p_dpnt_cvrd_othr_pgm_rt_id => p_dpnt_cvrd_othr_pgm_rt_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_enrl_det_dt_cd
124 <> nvl(ben_dop_shd.g_old_rec.enrl_det_dt_cd,hr_api.g_varchar2)
125 or not l_api_updating)
126 and p_enrl_det_dt_cd 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 => 'BEN_ENRL_DET_DT',
132 p_lookup_code => p_enrl_det_dt_cd,
133 p_effective_date => p_effective_date) then
134 --
135 -- raise error as does not exist as lookup
136 --
137 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
138 fnd_message.set_token('FIELD','p_enrl_det_dt_cd');
139 fnd_message.set_token('TYPE','BEN_ENRL_DET_DT');
140 fnd_message.raise_error;
141 --
142 end if;
143 --
144 end if;
145 --
146 hr_utility.set_location('Leaving:'||l_proc,10);
147 --
148 end chk_enrl_det_dt_cd;
149 --
150 -- ----------------------------------------------------------------------------
151 -- |------< chk_only_pls_subj_cobra_flag >------|
152 -- ----------------------------------------------------------------------------
153 --
154 -- Description
155 -- This procedure is used to check that the lookup value is valid.
156 --
157 -- Pre Conditions
158 -- None.
159 --
160 -- In Parameters
161 -- dpnt_cvrd_othr_pgm_rt_id PK of record being inserted or updated.
162 -- only_pls_subj_cobra_flag Value of lookup code.
163 -- effective_date effective date
164 -- object_version_number Object version number of record being
165 -- inserted or updated.
166 --
167 -- Post Success
168 -- Processing continues
169 --
170 -- Post Failure
171 -- Error handled by procedure
172 --
173 -- Access Status
174 -- Internal table handler use only.
175 --
176 Procedure chk_only_pls_subj_cobra_flag(p_dpnt_cvrd_othr_pgm_rt_id in number,
177 p_only_pls_subj_cobra_flag in varchar2,
178 p_effective_date in date,
179 p_object_version_number in number) is
180 --
181 l_proc varchar2(72) := g_package||'chk_only_pls_subj_cobra_flag';
182 l_api_updating boolean;
183 --
184 Begin
185 --
186 hr_utility.set_location('Entering:'||l_proc, 5);
187 --
188 l_api_updating := ben_dop_shd.api_updating
189 (p_dpnt_cvrd_othr_pgm_rt_id => p_dpnt_cvrd_othr_pgm_rt_id,
190 p_effective_date => p_effective_date,
191 p_object_version_number => p_object_version_number);
192 --
193 if (l_api_updating
194 and p_only_pls_subj_cobra_flag
195 <> nvl(ben_dop_shd.g_old_rec.only_pls_subj_cobra_flag,hr_api.g_varchar2)
196 or not l_api_updating) then
197 --
198 -- check if value of lookup falls within lookup type.
199 --
200 --
201 if hr_api.not_exists_in_hr_lookups
202 (p_lookup_type => 'YES_NO',
203 p_lookup_code => p_only_pls_subj_cobra_flag,
204 p_effective_date => p_effective_date) then
205 --
206 -- raise error as does not exist as lookup
207 --
208 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
209 fnd_message.set_token('FIELD','p_only_pls_subj_cobra_flag');
210 fnd_message.set_token('TYPE','YES_NO');
211 fnd_message.raise_error;
212 --
213 end if;
214 --
215 end if;
216 --
217 hr_utility.set_location('Leaving:'||l_proc,10);
218 --
219 end chk_only_pls_subj_cobra_flag;
220 -- ----------------------------------------------------------------------------
221 -- |------< chk_dup_record >------|
222 -- ----------------------------------------------------------------------------
223 --
224 -- Description
225 -- This procedure is used to check that there is no duplicate record
226 --
227 -- Pre Conditions
228 -- None.
229 --
230 -- In Parameters
231 -- p_dpnt_cvrd_othr_pgm_rt_id PK of record being inserted or updated.
232 -- p_pgm_id Value of FK
233 -- p_vrbl_rt_prfl_id FK of the record
234 -- p_effective_date effective date
235 -- p_object_version_number Object version number of record being
236 -- inserted or updated.
237 -- p_business_group_id business_group_id of the record
238 -- p_validation_start_date validation_start_date of record
239 -- p_validation_end_date validation_end_date of record
240 --
241 -- Post Success
242 -- Processing continues
243 --
244 -- Post Failure
245 -- Error handled by procedure
246 --
247 -- Access Status
248 -- Internal table handler use only.
249 --
250 Procedure chk_dup_record
251 (p_dpnt_cvrd_othr_pgm_rt_id in number,
252 p_pgm_id in number,
253 p_enrl_det_dt_cd in varchar2,
254 p_vrbl_rt_prfl_id in number,
255 p_effective_date in date,
256 p_object_version_number in number,
257 p_business_group_id in number,
258 p_validation_start_date in date,
259 p_validation_end_date in date )
260 is
261 --
262 l_proc varchar2(72) := g_package||'chk_dup_record';
263 l_api_updating boolean;
264 l_exists varchar2(1);
265 --
266 cursor c_dup is
267 select null
268 from ben_dpnt_cvrd_othr_pgm_rt_f
269 where pgm_id = p_pgm_id
270 and enrl_det_dt_cd = p_enrl_det_dt_cd
271 and vrbl_rt_prfl_id = p_vrbl_rt_prfl_id
272 and dpnt_cvrd_othr_pgm_rt_id <> nvl(p_dpnt_cvrd_othr_pgm_rt_id,hr_api.g_number)
273 and business_group_id + 0 = p_business_group_id
274 and p_validation_start_date <= effective_end_date
275 and p_validation_end_date >= effective_start_date;
276 --
277 BEGIN
278 --
279 hr_utility.set_location('Entering:'||l_proc, 5);
280 --
281 l_api_updating := ben_dop_shd.api_updating
282 (p_dpnt_cvrd_othr_pgm_rt_id => p_dpnt_cvrd_othr_pgm_rt_id,
283 p_effective_date => p_effective_date,
284 p_object_version_number => p_object_version_number);
285 --
286 if (l_api_updating
287 and (p_pgm_id <> nvl(ben_dop_shd.g_old_rec.pgm_id,hr_api.g_number)
288 or p_enrl_det_dt_cd <> nvl(ben_dco_shd.g_old_rec.enrl_det_dt_cd,hr_api.g_varchar2))
289 or not l_api_updating) then
290
291 open c_dup;
292 fetch c_dup into l_exists;
293 if c_dup%found then
294 close c_dup;
295 --
296 -- raise error as this Covered by Another Program criteria already exists for this profile
297 --
298 fnd_message.set_name('BEN', 'BEN_92992_DUPS_ROW');
299 fnd_message.set_token('VAR1','Covered by Another Program criteria',TRUE);
300 fnd_message.set_token('VAR2','Variable Rate Profile',TRUE);
301 fnd_message.raise_error;
302 --
303 end if;
304 close c_dup;
305 --
306 end if;
307 hr_utility.set_location('Leaving:'||l_proc,10);
308 --
309 END chk_dup_record;
310
311 --
312 -- ----------------------------------------------------------------------------
313 -- |------< chk_excld_flag >------|
314 -- ----------------------------------------------------------------------------
315 --
316 -- Description
317 -- This procedure is used to check that the lookup value is valid.
318 --
319 -- Pre Conditions
320 -- None.
321 --
322 -- In Parameters
323 -- dpnt_cvrd_othr_pgm_rt_id PK of record being inserted or updated.
324 -- excld_flag Value of lookup code.
325 -- effective_date effective date
326 -- object_version_number Object version number of record being
327 -- inserted or updated.
328 --
329 -- Post Success
330 -- Processing continues
331 --
332 -- Post Failure
333 -- Error handled by procedure
334 --
335 -- Access Status
336 -- Internal table handler use only.
337 --
338 Procedure chk_excld_flag(p_dpnt_cvrd_othr_pgm_rt_id in number,
339 p_excld_flag in varchar2,
340 p_effective_date in date,
341 p_object_version_number in number) is
342 --
343 l_proc varchar2(72) := g_package||'chk_excld_flag';
344 l_api_updating boolean;
345 --
346 Begin
347 --
348 hr_utility.set_location('Entering:'||l_proc, 5);
349 --
350 l_api_updating := ben_dop_shd.api_updating
351 (p_dpnt_cvrd_othr_pgm_rt_id => p_dpnt_cvrd_othr_pgm_rt_id,
352 p_effective_date => p_effective_date,
353 p_object_version_number => p_object_version_number);
354 --
355 if (l_api_updating
356 and p_excld_flag
357 <> nvl(ben_dop_shd.g_old_rec.excld_flag,hr_api.g_varchar2)
358 or not l_api_updating) then
359 --
360 -- check if value of lookup falls within lookup type.
361 --
362 --
363 if hr_api.not_exists_in_hr_lookups
364 (p_lookup_type => 'YES_NO',
365 p_lookup_code => p_excld_flag,
366 p_effective_date => p_effective_date) then
367 --
368 -- raise error as does not exist as lookup
369 --
370 fnd_message.set_name('BEN','BEN_91628_LOOKUP_TYPE_GENERIC');
371 fnd_message.set_token('FIELD','p_excld_flag');
372 fnd_message.set_token('TYPE','YES_NO');
373 fnd_message.raise_error;
374 --
375 end if;
376 --
377 end if;
378 --
379 hr_utility.set_location('Leaving:'||l_proc,10);
380 --
381 end chk_excld_flag;
382 --
383 --
384 --
385 -- added for Bug 5078478 .. add this procedure to check the duplicate seq no
386 -- |--------------------< chk_duplicate_ordr_num >----------------------------|
387 -- ----------------------------------------------------------------------------
388 --
389 -- Description
390 --
391 -- Pre Conditions
392 -- None.
393 --
394 -- In Parameters
395 -- p_pgm_id
396 -- p_vrbl_rt_prfl_id
397 -- p_ordr_num
398 -- p_effective_date
399 -- p_business_group_id
400 --
401 -- Post Success
402 -- Processing continues
403 --
404 -- Post Failure
405 -- Errors handled by the procedure
406 --
407 -- Access Status
408 -- Internal table handler use only.
409 --
410 -- ----------------------------------------------------------------------------
411
412
413 procedure chk_duplicate_ordr_num
414 (p_vrbl_rt_prfl_id in number
415 ,p_dpnt_cvrd_othr_pgm_rt_id in number
416 ,p_ordr_num in number
417 ,p_validation_start_date in date
418 ,p_validation_end_date in date
419 ,p_business_group_id in number)
420 is
421 l_proc varchar2(72) := g_package||' chk_duplicate_ordr_num ';
422 l_dummy char(1);
423 cursor c1 is select null
424 from ben_dpnt_cvrd_othr_pgm_rt_f
425 where vrbl_rt_prfl_id = p_vrbl_rt_prfl_id
426 -- changed against bug: 5113011
427 and dpnt_cvrd_othr_pgm_rt_id <> nvl(p_dpnt_cvrd_othr_pgm_rt_id ,-1)
428 -- and pgm_id <> nvl(p_pgm_id ,-1)
429 --and p_effective_date between effective_start_date
430 -- and effective_end_date
431 and p_validation_start_date <= effective_end_date
432 and p_validation_end_date >= effective_start_date
433 and business_group_id + 0 = p_business_group_id
434 and ordr_num = p_ordr_num;
435 --
436 Begin
437 hr_utility.set_location('Entering:'||l_proc, 5);
438
439 --
440 open c1;
441 fetch c1 into l_dummy;
442 --
443 if c1%found then
444 fnd_message.set_name('BEN','BEN_91001_SEQ_NOT_UNIQUE');
445 fnd_message.raise_error;
446 end if;
447 close c1;
448 --
449 hr_utility.set_location('Leaving:'||l_proc, 15);
450 End chk_duplicate_ordr_num;
451
452
453
454
455 -- ----------------------------------------------------------------------------
456 -- |--------------------------< dt_update_validate >--------------------------|
457 -- ----------------------------------------------------------------------------
458 -- {Start Of Comments}
459 --
460 -- Description:
461 -- This procedure is used for referential integrity of datetracked
462 -- parent entities when a datetrack update operation is taking place
463 -- and where there is no cascading of update defined for this entity.
464 --
465 -- Prerequisites:
466 -- This procedure is called from the update_validate.
467 --
468 -- In Parameters:
469 --
470 -- Post Success:
471 -- Processing continues.
472 --
473 -- Post Failure:
474 --
475 -- Developer Implementation Notes:
476 -- This procedure should not need maintenance unless the HR Schema model
477 -- changes.
478 --
479 -- Access Status:
480 -- Internal Row Handler Use Only.
481 --
482 -- {End Of Comments}
483 -- ----------------------------------------------------------------------------
484 Procedure dt_update_validate
485 (p_vrbl_rt_prfl_id in number default hr_api.g_number,
486 p_pgm_id in number default hr_api.g_number,
487 p_datetrack_mode in varchar2,
488 p_validation_start_date in date,
489 p_validation_end_date in date) Is
490 --
491 l_proc varchar2(72) := g_package||'dt_update_validate';
492 l_integrity_error Exception;
493 l_table_name all_tables.table_name%TYPE;
494 --
495 Begin
496 hr_utility.set_location('Entering:'||l_proc, 5);
497 --
498 -- Ensure that the p_datetrack_mode argument is not null
499 --
500 hr_api.mandatory_arg_error
501 (p_api_name => l_proc,
502 p_argument => 'datetrack_mode',
503 p_argument_value => p_datetrack_mode);
504 --
505 -- Only perform the validation if the datetrack update mode is valid
506 --
507 If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
508 --
509 --
510 -- Ensure the arguments are not null
511 --
512 hr_api.mandatory_arg_error
513 (p_api_name => l_proc,
514 p_argument => 'validation_start_date',
515 p_argument_value => p_validation_start_date);
516 --
517 hr_api.mandatory_arg_error
518 (p_api_name => l_proc,
519 p_argument => 'validation_end_date',
520 p_argument_value => p_validation_end_date);
521 --
522 If ((nvl(p_vrbl_rt_prfl_id, hr_api.g_number) <> hr_api.g_number) and
523 NOT (dt_api.check_min_max_dates
524 (p_base_table_name => 'ben_vrbl_rt_prfl_f',
525 p_base_key_column => 'vrbl_rt_prfl_id',
526 p_base_key_value => p_vrbl_rt_prfl_id,
527 p_from_date => p_validation_start_date,
528 p_to_date => p_validation_end_date))) Then
529 l_table_name := 'ben_vrbl_rt_prfl_f';
530 Raise l_integrity_error;
531 End If;
532 If ((nvl(p_pgm_id, hr_api.g_number) <> hr_api.g_number) and
533 NOT (dt_api.check_min_max_dates
534 (p_base_table_name => 'ben_pgm_f',
535 p_base_key_column => 'pgm_id',
536 p_base_key_value => p_pgm_id,
537 p_from_date => p_validation_start_date,
538 p_to_date => p_validation_end_date))) Then
539 l_table_name := 'ben_pgm_f';
540 Raise l_integrity_error;
541 End If;
542 --
543 End If;
544 --
545 hr_utility.set_location(' Leaving:'||l_proc, 10);
546 Exception
547 When l_integrity_error Then
548 --
549 -- A referential integrity check was violated therefore
550 -- we must error
551 --
552 ben_utility.parent_integrity_error(p_table_name => l_table_name);
553 --
554 When Others Then
555 --
556 -- An unhandled or unexpected error has occurred which
557 -- we must report
558 --
559 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
560 fnd_message.set_token('PROCEDURE', l_proc);
561 fnd_message.set_token('STEP','15');
562 fnd_message.raise_error;
563 End dt_update_validate;
564 --
565 -- ----------------------------------------------------------------------------
566 -- |--------------------------< dt_delete_validate >--------------------------|
567 -- ----------------------------------------------------------------------------
568 -- {Start Of Comments}
569 --
570 -- Description:
571 -- This procedure is used for referential integrity of datetracked
572 -- child entities when either a datetrack DELETE or ZAP is in operation
573 -- and where there is no cascading of delete defined for this entity.
574 -- For the datetrack mode of DELETE or ZAP we must ensure that no
575 -- datetracked child rows exist between the validation start and end
576 -- dates.
577 --
578 -- Prerequisites:
579 -- This procedure is called from the delete_validate.
580 --
581 -- In Parameters:
582 --
583 -- Post Success:
584 -- Processing continues.
585 --
586 -- Post Failure:
587 -- If a row exists by determining the returning Boolean value from the
588 -- generic dt_api.rows_exist function then we must supply an error via
589 -- the use of the local exception handler l_rows_exist.
590 --
591 -- Developer Implementation Notes:
592 -- This procedure should not need maintenance unless the HR Schema model
593 -- changes.
594 --
595 -- Access Status:
596 -- Internal Row Handler Use Only.
597 --
598 -- {End Of Comments}
599 -- ----------------------------------------------------------------------------
600 Procedure dt_delete_validate
601 (p_dpnt_cvrd_othr_pgm_rt_id in number,
602 p_datetrack_mode in varchar2,
603 p_validation_start_date in date,
604 p_validation_end_date in date) Is
605 --
606 l_proc varchar2(72) := g_package||'dt_delete_validate';
607 l_rows_exist Exception;
608 l_table_name all_tables.table_name%TYPE;
609 --
610 Begin
611 hr_utility.set_location('Entering:'||l_proc, 5);
612 --
613 -- Ensure that the p_datetrack_mode argument is not null
614 --
615 hr_api.mandatory_arg_error
616 (p_api_name => l_proc,
617 p_argument => 'datetrack_mode',
618 p_argument_value => p_datetrack_mode);
619 --
620 -- Only perform the validation if the datetrack mode is either
621 -- DELETE or ZAP
622 --
623 If (p_datetrack_mode = 'DELETE' or
624 p_datetrack_mode = 'ZAP') then
625 --
626 --
627 -- Ensure the arguments are not null
628 --
629 hr_api.mandatory_arg_error
630 (p_api_name => l_proc,
631 p_argument => 'validation_start_date',
632 p_argument_value => p_validation_start_date);
633 --
634 hr_api.mandatory_arg_error
635 (p_api_name => l_proc,
636 p_argument => 'validation_end_date',
637 p_argument_value => p_validation_end_date);
638 --
639 hr_api.mandatory_arg_error
640 (p_api_name => l_proc,
641 p_argument => 'dpnt_cvrd_othr_pgm_rt_id',
642 p_argument_value => p_dpnt_cvrd_othr_pgm_rt_id);
643 --
644 --
645 --
646 End If;
647 --
648 hr_utility.set_location(' Leaving:'||l_proc, 10);
649 Exception
650 When l_rows_exist Then
651 --
652 -- A referential integrity check was violated therefore
653 -- we must error
654 --
655 fnd_message.set_name('PAY', 'HR_7215_DT_CHILD_EXISTS');
656 fnd_message.set_token('TABLE_NAME', l_table_name);
657 fnd_message.raise_error;
658 When Others Then
659 --
660 -- An unhandled or unexpected error has occurred which
661 -- we must report
662 --
663 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
664 fnd_message.set_token('PROCEDURE', l_proc);
665 fnd_message.set_token('STEP','15');
666 fnd_message.raise_error;
667 End dt_delete_validate;
668 --
669 -- ----------------------------------------------------------------------------
670 -- |---------------------------< insert_validate >----------------------------|
671 -- ----------------------------------------------------------------------------
672 Procedure insert_validate
673 (p_rec in ben_dop_shd.g_rec_type,
674 p_effective_date in date,
675 p_datetrack_mode in varchar2,
676 p_validation_start_date in date,
677 p_validation_end_date in date) is
678 --
679 l_proc varchar2(72) := g_package||'insert_validate';
680 --
681 Begin
682 hr_utility.set_location('Entering:'||l_proc, 5);
683 --
684 -- Call all supporting business operations
685 --
686 --
687 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
688 --
689 chk_dpnt_cvrd_othr_pgm_rt_id
690 (p_dpnt_cvrd_othr_pgm_rt_id => p_rec.dpnt_cvrd_othr_pgm_rt_id,
691 p_effective_date => p_effective_date,
692 p_object_version_number => p_rec.object_version_number);
693 --
694 chk_enrl_det_dt_cd
695 (p_dpnt_cvrd_othr_pgm_rt_id => p_rec.dpnt_cvrd_othr_pgm_rt_id,
696 p_enrl_det_dt_cd => p_rec.enrl_det_dt_cd,
697 p_effective_date => p_effective_date,
698 p_object_version_number => p_rec.object_version_number);
699 --
700 chk_only_pls_subj_cobra_flag
701 (p_dpnt_cvrd_othr_pgm_rt_id => p_rec.dpnt_cvrd_othr_pgm_rt_id,
702 p_only_pls_subj_cobra_flag => p_rec.only_pls_subj_cobra_flag,
703 p_effective_date => p_effective_date,
704 p_object_version_number => p_rec.object_version_number);
705 --
706 chk_dup_record
707 (p_dpnt_cvrd_othr_pgm_rt_id => p_rec.dpnt_cvrd_othr_pgm_rt_id,
708 p_pgm_id => p_rec.pgm_id,
709 p_enrl_det_dt_cd => p_rec.enrl_det_dt_cd,
710 p_vrbl_rt_prfl_id => p_rec.vrbl_rt_prfl_id,
711 p_effective_date => p_effective_date,
712 p_object_version_number => p_rec.object_version_number,
713 p_business_group_id => p_rec.business_group_id,
714 p_validation_start_date => p_validation_start_date,
715 p_validation_end_date => p_validation_end_date);
716 --
717 chk_excld_flag
718 (p_dpnt_cvrd_othr_pgm_rt_id => p_rec.dpnt_cvrd_othr_pgm_rt_id,
719 p_excld_flag => p_rec.excld_flag,
720 p_effective_date => p_effective_date,
721 p_object_version_number => p_rec.object_version_number);
722 --
723 -- added for Bug 5078478 .. add this procedure to check the duplicate seq no
724 chk_duplicate_ordr_num
725 (p_vrbl_rt_prfl_id => p_rec.vrbl_rt_prfl_id
726 ,p_dpnt_cvrd_othr_pgm_rt_id => p_rec.dpnt_cvrd_othr_pgm_rt_id
727 ,p_ordr_num => p_rec.ordr_num
728 ,p_validation_start_date => p_validation_start_date
729 ,p_validation_end_date => p_validation_end_date
730 ,p_business_group_id => p_rec.business_group_id);
731
732 --
733 hr_utility.set_location(' Leaving:'||l_proc, 10);
734 End insert_validate;
735 --
736 -- ----------------------------------------------------------------------------
737 -- |---------------------------< update_validate >----------------------------|
738 -- ----------------------------------------------------------------------------
739 Procedure update_validate
740 (p_rec in ben_dop_shd.g_rec_type,
741 p_effective_date in date,
742 p_datetrack_mode in varchar2,
743 p_validation_start_date in date,
744 p_validation_end_date in date) is
745 --
746 l_proc varchar2(72) := g_package||'update_validate';
747 --
748 Begin
749 hr_utility.set_location('Entering:'||l_proc, 5);
750 --
751 -- Call all supporting business operations
752 --
753 --
754 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
755 --
756 chk_dpnt_cvrd_othr_pgm_rt_id
757 (p_dpnt_cvrd_othr_pgm_rt_id => p_rec.dpnt_cvrd_othr_pgm_rt_id,
758 p_effective_date => p_effective_date,
759 p_object_version_number => p_rec.object_version_number);
760 --
761 chk_enrl_det_dt_cd
762 (p_dpnt_cvrd_othr_pgm_rt_id => p_rec.dpnt_cvrd_othr_pgm_rt_id,
763 p_enrl_det_dt_cd => p_rec.enrl_det_dt_cd,
764 p_effective_date => p_effective_date,
765 p_object_version_number => p_rec.object_version_number);
766 --
767 chk_only_pls_subj_cobra_flag
768 (p_dpnt_cvrd_othr_pgm_rt_id => p_rec.dpnt_cvrd_othr_pgm_rt_id,
769 p_only_pls_subj_cobra_flag => p_rec.only_pls_subj_cobra_flag,
770 p_effective_date => p_effective_date,
771 p_object_version_number => p_rec.object_version_number);
772 --
773 chk_dup_record
774 (p_dpnt_cvrd_othr_pgm_rt_id => p_rec.dpnt_cvrd_othr_pgm_rt_id,
775 p_pgm_id => p_rec.pgm_id,
776 p_enrl_det_dt_cd => p_rec.enrl_det_dt_cd,
777 p_vrbl_rt_prfl_id => p_rec.vrbl_rt_prfl_id,
778 p_effective_date => p_effective_date,
779 p_object_version_number => p_rec.object_version_number,
780 p_business_group_id => p_rec.business_group_id,
781 p_validation_start_date => p_validation_start_date,
782 p_validation_end_date => p_validation_end_date);
783 --
784 chk_excld_flag
785 (p_dpnt_cvrd_othr_pgm_rt_id => p_rec.dpnt_cvrd_othr_pgm_rt_id,
786 p_excld_flag => p_rec.excld_flag,
787 p_effective_date => p_effective_date,
788 p_object_version_number => p_rec.object_version_number);
789 --
790 -- added for Bug 5078478 .. add this procedure to check the duplicate seq no
791 chk_duplicate_ordr_num
792 (p_vrbl_rt_prfl_id => p_rec.vrbl_rt_prfl_id
793 ,p_dpnt_cvrd_othr_pgm_rt_id => p_rec.dpnt_cvrd_othr_pgm_rt_id
794 ,p_ordr_num => p_rec.ordr_num
795 ,p_validation_start_date => p_validation_start_date
796 ,p_validation_end_date => p_validation_end_date
797 ,p_business_group_id => p_rec.business_group_id);
798
799 --
800 -- Call the datetrack update integrity operation
801 --
802 dt_update_validate
803 (p_vrbl_rt_prfl_id => p_rec.vrbl_rt_prfl_id,
804 p_pgm_id => p_rec.pgm_id,
805 p_datetrack_mode => p_datetrack_mode,
806 p_validation_start_date => p_validation_start_date,
807 p_validation_end_date => p_validation_end_date);
808 --
809 hr_utility.set_location(' Leaving:'||l_proc, 10);
810 End update_validate;
811 --
812 -- ----------------------------------------------------------------------------
813 -- |---------------------------< delete_validate >----------------------------|
814 -- ----------------------------------------------------------------------------
815 Procedure delete_validate
816 (p_rec in ben_dop_shd.g_rec_type,
817 p_effective_date in date,
818 p_datetrack_mode in varchar2,
819 p_validation_start_date in date,
820 p_validation_end_date in date) is
821 --
822 l_proc varchar2(72) := g_package||'delete_validate';
823 --
824 Begin
825 hr_utility.set_location('Entering:'||l_proc, 5);
826 --
827 -- Call all supporting business operations
828 --
829 dt_delete_validate
830 (p_datetrack_mode => p_datetrack_mode,
831 p_validation_start_date => p_validation_start_date,
832 p_validation_end_date => p_validation_end_date,
833 p_dpnt_cvrd_othr_pgm_rt_id => p_rec.dpnt_cvrd_othr_pgm_rt_id);
834 --
835 hr_utility.set_location(' Leaving:'||l_proc, 10);
836 End delete_validate;
837 --
838 --
839 -- ---------------------------------------------------------------------------
840 -- |---------------------< return_legislation_code >-------------------------|
841 -- ---------------------------------------------------------------------------
842 --
843 function return_legislation_code
844 (p_dpnt_cvrd_othr_pgm_rt_id in number) return varchar2 is
845 --
846 -- Declare cursor
847 --
848 cursor csr_leg_code is
849 select a.legislation_code
850 from per_business_groups a,
851 ben_dpnt_cvrd_othr_pgm_rt_f b
852 where b.dpnt_cvrd_othr_pgm_rt_id = p_dpnt_cvrd_othr_pgm_rt_id
853 and a.business_group_id = b.business_group_id;
854 --
855 -- Declare local variables
856 --
857 l_legislation_code varchar2(150);
858 l_proc varchar2(72) := g_package||'return_legislation_code';
859 --
860 begin
861 --
862 hr_utility.set_location('Entering:'|| l_proc, 10);
863 --
864 -- Ensure that all the mandatory parameter are not null
865 --
866 hr_api.mandatory_arg_error(p_api_name => l_proc,
867 p_argument => 'dpnt_cvrd_othr_pgm_rt_id',
868 p_argument_value => p_dpnt_cvrd_othr_pgm_rt_id);
869 --
870 open csr_leg_code;
871 --
872 fetch csr_leg_code into l_legislation_code;
873 --
874 if csr_leg_code%notfound then
875 --
876 close csr_leg_code;
877 --
878 -- The primary key is invalid therefore we must error
879 --
880 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
881 fnd_message.raise_error;
882 --
883 end if;
884 --
885 close csr_leg_code;
886 --
887 hr_utility.set_location(' Leaving:'|| l_proc, 20);
888 --
889 return l_legislation_code;
890 --
891 end return_legislation_code;
892 --
893 end ben_dop_bus;