DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_AU_ABSENCE_HOOK

Source


1 PACKAGE BODY HR_AU_ABSENCE_HOOK AS
2 /* $Header: peaulhab.pkb 120.2 2006/03/23 15:42:35 strussel noship $ */
3 
4 g_debug boolean ;
5 
6 PROCEDURE UPDATE_ABSENCE_DEV_DESC_FLEX ( p_absence_attendance_id IN NUMBER
7                                ) AS
8 
9   l_proc                  varchar2(100) := 'hr_au_absence_hook.udpate_absence_dev_desc_flex';
10   l_element_entry_id      pay_element_entries_f.element_entry_id%TYPE;
11   l_effective_start_date  pay_element_entries_f.effective_start_date%TYPE;
12   l_effective_end_date    pay_element_entries_f.effective_end_date%TYPE;
13   l_processing_type       pay_element_types_f.processing_type%TYPE;
14   l_ovn                   pay_element_entries_f.object_version_number%TYPE;
15   l_warning               boolean;
16 
17   cursor c_get_absence_element (c_absence_attendance_id number)
18   is
19     select pee.element_entry_id
20           ,pee.effective_start_date
21           ,pee.effective_end_date
22           ,pet.processing_type
23           ,max(pee.object_version_number)
24     from   per_absence_attendances abs
25           ,pay_element_entries_f pee
26           ,pay_element_types_f pet
27           ,per_all_assignments_f paa
28     where abs.absence_attendance_id = c_absence_attendance_id
29     and   pee.creator_id = abs.absence_attendance_id
30     and   pee.creator_type = 'A'
31     and   pee.element_type_id = pet.element_type_id
32     and   pee.effective_start_date between pet.effective_start_date and
33                                            pet.effective_end_date
34     and   paa.person_id = abs.person_id
35     and   pee.effective_start_date between paa.effective_start_date and
36                                            paa.effective_end_date
37     and   paa.assignment_id = pee.assignment_id
38     group by pee.element_entry_id,
39              pee.effective_start_date,
40              pee.effective_end_date,
41              pet.processing_type
42 ;
43 
44 /* Update the absence flexfield values by doing a call to the
45    update_element_entry api. This api has a legislative hook which updates
46    the element entry values from the Absence flexfield so no need to do the
47    same updates in here.
48 
49    Only do for recurring elements because for non-recurring the
50    update_element_entry api is already being called in the core absence package.
51 
52 */
53 
54 begin
55 
56   g_debug := hr_utility.debug_enabled;
57 
58   if g_debug THEN
59     hr_utility.set_location('Entering '||l_proc, 10);
60     hr_utility.set_location('p_absence_attendance_id ' || p_absence_attendance_id, 25);
61   end if;
62 
63 /* Get the element entry details for the absence element. */
64 
65   if g_debug THEN
66     hr_utility.set_location(l_proc, 20);
67   end if;
68   open c_get_absence_element(p_absence_attendance_id);
69   fetch c_get_absence_element into l_element_entry_id,
70                                    l_effective_start_date,
71                                    l_effective_end_date,
72                                    l_processing_type,
73                                    l_ovn;
74   close c_get_absence_element;
75 
76   if g_debug THEN
77     hr_utility.set_location('l_element_entry_id ' || l_element_entry_id, 25);
78     hr_utility.set_location('l_effective_start_date ' || l_effective_start_date, 25);
79     hr_utility.set_location('l_effective_end_date ' || l_effective_end_date, 25);
80     hr_utility.set_location('l_processing_type ' || l_processing_type, 25);
81     hr_utility.set_location('l_ovn ' || l_ovn, 25);
82   end if;
83 
84 /* Call the AU element entry hook package to udpate the element entry values.
85    Only do for recurring elements. */
86 
87   if l_processing_type = 'R' then
88 
89     hr_au_element_entry_hook.update_element_entry_values
90       (p_effective_date        => l_effective_start_date
91       ,p_element_entry_id      => l_element_entry_id
92       ,p_creator_type          => 'A'
93       ,p_creator_id            => p_absence_attendance_id
94       );
95 
96     if g_debug THEN
97       hr_utility.set_location(l_proc, 90);
98     end if;
99 
100   end if;
101 
102   if g_debug THEN
103     hr_utility.set_location('Leaving '||l_proc, 99);
104   end if;
105 
106 END update_absence_dev_desc_flex ;
107 
108 END hr_au_absence_hook;