1 Package Body pay_ett_bus as
2 /* $Header: pyettrhi.pkb 120.1 2005/10/04 22:03:25 pgongada noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_ett_bus.'; -- Global package name
9 --
10 -- The following two global variables are only to be
11 -- used by the return_legislation_code function.
12 --
13 g_legislation_code varchar2(150) default null;
14 g_element_type_id number default null;
15 g_language varchar2(4) default null;
16 --
17 -- ---------------------------------------------------------------------------
18 -- |----------------------< set_security_group_id >--------------------------|
19 -- ---------------------------------------------------------------------------
20 --
21 Procedure set_security_group_id
22 (p_element_type_id in number
23 ,p_associated_column1 in varchar2 default null
24 ) is
25 --
26 -- Declare cursor
27 --
28 cursor csr_sec_grp is
29 select pbg.security_group_id
30 from per_business_groups pbg
31 , pay_element_types_f_tl ett
32 , pay_element_types_f etp
33 where ett.element_type_id = p_element_type_id
34 and pbg.business_group_id = etp.business_group_id
35 and ett.element_type_id = etp.element_type_id;
36 --
37 -- Declare local variables
38 --
39 l_security_group_id number;
40 l_proc varchar2(72) := g_package||'set_security_group_id';
41 --
42 begin
43 --
44 hr_utility.set_location('Entering:'|| l_proc, 10);
45 --
46 -- Ensure that all the mandatory parameter are not null
47 --
48 hr_api.mandatory_arg_error
49 (p_api_name => l_proc
50 ,p_argument => 'element_type_id'
51 ,p_argument_value => p_element_type_id
52 );
53 --
54 --
55 open csr_sec_grp;
56 fetch csr_sec_grp into l_security_group_id;
57 --
58 if csr_sec_grp%notfound then
59 --
60 close csr_sec_grp;
61 --
62 -- The primary key is invalid therefore we must error
63 --
64 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
65 hr_multi_message.add
66 (p_associated_column1
67 => nvl(p_associated_column1,'ELEMENT_TYPE_ID')
68 );
69 --
70 else
71 close csr_sec_grp;
72 --
73 -- Set the security_group_id in CLIENT_INFO
74 --
75 hr_api.set_security_group_id
76 (p_security_group_id => l_security_group_id
77 );
78 end if;
79 --
80 hr_utility.set_location(' Leaving:'|| l_proc, 20);
81 --
82 end set_security_group_id;
83 --
84 -- ---------------------------------------------------------------------------
85 -- |---------------------< return_legislation_code >-------------------------|
86 -- ---------------------------------------------------------------------------
87 --
88 Function return_legislation_code
89 (p_element_type_id in number
90 ,p_language in varchar2
91 )
92 Return Varchar2 Is
93 --
94 -- Declare cursor
95 --
96 cursor csr_leg_code is
97 select pbg.legislation_code
98 from per_business_groups pbg
99 , pay_element_types_f_tl ett
100 , pay_element_types_f etp
101 where ett.element_type_id = p_element_type_id
102 and pbg.business_group_id = etp.business_group_id
103 and ett.element_type_id = etp.element_type_id
104 and ett.language = p_language;
105 --
106 -- Declare local variables
107 --
108 l_legislation_code varchar2(150);
109 l_proc varchar2(72) := g_package||'return_legislation_code';
110 --
111 Begin
112 --
113 hr_utility.set_location('Entering:'|| l_proc, 10);
114 --
115 -- Ensure that all the mandatory parameter are not null
116 --
117 hr_api.mandatory_arg_error
118 (p_api_name => l_proc
119 ,p_argument => 'element_type_id'
120 ,p_argument_value => p_element_type_id
121 );
122 --
123 --
124 if (( nvl(pay_ett_bus.g_element_type_id, hr_api.g_number)
125 = p_element_type_id)
126 and ( nvl(pay_ett_bus.g_language, hr_api.g_varchar2)
127 = p_language)) then
128 --
129 -- The legislation code has already been found with a previous
130 -- call to this function. Just return the value in the global
131 -- variable.
132 --
133 l_legislation_code := pay_ett_bus.g_legislation_code;
134 hr_utility.set_location(l_proc, 20);
135 else
136 --
137 -- The ID is different to the last call to this function
138 -- or this is the first call to this function.
139 --
140 open csr_leg_code;
141 fetch csr_leg_code into l_legislation_code;
142 --
143 if csr_leg_code%notfound then
144 --
145 -- The primary key is invalid therefore we must error
146 --
147 close csr_leg_code;
148 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
149 fnd_message.raise_error;
150 end if;
151 hr_utility.set_location(l_proc,30);
152 --
153 -- Set the global variables so the values are
154 -- available for the next call to this function.
155 --
156 close csr_leg_code;
157 pay_ett_bus.g_element_type_id := p_element_type_id;
158 pay_ett_bus.g_language := p_language;
159 pay_ett_bus.g_legislation_code := l_legislation_code;
160 end if;
161 hr_utility.set_location(' Leaving:'|| l_proc, 40);
162 return l_legislation_code;
163 end return_legislation_code;
164 --
165 -- ----------------------------------------------------------------------------
166 -- |-----------------------< chk_non_updateable_args >------------------------|
167 -- ----------------------------------------------------------------------------
168 -- {Start Of Comments}
169 --
170 -- Description:
171 -- This procedure is used to ensure that non updateable attributes have
172 -- not been updated. If an attribute has been updated an error is generated.
173 --
174 -- Pre Conditions:
175 -- g_old_rec has been populated with details of the values currently in
176 -- the database.
177 --
178 -- In Arguments:
179 -- p_rec has been populated with the updated values the user would like the
180 -- record set to.
181 --
182 -- Post Success:
183 -- Processing continues if all the non updateable attributes have not
184 -- changed.
185 --
186 -- Post Failure:
187 -- An application error is raised if any of the non updatable attributes
188 -- have been altered.
189 --
190 -- {End Of Comments}
191 -- ----------------------------------------------------------------------------
192 Procedure chk_non_updateable_args
193 (p_rec in pay_ett_shd.g_rec_type
194 ) IS
195 --
196 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
197 --
198 Begin
199 --
200 -- Only proceed with the validation if a row exists for the current
201 -- record in the HR Schema.
202 --
203 IF NOT pay_ett_shd.api_updating
204 (p_element_type_id => p_rec.element_type_id
205 ,p_language => p_rec.language
206 ) THEN
207 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
208 fnd_message.set_token('PROCEDURE ', l_proc);
209 fnd_message.set_token('STEP ', '5');
210 fnd_message.raise_error;
211 END IF;
212 --
213 End chk_non_updateable_args;
214 --
215 -- ----------------------------------------------------------------------------
216 -- |---------------------------< insert_validate >----------------------------|
217 -- ----------------------------------------------------------------------------
218 Procedure insert_validate
219 (p_rec in pay_ett_shd.g_rec_type
220 ,p_element_type_id in number
221 ) is
222 --
223 l_proc varchar2(72) := g_package||'insert_validate';
224 --
225 Begin
226 hr_utility.set_location('Entering:'||l_proc, 5);
227 --
228 -- Call all supporting business operations
229 --
230 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
231 --
232 -- Validate Dependent Attributes
233 --
234 hr_utility.set_location(' Leaving:'||l_proc, 10);
235 End insert_validate;
236 --
237 -- ----------------------------------------------------------------------------
238 -- |---------------------------< update_validate >----------------------------|
239 -- ----------------------------------------------------------------------------
240 Procedure update_validate
241 (p_rec in pay_ett_shd.g_rec_type
242 ) is
243 --
244 l_proc varchar2(72) := g_package||'update_validate';
245 --
246 Begin
247 hr_utility.set_location('Entering:'||l_proc, 5);
248 --
249 -- Call all supporting business operations
250 --
251 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
252 --
253 -- Validate Dependent Attributes
254 --
255 chk_non_updateable_args
256 (p_rec => p_rec
257 );
258 --
259 --
260 hr_utility.set_location(' Leaving:'||l_proc, 10);
261 End update_validate;
262 --
263 -- ----------------------------------------------------------------------------
264 -- |---------------------------< delete_validate >----------------------------|
265 -- ----------------------------------------------------------------------------
266 Procedure delete_validate
267 (p_rec in pay_ett_shd.g_rec_type
268 ) is
269 --
270 l_proc varchar2(72) := g_package||'delete_validate';
271 --
272 Begin
273 hr_utility.set_location('Entering:'||l_proc, 5);
274 --
275 -- Call all supporting business operations
276 --
277 hr_utility.set_location(' Leaving:'||l_proc, 10);
278 End delete_validate;
279 --
280 end pay_ett_bus;