DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_DPC_BUS

Source


1 Package Body ben_dpc_bus as
2 /* $Header: bedpcrhi.pkb 120.1 2006/03/31 01:02:57 gsehgal noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_dpc_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_dpnt_cvrd_anthr_pl_cvg_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_anthr_pl_cvg_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.
30 --
27 --
28 -- Post Success
29 --   Processing continues
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_anthr_pl_cvg_id(p_dpnt_cvrd_anthr_pl_cvg_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_anthr_pl_cvg_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_dpc_shd.api_updating
49     (p_effective_date              => p_effective_date,
50      p_dpnt_cvrd_anthr_pl_cvg_id                => p_dpnt_cvrd_anthr_pl_cvg_id,
51      p_object_version_number       => p_object_version_number);
52   --
53   if (l_api_updating
54      and nvl(p_dpnt_cvrd_anthr_pl_cvg_id,hr_api.g_number)
55      <>  ben_dpc_shd.g_old_rec.dpnt_cvrd_anthr_pl_cvg_id) then
56     --
57     -- raise error as PK has changed
58     --
59     ben_dpc_shd.constraint_error('BEN_DPNT_CVRD_ANTHR_PL_CVG_PK');
60     --
61   elsif not l_api_updating then
62     --
63     -- check if PK is null
64     --
65     if p_dpnt_cvrd_anthr_pl_cvg_id is not null then
66       --
67       -- raise error as PK is not null
68       --
69       ben_dpc_shd.constraint_error('BEN_DPNT_CVRD_ANTHR_PL_CVG_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_anthr_pl_cvg_id;
78 --
79 -- ----------------------------------------------------------------------------
80 -- |------< chk_excld_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 --   dpnt_cvrd_anthr_pl_cvg_id PK of record being inserted or updated.
91 --   excld_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_excld_flag(p_dpnt_cvrd_anthr_pl_cvg_id                in number,
106                             p_excld_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_excld_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_dpc_shd.api_updating
118     (p_dpnt_cvrd_anthr_pl_cvg_id                => p_dpnt_cvrd_anthr_pl_cvg_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_excld_flag
124       <> nvl(ben_dpc_shd.g_old_rec.excld_flag,hr_api.g_varchar2)
125       or not l_api_updating) then
126     --
127     -- check if value of lookup falls within lookup type.
128     --
129     --
130     if hr_api.not_exists_in_hr_lookups
131           (p_lookup_type    => 'YES_NO',
132            p_lookup_code    => p_excld_flag,
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_excld_flag');
139       fnd_message.set_token('TYPE','YES_NO');
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_excld_flag;
149 --
150 -- ----------------------------------------------------------------------------
151 -- |------< chk_cvg_det_dt_cd >------|
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_anthr_pl_cvg_id PK of record being inserted or updated.
162 --   cvg_det_dt_cd 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_cvg_det_dt_cd(p_dpnt_cvrd_anthr_pl_cvg_id                in number,
177                             p_cvg_det_dt_cd               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_cvg_det_dt_cd';
182   l_api_updating boolean;
183   --
184 Begin
185   --
186   hr_utility.set_location('Entering:'||l_proc, 5);
187   --
188   l_api_updating := ben_dpc_shd.api_updating
189     (p_dpnt_cvrd_anthr_pl_cvg_id                => p_dpnt_cvrd_anthr_pl_cvg_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_cvg_det_dt_cd
195       <> nvl(ben_dpc_shd.g_old_rec.cvg_det_dt_cd,hr_api.g_varchar2)
196       or not l_api_updating)
197       and p_cvg_det_dt_cd is not null then
198     --
199     -- check if value of lookup falls within lookup type.
200     --
201     if hr_api.not_exists_in_hr_lookups
202           (p_lookup_type    => 'BEN_CVG_DET_DT',
203            p_lookup_code    => p_cvg_det_dt_cd,
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_cvg_det_dt_cd');
210       fnd_message.set_token('TYPE','BEN_CVG_DET_DT');
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_cvg_det_dt_cd;
220 --
221 --
222 -- ----------------------------------------------------------------------------
223 -- |------< chk_duplicate_rows >------|
224 -- ----------------------------------------------------------------------------
225 --
226 -- Description
227 --   This procedure is used to check if duplicate rows exist
228 --
229 -- Pre Conditions
230 --   None.
231 --
232 -- In Parameters
233 
234 --   p_dpnt_cvrd_anthr_pl_cvg_id - primary key of the table
235 --   p_pl_id - duplicate value to be checked
236 --   p_dpnt_cvg_eligy_prfl_id - master's id
237 --   p_effective_date
238 --   p_business_group_id
239 
240 -- Post Success
241 --   Processing continues
242 --
243 -- Post Failure
244 --   Errors handled by the procedure
245 --
246 -- Access Status
247 --   Internal table handler use only.
248 --
249 Procedure chk_duplicate_rows(p_dpnt_cvrd_anthr_pl_cvg_id in number,
250                              p_pl_id in number,
251                              p_dpnt_cvg_eligy_prfl_id in number,
252                              p_business_group_id in varchar2,
253                              p_effective_date in date) is
254   --
255   l_proc         varchar2(72) := g_package||'chk_duplicate_rows';
256   l_api_updating boolean;
257 
258   dummy varchar2(1);
259   cursor c1 is select null from ben_dpnt_cvrd_anthr_pl_cvg_f
260      where (dpnt_cvrd_anthr_pl_cvg_id <> p_dpnt_cvrd_anthr_pl_cvg_id or p_dpnt_cvrd_anthr_pl_cvg_id is null) and
261            dpnt_cvg_eligy_prfl_id = p_dpnt_cvg_eligy_prfl_id and
262            pl_id = p_pl_id and
263            business_group_id = p_business_group_id and
264            p_effective_date between effective_start_date and effective_end_date;
265 
266 
267 --
268 Begin
269   --
270   hr_utility.set_location('Entering:'||l_proc, 6);
271   --
272   open c1;
273   fetch c1 into dummy;
274   if c1%found then
275     close c1;
276     fnd_message.set_name('BEN','BEN_91009_NAME_NOT_UNIQUE');
277     fnd_message.raise_error;
278   end if;
279   close c1;
280   --
281   hr_utility.set_location('Leaving:'||l_proc, 10);
282   --
283 End chk_duplicate_rows;
284 ---
285 --
286 -- added for Bug 5078478 .. add this procedure to check the duplicate seq no
287 -- |--------------------< chk_duplicate_ordr_num >----------------------------|
288 -- ----------------------------------------------------------------------------
289 --
290 -- Description
291 --
292 -- Pre Conditions
293 --   None.
294 --
295 -- In Parameters
296 --    p_dpnt_cvg_eligy_prfl_id
297 --    p_dpnt_cvrd_anthr_pl_cvg_id
298 --    p_ordr_num
299 --    p_validation_start_date
300 --    p_validation_end_date
301 --    p_business_group_id
302 --
303 -- Post Success
304 --   Processing continues
305 --
306 -- Post Failure
307 --   Errors handled by the procedure
308 --
309 -- Access Status
310 --   Internal table handler use only.
311 --
312 -- ----------------------------------------------------------------------------
313 
314 
315 procedure chk_duplicate_ordr_num
316            (p_dpnt_cvg_eligy_prfl_id in number
317            ,p_dpnt_cvrd_anthr_pl_cvg_id  in number
318            ,p_ordr_num in number
319            ,p_validation_start_date in date
320 	   ,p_validation_end_date in date
321            ,p_business_group_id in number)
322 is
323 l_proc   varchar2(72) := g_package||' chk_duplicate_ordr_num ';
324    l_dummy    char(1);
325    cursor c1 is select null
326                   from ben_dpnt_cvrd_anthr_pl_cvg_f
327                  where dpnt_cvg_eligy_prfl_id = p_dpnt_cvg_eligy_prfl_id
328 		   and dpnt_cvrd_anthr_pl_cvg_id <> nvl(p_dpnt_cvrd_anthr_pl_cvg_id,-1)
329 		   and p_validation_start_date <= effective_end_date
330 		   and p_validation_end_date >= effective_start_date
331                    and business_group_id + 0 = p_business_group_id
332                    and ordr_num = p_ordr_num;
333 --
334 Begin
335    hr_utility.set_location('Entering:'||l_proc, 5);
336 
337    --
338    open c1;
339    fetch c1 into l_dummy;
340    --
341    if c1%found then
342       fnd_message.set_name('BEN','BEN_91001_SEQ_NOT_UNIQUE');
343       fnd_message.raise_error;
344    end if;
345    close c1;
346    --
347    hr_utility.set_location('Leaving:'||l_proc, 15);
348 End chk_duplicate_ordr_num;
349 --
350 
351 ---
352 -- ----------------------------------------------------------------------------
353 -- |--------------------------< dt_update_validate >--------------------------|
354 -- ----------------------------------------------------------------------------
355 -- {Start Of Comments}
356 --
357 -- Description:
358 --   This procedure is used for referential integrity of datetracked
359 --   parent entities when a datetrack update operation is taking place
360 --   and where there is no cascading of update defined for this entity.
361 --
362 -- Prerequisites:
363 --   This procedure is called from the update_validate.
364 --
365 -- In Parameters:
366 --
367 -- Post Success:
368 --   Processing continues.
369 --
370 -- Post Failure:
371 --
372 -- Developer Implementation Notes:
373 --   This procedure should not need maintenance unless the HR Schema model
374 --   changes.
375 --
376 -- Access Status:
377 --   Internal Row Handler Use Only.
378 --
379 -- {End Of Comments}
380 -- ----------------------------------------------------------------------------
381 Procedure dt_update_validate
382             (p_dpnt_cvg_eligy_prfl_id        in number default hr_api.g_number,
383              p_pl_id                         in number default hr_api.g_number,
384 	     p_datetrack_mode		     in varchar2,
385              p_validation_start_date	     in date,
386 	     p_validation_end_date	     in date) Is
387 --
388   l_proc	    varchar2(72) := g_package||'dt_update_validate';
389   l_integrity_error Exception;
390   l_table_name	    all_tables.table_name%TYPE;
391 --
392 Begin
393   hr_utility.set_location('Entering:'||l_proc, 5);
394   --
395   -- Ensure that the p_datetrack_mode argument is not null
396   --
397   hr_api.mandatory_arg_error
398     (p_api_name       => l_proc,
399      p_argument       => 'datetrack_mode',
400      p_argument_value => p_datetrack_mode);
401   --
402   -- Only perform the validation if the datetrack update mode is valid
403   --
404   If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
405     --
406     --
407     -- Ensure the arguments are not null
408     --
409     hr_api.mandatory_arg_error
410       (p_api_name       => l_proc,
411        p_argument       => 'validation_start_date',
412        p_argument_value => p_validation_start_date);
413     --
414     hr_api.mandatory_arg_error
415       (p_api_name       => l_proc,
416        p_argument       => 'validation_end_date',
417        p_argument_value => p_validation_end_date);
418     --
419     If ((nvl(p_dpnt_cvg_eligy_prfl_id, hr_api.g_number) <> hr_api.g_number) and
420       NOT (dt_api.check_min_max_dates
421             (p_base_table_name => 'ben_dpnt_cvg_eligy_prfl_f',
422              p_base_key_column => 'dpnt_cvg_eligy_prfl_id',
423              p_base_key_value  => p_dpnt_cvg_eligy_prfl_id,
424              p_from_date       => p_validation_start_date,
425              p_to_date         => p_validation_end_date)))  Then
426       l_table_name := 'ben_dpnt_cvg_eligy_prfl_f';
427       Raise l_integrity_error;
428     End If;
429     If ((nvl(p_pl_id, hr_api.g_number) <> hr_api.g_number) and
430       NOT (dt_api.check_min_max_dates
431             (p_base_table_name => 'ben_pl_f',
432              p_base_key_column => 'pl_id',
436       l_table_name := 'ben_pl_f';
433              p_base_key_value  => p_pl_id,
434              p_from_date       => p_validation_start_date,
435              p_to_date         => p_validation_end_date)))  Then
437       Raise l_integrity_error;
438     End If;
439     --
440   End If;
441   --
442   hr_utility.set_location(' Leaving:'||l_proc, 10);
443 Exception
444   When l_integrity_error Then
445     --
446     -- A referential integrity check was violated therefore
447     -- we must error
448     --
449     ben_utility.parent_integrity_error(p_table_name => l_table_name);
450   When Others Then
451     --
452     -- An unhandled or unexpected error has occurred which
453     -- we must report
454     --
455     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
456     fnd_message.set_token('PROCEDURE', l_proc);
457     fnd_message.set_token('STEP','15');
458     fnd_message.raise_error;
459 End dt_update_validate;
460 --
461 -- ----------------------------------------------------------------------------
462 -- |--------------------------< dt_delete_validate >--------------------------|
463 -- ----------------------------------------------------------------------------
464 -- {Start Of Comments}
465 --
466 -- Description:
467 --   This procedure is used for referential integrity of datetracked
468 --   child entities when either a datetrack DELETE or ZAP is in operation
469 --   and where there is no cascading of delete defined for this entity.
470 --   For the datetrack mode of DELETE or ZAP we must ensure that no
471 --   datetracked child rows exist between the validation start and end
472 --   dates.
473 --
474 -- Prerequisites:
475 --   This procedure is called from the delete_validate.
476 --
477 -- In Parameters:
478 --
479 -- Post Success:
480 --   Processing continues.
481 --
482 -- Post Failure:
483 --   If a row exists by determining the returning Boolean value from the
484 --   generic dt_api.rows_exist function then we must supply an error via
485 --   the use of the local exception handler l_rows_exist.
486 --
487 -- Developer Implementation Notes:
488 --   This procedure should not need maintenance unless the HR Schema model
489 --   changes.
490 --
491 -- Access Status:
492 --   Internal Row Handler Use Only.
493 --
494 -- {End Of Comments}
495 -- ----------------------------------------------------------------------------
496 Procedure dt_delete_validate
497             (p_dpnt_cvrd_anthr_pl_cvg_id		in number,
498              p_datetrack_mode		in varchar2,
499 	     p_validation_start_date	in date,
500 	     p_validation_end_date	in date) Is
501 --
502   l_proc	varchar2(72) 	:= g_package||'dt_delete_validate';
503   l_rows_exist	Exception;
504   l_table_name	all_tables.table_name%TYPE;
505 --
506 Begin
507   hr_utility.set_location('Entering:'||l_proc, 5);
508   --
509   -- Ensure that the p_datetrack_mode argument is not null
510   --
511   hr_api.mandatory_arg_error
512     (p_api_name       => l_proc,
513      p_argument       => 'datetrack_mode',
514      p_argument_value => p_datetrack_mode);
515   --
516   -- Only perform the validation if the datetrack mode is either
517   -- DELETE or ZAP
518   --
519   If (p_datetrack_mode = 'DELETE' or
520       p_datetrack_mode = 'ZAP') then
521     --
522     --
523     -- Ensure the arguments are not null
524     --
525     hr_api.mandatory_arg_error
526       (p_api_name       => l_proc,
527        p_argument       => 'validation_start_date',
528        p_argument_value => p_validation_start_date);
529     --
530     hr_api.mandatory_arg_error
531       (p_api_name       => l_proc,
532        p_argument       => 'validation_end_date',
533        p_argument_value => p_validation_end_date);
534     --
535     hr_api.mandatory_arg_error
536       (p_api_name       => l_proc,
537        p_argument       => 'dpnt_cvrd_anthr_pl_cvg_id',
538        p_argument_value => p_dpnt_cvrd_anthr_pl_cvg_id);
539     --
540     --
541     --
542   End If;
543   --
547     --
544   hr_utility.set_location(' Leaving:'||l_proc, 10);
545 Exception
546   When l_rows_exist Then
548     -- A referential integrity check was violated therefore
549     -- we must error
550     --
551     fnd_message.set_name('PAY', 'HR_7215_DT_CHILD_EXISTS');
552     fnd_message.set_token('TABLE_NAME', l_table_name);
553     fnd_message.raise_error;
554   When Others Then
555     --
559     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
556     -- An unhandled or unexpected error has occurred which
557     -- we must report
558     --
560     fnd_message.set_token('PROCEDURE', l_proc);
561     fnd_message.set_token('STEP','15');
562     fnd_message.raise_error;
563 End dt_delete_validate;
564 --
565 -- ----------------------------------------------------------------------------
566 -- |---------------------------< insert_validate >----------------------------|
567 -- ----------------------------------------------------------------------------
568 Procedure insert_validate
569 	(p_rec 			 in ben_dpc_shd.g_rec_type,
570 	 p_effective_date	 in date,
571 	 p_datetrack_mode	 in varchar2,
572 	 p_validation_start_date in date,
573 	 p_validation_end_date	 in date) is
574 --
575   l_proc	varchar2(72) := g_package||'insert_validate';
576 --
577 Begin
578   hr_utility.set_location('Entering:'||l_proc, 5);
579   --
580   -- Call all supporting business operations
581   --
582   --
583   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
584   --
585   chk_duplicate_rows
586   (p_dpnt_cvrd_anthr_pl_cvg_id          => p_rec.dpnt_cvrd_anthr_pl_cvg_id,
587    p_pl_id                      => p_rec.pl_id,
588    p_dpnt_cvg_eligy_prfl_id     => p_rec.dpnt_cvg_eligy_prfl_id,
589    p_business_group_id          => p_rec.business_group_id,
590    p_effective_date             => p_effective_date);
591 
592   --
593   chk_dpnt_cvrd_anthr_pl_cvg_id
594   (p_dpnt_cvrd_anthr_pl_cvg_id          => p_rec.dpnt_cvrd_anthr_pl_cvg_id,
595    p_effective_date        => p_effective_date,
596    p_object_version_number => p_rec.object_version_number);
597   --
598   chk_excld_flag
599   (p_dpnt_cvrd_anthr_pl_cvg_id          => p_rec.dpnt_cvrd_anthr_pl_cvg_id,
600    p_excld_flag         => p_rec.excld_flag,
601    p_effective_date        => p_effective_date,
602    p_object_version_number => p_rec.object_version_number);
603   --
604   chk_cvg_det_dt_cd
605   (p_dpnt_cvrd_anthr_pl_cvg_id          => p_rec.dpnt_cvrd_anthr_pl_cvg_id,
606    p_cvg_det_dt_cd         => p_rec.cvg_det_dt_cd,
607    p_effective_date        => p_effective_date,
608    p_object_version_number => p_rec.object_version_number);
609    -- added for bug: 5078478
610    chk_duplicate_ordr_num
611            (p_dpnt_cvg_eligy_prfl_id => p_rec.dpnt_cvg_eligy_prfl_id
612            ,p_dpnt_cvrd_anthr_pl_cvg_id  => p_rec.dpnt_cvrd_anthr_pl_cvg_id
613            ,p_ordr_num => p_rec.ordr_num
614            ,p_validation_start_date => p_validation_start_date
615 	   ,p_validation_end_date =>p_validation_end_date
616            ,p_business_group_id => p_rec.business_group_id);
617 
618   --
619   hr_utility.set_location(' Leaving:'||l_proc, 10);
620 End insert_validate;
621 --
622 -- ----------------------------------------------------------------------------
623 -- |---------------------------< update_validate >----------------------------|
624 -- ----------------------------------------------------------------------------
625 Procedure update_validate
626 	(p_rec 			 in ben_dpc_shd.g_rec_type,
627 	 p_effective_date	 in date,
628 	 p_datetrack_mode	 in varchar2,
629 	 p_validation_start_date in date,
630 	 p_validation_end_date	 in date) is
631 --
632   l_proc	varchar2(72) := g_package||'update_validate';
633 --
634 Begin
635   hr_utility.set_location('Entering:'||l_proc, 5);
636   --
637   -- Call all supporting business operations
638   --
639   --
640   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
641   --
642   chk_duplicate_rows
643   (p_dpnt_cvrd_anthr_pl_cvg_id          => p_rec.dpnt_cvrd_anthr_pl_cvg_id,
644    p_pl_id                      => p_rec.pl_id,
645    p_dpnt_cvg_eligy_prfl_id     => p_rec.dpnt_cvg_eligy_prfl_id,
646    p_business_group_id          => p_rec.business_group_id,
647    p_effective_date             => p_effective_date);
648   --
649   chk_dpnt_cvrd_anthr_pl_cvg_id
650   (p_dpnt_cvrd_anthr_pl_cvg_id          => p_rec.dpnt_cvrd_anthr_pl_cvg_id,
651    p_effective_date        => p_effective_date,
652    p_object_version_number => p_rec.object_version_number);
653   --
654   chk_excld_flag
655   (p_dpnt_cvrd_anthr_pl_cvg_id          => p_rec.dpnt_cvrd_anthr_pl_cvg_id,
656    p_excld_flag         => p_rec.excld_flag,
657    p_effective_date        => p_effective_date,
658    p_object_version_number => p_rec.object_version_number);
659   --
660   chk_cvg_det_dt_cd
661   (p_dpnt_cvrd_anthr_pl_cvg_id          => p_rec.dpnt_cvrd_anthr_pl_cvg_id,
662    p_cvg_det_dt_cd         => p_rec.cvg_det_dt_cd,
663    p_effective_date        => p_effective_date,
664    p_object_version_number => p_rec.object_version_number);
665   --
666    -- added for bug: 5078478
667    chk_duplicate_ordr_num
668            (p_dpnt_cvg_eligy_prfl_id => p_rec.dpnt_cvg_eligy_prfl_id
669            ,p_dpnt_cvrd_anthr_pl_cvg_id  => p_rec.dpnt_cvrd_anthr_pl_cvg_id
670            ,p_ordr_num => p_rec.ordr_num
671            ,p_validation_start_date => p_validation_start_date
672 	   ,p_validation_end_date =>p_validation_end_date
673            ,p_business_group_id => p_rec.business_group_id);
674 ---
675 
676   -- Call the datetrack update integrity operation
677   --
678   dt_update_validate
679     (p_dpnt_cvg_eligy_prfl_id        => p_rec.dpnt_cvg_eligy_prfl_id,
680              p_pl_id                         => p_rec.pl_id,
681      p_datetrack_mode                => p_datetrack_mode,
682      p_validation_start_date	     => p_validation_start_date,
683      p_validation_end_date	     => p_validation_end_date);
684   --
688 -- ----------------------------------------------------------------------------
685   hr_utility.set_location(' Leaving:'||l_proc, 10);
686 End update_validate;
687 --
689 -- |---------------------------< delete_validate >----------------------------|
690 -- ----------------------------------------------------------------------------
691 Procedure delete_validate
692 	(p_rec 			 in ben_dpc_shd.g_rec_type,
693 	 p_effective_date	 in date,
694 	 p_datetrack_mode	 in varchar2,
695 	 p_validation_start_date in date,
696 	 p_validation_end_date	 in date) is
697 --
698   l_proc	varchar2(72) := g_package||'delete_validate';
699 --
700 Begin
701   hr_utility.set_location('Entering:'||l_proc, 5);
702   --
703   -- Call all supporting business operations
704   --
705   dt_delete_validate
706     (p_datetrack_mode		=> p_datetrack_mode,
707      p_validation_start_date	=> p_validation_start_date,
708      p_validation_end_date	=> p_validation_end_date,
709      p_dpnt_cvrd_anthr_pl_cvg_id		=> p_rec.dpnt_cvrd_anthr_pl_cvg_id);
710   --
711   hr_utility.set_location(' Leaving:'||l_proc, 10);
712 End delete_validate;
713 --
714 --
715 --  ---------------------------------------------------------------------------
716 --  |---------------------< return_legislation_code >-------------------------|
717 --  ---------------------------------------------------------------------------
718 --
719 function return_legislation_code
720   (p_dpnt_cvrd_anthr_pl_cvg_id in number) return varchar2 is
721   --
722   -- Declare cursor
723   --
724   cursor csr_leg_code is
725     select a.legislation_code
726     from   per_business_groups a,
727            ben_dpnt_cvrd_anthr_pl_cvg_f b
728     where b.dpnt_cvrd_anthr_pl_cvg_id      = p_dpnt_cvrd_anthr_pl_cvg_id
729     and   a.business_group_id = b.business_group_id;
730   --
731   -- Declare local variables
732   --
733   l_legislation_code  varchar2(150);
734   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
735   --
736 begin
737   --
738   hr_utility.set_location('Entering:'|| l_proc, 10);
739   --
740   -- Ensure that all the mandatory parameter are not null
741   --
742   hr_api.mandatory_arg_error(p_api_name       => l_proc,
743                              p_argument       => 'dpnt_cvrd_anthr_pl_cvg_id',
744                              p_argument_value => p_dpnt_cvrd_anthr_pl_cvg_id);
745   --
746   open csr_leg_code;
747     --
748     fetch csr_leg_code into l_legislation_code;
749     --
750     if csr_leg_code%notfound then
751       --
752       close csr_leg_code;
753       --
754       -- The primary key is invalid therefore we must error
755       --
756       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
757       fnd_message.raise_error;
758       --
759     end if;
760     --
761   close csr_leg_code;
762   --
763   hr_utility.set_location(' Leaving:'|| l_proc, 20);
764   --
765   return l_legislation_code;
766   --
767 end return_legislation_code;
768 --
769 end ben_dpc_bus;