DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EAO_BUS

Source


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