[Home] [Help]
PACKAGE BODY: APPS.PER_PEA_BUS
Source
1 Package Body per_pea_bus as
2 /* $Header: pepearhi.pkb 120.0.12010000.1 2008/07/28 05:10:27 appldev ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 --
9 g_package varchar2(33) := ' per_pea_bus.'; -- Global package name
10 --
11 -- ----------------------------------------------------------------------------
12 -- |--------------------< chk_person_id >-------------------------------------|
13 -- ----------------------------------------------------------------------------
14 --
15 -- Desciption :
16 --
17 -- Validates that PERSON_ID is not null
18 --
19 -- Validates that values enterd for this column exist in the PER_PEOPLE_F
20 -- table.
21 --
22 -- Validates that BUSINESS_GROUP_ID in the PER_PERSON_ANALYSES table matches
23 -- BUSINESS_GROUP_ID in the PER_PEOPLE_F table for the record specified by
24 -- PERSON_ID.
25 --
26 -- Pre-conditions:
27 --
28 -- In Arguments :
29 -- p_person_id
30 -- p_business_group_id
31 -- p_effective_date
32 --
33 -- Post Success :
34 -- If the above business rules are satisfied, processing continues
35 --
36 -- Post Failure :
37 -- If the above business rules are violated, an application error
38 -- is raised and processing terminates
39 --
40 -- Access Status :
41 -- Internal Table Handler Use only.
42 --
43 -- {End of Comments}
44 --
45 -- -----------------------------------------------------------------------
46 Procedure chk_person_id
47 (p_person_id in per_person_analyses.person_id%TYPE
48 ,p_business_group_id in per_person_analyses.business_group_id%TYPE
49 ,p_effective_date in date) is
50 --
51 l_proc varchar2(72) := g_package||'chk_person_id';
52 l_business_group_id per_person_analyses.business_group_id%TYPE;
53 --
54 --
55 -- Cursor to check that PERSON_ID exists, in addition obtain
56 -- the BUSINESS_GROUP_ID for the other validation checks
57 --
58 cursor csr_valid_person_id is
59 select per.business_group_id
60 from per_people_f per
61 where per.person_id = p_person_id
62 and p_effective_date between per.effective_start_date
63 and per.effective_end_date;
64 --
65 begin
66 hr_utility.set_location('Entering:'||l_proc,5);
67 --
68 -- Perform PERSON_ID mandatory check
69 --
70 hr_api.mandatory_arg_error
71 (p_api_name => l_proc
72 ,p_argument => 'person_id'
73 ,p_argument_value => p_person_id
74 );
75 --
76 hr_api.mandatory_arg_error
77 (p_api_name => l_proc
78 ,p_argument => 'effective date'
79 ,p_argument_value => p_effective_date
80 );
81 --
82 hr_utility.set_location(l_proc,10);
83 --
84 -- Check for valid PERSON_ID
85 --
86 open csr_valid_person_id;
87 fetch csr_valid_person_id
88 into l_business_group_id;
89 if (csr_valid_person_id%notfound) then
90 --
91 close csr_valid_person_id;
92 --
93 hr_utility.set_message(800,'PER_52092_PEA_INV_PERSON_ID');
94 hr_utility.raise_error;
95 end if;
96 --
97 close csr_valid_person_id;
98 --
99 hr_utility.set_location(l_proc,15);
100 --
101 -- Check BUSINESS_GROUP_ID is in the same business group as the person
102 --
103 if (p_business_group_id <> l_business_group_id) then
104 hr_utility.set_message(800,'PER_52090_PEA_INV_PERSON_COMB');
105 hr_utility.raise_error;
106 end if;
107 --
108 hr_utility.set_location('Leaving:'|| l_proc, 20);
109 exception
110 when app_exception.application_exception then
111 if hr_multi_message.exception_add
112 (p_associated_column1 => 'PER_PERSON_ANALYSES.PERSON_ID'
113 ) then
114 hr_utility.set_location('Leaving:'||l_proc, 30);
115 raise;
116 end if;
117 hr_utility.set_location('Leaving:'||l_proc,40);
118 end chk_person_id;
119 --
120 -- ----------------------------------------------------------------------------
121 -- |--------------------< chk_id_flex_num >-----------------------------------|
122 -- ----------------------------------------------------------------------------
123 --
124 -- Desciption :
125 --
126 -- Validates that ID_FLEX_NUM is not null
127 --
128 -- Pre-conditions:
129 --
130 -- In Arguments :
131 --
132 -- p_id_flex_num
133 --
134 -- Post Success :
135 -- If the above business rules are satisfied, processing continues
136 --
137 -- Post Failure :
138 -- If the above business rules are violated, an application error
139 -- is raised and processing terminates
140 --
141 -- Access Status :
142 -- Internal Table Handler Use only.
143 --
144 -- {End of Comments}
145 --
146 -- -----------------------------------------------------------------------
147 Procedure chk_id_flex_num
148 (p_id_flex_num in per_person_analyses.id_flex_num%TYPE
149 ) is
150 --
151 l_proc varchar2(72) := g_package||'chk_id_flex_num';
152 --
153 begin
154 hr_utility.set_location('Entering:'||l_proc,5);
155 --
156 -- Perform id_flex_num mandatory check
157 --
158 hr_api.mandatory_arg_error
159 (p_api_name => l_proc
160 ,p_argument => 'id_flex_num'
161 ,p_argument_value => p_id_flex_num
162 );
163 --
164 hr_utility.set_location('Leaving:'||l_proc, 10);
165 end chk_id_flex_num;
166 --
167 -- ----------------------------------------------------------------------------
168 -- |-----------------------< chk_analysis_criteria_id >-----------------------|
169 -- ----------------------------------------------------------------------------
170 --
171 -- Desciption :
172 --
173 -- Validates that ANALYSIS_CRITERIA_ID is not null
174 --
175 -- Validates that ID_FLEX_NUM in the PER_PERSON_ANALYSES table matches the
176 -- ID_FLEX_NUM in the PER_ANALYSIS_CRITERIA table for the record specified by
177 -- ANALYSIS_CRITERIA_ID.
178 --
179 -- Pre-conditions:
180 -- ID_FLEX_NUM is not null.
181 --
182 -- In Arguments :
183 -- p_analysis_criteria_id
184 -- p_id_flex_num
185 -- p_person_analysis_id
186 -- p_object_version_number
187 --
188 -- Post Success :
189 -- If the above business rules are satisfied, processing continues
190 --
191 -- Post Failure :
192 -- If the above business rules are violated, an application error
193 -- is raised and processing terminates
194 --
195 -- Access Status :
196 -- Internal Table Handler Use only.
197 --
198 -- {End of Comments}
199 --
200 -- -----------------------------------------------------------------------
201 Procedure chk_analysis_criteria_id
202 (p_analysis_criteria_id in per_person_analyses.analysis_criteria_id%TYPE
203 ,p_id_flex_num in per_person_analyses.id_flex_num%TYPE
204 ,p_person_analysis_id in per_person_analyses.person_analysis_id%TYPE
205 ,p_object_version_number in per_person_analyses.object_version_number%TYPE
206 ) is
207 --
208 l_proc varchar2(72) := g_package||'chk_analysis_criteria_id';
209 l_id_flex_num per_person_analyses.id_flex_num%TYPE;
210 l_api_updating boolean;
211 --
212 --
213 -- Cursor to check that ANALYSIS_CRITERIA_ID exists, in addition obtain
214 -- the ID_FLEX_NUM for the other validation checks
215 --
216 cursor csr_valid_analysis_criteria_id is
217 select pac.id_flex_num
218 from per_analysis_criteria pac
219 where pac.analysis_criteria_id = p_analysis_criteria_id;
220 --
221 begin
222 hr_utility.set_location('Entering:'||l_proc,5);
223 --
224 -- Perform ANALYSIS_CRITERIA_ID mandatory check
225 --
226 hr_api.mandatory_arg_error
227 (p_api_name => l_proc
228 ,p_argument => 'analysis_criteria_id'
229 ,p_argument_value => p_analysis_criteria_id
230 );
231 --
232 hr_utility.set_location(l_proc,10);
233 --
234 l_api_updating := per_pea_shd.api_updating
235 (p_person_analysis_id => p_person_analysis_id
236 ,p_object_version_number => p_object_version_number);
237 --
238 -- Check for valid analysis criteria id
239 --
240 if ((l_api_updating
241 and
242 (per_pea_shd.g_old_rec.analysis_criteria_id <> p_analysis_criteria_id)
243 or
244 (per_pea_shd.g_old_rec.id_flex_num <> p_id_flex_num))
245 or
246 (NOT l_api_updating)) then
247 --
248 hr_utility.set_location(l_proc,15);
249 --
250 open csr_valid_analysis_criteria_id;
251 fetch csr_valid_analysis_criteria_id
252 into l_id_flex_num;
253 --
254 if (csr_valid_analysis_criteria_id%notfound) then
255 close csr_valid_analysis_criteria_id;
256 --
257 hr_utility.set_message(801,'HR_51603_PEA_INV_ANA_CRI_ID');
258 hr_multi_message.add
259 (p_associated_column1 => 'PER_PERSON_ANALYSES.ANALYSIS_CRITERIA_ID'
260 );
261 else
262 close csr_valid_analysis_criteria_id;
263 --
264 hr_utility.set_location(l_proc,20);
265 --
266 -- Check ID_FLEX_NUM is in the same ID_FLEX_NUM as the ANALYSIS_CRITERIA_ID
267 --
268 if (p_id_flex_num <> l_id_flex_num) then
269 hr_utility.set_message(800,'PER_52093_PEA_INV_FLEX_ANA_COM');
270 hr_multi_message.add
271 (p_associated_column1 => 'PER_PERSON_ANALYSES.ANALYSIS_CRITERIA_ID'
272 ,p_associated_column2 => 'PER_PERSON_ANALYSES.ID_FLEX_NUM'
273 );
274 end if;
275 --
276 end if;
277 end if;
278 --
279 hr_utility.set_location('Leaving '||l_proc,25);
280 end chk_analysis_criteria_id;
281 --
282 -- ---------------------------------------------------------------------------
283 -- |------------------< check_for_duplicates >-----------------------------|
284 -- ---------------------------------------------------------------------------
285 --
286 -- Desciption :
287 --
288 -- Looks for duplicate person analyses records for the current person
289 -- on the same start and end dates
290 --
291 -- Pre-conditions:
292 --
293 --
294 -- In Arguments :
295 -- p_bg_id
296 -- p_id_flex_num
297 -- p_analysis_criteria_id
298 -- p_date_from
299 -- p_date_to
300 -- p_person_id
301 -- p_person_analysis_id
302 --
303 -- Post Success :
304 -- If the above business rules are satisfied, processing continues
305 --
306 -- Post Failure :
307 -- If the above business rules are violated, an application error
308 -- is raised and processing terminates
309 --
310 -- Access Status :
311 -- Internal Table Handler Use only.
312 --
313 -- {End of Comments}
314 --
315 -- ---------------------------------------------------------------------------
316 --
317 procedure check_for_duplicates
318 (p_bg_id in per_person_analyses.business_group_id%TYPE
319 ,p_id_flex_num in per_person_analyses.id_flex_num%TYPE
320 ,p_analysis_criteria_id in per_person_analyses.analysis_criteria_id%TYPE
321 ,p_date_from in per_person_analyses.date_from%TYPE
322 ,p_date_to in per_person_analyses.date_to%TYPE
323 ,p_person_id in per_person_analyses.person_id%TYPE
324 ,p_person_analysis_id in per_person_analyses.person_analysis_id%TYPE
325 ) is
326 --
327 cursor c is
328 select 'x'
329 from per_person_analyses pa
330 ,per_analysis_criteria ac
331 where pa.analysis_criteria_id = p_analysis_criteria_id
332 and pa.business_group_id + 0 = p_bg_id
333 and pa.analysis_criteria_id = ac.analysis_criteria_id
334 and ac.id_flex_num = p_id_flex_num
335 and nvl(pa.date_to,hr_api.g_eot) =
336 nvl(p_date_to,hr_api.g_eot)
337 and pa.date_from = p_date_from
338 and pa.person_id = p_person_id
339 and (p_person_analysis_id is null
340 or (p_person_analysis_id is not null
341 and pa.person_analysis_id <> p_person_analysis_id));
342 --
343 l_exists varchar2(1);
344 l_proc varchar2(72) := g_package||'check_for_duplicates';
345 --
346 begin
347 hr_utility.set_location('Entering:'||l_proc,5);
348 --
349 -- Only proceed with validation when multiple message list does not already
350 -- contain an error associated with ANALYSIS_CRITERIA_ID,DATE_FROM, DATE_TO
351 -- PERSON_ID columns.
352 --
353 if hr_multi_message.no_exclusive_error
354 (p_check_column1 => 'PER_PERSON_ANALYSES.ANALYSIS_CRITERIA_ID'
355 ,p_check_column2 => 'PER_PERSON_ANALYSES.DATE_FROM'
356 ,p_check_column3 => 'PER_PERSON_ANALYSES.DATE_TO'
357 ,p_check_column4 => 'PER_PERSON_ANALYSES.PERSON_ID'
358 ,p_associated_column1 => 'PER_PERSON_ANALYSES.ANALYSIS_CRITERIA_ID'
359 ,p_associated_column2 => 'PER_PERSON_ANALYSES.DATE_FROM'
360 ,p_associated_column3 => 'PER_PERSON_ANALYSES.DATE_TO'
361 ,p_associated_column4 => 'PER_PERSON_ANALYSES.PERSON_ID'
362 ) then
363 --
364 -- Perform ANALYSIS_CRITERIA_ID mandatory check
365 --
366 hr_api.mandatory_arg_error
367 (p_api_name => l_proc
368 ,p_argument => 'analysis_criteria_id'
369 ,p_argument_value => p_analysis_criteria_id
370 );
371 --
372 hr_utility.set_location(l_proc,10);
373 --
374 open c;
375 fetch c into l_exists;
376 if c%found then
377 close c;
378 hr_utility.set_message(801,'HR_6012_ROW_INSERTED');
379 hr_utility.raise_error;
380 end if;
381 close c;
382 end if;
383 hr_utility.set_location('Leaving '||l_proc,15);
384 exception
385 --
386 -- When multiple error detection is enabled handle the application errors
387 -- which have been raised by this procedure.
388 --
389 when app_exception.application_exception then
390 if hr_multi_message.exception_add
391 (p_same_associated_columns => 'Y'
392 ) then
393 hr_utility.set_location('Leaving:'||l_proc, 30);
394 raise;
395 end if;
396 hr_utility.set_location('Leaving:'||l_proc,40);
397 end check_for_duplicates;
398 --
399 --
400 -- ---------------------------------------------------------------------------
401 -- |---------------------------< chk_date_from_to>---------------------------|
402 -- ---------------------------------------------------------------------------
403 --
404 -- Desciption :
405 --
406 --
407 -- Validates that DATE_FROM is less than or equal to the value for
408 -- DATE_TO on the same person_analysis record
409 --
410 -- Validates that if DATE_TO has values,DATE_FROM must be not null.
411 --
412 -- Pre-conditions:
413 --
414 --
415 -- In Arguments :
416 -- p_person_analysis_id
417 -- p_date_from
418 -- p_date_to
419 -- p_object_version_number
420 --
421 -- Post Success :
422 -- If the above business rules are satisfied, processing continues
423 --
424 -- Post Failure :
425 -- If the above business rules are violated, an application error
426 -- is raised and processing terminates
427 --
428 -- Access Status :
429 -- Internal Table Handler Use only.
430 --
431 -- {End of Comments}
432 --
433 -- ---------------------------------------------------------------------------
434 procedure chk_date_from_to
435 (p_person_analysis_id in number default null
436 ,p_date_from in date
437 ,p_date_to in date
438 ,p_object_version_number in number default null) is
439 --
440 l_proc varchar2(72) := g_package||'chk_date_from_to';
441 l_api_updating boolean;
442 --
443 begin
444 hr_utility.set_location('Entering:'||l_proc, 5);
445 --
446 -- Only proceed with validation if :
447 -- a) The current g_old_rec is current and
448 -- b) The DATE_TO value has changed
449 --
450 l_api_updating := per_pea_shd.api_updating
451 (p_person_analysis_id => p_person_analysis_id
452 ,p_object_version_number => p_object_version_number);
453 --
454 if (((l_api_updating
455 and
456 (nvl(per_pea_shd.g_old_rec.date_from,hr_api.g_eot) <>nvl(p_date_from,hr_api.g_eot))
457 or
458 (nvl(per_pea_shd.g_old_rec.date_to,hr_api.g_eot) <> nvl(p_date_to,hr_api.g_eot)))
459 or
460 (NOT l_api_updating))) then
461 --
462 -- Check DATE_FROM.If the DATE_TO has value,DATE_FROM is not null.
463 --
464 hr_utility.set_location(l_proc,10);
465 --
466 if p_date_to is not null and p_date_from is null then
467 --
468 hr_utility.set_message(800,'PER_52095_PEA_INV_DATE_FROM');
469 hr_multi_message.add
470 (p_associated_column1 => 'PER_PERSON_ANALYSES.DATE_FROM'
471 ,p_associated_column2 => 'PER_PERSON_ANALYSES.DATE_TO'
472 );
473 --
474 elsif p_date_from is not null then
475 --
476 -- Check that DATE_FROM <= DATE_TO
477 --
478 hr_utility.set_location(l_proc,15);
479 --
480 if p_date_from > nvl(p_date_to,hr_api.g_eot) then
481 --
482 hr_utility.set_message(800,'PER_52094_PEA_INV_DATE_COMB');
483 hr_multi_message.add
484 (p_associated_column1 => 'PER_PERSON_ANALYSES.DATE_FROM'
485 ,p_associated_column2 => 'PER_PERSON_ANALYSES.DATE_TO'
486 );
487 --
488 end if;
489 end if;
490 --
491 end if;
492 --
493 hr_utility.set_location(' Leaving:'||l_proc,20);
494 --
495 end chk_date_from_to;
496 --
497 -- ----------------------------------------------------------------------------
498 -- |--------------------< check_non_updateable_args >-------------------------|
499 -- ----------------------------------------------------------------------------
500 Procedure check_non_updateable_args(p_rec in per_pea_shd.g_rec_type)
501 is
502 --
503 l_proc varchar2(72) := g_package||'check_non_updateable_args';
504 --
505 Begin
506 hr_utility.set_location('Entering:'||l_proc, 5);
507 --
508 -- Only proceed with validation if a row exists for
509 -- the current record in the HR Schema
510 --
511 if not per_pea_shd.api_updating
512 (p_person_analysis_id => p_rec.person_analysis_id
513 ,p_object_version_number => p_rec.object_version_number
514 ) then
515 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
516 hr_utility.set_message_token('PROCEDURE', l_proc);
517 hr_utility.set_message_token('STEP', '5');
518 hr_utility.raise_error;
519 end if;
520 --
521 hr_utility.set_location(l_proc,10);
522 --
523 --
524 if nvl(p_rec.business_group_id, hr_api.g_number) <>
525 per_pea_shd.g_old_rec.business_group_id then
526 hr_api.argument_changed_error
527 (p_api_name => l_proc
528 ,p_argument => 'BUSINESS_GROUP_ID'
529 ,p_base_table => per_pea_shd.g_tab_nam
530 );
531 end if;
532 --
533 if nvl(p_rec.person_id, hr_api.g_number) <>
534 per_pea_shd.g_old_rec.person_id then
535 hr_api.argument_changed_error
536 (p_api_name => l_proc
537 ,p_argument => 'PERSON_ID'
538 ,p_base_table => per_pea_shd.g_tab_nam
539 );
540 end if;
541 hr_utility.set_location(' Leaving:'||l_proc, 15);
542 end check_non_updateable_args;
543 --
544 -- -----------------------------------------------------------------------
545 -- |------------------------------< chk_df >-----------------------------|
546 -- -----------------------------------------------------------------------
547 --
548 -- Description:
549 -- Validates the all Descriptive Flexfield values.
550 --
551 -- Pre-conditions:
552 -- All other columns have been validated. Must be called as the
553 -- last step from insert_validate and update_validate.
554 --
555 -- In Arguments:
556 -- p_rec
557 --
558 -- Post Success:
559 -- If the Descriptive Flexfield structure column and data values are
560 -- all valid this procedure will end normally and processing will
561 -- continue.
562 --
563 -- Post Failure:
564 -- If the Descriptive Flexfield structure column value or any of
565 -- the data values are invalid then an application error is raised as
566 -- a PL/SQL exception.
567 --
568 -- Access Status:
569 -- Internal Row Handler Use Only.
570 --
571 procedure chk_df
572 (p_rec in per_pea_shd.g_rec_type) is
573 --
574 l_proc varchar2(72) := g_package||'chk_df';
575 --
576 begin
580 nvl(per_pea_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
577 hr_utility.set_location('Entering:'||l_proc, 10);
578 --
579 if ((p_rec.person_analysis_id is not null) and (
581 nvl(p_rec.attribute_category, hr_api.g_varchar2) or
582 nvl(per_pea_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
583 nvl(p_rec.attribute1, hr_api.g_varchar2) or
584 nvl(per_pea_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
585 nvl(p_rec.attribute2, hr_api.g_varchar2) or
586 nvl(per_pea_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
587 nvl(p_rec.attribute3, hr_api.g_varchar2) or
588 nvl(per_pea_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
589 nvl(p_rec.attribute4, hr_api.g_varchar2) or
590 nvl(per_pea_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
591 nvl(p_rec.attribute5, hr_api.g_varchar2) or
592 nvl(per_pea_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
593 nvl(p_rec.attribute6, hr_api.g_varchar2) or
594 nvl(per_pea_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
595 nvl(p_rec.attribute7, hr_api.g_varchar2) or
596 nvl(per_pea_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
597 nvl(p_rec.attribute8, hr_api.g_varchar2) or
598 nvl(per_pea_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
599 nvl(p_rec.attribute9, hr_api.g_varchar2) or
600 nvl(per_pea_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
601 nvl(p_rec.attribute10, hr_api.g_varchar2) or
602 nvl(per_pea_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
603 nvl(p_rec.attribute11, hr_api.g_varchar2) or
604 nvl(per_pea_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
605 nvl(p_rec.attribute12, hr_api.g_varchar2) or
606 nvl(per_pea_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
607 nvl(p_rec.attribute13, hr_api.g_varchar2) or
608 nvl(per_pea_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
609 nvl(p_rec.attribute14, hr_api.g_varchar2) or
610 nvl(per_pea_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
611 nvl(p_rec.attribute15, hr_api.g_varchar2) or
612 nvl(per_pea_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
613 nvl(p_rec.attribute16, hr_api.g_varchar2) or
614 nvl(per_pea_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
615 nvl(p_rec.attribute17, hr_api.g_varchar2) or
616 nvl(per_pea_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
617 nvl(p_rec.attribute18, hr_api.g_varchar2) or
618 nvl(per_pea_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
619 nvl(p_rec.attribute19, hr_api.g_varchar2) or
620 nvl(per_pea_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
621 nvl(p_rec.attribute20, hr_api.g_varchar2)))
622 or
623 (p_rec.person_analysis_id is null) then
624 --
625 -- Only execute the validation if absolutely necessary:
626 -- a) During update, the structure column value or any
627 -- of the attribute values have actually changed.
628 -- b) During insert.
629 --
630 hr_dflex_utility.ins_or_upd_descflex_attribs
631 (p_appl_short_name => 'PER'
632 ,p_descflex_name => 'PER_PERSON_ANALYSES'
633 ,p_attribute_category => p_rec.attribute_category
634 ,p_attribute1_name => 'ATTRIBUTE1'
635 ,p_attribute1_value => p_rec.attribute1
636 ,p_attribute2_name => 'ATTRIBUTE2'
637 ,p_attribute2_value => p_rec.attribute2
638 ,p_attribute3_name => 'ATTRIBUTE3'
639 ,p_attribute3_value => p_rec.attribute3
640 ,p_attribute4_name => 'ATTRIBUTE4'
641 ,p_attribute4_value => p_rec.attribute4
642 ,p_attribute5_name => 'ATTRIBUTE5'
643 ,p_attribute5_value => p_rec.attribute5
644 ,p_attribute6_name => 'ATTRIBUTE6'
645 ,p_attribute6_value => p_rec.attribute6
646 ,p_attribute7_name => 'ATTRIBUTE7'
647 ,p_attribute7_value => p_rec.attribute7
648 ,p_attribute8_name => 'ATTRIBUTE8'
649 ,p_attribute8_value => p_rec.attribute8
650 ,p_attribute9_name => 'ATTRIBUTE9'
651 ,p_attribute9_value => p_rec.attribute9
652 ,p_attribute10_name => 'ATTRIBUTE10'
653 ,p_attribute10_value => p_rec.attribute10
654 ,p_attribute11_name => 'ATTRIBUTE11'
655 ,p_attribute11_value => p_rec.attribute11
656 ,p_attribute12_name => 'ATTRIBUTE12'
657 ,p_attribute12_value => p_rec.attribute12
658 ,p_attribute13_name => 'ATTRIBUTE13'
659 ,p_attribute13_value => p_rec.attribute13
660 ,p_attribute14_name => 'ATTRIBUTE14'
661 ,p_attribute14_value => p_rec.attribute14
662 ,p_attribute15_name => 'ATTRIBUTE15'
663 ,p_attribute15_value => p_rec.attribute15
664 ,p_attribute16_name => 'ATTRIBUTE16'
665 ,p_attribute16_value => p_rec.attribute16
666 ,p_attribute17_name => 'ATTRIBUTE17'
667 ,p_attribute17_value => p_rec.attribute17
668 ,p_attribute18_name => 'ATTRIBUTE18'
669 ,p_attribute18_value => p_rec.attribute18
670 ,p_attribute19_name => 'ATTRIBUTE19'
671 ,p_attribute19_value => p_rec.attribute19
672 ,p_attribute20_name => 'ATTRIBUTE20'
673 ,p_attribute20_value => p_rec.attribute20
674 );
675 end if;
676 --
677 hr_utility.set_location(' Leaving:'||l_proc, 20);
678 end chk_df;
679 --
680 -- ----------------------------------------------------------------------------
681 -- |---------------------------< insert_validate >----------------------------|
682 -- ----------------------------------------------------------------------------
683 Procedure insert_validate
684 (p_rec in per_pea_shd.g_rec_type,
685 p_effective_date in date) is
686 --
687 l_proc varchar2(72) := g_package||'insert_validate';
688 --
689 Begin
690 hr_utility.set_location('Entering:'||l_proc, 5);
691 --
695 (p_business_group_id => p_rec.business_group_id
692 -- Validate Important Attributes
693 --
694 hr_api.validate_bus_grp_id
696 ,p_associated_column1 => per_pea_shd.g_tab_nam || '.BUSINESS_GROUP_ID'
697 ); -- Validate Bus Grp
698 --
699 --After validating the set of important attributes,
700 --if multiple message detection is enabled and atleast
701 --one error has been found then abort further validation.
702 --
703 hr_multi_message.end_validation_set;
704 --
705 --validate dependent attributes
706 -- Call all supporting business operations
707 --
708 hr_utility.set_location(l_proc, 6);
709 --
710 -- Validate person id and business group id
711 --
712 chk_person_id
713 (p_person_id => p_rec.person_id,
714 p_business_group_id => p_rec.business_group_id,
715 p_effective_date => p_effective_date
716 );
717 --
718 hr_utility.set_location(l_proc, 7);
719 --
720 -- Validate id flex num
721 --
722 chk_id_flex_num(p_id_flex_num => p_rec.id_flex_num);
723 --
724 hr_utility.set_location(l_proc, 8);
725 --
726 -- Validate analysis criteria id
727 --
728 chk_analysis_criteria_id
729 (p_analysis_criteria_id => p_rec.analysis_criteria_id,
730 p_id_flex_num => p_rec.id_flex_num,
731 p_person_analysis_id => p_rec.person_analysis_id,
732 p_object_version_number => p_rec.object_version_number
733 );
734 --
735 hr_utility.set_location(l_proc, 9);
736 --
737 --
738 -- Validate date
739 --
740 chk_date_from_to
741 (p_person_analysis_id => p_rec.person_analysis_id,
742 p_date_from => p_rec.date_from,
743 p_date_to => p_rec.date_to,
744 p_object_version_number => p_rec.object_version_number
745 );
746 --
747 hr_utility.set_location(l_proc, 10);
748 --
749 -- Check For Duplicates
750 --
751 check_for_duplicates
752 (p_bg_id => p_rec.business_group_id
753 ,p_id_flex_num => p_rec.id_flex_num
754 ,p_analysis_criteria_id => p_rec.analysis_criteria_id
755 ,p_date_from => p_rec.date_from
756 ,p_date_to => p_rec.date_to
757 ,p_person_id => p_rec.person_id
758 ,p_person_analysis_id => p_rec.person_analysis_id
759 );
760 --
761 --
762 hr_utility.set_location(l_proc, 11);
763 --
764 ----
765 -- Validate flex fields.
766 --
767 chk_df(p_rec => p_rec);
768 --
769 hr_utility.set_location('Leaving:'||l_proc, 12);
770 --
771
772 End insert_validate;
773 --
774 -- ----------------------------------------------------------------------------
775 -- |---------------------------< update_validate >----------------------------|
776 -- ----------------------------------------------------------------------------
777 Procedure update_validate
778 (p_rec in per_pea_shd.g_rec_type) is
779 --
780 l_proc varchar2(72) := g_package||'update_validate';
781 --
782 Begin
783 hr_utility.set_location('Entering:'||l_proc, 5);
784 --
785 -- Validate Important Attributes
786 --
787 hr_api.validate_bus_grp_id
788 (p_business_group_id => p_rec.business_group_id
789 ,p_associated_column1 => per_pea_shd.g_tab_nam || '.BUSINESS_GROUP_ID'
790 ); -- Validate Bus Grp
791 --
792 --After validating the set of important attributes,
793 --if multiple message detection is enabled and atleast
794 --one error has been found then abort further validation.
795 --
796 hr_multi_message.end_validation_set;
797 --
798 -- validate dependent attributes
799 -- Call all supporting business operations
800 --
801 hr_utility.set_location(l_proc, 6);
802 --
803 -- Check the non-updateable arguments have in fact not been modified
804 --
805 per_pea_bus.check_non_updateable_args(p_rec => p_rec);
806 --
807 hr_utility.set_location(l_proc, 7);
808 --
809 -- Validate id flex num
810 --
811 chk_id_flex_num(p_id_flex_num => p_rec.id_flex_num);
812 --
813 hr_utility.set_location(l_proc, 8);
814 --
815 -- Validate analysis criteria id
816 --
817 chk_analysis_criteria_id
818 (p_analysis_criteria_id => p_rec.analysis_criteria_id,
819 p_id_flex_num => p_rec.id_flex_num,
820 p_person_analysis_id => p_rec.person_analysis_id,
821 p_object_version_number => p_rec.object_version_number
822 );
823 --
824 hr_utility.set_location(l_proc, 9);
825 --
826 --
827 -- Validate date
828 --
829 chk_date_from_to
830 (p_person_analysis_id => p_rec.person_analysis_id,
831 p_date_from => p_rec.date_from,
832 p_date_to => p_rec.date_to,
833 p_object_version_number => p_rec.object_version_number
834 );
835 --
836 --
837 hr_utility.set_location(l_proc, 10);
838 --
839 -- Check For Duplicates
840 --
841 check_for_duplicates
842 (p_bg_id => p_rec.business_group_id
843 ,p_id_flex_num => p_rec.id_flex_num
844 ,p_analysis_criteria_id => p_rec.analysis_criteria_id
845 ,p_date_from => p_rec.date_from
846 ,p_date_to => p_rec.date_to
847 ,p_person_id => p_rec.person_id
848 ,p_person_analysis_id => p_rec.person_analysis_id
849 );
850 --
851 --
852 hr_utility.set_location(l_proc, 11);
853 --
854 ----
855 -- Validate flex fields.
856 --
857 chk_df(p_rec => p_rec);
858 --
859 hr_utility.set_location('Leaving:'||l_proc, 12);
860 --
861 End update_validate;
862 --
863 -- ----------------------------------------------------------------------------
864 -- |---------------------------< delete_validate >----------------------------|
865 -- ----------------------------------------------------------------------------
866 Procedure delete_validate(p_rec in per_pea_shd.g_rec_type) is
867 --
868 l_proc varchar2(72) := g_package||'delete_validate';
869 --
870 Begin
871 hr_utility.set_location('Entering:'||l_proc, 5);
872 --
873 -- Call all supporting business operations
874 --
875 --
876 -- Validate flex fields.
877 --
878 chk_df(p_rec => p_rec);
879 --
880 hr_utility.set_location(' Leaving:'||l_proc, 10);
881 End delete_validate;
882 --
883 --
884 -- ----------------------------------------------------------------------------
885 -- |-----------------------< return_legislation_code >-------------------------|
886 -- ----------------------------------------------------------------------------
887 Function return_legislation_code
888 (p_person_analysis_id in per_person_analyses.person_analysis_id%TYPE
889 ) return varchar2 is
890 --
891 -- Curson to find legislation code.
892 --
893 cursor csr_leg_code is
894 select legislation_code
895 from per_business_groups pbg,
896 per_person_analyses ppa
897 where ppa.person_analysis_id = p_person_analysis_id
898 and pbg.business_group_id = ppa.business_group_id;
899 --
900 -- Declare local variables
901 --
902 l_proc varchar2(72) := 'return_legislation_code';
903 l_legislation_code varchar2(150);
904 --
905 begin
906 hr_utility.set_location('Entering:'||l_proc, 10);
907 --
908 -- Ensure that all the mandatory parameters are not null
909 --
910 hr_api.mandatory_arg_error (p_api_name => l_proc,
911 p_argument => 'person_analysis_id',
912 p_argument_value => p_person_analysis_id );
913 if nvl(g_person_analysis_id, hr_api.g_number) = p_person_analysis_id then
914 --
915 -- The legislation code has already been found with a previous
916 -- call to this function. Just return the value in the global
917 -- variable.
918 --
919 l_legislation_code := g_legislation_code;
920 hr_utility.set_location(l_proc, 20);
921 else
922 --
923 -- The ID is different to the last call to this function
924 -- or this is the first call to this function.
925 --
926 open csr_leg_code;
927 fetch csr_leg_code into l_legislation_code;
928 if csr_leg_code%notfound then
929 --
930 -- The primary key is invalid therefore we must error
931 --
932 close csr_leg_code;
933 --
934 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
935 fnd_message.raise_error;
936 end if;
937 hr_utility.set_location(l_proc, 30);
938 --
939 -- Set the global variables so the values are
940 -- available for the next call to this function
941 --
942 close csr_leg_code;
943 g_person_analysis_id := p_person_analysis_id;
944 g_legislation_code := l_legislation_code;
945 end if;
946 hr_utility.set_location(' Leaving:'||l_proc, 40);
947 return l_legislation_code;
948 --
949 end return_legislation_code;
950 --
951 end per_pea_bus;