[Home] [Help]
PACKAGE BODY: APPS.PSP_ERA_BUS
Source
1 Package Body psp_era_bus as
2 /* $Header: PSPEARHB.pls 120.2 2006/03/26 01:08 dpaudel noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' psp_era_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_effort_report_approval_id number default null;
15 --
16 -- ---------------------------------------------------------------------------
17 -- |----------------------< set_security_group_id >--------------------------|
18 -- ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21 (p_effort_report_approval_id in number
22 ,p_associated_column1 in varchar2 default null
23 ) is
24 --
25 -- Declare cursor
26 --
27 -- EDIT_HERE In the following cursor statement add join(s) between
28 -- psp_eff_report_approvals and PER_BUSINESS_GROUPS_PERF
29 -- so that the security_group_id for
30 -- the current business group context can be derived.
31 -- Remove this comment when the edit has been completed.
32 cursor csr_sec_grp is
33 select pbg.security_group_id,
34 pbg.legislation_code
35 from per_business_groups_perf pbg
36 , psp_eff_report_approvals era
37 , psp_eff_report_details erd
38 , psp_eff_reports per
39 where era.effort_report_approval_id = p_effort_report_approval_id
40 and era.effort_report_detail_id = erd.effort_report_detail_id
41 and erd.effort_report_id = per.effort_report_id
42 and pbg.business_group_id = per.business_group_id ;
43 --
44 -- Declare local variables
45 --
46 l_security_group_id number;
47 l_proc varchar2(72) := g_package||'set_security_group_id';
48 l_legislation_code varchar2(150);
49 --
50 begin
51 --
52 hr_utility.set_location('Entering:'|| l_proc, 10);
53 --
54 -- Ensure that all the mandatory parameter are not null
55 --
56 hr_api.mandatory_arg_error
57 (p_api_name => l_proc
58 ,p_argument => 'effort_report_approval_id'
59 ,p_argument_value => p_effort_report_approval_id
60 );
61 --
62 open csr_sec_grp;
63 fetch csr_sec_grp into l_security_group_id
64 , l_legislation_code;
65 --
66 if csr_sec_grp%notfound then
67 --
68 close csr_sec_grp;
69 --
70 -- The primary key is invalid therefore we must error
71 --
72 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
73 hr_multi_message.add
74 (p_associated_column1
75 => nvl(p_associated_column1,'EFFORT_REPORT_APPROVAL_ID')
76 );
77 --
78 else
79 close csr_sec_grp;
80 --
81 -- Set the security_group_id in CLIENT_INFO
82 --
83 hr_api.set_security_group_id
84 (p_security_group_id => l_security_group_id
85 );
86 --
87 -- Set the sessions legislation context in HR_SESSION_DATA
88 --
89 hr_api.set_legislation_context(l_legislation_code);
90 end if;
91 --
92 hr_utility.set_location(' Leaving:'|| l_proc, 20);
93 --
94 end set_security_group_id;
95 --
96 -- ---------------------------------------------------------------------------
97 -- |---------------------< return_legislation_code >-------------------------|
98 -- ---------------------------------------------------------------------------
99 --
100 Function return_legislation_code
101 (p_effort_report_approval_id in number
102 )
103 Return Varchar2 Is
104 --
105 -- Declare cursor
106 --
107 -- EDIT_HERE In the following cursor statement add join(s) between
108 -- psp_eff_report_approvals and PER_BUSINESS_GROUPS_PERF
109 -- so that the legislation_code for
110 -- the current business group context can be derived.
111 -- Remove this comment when the edit has been completed.
112 cursor csr_leg_code is
113 select pbg.legislation_code
114 from per_business_groups_perf pbg
115 , psp_eff_report_approvals era
116 , psp_eff_report_details erd
117 , psp_eff_reports per
118 where era.effort_report_approval_id = p_effort_report_approval_id
119 and era.effort_report_detail_id = erd.effort_report_detail_id
120 and erd.effort_report_id = per.effort_report_id
121 and pbg.business_group_id = per.business_group_id ;
122 --
123 -- Declare local variables
124 --
125 l_legislation_code varchar2(150);
126 l_proc varchar2(72) := g_package||'return_legislation_code';
127 --
128 Begin
129 --
130 hr_utility.set_location('Entering:'|| l_proc, 10);
131 --
132 -- Ensure that all the mandatory parameter are not null
133 --
134 hr_api.mandatory_arg_error
135 (p_api_name => l_proc
136 ,p_argument => 'effort_report_approval_id'
137 ,p_argument_value => p_effort_report_approval_id
138 );
139 --
140 if ( nvl(psp_era_bus.g_effort_report_approval_id, hr_api.g_number)
141 = p_effort_report_approval_id) then
142 --
143 -- The legislation code has already been found with a previous
144 -- call to this function. Just return the value in the global
145 -- variable.
146 --
147 l_legislation_code := psp_era_bus.g_legislation_code;
148 hr_utility.set_location(l_proc, 20);
149 else
150 --
151 -- The ID is different to the last call to this function
152 -- or this is the first call to this function.
153 --
154 open csr_leg_code;
155 fetch csr_leg_code into l_legislation_code;
156 --
157 if csr_leg_code%notfound then
158 --
159 -- The primary key is invalid therefore we must error
160 --
161 close csr_leg_code;
162 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
163 fnd_message.raise_error;
164 end if;
165 hr_utility.set_location(l_proc,30);
166 --
167 -- Set the global variables so the values are
168 -- available for the next call to this function.
169 --
170 close csr_leg_code;
171 psp_era_bus.g_effort_report_approval_id := p_effort_report_approval_id;
172 psp_era_bus.g_legislation_code := l_legislation_code;
173 end if;
174 hr_utility.set_location(' Leaving:'|| l_proc, 40);
175 return l_legislation_code;
176 end return_legislation_code;
177 --
178 -- ----------------------------------------------------------------------------
179 -- |-----------------------------< chk_ddf >----------------------------------|
180 -- ----------------------------------------------------------------------------
181 --
182 -- Description:
183 -- Validates all the Developer Descriptive Flexfield values.
184 --
185 -- Prerequisites:
186 -- All other columns have been validated. Must be called as the
187 -- last step from insert_validate and update_validate.
188 --
189 -- In Arguments:
190 -- p_rec
191 --
192 -- Post Success:
193 -- If the Developer Descriptive Flexfield structure column and data values
194 -- are all valid this procedure will end normally and processing will
195 -- continue.
196 --
197 -- Post Failure:
198 -- If the Developer Descriptive Flexfield structure column value or any of
199 -- the data values are invalid then an application error is raised as
200 -- a PL/SQL exception.
201 --
202 -- Access Status:
203 -- Internal Row Handler Use Only.
204 --
205 -- ----------------------------------------------------------------------------
206 procedure chk_ddf
207 (p_rec in psp_era_shd.g_rec_type
208 ) is
209 --
210 l_proc varchar2(72) := g_package || 'chk_ddf';
211 --
212 begin
213 hr_utility.set_location('Entering:'||l_proc,10);
214 --
215 if ((p_rec.effort_report_approval_id is not null) and (
216 nvl(psp_era_shd.g_old_rec.pera_information_category, hr_api.g_varchar2) <>
217 nvl(p_rec.pera_information_category, hr_api.g_varchar2) or
218 nvl(psp_era_shd.g_old_rec.pera_information1, hr_api.g_varchar2) <>
219 nvl(p_rec.pera_information1, hr_api.g_varchar2) or
220 nvl(psp_era_shd.g_old_rec.pera_information2, hr_api.g_varchar2) <>
221 nvl(p_rec.pera_information2, hr_api.g_varchar2) or
222 nvl(psp_era_shd.g_old_rec.pera_information3, hr_api.g_varchar2) <>
223 nvl(p_rec.pera_information3, hr_api.g_varchar2) or
224 nvl(psp_era_shd.g_old_rec.pera_information4, hr_api.g_varchar2) <>
225 nvl(p_rec.pera_information4, hr_api.g_varchar2) or
226 nvl(psp_era_shd.g_old_rec.pera_information5, hr_api.g_varchar2) <>
227 nvl(p_rec.pera_information5, hr_api.g_varchar2) or
228 nvl(psp_era_shd.g_old_rec.pera_information6, hr_api.g_varchar2) <>
229 nvl(p_rec.pera_information6, hr_api.g_varchar2) or
230 nvl(psp_era_shd.g_old_rec.pera_information7, hr_api.g_varchar2) <>
231 nvl(p_rec.pera_information7, hr_api.g_varchar2) or
232 nvl(psp_era_shd.g_old_rec.pera_information8, hr_api.g_varchar2) <>
233 nvl(p_rec.pera_information8, hr_api.g_varchar2) or
234 nvl(psp_era_shd.g_old_rec.pera_information9, hr_api.g_varchar2) <>
235 nvl(p_rec.pera_information9, hr_api.g_varchar2) or
236 nvl(psp_era_shd.g_old_rec.pera_information10, hr_api.g_varchar2) <>
237 nvl(p_rec.pera_information10, hr_api.g_varchar2) or
238 nvl(psp_era_shd.g_old_rec.pera_information11, hr_api.g_varchar2) <>
239 nvl(p_rec.pera_information11, hr_api.g_varchar2) or
240 nvl(psp_era_shd.g_old_rec.pera_information12, hr_api.g_varchar2) <>
241 nvl(p_rec.pera_information12, hr_api.g_varchar2) or
242 nvl(psp_era_shd.g_old_rec.pera_information13, hr_api.g_varchar2) <>
243 nvl(p_rec.pera_information13, hr_api.g_varchar2) or
244 nvl(psp_era_shd.g_old_rec.pera_information14, hr_api.g_varchar2) <>
245 nvl(p_rec.pera_information14, hr_api.g_varchar2) or
246 nvl(psp_era_shd.g_old_rec.pera_information15, hr_api.g_varchar2) <>
247 nvl(p_rec.pera_information15, hr_api.g_varchar2) or
248 nvl(psp_era_shd.g_old_rec.pera_information16, hr_api.g_varchar2) <>
249 nvl(p_rec.pera_information16, hr_api.g_varchar2) or
250 nvl(psp_era_shd.g_old_rec.pera_information17, hr_api.g_varchar2) <>
251 nvl(p_rec.pera_information17, hr_api.g_varchar2) or
252 nvl(psp_era_shd.g_old_rec.pera_information18, hr_api.g_varchar2) <>
253 nvl(p_rec.pera_information18, hr_api.g_varchar2) or
254 nvl(psp_era_shd.g_old_rec.pera_information19, hr_api.g_varchar2) <>
255 nvl(p_rec.pera_information19, hr_api.g_varchar2) or
256 nvl(psp_era_shd.g_old_rec.pera_information20, hr_api.g_varchar2) <>
257 nvl(p_rec.pera_information20, hr_api.g_varchar2)))
258 or (p_rec.effort_report_approval_id is null) then
259 --
260 -- Only execute the validation if absolutely necessary:
261 -- a) During update, the structure column value or any
262 -- of the attribute values have actually changed.
263 -- b) During insert.
264 --
265 hr_dflex_utility.ins_or_upd_descflex_attribs
266 (p_appl_short_name => 'PSP'
267 ,p_descflex_name => 'Effort Approval DF'
268 ,p_attribute_category => p_rec.pera_information_category
269 ,p_attribute1_name => 'PERA_INFORMATION1'
270 ,p_attribute1_value => p_rec.pera_information1
271 ,p_attribute2_name => 'PERA_INFORMATION2'
272 ,p_attribute2_value => p_rec.pera_information2
273 ,p_attribute3_name => 'PERA_INFORMATION3'
274 ,p_attribute3_value => p_rec.pera_information3
275 ,p_attribute4_name => 'PERA_INFORMATION4'
276 ,p_attribute4_value => p_rec.pera_information4
277 ,p_attribute5_name => 'PERA_INFORMATION5'
278 ,p_attribute5_value => p_rec.pera_information5
279 ,p_attribute6_name => 'PERA_INFORMATION6'
280 ,p_attribute6_value => p_rec.pera_information6
281 ,p_attribute7_name => 'PERA_INFORMATION7'
282 ,p_attribute7_value => p_rec.pera_information7
283 ,p_attribute8_name => 'PERA_INFORMATION8'
284 ,p_attribute8_value => p_rec.pera_information8
285 ,p_attribute9_name => 'PERA_INFORMATION9'
286 ,p_attribute9_value => p_rec.pera_information9
290 ,p_attribute11_value => p_rec.pera_information11
287 ,p_attribute10_name => 'PERA_INFORMATION10'
288 ,p_attribute10_value => p_rec.pera_information10
289 ,p_attribute11_name => 'PERA_INFORMATION11'
291 ,p_attribute12_name => 'PERA_INFORMATION12'
292 ,p_attribute12_value => p_rec.pera_information12
293 ,p_attribute13_name => 'PERA_INFORMATION13'
294 ,p_attribute13_value => p_rec.pera_information13
295 ,p_attribute14_name => 'PERA_INFORMATION14'
296 ,p_attribute14_value => p_rec.pera_information14
297 ,p_attribute15_name => 'PERA_INFORMATION15'
298 ,p_attribute15_value => p_rec.pera_information15
299 ,p_attribute16_name => 'PERA_INFORMATION16'
300 ,p_attribute16_value => p_rec.pera_information16
301 ,p_attribute17_name => 'PERA_INFORMATION17'
302 ,p_attribute17_value => p_rec.pera_information17
303 ,p_attribute18_name => 'PERA_INFORMATION18'
304 ,p_attribute18_value => p_rec.pera_information18
305 ,p_attribute19_name => 'PERA_INFORMATION19'
306 ,p_attribute19_value => p_rec.pera_information19
307 ,p_attribute20_name => 'PERA_INFORMATION20'
308 ,p_attribute20_value => p_rec.pera_information20
309 );
310 end if;
311
312 if ((p_rec.effort_report_approval_id is not null) and (
313 nvl(psp_era_shd.g_old_rec.eff_information_category, hr_api.g_varchar2) <>
314 nvl(p_rec.eff_information_category, hr_api.g_varchar2) or
315 nvl(psp_era_shd.g_old_rec.eff_information1, hr_api.g_varchar2) <>
316 nvl(p_rec.eff_information1, hr_api.g_varchar2) or
317 nvl(psp_era_shd.g_old_rec.eff_information2, hr_api.g_varchar2) <>
318 nvl(p_rec.eff_information2, hr_api.g_varchar2) or
319 nvl(psp_era_shd.g_old_rec.eff_information3, hr_api.g_varchar2) <>
320 nvl(p_rec.eff_information3, hr_api.g_varchar2) or
321 nvl(psp_era_shd.g_old_rec.eff_information4, hr_api.g_varchar2) <>
322 nvl(p_rec.eff_information4, hr_api.g_varchar2) or
323 nvl(psp_era_shd.g_old_rec.eff_information5, hr_api.g_varchar2) <>
324 nvl(p_rec.eff_information5, hr_api.g_varchar2) or
325 nvl(psp_era_shd.g_old_rec.eff_information6, hr_api.g_varchar2) <>
326 nvl(p_rec.eff_information6, hr_api.g_varchar2) or
327 nvl(psp_era_shd.g_old_rec.eff_information7, hr_api.g_varchar2) <>
328 nvl(p_rec.eff_information7, hr_api.g_varchar2) or
329 nvl(psp_era_shd.g_old_rec.eff_information8, hr_api.g_varchar2) <>
330 nvl(p_rec.eff_information8, hr_api.g_varchar2) or
331 nvl(psp_era_shd.g_old_rec.eff_information9, hr_api.g_varchar2) <>
332 nvl(p_rec.eff_information9, hr_api.g_varchar2) or
333 nvl(psp_era_shd.g_old_rec.eff_information10, hr_api.g_varchar2) <>
334 nvl(p_rec.eff_information10, hr_api.g_varchar2) or
335 nvl(psp_era_shd.g_old_rec.eff_information11, hr_api.g_varchar2) <>
336 nvl(p_rec.eff_information11, hr_api.g_varchar2) or
337 nvl(psp_era_shd.g_old_rec.eff_information12, hr_api.g_varchar2) <>
338 nvl(p_rec.eff_information12, hr_api.g_varchar2) or
339 nvl(psp_era_shd.g_old_rec.eff_information13, hr_api.g_varchar2) <>
340 nvl(p_rec.eff_information13, hr_api.g_varchar2) or
341 nvl(psp_era_shd.g_old_rec.eff_information14, hr_api.g_varchar2) <>
342 nvl(p_rec.eff_information14, hr_api.g_varchar2) or
343 nvl(psp_era_shd.g_old_rec.eff_information15, hr_api.g_varchar2) <>
344 nvl(p_rec.eff_information15, hr_api.g_varchar2 )))
345 or (p_rec.effort_report_approval_id is null) then
346 --
347 -- Only execute the validation if absolutely necessary:
348 -- a) During update, the structure column value or any
349 -- of the attribute values have actually changed.
350 -- b) During insert.
351 --
352 hr_dflex_utility.ins_or_upd_descflex_attribs
353 (p_appl_short_name => 'PSP'
354 ,p_descflex_name => 'Effort Report DF'
355 ,p_attribute_category => p_rec.eff_information_category
356 ,p_attribute1_name => 'EFF_INFORMATION1'
357 ,p_attribute1_value => p_rec.eff_information1
358 ,p_attribute2_name => 'EFF_INFORMATION2'
359 ,p_attribute2_value => p_rec.eff_information2
360 ,p_attribute3_name => 'EFF_INFORMATION3'
361 ,p_attribute3_value => p_rec.eff_information3
362 ,p_attribute4_name => 'EFF_INFORMATION4'
363 ,p_attribute4_value => p_rec.eff_information4
364 ,p_attribute5_name => 'EFF_INFORMATION5'
365 ,p_attribute5_value => p_rec.eff_information5
366 ,p_attribute6_name => 'EFF_INFORMATION6'
367 ,p_attribute6_value => p_rec.eff_information6
368 ,p_attribute7_name => 'EFF_INFORMATION7'
369 ,p_attribute7_value => p_rec.eff_information7
370 ,p_attribute8_name => 'EFF_INFORMATION8'
371 ,p_attribute8_value => p_rec.eff_information8
372 ,p_attribute9_name => 'EFF_INFORMATION9'
373 ,p_attribute9_value => p_rec.eff_information9
374 ,p_attribute10_name => 'EFF_INFORMATION10'
375 ,p_attribute10_value => p_rec.eff_information10
376 ,p_attribute11_name => 'EFF_INFORMATION11'
377 ,p_attribute11_value => p_rec.eff_information11
378 ,p_attribute12_name => 'EFF_INFORMATION12'
379 ,p_attribute12_value => p_rec.eff_information12
380 ,p_attribute13_name => 'EFF_INFORMATION13'
381 ,p_attribute13_value => p_rec.eff_information13
382 ,p_attribute14_name => 'EFF_INFORMATION14'
386 );
383 ,p_attribute14_value => p_rec.eff_information14
384 ,p_attribute15_name => 'EFF_INFORMATION15'
385 ,p_attribute15_value => p_rec.eff_information15
387 end if;
388
389 --
390 hr_utility.set_location(' Leaving:'||l_proc,20);
391 end chk_ddf;
392 --
393 -- ----------------------------------------------------------------------------
394 -- |-----------------------< chk_non_updateable_args >------------------------|
395 -- ----------------------------------------------------------------------------
396 -- {Start Of Comments}
397 --
398 -- Description:
399 -- This procedure is used to ensure that non updateable attributes have
400 -- not been updated. If an attribute has been updated an error is generated.
401 --
402 -- Pre Conditions:
403 -- g_old_rec has been populated with details of the values currently in
404 -- the database.
405 --
406 -- In Arguments:
407 -- p_rec has been populated with the updated values the user would like the
408 -- record set to.
409 --
410 -- Post Success:
411 -- Processing continues if all the non updateable attributes have not
412 -- changed.
413 --
414 -- Post Failure:
415 -- An application error is raised if any of the non updatable attributes
416 -- have been altered.
417 --
418 -- {End Of Comments}
419 -- ----------------------------------------------------------------------------
420 Procedure chk_non_updateable_args
421 (p_rec in psp_era_shd.g_rec_type
422 ) IS
423 --
424 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
425 --
426 Begin
427 --
428 -- Only proceed with the validation if a row exists for the current
429 -- record in the HR Schema.
430 --
431 IF NOT psp_era_shd.api_updating
432 (p_effort_report_approval_id => p_rec.effort_report_approval_id
433 ,p_object_version_number => p_rec.object_version_number
434 ) THEN
435 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
436 fnd_message.set_token('PROCEDURE ', l_proc);
437 fnd_message.set_token('STEP ', '5');
438 fnd_message.raise_error;
439 END IF;
440 --
441 -- EDIT_HERE: Add checks to ensure non-updateable args have
442 -- not been updated.
443 --
444 End chk_non_updateable_args;
445 --
446 -- ----------------------------------------------------------------------------
447 -- |---------------------------< insert_validate >----------------------------|
448 -- ----------------------------------------------------------------------------
449 Procedure insert_validate
450 (p_rec in psp_era_shd.g_rec_type
451 ) is
452 --
453 l_proc varchar2(72) := g_package||'insert_validate';
454 --
455 Begin
456 hr_utility.set_location('Entering:'||l_proc, 5);
457 --
458 -- Call all supporting business operations
459 --
460 --
461 -- EDIT_HERE: As this table does not have a mandatory business_group_id
462 -- column, ensure client_info is populated by calling a suitable
463 -- ???_???_bus.set_security_group_id procedure, or add one of the following
464 -- comments:
465 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
466 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
467 --
468 -- Validate Dependent Attributes
469 --
470 --
471 psp_era_bus.chk_ddf(p_rec);
472 --
473 hr_utility.set_location(' Leaving:'||l_proc, 10);
474 End insert_validate;
475 --
476 -- ----------------------------------------------------------------------------
477 -- |---------------------------< update_validate >----------------------------|
478 -- ----------------------------------------------------------------------------
479 Procedure update_validate
480 (p_rec in psp_era_shd.g_rec_type
481 ) is
482 --
483 l_proc varchar2(72) := g_package||'update_validate';
484 --
485 Begin
486 hr_utility.set_location('Entering:'||l_proc, 5);
487 --
488 -- Call all supporting business operations
489 --
490 --
491 -- EDIT_HERE: As this table does not have a mandatory business_group_id
492 -- column, ensure client_info is populated by calling a suitable
493 -- ???_???_bus.set_security_group_id procedure, or add one of the following
494 -- comments:
495 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
496 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
497 --
498 -- Validate Dependent Attributes
499 --
500 chk_non_updateable_args
501 (p_rec => p_rec
502 );
503 --
504 --
505 psp_era_bus.chk_ddf(p_rec);
506 --
507 hr_utility.set_location(' Leaving:'||l_proc, 10);
508 End update_validate;
509 --
510 -- ----------------------------------------------------------------------------
511 -- |---------------------------< delete_validate >----------------------------|
512 -- ----------------------------------------------------------------------------
513 Procedure delete_validate
514 (p_rec in psp_era_shd.g_rec_type
515 ) is
516 --
517 l_proc varchar2(72) := g_package||'delete_validate';
518 --
519 Begin
520 hr_utility.set_location('Entering:'||l_proc, 5);
521 --
522 -- Call all supporting business operations
523 --
524 hr_utility.set_location(' Leaving:'||l_proc, 10);
525 End delete_validate;
526 --
527 end psp_era_bus;