DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ECL_BUS

Source


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