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