1 Package Body per_ssb_bus as
2 /* $Header: pessbrhi.pkb 115.1 2003/08/06 01:25:57 kavenkat noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_ssb_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_setup_sub_task_code varchar2(60) default null;
15 --
16 -- ---------------------------------------------------------------------------
17 -- |----------------------< set_security_group_id >--------------------------|
18 -- ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21 (p_setup_sub_task_code in varchar2
22 ,p_associated_column1 in varchar2 default null
23 ) is
24 --
25 -- Declare cursor
26
27 cursor csr_sec_grp is
28 select null --pbg.security_group_id,
29 -- pbg.legislation_code
30 from -- per_business_groups_perf pbg
31 per_ri_setup_sub_tasks ssb
32 -- , EDIT_HERE table_name(s) 333
33 where ssb.setup_sub_task_code = p_setup_sub_task_code;
34 -- and pbg.business_group_id = EDIT_HERE 333.business_group_id;
35 --
36 -- Declare local variables
37 --
38 l_security_group_id number;
39 l_proc varchar2(72) := g_package||'set_security_group_id';
40 l_legislation_code varchar2(150);
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 => 'setup_sub_task_code'
51 ,p_argument_value => p_setup_sub_task_code
52 );
53 --
54 open csr_sec_grp;
55 fetch csr_sec_grp into l_security_group_id ;
56 -- , l_legislation_code;
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,'SETUP_SUB_TASK_CODE')
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 --
79 -- Set the sessions legislation context in HR_SESSION_DATA
80 --
81 hr_api.set_legislation_context(l_legislation_code);
82 end if;
83 --
84 hr_utility.set_location(' Leaving:'|| l_proc, 20);
85 --
86 end set_security_group_id;
87 --
88 -- ---------------------------------------------------------------------------
89 -- |---------------------< return_legislation_code >-------------------------|
90 -- ---------------------------------------------------------------------------
91 --
92 Function return_legislation_code
93 (p_setup_sub_task_code in varchar2
94 )
95 Return Varchar2 Is
96 --
97 -- Declare cursor
98
99 cursor csr_leg_code is
100 select Null -- pbg.legislation_code
101 from -- per_business_groups_perf pbg
102 per_ri_setup_sub_tasks ssb
103 -- , EDIT_HERE table_name(s) 333
104 where ssb.setup_sub_task_code = p_setup_sub_task_code;
105 -- and pbg.business_group_id = EDIT_HERE 333.business_group_id;
106 --
107 -- Declare local variables
108 --
109 l_legislation_code varchar2(150);
110 l_proc varchar2(72) := g_package||'return_legislation_code';
111 --
112 Begin
113 --
114 hr_utility.set_location('Entering:'|| l_proc, 10);
115 --
116 -- Ensure that all the mandatory parameter are not null
117 --
118 hr_api.mandatory_arg_error
119 (p_api_name => l_proc
120 ,p_argument => 'setup_sub_task_code'
121 ,p_argument_value => p_setup_sub_task_code
122 );
123 --
124 if ( nvl(per_ssb_bus.g_setup_sub_task_code, hr_api.g_varchar2)
125 = p_setup_sub_task_code) then
126 --
127 -- The legislation code has already been found with a previous
128 -- call to this function. Just return the value in the global
129 -- variable.
130 --
131 l_legislation_code := per_ssb_bus.g_legislation_code;
132 hr_utility.set_location(l_proc, 20);
133 else
134 --
135 -- The ID is different to the last call to this function
136 -- or this is the first call to this function.
137 --
138 open csr_leg_code;
139 fetch csr_leg_code into l_legislation_code;
140 --
141 if csr_leg_code%notfound then
142 --
143 -- The primary key is invalid therefore we must error
144 --
145 close csr_leg_code;
146 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
147 fnd_message.raise_error;
148 end if;
149 hr_utility.set_location(l_proc,30);
150 --
151 -- Set the global variables so the values are
152 -- available for the next call to this function.
153 --
154 close csr_leg_code;
155 per_ssb_bus.g_setup_sub_task_code := p_setup_sub_task_code;
156 per_ssb_bus.g_legislation_code := l_legislation_code;
157 end if;
158 hr_utility.set_location(' Leaving:'|| l_proc, 40);
159 return l_legislation_code;
160 end return_legislation_code;
161 --
162 -- ----------------------------------------------------------------------------
163 -- |-----------------------< chk_non_updateable_args >------------------------|
164 -- ----------------------------------------------------------------------------
165 -- {Start Of Comments}
166 --
167 -- Description:
168 -- This procedure is used to ensure that non updateable attributes have
169 -- not been updated. If an attribute has been updated an error is generated.
170 --
171 -- Pre Conditions:
172 -- g_old_rec has been populated with details of the values currently in
173 -- the database.
174 --
175 -- In Arguments:
176 -- p_rec has been populated with the updated values the user would like the
177 -- record set to.
178 --
179 -- Post Success:
180 -- Processing continues if all the non updateable attributes have not
181 -- changed.
182 --
183 -- Post Failure:
184 -- An application error is raised if any of the non updatable attributes
185 -- have been altered.
186 --
187 -- {End Of Comments}
188 -- ----------------------------------------------------------------------------
189 Procedure chk_non_updateable_args
190 (p_effective_date in date
191 ,p_rec in per_ssb_shd.g_rec_type
192 ) IS
193 --
194 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
195 --
196 Begin
197 --
198 -- Only proceed with the validation if a row exists for the current
199 -- record in the HR Schema.
200 --
201 IF NOT per_ssb_shd.api_updating
202 (p_setup_sub_task_code => p_rec.setup_sub_task_code
203 ,p_object_version_number => p_rec.object_version_number
204 ) THEN
205 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
206 fnd_message.set_token('PROCEDURE ', l_proc);
207 fnd_message.set_token('STEP ', '5');
208 fnd_message.raise_error;
209 END IF;
210 --
211 -- EDIT_HERE: Add checks to ensure non-updateable args have
212 -- not been updated.
213 --
214 End chk_non_updateable_args;
215 --
216 --
217 -- ---------------------------------------------------------------------------
218 -- |-------------------------< chk_setup_task_type >--------------------------|
219 -- ---------------------------------------------------------------------------
220 --
221 -- Description:
222 -- Validates that the following business rules are met:
223 -- a)Validate against HR_LOOKUPS.lookup_code
224 -- where LOOKUP_TYPE = 'PER_RI_TASK_TYPE' (I,U)
225 --
226 -- Pre-conditions:
227 -- workbench_item_code must have been successfully validated.
228 --
229 -- In Arguments:
230 -- p_workbench_item_code
231 -- p_effective_date
232 -- p_object_version_number
233 -- p_workbench_item_type
234 --
235 -- Post Success:
236 -- If the above business rules are satisfied then processing continues.
237 --
238 -- Post Failure:
239 -- If the above business rules then an application error will be raised and
240 -- processing is terminated.
241 --
242 -- Access Status:
243 -- Internal Table Handler Use Only.
244 --
245 -- {End Of Comments}
246 -- ----------------------------------------------------------------------------
247
248 Procedure chk_setup_sub_task_type(p_setup_sub_task_code Varchar2
249 ,p_effective_date Varchar2
250 ,p_object_version_number Number
251 ,p_setup_sub_task_type Varchar2
252 ) Is
253
254 l_proc varchar2(72) := g_package||'chk_setup_sub_task_type';
255
256 Begin
257 hr_utility.set_location('Entering:'|| l_proc, 1);
258
259 If p_setup_sub_task_type Is Not Null Then
260
261 hr_api.mandatory_arg_error
262 (p_api_name => l_proc
263 ,p_argument => 'EFFECTIVE_DATE'
264 ,p_argument_value => p_effective_date
265 );
266 If hr_api.not_exists_in_hr_lookups
270 ) Then
267 (p_effective_date => p_effective_date
268 ,p_lookup_type => 'PER_RI_SUB_TASK_TYPE'
269 ,p_lookup_code => p_setup_sub_task_type
271 fnd_message.set_name('PER', 'HR_52966_INVALID_LOOKUP');
272 fnd_message.set_token('COLUMN ', p_setup_sub_task_type);
273 fnd_message.set_token('LOOKUP_TYPE ', 'PER_RI_SUB_TASK_TYPE');
274 fnd_message.set_token('STEP ', '5');
275 fnd_message.raise_error;
276 End If;
277
278 End If;
279
280 hr_utility.set_location('Leaving:'|| l_proc, 1);
281
282 End chk_setup_sub_task_type;
283 --
284 -- ----------------------------------------------------------------------------
285 -- |---------------------------< insert_validate >----------------------------|
286 -- ----------------------------------------------------------------------------
287 Procedure insert_validate
288 (p_effective_date in date
289 ,p_rec in per_ssb_shd.g_rec_type
290 ) is
291 --
292 l_proc varchar2(72) := g_package||'insert_validate';
293 --
294 Begin
295 hr_utility.set_location('Entering:'||l_proc, 5);
296 --
297 -- Call all supporting business operations
298 --
299 --
300 -- EDIT_HERE: As this table does not have a mandatory business_group_id
301 -- column, ensure client_info is populated by calling a suitable
302 -- ???_???_bus.set_security_group_id procedure, or add one of the following
303 -- comments:
304 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
305 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
306 --
307 -- Validate Dependent Attributes
308 --
309 chk_setup_sub_task_type(p_setup_sub_task_code => p_rec.setup_sub_task_code
310 ,p_effective_date => p_effective_date
311 ,p_object_version_number => p_rec.object_version_number
312 ,p_setup_sub_task_type => p_rec.setup_sub_task_type
313 ) ;
314 --
315 hr_utility.set_location(' Leaving:'||l_proc, 10);
316 End insert_validate;
317 --
318 -- ----------------------------------------------------------------------------
319 -- |---------------------------< update_validate >----------------------------|
320 -- ----------------------------------------------------------------------------
321 Procedure update_validate
322 (p_effective_date in date
323 ,p_rec in per_ssb_shd.g_rec_type
324 ) is
325 --
326 l_proc varchar2(72) := g_package||'update_validate';
327 --
328 Begin
329 hr_utility.set_location('Entering:'||l_proc, 5);
330 --
331 -- Call all supporting business operations
332 --
333 --
334 -- EDIT_HERE: As this table does not have a mandatory business_group_id
335 -- column, ensure client_info is populated by calling a suitable
336 -- ???_???_bus.set_security_group_id procedure, or add one of the following
337 -- comments:
338 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
339 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
340 --
341 -- Validate Dependent Attributes
342 --
343 chk_non_updateable_args
344 (p_effective_date => p_effective_date
345 ,p_rec => p_rec
346 );
347 --
348 --
349 --
350 chk_setup_sub_task_type(p_setup_sub_task_code => p_rec.setup_sub_task_code
351 ,p_effective_date => p_effective_date
352 ,p_object_version_number => p_rec.object_version_number
353 ,p_setup_sub_task_type => p_rec.setup_sub_task_type
354 ) ;
355
356 --
357 --
358 hr_utility.set_location(' Leaving:'||l_proc, 10);
359 End update_validate;
360 --
361 -- ----------------------------------------------------------------------------
362 -- |---------------------------< delete_validate >----------------------------|
363 -- ----------------------------------------------------------------------------
364 Procedure delete_validate
365 (p_rec in per_ssb_shd.g_rec_type
366 ) is
367 --
368 l_proc varchar2(72) := g_package||'delete_validate';
369 --
370 Begin
371 hr_utility.set_location('Entering:'||l_proc, 5);
372 --
373 -- Call all supporting business operations
374 --
375 hr_utility.set_location(' Leaving:'||l_proc, 10);
376 End delete_validate;
377 --
378 end per_ssb_bus;