DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EQT_BUS

Source


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