DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_QTR_BUS

Source


1 Package Body ben_qtr_bus as
2 /* $Header: beqtrrhi.pkb 120.2.12010000.2 2008/08/05 15:25:12 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_qtr_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------< chk_qual_titl_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 --   qual_titl_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_qual_titl_rt_id
38             (p_qual_titl_rt_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_qual_titl_rt_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_qtr_shd.api_updating
50     (p_effective_date        => p_effective_date,
51      p_qual_titl_rt_id => p_qual_titl_rt_id,
52      p_object_version_number => p_object_version_number);
53   --
54   if (l_api_updating
55      and nvl(p_qual_titl_rt_id,hr_api.g_number)
56      <>  ben_qtr_shd.g_old_rec.qual_titl_rt_id) then
57     --
58     -- raise error as PK has changed
59     --
60     ben_qtr_shd.constraint_error('BEN_qual_titl_rt_F_PK');
61     --
62   elsif not l_api_updating then
63     --
64     -- check if PK is null
65     --
66     if p_qual_titl_rt_id is not null then
67       --
68       -- raise error as PK is not null
69       --
70       ben_qtr_shd.constraint_error('BEN_qual_titl_rt_F_PK');
71       --
72     end if;
73     --
74   end if;
75   --
76   hr_utility.set_location('Leaving:'||l_proc, 10);
77   --
78 End chk_qual_titl_rt_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 --   qual_titl_rt_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_qual_titl_rt_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_qtr_shd.api_updating
119     (p_qual_titl_rt_id  => p_qual_titl_rt_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_qtr_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_qual_titl_rt_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_qual_titl_rt_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_qtr_shd.api_updating
197      (p_qual_titl_rt_id => p_qual_titl_rt_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_qtr_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_qtr_shd.constraint_error('BEN_qual_titl_rt_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_qual_titl_rt_id
244 --   p_vrbl_rt_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_qual_titl_rt_id    in number,
261                             p_qualification_type_id       in number,
262                             p_title                       in varchar2,
263                             p_vrbl_rt_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_qual_titl_rt_f qtr
276        where nvl(qtr.qualification_type_id,-1) = nvl(p_qualification_type_id,-1)
277        and   nvl(qtr.title,-1) = nvl(p_title,-1)
278        and qtr.vrbl_rt_prfl_id = p_vrbl_rt_prfl_id
279        and qtr.qual_titl_rt_id <> nvl(p_qual_titl_rt_id,hr_api.g_number)
280        and qtr.business_group_id = p_business_group_id
281        and p_validation_start_date <= qtr.effective_end_date
282        and p_validation_end_date >= qtr.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_92992_DUPS_ROW');
299       fnd_message.set_token('VAR1','Qualification Title criteria');
300       fnd_message.set_token('VAR2','Variable Rate Profile');
301       fnd_message.raise_error;
302       --
303     end if;
304   close c1;
305   --
306   hr_utility.set_location('Leaving:'||l_proc,10);
307   --
308 End chk_dup_title_criteria;
309 --
310 -- added for Bug 5078478 .. add this procedure to check the duplicate seq no
311 -- |--------------------< chk_duplicate_ordr_num >----------------------------|
312 -- ----------------------------------------------------------------------------
313 --
314 -- Description
315 --
316 -- Pre Conditions
317 --   None.
318 --
319 -- In Parameters
320 --    p_qual_titl_rt_id
321 --    p_vrbl_rt_prfl_id
322 --    p_ordr_num
323 --    p_effective_date
324 --    p_business_group_id
325 --
326 -- Post Success
327 --   Processing continues
328 --
329 -- Post Failure
330 --   Errors handled by the procedure
331 --
332 -- Access Status
333 --   Internal table handler use only.
334 --
335 -- ----------------------------------------------------------------------------
336 
337 
338 procedure chk_duplicate_ordr_num
339            (p_vrbl_rt_prfl_id in number
340            ,p_qual_titl_rt_id  in number
341            ,p_ordr_num in number
342            ,p_validation_start_date in date
343 	   ,p_validation_end_date in date
344            ,p_business_group_id in number)
345 is
346 l_proc   varchar2(72) := g_package||' chk_duplicate_ordr_num ';
347    l_dummy    char(1);
348    cursor c1 is select null
349                   from ben_qual_titl_rt_f
350                  where vrbl_rt_prfl_id = p_vrbl_rt_prfl_id
351                    -- changed against bug: 5113011
352 		   and qual_titl_rt_id   <> nvl(p_qual_titl_rt_id  ,-1)
353                    -- and qualification_type_id   <> nvl(p_qualification_type_id  ,-1)
354                    --and p_effective_date between effective_start_date
355                    --                         and effective_end_date
356 		   and p_validation_start_date <= effective_end_date
357 		   and p_validation_end_date >= effective_start_date
358                    and business_group_id + 0 = p_business_group_id
359                    and ordr_num = p_ordr_num;
360 --
361 Begin
362    hr_utility.set_location('Entering:'||l_proc, 5);
363 
364    --
365    open c1;
366    fetch c1 into l_dummy;
367    --
368    if c1%found then
369       fnd_message.set_name('BEN','BEN_91001_SEQ_NOT_UNIQUE');
370       fnd_message.raise_error;
371    end if;
372    close c1;
373    --
374    hr_utility.set_location('Leaving:'||l_proc, 15);
375 End chk_duplicate_ordr_num;
376 --
377 -- ----------------------------------------------------------------------------
378 -- |--------------------------< dt_update_validate >--------------------------|
379 -- ----------------------------------------------------------------------------
380 -- {Start Of Comments}
381 --
382 -- Description:
383 --   This procedure is used for referential integrity of datetracked
384 --   parent entities when a datetrack update operation is taking place
385 --   and where there is no cascading of update defined for this entity.
386 --
387 -- Prerequisites:
388 --   This procedure is called from the update_validate.
389 --
390 -- In Parameters:
391 --
392 -- Post Success:
393 --   Processing continues.
394 --
395 -- Post Failure:
396 --
397 -- Developer Implementation Notes:
398 --   This procedure should not need maintenance unless the HR Schema model
399 --   changes.
400 --
401 -- Access Status:
402 --   Internal Row Handler Use Only.
403 --
404 -- {End Of Comments}
405 -- ----------------------------------------------------------------------------
406 Procedure dt_update_validate
407             (p_vrbl_rt_prfl_id                 in number default hr_api.g_number,
408 	     p_datetrack_mode		     in varchar2,
409              p_validation_start_date	     in date,
410 	     p_validation_end_date	     in date) Is
411 --
412   l_proc	    varchar2(72) := g_package||'dt_update_validate';
413   l_integrity_error Exception;
414   l_table_name	    all_tables.table_name%TYPE;
415 --
416 Begin
417   hr_utility.set_location('Entering:'||l_proc, 5);
418   --
419   -- Ensure that the p_datetrack_mode argument is not null
420   --
421   hr_api.mandatory_arg_error
422     (p_api_name       => l_proc,
423      p_argument       => 'datetrack_mode',
424      p_argument_value => p_datetrack_mode);
425   --
426   -- Only perform the validation if the datetrack update mode is valid
427   --
431     -- Ensure the arguments are not null
428   If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
429     --
430     --
432     --
433     hr_api.mandatory_arg_error
434       (p_api_name       => l_proc,
435        p_argument       => 'validation_start_date',
436        p_argument_value => p_validation_start_date);
437     --
438     hr_api.mandatory_arg_error
439       (p_api_name       => l_proc,
440        p_argument       => 'validation_end_date',
441        p_argument_value => p_validation_end_date);
442     --
443     If ((nvl(p_vrbl_rt_prfl_id, hr_api.g_number) <> hr_api.g_number) and
444       NOT (dt_api.check_min_max_dates
445             (p_base_table_name => 'ben_vrbl_rt_prfl_f',
446              p_base_key_column => 'vrbl_rt_prfl_id',
447              p_base_key_value  => p_vrbl_rt_prfl_id,
448              p_from_date       => p_validation_start_date,
449              p_to_date         => p_validation_end_date)))  Then
450       l_table_name := 'ben_vrbl_rt_prfl_f';
451       Raise l_integrity_error;
452     End If;
453     --
454   End If;
455   --
456   hr_utility.set_location(' Leaving:'||l_proc, 10);
457 Exception
458   When l_integrity_error Then
459     --
460     -- A referential integrity check was violated therefore
461     -- we must error
462     --
463     ben_utility.parent_integrity_error(p_table_name => l_table_name);
464     --
465   When Others Then
466     --
467     -- An unhandled or unexpected error has occurred which
468     -- we must report
469     --
470     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
471     fnd_message.set_token('PROCEDURE', l_proc);
472     fnd_message.set_token('STEP','15');
473     fnd_message.raise_error;
474 End dt_update_validate;
475 --
476 -- ----------------------------------------------------------------------------
477 -- |--------------------------< dt_delete_validate >--------------------------|
478 -- ----------------------------------------------------------------------------
479 -- {Start Of Comments}
480 --
481 -- Description:
482 --   This procedure is used for referential integrity of datetracked
483 --   child entities when either a datetrack DELETE or ZAP is in operation
484 --   and where there is no cascading of delete defined for this entity.
485 --   For the datetrack mode of DELETE or ZAP we must ensure that no
486 --   datetracked child rows exist between the validation start and end
487 --   dates.
488 --
489 -- Prerequisites:
490 --   This procedure is called from the delete_validate.
491 --
492 -- In Parameters:
493 --
494 -- Post Success:
495 --   Processing continues.
496 --
497 -- Post Failure:
498 --   If a row exists by determining the returning Boolean value from the
499 --   generic dt_api.rows_exist function then we must supply an error via
500 --   the use of the local exception handler l_rows_exist.
501 --
502 -- Developer Implementation Notes:
503 --   This procedure should not need maintenance unless the HR Schema model
504 --   changes.
505 --
506 -- Access Status:
507 --   Internal Row Handler Use Only.
508 --
509 -- {End Of Comments}
510 -- ----------------------------------------------------------------------------
511 Procedure dt_delete_validate
512             (p_qual_titl_rt_id in number,
513              p_datetrack_mode        in varchar2,
514 	     p_validation_start_date in date,
515 	     p_validation_end_date   in date) Is
516 --
517   l_proc	varchar2(72) 	:= g_package||'dt_delete_validate';
518   l_rows_exist	Exception;
519   l_table_name	all_tables.table_name%TYPE;
520 --
521 Begin
522   hr_utility.set_location('Entering:'||l_proc, 5);
523   --
524   -- Ensure that the p_datetrack_mode argument is not null
525   --
526   hr_api.mandatory_arg_error
527     (p_api_name       => l_proc,
528      p_argument       => 'datetrack_mode',
529      p_argument_value => p_datetrack_mode);
530   --
531   -- Only perform the validation if the datetrack mode is either
532   -- DELETE or ZAP
533   --
534   If (p_datetrack_mode = 'DELETE' or
535       p_datetrack_mode = 'ZAP') then
536     --
537     --
538     -- Ensure the arguments are not null
539     --
540     hr_api.mandatory_arg_error
541       (p_api_name       => l_proc,
542        p_argument       => 'validation_start_date',
543        p_argument_value => p_validation_start_date);
544     --
545     hr_api.mandatory_arg_error
546       (p_api_name       => l_proc,
547        p_argument       => 'validation_end_date',
548        p_argument_value => p_validation_end_date);
549     --
550     hr_api.mandatory_arg_error
551       (p_api_name       => l_proc,
552        p_argument       => 'qual_titl_rt_id',
553        p_argument_value => p_qual_titl_rt_id);
554     --
555     --
556     --
557   End If;
558   --
559   hr_utility.set_location(' Leaving:'||l_proc, 10);
560 Exception
561   When l_rows_exist Then
562     --
563     -- A referential integrity check was violated therefore
564     -- we must error
565     --
566     fnd_message.set_name('PAY', 'HR_7215_DT_CHILD_EXISTS');
567     fnd_message.set_token('TABLE_NAME', l_table_name);
571     -- An unhandled or unexpected error has occurred which
568     fnd_message.raise_error;
569   When Others Then
570     --
572     -- we must report
573     --
574     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
575     fnd_message.set_token('PROCEDURE', l_proc);
576     fnd_message.set_token('STEP','15');
577     fnd_message.raise_error;
578 End dt_delete_validate;
579 --
580 -- ----------------------------------------------------------------------------
581 -- |---------------------------< insert_validate >----------------------------|
582 -- ----------------------------------------------------------------------------
583 Procedure insert_validate
584 	(p_rec 			 in ben_qtr_shd.g_rec_type,
585 	 p_effective_date	 in date,
586 	 p_datetrack_mode	 in varchar2,
587 	 p_validation_start_date in date,
588 	 p_validation_end_date	 in date) is
589 --
590   l_proc	varchar2(72) := g_package||'insert_validate';
591 --
592 Begin
593   hr_utility.set_location('Entering:'||l_proc, 5);
594   --
595   -- Call all supporting business operations
596   --
597   --
598   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
599   --
600   chk_qual_titl_rt_id
601   (p_qual_titl_rt_id => p_rec.qual_titl_rt_id,
602    p_effective_date        => p_effective_date,
603    p_object_version_number => p_rec.object_version_number);
604   --
605   chk_excld_flag
606   (p_qual_titl_rt_id => p_rec.qual_titl_rt_id,
607    p_excld_flag            => p_rec.excld_flag,
608    p_effective_date        => p_effective_date,
609    p_object_version_number => p_rec.object_version_number);
610   --
611   chk_qualification_type_id
612   (p_qual_titl_rt_id => p_rec.qual_titl_rt_id,
613    p_qualification_type_id => p_rec.qualification_type_id,
614    p_object_version_number => p_rec.object_version_number,
615    p_effective_date        => p_effective_date,
616    p_business_group_id     => p_rec.business_group_id);
617   --
618   chk_dup_title_criteria
619   (p_qual_titl_rt_id => p_rec.qual_titl_rt_id,
620    p_qualification_type_id => p_rec.qualification_type_id,
621    p_title                 => p_rec.title,
622    p_vrbl_rt_prfl_id         => p_rec.vrbl_rt_prfl_id,
623    p_validation_start_date => p_validation_start_date,
624    p_validation_end_date   => p_validation_end_date,
625    p_business_group_id     => p_rec.business_group_id);
626 --
627 -- added for Bug 5078478 .. added the check for checking duplicate seq no.
628   chk_duplicate_ordr_num
629           (p_vrbl_rt_prfl_id      => p_rec.vrbl_rt_prfl_id
630            ,p_qual_titl_rt_id  	  => p_rec.qual_titl_rt_id
631            ,p_ordr_num            => p_rec.ordr_num
632            ,p_validation_start_date => p_validation_start_date
633 	   ,p_validation_end_date => p_validation_end_date
634            ,p_business_group_id   => p_rec.business_group_id);
635 
636   --
637   hr_utility.set_location(' Leaving:'||l_proc, 10);
638 End insert_validate;
639 --
640 -- ----------------------------------------------------------------------------
641 -- |---------------------------< update_validate >----------------------------|
642 -- ----------------------------------------------------------------------------
643 Procedure update_validate
644 	(p_rec 			 in ben_qtr_shd.g_rec_type,
645 	 p_effective_date	 in date,
646 	 p_datetrack_mode	 in varchar2,
647 	 p_validation_start_date in date,
648 	 p_validation_end_date	 in date) is
649 --
650   l_proc	varchar2(72) := g_package||'update_validate';
651 --
652 Begin
653   hr_utility.set_location('Entering:'||l_proc, 5);
654   --
655   -- Call all supporting business operations
656   --
657   --
658   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
659   --
660   chk_qual_titl_rt_id
661   (p_qual_titl_rt_id => p_rec.qual_titl_rt_id,
662    p_effective_date        => p_effective_date,
663    p_object_version_number => p_rec.object_version_number);
664   --
665   chk_excld_flag
666   (p_qual_titl_rt_id  => p_rec.qual_titl_rt_id,
667    p_excld_flag            => p_rec.excld_flag,
668    p_effective_date        => p_effective_date,
669    p_object_version_number => p_rec.object_version_number);
670   --
671   chk_qualification_type_id
672   (p_qual_titl_rt_id => p_rec.qual_titl_rt_id,
673    p_qualification_type_id => p_rec.qualification_type_id,
674    p_object_version_number => p_rec.object_version_number,
675    p_effective_date        => p_effective_date,
676    p_business_group_id     => p_rec.business_group_id);
677   --
678   chk_dup_title_criteria
679   (p_qual_titl_rt_id => p_rec.qual_titl_rt_id,
680    p_qualification_type_id => p_rec.qualification_type_id,
681    p_title                 => p_rec.title,
682    p_vrbl_rt_prfl_id         => p_rec.vrbl_rt_prfl_id,
683    p_validation_start_date => p_validation_start_date,
684    p_validation_end_date   => p_validation_end_date,
685    p_business_group_id     => p_rec.business_group_id);
686   --
687   -- Call the datetrack update integrity operation
688   --
689   dt_update_validate
690     (p_vrbl_rt_prfl_id                 => p_rec.vrbl_rt_prfl_id,
691      p_datetrack_mode                => p_datetrack_mode,
692      p_validation_start_date	     => p_validation_start_date,
696   chk_duplicate_ordr_num
693      p_validation_end_date	     => p_validation_end_date);
694     --
695   -- added for Bug 5078478 .. added the check for checking duplicate seq no.
697           (p_vrbl_rt_prfl_id      => p_rec.vrbl_rt_prfl_id
698            ,p_qual_titl_rt_id  	  => p_rec.qual_titl_rt_id
699            ,p_ordr_num            => p_rec.ordr_num
700            ,p_validation_start_date => p_validation_start_date
701 	   ,p_validation_end_date => p_validation_end_date
702            ,p_business_group_id   => p_rec.business_group_id);
703 
704   hr_utility.set_location(' Leaving:'||l_proc, 10);
705 End update_validate;
706 --
707 -- ----------------------------------------------------------------------------
708 -- |---------------------------< delete_validate >----------------------------|
709 -- ----------------------------------------------------------------------------
710 Procedure delete_validate
711 	(p_rec 			 in ben_qtr_shd.g_rec_type,
712 	 p_effective_date	 in date,
713 	 p_datetrack_mode	 in varchar2,
714 	 p_validation_start_date in date,
715 	 p_validation_end_date	 in date) is
716 --
717   l_proc	varchar2(72) := g_package||'delete_validate';
718 --
719 Begin
720   hr_utility.set_location('Entering:'||l_proc, 5);
721   --
722   -- Call all supporting business operations
723   --
724   dt_delete_validate
725     (p_datetrack_mode		=> p_datetrack_mode,
726      p_validation_start_date	=> p_validation_start_date,
727      p_validation_end_date	=> p_validation_end_date,
728      p_qual_titl_rt_id => p_rec.qual_titl_rt_id);
729   --
730   hr_utility.set_location(' Leaving:'||l_proc, 10);
731 End delete_validate;
732 --
733 --
734 --  ---------------------------------------------------------------------------
735 --  |---------------------< return_legislation_code >-------------------------|
736 --  ---------------------------------------------------------------------------
737 --
738 function return_legislation_code
739   (p_qual_titl_rt_id in number) return varchar2 is
740   --
741   -- Declare cursor
742   --
743   cursor csr_leg_code is
744     select a.legislation_code
745     from   per_business_groups a,
746            ben_qual_titl_rt_f b
747     where b.qual_titl_rt_id      = p_qual_titl_rt_id
748     and   a.business_group_id = b.business_group_id;
749   --
750   -- Declare local variables
751   --
752   l_legislation_code  varchar2(150);
753   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
754   --
755 begin
756   --
757   hr_utility.set_location('Entering:'|| l_proc, 10);
758   --
759   -- Ensure that all the mandatory parameter are not null
760   --
761   hr_api.mandatory_arg_error(p_api_name       => l_proc,
762                              p_argument       => 'qual_titl_rt_id',
763                              p_argument_value => p_qual_titl_rt_id);
764   --
765   open csr_leg_code;
766     --
767     fetch csr_leg_code into l_legislation_code;
768     --
769     if csr_leg_code%notfound then
770       --
771       close csr_leg_code;
772       --
773       -- The primary key is invalid therefore we must error
774       --
775       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
776       fnd_message.raise_error;
777       --
778     end if;
779     --
780   close csr_leg_code;
781   --
782   hr_utility.set_location(' Leaving:'|| l_proc, 20);
783   --
784   return l_legislation_code;
785   --
786 end return_legislation_code;
787 --
788 end ben_qtr_bus;