[Home] [Help]
PACKAGE BODY: APPS.PER_PRV_BUS
Source
1 Package Body per_prv_bus as
2 /* $Header: peprvrhi.pkb 120.1 2006/04/14 17:27:46 kandra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_prv_bus.'; -- Global package name
9 --
10 g_legislation_code varchar2(150) default null;
11 g_performance_review_id number default null;
12 --
13 -- ----------------------------------------------------------------------------
14 -- |------------------------< chk_performance_review_id >---------------------|
15 -- ----------------------------------------------------------------------------
16 --
17 -- Description
18 -- This procedure is used to check that the primary key for the table
19 -- is created properly. It should be null on insert and
20 -- should not be able to be updated.
21 --
22 -- Pre Conditions
23 -- None.
24 --
25 -- In Parameters
26 -- performance_review_id PK of record being inserted or updated.
27 -- object_version_number Object version number of record being
28 -- inserted or updated.
29 --
30 -- Post Success
31 -- Processing continues
32 --
33 -- Post Failure
34 -- Errors handled by the procedure
35 --
36 -- Access Status
37 -- Internal table handler use only.
38 --
39 Procedure chk_performance_review_id(p_performance_review_id in number
40 ,p_object_version_number in number) is
41 --
42 l_proc varchar2(72) := g_package||'chk_performance_review_id';
43 l_api_updating boolean;
44 --
45 Begin
46 --
47 hr_utility.set_location('Entering:'||l_proc, 5);
48 --
49 l_api_updating := per_prv_shd.api_updating
50 (p_performance_review_id => p_performance_review_id,
51 p_object_version_number => p_object_version_number);
52 --
53 if (l_api_updating
54 and nvl(p_performance_review_id,hr_api.g_number)
55 <> per_prv_shd.g_old_rec.performance_review_id) then
56 --
57 -- raise error as PK has changed
58 --
59 per_prv_shd.constraint_error('PER_PERFORMANCE_REVIEWS_PK');
60 --
61 elsif not l_api_updating then
62 --
63 -- check if PK is null
64 --
65 if p_performance_review_id is not null then
66 --
67 -- raise error as PK is not null
68 --
69 per_prv_shd.constraint_error('PER_PERFORMANCE_REVIEWS_PK');
70 --
71 end if;
72 --
73 end if;
74 --
75 hr_utility.set_location('Leaving:'||l_proc, 10);
76 --
77 End chk_performance_review_id;
78 --
79 -- ----------------------------------------------------------------------------
80 -- |-------------------------------< chk_event_id >---------------------------|
81 -- ----------------------------------------------------------------------------
82 --
83 -- Description
84 -- This procedure checks that the event id is valid
85 --
86 -- Pre-Conditions
87 -- none
88 --
89 -- In Parameters
90 -- p_performance_review_id
91 -- the performance review id
92 -- p_event_id
93 -- the id of the event associated with the review
94 -- p_object_version_number
95 -- the object version number
96 --
97 -- Post Success
98 -- Processing continues
99 --
100 -- Post Failure
101 -- Error raised.
102 --
103 -- Access Status
104 -- Internal table handler use only.
105 --
106 Procedure chk_event_id (p_performance_review_id in number
107 ,p_event_id in number
108 ,p_object_version_number in number) is
109 --
110 l_proc varchar2(72) := g_package||'chk_event_id';
111 l_api_updating boolean;
112 l_dummy varchar2(1);
113 --
114 cursor get_event is
115 select null
116 from per_events pev
117 where pev.event_id = p_event_id;
118 --
119 Begin
120 --
121 hr_utility.set_location('Entering:'||l_proc,5);
122 --
123 if (p_event_id is not null) then
124 l_api_updating := per_prv_shd.api_updating
125 (p_performance_review_id => p_performance_review_id
126 ,p_object_version_number => p_object_version_number);
127 --
128 if (l_api_updating
129 and nvl(p_event_id,hr_api.g_number)
130 <> nvl(per_prv_shd.g_old_rec.event_id,hr_api.g_number)
131 or not l_api_updating) then
132 --
133 -- check if event_id value exists in per_events table
134 --
135 open get_event;
136 --
137 fetch get_event into l_dummy;
138 if get_event%notfound then
139 --
140 close get_event;
141 --
142 -- raise error as FK does not relate to PK in per_events
143 -- table.
144 --
145 per_prv_shd.constraint_error('PER_PERFORMANCE_REVIEWS_FK2');
146 --
147 end if;
148 --
149 close get_event;
150 --
151 end if;
152 end if;
153 --
154 hr_utility.set_location('Leaving:'||l_proc,10);
155 --
156 End chk_event_id;
157 --
158 -- ----------------------------------------------------------------------------
159 -- |---------------------------< chk_person_id_date >-------------------------|
160 -- ----------------------------------------------------------------------------
161 --
162 Procedure chk_person_id_date(p_performance_review_id in number
163 ,p_object_version_number in number
164 ,p_person_id in number
165 ,p_review_date in date) is
166
167 cursor get_person is
168 select 1
169 from per_all_people_f ppf
170 where ppf.person_id=p_person_id
171 and p_review_date between ppf.effective_start_date
172 and ppf.effective_end_date
173 and ppf.current_employee_flag='Y';
174
175 cursor get_dup_date is
176 select 1
177 from per_performance_reviews prv
178 where prv.person_id=p_person_id
179 and prv.review_date=p_review_date;
180
181 l_proc varchar2(72) := g_package||'chk_person_id_date';
182 l_api_updating boolean;
183 l_dummy number;
184
185 begin
186
187 hr_utility.set_location('Entering:'||l_proc,5);
188 --
189 -- Check mandatory parameters have being set.
190 --
191 hr_api.mandatory_arg_error
192 (p_api_name => l_proc
193 ,p_argument => 'review_date'
194 ,p_argument_value => p_review_date
195 );
196 --
197 hr_api.mandatory_arg_error
198 (p_api_name => l_proc
199 ,p_argument => 'person_id'
200 ,p_argument_value => p_person_id
201 );
202 --
203 l_api_updating := per_prv_shd.api_updating
204 (p_performance_review_id => p_performance_review_id,
205 p_object_version_number => p_object_version_number);
206 --
207 if (l_api_updating
208 and ( nvl(p_person_id,hr_api.g_number)
209 <> nvl(per_prv_shd.g_old_rec.person_id,hr_api.g_number)
210 or nvl(p_review_date,hr_api.g_date)
211 <> nvl(per_prv_shd.g_old_rec.review_date,hr_api.g_date))
212 or not l_api_updating) then
213 hr_utility.set_location(l_proc,10);
214 --
215 -- check if the person exists on this date
216 --
217 open get_person;
218 --
219 fetch get_person into l_dummy;
220 if get_person%notfound then
221 hr_utility.set_location(l_proc,15);
222 --
223 close get_person;
224 --
225 -- raise error as FK does not relate to PK in per_events
226 -- table.
227 --
228 per_prv_shd.constraint_error('PER_PERFORMANCE_REVIEWS_DT1');
229 --
230 end if;
231 --
232 close get_person;
233 --
234 hr_utility.set_location(l_proc,20);
235 open get_dup_date;
236 fetch get_dup_date into l_dummy;
237 if get_dup_date%FOUND then
238 close get_dup_date;
239 hr_utility.set_location(l_proc,25);
240 hr_utility.set_message(801,'HR_13000_SAL_DATE_NOT_UNIQUE');
241 hr_utility.raise_error;
242 end if;
243 close get_dup_date;
244 end if;
245 --
246 hr_utility.set_location('Leaving:'||l_proc,30);
247 end chk_person_id_date;
248 --
249 -- ----------------------------------------------------------------------------
250 -- |-----------------------< chk_next_perf_review_date >----------------------|
251 -- ----------------------------------------------------------------------------
252 --
253 Procedure chk_next_perf_review_date(p_performance_review_id in number
254 ,p_object_version_number in number
255 ,p_review_date in date
256 ,p_next_perf_review_date in date
257 ,p_person_id in number
258 ,p_next_review_date_warning out nocopy boolean) is
259 --
260 l_proc varchar2(72) := g_package||'chk_next_perf_review_date';
261 l_api_updating boolean;
262 l_dummy number;
263 --
264 cursor get_person is
265 select 1
266 from per_all_people_f ppf
267 where ppf.person_id=p_person_id
268 and p_next_perf_review_date between ppf.effective_start_date
269 and ppf.effective_end_date
270 and ppf.current_employee_flag='Y';
271 --
272 Begin
273 --
274 hr_utility.set_location('Entering:'||l_proc, 5);
275 --
276 -- Check mandatory parameters have being set.
277 --
278 hr_api.mandatory_arg_error
279 (p_api_name => l_proc
280 ,p_argument => 'review_date'
281 ,p_argument_value => p_review_date
282 );
283 --
284 l_api_updating := per_prv_shd.api_updating
285 (p_performance_review_id => p_performance_review_id
286 ,p_object_version_number => p_object_version_number);
287 --
288 if (l_api_updating AND
289 (nvl(per_prv_shd.g_old_rec.next_perf_review_date,hr_api.g_date) <>
290 nvl(p_next_perf_review_date,hr_api.g_date)
291 or nvl(per_prv_shd.g_old_rec.review_date ,hr_api.g_date)
292 <> nvl(p_review_date,hr_api.g_date))
293 or not l_api_updating) then
294 --
295 hr_utility.set_location(l_proc, 10);
296 if(p_next_perf_review_date<=p_review_date) then
297 hr_utility.set_message(801, 'HR_51260_PYP_INVAL_PERF_DATE');
298 hr_utility.raise_error;
299 end if;
300 open get_person;
301 fetch get_person into l_dummy;
302 if get_person%notfound and p_next_perf_review_date is not null then
303 hr_utility.set_location(l_proc, 15);
304 close get_person;
305 p_next_review_date_warning:=TRUE;
306 else
307 close get_person;
308 p_next_review_date_warning:=FALSE;
309 end if;
310 end if;
311 --
312 hr_utility.set_location('Leaving:'||l_proc,20);
313 end chk_next_perf_review_date;
314 --
315 --
316 -- ----------------------------------------------------------------------------
317 -- |---------------------< chk_get_next_perf_review_date >--------------------|
318 -- ----------------------------------------------------------------------------
319 --
320 Procedure chk_get_next_perf_review_date(p_performance_review_id in number
321 ,p_object_version_number in number
322 ,p_review_date in date
323 ,p_next_perf_review_date in out nocopy date
324 ,p_assignment_id in number) is
325 --
326 l_proc varchar2(72) := g_package||'chk_get_next_perf_review_date';
327 l_api_updating boolean;
328 l_period number;
329 l_frequency varchar2(30);
330 --
331 cursor get_frequency is
332 select perf_review_period,perf_review_period_frequency
333 from per_all_assignments_f paf
334 where paf.assignment_id=p_assignment_id
335 and p_review_date between paf.effective_start_date
336 and paf.effective_end_date;
337 --
338 Begin
339 --
340 hr_utility.set_location('Entering:'||l_proc, 5);
341 --
342 -- Check mandatory parameters have being set.
343 --
344 hr_api.mandatory_arg_error
345 (p_api_name => l_proc
346 ,p_argument => 'review_date'
347 ,p_argument_value => p_review_date
348 );
349 --
350 l_api_updating := per_prv_shd.api_updating
351 (p_performance_review_id => p_performance_review_id
352 ,p_object_version_number => p_object_version_number);
353 --
354 if (l_api_updating AND
355 (nvl(per_prv_shd.g_old_rec.review_date ,hr_api.g_date)
356 <> nvl(p_review_date,hr_api.g_date))
357 or not l_api_updating) then
358 --
359 hr_utility.set_location(l_proc, 10);
360 if(p_assignment_id is not null
361 and p_next_perf_review_date is null) then
362 open get_frequency;
363 fetch get_frequency into l_period,l_frequency;
364 if get_frequency%found then
365 hr_utility.set_location(l_proc, 15);
366 close get_frequency;
367 if(l_frequency='M') THEN
368 hr_utility.set_location(l_proc, 20);
369 p_next_perf_review_date:=add_months(p_review_date,l_period);
370 elsif(l_frequency='Y') THEN
371 hr_utility.set_location(l_proc, 25);
372 p_next_perf_review_date:=add_months(p_review_date,l_period*12);
373 elsif(l_frequency='D') THEN
374 hr_utility.set_location(l_proc, 30);
375 p_next_perf_review_date:=p_review_date+l_period;
376 elsif(l_frequency='W') THEN
377 hr_utility.set_location(l_proc, 35);
378 p_next_perf_review_date:=p_review_date+(l_period*7);
379 else
380 hr_utility.set_location(l_proc||' '||l_frequency, 40);
381 end if;
382 else
383 hr_utility.set_location(l_proc, 50);
384 close get_frequency;
385 end if;
386 end if;
387 end if;
388 --
389 hr_utility.set_location('Leaving:'||l_proc,55);
390 end chk_get_next_perf_review_date;
391 --
392 --
393 -- ----------------------------------------------------------------------------
394 -- |----------------------< chk_performance_rating >--------------------------|
395 -- ----------------------------------------------------------------------------
396 --
397 -- Description:
398 -- Validates the value entered for performance_rating exists on hr_lookups.
399 -- Pre-conditions:
400 -- None
401 --
402 -- In Arguments:
403 -- p_performance_review_id
404 -- p_performance_rating
405 -- p_object_version_number
406 --
407 -- Post Success:
408 -- Processing continues if :
409 -- - The performance_rating value is valid
410 --
411 -- Post Failure:
412 -- An application error is raised and processing is terminated if any
413 -- - The performance_rating value is invalid
414 --
415 -- Access Status:
416 -- Internal Table Handler Use Only.
417 --
418 procedure chk_performance_rating
419 (p_performance_review_id in per_performance_reviews.performance_review_id%TYPE
420 ,p_performance_rating in per_performance_reviews.performance_rating%TYPE
421 ,p_review_date in per_performance_reviews.review_date%TYPE
422 ,p_object_version_number in per_performance_reviews.object_version_number%TYPE
423 )
424 is
425 --
426 l_proc varchar2(72):= g_package||'chk_performance_rating';
427 l_api_updating boolean;
428 --
429
430 begin
431 hr_utility.set_location('Entering:'|| l_proc, 5);
432 --
433 -- Check mandatory parameters have being set.
434 --
435 hr_api.mandatory_arg_error
436 (p_api_name => l_proc
437 ,p_argument => 'performance_rating'
438 ,p_argument_value => p_performance_rating
439 );
440 --
441 -- Only proceed with validation if :
442 -- a) The current g_old_rec is current and
443 -- b) The value for performance_rating has changed
444 --
445 l_api_updating := per_prv_shd.api_updating
446 (p_performance_review_id => p_performance_review_id
447 ,p_object_version_number => p_object_version_number);
448 --
449 if (l_api_updating AND (nvl(per_prv_shd.g_old_rec.performance_rating,hr_api.g_varchar2) <>
450 nvl(p_performance_rating,hr_api.g_varchar2)) OR not l_api_updating) then
451 hr_utility.set_location(l_proc, 10);
452 --
453 -- check that the p_performance_rating exists in hr_lookups.
454 --
455 if hr_api.not_exists_in_hr_lookups
456 (p_effective_date => p_review_date
457 ,p_lookup_type => 'PERFORMANCE_RATING'
458 ,p_lookup_code => p_performance_rating
459 ) then
460 hr_utility.set_location(l_proc, 15);
461 hr_utility.set_message(801,'HR_51264_PYP_INVAL_PERF_RATING');
462 hr_utility.raise_error;
463 end if;
464 --
465 end if;
466 --
467 hr_utility.set_location(' Leaving:'|| l_proc, 20);
468 end chk_performance_rating;
469 --
470 --
471 -- -----------------------------------------------------------------------
472 -- |------------------------------< chk_df >-----------------------------|
473 -- -----------------------------------------------------------------------
474 --
475 -- Description:
476 -- Validates the all Descriptive Flexfield values.
477 --
478 -- Pre-conditions:
479 -- All other columns have been validated. Must be called as the
480 -- last step from insert_validate and update_validate.
481 --
482 -- In Arguments:
483 -- p_rec
484 --
485 -- Post Success:
486 -- If the Descriptive Flexfield structure column and data values are
487 -- all valid this procedure will end normally and processing will
488 -- continue.
489 --
490 -- Post Failure:
491 -- If the Descriptive Flexfield structure column value or any of
492 -- the data values are invalid then an application error is raised as
493 -- a PL/SQL exception.
494 --
495 -- Access Status:
496 -- Internal Row Handler Use Only.
497 --
498 procedure chk_df
499 (p_rec in per_prv_shd.g_rec_type) is
500 --
501 l_proc varchar2(72) := g_package||'chk_df';
502 --
503 begin
504 hr_utility.set_location('Entering:'||l_proc, 10);
505 --
506 if ((p_rec.performance_review_id is not null) and (
507 nvl(per_prv_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
508 nvl(p_rec.attribute_category, hr_api.g_varchar2) or
509 nvl(per_prv_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
510 nvl(p_rec.attribute1, hr_api.g_varchar2) or
511 nvl(per_prv_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
512 nvl(p_rec.attribute2, hr_api.g_varchar2) or
513 nvl(per_prv_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
514 nvl(p_rec.attribute3, hr_api.g_varchar2) or
515 nvl(per_prv_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
516 nvl(p_rec.attribute4, hr_api.g_varchar2) or
517 nvl(per_prv_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
518 nvl(p_rec.attribute5, hr_api.g_varchar2) or
519 nvl(per_prv_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
520 nvl(p_rec.attribute6, hr_api.g_varchar2) or
521 nvl(per_prv_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
522 nvl(p_rec.attribute7, hr_api.g_varchar2) or
523 nvl(per_prv_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
524 nvl(p_rec.attribute8, hr_api.g_varchar2) or
525 nvl(per_prv_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
526 nvl(p_rec.attribute9, hr_api.g_varchar2) or
527 nvl(per_prv_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
528 nvl(p_rec.attribute10, hr_api.g_varchar2) or
529 nvl(per_prv_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
530 nvl(p_rec.attribute11, hr_api.g_varchar2) or
531 nvl(per_prv_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
532 nvl(p_rec.attribute12, hr_api.g_varchar2) or
533 nvl(per_prv_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
534 nvl(p_rec.attribute13, hr_api.g_varchar2) or
535 nvl(per_prv_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
536 nvl(p_rec.attribute14, hr_api.g_varchar2) or
537 nvl(per_prv_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
538 nvl(p_rec.attribute15, hr_api.g_varchar2) or
539 nvl(per_prv_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
540 nvl(p_rec.attribute16, hr_api.g_varchar2) or
541 nvl(per_prv_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
542 nvl(p_rec.attribute17, hr_api.g_varchar2) or
543 nvl(per_prv_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
544 nvl(p_rec.attribute18, hr_api.g_varchar2) or
545 nvl(per_prv_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
546 nvl(p_rec.attribute19, hr_api.g_varchar2) or
547 nvl(per_prv_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
548 nvl(p_rec.attribute20, hr_api.g_varchar2) or
549 nvl(per_prv_shd.g_old_rec.attribute21, hr_api.g_varchar2) <>
550 nvl(p_rec.attribute21, hr_api.g_varchar2) or
551 nvl(per_prv_shd.g_old_rec.attribute22, hr_api.g_varchar2) <>
552 nvl(p_rec.attribute22, hr_api.g_varchar2) or
553 nvl(per_prv_shd.g_old_rec.attribute23, hr_api.g_varchar2) <>
554 nvl(p_rec.attribute23, hr_api.g_varchar2) or
555 nvl(per_prv_shd.g_old_rec.attribute24, hr_api.g_varchar2) <>
556 nvl(p_rec.attribute24, hr_api.g_varchar2) or
557 nvl(per_prv_shd.g_old_rec.attribute25, hr_api.g_varchar2) <>
558 nvl(p_rec.attribute25, hr_api.g_varchar2) or
559 nvl(per_prv_shd.g_old_rec.attribute26, hr_api.g_varchar2) <>
560 nvl(p_rec.attribute26, hr_api.g_varchar2) or
561 nvl(per_prv_shd.g_old_rec.attribute27, hr_api.g_varchar2) <>
562 nvl(p_rec.attribute27, hr_api.g_varchar2) or
563 nvl(per_prv_shd.g_old_rec.attribute28, hr_api.g_varchar2) <>
564 nvl(p_rec.attribute28, hr_api.g_varchar2) or
565 nvl(per_prv_shd.g_old_rec.attribute29, hr_api.g_varchar2) <>
566 nvl(p_rec.attribute29, hr_api.g_varchar2) or
567 nvl(per_prv_shd.g_old_rec.attribute30, hr_api.g_varchar2) <>
568 nvl(p_rec.attribute30, hr_api.g_varchar2)))
569 or
570 (p_rec.performance_review_id is null) then
571 --
572 -- Only execute the validation if absolutely necessary:
573 -- a) During update, the structure column value or any
574 -- of the attribute values have actually changed.
575 -- b) During insert.
576 --
577 hr_dflex_utility.ins_or_upd_descflex_attribs
578 (p_appl_short_name => 'PER'
579 ,p_descflex_name => 'PER_PERFORMANCE_REVIEWS'
580 ,p_attribute_category => p_rec.attribute_category
581 ,p_attribute1_name => 'ATTRIBUTE1'
582 ,p_attribute1_value => p_rec.attribute1
583 ,p_attribute2_name => 'ATTRIBUTE2'
584 ,p_attribute2_value => p_rec.attribute2
585 ,p_attribute3_name => 'ATTRIBUTE3'
586 ,p_attribute3_value => p_rec.attribute3
587 ,p_attribute4_name => 'ATTRIBUTE4'
588 ,p_attribute4_value => p_rec.attribute4
589 ,p_attribute5_name => 'ATTRIBUTE5'
590 ,p_attribute5_value => p_rec.attribute5
591 ,p_attribute6_name => 'ATTRIBUTE6'
592 ,p_attribute6_value => p_rec.attribute6
593 ,p_attribute7_name => 'ATTRIBUTE7'
594 ,p_attribute7_value => p_rec.attribute7
595 ,p_attribute8_name => 'ATTRIBUTE8'
596 ,p_attribute8_value => p_rec.attribute8
597 ,p_attribute9_name => 'ATTRIBUTE9'
598 ,p_attribute9_value => p_rec.attribute9
599 ,p_attribute10_name => 'ATTRIBUTE10'
600 ,p_attribute10_value => p_rec.attribute10
601 ,p_attribute11_name => 'ATTRIBUTE11'
602 ,p_attribute11_value => p_rec.attribute11
603 ,p_attribute12_name => 'ATTRIBUTE12'
604 ,p_attribute12_value => p_rec.attribute12
605 ,p_attribute13_name => 'ATTRIBUTE13'
606 ,p_attribute13_value => p_rec.attribute13
607 ,p_attribute14_name => 'ATTRIBUTE14'
608 ,p_attribute14_value => p_rec.attribute14
609 ,p_attribute15_name => 'ATTRIBUTE15'
610 ,p_attribute15_value => p_rec.attribute15
611 ,p_attribute16_name => 'ATTRIBUTE16'
612 ,p_attribute16_value => p_rec.attribute16
613 ,p_attribute17_name => 'ATTRIBUTE17'
614 ,p_attribute17_value => p_rec.attribute17
615 ,p_attribute18_name => 'ATTRIBUTE18'
616 ,p_attribute18_value => p_rec.attribute18
617 ,p_attribute19_name => 'ATTRIBUTE19'
618 ,p_attribute19_value => p_rec.attribute19
619 ,p_attribute20_name => 'ATTRIBUTE20'
620 ,p_attribute20_value => p_rec.attribute20
621 ,p_attribute21_name => 'ATTRIBUTE21'
622 ,p_attribute21_value => p_rec.attribute21
623 ,p_attribute22_name => 'ATTRIBUTE22'
624 ,p_attribute22_value => p_rec.attribute22
625 ,p_attribute23_name => 'ATTRIBUTE23'
626 ,p_attribute23_value => p_rec.attribute23
627 ,p_attribute24_name => 'ATTRIBUTE24'
628 ,p_attribute24_value => p_rec.attribute24
629 ,p_attribute25_name => 'ATTRIBUTE25'
630 ,p_attribute25_value => p_rec.attribute25
631 ,p_attribute26_name => 'ATTRIBUTE26'
632 ,p_attribute26_value => p_rec.attribute26
633 ,p_attribute27_name => 'ATTRIBUTE27'
634 ,p_attribute27_value => p_rec.attribute27
635 ,p_attribute28_name => 'ATTRIBUTE28'
636 ,p_attribute28_value => p_rec.attribute28
637 ,p_attribute29_name => 'ATTRIBUTE29'
638 ,p_attribute29_value => p_rec.attribute29
639 ,p_attribute30_name => 'ATTRIBUTE30'
640 ,p_attribute30_value => p_rec.attribute30
641 );
642 end if;
643 --
644 hr_utility.set_location(' Leaving:'||l_proc, 20);
645 end chk_df;
646 -- ----------------------------------------------------------------------------
647 -- |-----------------------< chk_non_updateable_args >------------------------|
648 -- ----------------------------------------------------------------------------
649 -- {Start Of Comments}
650 --
651 -- Description:
652 -- This procedure is used to ensure that non updateable attributes have
653 -- not been updated. If an attribute has been updated an error is generated.
654 --
655 -- Pre Conditions:
656 -- g_old_rec has been populated with details of the values currently in
657 -- the database.
658 --
659 -- In Arguments:
660 -- p_rec has been populated with the updated values the user would like the
661 -- record set to.
662 --
663 -- Post Success:
664 -- Processing continues if all the non updateable attributes have not
665 -- changed.
666 --
667 -- Post Failure:
668 -- An application error is raised if any of the non updatable attributes
669 -- have been altered.
670 --
671 -- {End Of Comments}
672 -- ----------------------------------------------------------------------------
673 Procedure chk_non_updateable_args
674 (p_rec in per_prv_shd.g_rec_type ) IS
675 --
676 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
677 l_error EXCEPTION;
678 l_argument varchar2(30);
679 --
680 Begin
681 --
682 -- Only proceed with the validation if a row exists for the current
683 -- record in the HR Schema.
684 --
685 IF NOT per_prv_shd.api_updating
686 (p_performance_review_id => p_rec.performance_review_id
687 ,p_object_version_number => p_rec.object_version_number
688 ) THEN
689 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
690 fnd_message.set_token('PROCEDURE ', l_proc);
691 fnd_message.set_token('STEP ', '5');
692 fnd_message.raise_error;
693 END IF;
694 --
695 hr_utility.set_location(l_proc, 30);
696 --
697 if nvl(p_rec.person_id, hr_api.g_number) <>
698 nvl(per_prv_shd.g_old_rec.person_id
699 ,hr_api.g_number) then
700 l_argument := 'person_id';
701 raise l_error;
702 end if;
703 --
704 --
705 EXCEPTION
706 WHEN l_error THEN
707 hr_api.argument_changed_error
708 (p_api_name => l_proc
709 ,p_argument => l_argument);
710 WHEN OTHERS THEN
711 RAISE;
712 End chk_non_updateable_args;
713 --
714 -- ----------------------------------------------------------------------------
715 -- |-----------------------< chk_delete_performance_review>-------------------|
716 -- ----------------------------------------------------------------------------
717 --
718 Procedure chk_delete_performance_review(p_performance_review_id in number) is
719 --
720 l_proc varchar2(72) := g_package||'chk_delete_performance_review';
721 l_exists number;
722 --
723 cursor c_used is
724 select 1
725 from per_pay_proposals ppp
726 where ppp.performance_review_id=p_performance_review_id;
727 --
728 Begin
729 --
730 hr_utility.set_location('Entering:'||l_proc, 5);
731 --
732 hr_api.mandatory_arg_error
733 (p_api_name => l_proc
734 ,p_argument => 'performance_review_id'
735 ,p_argument_value => p_performance_review_id
736 );
737 --
738 open c_used;
739 fetch c_used into l_exists;
740 if(c_used%found) then
741 close c_used;
742 hr_utility.set_location(l_proc,10);
743 hr_utility.set_message(800,'HR_52408_PRV_PROPOSAL_EXISTS');
744 hr_utility.raise_error;
745 else
746 close c_used;
747 end if;
748 --
749 hr_utility.set_location(' Leaving:'||l_proc, 20);
750 end chk_delete_performance_review;
751 --
752 -- ----------------------------------------------------------------------------
753 -- |---------------------------< insert_validate >----------------------------|
754 -- ----------------------------------------------------------------------------
755 Procedure insert_validate(p_rec in per_prv_shd.g_rec_type
756 ,p_next_review_date_warning out nocopy boolean ) is
757 --
758 l_proc varchar2(72) := g_package||'insert_validate';
759 --
760 Begin
761 hr_utility.set_location('Entering:'||l_proc, 5);
762 --
763 per_per_bus.set_security_group_id
764 (
765 p_person_id => p_rec.person_id
766 );
767 --
768 hr_utility.set_location('Entering:'||l_proc, 5);
769 --
770 -- Call all supporting business operations
771 --
772 chk_performance_review_id
773 (p_performance_review_id => p_rec.performance_review_id,
774 p_object_version_number => p_rec.object_version_number);
775 --
776 hr_utility.set_location(l_proc, 10);
777 --
778 chk_event_id
779 (p_performance_review_id => p_rec.performance_review_id,
780 p_event_id => p_rec.event_id,
781 p_object_version_number => p_rec.object_version_number);
782 --
783 hr_utility.set_location(l_proc, 15);
784 --
785 chk_person_id_date(p_performance_review_id => p_rec.performance_review_id
786 ,p_object_version_number => p_rec.object_version_number
787 ,p_person_id => p_rec.person_id
788 ,p_review_date => p_rec.review_date);
789 --
790 hr_utility.set_location(l_proc, 20);
791 --
792 chk_next_perf_review_date(p_performance_review_id => p_rec.performance_review_id
793 ,p_object_version_number => p_rec.object_version_number
794 ,p_review_date => p_rec.review_date
795 ,p_next_perf_review_date => p_rec.next_perf_review_date
796 ,p_person_id => p_rec.person_id
797 ,p_next_review_date_warning => p_next_review_date_warning);
798 --
799 chk_performance_rating
800 (p_performance_review_id => p_rec.performance_review_id
801 ,p_performance_rating => p_rec.performance_rating
802 ,p_review_date => p_rec.review_date
803 ,p_object_version_number => p_rec.object_version_number);
804 --
805 hr_utility.set_location(l_proc, 25);
806 --
807 chk_df(p_rec => p_rec);
808 --
809 hr_utility.set_location(' Leaving:'||l_proc, 10);
810 End insert_validate;
811 --
812 -- ----------------------------------------------------------------------------
813 -- |---------------------------< update_validate >----------------------------|
814 -- ----------------------------------------------------------------------------
815 Procedure update_validate(p_rec in per_prv_shd.g_rec_type
816 ,p_next_review_date_warning out nocopy boolean ) is
817 --
818 l_proc varchar2(72) := g_package||'update_validate';
819 --
820 Begin
821 hr_utility.set_location('Entering:'||l_proc, 5);
822 --
823 per_per_bus.set_security_group_id
824 (
825 p_person_id => p_rec.person_id
826 );
827 --
828 hr_utility.set_location('Entering:'||l_proc, 5);
829 --
830 -- Call all supporting business operations
831 --
832 chk_non_updateable_args(
833 p_rec => p_rec);
834 --
835 chk_performance_review_id
836 (p_performance_review_id => p_rec.performance_review_id,
837 p_object_version_number => p_rec.object_version_number);
838 --
839 hr_utility.set_location(l_proc, 10);
840 --
841 chk_event_id
842 (p_performance_review_id => p_rec.performance_review_id,
843 p_event_id => p_rec.event_id,
844 p_object_version_number => p_rec.object_version_number);
845 --
846 hr_utility.set_location(l_proc, 15);
847 --
848 chk_person_id_date(p_performance_review_id => p_rec.performance_review_id
849 ,p_object_version_number => p_rec.object_version_number
850 ,p_person_id => p_rec.person_id
851 ,p_review_date => p_rec.review_date);
852 --
853 hr_utility.set_location(l_proc, 20);
854 --
855 chk_next_perf_review_date(p_performance_review_id => p_rec.performance_review_id
856 ,p_object_version_number => p_rec.object_version_number
857 ,p_review_date => p_rec.review_date
858 ,p_next_perf_review_date => p_rec.next_perf_review_date
859 ,p_person_id => p_rec.person_id
860 ,p_next_review_date_warning => p_next_review_date_warning);
861 --
862 chk_performance_rating
863 (p_performance_review_id => p_rec.performance_review_id
864 ,p_performance_rating => p_rec.performance_rating
865 ,p_review_date => p_rec.review_date
866 ,p_object_version_number => p_rec.object_version_number);
867 --
868 hr_utility.set_location(l_proc, 25);
869 --
870 chk_df(p_rec => p_rec);
871 --
872 --
873 hr_utility.set_location(' Leaving:'||l_proc, 10);
874 End update_validate;
875 --
876 -- ----------------------------------------------------------------------------
877 -- |---------------------------< delete_validate >----------------------------|
878 -- ----------------------------------------------------------------------------
879 Procedure delete_validate(p_rec in per_prv_shd.g_rec_type) is
880 --
881 l_proc varchar2(72) := g_package||'delete_validate';
882 --
883 Begin
884 hr_utility.set_location('Entering:'||l_proc, 5);
885 --
886 chk_delete_performance_review (p_performance_review_id => p_rec.performance_review_id);
887 --
888 hr_utility.set_location(' Leaving:'||l_proc, 10);
889 End delete_validate;
890 --
891 -- ----------------------------------------------------------------------------
892 -- |--------------------< return_legislation_code >---------------------------|
893 -- ----------------------------------------------------------------------------
894 Function return_legislation_code
895 (p_performance_review_id in number
896 ) return varchar2 is
897 --
898 -- Cursor to find legislation code
899 --
900 cursor csr_leg_code is
901 select pbg.legislation_code
902 from per_business_groups pbg
903 , per_performance_reviews prv
904 , per_all_people per
905 where prv.performance_review_id = p_performance_review_id
906 and per.person_id = prv.person_id
907 and per.business_group_id = pbg.business_group_id;
908 --
909 -- Declare local variables
910 --
911 l_legislation_code varchar2(150);
912 l_proc varchar2(72) := 'return_legislation_code';
913 begin
914 hr_utility.set_location('Entering: '||l_proc,10);
915 hr_api.mandatory_arg_error
916 (p_api_name => l_proc
917 ,p_argument => 'performance_review_id'
918 ,p_argument_value => p_performance_review_id
919 );
920 if nvl(g_performance_review_id, hr_api.g_number) = p_performance_review_id then
921 --
922 -- The legislation code has already been found with a previous
923 -- call to this function. Just return the value in the global
924 -- variable.
925 --
926 l_legislation_code := g_legislation_code;
927 hr_utility.set_location(l_proc,20);
928 else
929 --
930 -- The ID is different to the last call to this function
931 -- or this is the first call to this function.
932 --
933 open csr_leg_code;
934 fetch csr_leg_code into l_legislation_code;
935 if csr_leg_code%notfound then
936 --
937 -- The primary key is invalid, therefore we must error
938 --
939 close csr_leg_code;
940 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
941 fnd_message.raise_error;
942 end if;
943 hr_utility.set_location(l_proc,30);
944 --
945 -- Set the global variables so the values are available
946 -- for the next call to this function.
947 --
948 close csr_leg_code;
949 g_performance_review_id := p_performance_review_id;
950 g_legislation_code := l_legislation_code;
951 end if;
952 hr_utility.set_location(' Leaving: '||l_proc, 40);
953 --
954 return l_legislation_code;
955 end return_legislation_code;
956 --
957 end per_prv_bus;