DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_PAP_BUS

Source


1 Package Body hr_pap_bus as
2 /* $Header: hrpaprhi.pkb 115.2 99/07/17 05:36:33 porting ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_pap_bus.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< chk_pattern_purpose >------------------------|
12 -- ----------------------------------------------------------------------------
13 procedure chk_pattern_purpose (
14 --
15 p_pattern_purpose	in varchar2,
16 p_pattern_id		in number
17 ) is
18 --
19 l_proc	varchar2(72) := g_package||'chk_pattern_purpose';
20 l_dummy	integer (1) :=null;
21 --
22 cursor csr_lookup is
23 	--
24 	select	1
25 	from	hr_lookups
26 	where	lookup_type = 'PATTERN_PURPOSE'
27 	and	lookup_code = p_pattern_purpose;
28 	--
29 cursor csr_non_SSP_pattern is
30 	--
31 	-- Find pattern which is not required to start at midnight
32 	--
33 	select	1
34 	from	hr_patterns
35 	where	pattern_id = p_pattern_id
36 	and	pattern_start_time <> '00:00'
37 	--
38 	-- Find, for construction rows based directly on pattern bits, any
39 	-- row which is not based on whole multiples of a day or which is
40 	-- not a qualifying or non-qualifying day.
41 	--
42 	union all
43 	select  1
44 	from    hr_pattern_bits			BIT,
45 		hr_pattern_constructions	CON
46 	where   con.pattern_bit_id = bit.pattern_bit_id
47 	and	con.pattern_id = p_pattern_id
48 	and     (bit.time_unit_multiplier <> ceil (bit.time_unit_multiplier)
49 		or bit.base_time_unit <> 'DAYS'
50 		or con.availability is null
51 		or con.availability not in ('QUALIFYING','NON QUALIFYING'))
52 	--
53 	-- Find, for construction rows based on other patterns , any
54 	-- row which is not based on whole multiples of a day or which is
55 	-- not a qualifying or non-qualifying day.
56 	--
57 	union all
58 	select  1
59 	from    hr_pattern_bits                 BIT,
60 		hr_pattern_constructions        CON,
61 		hr_pattern_constructions	CON2
62 	where   bit.pattern_bit_id = con2.pattern_bit_id
63 	and	con.pattern_id = p_pattern_id
64 	and	con.component_pattern_id = con2.pattern_id
65 	and     (bit.time_unit_multiplier <> ceil (bit.time_unit_multiplier)
66 		or bit.base_time_unit <> 'DAYS'
67 		or con2.availability not in ('QUALIFYING','NON QUALIFYING'));
68 --
69 procedure check_parameters is
70 	--
71 	begin
72 	--
73 	hr_api.mandatory_arg_error
74 		(p_api_name       => l_proc,
75 		p_argument       => 'pattern_id',
76 		p_argument_value => p_pattern_id);
77 	--
78 	hr_api.mandatory_arg_error
79 		(p_api_name       => l_proc,
80 		p_argument       => 'pattern_purpose',
81 		p_argument_value => p_pattern_purpose);
82 	--
83 	end check_parameters;
84 	--
85 begin
86 --
87 hr_utility.set_location ('Entering '||l_proc,1);
88 --
89 check_parameters;
90 --
91 -- Check that the pattern purpose is a valid lookup code.
92 --
93 open csr_lookup;
94 fetch csr_lookup into l_dummy;
95 if csr_lookup%notfound then
96   --
97   -- The pattern purpose is not valid.
98   --
99   close csr_lookup;
100   hr_utility.set_message (801,'HR_51078_PAP_PATTERN_PURPOSE');
101   hr_utility.raise_error;
102   --
103 else
104   --
105   close csr_lookup;
106   --
107 end if;
108 --
109 -- Check SSP-specific rules
110 --
111 if p_pattern_purpose = 'QUALIFYING PATTERN' then
112   --
113   -- Look for any reason why this pattern is not a valid SSP qualifying pattern
114   --
115   open csr_non_SSP_pattern;
116   fetch csr_non_SSP_pattern into l_dummy;
117   if csr_non_SSP_pattern%found then
118     --
119     close csr_non_SSP_pattern;
120     hr_utility.set_message (801,'HR_51079_PAP_SSP_PATTERN');
121     hr_utility.raise_error;
122     --
123   else
124     --
125     close csr_non_SSP_pattern;
126     --
127   end if;
128   --
129 end if;
130 --
131 hr_utility.set_location ('Leaving '||l_proc,10);
132 --
133 end chk_pattern_purpose;
134 -- ----------------------------------------------------------------------------
135 -- |---------------------------< insert_validate >----------------------------|
136 -- ----------------------------------------------------------------------------
137 Procedure insert_validate(p_rec in hr_pap_shd.g_rec_type) is
138 --
139   l_proc  varchar2(72) := g_package||'insert_validate';
140 --
141 Begin
142   hr_utility.set_location('Entering:'||l_proc, 5);
143   --
144   -- Call all supporting business operations
145   --
146   chk_pattern_purpose (	p_pattern_purpose=> p_rec.pattern_purpose,
147 			p_pattern_id=> p_rec.pattern_id);
148   --
149   --
150   hr_utility.set_location(' Leaving:'||l_proc, 10);
151 End insert_validate;
152 --
153 -- ----------------------------------------------------------------------------
154 -- |---------------------------< update_validate >----------------------------|
155 -- ----------------------------------------------------------------------------
156 Procedure update_validate(p_rec in hr_pap_shd.g_rec_type) is
157 --
158   l_proc  varchar2(72) := g_package||'update_validate';
159 --
160 Begin
161   hr_utility.set_location('Entering:'||l_proc, 5);
162   --
163   -- Call all supporting business operations
164   --
165   --
166   --
167   hr_utility.set_location(' Leaving:'||l_proc, 10);
168 End update_validate;
169 --
170 -- ----------------------------------------------------------------------------
171 -- |---------------------------< delete_validate >----------------------------|
172 -- ----------------------------------------------------------------------------
173 Procedure delete_validate(p_rec in hr_pap_shd.g_rec_type) is
174 --
175   l_proc  varchar2(72) := g_package||'delete_validate';
176 --
177 Begin
178   hr_utility.set_location('Entering:'||l_proc, 5);
179   --
180   -- Call all supporting business operations
181   --
182   hr_utility.set_location(' Leaving:'||l_proc, 10);
183 End delete_validate;
184 --
185 end hr_pap_bus;