DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_AHK_BUS

Source


1 Package Body hr_ahk_bus as
2 /* $Header: hrahkrhi.pkb 115.8 2002/12/03 16:34:49 apholt ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_ahk_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_ahk_shd.g_rec_type
17   ) is
18 --
19   l_proc     varchar2(72) := g_package||'chk_non_updateable_args';
20   l_error    exception;
21   l_argument varchar2(30);
22 --
23 Begin
24   hr_utility.set_location('Entering:'||l_proc, 10);
25   --
26   -- Only proceed with validation if a row exists for
27   -- the current record in the HR Schema
28   --
29   if not hr_ahk_shd.api_updating
30       (p_api_hook_id          => p_rec.api_hook_id
31       ) then
32     hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
33     hr_utility.set_message_token('PROCEDURE', l_proc);
34     hr_utility.set_message_token('STEP', '20');
35   end if;
36   hr_utility.set_location(l_proc, 30);
37   --
38   if nvl(p_rec.api_module_id, hr_api.g_varchar2) <>
39      nvl(hr_ahk_shd.g_old_rec.api_module_id
40         ,hr_api.g_varchar2
41         ) then
42      l_argument := 'api_module_id';
43      raise l_error;
44   end if;
45   --
46   if nvl(p_rec.legislation_code, hr_api.g_varchar2) <>
47      nvl(hr_ahk_shd.g_old_rec.legislation_code
48         ,hr_api.g_varchar2
49         ) then
50      l_argument := 'legislation_code';
51      raise l_error;
52   end if;
53   --
54   hr_utility.set_location(l_proc, 40);
55 exception
56     when l_error then
57        hr_api.argument_changed_error
58          (p_api_name => l_proc
59          ,p_argument => l_argument
60          );
61     when others then
62        raise;
63   hr_utility.set_location(' Leaving:'||l_proc, 50);
64 end chk_non_updateable_args;
65 --
66 --  -----------------------------------------------------------------
67 --  |-----------------------< chk_api_module_id >-------------------------|
68 --  -----------------------------------------------------------------
69 --
70 --  Description:
71 --    Check that the api_module_id is not null and that it refers to a row on
72 --    the parent HR_API_MODULES table. Prohibit insert into table HR_API_HOOKS
73 --    should the api-module-type equal 'AI' (Alternative Interface).
74 --
75 --  Pre-Requisites:
76 --    None
77 --
78 --  In Parameters:
79 --    p_api_hook_id
80 --    p_api_module_id
81 --
82 --  Post Success:
83 --    Processing continues if the api_module_id is valid.
84 --
85 --  Post Failure:
86 --    An application error is raised and processing is terminated if
87 --    the api_module_id is invalid.
88 --
89 --  Access Status:
90 --    Internal Row Handler Use Only.
91 --
92 Procedure chk_api_module_id
93        (p_api_hook_id           in      number,
94         p_api_module_id		in	number
95        ) is
96 --
97 --  Local declarations
98   l_proc			varchar2(72) := g_package||' chk_api_module_id';
99   l_api_module_type             hr_api_modules.api_module_type%TYPE;
100 
101   -- Setup cursor for valid module type check
102   cursor csr_valid_module_type is
103     select api_module_type
104     from hr_api_modules
105     where api_module_id = p_api_module_id;
106 --
107 begin
108 	hr_utility.set_location('Entering: '||l_proc,5);
109         --
110         --------------------------------
111         -- Check module id not null --
112         --------------------------------
113         hr_api.mandatory_arg_error
114            (p_api_name => l_proc,
115             p_argument =>  'p_api_module_id',
116             p_argument_value => p_api_module_id);
117 
118         --------------------------------
119         -- Check module id is valid --
120         --------------------------------
121         open csr_valid_module_type;
122         fetch csr_valid_module_type into l_api_module_type;
123         if csr_valid_module_type%notfound then
124            close csr_valid_module_type;
125            hr_ahk_shd.constraint_error('HR_API_HOOKS_FK1');
126         end if;
127 --      #661588:-
128         if l_api_module_type = 'AI' then
129           close csr_valid_module_type;
130           hr_utility.set_message(800,
131                 'PER_50041_TYPE_AI_NOT_ALLOWED');
132           hr_utility.raise_error;
133         end if;
134 --
135         close csr_valid_module_type;
136 
137 	hr_utility.set_location('Leaving: '||l_proc,10);
138 end chk_api_module_id;
139 --
140 --
141 --  -----------------------------------------------------------------
142 --  |-----------------------< chk_api_hook_type >-------------------|
143 --  -----------------------------------------------------------------
144 --
145 --  Description:
146 --    Check that api_hook_type is not null and exists on the HR_LOOKUPS table.
147 --    The combination of parent module id and api_hook_type must be unique within
148 --    the table. Also, api_hook_type must be validated against the parent module
149 --    attribute of api_module_type.
150 --
151 --  Pre-Requisites:
152 --    None
153 --
154 --  In Parameters:
155 --    p_api_hook_id
156 --    p_api_module_id
157 --    p_api_hook_type
158 --    p_effective_date
159 --
160 --  Post Success:
161 --    Processing continues if the api_hook_type is valid.
162 --
163 --  Post Failure:
164 --    An application error is raised and processing is terminated if
165 --    the api_hook_type is invalid.
166 --
167 --  Access Status:
168 --    Internal Row Handler Use Only.
169 --
170 Procedure chk_api_hook_type
171        (p_api_hook_id           in      number,
172         p_api_module_id         in number,
173         p_api_hook_type         in varchar2,
174         p_effective_date        in date
175        ) is
176 --
177 --   Local declarations
178   l_proc               varchar2(72) := g_package||'chk_api_hook_type';
179   l_api_module_id       number;
180   l_api_module_type     varchar2(30);
181   l_api_updating         boolean;
182 --
183 -- Declare a cursor that will check whether the passed
184 -- in hook type and module id form a unique combination
185    cursor csr_valid_combo is
186    select api_module_id from hr_api_hooks hah
187    where hah.api_module_id = p_api_module_id
188    and   hah.api_hook_type = p_api_hook_type;
189 
190 -- Declare a cursor to retrieve the module type from
191 -- the HR_API_MODULES table, using the api_module_id as a key.
192    cursor csr_get_module_type is
193    select api_module_type from hr_api_modules
194    where api_module_id = p_api_module_id;
195 
196 --
197 --
198 begin
199     hr_utility.set_location('Entering: '||l_proc,5);
200 
201     ----------------------------------
202     -- Check api hook type not null --
203     ----------------------------------
204     hr_api.mandatory_arg_error
205           (p_api_name => l_proc,
206            p_argument =>  'p_api_hook_type',
207            p_argument_value => p_api_hook_type);
208     --
209     -- Check if hook is being updated
210     --
211     l_api_updating := hr_ahk_shd.api_updating
212                         (p_api_hook_id => p_api_hook_id);
213 
214 
215     --
216     -- Proceed with validation based on outcome of api_updating call.
217     if ((l_api_updating and
218         hr_ahk_shd.g_old_rec.api_hook_type <> p_api_hook_type) or
219         (not l_api_updating)) then
220 
221 
222        --------------------------------
223        -- Check hook type is valid --
224        --------------------------------
225 
226        if hr_api.not_exists_in_hr_lookups
227            (p_effective_date       => p_effective_date,
228             p_lookup_type          => 'API_HOOK_TYPE',
229             p_lookup_code          => p_api_hook_type) then
230            hr_ahk_shd.constraint_error('HR_API_HOOKS_CK1');
231        end if;
232 
233        --------------------------------------------------------
234        -- Check for unique Module id and hook type combo --
235        --------------------------------------------------------
236        open csr_valid_combo;
237        fetch csr_valid_combo into l_api_module_id;
238 
239        if csr_valid_combo%found then
240            close csr_valid_combo;
241            hr_ahk_shd.constraint_error('HR_API_HOOKS_UK1');
242        end if;
243 
244        close csr_valid_combo;
245 
246        -----------------------------------------------------------------
247        -- Check that the module type and hook type form a valid combo --
248        -----------------------------------------------------------------
249 
250        open csr_get_module_type;
251        fetch csr_get_module_type into l_api_module_type;
252        if ((p_api_hook_type in ('AI', 'AU', 'AD') and l_api_module_type <> 'RH')
253             OR
254            (p_api_hook_type in ('BP', 'AP')       and l_api_module_type <> 'BP'))
255 
256           THEN
257           close csr_get_module_type;
258           hr_utility.set_message(800,'PER_52129_AHK_WRONG_HOOK_TYPE');
259           hr_utility.raise_error;
260        end if;
261 
262        close csr_get_module_type;
263 
264     end if; -- end of api_updating? if
265     hr_utility.set_location('Leaving: '||l_proc,10);
266 end chk_api_hook_type;
267 --
268 --
269 --  -----------------------------------------------------------------
270 --  |-----------------------< chk_legislation_code >----------------|
271 --  -----------------------------------------------------------------
272 --
273 --  Description:
274 --    Checks that the legislation_code is valid against the FND_TERRITORIES table.
275 --
276 --  Pre-Requisites:
277 --    None
278 --
279 --  In Parameters:
280 --    p_api_hook_id
281 --    p_legislation_code
282 --
283 --  Post Success:
284 --    Processing continues if the legislation_code is valid.
285 --
286 --  Post Failure:
287 --    An application error is raised and processing is terminated if
288 --    the legislation_code is invalid.
289 --
290 --  Access Status:
291 --    Internal Row Handler Use Only.
292 --
293 Procedure chk_legislation_code
294        (p_api_hook_id           in      number,
295         p_legislation_code      in      varchar2
296        ) is
297 --
298 --   Local declarations
299   l_proc               varchar2(72) := g_package||'chk_legislation_code';
300   l_territory_code     fnd_territories.territory_code%TYPE;
301 --
302 -- Setup cursor for valid legislation code check
303   cursor csr_valid_legislation_code is
304     select territory_code
305     from fnd_territories ft
306     where ft.territory_code = p_legislation_code;
307 
308 --
309 --
310 begin
311      hr_utility.set_location('Entering: '||l_proc,5);
312 
313      --------------------------------
314      -- Check legislation code is valid --
315      --------------------------------
316      if p_legislation_code is not null then
317         open csr_valid_legislation_code;
318         fetch csr_valid_legislation_code into l_territory_code;
319 
320         if csr_valid_legislation_code%notfound then
321             close csr_valid_legislation_code;
322             hr_utility.set_message(800,'PER_52123_AMD_LEG_CODE_INV');
323             hr_utility.raise_error;
324         end if; -- End cursor if
325 
326         close csr_valid_legislation_code;
327      end if; -- end check
328 
329     hr_utility.set_location('Leaving: '||l_proc,10);
330 end chk_legislation_code;
331 --
332 --
333 --  -----------------------------------------------------------------
334 --  |-----------------------< chk_hook_package >-------------------------|
335 --  -----------------------------------------------------------------
336 --
337 --  Description:
338 --    Check the hook package is not null.
339 --
340 --  Pre-Requisites:
341 --    None
342 --
343 --  In Parameters:
344 --    p_api_hook_id
345 --    p_hook_package
346 --
347 --  Post Success:
348 --    Processing continues if the hook_package is valid.
349 --
350 --  Post Failure:
351 --    An application error is raised and processing is terminated if
352 --    the hook_package is invalid.
353 --
354 --  Access Status:
355 --    Internal Row Handler Use Only.
356 --
357 Procedure chk_hook_package
358        (p_api_hook_id           in      number,
359         p_hook_package      in      varchar2
360        ) is
361 --
362 --   Local declarations
363   l_proc               varchar2(72) := g_package||'chk_hook_package';
364   l_api_updating         boolean;
365 --
366 --
367 begin
368      hr_utility.set_location('Entering: '||l_proc,5);
369 
370        --------------------------------
371        -- Check hook package not null --
372        --------------------------------
373        hr_api.mandatory_arg_error
374           (p_api_name => l_proc,
375            p_argument =>  'p_hook_package',
376            p_argument_value => p_hook_package);
377 
378     hr_utility.set_location('Leaving: '||l_proc,10);
379 
380 end chk_hook_package;
381 --
382 --
383 --  -----------------------------------------------------------------
384 --  |-----------------------< chk_hook_procedure >------------------|
385 --  -----------------------------------------------------------------
386 --
387 --  Description:
388 --    Check that the hook procedure is not null.
389 --
390 --  Pre-Requisites:
391 --    None
392 --
393 --  In Parameters:
394 --    p_api_hook_id
395 --    p_hook_procedure
396 --
397 --  Post Success:
398 --    Processing continues if the hook_procedure is valid.
399 --
400 --  Post Failure:
401 --    An application error is raised and processing is terminated if
402 --    the hook_procedure is invalid.
403 --
404 --  Access Status:
405 --    Internal Row Handler Use Only.
406 --
407 Procedure chk_hook_procedure
408        (p_api_hook_id           in      number,
409         p_hook_procedure      in      varchar2
410        ) is
411 --
412 --   Local declarations
413   l_proc               varchar2(72) := g_package||'chk_hook_procedure';
414   l_api_updating       boolean;
415 --
416 
417 --
418 begin
419      hr_utility.set_location('Entering: '||l_proc,5);
420 
421        --------------------------------
422        -- Check hook procedure not null --
423        --------------------------------
424        hr_api.mandatory_arg_error
425           (p_api_name => l_proc,
426            p_argument =>  'p_hook_procedure',
427            p_argument_value => p_hook_procedure);
428 
429      hr_utility.set_location('Leaving: '||l_proc,10);
430 end chk_hook_procedure;
431 --
432 --  -----------------------------------------------------------------
433 --  |-----------------------< chk_hook_package_procedure >----------|
434 --  -----------------------------------------------------------------
435 --
436 --  Description:
437 --    Checks that the hook package and hook procedure form a unique combination
441 --    None
438 --    on the table.
439 --
440 --  Pre-Requisites:
442 --
443 --  In Parameters:
444 --
445 --  Post Success:
446 --    Processing continues if the combination is valid.
447 --
448 --  Post Failure:
449 --    An application error is raised and processing is terminated if
450 --    the combination is invalid.
451 --
452 --  Access Status:
453 --    Internal Row Handler Use Only.
454 --
455 Procedure chk_hook_package_procedure
456        (p_api_hook_id           in      number,
457         p_hook_package        in      varchar2,
458         p_hook_procedure      in      varchar2
459        ) is
460 --
461 --   Local declarations
462   l_proc               varchar2(72) := g_package||'chk_hook_procedure';
463   l_api_module_id      number;
464   l_api_updating         boolean;
465 --
466 -- Declare a cursor that will check whether the passed
467 -- in hook package and hook procedure form a unique combination
468    cursor csr_valid_combo is
469    select api_module_id from hr_api_hooks hah
470    where hah.hook_package = p_hook_package
471    and   hah.hook_procedure = p_hook_procedure;
472 
473 --
474 begin
475      hr_utility.set_location('Entering: '||l_proc,5);
476 
477     -- Check if hook is being updated
478     l_api_updating := hr_ahk_shd.api_updating
479                       (p_api_hook_id => p_api_hook_id);
480 
481 
482     -- Proceed with validation based on outcome of api_updating call.
483     if ((l_api_updating and
484         hr_ahk_shd.g_old_rec.hook_procedure <> nvl(p_hook_procedure, hr_api.g_varchar2) and
485         hr_ahk_shd.g_old_rec.hook_package <>   nvl(p_hook_package,   hr_api.g_varchar2) ) or
486         (not l_api_updating)) then
487 
488        --------------------------------------------------------
489        -- Check for unique hook package and hook procedure combo --
490        --------------------------------------------------------
491        open csr_valid_combo;
492        fetch csr_valid_combo into l_api_module_id;
493 
494        if csr_valid_combo%found then
495            close csr_valid_combo;
496            hr_ahk_shd.constraint_error('HR_API_HOOKS_UK2');
497        end if;
498 
499        close csr_valid_combo;
500 
501      end if;
502 
503      hr_utility.set_location('Leaving: '||l_proc,10);
504 end chk_hook_package_procedure;
505 --
506 --
507 --  -----------------------------------------------------------------
508 --  |-----------------------< chk_legislation_package >--------------|
509 --  -----------------------------------------------------------------
510 --
511 --  Description:
512 --    Check the package is valid by referencing it against the parent attribute
513 --    Data_within_business_group.
514 --
515 --  Pre-Requisites:
516 --    None
517 --
518 --  In Parameters:
519 --    p_api_hook_id
520 --    p_api_module_id
521 --    p_legislation_package
522 --
523 --  Post Success:
524 --    Processing continues if the legislation_package is valid.
525 --
526 --  Post Failure:
527 --    An application error is raised and processing is terminated if
528 --    the legislation_package is invalid.
529 --
530 --  Access Status:
531 --    Internal Row Handler Use Only.
532 --
533 Procedure chk_legislation_package
534        (p_api_hook_id           in      number,
535         p_api_module_id            in number,
536         p_legislation_package      in      varchar2
537        ) is
538 --
539 --   Local declarations
540   l_proc               varchar2(72) := g_package||'chk_legislation_package';
541   l_data_within_business_group     hr_api_modules.data_within_business_group%TYPE;
542   l_api_updating         boolean;
543 --
544 -- Setup cursor for to retrieve data within business group from parent
545     cursor csr_get_data_within_bus_group is
546       select data_within_business_group
547       from hr_api_modules
548       where api_module_id = p_api_module_id;
549 --
550 --
551 begin
552     hr_utility.set_location('Entering: '||l_proc,5);
553 
554     -- Check if hook is being updated
555     l_api_updating := hr_ahk_shd.api_updating
556                       (p_api_hook_id => p_api_hook_id);
557 
558     -- Proceed with validation based on outcome of api_updating call.
559     if ((l_api_updating and
560         nvl(hr_ahk_shd.g_old_rec.legislation_package, hr_api.g_varchar2) <>
561                                            nvl(p_legislation_package, hr_api.g_varchar2) ) or
562         (not l_api_updating)) then
563 
564      ----------------------------------------
565      -- Check legislation package is valid --
566      ----------------------------------------
567      if p_legislation_package is not null then
568         open csr_get_data_within_bus_group;
569         fetch csr_get_data_within_bus_group into l_data_within_business_group;
570 
571         if l_data_within_business_group = 'N' THEN
572            close csr_get_data_within_bus_group;
573            hr_utility.set_message(800,'PER_52131_AHK_LEG_PACK_INV');
574            hr_utility.raise_error;
575         end if;
576 
580     end if;
577         close csr_get_data_within_bus_group;
578      end if;
579 
581     hr_utility.set_location('Leaving: '||l_proc,10);
582 end chk_legislation_package;
583 --
584 --
585 --
586 --  -----------------------------------------------------------------
587 --  |-----------------------< chk_legislation_function >------------|
588 --  -----------------------------------------------------------------
589 --
590 --  Description:
591 --    Checks that legislation_function is valid by referencing the parent
592 --    attribute data_within_business_group.
593 --
594 --  Pre-Requisites:
595 --    None
596 --
597 --  In Parameters:
598 --    p_api_hook_id
599 --    p_api_module_id
600 --    p_legislation_function
601 --
602 --  Post Success:
603 --    Processing continues if the legislation_function is valid.
604 --
605 --  Post Failure:
606 --    An application error is raised and processing is terminated if
607 --    the legislation_function is invalid.
608 --
609 --  Access Status:
610 --    Internal Row Handler Use Only.
611 --
612 Procedure chk_legislation_function
613        (p_api_hook_id           in      number,
614         p_api_module_id            in number,
615         p_legislation_function     in      varchar2
616        ) is
617 --
618 --   Local declarations
619   l_proc               varchar2(72) := g_package||'chk_legislation_function';
620   l_data_within_business_group     hr_api_modules.data_within_business_group%TYPE;
621   l_api_updating         boolean;
622 --
623 -- Setup cursor for to retrieve data within business group from parent
624     cursor csr_get_data_within_bus_group is
625       select data_within_business_group
626       from hr_api_modules
627       where api_module_id = p_api_module_id;
628 --
629 --
630 begin
631      hr_utility.set_location('Entering: '||l_proc,5);
632 
633     -- Check if hook is being updated
634     l_api_updating := hr_ahk_shd.api_updating
635                       (p_api_hook_id => p_api_hook_id);
636 
637     -- Proceed with validation based on outcome of api_updating call.
638     if ((l_api_updating and
639         nvl(hr_ahk_shd.g_old_rec.legislation_function, hr_api.g_varchar2) <>
640                                   nvl(p_legislation_function, hr_api.g_varchar2) ) or
641         (not l_api_updating)) then
642 
643      ----------------------------------------
644      -- Check legislation function is valid --
645      ----------------------------------------
646      if p_legislation_function is not null then
647         open csr_get_data_within_bus_group;
648         fetch csr_get_data_within_bus_group into l_data_within_business_group;
649 
650         if (l_data_within_business_group = 'N' AND
651            p_legislation_function is not null)  THEN
652            close csr_get_data_within_bus_group;
653            hr_utility.set_message(800,'PER_52132_AHK_LEG_FUNC_INV');
654            hr_utility.raise_error;
655         end if;
656 
657         close csr_get_data_within_bus_group;
658      end if;
659 
660     end if;
661     hr_utility.set_location('Leaving: '||l_proc,10);
662 end chk_legislation_function;
663 --
664 --
665 --  -----------------------------------------------------------------
666 --  |-----------------------< chk_leg_package_function >-------------|
667 --  -----------------------------------------------------------------
668 --
669 --  Description:
670 --    Check that the combination of leg_package and leg_function form a unique
671 --    combination on the table.
672 --
673 --  Pre-Requisites:
674 --    None
675 --
676 --  In Parameters:
677 --    p_api_hook_id
678 --    p_api_module_id
679 --    p_legislation_package
680 --    p_legislation_function
681 --
682 --  Post Success:
683 --    Processing continues if the combination is valid.
684 --
685 --  Post Failure:
686 --    An application error is raised and processing is terminated if
687 --    the combination is invalid.
688 --
689 --  Access Status:
690 --    Internal Row Handler Use Only.
691 --
692 Procedure chk_leg_package_function
693        (p_api_hook_id           in      number,
694         p_api_module_id            in number,
695         p_legislation_package      in      varchar2,
696         p_legislation_function     in      varchar2
697        ) is
698 --
699 --   Local declarations
700   l_proc               varchar2(72) := g_package||'chk_legislation_function';
701 --
702 --
703 begin
704      hr_utility.set_location('Entering: '||l_proc,5);
705 
706      --------------------------------------------------
707      -- Check Legislation Function and Package Combo --
708      --------------------------------------------------
709 
710      if (p_legislation_function is not null and p_legislation_package is null) OR
711         (p_legislation_function is     null and p_legislation_package is not null)
712         then
713            hr_ahk_shd.constraint_error('HR_API_HOOKS_CK2');
714      end if;
715 
716     hr_utility.set_location('Leaving: '||l_proc,10);
717 end chk_leg_package_function;
718 --
722 --
719 --  -----------------------------------------------------------------
720 --  |-----------------------< chk_delete >-------------------------|
721 --  -----------------------------------------------------------------
723 --  Description:
724 --    Checks if the hook has any children.
725 --
726 --  Pre-Requisites:
727 --    None
728 --
729 --  In Parameters:
730 --    p_api_hook_id
731 --
732 --  Post Success:
733 --    Processing continues if the hook has no children.
734 --
735 --  Post Failure:
736 --    An application error is raised and processing is terminated if
737 --    the hook has children.
738 --
739 --  Access Status:
740 --    Internal Row Handler Use Only.
741 --
742 Procedure chk_delete
743        (p_api_hook_id		in	number
744        ) is
745 --
746 --   Local declarations
747   l_proc               varchar2(72) := g_package||'chk_delete';
748   l_api_hook_id        number;
749 --
750 -- Setup cursor to check for children
751   cursor csr_check_for_child is
752     select api_hook_id
753     from hr_api_hook_calls hahc
754     where hahc.api_hook_id = p_api_hook_id;
755 --
756 --
757 begin
758      hr_utility.set_location('Entering: '||l_proc,5);
759 
760      -- We don't have to check for valid hook id as this is done by the lck proc
761      --------------------------------------
762      -- Check if hook has any children --
763      --------------------------------------
764 
765      open csr_check_for_child;
766      fetch csr_check_for_child into l_api_hook_id;
767 
768      if csr_check_for_child%found then
769          close csr_check_for_child;
770          hr_utility.set_message(800,'PER_52148_AHK_CANNOT_DEL_ROW');
771          hr_utility.raise_error;
772      end if;
773 
774      close csr_check_for_child;
775 
776     hr_utility.set_location('Leaving: '||l_proc,10);
777 end chk_delete;
778 --
779 --
780 --
781 -- ----------------------------------------------------------------------------
782 -- |---------------------------< insert_validate >----------------------------|
783 -- ----------------------------------------------------------------------------
784 Procedure insert_validate(p_rec in hr_ahk_shd.g_rec_type,
785                           p_effective_date in date) is
786 --
787   l_proc  varchar2(72) := g_package||'insert_validate';
788 --
789 Begin
790   hr_utility.set_location('Entering:'||l_proc, 5);
791   --
792   --
793   -- As this data is not within the context of a business group
794   -- the set_security_group_id procedure has zero passed
795   -- to it as the default security_group_id.
796   --
797   hr_api.set_security_group_id(p_security_group_id => 0);
798   --
799   hr_utility.set_location('Entering:'||l_proc, 7);
800   --
801   -- Call all supporting business operations
802   --
803   -- Validate the Module Id
804        chk_api_module_id
805        (p_api_hook_id           => p_rec.api_hook_id,
806         p_api_module_id              => p_rec.api_module_id);
807 
808   -- Validate the API Hook Type
809        chk_api_hook_type
810        (p_api_hook_id           => p_rec.api_hook_id,
811         p_api_module_id              => p_rec.api_module_id,
812         p_api_hook_type              => p_rec.api_hook_type,
813         p_effective_date             => p_effective_date);
814   --
815   -- Validate the hook package
816        chk_hook_package
817        (p_api_hook_id           => p_rec.api_hook_id,
818         p_hook_package               => p_rec.hook_package);
819 
820   -- Validate the hook procedure
821        chk_hook_procedure
822        (p_api_hook_id           => p_rec.api_hook_id,
823         p_hook_procedure             => p_rec.hook_procedure);
824 
825   -- Validate the hook proc and pack combo.
826        chk_hook_package_procedure
827        (p_api_hook_id           => p_rec.api_hook_id,
828         p_hook_package        => p_rec.hook_package,
829         p_hook_procedure      => p_rec.hook_procedure);
830 
831   -- Validate Legislation Code
832      chk_legislation_code
833        (p_api_hook_id           => p_rec.api_hook_id,
834         p_legislation_code           => p_rec.legislation_code);
835   --
836   -- Validate Legislation Package
837      chk_legislation_package
838        (p_api_hook_id           => p_rec.api_hook_id,
839         p_api_module_id            => p_rec.api_module_id,
840         p_legislation_package      => p_rec.legislation_package
841        );
842   --
843   -- Validate Legislation Function
844      chk_legislation_function
845        (p_api_hook_id           => p_rec.api_hook_id,
846         p_api_module_id            => p_rec.api_module_id,
847         p_legislation_function     => p_rec.legislation_function
848        );
849 
850   --
851   -- Validate Legislation Package and Function combination
852      chk_leg_package_function
853        (p_api_hook_id           => p_rec.api_hook_id,
854         p_api_module_id            => p_rec.api_module_id,
855         p_legislation_package      => p_rec.legislation_package,
856         p_legislation_function     => p_rec.legislation_function
857        );
858 
859   --
860   hr_utility.set_location(' Leaving:'||l_proc, 10);
861 End insert_validate;
862 --
863 -- ----------------------------------------------------------------------------
864 -- |---------------------------< update_validate >----------------------------|
865 -- ----------------------------------------------------------------------------
866 Procedure update_validate(p_rec in hr_ahk_shd.g_rec_type,
867                           p_effective_date in date) is
868 --
869   l_proc  varchar2(72) := g_package||'update_validate';
870 --
871 Begin
872   hr_utility.set_location('Entering:'||l_proc, 5);
873   --
874   -- As this data is not within the context of a business group
875   -- the set_security_group_id procedure has zero passed
876   -- to it as the default security_group_id.
877   --
878   hr_api.set_security_group_id(p_security_group_id => 0);
879   --
880   hr_utility.set_location('Entering:'||l_proc, 7);
881   --
882   -- Call all supporting business operations
883   --
884   -- Validate the API Hook Type
885        chk_api_hook_type
886        (p_api_hook_id           => p_rec.api_hook_id,
887         p_api_module_id              => p_rec.api_module_id,
888         p_api_hook_type              => p_rec.api_hook_type,
889         p_effective_date             => p_effective_date);
890   --
891   -- Validate the hook package
892        chk_hook_package
893        (p_api_hook_id           => p_rec.api_hook_id,
894         p_hook_package               => p_rec.hook_package);
895 
896   -- Validate the hook procedure
897        chk_hook_procedure
898        (p_api_hook_id           => p_rec.api_hook_id,
899         p_hook_procedure             => p_rec.hook_procedure);
900 
901   -- Validate the hook proc and pack combo.
902        chk_hook_package_procedure
903        (p_api_hook_id           => p_rec.api_hook_id,
904         p_hook_package        => p_rec.hook_package,
905         p_hook_procedure      => p_rec.hook_procedure);
906   --
907   -- Validate Legislation Package
908      chk_legislation_package
909        (p_api_hook_id           => p_rec.api_hook_id,
910         p_api_module_id            => p_rec.api_module_id,
911         p_legislation_package      => p_rec.legislation_package
912        );
913   --
914   -- Validate Legislation Function
915      chk_legislation_function
916        (p_api_hook_id           => p_rec.api_hook_id,
917         p_api_module_id            => p_rec.api_module_id,
918         p_legislation_function     => p_rec.legislation_function
919        );
920   --
921   -- Validate Legislation Package and Function combination
922      chk_leg_package_function
923        (p_api_hook_id           => p_rec.api_hook_id,
924         p_api_module_id            => p_rec.api_module_id,
925         p_legislation_package      => p_rec.legislation_package,
926         p_legislation_function     => p_rec.legislation_function
927        );
928   --
929   --
930   hr_utility.set_location(' Leaving:'||l_proc, 10);
931 End update_validate;
932 --
933 -- ----------------------------------------------------------------------------
934 -- |---------------------------< delete_validate >----------------------------|
935 -- ----------------------------------------------------------------------------
936 Procedure delete_validate(p_rec in hr_ahk_shd.g_rec_type) is
937 --
938   l_proc  varchar2(72) := g_package||'delete_validate';
939 --
940 Begin
941   hr_utility.set_location('Entering:'||l_proc, 5);
942   --
943   -- Call all supporting business operations
944     chk_delete(p_api_hook_id   =>   p_rec.api_hook_id);
945   --
946   hr_utility.set_location(' Leaving:'||l_proc, 10);
947 End delete_validate;
948 --
949 end hr_ahk_bus;