DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_DCL_BUS

Source


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