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