[Home] [Help]
PACKAGE BODY: APPS.HR_AHC_BUS
Source
1 Package Body hr_ahc_bus as
2 /* $Header: hrahcrhi.pkb 115.7 2002/12/02 14:52:05 apholt ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_ahc_bus.'; -- Global package name
9 --
10 --
11 -- -----------------------------------------------------------------
12 -- |-----------------------< chk_non_updateable_args >--------------|
13 -- -----------------------------------------------------------------
14 --
15 Procedure chk_non_updateable_args
16 (p_rec in hr_ahc_shd.g_rec_type
17 ,p_effective_date in date
18 ) is
19 --
20 l_proc varchar2(72) := g_package||'chk_non_updateable_args';
21 l_error exception;
22 l_argument varchar2(30);
23 --
24 Begin
25 hr_utility.set_location('Entering:'||l_proc, 10);
26 --
27 -- Only proceed with validation if a row exists for
28 -- the current record in the HR Schema
29 --
30 if not hr_ahc_shd.api_updating
31 (p_api_hook_call_id => p_rec.api_hook_call_id,
32 p_object_version_number => p_rec.object_version_number
33 ) then
34 hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
35 hr_utility.set_message_token('PROCEDURE', l_proc);
36 hr_utility.set_message_token('STEP', '20');
37 end if;
38 hr_utility.set_location(l_proc, 30);
39 --
40 if nvl(p_rec.api_hook_id, hr_api.g_number) <>
41 nvl(hr_ahc_shd.g_old_rec.api_hook_id
42 ,hr_api.g_number
43 ) then
44 l_argument := 'api_hook_id';
45 raise l_error;
46 end if;
47 --
48 if nvl(p_rec.api_hook_call_type, hr_api.g_varchar2) <>
49 nvl(hr_ahc_shd.g_old_rec.api_hook_call_type
50 ,hr_api.g_varchar2
51 ) then
52 l_argument := 'api_hook_call_type';
53 raise l_error;
54 end if;
55 --
56 if nvl(p_rec.legislation_code, hr_api.g_varchar2) <>
57 nvl(hr_ahc_shd.g_old_rec.legislation_code
58 ,hr_api.g_varchar2
59 ) then
60 l_argument := 'legislation_code';
61 raise l_error;
62 end if;
63 --
64 if nvl(p_rec.application_id, hr_api.g_number) <>
65 nvl(hr_ahc_shd.g_old_rec.application_id
66 ,hr_api.g_number
67 ) then
68 l_argument := 'application_id';
69 raise l_error;
70 end if;
71 --
72 hr_utility.set_location(l_proc, 40);
73 exception
74 when l_error then
75 hr_api.argument_changed_error
76 (p_api_name => l_proc
77 ,p_argument => l_argument
78 );
79 when others then
80 raise;
81 hr_utility.set_location(' Leaving:'||l_proc, 50);
82 end chk_non_updateable_args;
83 --
84 -- -----------------------------------------------------------------
85 -- |-----------------------< chk_api_hook_id >-------------------------|
86 -- -----------------------------------------------------------------
87 --
88 -- Description:
89 -- Check that the p_api_hook_id is not null and refers to a valid parent row.
90 --
91 -- Pre-Requisites:
92 -- None
93 --
94 -- In Parameters:
95 -- p_api_hook_call_id
96 -- p_api_hook_id
97 --
98 -- Post Success:
99 -- Processing continues if the api_hook_id is valid.
100 --
101 -- Post Failure:
102 -- An application error is raised and processing is terminated if
103 -- the api_hook_id is invalid.
104 --
105 -- Access Status:
106 -- Internal Row Handler Use Only.
107 --
108 Procedure chk_api_hook_id
109 (p_api_hook_call_id in number,
110 p_api_hook_id in number
111 ) is
112 --
113 -- Local declarations
114 l_proc varchar2(72) := g_package||'chk_api_hook_id';
115 l_api_hook_id number;
116
117 -- Setup cursor for valid hook id check
118 cursor csr_valid_hook_id is
119 select api_hook_id
120 from hr_api_hooks
121 where api_hook_id = p_api_hook_id;
122
123 --
124 begin
125 hr_utility.set_location('Entering: '||l_proc,5);
126 --
127 --------------------------------
128 -- Check hook id not null --
129 --------------------------------
130 hr_api.mandatory_arg_error
131 (p_api_name => l_proc,
132 p_argument => 'p_api_hook_id',
133 p_argument_value => p_api_hook_id);
134
135 --------------------------------
136 -- Check hook id is valid --
137 --------------------------------
138 open csr_valid_hook_id;
139 fetch csr_valid_hook_id into l_api_hook_id;
140 if csr_valid_hook_id%notfound then
141 close csr_valid_hook_id;
142 hr_ahc_shd.constraint_error('HR_API_HOOK_CALLS_FK1');
143 end if;
144 close csr_valid_hook_id;
145
149 --
146 hr_utility.set_location('Leaving: '||l_proc,10);
147 end chk_api_hook_id;
148 --
150 -- -----------------------------------------------------------------
151 -- |-----------------------< chk_api_hook_call_type >--------------|
152 -- -----------------------------------------------------------------
153 --
154 -- Description:
155 -- Check that the api_hook_call_type is not null and validate it against the
156 -- HR_LOOKUPS table.
157 --
158 -- Pre-Requisites:
159 -- None
160 --
161 -- In Parameters:
162 -- p_api_hook_call_id
163 -- p_api_hook_call_type
164 -- p_effective_date
165 --
166 -- Post Success:
167 -- Processing continues if the api_hook_call_type is valid.
168 --
169 -- Post Failure:
170 -- An application error is raised and processing is terminated if
171 -- the api_hook_call_type is invalid.
172 --
173 -- Access Status:
174 -- Internal Row Handler Use Only.
175 --
176 Procedure chk_api_hook_call_type
177 (p_api_hook_call_id in number,
178 p_api_hook_call_type in varchar2,
179 p_effective_date in date
180 ) is
181 --
182 -- Local declarations
183 l_proc varchar2(72) := g_package||'chk_api_hook_call_type';
184 l_lookup_code hr_lookups.lookup_code%TYPE;
185 --
186 --
187 begin
188 hr_utility.set_location('Entering: '||l_proc,5);
189 --
190 --------------------------------
191 -- Check hook call type not null --
192 --------------------------------
193 hr_api.mandatory_arg_error
194 (p_api_name => l_proc,
195 p_argument => 'p_api_hook_call_type',
196 p_argument_value => p_api_hook_call_type);
197
198 --------------------------------
199 -- Check hook call type is valid --
200 --------------------------------
201 if hr_api.not_exists_in_hr_lookups
202 (p_effective_date => p_effective_date,
203 p_lookup_type => 'API_HOOK_CALL_TYPE',
204 p_lookup_code => p_api_hook_call_type) then
205 hr_ahc_shd.constraint_error('HR_API_HOOK_CALLS_CK1');
206 end if;
207
208 hr_utility.set_location('Leaving: '||l_proc,10);
209 end chk_api_hook_call_type;
210 --
211 --
212 -- -----------------------------------------------------------------
213 -- |-----------------------< chk_legislation_code >----------------|
214 -- -----------------------------------------------------------------
215 --
216 -- Description:
217 -- Validate the legislation_code against the FND_TERRITORIES table.
218 --
219 -- Pre-Requisites:
220 -- None
221 --
222 -- In Parameters:
223 -- p_api_hook_call_id
224 -- p_legislation_code
225 --
226 -- Post Success:
227 -- Processing continues if the legislation_code is valid.
228 --
229 -- Post Failure:
230 -- An application error is raised and processing is terminated if
231 -- the legislation_code is invalid.
232 --
233 -- Access Status:
234 -- Internal Row Handler Use Only.
235 --
236 Procedure chk_legislation_code
237 (p_api_hook_call_id in number,
238 p_legislation_code in varchar2
239 ) is
240 --
241 -- Local declarations
242 l_proc varchar2(72) := g_package||'chk_legislation_code';
243 l_territory_code fnd_territories.territory_code%TYPE;
244 --
245 -- Setup cursor for valid legislation code check
246 cursor csr_valid_legislation_code is
247 select territory_code
248 from fnd_territories ft
249 where ft.territory_code = p_legislation_code;
250 --
251 --
252 begin
253 hr_utility.set_location('Entering: '||l_proc,5);
254 --------------------------------
255 -- Check legislation code is valid --
256 --------------------------------
257 if p_legislation_code is not null then
258 open csr_valid_legislation_code;
259 fetch csr_valid_legislation_code into l_territory_code;
260
261 if csr_valid_legislation_code%notfound then
262 close csr_valid_legislation_code;
263 hr_utility.set_message(800,'PER_52123_AMD_LEG_CODE_INV');
264 hr_utility.raise_error;
265 end if; -- End cursor if
266
267 close csr_valid_legislation_code;
268 end if; -- end check
269
270 hr_utility.set_location('Leaving: '||l_proc,10);
271 end chk_legislation_code;
272 --
273 --
274 -- -----------------------------------------------------------------
275 -- |-----------------------< chk_sequence >-------------------------|
276 -- -----------------------------------------------------------------
277 --
278 -- Description:
279 -- Check that the sequence is within the correct range, dependent on
280 -- LEGISLATION_CODE and APPLICATION_ID.
281 --
282 -- Pre-Requisites:
283 -- None
284 --
285 -- In Parameters:
286 -- p_api_hook_call_id
287 -- p_sequence
288 -- p_legislation_code
289 -- p_application_id
290 -- p_object_version_number
291 --
292 -- Post Success:
293 -- Processing continues if the sequence is valid.
294 --
295 -- Post Failure:
296 -- An application error is raised and processing is terminated if
297 -- the sequence is invalid.
298 --
299 -- Access Status:
300 -- Internal Row Handler Use Only.
301 --
302 Procedure chk_sequence
303 (p_api_hook_call_id in number,
304 p_sequence in number,
308 ) is
305 p_legislation_code in varchar2,
306 p_application_id in number,
307 p_object_version_number in number
309 --
310 -- Local declarations
311 l_proc varchar2(72) := g_package||'chk_sequence';
312 l_api_updating boolean;
313
314 --
315 begin
316 hr_utility.set_location('Entering: '||l_proc,5);
317
318 -- Check if hook is being updated
319 l_api_updating := hr_ahc_shd.api_updating
320 (p_api_hook_call_id => p_api_hook_call_id,
321 p_object_version_number => p_object_version_number);
322
323 -- Proceed with validation based on outcome of api_updating call.
324 if ((l_api_updating and
325 hr_ahc_shd.g_old_rec.sequence <> nvl(p_sequence, hr_api.g_number) ) or
326 (not l_api_updating)) then
327
328
329 if ( p_legislation_code is not null and
330 (p_sequence < 1500 or p_sequence > 1999) ) then
331 hr_utility.set_message(800,'PER_52145_AHC_INVALID_SEQ1');
332 hr_utility.raise_error;
333 elsif( p_legislation_code is null) then
334 if (p_application_id is null and
335 (p_sequence >= 1000 and p_sequence <= 1999) )then
336 hr_utility.set_message(800,'PER_52146_AHC_INVALID_SEQ2');
337 hr_utility.raise_error;
338 elsif (p_application_id is not null and
339 (p_sequence < 1000 or p_sequence > 1499)) then
340 hr_utility.set_message(800,'PER_289089_AHC_INVALID_SEQ3');
341 hr_utility.raise_error;
342 end if;
343 end if;
344 end if;
345
346 hr_utility.set_location('Leaving: '||l_proc,10);
347 end chk_sequence;
348 --
349 --
350 -- -----------------------------------------------------------------
351 -- |-----------------------< chk_enabled_flag >-------------------------|
352 -- -----------------------------------------------------------------
353 --
354 -- Description:
355 -- Check that enabled flag is not null and validate it against HR_LOOKUPS.
356 --
357 -- Pre-Requisites:
358 -- None
359 --
360 -- In Parameters:
361 -- p_api_hook_call_id
362 -- p_enabled_flag
363 -- p_object_version_number
364 -- p_effective_date
365 --
366 -- Post Success:
367 -- Processing continues if the enabled_flag is valid.
368 --
369 -- Post Failure:
370 -- An application error is raised and processing is terminated if
371 -- the enabled_flag is invalid.
372 --
373 -- Access Status:
374 -- Internal Row Handler Use Only.
375 --
376 Procedure chk_enabled_flag
377 (p_api_hook_call_id in number,
378 p_enabled_flag in varchar2,
379 p_object_version_number in number,
380 p_effective_date in date
381 ) is
382 --
383 -- Local declarations
384 l_proc varchar2(72) := g_package||'chk_enabled_flag';
385 l_application_id hr_lookups.application_id%TYPE;
386 l_api_updating boolean;
387 --
388 --
389 begin
390 hr_utility.set_location('Entering: '||l_proc,5);
391
392 --------------------------------
393 -- Check enabled flag type not null --
394 --------------------------------
395 hr_api.mandatory_arg_error
396 (p_api_name => l_proc,
397 p_argument => 'p_enabled_flag',
398 p_argument_value => p_enabled_flag);
399
400 -- Check if hook is being updated
401 l_api_updating := hr_ahc_shd.api_updating
402 (p_api_hook_call_id => p_api_hook_call_id,
403 p_object_version_number => p_object_version_number);
404
405 -- Proceed with validation based on outcome of api_updating call.
406 if ((l_api_updating and
407 hr_ahc_shd.g_old_rec.enabled_flag <> nvl(p_enabled_flag, hr_api.g_varchar2) ) or
408 (not l_api_updating)) then
409
410 --------------------------------
411 -- Check enabled is valid --
412 --------------------------------
413 if hr_api.not_exists_in_hr_lookups
414 (p_effective_date => p_effective_date,
415 p_lookup_type => 'YES_NO',
416 p_lookup_code => p_enabled_flag) then
417 hr_utility.set_message(800,'PER_52136_AHC_ENAB_FLAG_INV');
418 hr_utility.raise_error;
419 end if;
420
421 end if;
422 hr_utility.set_location('Leaving: '||l_proc,10);
423 end chk_enabled_flag;
424 --
425 --
426 -- -----------------------------------------------------------------
427 -- |-----------------------< chk_call_package >---------------------|
428 -- -----------------------------------------------------------------
429 --
430 -- Description:
431 -- Validate the call_package against the hook call type.
432 --
433 -- Pre-Requisites:
434 -- None
435 --
436 -- In Parameters:
437 -- p_api_hook_call_id
438 -- p_call_package
439 -- p_api_hook_call_type
440 -- p_object_version_number
441 --
442 -- Post Success:
443 -- Processing continues if the call_package is valid.
444 --
445 -- Post Failure:
446 -- An application error is raised and processing is terminated if
447 -- the call_package is invalid.
448 --
449 -- Access Status:
450 -- Internal Row Handler Use Only.
451 --
452 Procedure chk_call_package
453 (p_api_hook_call_id in number,
454 p_call_package in varchar2,
458 --
455 p_api_hook_call_type in varchar2,
456 p_object_version_number in number
457 ) is
459 -- Local declarations
460 l_proc varchar2(72) := g_package||'chk_call_package';
461 l_api_updating boolean;
462 --
463 begin
464 hr_utility.set_location('Entering: '||l_proc,5);
465
466 -- Check if hook is being updated
467 l_api_updating := hr_ahc_shd.api_updating
468 (p_api_hook_call_id => p_api_hook_call_id,
469 p_object_version_number => p_object_version_number);
470
471 -- Proceed with validation based on outcome of api_updating call.
472 if ((l_api_updating and
473 nvl(hr_ahc_shd.g_old_rec.call_package, hr_api.g_varchar2) <>
474 nvl(p_call_package, hr_api.g_varchar2) ) or
475 (not l_api_updating)) then
476
477 if (p_api_hook_call_type = 'PP' and p_call_package is null) OR
478 (p_api_hook_call_type = 'FF' and p_call_package is not null)
479 then
480 hr_utility.set_message(800,'PER_52137_AHC_CALL_PACK_INV');
481 hr_utility.raise_error;
482 end if;
483 end if;
484
485 hr_utility.set_location('Leaving: '||l_proc,10);
486 end chk_call_package;
487 --
488 --
489 -- -----------------------------------------------------------------
490 -- |-----------------------< chk_call_procedure >------------------|
491 -- -----------------------------------------------------------------
492 --
493 -- Description:
494 -- Validate the call_procedure against the hook call type.
495 --
496 -- Pre-Requisites:
497 -- None
498 --
499 -- In Parameters:
500 -- p_api_hook_call_id
501 -- p_call_procedure
502 -- p_api_hook_call_type
503 -- p_object_version_number
504 --
505 -- Post Success:
506 -- Processing continues if the call_procedure is valid.
507 --
508 -- Post Failure:
509 -- An application error is raised and processing is terminated if
510 -- the call_procedure is invalid.
511 --
512 -- Access Status:
513 -- Internal Row Handler Use Only.
514 --
515 Procedure chk_call_procedure
516 (p_api_hook_call_id in number,
517 p_call_procedure in varchar2,
518 p_api_hook_call_type in varchar2,
519 p_object_version_number in number
520 ) is
521 --
522 -- Local declarations
523 l_proc varchar2(72) := g_package||'chk_call_procedure';
524 l_api_updating boolean;
525 --
526 begin
527 hr_utility.set_location('Entering: '||l_proc,5);
528
529 -- Check if hook is being updated
530 l_api_updating := hr_ahc_shd.api_updating
531 (p_api_hook_call_id => p_api_hook_call_id,
532 p_object_version_number => p_object_version_number);
533
534 -- Proceed with validation based on outcome of api_updating call.
535 if ((l_api_updating and
536 nvl(hr_ahc_shd.g_old_rec.call_procedure, hr_api.g_varchar2) <>
537 nvl(p_call_procedure, hr_api.g_varchar2) ) or
538 (not l_api_updating)) then
539
540 if (p_api_hook_call_type = 'PP' and p_call_procedure is null) OR
541 (p_api_hook_call_type = 'FF' and p_call_procedure is not null)
542 then
543 hr_utility.set_message(800,'PER_52138_AHC_CALL_PROC_INV');
544 hr_utility.raise_error;
545 end if;
546
547 end if;
548
549 hr_utility.set_location('Leaving: '||l_proc,10);
550 end chk_call_procedure;
551 --
552 --
553 -- -----------------------------------------------------------------
554 -- |-----------------------< chk_call_pp_combination >-------------|
555 -- -----------------------------------------------------------------
556 --
557 -- Description:
558 -- Validate that call_package, call_procedure, legislation_code,
559 -- application_id and api_hook_id form a unique combination on the table
560 -- when hook_call_type = 'PP'
561 --
562 -- Pre-Requisites:
563 -- None
564 --
565 -- In Parameters:
566 -- p_api_hook_call_id
567 -- p_api_hook_call_type
568 -- p_legislation_code
569 -- p_application_id
570 -- p_call_package
571 -- p_call_procedure
572 -- p_api_hook_id
573 -- p_object_version_number
574 --
575 -- Post Success:
576 -- Processing continues if the combination is valid.
577 --
578 -- Post Failure:
579 -- An application error is raised and processing is terminated if
580 -- the combination is invalid.
581 --
582 -- Access Status:
583 -- Internal Row Handler Use Only.
584 --
585 Procedure chk_call_pp_combination
586 (p_api_hook_call_id in number,
587 p_api_hook_call_type in varchar2,
588 p_legislation_code in varchar2,
589 p_application_id in number,
590 p_call_package in varchar2,
591 p_call_procedure in varchar2,
592 p_api_hook_id in number,
593 p_object_version_number in number
594 ) is
595 --
596 -- Local declarations
597 l_proc varchar2(72) := g_package||'chk_call_pp_combination';
598 l_api_hook_call_id number;
599 l_api_updating boolean;
600 --
601 -- Declare a cursor that will check whether the passed
602 -- in hook package and hook procedure form a unique combination
603
604 cursor csr_valid_combo is
608 = nvl(p_legislation_code,'X')
605 select api_hook_call_id from hr_api_hook_calls
606 where api_hook_id = p_api_hook_id
607 and nvl(legislation_code,'X')
609 and nvl(application_id, -987123654)
610 = nvl(p_application_id,-987123654)
611 and nvl(call_package, 'X')
612 = nvl(p_call_package, 'X')
613 and nvl(call_procedure, 'X')
614 = nvl(p_call_procedure, 'X');
615
616 --
617 begin
618 hr_utility.set_location('Entering: '||l_proc,5);
619 -- Check if hook call is being updated
620 l_api_updating := hr_ahc_shd.api_updating
621 (p_api_hook_call_id => p_api_hook_call_id,
622 p_object_version_number => p_object_version_number);
623
624 -- Proceed with validation based on outcome of api_updating call.
625 if ( (l_api_updating and
626 (hr_ahc_shd.g_old_rec.call_package <> p_call_package or
627 hr_ahc_shd.g_old_rec.call_procedure <> p_call_procedure)
628 )
629 or
630 (not l_api_updating) ) then
631 hr_utility.set_location('**'||hr_ahc_shd.g_old_rec.call_package,99);
632 hr_utility.set_location('**'||hr_ahc_shd.g_old_rec.call_procedure,99);
633
634 if p_api_hook_call_type = 'PP' then
635 ----------------------------------------------------------------------------
636 -- Check for combination of hook call id, leg code, call pack, call proc --
637 ----------------------------------------------------------------------------
638 hr_utility.set_location('App_id:'||to_char(p_application_id),1);
639 hr_utility.set_location('Leg:'||p_legislation_code,2);
640 hr_utility.set_location('Pkg:'||p_call_package,3);
641 hr_utility.set_location('prc:'||p_call_procedure,4);
642 open csr_valid_combo;
643 fetch csr_valid_combo into l_api_hook_call_id;
644
645 if csr_valid_combo%found then
646 close csr_valid_combo;
647 hr_ahc_shd.constraint_error('HR_API_HOOK_CALLS_UK1');
648 end if;
649
650 close csr_valid_combo;
651 end if;
652
653 end if;
654 hr_utility.set_location('Leaving: '||l_proc,10);
655 end chk_call_pp_combination;
656 --
657 --
658 -- -----------------------------------------------------------------
659 -- |-----------------------< chk_formula_id >-----------------------|
660 -- -----------------------------------------------------------------
661 --
662 -- Description:
663 -- Not yet implemented
664 --
665 -- Pre-Requisites:
666 -- None
667 --
668 -- In Parameters:
669 --
670 -- Post Success:
671 -- Processing continues if the formula_id is valid.
672 --
673 -- Post Failure:
674 -- An application error is raised and processing is terminated if
675 -- the formula_id is invalid.
676 --
677 -- Access Status:
678 -- Internal Row Handler Use Only.
679 --
680 Procedure chk_formula_id
681 (p_api_hook_call_id in number
682 ) is
683 --
684 -- Local declarations
685 l_proc varchar2(72) := g_package||'chk_formula_id';
686
687 --
688 begin
689 hr_utility.set_location('Entering: '||l_proc,5);
690
691 -- There is no formula id in the table for the first version.
692 -- It will be added when FORMULA calls are possible.
693
694
695 hr_utility.set_location('Leaving: '||l_proc,10);
696 end chk_formula_id;
697 --
698 --
699 -- -----------------------------------------------------------------
700 -- |-----------------------< chk_call_ff_combination >-----------|
701 -- -----------------------------------------------------------------
702 --
703 -- Description:
704 -- Not yet implemented.
705 --
706 -- Pre-Requisites:
707 -- None
708 --
709 -- In Parameters:
710 --
711 -- Post Success:
712 -- Processing continues if the combination is valid.
713 --
714 -- Post Failure:
715 -- An application error is raised and processing is terminated if
716 -- the combination is invalid.
717 --
718 -- Access Status:
719 -- Internal Row Handler Use Only.
720 --
721 Procedure chk_call_ff_combination
722 (p_api_hook_call_id in number
723 ) is
724 --
725 -- Local declarations
726 l_proc varchar2(72) := g_package||'chk_call_ff_combination';
727
728 --
729 begin
730 hr_utility.set_location('Entering: '||l_proc,5);
731
732 -- There is no formula id in the table for the first version.
733 -- It will be added when FORMULA calls are possible.
734
735 hr_utility.set_location('Leaving: '||l_proc,10);
736 end chk_call_ff_combination;
737 --
738 --
739 -- -----------------------------------------------------------------
740 -- |-----------------------< chk_pre_processor_date >--------------|
741 -- -----------------------------------------------------------------
742 --
743 -- Description:
744 -- Check that pre_processor_date is null on insert.
745 --
746 -- Pre-Requisites:
747 -- None
748 --
749 -- In Parameters:
750 -- p_api_hook_call_id
751 -- p_pre_processor_date
752 -- p_object_version_number
753 --
754 -- Post Success:
755 -- Processing continues if the pre_processor_date is valid.
756 --
757 -- Post Failure:
758 -- An application error is raised and processing is terminated if
762 -- Internal Row Handler Use Only.
759 -- the pre_processor_date is invalid.
760 --
761 -- Access Status:
763 --
764 Procedure chk_pre_processor_date
765 (p_api_hook_call_id in number,
766 p_pre_processor_date in date,
767 p_object_version_number in number
768 ) is
769 --
770 -- Local declarations
771 l_proc varchar2(72) := g_package||'chk_pre_processor_date';
772 l_api_updating boolean;
773 --
774 begin
775 hr_utility.set_location('Entering: '||l_proc,5);
776
777 -- Check if hook is being updated
778 l_api_updating := hr_ahc_shd.api_updating
779 (p_api_hook_call_id => p_api_hook_call_id,
780 p_object_version_number => p_object_version_number);
781
782 if (not l_api_updating and p_pre_processor_date is not null) then
783 hr_utility.set_message(800,'PER_52144_AHC_PP_DATE_NOT_NULL');
784 hr_utility.raise_error;
785 end if;
786
787 hr_utility.set_location('Leaving: '||l_proc,10);
788 end chk_pre_processor_date;
789 --
790 --
791 -- -----------------------------------------------------------------
792 -- |-----------------------< chk_encoded_error >-------------------------|
793 -- -----------------------------------------------------------------
794 --
795 -- Description:
796 -- Check that encoded error is null on insert and then validate against
797 -- status for further update calls.
798 --
799 -- Pre-Requisites:
800 -- None
801 --
802 -- In Parameters:
803 -- p_api_hook_call_id
804 -- p_encoded_error
805 -- p_status
806 -- p_object_version_number
807 --
808 -- Post Success:
809 -- Processing continues if the encoded_error is valid.
810 --
811 -- Post Failure:
812 -- An application error is raised and processing is terminated if
813 -- the encoded_error is invalid.
814 --
815 -- Access Status:
816 -- Internal Row Handler Use Only.
817 --
818 Procedure chk_encoded_error
819 (p_api_hook_call_id in number,
820 p_encoded_error in varchar2,
821 p_status in varchar2,
822 p_object_version_number in number
823 ) is
824 --
825 -- Local declarations
826 l_proc varchar2(72) := g_package||'chk_encoded_error';
827 l_api_updating boolean;
828 --
829 begin
830 hr_utility.set_location('Entering: '||l_proc,5);
831
832 -- Check if hook is being updated
833 l_api_updating := hr_ahc_shd.api_updating
834 (p_api_hook_call_id => p_api_hook_call_id,
835 p_object_version_number => p_object_version_number);
836
837 -- Proceed with validation based on outcome of api_updating call.
838 if (not l_api_updating and p_encoded_error is not null)
839 then
840 hr_utility.set_message(800,'PER_52142_AHC_ENC_ERR_NOT_NULL');
841 hr_utility.raise_error;
842 elsif
843 (l_api_updating and
844 (p_status = 'N' or p_status = 'V') and
845 p_encoded_error is not null)
846 then
847 hr_utility.set_message(800,'PER_52143_AHC_E_ERR_NOT_NULL2');
848 hr_utility.raise_error;
849 end if;
850
851 hr_utility.set_location('Leaving: '||l_proc,10);
852 end chk_encoded_error;
853 --
854 --
855 -- -----------------------------------------------------------------
856 -- |-----------------------< chk_status >-------------------------|
857 -- -----------------------------------------------------------------
858 --
859 -- Description:
860 -- Check that status is not null, N on insert and then validate against
861 -- HR_LOOKUPS for subsequent update calls.
862 --
863 -- Pre-Requisites:
864 -- None
865 --
866 -- In Parameters:
867 -- p_api_hook_call_id
868 -- p_status
869 -- p_object_version_number
870 -- p_effective_date
871 --
872 -- Post Success:
873 -- Processing continues if the Status is valid.
874 --
875 -- Post Failure:
876 -- An application error is raised and processing is terminated if
877 -- the Status is invalid.
878 --
879 -- Access Status:
880 -- Internal Row Handler Use Only.
881 --
882 Procedure chk_status
883 (p_api_hook_call_id in number,
884 p_status in varchar2,
885 p_object_version_number in number,
886 p_effective_date in date
887 ) is
888 --
889 -- Local declarations
890 l_proc varchar2(72) := g_package||'chk_status';
891 l_lookup_code hr_lookups.lookup_code%TYPE;
892 l_api_updating boolean;
893 --
894 --
895 begin
896 hr_utility.set_location('Entering: '||l_proc,5);
897
898 --------------------------------
899 -- Check status not null --
900 --------------------------------
901 hr_api.mandatory_arg_error
902 (p_api_name => l_proc,
903 p_argument => 'p_status',
904 p_argument_value => p_status);
905
906 -- Check if hook is being updated
907 l_api_updating := hr_ahc_shd.api_updating
908 (p_api_hook_call_id => p_api_hook_call_id,
909 p_object_version_number => p_object_version_number);
910
911 -- Proceed with validation based on outcome of api_updating call.
915
912 if ((l_api_updating and
913 hr_ahc_shd.g_old_rec.status <> nvl(p_status, hr_api.g_varchar2)) or
914 (not l_api_updating)) then
916 --------------------------------
917 -- Check status is valid --
918 --------------------------------
919 if hr_api.not_exists_in_hr_lookups
920 (p_effective_date => p_effective_date,
921 p_lookup_type => 'API_HOOK_CALL_STATUS',
922 p_lookup_code => p_status) then
923 hr_utility.set_message(800,'PER_52140_AHC_STATUS_INV');
924 hr_utility.raise_error;
925 end if;
926
927 --------------------------------------
928 -- Status must be 'N' during insert --
929 --------------------------------------
930 if (not l_api_updating and p_status <> 'N') then
931 hr_utility.set_message(800,'PER_52141_AHC_INV_STA_ON_INS');
932 hr_utility.raise_error;
933 end if;
934
935 end if;
936 hr_utility.set_location('Leaving: '||l_proc,10);
937 end chk_status;
938 --
939 -- ----------------------------------------------------------------------------
940 -- |-----------------------< chk_application_id >-----------------------------|
941 -- ----------------------------------------------------------------------------
942 -- Description:
943 -- Indicates if the extra logic should be called on behalf of another
944 -- Oracle Application.
945 --
946 -- Pre-Requisites:
947 -- None
948 --
949 -- In Parameters:
950 -- p_application_id
951 --
952 -- Post Success:
953 -- Processing continues if the application_id is valid.
954 --
955 -- Post Failure:
956 -- An application_error is raised, and processing is terminated if the
957 -- application_id is invalid.
958 --
959 -- Access Status:
960 -- Internal Row Handler Use Only.
961 -- ----------------------------------------------------------------------------
962 PROCEDURE chk_application_id (p_application_id IN number) IS
963 --
964 -- Cursor to determine if the application_id is valid
965 CURSOR csr_check_app_id IS
966 SELECT 'Y'
967 FROM fnd_application app
968 WHERE app.application_id = p_application_id;
969 --
970 l_exists varchar2(1);
971 --
972 BEGIN
973 --
974 IF p_application_id IS NOT NULL THEN
975 --
976 -- Check if application_id is valid
977 OPEN csr_check_app_id;
978 FETCH csr_check_app_id INTO l_exists;
979 --
980 IF csr_check_app_id%NOTFOUND THEN
981 -- Application does not exist
982 CLOSE csr_check_app_id;
983 hr_utility.set_message(800,'PER_289085_AHC_INVALID_APPL');
984 hr_utility.raise_error;
985 END IF;
986 CLOSE csr_check_app_id;
987 --
988 END IF;
989 --
990 END chk_application_id;
991 --
992 -- ----------------------------------------------------------------------------
993 -- |-----------------------< chk_app_install_status >-------------------------|
994 -- ----------------------------------------------------------------------------
995 -- Description:
996 -- Indicates when the application hook calls should be executed, based
997 -- on the application's install status.
998 --
999 -- Pre-Requisites:
1000 -- None
1001 --
1002 -- In Parameters:
1003 -- p_app_install_status
1004 -- p_application_id
1005 -- p_effective_date
1006 --
1007 -- Post Success:
1008 -- Processing continues if the app_install_status is valid.
1009 --
1010 -- Post Failure:
1011 -- An application_error is raised, and processing is terminated if the
1012 -- app_install_status is invalid.
1013 --
1014 -- Access Status:
1015 -- Internal Row Handler Use Only.
1016 -- ----------------------------------------------------------------------------
1017 PROCEDURE chk_app_install_status
1018 (p_app_install_status in varchar2
1019 ,p_application_id in number
1020 ,p_effective_date in date) IS
1021 --
1022 BEGIN
1023 --
1024 IF ((p_application_id IS NULL) and (p_app_install_status IS NOT NULL)) THEN
1025 --
1026 -- Error - app_install_status must be null when app_id is null
1027 hr_utility.set_message(800,'PER_289086_AHC_INST_STAT_NULL');
1028 hr_utility.raise_error;
1029 --
1030 ELSIF ((p_application_id IS NOT NULL) and (p_app_install_status IS NULL)) THEN
1031 --
1032 -- Error - app_install_status is mandatory when app_id is not null
1033 hr_utility.set_message(800,'PER_289087_AHC_MAND_INSTALL_ST');
1034 hr_utility.raise_error;
1035 ELSE
1036 -- combination of application_id and app_install_status is ok
1037 IF p_app_install_status IS NOT NULL THEN
1038 -- validate against HR_LOOKUPS
1039 if hr_api.not_exists_in_hr_lookups
1040 (p_effective_date => p_effective_date,
1041 p_lookup_type => 'APP_INSTALL_STATUS',
1042 p_lookup_code => p_app_install_status) then
1043 hr_utility.set_message(800,'PER_289088_AHC_INST_STATUS_ERR');
1044 hr_utility.raise_error;
1045 end if;
1046 END IF;
1047 END IF;
1048 --
1049 END chk_app_install_status;
1050 --
1051 -- ----------------------------------------------------------------------------
1052 -- |---------------------------< insert_validate >----------------------------|
1053 -- ----------------------------------------------------------------------------
1054 Procedure insert_validate(p_rec in hr_ahc_shd.g_rec_type,
1055 p_effective_date in date) is
1056 --
1057 l_proc varchar2(72) := g_package||'insert_validate';
1058 --
1059 Begin
1060 hr_utility.set_location('Entering:'||l_proc, 5);
1064 -- to it as the default security_group_id.
1061 --
1062 -- As this data is not within the context of a business group
1063 -- the set_security_group_id procedure has zero passed
1065 --
1066 hr_api.set_security_group_id(p_security_group_id => 0);
1067 --
1068 hr_utility.set_location('Entering:'||l_proc, 6);
1069 --
1070 -- Call all supporting business operations
1071 --
1072 -- Validate the api_hook_id
1073 chk_api_hook_id
1074 (p_api_hook_call_id => p_rec.api_hook_call_id,
1075 p_api_hook_id => p_rec.api_hook_id);
1076
1077 -- Validate the hook call type
1078 chk_api_hook_call_type
1079 (p_api_hook_call_id => p_rec.api_hook_call_id,
1080 p_api_hook_call_type => p_rec.api_hook_call_type,
1081 p_effective_date => p_effective_date);
1082
1083 -- Validate the legislation_code
1084 chk_legislation_code
1085 (p_api_hook_call_id => p_rec.api_hook_call_id,
1086 p_legislation_code => p_rec.legislation_code);
1087
1088 -- validate the application_id
1089 chk_application_id
1090 (p_application_id => p_rec.application_id);
1091
1092 -- validate the application_install_status
1093 chk_app_install_status
1094 (p_app_install_status => p_rec.app_install_status
1095 ,p_application_id => p_rec.application_id
1096 ,p_effective_date => p_effective_date);
1097
1098 -- Validate the sequence
1099 chk_sequence
1100 (p_api_hook_call_id => p_rec.api_hook_call_id,
1101 p_sequence => p_rec.sequence,
1102 p_legislation_code => p_rec.legislation_code,
1103 p_application_id => p_rec.application_id,
1104 p_object_version_number => p_rec.object_version_number);
1105
1106 -- Validate the enabled_flag
1107 chk_enabled_flag
1108 (p_api_hook_call_id => p_rec.api_hook_call_id,
1109 p_enabled_flag => p_rec.enabled_flag,
1110 p_object_version_number => p_rec.object_version_number,
1111 p_effective_date => p_effective_date);
1112
1113 -- Validate the call_package
1114 chk_call_package
1115 (p_api_hook_call_id => p_rec.api_hook_call_id,
1116 p_call_package => p_rec.call_package,
1117 p_api_hook_call_type => p_rec.api_hook_call_type,
1118 p_object_version_number => p_rec.object_version_number);
1119
1120 -- Validate the call_procedure
1121 chk_call_procedure
1122 (p_api_hook_call_id => p_rec.api_hook_call_id,
1123 p_call_procedure => p_rec.call_procedure,
1124 p_api_hook_call_type => p_rec.api_hook_call_type,
1125 p_object_version_number => p_rec.object_version_number);
1126
1127 -- Validate the call_pp_combination
1128 chk_call_pp_combination
1129 (p_api_hook_call_id => p_rec.api_hook_call_id,
1130 p_api_hook_call_type => p_rec.api_hook_call_type,
1131 p_legislation_code => p_rec.legislation_code,
1132 p_application_id => p_rec.application_id,
1133 p_call_package => p_rec.call_package,
1134 p_call_procedure => p_rec.call_procedure,
1135 p_api_hook_id => p_rec.api_hook_id,
1136 p_object_version_number => p_rec.object_version_number);
1137
1138 /*******************************************************************************
1139 * These two calls will be commented out for the first version. They will be
1140 * added back in when FORMULA calls are possible.
1141 ********************************************************************************
1142 *
1143 * -- Validate the formula_id
1144 * chk_formula_id
1145 * (p_api_hook_call_id => p_rec.api_hook_call_id,
1146 * p_formula_id => p_rec.formula_id);
1147 *
1148 * -- Validate the call_ff_combination
1149 * chk_call_ff_combination
1150 * (p_api_hook_call_id => p_rec.api_hook_call_id);
1151 *
1152 *
1153 *******************************************************************************/
1154
1155 -- Validate the pre_processor_date
1156 chk_pre_processor_date
1157 (p_api_hook_call_id => p_rec.api_hook_call_id,
1158 p_pre_processor_date => p_rec.pre_processor_date,
1159 p_object_version_number => p_rec.object_version_number);
1160
1161 -- Validate the status
1162 chk_status
1163 (p_api_hook_call_id => p_rec.api_hook_call_id,
1164 p_status => p_rec.status,
1165 p_object_version_number => p_rec.object_version_number,
1166 p_effective_date => p_effective_date);
1167
1168 -- Validate the encoded_error
1169 chk_encoded_error
1170 (p_api_hook_call_id => p_rec.api_hook_call_id,
1171 p_encoded_error => p_rec.encoded_error,
1172 p_status => p_rec.status,
1173 p_object_version_number => p_rec.object_version_number);
1174 --
1175 hr_utility.set_location(' Leaving:'||l_proc, 10);
1176 End insert_validate;
1177 --
1178 -- ----------------------------------------------------------------------------
1179 -- |---------------------------< update_validate >----------------------------|
1180 -- ----------------------------------------------------------------------------
1181 Procedure update_validate(p_rec in hr_ahc_shd.g_rec_type,
1182 p_effective_date in date) is
1183 --
1184 l_proc varchar2(72) := g_package||'update_validate';
1185 --
1186 Begin
1187 hr_utility.set_location('Entering:'||l_proc, 5);
1188 --
1192 --
1189 -- As this data is not within the context of a business group
1190 -- the set_security_group_id procedure has zero passed
1191 -- to it as the default security_group_id.
1193 hr_api.set_security_group_id(p_security_group_id => 0);
1194 --
1195 hr_utility.set_location('Entering:'||l_proc, 6);
1196 --
1197 -- Check that non-updateable columns have not been updated
1198 chk_non_updateable_args
1199 (p_effective_date => p_effective_date
1200 ,p_rec => p_rec);
1201 --
1202 -- Call all supporting business operations
1203 --
1204 -- validate the application_install_status
1205 chk_app_install_status
1206 (p_app_install_status => p_rec.app_install_status
1207 ,p_application_id => p_rec.application_id
1208 ,p_effective_date => p_effective_date);
1209
1210 -- Validate the sequence
1211 chk_sequence
1212 (p_api_hook_call_id => p_rec.api_hook_call_id,
1213 p_sequence => p_rec.sequence,
1214 p_legislation_code => p_rec.legislation_code,
1215 p_application_id => p_rec.application_id,
1216 p_object_version_number => p_rec.object_version_number);
1217
1218 -- Validate the enabled_flag
1219 chk_enabled_flag
1220 (p_api_hook_call_id => p_rec.api_hook_call_id,
1221 p_enabled_flag => p_rec.enabled_flag,
1222 p_object_version_number => p_rec.object_version_number,
1223 p_effective_date => p_effective_date);
1224
1225 -- Validate the call_package
1226 chk_call_package
1227 (p_api_hook_call_id => p_rec.api_hook_call_id,
1228 p_call_package => p_rec.call_package,
1229 p_api_hook_call_type => p_rec.api_hook_call_type,
1230 p_object_version_number => p_rec.object_version_number);
1231
1232 -- Validate the call_procedure
1233 chk_call_procedure
1234 (p_api_hook_call_id => p_rec.api_hook_call_id,
1235 p_call_procedure => p_rec.call_procedure,
1236 p_api_hook_call_type => p_rec.api_hook_call_type,
1237 p_object_version_number => p_rec.object_version_number);
1238
1239 -- Validate the call_pp_combination
1240 chk_call_pp_combination
1241 (p_api_hook_call_id => p_rec.api_hook_call_id,
1242 p_api_hook_call_type => p_rec.api_hook_call_type,
1243 p_legislation_code => p_rec.legislation_code,
1244 p_application_id => p_rec.application_id,
1245 p_call_package => p_rec.call_package,
1246 p_call_procedure => p_rec.call_procedure,
1247 p_api_hook_id => p_rec.api_hook_id,
1248 p_object_version_number => p_rec.object_version_number);
1249 --
1250 /*******************************************************************************
1251 * These two calls will be commented out for the first version. They will be
1252 * added back in when FORMULA calls are possible.
1253 ********************************************************************************
1254 *
1255 * -- Validate the formula_id
1256 * chk_formula_id
1257 * (p_api_hook_call_id => p_rec.api_hook_call_id,
1258 * p_formula_id => p_rec.formula_id);
1259 *
1260 * -- Validate the call_ff_combination
1261 * chk_call_ff_combination
1262 * (p_api_hook_call_id => p_rec.api_hook_call_id);
1263 *
1264 *
1265 *******************************************************************************/
1266 --
1267 -- Validate the pre_processor_date
1268 chk_pre_processor_date
1269 (p_api_hook_call_id => p_rec.api_hook_call_id,
1270 p_pre_processor_date => p_rec.pre_processor_date,
1271 p_object_version_number => p_rec.object_version_number);
1272
1273 -- Validate the status
1274 chk_status
1275 (p_api_hook_call_id => p_rec.api_hook_call_id,
1276 p_status => p_rec.status,
1277 p_object_version_number => p_rec.object_version_number,
1278 p_effective_date => p_effective_date);
1279 --
1280 -- Validate the encoded_error
1281 chk_encoded_error
1282 (p_api_hook_call_id => p_rec.api_hook_call_id,
1283 p_encoded_error => p_rec.encoded_error,
1284 p_status => p_rec.status,
1285 p_object_version_number => p_rec.object_version_number);
1286 --
1287 hr_utility.set_location(' Leaving:'||l_proc, 10);
1288 End update_validate;
1289 --
1290 -- ----------------------------------------------------------------------------
1291 -- |---------------------------< delete_validate >----------------------------|
1292 -- ----------------------------------------------------------------------------
1293 Procedure delete_validate(p_rec in hr_ahc_shd.g_rec_type) is
1294 --
1295 l_proc varchar2(72) := g_package||'delete_validate';
1296 --
1297 Begin
1298 hr_utility.set_location('Entering:'||l_proc, 5);
1299 --
1300 -- Call all supporting business operations
1301 --
1302 hr_utility.set_location(' Leaving:'||l_proc, 10);
1303 End delete_validate;
1304 --
1305 end hr_ahc_bus;