4 -- ----------------------------------------------------------------------------
1 Package Body per_obj_bus as
2 /* $Header: peobjrhi.pkb 120.20 2011/12/19 10:22:22 kgowripe ship $ */
3 --
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_obj_bus.'; -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |----------------------< chk_non_updateable_args >-----------------------|
13 -- ----------------------------------------------------------------------------
14 --
15 Procedure chk_non_updateable_args(p_rec in per_obj_shd.g_rec_type) is
16 --
17 l_proc varchar2(72) := g_package||'chk_non_updateable_args';
18 l_error exception;
19 l_argument varchar2(30);
20 --
21 Begin
22 hr_utility.set_location('Entering:'||l_proc, 5);
23 --
24 -- Only proceed with validation if a row exists for
25 -- the current record in the HR Schema
26 --
27 if not per_obj_shd.api_updating
28 (p_objective_id => p_rec.objective_id
29 ,p_object_version_number => p_rec.object_version_number
30 ) then
31 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
32 hr_utility.set_message_token('PROCEDURE', l_proc);
33 hr_utility.set_message_token('STEP', '5');
34 end if;
35 --
36 hr_utility.set_location(l_proc, 6);
37 --
38 if p_rec.business_group_id <> per_obj_shd.g_old_rec.business_group_id then
39 l_argument := 'business_group_id';
40 raise l_error;
41 elsif p_rec.appraisal_id <> per_obj_shd.g_old_rec.appraisal_id then
42 hr_utility.set_location(l_proc, 7);
43 l_argument := 'appraisal_id';
44 raise l_error;
45 elsif p_rec.owning_person_id <> per_obj_shd.g_old_rec.owning_person_id then
46 hr_utility.set_location(l_proc, 8);
47 l_argument := 'owning_person_id';
48 raise l_error;
49 end if;
50 hr_utility.set_location(l_proc, 11);
51 --
52 exception
53 when l_error then
54 hr_api.argument_changed_error
55 (p_api_name => l_proc
56 ,p_argument => l_argument
57 ,p_base_table => per_par_shd.g_tab_nam);
58 when others then
59 raise;
60 hr_utility.set_location(' Leaving:'||l_proc, 12);
61 end chk_non_updateable_args;
62 --
63 --
64 -----------------------------------------------------------------------------
65 -------------------------------<chk_appraisal>-------------------------------
66 -----------------------------------------------------------------------------
67 --
68 -- Description:
69 -- - Validates that the appraisal exists and is within the same business
70 -- group as that of objective
71 --
72 -- Pre_conditions:
73 -- - Valid Business group id
74 --
75 -- In Arguments:
76 -- p_appraisal_id
77 -- p_business_group_id
78 --
79 -- Post Success:
80 -- Process continues if :
81 -- All the in parameters are valid.
82 --
83 -- Post Failure:
84 -- An application error is raised and processing is terminated if any of
85 -- the following cases are found :
86 -- -- appraisal does not exist
87 -- -- appraisal exists but not with the same business group
88 --
89 -- Access Status
90 -- Internal Table Handler Use Only.
91 --
92 --
93 procedure chk_appraisal
94 (p_appraisal_id in per_objectives.appraisal_id%TYPE
95 ,p_business_group_id in per_objectives.business_group_id%TYPE
96 )
97 is
98 --
99 l_exists varchar2(1);
100 l_proc varchar2(72) := g_package||'chk_appraisal';
101 l_business_group_id per_objectives.business_group_id%TYPE;
102 --
103 --
104 -- Cursor to check if appraisal exists
105 --
106 Cursor csr_appraisal_exists
107 is
108 select business_group_id
109 from per_appraisals
110 where appraisal_id = p_appraisal_id;
111 --
112 begin
113 hr_utility.set_location('Entering:'|| l_proc, 1);
114 --
115 -- Check mandatory parameters have been set
116 --
117 hr_api.mandatory_arg_error
118 (p_api_name => l_proc
119 ,p_argument => 'business_group_id'
120 ,p_argument_value => p_business_group_id
121 );
122 --
123 hr_utility.set_location('Entering:'|| l_proc, 2);
124 --
125 if p_appraisal_id is not null then
126 open csr_appraisal_exists;
127 fetch csr_appraisal_exists into l_business_group_id;
128 if csr_appraisal_exists%notfound then
129 close csr_appraisal_exists;
130 hr_utility.set_message(801,'HR_52054_OBJ_APR_NOT_EXIST');
131 hr_utility.raise_error;
132 else
133 close csr_appraisal_exists;
134 end if;
135 --
136 -- check if appraisal is in the same business group
137 --
138 hr_utility.set_location('Entering:'|| l_proc, 3);
139 if l_business_group_id <> p_business_group_id then
140 hr_utility.set_message(801,'HR_52055_OBJ_DIFF_BUS_GRP');
141 hr_utility.raise_error;
142 end if;
143 end if;
144 --
145 hr_utility.set_location(l_proc, 4);
146 --
147 hr_utility.set_location('Leaving: '|| l_proc, 10);
148 --
149 exception
150 when app_exception.application_exception then
151 if hr_multi_message.exception_add
152 (p_associated_column1 => 'PER_OBJECTIVES.APPRAISAL_ID'
153 ) then
154 raise;
155 end if;
156
157 end chk_appraisal;
158 --
159 --
160 -----------------------------------------------------------------------------
161 -------------------------------<chk_upd_appraisal>-------------------------------
162 -----------------------------------------------------------------------------
163 --
164 -- Description:
165 -- - Update only when the existing value is null, otherwise error out
166 -- group as that of objective
167 --
168 --
169 -- In Arguments:
170 -- p_appraisal_id
171 --
172 -- Post Success:
173 -- Process continues if :
174 -- All the in parameters are valid.
175 --
176 -- Post Failure:
177 -- An application error is raised and processing is terminated if any of
178 -- the following cases are found :
179 -- -- appraisal does not exist
183 -- Internal Table Handler Use Only.
180 -- -- appraisal exists but not with the same business group
181 --
182 -- Access Status
184 --
185 --
186 procedure chk_upd_appraisal
187 (p_appraisal_id per_appraisals.appraisal_id%TYPE
188 )
189 is
190 --
191 l_exists varchar2(1);
192 l_proc varchar2(72) := g_package||'chk_upd_appraisal';
193 --
194 --
195 -- Cursor to check if appraisal exists
196 --
197 --
198 begin
199 hr_utility.set_location('Entering:'|| l_proc, 1);
200 --
201 -- Check mandatory parameters have been set
202 --
203 --
204 hr_utility.set_location('Entering:'|| l_proc, 2);
205 --
206 if( p_appraisal_id <> per_obj_shd.g_old_rec.appraisal_id ) then
207 if per_obj_shd.g_old_rec.appraisal_id is not null then
208 hr_utility.set_message(801,'HR_52055_OBJ_APPR_ID');
209 hr_utility.raise_error;
210 end if;
211 end if;
212 --
213 hr_utility.set_location(l_proc, 4);
214 --
215 hr_utility.set_location('Leaving: '|| l_proc, 10);
216 --
217 exception
218 when app_exception.application_exception then
219 if hr_multi_message.exception_add
220 (p_associated_column1 => 'PER_OBJECTIVES.APPRAISAL_ID'
221 ) then
222 raise;
223 end if;
224
225 end chk_upd_appraisal;
226 --
227 -----------------------------------------------------------------------------
228 -----------------------------<chk_owned_by_person>---------------------------
229 -----------------------------------------------------------------------------
230 --
231 -- Description:
232 -- - Validates that the person_id (owning_person_id) has been entered
233 -- as it is a mandatory column
234 -- - Validates that the person is in the same business group as the
235 -- objective
236 -- - Validates that the person is valid as of the effective date
237 -- - Validates that if an appraisal_id is entered then the owning_person_id
238 -- equals to the appraisee_id in per_appraisals.
239 --
240 -- Pre_conditions:
241 -- - Valid Business_group_id
242 --
243 -- In Arguments:
244 -- p_owning_person_id
245 -- p_effective_date
246 -- p_business_group_id
247 -- p_appraisal_id
248 --
249 -- Post Success:
250 -- Process continues if :
251 -- All the in parameters are valid.
252 --
253 -- Post Failure:
254 -- An application error is raised and processing is terminated if any of
255 -- the following cases are found :
256 -- -- owning_person_id is not set
257 -- -- effective_date is not set
258 -- -- person does not exist in the business group
259 -- -- person does not exist as of effective date
260 -- -- owning_person_id does to equal to appraisee_id in per_appraisals
261 -- if appraisal_id is entered.
262 --
263 -- Access Status
264 -- Internal Table Handler Use Only.
265 --
266 --
267 procedure chk_owned_by_person
268 (p_owning_person_id in per_objectives.owning_person_id%TYPE
269 ,p_business_group_id in per_objectives.business_group_id%TYPE
270 ,p_appraisal_id in per_objectives.appraisal_id%TYPE
271 ,p_effective_date in date
272 )
273 is
274 --
275 l_exists varchar2(1);
276 l_business_group_id per_objectives.business_group_id%TYPE;
277 l_proc varchar2(72) := g_package||'chk_owned_by_person';
278 --
279 --
280 -- Cursor to check if the person_exists
281 --
282 Cursor csr_person_bg
283 is
284 select business_group_id
285 from per_all_people_f
286 where person_id = p_owning_person_id;
287 --
288 --
289 -- Cursor to check if person is valid
290 -- as of effective date
291 --
295 from per_all_people_f
292 Cursor csr_person_valid_date
293 is
294 select 'Y'
296 where person_id = p_owning_person_id
297 and p_effective_date between
298 effective_start_date and nvl(effective_end_date,hr_api.g_eot);
299 --
300 --
301 -- Cursor to check if the owning_person_id is equal to
302 -- the appraisee_id in per_appraisals
303 --
304 Cursor csr_owned_by_person
305 is
306 select 'Y'
307 from per_appraisals
308 where appraisal_id = p_appraisal_id
309 and appraisee_person_id = p_owning_person_id;
310 --
311 begin
312 hr_utility.set_location('Entering:'|| l_proc, 1);
313 --
314 if (p_owning_person_id is NULL) then
315 hr_utility.set_message(801, 'HR_52056_OBJ_PERSON_NULL');
316 hr_utility.raise_error;
317 end if;
318 --
319 -- Check mandatory parameters have been set
320 --
321 hr_api.mandatory_arg_error
322 (p_api_name => l_proc
323 ,p_argument => 'effective_date'
324 ,p_argument_value => p_effective_date
325 );
326 --
327 --
328 -- Check mandatory parameters have been set
329 --
330 hr_api.mandatory_arg_error
331 (p_api_name => l_proc
332 ,p_argument => 'business_group_id'
333 ,p_argument_value => p_business_group_id
334 );
335 --
336 --
337 hr_utility.set_location('Entering:'|| l_proc, 2);
338 --
339 if p_owning_person_id is not null then
340 open csr_person_bg;
341 fetch csr_person_bg into l_business_group_id;
342 if csr_person_bg%notfound then
343 close csr_person_bg;
344 hr_utility.set_message(801,'HR_52057_OBJ_PERSON_NOT_EXIST');
345 hr_utility.raise_error;
346 else
347 close csr_person_bg;
348 end if;
349
350 hr_utility.set_location(l_proc, 3);
351 -- check if business group match
352 /*
353 if p_business_group_id <> l_business_group_id then
354 hr_utility.set_message(801,'HR_52058_OBJ_PERSON_DIFF_BG');
355 hr_utility.raise_error;
356 end if;
357 */
358 hr_utility.set_location(l_proc, 4);
359 -- check if person is valid as of effective date
360 open csr_person_valid_date;
361 fetch csr_person_valid_date into l_exists;
362 if csr_person_valid_date%notfound then
363 close csr_person_valid_date;
364 hr_utility.set_message(801,'HR_52059_OBJ_PERSON_DATE_RANGE');
365 hr_utility.raise_error;
366 else
367 close csr_person_valid_date;
368 end if;
369
370 hr_utility.set_location(l_proc, 5);
371 /*
372 -- check if owning_person_id = appraisee_id in per_appraisals
373 -- Only perform the check if the appraisal_id is populated
374 if p_appraisal_id is not null then
375 open csr_owned_by_person;
376 fetch csr_owned_by_person into l_exists;
377 if csr_owned_by_person%notfound then
378 close csr_owned_by_person;
379 hr_utility.set_message(801,'HR_52060_OBJ_NOT_EQ_APPRAISEE');
380 hr_utility.raise_error;
381 else
382 close csr_owned_by_person;
383 end if;
384 end if;*/
385 end if;
386 --
387 hr_utility.set_location('Leaving: '|| l_proc, 10);
388 --
389 exception
390 when app_exception.application_exception then
391 if hr_multi_message.exception_add
392 (p_associated_column1 => 'PER_OBJECTIVES.OWNING_PERSON_ID'
393 ) then
394 raise;
395 end if;
396
397 end chk_owned_by_person;
398 --
399 -- ---------------------------------------------------------------------
400 -- |-----------------------< chk_next_review_date >--------------------|
401 -- ---------------------------------------------------------------------
402 --
403 -- Description:
404 -- Validates that next_review_date is not later than start_date.
405 --
406 -- Pre-Requisites:
407 -- None.
408 --
409 -- In Parameters:
410 -- p_objective_id
411 -- p_start_date
412 -- p_next_review_date
413 -- p_object_version_number
414 --
415 -- Post Success:
416 -- Processing continues if next_review_date is later than start_date
417 -- or if next_review_date is not entered.
418 --
419 -- Post Failure:
420 -- An Application Error is raised and processing is terminated if
421 -- next_review_date is invalid.
422 --
423 -- Access Status:
424 -- Internal Development use only.
425 --
426 -- ---------------------------------------------------------------------
427 procedure chk_next_review_date
428 (p_objective_id in per_objectives.objective_id%TYPE
429 ,p_start_date in per_objectives.start_date%TYPE
430 ,p_next_review_date in per_objectives.next_review_date%TYPE
431 ,p_object_version_number in per_objectives.object_version_number%TYPE
432 ) is
433 --
434 l_proc varchar2(72) := g_package||'chk_next_review_date';
435 --
436 begin
437 --
438 hr_utility.set_location('Entering:'|| l_proc,5);
439 --
440 if p_next_review_date < p_start_date then
441 hr_utility.set_message(800,'HR_INV_NEXT_REV_DATE');
442 hr_utility.raise_error;
443 end if;
444 --
445 hr_utility.set_location(' Leaving:'||l_proc, 10);
446 --
447 exception
448 when app_exception.application_exception then
449 if hr_multi_message.exception_add
453 end if;
450 (p_associated_column1 => 'PER_OBJECTIVES.NEXT_REVIEW_DATE'
451 ) then
452 raise;
454 end chk_next_review_date;
455 --
456 -- ---------------------------------------------------------------------
457 -- |-----------------------< chk_target_date >-------------------------|
458 -- ---------------------------------------------------------------------
459 --
460 -- Description:
461 -- Validates that target_date is later than start_date.
462 --
463 -- Pre-Requisites:
464 -- None.
465 --
466 -- In Parameters:
467 -- p_objective_id
468 -- p_start_date
469 -- p_target_date
470 -- p_object_version_number
471 --
472 -- Post Success:
473 -- Processing continues if target_date is not later than start_date
474 -- or if target_date is not entered.
475 --
476 -- Post Failure:
477 -- An Application Error is raised and processing is terminated if
478 -- start_date is invalid.
479 --
480 -- Access Status:
481 -- Internal Development use only.
482 --
483 -- ---------------------------------------------------------------------
484 procedure chk_target_date
485 (p_objective_id in per_objectives.objective_id%TYPE
486 ,p_start_date in per_objectives.start_date%TYPE
487 ,p_target_date in per_objectives.target_date%TYPE
488 ,p_object_version_number in per_objectives.object_version_number%TYPE
489 ) is
490 --
491 l_proc varchar2(72) := g_package||'chk_target_date';
492 --
493 begin
494 --
495 hr_utility.set_location('Entering:'|| l_proc,5);
496 --
497 if p_target_date < p_start_date then
498 hr_utility.set_message(800,'PER_52552_TARGET_DATE');
499 hr_utility.raise_error;
500 end if;
501 --
502 hr_utility.set_location(' Leaving:'||l_proc, 10);
503 --
504 exception
505 when app_exception.application_exception then
506 if hr_multi_message.exception_add
507 (p_associated_column1 => 'PER_OBJECTIVES.TARGET_DATE'
508 ) then
509 raise;
510 end if;
511
512 end chk_target_date;
513 --
514 --
515 -- ---------------------------------------------------------------------
516 -- |------------------------< chk_achiev_date >------------------------|
517 -- ---------------------------------------------------------------------
518 --
519 -- Description:
520 -- Validates that achievement_date is later than start_date.
521 --
522 -- Pre-Requisites:
523 -- None.
524 --
525 -- In Parameters:
526 -- p_objective_id
527 -- p_start_date
528 -- p_achievement_date
529 -- p_complete_percent
530 -- p_appraisal_id
531 -- p_object_version_number
532 --
533 -- Post Success:
534 -- Processing continues if achievement_date is not later than
535 -- start_date or if achievement_date is not entered.
536 --
537 -- Post Failure:
538 -- An Application Error is raised and processing is terminated if
539 -- start_date is invalid.
540 --
541 -- Access Status:
542 -- Internal Development use only.
543 --
544 -- ---------------------------------------------------------------------
545 procedure chk_achiev_date
546 (p_objective_id in per_objectives.objective_id%TYPE
547 ,p_start_date in per_objectives.start_date%TYPE
548 ,p_achievement_date in per_objectives.achievement_date%TYPE
549 ,p_complete_percent in per_objectives.complete_percent%TYPE
550 ,p_appraisal_id in per_objectives.appraisal_id%TYPE
551 ,p_object_version_number in per_objectives.object_version_number%TYPE
552 ,p_scorecard_id IN per_objectives.scorecard_id%TYPE -- new parameter added for for fixing bug#5947176...
553 ) is
554 --
555 l_proc varchar2(72) := g_package||'chk_achiev_date';
556 l_is_new_appraisal varchar2(1);
557 --
558 -- Cursor to check if the appraisal is new or old
559 --
560 cursor csr_is_new_appraisal
561 is
562 select 'Y'
563 from per_appraisals appr,
564 per_appraisal_templates templ
565 where appr.appraisal_id = p_appraisal_id
566 and appr.appraisal_template_id = templ.appraisal_template_id
567 and templ.objective_asmnt_type_id is not null;
568 --
569 --
570 begin
571 --
572 hr_utility.set_location('Entering:'|| l_proc,5);
573 --
574 if p_achievement_date < p_start_date then
575 hr_utility.set_message(800,'PER_52553_ACHIEV_DATE');
576 hr_utility.raise_error;
577 end if;
578 --
579 hr_utility.set_location(' Leaving:'||l_proc, 10);
580 --
581 -- Following fix has raised a regression issue in 5201522
582 -- Removing this check
583 --
584 --fix for Bug 5186559
585
586 ----change the p_appraisal_id IS NULL condition to p_scorecard_id IS NOT NULL for for fixing bug#5947176
587 if ( p_achievement_date > trunc(sysdate) and p_scorecard_id is not null ) then
588 hr_utility.set_message(800,'HR_WPM_INV_FUTURE_ACH_DATE');
589 hr_utility.raise_error;
590 end if;
591 -- end of fix for bug 5186559
592
593 --
594 if (p_appraisal_id is not null) then
595 open csr_is_new_appraisal;
596 fetch csr_is_new_appraisal into l_is_new_appraisal;
597 if csr_is_new_appraisal%found then
598 close csr_is_new_appraisal;
599 else
600 close csr_is_new_appraisal;
601 return;
605 hr_utility.set_location(' Leaving:'||l_proc, 12);
602 end if;
603 end if;
604 --
606 --
607 /* if ((p_achievement_date is not null)
608 and ((p_complete_percent is null) or (p_complete_percent <> 100))) then
609 hr_utility.set_message(800,'HR_INV_CMPL_PERC_ACHIEV_DATE');
610 hr_utility.raise_error;
611 end if;*/
612 --
613 hr_utility.set_location(' Leaving:'||l_proc, 15);
614 --
615 exception
616 when app_exception.application_exception then
617 if hr_multi_message.exception_add
618 (p_associated_column1 => 'PER_OBJECTIVES.ACHIEVEMENT_DATE'
619 ) then
620 raise;
621 end if;
622
623 end chk_achiev_date;
624 --
625 -------------------------------------------------------------------------------
626 ------------------------------<chk_objective_delete>---------------------------
627 -------------------------------------------------------------------------------
628 --
629 -- Description:
630 -- - Validates that an objective cannot be deleted if:
631 -- objective is referenced in:
632 -- - per_performance_ratings
633 --
634 -- Pre_conditions:
635 -- - A valid objective_id
636 --
637 -- In Arguments:
638 -- p_objective_id
639 -- p_object_version_number
640 --
641 -- Post Success:
642 -- Process continues if :
643 -- All the in parameters are valid.
644 --
645 -- Post Failure:
646 -- An application error is raised and processing is terminated if any of
647 -- the following cases are found :
648 -- - objective is referenced in per_performance_ratings
649 --
650 -- Access Status
651 -- Internal Table Handler Use Only.
652 --
653 procedure chk_objective_delete
654 (p_objective_id in per_objectives.objective_id%TYPE
655 ,p_object_version_number in per_objectives.object_version_number%TYPE
656 )
657 is
658 --
659 l_exists varchar2(1);
660 l_proc varchar2(72) := g_package||'chk_objective_delete';
661 --
662 --
663 -- Cursor to check if the objective is used in per_performance_ratings
664 --
665 cursor csr_apr_exits_in_perf_rat
666 is
667 select 'Y'
668 from per_performance_ratings
669 where objective_id = p_objective_id;
670 --
671 -- Cursor to check if the objective is aligned with other objectives
672 --
673 cursor csr_is_obj_aligned
674 is
675 select 'Y'
676 from per_objectives
677 where aligned_with_objective_id = p_objective_id;
678 --
679 --
680 begin
681 hr_utility.set_location('Entering:'|| l_proc, 1);
682 --
683 -- Check mandatory parameters have been set
684 --
685 hr_api.mandatory_arg_error
686 (p_api_name => l_proc
687 ,p_argument => 'objective_id'
688 ,p_argument_value => p_objective_id
689 );
690 --
691 hr_utility.set_location(l_proc, 2);
692 --
693 open csr_apr_exits_in_perf_rat;
694 fetch csr_apr_exits_in_perf_rat into l_exists;
695 if csr_apr_exits_in_perf_rat%found then
696 close csr_apr_exits_in_perf_rat;
697 hr_utility.set_message(801,'HR_52061_OBJ_IN_PERF_RAT');
698 hr_utility.raise_error;
699 else
700 close csr_apr_exits_in_perf_rat;
701 open csr_is_obj_aligned;
702 fetch csr_is_obj_aligned into l_exists;
703 if csr_is_obj_aligned%found then
704 close csr_is_obj_aligned;
705 hr_utility.set_message(801,'HR_52061_OBJ_IN_PERF_RAT');
706 hr_utility.raise_error;
707 else
708 close csr_is_obj_aligned;
709 end if;
710 --
711 end if;
712 --
713 hr_utility.set_location('Leaving: '|| l_proc, 10);
714 exception
715 when app_exception.application_exception then
716 if hr_multi_message.exception_add
717 (p_associated_column1 => 'PER_OBJECTIVES.OBJECTIVE_ID'
718 ) then
719 raise;
720 end if;
721
722 end chk_objective_delete;
723 --
724 -- ----------------------------------------------------------------------------
725 -- |----------------------------< chk_group_code >----------------------------|
726 -- ----------------------------------------------------------------------------
727 -- {Start Of Comments}
728 --
729 -- Description:
730 -- Checks that the group code is a valid lookup code in HR_WPM_GROUP.
731 --
732 -- Prerequisites:
733 -- None.
734 --
735 -- In Arguments:
736 --
737 --
738 -- Post Success:
739 -- Processing continues if the dates are valid.
740 --
741 -- Post Failure:
742 -- A warning message is displayed
743 --
744 -- Access Status:
745 -- Internal Row Handler Use Only.
746 --
747 -- {End Of Comments}
748 -- ----------------------------------------------------------------------------
749 procedure chk_group_code
750 (p_objective_id in number
751 ,p_object_version_number in number
752 ,p_effective_date in date
753 ,p_group_code in varchar2
754 ) is
755
756 -- Declare local variables
757
758 l_proc varchar2(72) := g_package||'chk_group_code';
759 l_api_updating boolean;
760
761 begin
762
763 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 1); END IF;
767 -- a) The current g_old_rec is current and
764
765 --
766 -- Only proceed with validation if :
768 -- b) The date values have changed
769 --
770 l_api_updating := per_obj_shd.api_updating
771 (p_objective_id => p_objective_id
772 ,p_object_version_number => p_object_version_number);
773 --
774 IF (l_api_updating
775 AND nvl(per_obj_shd.g_old_rec.group_code, hr_api.g_varchar2)
776 = nvl(p_group_code, hr_api.g_varchar2))
777 THEN
778 RETURN;
779 END IF;
780
781 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
782
783 --
784 -- Checks that the group code is valid
785 --
786 if p_group_code is not null then
787 if hr_api.not_exists_in_hr_lookups
788 (p_effective_date => p_effective_date
789 ,p_lookup_type => 'HR_WPM_GROUP'
790 ,p_lookup_code => p_group_code
791 ) then
792 -- Error: Invalid Group
793 fnd_message.set_name('PER', 'HR_50188_WPM_INV_GROUP');
794 fnd_message.raise_error;
795 end if;
796 end if;
797
798 IF g_debug THEN hr_utility.set_location(' Leaving:'|| l_proc, 970); END IF;
799
800 exception
801 when app_exception.application_exception then
802 if hr_multi_message.exception_add
803 (p_associated_column1 => 'PER_OBJECTIVES.GROUP_CODE'
804 ) then
805 hr_utility.set_location(' Leaving:'||l_proc, 980);
806 raise;
807 end if;
808 hr_utility.set_location(' Leaving:'||l_proc, 990);
809 --
810 end chk_group_code;
811 --
812 -- ----------------------------------------------------------------------------
813 -- |--------------------------< chk_priority_code >---------------------------|
814 -- ----------------------------------------------------------------------------
815 -- {Start Of Comments}
816 --
817 -- Description:
818 -- Checks that the priority code is a valid lookup code in HR_WPM_PRIORITY.
819 --
820 -- Prerequisites:
821 -- None.
822 --
823 -- In Arguments:
824 --
825 --
826 -- Post Success:
827 -- Processing continues if the priority code is valid.
828 --
829 -- Post Failure:
830 -- An application error is raised if the priority code is invalid.
831 --
832 -- Access Status:
833 -- Internal Row Handler Use Only.
834 --
835 -- {End Of Comments}
836 -- ----------------------------------------------------------------------------
837 procedure chk_priority_code
838 (p_objective_id in number
839 ,p_object_version_number in number
840 ,p_effective_date in date
841 ,p_priority_code in varchar2
842 ) is
843
844 -- Declare local variables
845
846 l_proc varchar2(72) := g_package||'chk_priority_code';
847 l_api_updating boolean;
848
849 begin
850
851 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 1); END IF;
852
853 --
854 -- Only proceed with validation if :
855 -- a) The current g_old_rec is current and
856 -- b) The date values have changed
857 --
858 l_api_updating := per_obj_shd.api_updating
859 (p_objective_id => p_objective_id
860 ,p_object_version_number => p_object_version_number);
861 --
862 IF (l_api_updating
863 AND nvl(per_obj_shd.g_old_rec.priority_code, hr_api.g_varchar2)
864 = nvl(p_priority_code, hr_api.g_varchar2))
865 THEN
866 RETURN;
867 END IF;
868
869 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
870
871 --
872 -- Checks that the priority code is valid
873 --
874 if p_priority_code is not null then
875 if hr_api.not_exists_in_hr_lookups
876 (p_effective_date => p_effective_date
877 ,p_lookup_type => 'HR_WPM_PRIORITY'
878 ,p_lookup_code => p_priority_code
879 ) then
880 -- Error: Invalid Group
881 fnd_message.set_name('PER', 'HR_50189_WPM_INV_PRIORITY');
882 fnd_message.raise_error;
883 end if;
884 end if;
885
886 IF g_debug THEN hr_utility.set_location(' Leaving:'|| l_proc, 970); END IF;
887
888 exception
889 when app_exception.application_exception then
890 if hr_multi_message.exception_add
891 (p_associated_column1 => 'PER_OBJECTIVES.PRIORITY_CODE'
892 ) then
893 hr_utility.set_location(' Leaving:'||l_proc, 980);
894 raise;
895 end if;
896 hr_utility.set_location(' Leaving:'||l_proc, 990);
897
898 end chk_priority_code;
899 --
900 -- ----------------------------------------------------------------------------
901 -- |--------------------------< chk_appraise_flag >---------------------------|
902 -- ----------------------------------------------------------------------------
903 -- {Start Of Comments}
904 --
905 -- Description:
906 -- Checks that the appraise flag is set to a valid value.
907 --
908 -- Prerequisites:
909 -- None.
910 --
911 -- In Arguments:
912 --
913 --
914 -- Post Success:
915 -- Processing continues if the appraise flag is valid.
916 --
917 -- Post Failure:
918 -- An application error is raised if the appraise flag is invalid.
919 --
920 -- Access Status:
921 -- Internal Row Handler Use Only.
922 --
923 -- {End Of Comments}
924 -- ----------------------------------------------------------------------------
925 procedure chk_appraise_flag
926 (p_objective_id in number
927 ,p_object_version_number in number
928 ,p_effective_date in date
929 ,p_appraise_flag in varchar2
930 ,p_scorecard_id in number
931 ) is
932
933 -- Declare local variables
934
935 l_proc varchar2(72) := g_package||'chk_appraise_flag';
936 l_api_updating boolean;
937
938 begin
939
940 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 1); END IF;
941
942 IF p_scorecard_id IS NOT null THEN
943 --
944 hr_api.mandatory_arg_error
945 (p_api_name => l_proc
946 ,p_argument => 'p_appraise_flag'
947 ,p_argument_value => p_appraise_flag
948 );
949
950 --
951 -- Only proceed with validation if :
952 -- a) The current g_old_rec is current and
953 -- b) The date values have changed
954 --
955 l_api_updating := per_obj_shd.api_updating
956 (p_objective_id => p_objective_id
957 ,p_object_version_number => p_object_version_number);
958 --
959 IF (l_api_updating
960 AND nvl(per_obj_shd.g_old_rec.appraise_flag, hr_api.g_varchar2)
961 = nvl(p_appraise_flag, hr_api.g_varchar2))
962 THEN
963 RETURN;
964 END IF;
965
966 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
967
968 --
969 -- Checks that the appraise flag is valid
970 --
971 if hr_api.not_exists_in_hr_lookups
972 (p_effective_date => p_effective_date
973 ,p_lookup_type => 'YES_NO'
974 ,p_lookup_code => p_appraise_flag
975 ) then
976 -- Error: Invalid Group
977 fnd_message.set_name('PER', 'HR_50199_WPM_APPRAISE_FLAG');
978 fnd_message.raise_error;
979 end if;
980 END IF;
981
982 IF g_debug THEN hr_utility.set_location(' Leaving:'|| l_proc, 970); END IF;
983
984 exception
985 when app_exception.application_exception then
986 if hr_multi_message.exception_add
987 (p_associated_column1 => 'PER_OBJECTIVES.APPRAISE_FLAG'
988 ) then
989 hr_utility.set_location(' Leaving:'||l_proc, 980);
990 raise;
991 end if;
992 hr_utility.set_location(' Leaving:'||l_proc, 990);
993
994 end chk_appraise_flag;
995 --
996 -- ----------------------------------------------------------------------------
997 -- |------------------------< chk_complete_percent >-------------------------|
998 -- ----------------------------------------------------------------------------
999 -- {Start Of Comments}
1000 --
1001 -- Description:
1002 -- Checks that the complete percent is between 0 and 100, both included.
1003 --
1004 -- Prerequisites:
1005 --
1006 -- In Arguments:
1007 --
1008 --
1009 -- Post Success:
1010 -- Processing continues if the complete percent is valid.
1011 --
1012 -- Post Failure:
1013 -- An application error is raised if the complete percent is invalid.
1014 --
1015 -- Access Status:
1016 -- Internal Row Handler Use Only.
1017 --
1018 -- {End Of Comments}
1019 -- ----------------------------------------------------------------------------
1020 procedure chk_complete_percent
1021 (p_objective_id in number
1022 ,p_object_version_number in number
1023 ,p_complete_percent in number
1024 ) is
1025
1026 -- Declare local variables
1027
1028 l_proc varchar2(72) := g_package||'chk_complete_percent';
1029 l_api_updating boolean;
1030
1031 begin
1032
1033 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 1); END IF;
1034
1035 --
1036 -- Only proceed with validation if :
1037 -- a) The current g_old_rec is current and
1038 -- b) The date values have changed
1039 --
1040 l_api_updating := per_obj_shd.api_updating
1041 (p_objective_id => p_objective_id
1042 ,p_object_version_number => p_object_version_number);
1043 --
1044 IF (l_api_updating
1045 AND nvl(per_obj_shd.g_old_rec.complete_percent, hr_api.g_number)
1046 = nvl(p_complete_percent, hr_api.g_number))
1047 THEN
1048 RETURN;
1049 END IF;
1050
1054
1051 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1052
1053 if p_complete_percent is not null then
1055 IF g_debug THEN hr_utility.set_location(l_proc, 30); END IF;
1056 --
1057 -- Checks that the complete_percent is between 0 and 100
1058 -- and raises error if it is otherwise
1059 --
1060 if (p_complete_percent < 0 ) then
1061 fnd_message.set_name('PER','HR_INV_CMPL_PERC');
1062 fnd_message.raise_error;
1063 end if;
1064
1065 IF g_debug THEN hr_utility.set_location(l_proc, 40); END IF;
1066
1067 end if;
1068
1069 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1070
1071 exception
1072 when app_exception.application_exception then
1073 if hr_multi_message.exception_add
1074 (p_associated_column1 => 'PER_OBJECTIVES.COMPLETE_PERCENT'
1075 ) then
1076 hr_utility.set_location(' Leaving:'||l_proc, 980);
1077 raise;
1078 end if;
1079 hr_utility.set_location(' Leaving:'||l_proc, 990);
1080
1081 end chk_complete_percent;
1082 --
1083 -- ----------------------------------------------------------------------------
1084 -- |------------------------< chk_weighting_percent >-------------------------|
1085 -- ----------------------------------------------------------------------------
1086 -- {Start Of Comments}
1087 --
1088 -- Description:
1089 -- Checks that the weighting value is not negative. (removed)
1090 -- Checks that the weighting percent is not greater than 100.
1091 -- Checks if the objective has been marked to be included in appraisals.
1092 -- Checks that the weighting_percent is a valid lookup value
1093 --
1094 -- Prerequisites:
1095 -- That the appraise flag has already been validated.
1096 --
1097 -- In Arguments:
1098 --
1099 --
1100 -- Post Success:
1101 -- Processing continues if the weighting percent is valid.
1102 --
1103 -- Post Failure:
1104 -- An application error is raised if the weighting percent is invalid.
1105 --
1106 -- Access Status:
1107 -- Internal Row Handler Use Only.
1108 --
1109 -- {End Of Comments}
1110 -- ----------------------------------------------------------------------------
1111 procedure chk_weighting_percent
1112 (p_objective_id in number
1113 ,p_object_version_number in number
1114 ,p_effective_date in date
1115 ,p_appraise_flag in varchar2
1116 ,p_weighting_percent in number
1117 ,p_weighting_over_100_warning out nocopy boolean
1118 ,p_weighting_appraisal_warning out nocopy boolean
1119 ) is
1120
1121
1122 -- Declare local variables
1123
1124 l_proc varchar2(72) := g_package||'chk_weighting_percent';
1125 l_api_updating boolean;
1126
1127 begin
1128
1129 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 1); END IF;
1130
1131 --
1132 -- Only proceed with validation if :
1133 -- a) The current g_old_rec is current and
1134 -- b) The date values have changed
1135 --
1136 l_api_updating := per_obj_shd.api_updating
1137 (p_objective_id => p_objective_id
1138 ,p_object_version_number => p_object_version_number);
1139 --
1140 IF (l_api_updating
1141 AND nvl(per_obj_shd.g_old_rec.appraise_flag, hr_api.g_varchar2)
1142 = nvl(p_appraise_flag, hr_api.g_varchar2)
1143 AND nvl(per_obj_shd.g_old_rec.weighting_percent, hr_api.g_number)
1144 = nvl(p_weighting_percent, hr_api.g_number))
1145 THEN
1146 RETURN;
1147 END IF;
1148
1149 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1150
1151 if p_weighting_percent is not null then
1152
1153 IF g_debug THEN hr_utility.set_location(l_proc, 30); END IF;
1154 --
1155 -- Warn if the objective is not marked for appraisal.
1156 --
1157 if hr_multi_message.no_exclusive_error
1158 (p_check_column1 => 'PER_OBJECTIVES.APPRAISE_FLAG'
1159 ,p_associated_column1 => 'PER_OBJECTIVES.APPRAISE_FLAG'
1160 ) then
1161 p_weighting_appraisal_warning := (p_appraise_flag = 'N');
1162 end if;
1163
1164 IF g_debug THEN hr_utility.set_location(l_proc, 40); END IF;
1165 --
1166 -- Checks that the weighting_percent is a valid lookup value
1167 --
1168 if hr_api.not_exists_in_hr_lookups
1169 (p_effective_date => p_effective_date
1170 ,p_lookup_type => 'HR_WPM_WEIGHTING'
1171 ,p_lookup_code => p_weighting_percent
1172 ) then
1173 -- Error: Invalid Group
1174 fnd_message.set_name('PER', 'HR_50193_WPM_WEIGHT_VALUE');
1175 fnd_message.raise_error;
1176 end if;
1177
1178 IF g_debug THEN hr_utility.set_location(l_proc, 50); END IF;
1179 --
1180 -- Warns that the weighting percent is greater than 100
1181 --
1182 p_weighting_over_100_warning := (p_weighting_percent > 100);
1183
1184 end if;
1185
1186 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1187
1188 exception
1189 when app_exception.application_exception then
1190 if hr_multi_message.exception_add
1191 (p_associated_column1 => 'PER_OBJECTIVES.WEIGHTING_PERCENT'
1192 ) then
1193 hr_utility.set_location(' Leaving:'||l_proc, 980);
1194 raise;
1195 end if;
1196 hr_utility.set_location(' Leaving:'||l_proc, 990);
1197
1198 end chk_weighting_percent;
1199 --
1203 -- {Start Of Comments}
1200 -- ----------------------------------------------------------------------------
1201 -- |--------------------------< chk_measurement_style_code >------------------|
1202 -- ----------------------------------------------------------------------------
1204 --
1205 -- Description:
1206 -- Checks that the measurement style code is a valid lookup code.
1207 --
1208 -- Prerequisites:
1209 -- None.
1210 --
1211 -- In Arguments:
1212 --
1213 --
1214 -- Post Success:
1215 -- Processing continues if the measurement style code is valid.
1216 --
1217 -- Post Failure:
1218 -- An application error is raised if the measurement style code is invalid.
1219 --
1220 -- Access Status:
1221 -- Internal Row Handler Use Only.
1222 --
1223 -- {End Of Comments}
1224 -- ----------------------------------------------------------------------------
1225 procedure chk_measurement_style_code
1226 (p_objective_id in number
1227 ,p_object_version_number in number
1228 ,p_effective_date in date
1229 ,p_measurement_style_code in varchar2
1230 ,p_scorecard_id in number
1231 ) is
1232
1233 -- Declare local variables
1234
1235 l_proc varchar2(72) := g_package||'chk_measurement_style_code';
1236 l_api_updating boolean;
1237
1238 begin
1239
1240 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 1); END IF;
1241
1242 IF p_scorecard_id IS NOT null THEN
1243 --
1244 hr_api.mandatory_arg_error
1245 (p_api_name => l_proc
1246 ,p_argument => 'p_measurement_style_code'
1247 ,p_argument_value => p_measurement_style_code
1248 );
1249
1250 --
1251 -- Only proceed with validation if :
1252 -- a) The current g_old_rec is current and
1253 -- b) The date values have changed
1254 --
1255 l_api_updating := per_obj_shd.api_updating
1256 (p_objective_id => p_objective_id
1257 ,p_object_version_number => p_object_version_number);
1258 --
1259 IF (l_api_updating
1260 AND nvl(per_obj_shd.g_old_rec.measurement_style_code, hr_api.g_varchar2)
1261 = nvl(p_measurement_style_code, hr_api.g_varchar2))
1262 THEN
1263 RETURN;
1264 END IF;
1265
1266 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1267
1268 --
1269 -- Checks that the measurement_style_code is valid
1270 --
1271 if hr_api.not_exists_in_hr_lookups
1272 (p_effective_date => p_effective_date
1273 ,p_lookup_type => 'HR_WPM_MEASURE'
1274 ,p_lookup_code => p_measurement_style_code
1275 ) then
1276 -- Error: Invalid Group
1277 fnd_message.set_name('PER', 'HR_50194_WPM_INV_MEASR_STYL');
1278 fnd_message.raise_error;
1279 end if;
1280
1281 END IF;
1282
1283 IF g_debug THEN hr_utility.set_location(' Leaving:'|| l_proc, 970); END IF;
1284
1285 exception
1286 when app_exception.application_exception then
1287 if hr_multi_message.exception_add
1288 (p_associated_column1 => 'PER_OBJECTIVES.MEASUREMENT_STYLE_CODE'
1289 ) then
1290 hr_utility.set_location(' Leaving:'||l_proc, 980);
1291 raise;
1292 end if;
1293 hr_utility.set_location(' Leaving:'||l_proc, 990);
1294
1295 end chk_measurement_style_code;
1296 --
1297 -- ----------------------------------------------------------------------------
1298 -- |--------------------------< chk_measure_name >----------------------------|
1299 -- ----------------------------------------------------------------------------
1300 -- {Start Of Comments}
1301 --
1302 -- Description:
1303 -- Checks that the measure name has been entered when the measurement style
1304 -- is quantitative or qualitative.
1305 --
1306 -- Prerequisites:
1307 -- That the measurement style code has been validated without error.
1308 --
1309 -- In Arguments:
1310 --
1311 --
1312 -- Post Success:
1313 -- Processing continues if the measure name has been entered.
1314 --
1315 -- Post Failure:
1316 -- An application error is raised if the measure name has not been entered
1317 -- when required.
1318 --
1319 -- Access Status:
1320 -- Internal Row Handler Use Only.
1321 --
1322 -- {End Of Comments}
1323 -- ----------------------------------------------------------------------------
1324 procedure chk_measure_name
1325 (p_objective_id in number
1326 ,p_object_version_number in number
1327 ,p_measurement_style_code in varchar2
1328 ,p_measure_name in varchar2
1329 ) is
1330
1331 -- Declare local variables
1332
1333 l_proc varchar2(72) := g_package||'chk_measure_name';
1334 l_api_updating boolean;
1335
1336 begin
1337
1338 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 1); END IF;
1339
1340 --
1341 -- Only proceed with validation if :
1342 -- a) The current g_old_rec is current and
1343 -- b) The date values have changed
1344 --
1345 l_api_updating := per_obj_shd.api_updating
1346 (p_objective_id => p_objective_id
1347 ,p_object_version_number => p_object_version_number);
1348 --
1349 IF (l_api_updating
1350 AND nvl(per_obj_shd.g_old_rec.measurement_style_code, hr_api.g_varchar2)
1351 = nvl(p_measurement_style_code, hr_api.g_varchar2)
1355 RETURN;
1352 AND nvl(per_obj_shd.g_old_rec.measure_name, hr_api.g_varchar2)
1353 = nvl(p_measure_name, hr_api.g_varchar2))
1354 THEN
1356 END IF;
1357
1358 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1359
1360 if hr_multi_message.no_exclusive_error
1361 (p_check_column1 => 'PER_OBJECTIVES.MEASUREMENT_STYLE_CODE'
1362 ,p_associated_column1 => 'PER_OBJECTIVES.MEASUREMENT_STYLE_CODE'
1363 ) then
1364
1365 if p_measurement_style_code <> 'N_M'
1366 then
1367 IF g_debug THEN hr_utility.set_location(l_proc, 30); END IF;
1368
1369 hr_api.mandatory_arg_error
1370 (p_api_name => l_proc
1371 ,p_argument => 'p_measure_name'
1372 ,p_argument_value => p_measure_name
1373 );
1374 end if;
1375
1376 end if;
1377
1378 IF g_debug THEN hr_utility.set_location(' Leaving:'|| l_proc, 970); END IF;
1379
1380 exception
1381 when app_exception.application_exception then
1382 if hr_multi_message.exception_add
1383 (p_associated_column1 => 'PER_OBJECTIVES.MEASURE_NAME'
1384 ) then
1385 hr_utility.set_location(' Leaving:'||l_proc, 980);
1386 raise;
1387 end if;
1388 hr_utility.set_location(' Leaving:'||l_proc, 990);
1389
1390 end chk_measure_name;
1391 --
1392 -- ----------------------------------------------------------------------------
1393 -- |--------------------------< chk_target_value >----------------------------|
1394 -- ----------------------------------------------------------------------------
1395 -- {Start Of Comments}
1396 --
1397 -- Description:
1398 -- Checks that the target value hs been entered when the measurement style
1399 -- is quantitative.
1400 --
1401 -- Prerequisites:
1402 -- That the measurement style code has been validated without error.
1403 --
1404 -- In Arguments:
1405 --
1406 --
1407 -- Post Success:
1408 -- Processing continues if the target value has been entered.
1409 --
1410 -- Post Failure:
1411 -- An application error is raised if the target value has not been entered
1412 -- when required.
1413 --
1414 -- Access Status:
1415 -- Internal Row Handler Use Only.
1416 --
1417 -- {End Of Comments}
1418 -- ----------------------------------------------------------------------------
1419 procedure chk_target_value
1420 (p_objective_id in number
1421 ,p_object_version_number in number
1422 ,p_measurement_style_code in varchar2
1423 ,p_target_value in number
1424 ) is
1425
1426 -- Declare local variables
1427
1428 l_proc varchar2(72) := g_package||'chk_target_value';
1429 l_api_updating boolean;
1430
1431 begin
1432
1433 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 1); END IF;
1434
1435 --
1436 -- Only proceed with validation if :
1437 -- a) The current g_old_rec is current and
1438 -- b) The date values have changed
1439 --
1440 l_api_updating := per_obj_shd.api_updating
1441 (p_objective_id => p_objective_id
1442 ,p_object_version_number => p_object_version_number);
1443 --
1444 IF (l_api_updating
1445 AND nvl(per_obj_shd.g_old_rec.measurement_style_code, hr_api.g_varchar2)
1446 = nvl(p_measurement_style_code, hr_api.g_varchar2)
1447 AND nvl(per_obj_shd.g_old_rec.target_value, hr_api.g_number)
1448 = nvl(p_target_value, hr_api.g_number))
1449 THEN
1450 RETURN;
1451 END IF;
1452
1453 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1454
1455 if hr_multi_message.no_exclusive_error
1456 (p_check_column1 => 'PER_OBJECTIVES.MEASUREMENT_STYLE_CODE'
1457 ,p_associated_column1 => 'PER_OBJECTIVES.MEASUREMENT_STYLE_CODE'
1458 ) then
1459
1460 if p_measurement_style_code = 'QUANT_M'
1461 then
1462 IF g_debug THEN hr_utility.set_location(l_proc, 30); END IF;
1463
1464 hr_api.mandatory_arg_error
1465 (p_api_name => l_proc
1466 ,p_argument => 'p_target_value'
1467 ,p_argument_value => p_target_value
1468 );
1469 end if;
1470
1471 end if;
1472
1473 IF g_debug THEN hr_utility.set_location(' Leaving:'|| l_proc, 970); END IF;
1474
1475 exception
1476 when app_exception.application_exception then
1477 if hr_multi_message.exception_add
1478 (p_associated_column1 => 'PER_OBJECTIVES.TARGET_VALUE'
1479 ) then
1480 hr_utility.set_location(' Leaving:'||l_proc, 980);
1481 raise;
1482 end if;
1483 hr_utility.set_location(' Leaving:'||l_proc, 990);
1484
1485 end chk_target_value;
1486 --
1487 -- ----------------------------------------------------------------------------
1488 -- |--------------------------< chk_uom_code >--------------------------------|
1489 -- ----------------------------------------------------------------------------
1490 -- {Start Of Comments}
1491 --
1492 -- Description:
1493 -- Checks that the UOM code is a valid lookup code.
1494 --
1495 -- Prerequisites:
1496 -- That the measurement style code has been validated without error.
1497 --
1498 -- In Arguments:
1499 --
1500 --
1501 -- Post Success:
1502 -- Processing continues if the UOM code is valid.
1503 --
1504 -- Post Failure:
1508 -- Internal Row Handler Use Only.
1505 -- An application error is raised if the UOM code is invalid.
1506 --
1507 -- Access Status:
1509 --
1510 -- {End Of Comments}
1511 -- ----------------------------------------------------------------------------
1512 procedure chk_uom_code
1513 (p_objective_id in number
1514 ,p_object_version_number in number
1515 ,p_effective_date in date
1516 ,p_measurement_style_code in varchar2
1517 ,p_uom_code in varchar2
1518 ) is
1519
1520 -- Declare local variables
1521
1522 l_proc varchar2(72) := g_package||'chk_uom_code';
1523 l_api_updating boolean;
1524
1525 begin
1526
1527 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 1); END IF;
1528
1529 --
1530 -- Only proceed with validation if :
1531 -- a) The current g_old_rec is current and
1532 -- b) The date values have changed
1533 --
1534 l_api_updating := per_obj_shd.api_updating
1535 (p_objective_id => p_objective_id
1536 ,p_object_version_number => p_object_version_number);
1537 --
1538 IF (l_api_updating
1539 AND nvl(per_obj_shd.g_old_rec.measurement_style_code, hr_api.g_varchar2)
1540 = nvl(p_measurement_style_code, hr_api.g_varchar2)
1541 AND nvl(per_obj_shd.g_old_rec.uom_code, hr_api.g_varchar2)
1542 = nvl(p_uom_code, hr_api.g_varchar2))
1543 THEN
1544 RETURN;
1545 END IF;
1546
1547 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1548
1549 if hr_multi_message.no_exclusive_error
1550 (p_check_column1 => 'PER_OBJECTIVES.MEASUREMENT_STYLE_CODE'
1551 ,p_associated_column1 => 'PER_OBJECTIVES.MEASUREMENT_STYLE_CODE'
1552 ) then
1553
1554 if p_measurement_style_code = 'QUANT_M'
1555 then
1556 IF g_debug THEN hr_utility.set_location(l_proc, 30); END IF;
1557
1558 hr_api.mandatory_arg_error
1559 (p_api_name => l_proc
1560 ,p_argument => 'p_uom_code'
1561 ,p_argument_value => p_uom_code
1562 );
1563 end if;
1564
1565 end if;
1566
1567 IF g_debug THEN hr_utility.set_location(l_proc, 40); END IF;
1568
1569 --
1570 -- Checks that the UOM code is valid
1571 --
1572 if p_uom_code is not null then
1573 if hr_api.not_exists_in_hr_lookups
1574 (p_effective_date => p_effective_date
1575 ,p_lookup_type => 'HR_WPM_MEASURE_UOM'
1576 ,p_lookup_code => p_uom_code
1577 ) then
1578 -- Error: Invalid Group
1579 fnd_message.set_name('PER', 'HR_50195_WPM_INV_UOM');
1580 fnd_message.raise_error;
1581 end if;
1582 end if;
1583
1584 IF g_debug THEN hr_utility.set_location(' Leaving:'|| l_proc, 970); END IF;
1585
1586 exception
1587 when app_exception.application_exception then
1588 if hr_multi_message.exception_add
1589 (p_associated_column1 => 'PER_OBJECTIVES.UOM_CODE'
1590 ) then
1591 hr_utility.set_location(' Leaving:'||l_proc, 980);
1592 raise;
1593 end if;
1594 hr_utility.set_location(' Leaving:'||l_proc, 990);
1595
1596 end chk_uom_code;
1597 --
1598 -- ----------------------------------------------------------------------------
1599 -- |--------------------------< chk_measure_type_code >-----------------------|
1600 -- ----------------------------------------------------------------------------
1601 -- {Start Of Comments}
1602 --
1603 -- Description:
1604 -- Checks that the measure type is a valid lookup code.
1605 --
1606 -- Prerequisites:
1607 -- That the measurement style code has been validated without error.
1608 --
1609 -- In Arguments:
1610 --
1611 --
1612 -- Post Success:
1613 -- Processing continues if the measure type code is valid.
1614 --
1615 -- Post Failure:
1616 -- An application error is raised if the measure type code is invalid.
1617 --
1618 -- Access Status:
1619 -- Internal Row Handler Use Only.
1620 --
1621 -- {End Of Comments}
1622 -- ----------------------------------------------------------------------------
1623 procedure chk_measure_type_code
1624 (p_objective_id in number
1625 ,p_object_version_number in number
1626 ,p_effective_date in date
1627 ,p_measurement_style_code in varchar2
1628 ,p_measure_type_code in varchar2
1629 ) is
1630
1631 -- Declare local variables
1632
1633 l_proc varchar2(72) := g_package||'chk_measure_type_code';
1634 l_api_updating boolean;
1635
1636 begin
1637
1638 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 1); END IF;
1639
1640 --
1641 -- Only proceed with validation if :
1642 -- a) The current g_old_rec is current and
1643 -- b) The date values have changed
1644 --
1645 l_api_updating := per_obj_shd.api_updating
1646 (p_objective_id => p_objective_id
1647 ,p_object_version_number => p_object_version_number);
1648 --
1649 IF (l_api_updating
1650 AND nvl(per_obj_shd.g_old_rec.measurement_style_code, hr_api.g_varchar2)
1651 = nvl(p_measurement_style_code, hr_api.g_varchar2)
1652 AND nvl(per_obj_shd.g_old_rec.measure_type_code, hr_api.g_varchar2)
1653 = nvl(p_measure_type_code, hr_api.g_varchar2))
1654 THEN
1655 RETURN;
1656 END IF;
1657
1658 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1659
1660 if hr_multi_message.no_exclusive_error
1661 (p_check_column1 => 'PER_OBJECTIVES.MEASUREMENT_STYLE_CODE'
1662 ,p_associated_column1 => 'PER_OBJECTIVES.MEASUREMENT_STYLE_CODE'
1663 ) then
1664
1665 if p_measurement_style_code = 'QUANT_M'
1666 then
1667 IF g_debug THEN hr_utility.set_location(l_proc, 30); END IF;
1668
1669 hr_api.mandatory_arg_error
1670 (p_api_name => l_proc
1671 ,p_argument => 'p_measure_type_code'
1672 ,p_argument_value => p_measure_type_code
1673 );
1674 end if;
1675
1676 end if;
1677
1678 IF g_debug THEN hr_utility.set_location(l_proc, 40); END IF;
1679
1680 --
1681 -- Checks that the measure type code is valid
1682 --
1683 if p_measure_type_code is not null then
1684 if hr_api.not_exists_in_hr_lookups
1685 (p_effective_date => p_effective_date
1686 ,p_lookup_type => 'HR_WPM_MEASURE_TYPE'
1687 ,p_lookup_code => p_measure_type_code
1688 ) then
1689 -- Error: Invalid Group
1690 fnd_message.set_name('PER', 'HR_50196_WPM_INV_MEASR_TYPE');
1691 fnd_message.raise_error;
1692 end if;
1693 end if;
1694
1695 IF g_debug THEN hr_utility.set_location(' Leaving:'|| l_proc, 970); END IF;
1696
1697 exception
1698 when app_exception.application_exception then
1699 if hr_multi_message.exception_add
1700 (p_associated_column1 => 'PER_OBJECTIVES.MEASURE_TYPE_CODE'
1701 ) then
1702 hr_utility.set_location(' Leaving:'||l_proc, 980);
1703 raise;
1704 end if;
1705 hr_utility.set_location(' Leaving:'||l_proc, 990);
1706
1707 end chk_measure_type_code;
1708 --
1709 -- ----------------------------------------------------------------------------
1710 -- |--------------------------< chk_scorecard_id >----------------------------|
1711 -- ----------------------------------------------------------------------------
1712 -- {Start Of Comments}
1713 --
1714 -- Description:
1715 -- This procedure is used to validate that the specified scorecard exists
1716 --
1717 -- Pre Conditions:
1718 -- The scorecard must already exist.
1719 --
1720 -- In Arguments:
1721 --
1722 --
1723 -- Post Success:
1724 -- Processing continues if the scorecard is valid.
1725 --
1726 -- Post Failure:
1727 -- An application error is raised if the scorecard does not exist.
1728 --
1729 -- {End Of Comments}
1730 -- ----------------------------------------------------------------------------
1731 Procedure chk_scorecard_id
1732 (p_objective_id in number
1733 ,p_object_version_number in number
1734 ,p_scorecard_id IN number
1735 ) IS
1736
1737 --
1738 l_proc varchar2(72) := g_package || 'chk_scorecard_id';
1739 l_api_updating boolean;
1740 l_scorecard_id number;
1741 --
1742
1746 WHERE psc.scorecard_id = p_scorecard_id;
1743 CURSOR csr_chk_scard_id IS
1744 SELECT psc.scorecard_id
1745 FROM per_personal_scorecards psc
1747 --
1748 BEGIN
1749
1750 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1751 -- Only proceed with validation if :
1752 -- a) The current g_old_rec is current and
1753 -- b) The scorecard value has changed
1754 --
1755 l_api_updating := per_obj_shd.api_updating
1756 (p_objective_id => p_objective_id
1757 ,p_object_version_number => p_object_version_number);
1758 --
1759 IF (l_api_updating
1760 AND nvl(per_obj_shd.g_old_rec.scorecard_id, hr_api.g_number)
1761 = nvl(p_scorecard_id, hr_api.g_number))
1762 THEN
1763 RETURN;
1764 END IF;
1765 --
1766 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 11); END IF;
1767 --
1768 IF nvl(p_scorecard_id,hr_api.g_number) <> hr_api.g_number THEN
1769 --
1770 -- Check that scorecard exists.
1771 --
1772 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1773 OPEN csr_chk_scard_id;
1774 FETCH csr_chk_scard_id INTO l_scorecard_id;
1775 CLOSE csr_chk_scard_id;
1776
1777 IF l_scorecard_id IS null THEN
1778 fnd_message.set_name('PER', 'HR_WPM_INVALID_SCORECARD');
1779 fnd_message.raise_error;
1780 END IF;
1781
1782 END IF;
1783
1784 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1785
1786 EXCEPTION
1787
1788 WHEN app_exception.application_exception THEN
1789 IF hr_multi_message.exception_add
1790 (p_associated_column1 => 'PER_OBJECTIVES.SCORECARD_ID')
1791 THEN
1792 hr_utility.set_location(' Leaving:'|| l_proc, 980);
1793 RAISE;
1794 END IF;
1795 hr_utility.set_location(' Leaving:'|| l_proc, 990);
1796
1797 END chk_scorecard_id;
1798 --
1799 --=======================================================================================
1800 --
1801 -----------------------------------------------------------------------------
1802 ---------------------------<chk_copied_from_lib_id>--------------------------
1803 -----------------------------------------------------------------------------
1804 --
1805 -- Description:
1806 -- - Validates that the copied from objective library exists
1807 --
1808 -- Pre_conditions:
1809 -- - None
1810 --
1811 -- In Arguments:
1812 -- p_copied_from_lib_id
1813 --
1814 -- Post Success:
1815 -- Process continues if :
1816 -- in parameter is valid.
1817 --
1818 -- Post Failure:
1819 -- An application error is raised and processing is terminated if any of
1820 -- the following cases are found :
1821 -- -- Objective library does not exist
1822 --
1823 -- Access Status
1824 -- Internal row Handler Use Only.
1825 --
1826 --
1827 procedure chk_copied_from_lib_id
1828 (p_objective_id in number
1829 ,p_object_version_number in number
1830 ,p_copied_from_lib_id in number
1831 )
1832 is
1833 --
1834 l_exists varchar2(1);
1835 l_proc varchar2(72) := g_package||'chk_copied_from_lib_id';
1836 l_api_updating boolean;
1837 --
1838 --
1839 -- Cursor to check if appraisal exists
1840 --
1841 Cursor csr_objlib_exists
1842 is
1843 select 'Y'
1844 from per_objectives_library
1845 where objective_id = p_copied_from_lib_id;
1846 --
1847 begin
1848 --
1849 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1850 -- Only proceed with validation if :
1851 -- a) The current g_old_rec is current and
1852 -- b) The copied_from_library_id value has changed
1853 --
1854 l_api_updating := per_obj_shd.api_updating
1855 (p_objective_id => p_objective_id
1856 ,p_object_version_number => p_object_version_number);
1857 --
1858 IF (l_api_updating
1859 AND nvl(per_obj_shd.g_old_rec.copied_from_library_id, hr_api.g_number)
1860 = nvl(p_copied_from_lib_id, hr_api.g_number))
1861 THEN
1862 RETURN;
1863 END IF;
1864 --
1865 IF g_debug THEN hr_utility.set_location(l_proc, 11); END IF;
1866 --
1867 if nvl(p_copied_from_lib_id,hr_api.g_number) <> hr_api.g_number then
1868 open csr_objlib_exists;
1869 fetch csr_objlib_exists into l_exists;
1870 if csr_objlib_exists%notfound then
1871 close csr_objlib_exists;
1872 hr_utility.set_message(800,'HR_WPM_INV_COPY_FRM_LIB_ID');
1873 hr_utility.raise_error;
1874 else
1875 close csr_objlib_exists;
1876 end if;
1877 --
1878 end if;
1879 --
1880 hr_utility.set_location('Leaving: '|| l_proc, 10);
1881 --
1882 exception
1883 when app_exception.application_exception then
1884 if hr_multi_message.exception_add
1885 (p_associated_column1 => 'PER_OBJECTIVES.COPIED_FROM_LIBRARY_ID'
1886 ) then
1887 raise;
1888 end if;
1889
1890 end chk_copied_from_lib_id;
1891 --
1892 -----------------------------------------------------------------------------
1893 ---------------------------<chk_copied_from_obj_id>--------------------------
1894 -----------------------------------------------------------------------------
1895 --
1896 -- Description:
1897 -- - Validates that the copied from objective exists
1898 --
1899 -- Pre_conditions:
1900 -- - None
1901 --
1902 -- In Arguments:
1906 -- Process continues if :
1903 -- p_copied_from_lib_id
1904 --
1905 -- Post Success:
1907 -- in parameter is valid.
1908 --
1909 -- Post Failure:
1910 -- An application error is raised and processing is terminated if any of
1911 -- the following cases are found :
1912 -- -- Objective library does not exist
1913 --
1914 -- Access Status
1915 -- Internal row Handler Use Only.
1916 --
1917 --
1918 procedure chk_copied_from_obj_id
1919 (p_objective_id in number
1920 ,p_object_version_number in number
1921 ,p_copied_from_obj_id in number
1922 )
1923 is
1924 --
1925 l_exists varchar2(1);
1926 l_proc varchar2(72) := g_package||'chk_copied_from_obj_id';
1927 l_api_updating boolean;
1928 --
1929 -- Cursor to check if appraisal exists
1930 --
1931 Cursor csr_obj_exists
1932 is
1933 select 'Y'
1934 from per_objectives
1935 where objective_id = p_copied_from_obj_id;
1936 --
1937 begin
1938 --
1939 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1940 -- Only proceed with validation if :
1941 -- a) The current g_old_rec is current and
1942 -- b) The copied_from_objective_id value has changed
1943 --
1944 l_api_updating := per_obj_shd.api_updating
1945 (p_objective_id => p_objective_id
1946 ,p_object_version_number => p_object_version_number);
1947 --
1948 IF (l_api_updating
1949 AND nvl(per_obj_shd.g_old_rec.copied_from_objective_id, hr_api.g_number)
1950 = nvl(p_copied_from_obj_id, hr_api.g_number))
1951 THEN
1952 RETURN;
1953 END IF;
1954 --
1955 IF g_debug THEN hr_utility.set_location(l_proc, 11); END IF;
1956 --
1957 if nvl(p_copied_from_obj_id,hr_api.g_number) <> hr_api.g_number then
1958 open csr_obj_exists;
1959 fetch csr_obj_exists into l_exists;
1960 if csr_obj_exists%notfound then
1961 close csr_obj_exists;
1962 hr_utility.set_message(800,'HR_WPM_INV_COPY_FRM_OBJ_ID');
1963 hr_utility.raise_error;
1964 else
1965 close csr_obj_exists;
1966 end if;
1967 --
1968 end if;
1969 --
1970 hr_utility.set_location('Leaving: '|| l_proc, 10);
1971 --
1972 exception
1973 when app_exception.application_exception then
1974 if hr_multi_message.exception_add
1975 (p_associated_column1 => 'PER_OBJECTIVES.COPIED_FROM_OBJECTIVE_ID'
1976 ) then
1977 raise;
1978 end if;
1979
1980 end chk_copied_from_obj_id;
1981 --
1982 --
1983 -----------------------------------------------------------------------------
1984 ---------------------------<chk_aligned_with_obj_id>-------------------------
1985 -----------------------------------------------------------------------------
1986 --
1987 -- Description:
1988 -- - Validates that the copied from objective exists
1989 --
1990 -- Pre_conditions:
1991 -- - None
1992 --
1993 -- In Arguments:
1994 -- p_aligned_with_obj_id
1995 --
1996 -- Post Success:
1997 -- Process continues if :
1998 -- in parameter is valid.
1999 --
2000 -- Post Failure:
2001 -- An application error is raised and processing is terminated if any of
2002 -- the following cases are found :
2003 -- -- Objective does not exist
2004 -- --
2005 --
2006 -- Access Status
2007 -- Internal row Handler Use Only.
2008 --
2009 --
2010 PROCEDURE chk_aligned_with_obj_id
2011 (p_objective_id in number
2012 ,p_object_version_number in number
2013 ,p_aligned_with_obj_id IN number
2014 ,p_scorecard_id IN number
2015 )
2016 IS
2017 --
2018 l_exists VARCHAR2(1);
2019 l_proc VARCHAR2(72) := g_package||'chk_aligned_with_obj_id';
2020 l_api_updating boolean;
2021 --
2022 --
2023 -- Cursor to check if source objective exists
2024 --
2025 /*CURSOR csr_obj_exists
2026 IS
2027 SELECT
2028 ppsc.plan_id,ppsc.scorecard_id,ppsc.person_id
2029 FROM
2030 per_objectives pobj
2031 ,per_personal_scorecards ppsc
2032 -- ,per_perf_mgmt_plans ppln
2033 WHERE
2034 pobj.objective_id = p_aligned_with_obj_id
2035 AND pobj.scorecard_id = ppsc.scorecard_id;
2036 --and ppsc.plan_id = ppln.plan_id;*/
2037 CURSOR csr_obj_exists
2038 IS
2039 SELECT
2040 NVL(ppsc.plan_id,ap.plan_id) PLAN_ID,
2041 NVL(ppsc.scorecard_id,ppsc2.scorecard_id) SCORECARD_ID,
2042 NVL(ppsc.person_id,ap.appraisee_person_id) SOURCE_PERSON_ID
2043 FROM
2044 per_objectives pobj
2045 ,per_personal_scorecards ppsc
2046 ,per_personal_scorecards ppsc2
2047 ,per_appraisals ap
2048 WHERE
2049 pobj.objective_id = p_aligned_with_obj_id
2050 AND pobj.scorecard_id = ppsc.scorecard_id (+)
2051 AND pobj.appraisal_id = ap.appraisal_id (+)
2052 AND ap.plan_id = ppsc2.plan_id(+)
2053 AND ap.appraisee_person_id = ppsc2.person_id(+);
2054 --
2055 l_source_plan_id per_personal_scorecards.plan_id%TYPE;
2056 l_source_scorecard_id per_personal_scorecards.scorecard_id%TYPE;
2057 l_source_person_id per_personal_scorecards.person_id%TYPE;
2058 --
2059 -- Cursor to get target plan
2060 --
2061 CURSOR csr_target_plan
2065 FROM
2062 IS
2063 SELECT
2064 plan_id,person_id
2066 per_personal_scorecards
2067 WHERE
2068 scorecard_id = p_scorecard_id;
2069 --
2070 l_target_plan_id per_personal_scorecards.plan_id%TYPE;
2071 l_target_person_id per_personal_scorecards.person_id%TYPE;
2072 --
2073 -- Cursor to check if source and target persons is same
2074 --
2075 CURSOR csr_chk_person
2076 IS
2077 SELECT 'Y'
2078 FROM
2079 per_objectives pobj
2080 ,per_personal_scorecards ppsc
2081 ,per_perf_mgmt_plans ppln
2082 WHERE
2083 ppln.plan_id = l_source_plan_id
2084 AND ppln.plan_id = ppsc.plan_id
2085 AND ppsc.person_id = l_source_person_id
2086 AND pobj.objective_id = p_aligned_with_obj_id;
2087 --
2088 l_same_person VARCHAR2(1);
2089 --
2090 -- Cursor to check whetehr the objective is shared
2091 --
2092 CURSOR csr_chk_shared
2093 IS
2094 SELECT
2095 'Y'
2096 FROM
2097 per_scorecard_sharing
2098 WHERE
2099 scorecard_id = l_source_scorecard_id
2100 AND person_id = l_target_person_id;
2101 --
2102 l_shared VARCHAR2(1);
2103 --
2104 --
2105 BEGIN
2106 --
2107 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
2108 -- Only proceed with validation if :
2109 -- a) The current g_old_rec is current and
2110 -- b) The aligned_with_obj_id value has changed
2111 --
2112 l_api_updating := per_obj_shd.api_updating
2113 (p_objective_id => p_objective_id
2114 ,p_object_version_number => p_object_version_number);
2115 --
2116 IF (l_api_updating
2117 AND nvl(per_obj_shd.g_old_rec.aligned_with_objective_id, hr_api.g_number)
2118 = nvl(p_aligned_with_obj_id, hr_api.g_number))
2119 THEN
2120 RETURN;
2121 END IF;
2122 --
2123 IF g_debug THEN hr_utility.set_location(l_proc, 11); END IF;
2124 --
2125 IF nvl(p_aligned_with_obj_id,-1) <> -1 THEN
2126 OPEN csr_obj_exists;
2127 FETCH csr_obj_exists INTO l_source_plan_id,l_source_scorecard_id,l_source_person_id;
2128 IF csr_obj_exists%NOTFOUND THEN
2129 CLOSE csr_obj_exists;
2130 --The Objective that you are aligning with does not exist
2131 hr_utility.set_message(800,'HR_WPM_INV_ALIGNED_WITH_OBJ_ID');
2132 hr_utility.raise_error;
2133 ELSE
2134 CLOSE csr_obj_exists;
2135 END IF;
2136 --
2137 --
2138 -- Check the source and target objectives are within the same plan
2139 --
2140 OPEN csr_target_plan;
2141 FETCH csr_target_plan INTO l_target_plan_id,l_target_person_id;
2142 IF (csr_target_plan%FOUND AND l_target_plan_id <> l_source_plan_id) THEN
2143 CLOSE csr_target_plan;
2144 -- You can not align this objective in a different performance management plan
2145 hr_utility.set_message(800,'HR_WPM_INV_ALIGN_DIFF_PLANS');
2146 hr_utility.raise_error;
2147 ELSE
2148 CLOSE csr_target_plan;
2149 END IF;
2150 --
2151 -- Check that the person is not the same for both the objectives (target and aligned-to obj)
2152 /*
2153 OPEN csr_chk_person;
2154 FETCH csr_chk_person INTO l_same_person;
2155 IF csr_chk_person%FOUND THEN
2156 CLOSE csr_chk_person;
2157 -- You can not align this objective to the same person who has this objective allocated.
2158 hr_utility.set_message(800,'HR_WPM_INV_ALIGN_SAME_PER');
2159 hr_utility.raise_error;
2160 ELSE
2161 CLOSE csr_chk_person;
2162 END IF;
2163 */
2164 IF l_target_person_id = l_source_person_id THEN
2165 -- You can not align this objective to the same person who has this objective allocated.
2166 hr_utility.set_message(800,'HR_WPM_INV_ALIGN_SAME_PER');
2167 hr_utility.raise_error;
2168 END IF;
2169 --
2170 -- Check whether the objective to be aligned with is shared
2171 --
2172 OPEN csr_chk_shared;
2173 FETCH csr_chk_shared INTO l_shared;
2174 IF csr_chk_shared%NOTFOUND THEN
2175 CLOSE csr_chk_shared;
2176 -- You can not align this objective as this objective is not shared.
2177 hr_utility.set_message(800,'HR_WPM_INV_ALIGN_SHR_ACCESS');
2178 hr_utility.raise_error;
2179 ELSE
2180 CLOSE csr_chk_shared;
2181 END IF;
2182 --
2183 END IF;
2184 --
2185 hr_utility.set_location('Leaving: '|| l_proc, 10);
2186 --
2187 EXCEPTION
2188 WHEN app_exception.application_exception THEN
2189 IF hr_multi_message.exception_add
2190 (p_associated_column1 => 'PER_OBJECTIVES.ALIGNED_WITH_OBJECTIVE_ID'
2191 ) THEN
2192 RAISE;
2193 END IF;
2194
2195 END chk_aligned_with_obj_id;
2196 --
2197 -----------------------------------------------------------------------------
2198 ---------------------------<chk_copied_from_sources>-------------------------
2199 -----------------------------------------------------------------------------
2200 --
2201 -- Description:
2202 -- - Validates that the copied from source is either from objective library
2203 -- or from objectives but not both
2204 --
2205 -- Pre_conditions:
2206 -- - None
2207 --
2208 -- In Arguments:
2209 -- p_copied_from_lib_id
2210 -- p_copied_from_obj_id
2211 --
2212 -- Post Success:
2216 -- Post Failure:
2213 -- Process continues if :
2214 -- Either of the parameter is NULL.
2215 --
2217 -- An application error is raised and processing is terminated if any of
2218 -- the following cases are found :
2219 -- -- Copied from Objective and Copied from library exist
2220 --
2221 -- Access Status
2222 -- Internal row Handler Use Only.
2223 --
2224 --
2225 procedure chk_copied_from_sources
2226 (p_copied_from_obj_id in number
2227 ,p_copied_from_lib_id in number
2228 )
2229 is
2230 --
2231 l_exists varchar2(1);
2232 l_proc varchar2(72) := g_package||'chk_copied_from_sources';
2233 --
2234 begin
2235 hr_utility.set_location('Entering:'|| l_proc, 1);
2236 --
2237 if (nvl(p_copied_from_obj_id,-1) <> -1 AND nvl(p_copied_from_lib_id,-1) <> -1)
2238 then
2239 hr_utility.set_message(800,'HR_WPM_INV_COPY_SOURCES');
2240 hr_utility.raise_error;
2241 end if;
2242 --
2243 hr_utility.set_location('Leaving: '|| l_proc, 10);
2244 --
2245 exception
2246 when app_exception.application_exception then
2247 if hr_multi_message.exception_add
2248 (p_associated_column1 => 'PER_OBJECTIVES.COPIED_FROM_OBJECTIVE_ID'
2249 ) then
2250 raise;
2251 end if;
2252
2253 end chk_copied_from_sources;
2254 --
2255 --
2256 -----------------------------------------------------------------------------
2257 ---------------------------<chk_sharing_access_code>-------------------------
2258 -----------------------------------------------------------------------------
2259 --
2260 -- Description:
2261 -- - Validates that the copied from source is either from objective library
2262 -- or from objectives but not both
2263 --
2264 -- Pre_conditions:
2265 -- - None
2266 --
2267 -- In Arguments:
2268 -- p_copied_from_lib_id
2269 -- p_copied_from_obj_id
2270 --
2271 -- Post Success:
2272 -- Process continues if :
2273 -- in parameter is valid.
2274 --
2275 -- Post Failure:
2276 -- An application error is raised and processing is terminated if any of
2277 -- the following cases are found :
2278 -- -- Objective library does not exist
2279 --
2280 -- Access Status
2281 -- Internal row Handler Use Only.
2282 --
2283 --
2284 procedure chk_sharing_access_code
2285 (p_objective_id in number
2286 ,p_object_version_number in number
2287 ,p_effective_date in date
2288 ,p_sharing_access_code in per_objectives.sharing_access_code%TYPE
2289 )
2290 is
2291 --
2292 l_exists varchar2(1);
2293 l_proc varchar2(72) := g_package||'chk_sharing_access_code';
2294 l_api_updating boolean;
2295 --
2296 begin
2297 hr_utility.set_location('Entering:'|| l_proc, 1);
2298 --
2299 -- Only proceed with validation if :
2300 -- a) The current g_old_rec is current and
2301 -- b) The sharing access code values have changed
2302 --
2303 l_api_updating := per_obj_shd.api_updating
2304 (p_objective_id => p_objective_id
2305 ,p_object_version_number => p_object_version_number);
2306 --
2307 IF (l_api_updating
2308 AND nvl(per_obj_shd.g_old_rec.sharing_access_code, hr_api.g_varchar2)
2309 = nvl(p_sharing_access_code, hr_api.g_varchar2))
2310 THEN
2311 RETURN;
2312 END IF;
2313
2314 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
2315
2316 --
2317 -- Checks that the group code is valid
2318 --
2319 if p_sharing_access_code is not null then
2320 if hr_api.not_exists_in_hr_lookups
2321 (p_effective_date => p_effective_date
2322 ,p_lookup_type => 'HR_WPM_OBJECTIVE_SHARING'
2323 ,p_lookup_code => p_sharing_access_code
2324 ) then
2325 -- Error: Invalid Code
2326 fnd_message.set_name('PER', 'HR_WPM_INV_SHR_ACCESS_CDE');
2327 fnd_message.raise_error;
2328 end if;
2329 end if;
2330 hr_utility.set_location('Leaving: '|| l_proc, 10);
2331 --
2332 exception
2333 when app_exception.application_exception then
2334 if hr_multi_message.exception_add
2335 (p_associated_column1 => 'PER_OBJECTIVES.SHARING_ACCESS_CODE'
2336 ) then
2337 raise;
2338 end if;
2339
2340 end chk_sharing_access_code;
2341 --
2342 -- -----------------------------------------------------------------------
2343 -- |------------------------------< chk_df >-----------------------------|
2344 -- -----------------------------------------------------------------------
2345 --
2346 -- Description:
2347 -- Validates the all Descriptive Flexfield values.
2348 --
2349 -- Pre-conditions:
2350 -- All other columns have been validated. Must be called as the
2351 -- last step from insert_validate and update_validate.
2352 --
2353 -- In Arguments:
2354 -- p_rec
2355 --
2356 -- Post Success:
2357 -- If the Descriptive Flexfield structure column and data values are
2358 -- all valid this procedure will end normally and processing will
2359 -- continue.
2360 --
2361 -- Post Failure:
2362 -- If the Descriptive Flexfield structure column value or any of
2363 -- the data values are invalid then an application error is raised as
2364 -- a PL/SQL exception.
2365 --
2366 -- Access Status:
2367 -- Internal Row Handler Use Only.
2368 --
2369 procedure chk_df
2370 (p_rec in per_obj_shd.g_rec_type) is
2371 --
2375 hr_utility.set_location('Entering:'||l_proc, 10);
2372 l_proc varchar2(72) := g_package||'chk_df';
2373 --
2374 begin
2376 --
2377 if ((p_rec.objective_id is not null) and (
2378 nvl(per_obj_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
2379 nvl(p_rec.attribute_category, hr_api.g_varchar2) or
2380 nvl(per_obj_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
2381 nvl(p_rec.attribute1, hr_api.g_varchar2) or
2382 nvl(per_obj_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
2383 nvl(p_rec.attribute2, hr_api.g_varchar2) or
2384 nvl(per_obj_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
2385 nvl(p_rec.attribute3, hr_api.g_varchar2) or
2386 nvl(per_obj_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
2387 nvl(p_rec.attribute4, hr_api.g_varchar2) or
2388 nvl(per_obj_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
2389 nvl(p_rec.attribute5, hr_api.g_varchar2) or
2390 nvl(per_obj_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
2391 nvl(p_rec.attribute6, hr_api.g_varchar2) or
2392 nvl(per_obj_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
2393 nvl(p_rec.attribute7, hr_api.g_varchar2) or
2394 nvl(per_obj_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
2395 nvl(p_rec.attribute8, hr_api.g_varchar2) or
2396 nvl(per_obj_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
2397 nvl(p_rec.attribute9, hr_api.g_varchar2) or
2398 nvl(per_obj_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
2399 nvl(p_rec.attribute10, hr_api.g_varchar2) or
2400 nvl(per_obj_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
2401 nvl(p_rec.attribute11, hr_api.g_varchar2) or
2402 nvl(per_obj_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
2403 nvl(p_rec.attribute12, hr_api.g_varchar2) or
2404 nvl(per_obj_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
2405 nvl(p_rec.attribute13, hr_api.g_varchar2) or
2406 nvl(per_obj_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
2407 nvl(p_rec.attribute14, hr_api.g_varchar2) or
2408 nvl(per_obj_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
2409 nvl(p_rec.attribute15, hr_api.g_varchar2) or
2410 nvl(per_obj_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
2411 nvl(p_rec.attribute16, hr_api.g_varchar2) or
2412 nvl(per_obj_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
2413 nvl(p_rec.attribute17, hr_api.g_varchar2) or
2414 nvl(per_obj_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
2415 nvl(p_rec.attribute18, hr_api.g_varchar2) or
2416 nvl(per_obj_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
2417 nvl(p_rec.attribute19, hr_api.g_varchar2) or
2418 nvl(per_obj_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
2419 nvl(p_rec.attribute20, hr_api.g_varchar2) or
2420
2421 nvl(per_obj_shd.g_old_rec.attribute21, hr_api.g_varchar2) <>
2422 nvl(p_rec.attribute21, hr_api.g_varchar2) or
2423 nvl(per_obj_shd.g_old_rec.attribute22, hr_api.g_varchar2) <>
2424 nvl(p_rec.attribute22, hr_api.g_varchar2) or
2425 nvl(per_obj_shd.g_old_rec.attribute23, hr_api.g_varchar2) <>
2426 nvl(p_rec.attribute23, hr_api.g_varchar2) or
2427 nvl(per_obj_shd.g_old_rec.attribute24, hr_api.g_varchar2) <>
2428 nvl(p_rec.attribute24, hr_api.g_varchar2) or
2429 nvl(per_obj_shd.g_old_rec.attribute25, hr_api.g_varchar2) <>
2430 nvl(p_rec.attribute25, hr_api.g_varchar2) or
2431 nvl(per_obj_shd.g_old_rec.attribute26, hr_api.g_varchar2) <>
2432 nvl(p_rec.attribute26, hr_api.g_varchar2) or
2433 nvl(per_obj_shd.g_old_rec.attribute27, hr_api.g_varchar2) <>
2434 nvl(p_rec.attribute27, hr_api.g_varchar2) or
2435 nvl(per_obj_shd.g_old_rec.attribute28, hr_api.g_varchar2) <>
2436 nvl(p_rec.attribute28, hr_api.g_varchar2) or
2437 nvl(per_obj_shd.g_old_rec.attribute29, hr_api.g_varchar2) <>
2438 nvl(p_rec.attribute29, hr_api.g_varchar2) or
2439 nvl(per_obj_shd.g_old_rec.attribute30, hr_api.g_varchar2) <>
2440 nvl(p_rec.attribute30, hr_api.g_varchar2)))
2441
2442
2443 or
2444 (p_rec.objective_id is null) then
2445 --
2446 -- Only execute the validation if absolutely necessary:
2447 -- a) During update, the structure column value or any
2448 -- of the attribute values have actually changed.
2449 -- b) During insert.
2450 --
2451 hr_dflex_utility.ins_or_upd_descflex_attribs
2452 (p_appl_short_name => 'PER'
2453 ,p_descflex_name => 'PER_OBJECTIVES'
2454 ,p_attribute_category => p_rec.attribute_category
2455 ,p_attribute1_name => 'ATTRIBUTE1'
2456 ,p_attribute1_value => p_rec.attribute1
2457 ,p_attribute2_name => 'ATTRIBUTE2'
2458 ,p_attribute2_value => p_rec.attribute2
2459 ,p_attribute3_name => 'ATTRIBUTE3'
2460 ,p_attribute3_value => p_rec.attribute3
2461 ,p_attribute4_name => 'ATTRIBUTE4'
2462 ,p_attribute4_value => p_rec.attribute4
2463 ,p_attribute5_name => 'ATTRIBUTE5'
2464 ,p_attribute5_value => p_rec.attribute5
2465 ,p_attribute6_name => 'ATTRIBUTE6'
2466 ,p_attribute6_value => p_rec.attribute6
2467 ,p_attribute7_name => 'ATTRIBUTE7'
2468 ,p_attribute7_value => p_rec.attribute7
2469 ,p_attribute8_name => 'ATTRIBUTE8'
2470 ,p_attribute8_value => p_rec.attribute8
2471 ,p_attribute9_name => 'ATTRIBUTE9'
2472 ,p_attribute9_value => p_rec.attribute9
2473 ,p_attribute10_name => 'ATTRIBUTE10'
2474 ,p_attribute10_value => p_rec.attribute10
2475 ,p_attribute11_name => 'ATTRIBUTE11'
2476 ,p_attribute11_value => p_rec.attribute11
2477 ,p_attribute12_name => 'ATTRIBUTE12'
2478 ,p_attribute12_value => p_rec.attribute12
2479 ,p_attribute13_name => 'ATTRIBUTE13'
2480 ,p_attribute13_value => p_rec.attribute13
2481 ,p_attribute14_name => 'ATTRIBUTE14'
2485 ,p_attribute16_name => 'ATTRIBUTE16'
2482 ,p_attribute14_value => p_rec.attribute14
2483 ,p_attribute15_name => 'ATTRIBUTE15'
2484 ,p_attribute15_value => p_rec.attribute15
2486 ,p_attribute16_value => p_rec.attribute16
2487 ,p_attribute17_name => 'ATTRIBUTE17'
2488 ,p_attribute17_value => p_rec.attribute17
2489 ,p_attribute18_name => 'ATTRIBUTE18'
2490 ,p_attribute18_value => p_rec.attribute18
2491 ,p_attribute19_name => 'ATTRIBUTE19'
2492 ,p_attribute19_value => p_rec.attribute19
2493 ,p_attribute20_name => 'ATTRIBUTE20'
2494 ,p_attribute20_value => p_rec.attribute20
2495 ,p_attribute21_name => 'ATTRIBUTE21'
2496 ,p_attribute21_value => p_rec.attribute21
2497 ,p_attribute22_name => 'ATTRIBUTE22'
2498 ,p_attribute22_value => p_rec.attribute22
2499 ,p_attribute23_name => 'ATTRIBUTE23'
2500 ,p_attribute23_value => p_rec.attribute23
2501 ,p_attribute24_name => 'ATTRIBUTE24'
2502 ,p_attribute24_value => p_rec.attribute24
2503 ,p_attribute25_name => 'ATTRIBUTE25'
2504 ,p_attribute25_value => p_rec.attribute25
2505 ,p_attribute26_name => 'ATTRIBUTE26'
2506 ,p_attribute26_value => p_rec.attribute26
2507 ,p_attribute27_name => 'ATTRIBUTE27'
2508 ,p_attribute27_value => p_rec.attribute27
2509 ,p_attribute28_name => 'ATTRIBUTE28'
2510 ,p_attribute28_value => p_rec.attribute28
2511 ,p_attribute29_name => 'ATTRIBUTE29'
2512 ,p_attribute29_value => p_rec.attribute29
2513 ,p_attribute30_name => 'ATTRIBUTE30'
2514 ,p_attribute30_value => p_rec.attribute30
2515 );
2516 end if;
2517 --
2518 hr_utility.set_location(' Leaving:'||l_proc, 20);
2519 end chk_df;
2520 --
2521 --
2522 -- ----------------------------------------------------------------------------
2523 -- |---------------------------< insert_validate >----------------------------|
2524 -- ----------------------------------------------------------------------------
2525 Procedure insert_validate(p_rec in per_obj_shd.g_rec_type
2526 ,p_effective_date in date
2527 ,p_weighting_over_100_warning out nocopy boolean
2528 ,p_weighting_appraisal_warning out nocopy boolean
2529 ) is
2530 --
2531 l_proc varchar2(72) := g_package||'insert_validate';
2532 --
2533 Begin
2534 hr_utility.set_location('Entering:'||l_proc, 5);
2535 --
2536 -- Call all supporting business operations
2537 --
2538 hr_api.validate_bus_grp_id(p_rec.business_group_id
2539 ,p_associated_column1 => per_obj_shd.g_tab_nam ||
2540 '.BUSINESS_GROUP_ID'); -- Validate Bus Grp
2541
2542 hr_multi_message.end_validation_set;
2543 --
2544 -- check if the name column has been entered
2545 if (p_rec.name is NULL) then
2546 hr_utility.set_message(801, 'HR_52062_OBJ_NAME_NULL');
2547 hr_utility.raise_error;
2548 end if;
2549 --
2550 -- check if the start date has been entered
2551 if (p_rec.start_date is NULL) then
2552 hr_utility.set_message(801, 'HR_52063_OBJ_START_DATE_NULL');
2553 hr_utility.raise_error;
2554 end if;
2555 --
2556 hr_utility.set_location('Leaving:'||l_proc, 4);
2557 --
2558 -- check if target_date is not later that start_date
2559 --
2560 per_obj_bus.chk_target_date
2561 (p_objective_id => p_rec.objective_id
2562 ,p_start_date => p_rec.start_date
2563 ,p_target_date => p_rec.target_date
2564 ,p_object_version_number => p_rec.object_version_number
2565 );
2566 --
2567 hr_utility.set_location('Leaving:'||l_proc, 5);
2568 --
2569 -- check if achievement_date is not later that start_date
2570 --
2571 per_obj_bus.chk_achiev_date
2572 (p_objective_id => p_rec.objective_id
2573 ,p_start_date => p_rec.start_date
2574 ,p_achievement_date => p_rec.achievement_date
2575 ,p_complete_percent => p_rec.complete_percent
2576 ,p_appraisal_id => p_rec.appraisal_id
2577 ,p_object_version_number => p_rec.object_version_number
2578 ,p_scorecard_id => p_rec.scorecard_id -- added new parameter for fixing bug#5947176
2579 );
2580 --
2581 hr_utility.set_location('Leaving:'||l_proc, 6);
2582 -- check appraisal
2583 per_obj_bus.chk_appraisal
2584 (p_appraisal_id => p_rec.appraisal_id
2585 ,p_business_group_id => p_rec.business_group_id
2586 );
2587 hr_utility.set_location(l_proc, 7);
2588 -- check owned_by_person
2589 -- if owning_person_id = -3, then do not call business rule as
2590 -- business rule will fail, since this is coming from eligibility
2591 -- and publish plan process.
2592 if p_rec.owning_person_id <> -3 then
2593 per_obj_bus.chk_owned_by_person
2594 (p_owning_person_id => p_rec.owning_person_id
2595 ,p_business_group_id => p_rec.business_group_id
2596 ,p_appraisal_id => p_rec.appraisal_id
2597 ,p_effective_date => p_effective_date
2598 );
2599 end if;
2600 /*
2601 * Added for WPM changes -- =========================================================
2602 *
2603 */
2604 --
2605 -- Check the group code.
2606 --
2607 chk_group_code
2608 (p_objective_id => p_rec.objective_id
2609 ,p_object_version_number => p_rec.object_version_number
2610 ,p_effective_date => p_effective_date
2611 ,p_group_code => p_rec.group_code);
2612
2613 hr_utility.set_location(l_proc, 20);
2614 --
2615 -- Check the priority.
2619 ,p_object_version_number => p_rec.object_version_number
2616 --
2617 chk_priority_code
2618 (p_objective_id => p_rec.objective_id
2620 ,p_effective_date => p_effective_date
2621 ,p_priority_code => p_rec.priority_code);
2622
2623 hr_utility.set_location(l_proc, 25);
2624 --
2625 -- Check the appraise flag.
2626 --
2627 chk_appraise_flag
2628 (p_objective_id => p_rec.objective_id
2629 ,p_object_version_number => p_rec.object_version_number
2630 ,p_effective_date => p_effective_date
2631 ,p_appraise_flag => p_rec.appraise_flag
2632 ,p_scorecard_id => p_rec.scorecard_id);
2633
2634 hr_utility.set_location(l_proc, 30);
2635 --
2636 -- Check the weighting percent.
2637 --
2638 chk_weighting_percent
2639 (p_objective_id => p_rec.objective_id
2640 ,p_object_version_number => p_rec.object_version_number
2641 ,p_effective_date => p_effective_date
2642 ,p_appraise_flag => p_rec.appraise_flag
2643 ,p_weighting_percent => p_rec.weighting_percent
2644 ,p_weighting_over_100_warning => p_weighting_over_100_warning
2645 ,p_weighting_appraisal_warning => p_weighting_appraisal_warning);
2646
2647 hr_utility.set_location(l_proc, 35);
2648
2649 --
2650 -- Check the measurement style code.
2651 --
2652 chk_measurement_style_code
2653 (p_objective_id => p_rec.objective_id
2654 ,p_object_version_number => p_rec.object_version_number
2655 ,p_effective_date => p_effective_date
2656 ,p_measurement_style_code => p_rec.measurement_style_code
2657 ,p_scorecard_id => p_rec.scorecard_id);
2658
2659
2660 hr_utility.set_location(l_proc, 40);
2661 --
2662 -- Check the measure name.
2663 --
2664 chk_measure_name
2665 (p_objective_id => p_rec.objective_id
2666 ,p_object_version_number => p_rec.object_version_number
2667 ,p_measurement_style_code => p_rec.measurement_style_code
2668 ,p_measure_name => p_rec.measure_name);
2669
2670 hr_utility.set_location(l_proc, 45);
2671 --
2672 -- Check the target value.
2673 --
2674 chk_target_value
2675 (p_objective_id => p_rec.objective_id
2676 ,p_object_version_number => p_rec.object_version_number
2677 ,p_measurement_style_code => p_rec.measurement_style_code
2678 ,p_target_value => p_rec.target_value);
2679
2680 hr_utility.set_location(l_proc, 50);
2681 --
2682 -- Check the UOM code.
2683 --
2684 chk_uom_code
2685 (p_objective_id => p_rec.objective_id
2686 ,p_object_version_number => p_rec.object_version_number
2687 ,p_effective_date => p_effective_date
2688 ,p_measurement_style_code => p_rec.measurement_style_code
2689 ,p_uom_code => p_rec.uom_code);
2690
2691 hr_utility.set_location(l_proc, 55);
2692 --
2693 -- Check the measure type code.
2694 --
2695 chk_measure_type_code
2696 (p_objective_id => p_rec.objective_id
2697 ,p_object_version_number => p_rec.object_version_number
2698 ,p_effective_date => p_effective_date
2699 ,p_measurement_style_code => p_rec.measurement_style_code
2700 ,p_measure_type_code => p_rec.measure_type_code);
2701
2702 hr_utility.set_location(l_proc, 60);
2703 --
2704 -- check if scorecard_id exists
2705 --
2706 IF p_rec.scorecard_id <> -1 THEN --- added for mass cascasde
2707 per_obj_bus.chk_scorecard_id
2708 (p_objective_id => p_rec.objective_id
2709 ,p_object_version_number => p_rec.object_version_number
2710 ,p_scorecard_id => p_rec.scorecard_id
2711 );
2712 END if;
2713 hr_utility.set_location(l_proc, 62);
2714 --
2715 -- check if complete percent is valid
2716 --
2717 hr_utility.set_location(l_proc, 66);
2718 per_obj_bus.chk_complete_percent
2719 (p_objective_id => p_rec.objective_id
2720 ,p_object_version_number => p_rec.object_version_number
2721 ,p_complete_percent => p_rec.complete_percent);
2722 hr_utility.set_location(l_proc, 67);
2723 --
2724 -- check if next_review_date is later than start_date
2725 --
2726 per_obj_bus.chk_next_review_date
2727 (p_objective_id => p_rec.objective_id
2728 ,p_start_date => p_rec.start_date
2729 ,p_next_review_date => p_rec.next_review_date
2730 ,p_object_version_number => p_rec.object_version_number
2731 );
2732 hr_utility.set_location(l_proc, 71);
2733 --
2734 chk_copied_from_lib_id
2735 (p_objective_id => p_rec.objective_id
2736 ,p_object_version_number => p_rec.object_version_number
2737 ,p_copied_from_lib_id => p_rec.copied_from_library_id
2738 );
2739 hr_utility.set_location(l_proc, 72);
2740 --
2741 chk_copied_from_obj_id
2742 (p_objective_id => p_rec.objective_id
2743 ,p_object_version_number => p_rec.object_version_number
2744 ,p_copied_from_obj_id => p_rec.copied_from_objective_id
2745 );
2746 hr_utility.set_location(l_proc, 73);
2747 --
2748 IF p_rec.scorecard_id <> -1 THEN --- added for mass cascasde
2749 chk_aligned_with_obj_id
2750 (p_objective_id => p_rec.objective_id
2751 ,p_object_version_number => p_rec.object_version_number
2755 END if;
2752 ,p_aligned_with_obj_id => p_rec.aligned_with_objective_id
2753 ,p_scorecard_id => p_rec.scorecard_id
2754 );
2756 hr_utility.set_location(l_proc, 74);
2757 --
2758 /* temporarily commented for functional justification
2759 chk_copied_from_sources
2760 (p_copied_from_obj_id => p_rec.copied_from_objective_id
2761 ,p_copied_from_lib_id => p_rec.copied_from_library_id
2762 );
2763 */
2764 hr_utility.set_location(l_proc, 75);
2765 --
2766 chk_sharing_access_code
2767 (p_objective_id => p_rec.objective_id
2768 ,p_object_version_number => p_rec.object_version_number
2769 ,p_effective_date => p_effective_date
2770 ,p_sharing_access_code => p_rec.sharing_access_code
2771 );
2772 hr_utility.set_location(l_proc, 76);
2773 /*
2774 * End of changes added for WPM --===============================================
2775 */
2776
2777 --
2778 -- Call descriptive flexfield validation routines
2779 --
2780 IF hr_general.get_calling_context <>'FORMS' THEN
2781 per_obj_flex.df(p_rec => p_rec);
2782 END IF;
2783 --
2784 per_obj_bus.chk_df(p_rec => p_rec);
2785 --
2786 hr_utility.set_location(' Leaving:'||l_proc, 10);
2787 End insert_validate;
2788 --
2789 -- ----------------------------------------------------------------------------
2790 -- |---------------------------< update_validate >----------------------------|
2791 -- ----------------------------------------------------------------------------
2792 Procedure update_validate(p_rec in per_obj_shd.g_rec_type
2793 ,p_effective_date in date
2794 ,p_weighting_over_100_warning out nocopy boolean
2795 ,p_weighting_appraisal_warning out nocopy boolean
2796 ) is
2797 --
2798 l_proc varchar2(72) := g_package||'update_validate';
2799 --
2800 Begin
2801 hr_utility.set_location('Entering:'||l_proc, 5);
2802 --
2803 -- Call all supporting business operations
2804 --
2805 --
2806 -- Validate business_group_id
2807 --
2808 hr_api.validate_bus_grp_id(p_rec.business_group_id
2809 ,p_associated_column1 => per_obj_shd.g_tab_nam ||
2810 '.BUSINESS_GROUP_ID'
2811 );
2812
2813 hr_multi_message.end_validation_set;
2814
2815 --
2816 -- Rule Check non-updateable fields cannot be updated
2817 --
2818 chk_non_updateable_args(p_rec => p_rec);
2819 --
2820 hr_utility.set_location('Entering:'||l_proc, 6);
2821 -- check if the name column has been entered
2822 if (p_rec.name is NULL) then
2823 hr_utility.set_message(801, 'HR_52062_OBJ_NAME_NULL');
2824 hr_utility.raise_error;
2825 end if;
2826 --
2827 -- check if the start date has been entered
2828 if (p_rec.start_date is NULL) then
2829 hr_utility.set_message(801, 'HR_52063_OBJ_START_DATE_NULL');
2830 hr_utility.raise_error;
2831 end if;
2832 --
2833 hr_utility.set_location('Leaving:'||l_proc, 4);
2834 --
2835 -- check if target_date is not later that start_date
2836 --
2837 per_obj_bus.chk_target_date
2838 (p_objective_id => p_rec.objective_id
2839 ,p_start_date => p_rec.start_date
2840 ,p_target_date => p_rec.target_date
2841 ,p_object_version_number => p_rec.object_version_number
2842 );
2843 --
2844 hr_utility.set_location('Leaving:'||l_proc, 5);
2845 --
2846 -- check if achievement_date is not later that start_date
2847 --
2848 per_obj_bus.chk_achiev_date
2849 (p_objective_id => p_rec.objective_id
2850 ,p_start_date => p_rec.start_date
2851 ,p_achievement_date => p_rec.achievement_date
2852 ,p_complete_percent => p_rec.complete_percent
2853 ,p_appraisal_id => p_rec.appraisal_id
2854 ,p_object_version_number => p_rec.object_version_number
2855 ,p_scorecard_id => p_rec.scorecard_id -- added new parameter for fixing bug#5947176
2856 );
2857 --
2858 hr_utility.set_location('Leaving:'||l_proc, 6);
2859
2860 /*
2861 * Added for WPM changes -- =========================================================
2862 *
2863 */
2864 --
2865 -- Check the group code.
2866 --
2867 chk_group_code
2868 (p_objective_id => p_rec.objective_id
2869 ,p_object_version_number => p_rec.object_version_number
2870 ,p_effective_date => p_effective_date
2871 ,p_group_code => p_rec.group_code);
2872
2873 hr_utility.set_location(l_proc, 20);
2874 --
2875 -- Check the priority.
2876 --
2877 chk_priority_code
2878 (p_objective_id => p_rec.objective_id
2879 ,p_object_version_number => p_rec.object_version_number
2880 ,p_effective_date => p_effective_date
2881 ,p_priority_code => p_rec.priority_code);
2882
2883 hr_utility.set_location(l_proc, 25);
2884 --
2885 -- Check the appraise flag.
2886 --
2887 chk_appraise_flag
2888 (p_objective_id => p_rec.objective_id
2889 ,p_object_version_number => p_rec.object_version_number
2890 ,p_effective_date => p_effective_date
2891 ,p_appraise_flag => p_rec.appraise_flag
2892 ,p_scorecard_id => p_rec.scorecard_id);
2893
2894 hr_utility.set_location(l_proc, 30);
2895 --
2896 -- Check the weighting percent.
2897 --
2898 chk_weighting_percent
2902 ,p_appraise_flag => p_rec.appraise_flag
2899 (p_objective_id => p_rec.objective_id
2900 ,p_object_version_number => p_rec.object_version_number
2901 ,p_effective_date => p_effective_date
2903 ,p_weighting_percent => p_rec.weighting_percent
2904 ,p_weighting_over_100_warning => p_weighting_over_100_warning
2905 ,p_weighting_appraisal_warning => p_weighting_appraisal_warning);
2906
2907 hr_utility.set_location(l_proc, 35);
2908 --
2909 -- Check the measurement style code.
2910 --
2911 chk_measurement_style_code
2912 (p_objective_id => p_rec.objective_id
2913 ,p_object_version_number => p_rec.object_version_number
2914 ,p_effective_date => p_effective_date
2915 ,p_measurement_style_code => p_rec.measurement_style_code
2916 ,p_scorecard_id => p_rec.scorecard_id);
2917
2918 hr_utility.set_location(l_proc, 40);
2919 --
2920 -- Check the measure name.
2921 --
2922 chk_measure_name
2923 (p_objective_id => p_rec.objective_id
2924 ,p_object_version_number => p_rec.object_version_number
2925 ,p_measurement_style_code => p_rec.measurement_style_code
2926 ,p_measure_name => p_rec.measure_name);
2927
2928 hr_utility.set_location(l_proc, 45);
2929 --
2930 -- Check the target value.
2931 --
2932 chk_target_value
2933 (p_objective_id => p_rec.objective_id
2934 ,p_object_version_number => p_rec.object_version_number
2935 ,p_measurement_style_code => p_rec.measurement_style_code
2936 ,p_target_value => p_rec.target_value);
2937
2938 hr_utility.set_location(l_proc, 50);
2939 --
2940 -- Check the UOM code.
2941 --
2942 chk_uom_code
2943 (p_objective_id => p_rec.objective_id
2944 ,p_object_version_number => p_rec.object_version_number
2945 ,p_effective_date => p_effective_date
2946 ,p_measurement_style_code => p_rec.measurement_style_code
2947 ,p_uom_code => p_rec.uom_code);
2948
2949 hr_utility.set_location(l_proc, 55);
2950 --
2951 -- Check the measure type code.
2952 --
2953 chk_measure_type_code
2954 (p_objective_id => p_rec.objective_id
2955 ,p_object_version_number => p_rec.object_version_number
2956 ,p_effective_date => p_effective_date
2957 ,p_measurement_style_code => p_rec.measurement_style_code
2958 ,p_measure_type_code => p_rec.measure_type_code);
2959
2960 hr_utility.set_location(l_proc, 60);
2961 --
2962 -- check if scorecard_id exists
2963 --
2964 IF p_rec.scorecard_id <> -1 THEN --- added for mass cascasde
2965 per_obj_bus.chk_scorecard_id
2966 (p_objective_id => p_rec.objective_id
2967 ,p_object_version_number => p_rec.object_version_number
2968 ,p_scorecard_id => p_rec.scorecard_id
2969 );
2970 END if;
2971 hr_utility.set_location(l_proc, 62);
2972 --
2973 -- check appraisal
2974 per_obj_bus.chk_appraisal
2975 (p_appraisal_id => p_rec.appraisal_id
2976 ,p_business_group_id => p_rec.business_group_id
2977 );
2978 hr_utility.set_location(l_proc, 63);
2979
2980 per_obj_bus.chk_upd_appraisal(p_rec.appraisal_id);
2981 hr_utility.set_location(l_proc, 64);
2982 --
2983 -- check if complete percent is valid
2984 --
2985 hr_utility.set_location(l_proc, 66);
2986 per_obj_bus.chk_complete_percent
2987 (p_objective_id => p_rec.objective_id
2988 ,p_object_version_number => p_rec.object_version_number
2989 ,p_complete_percent => p_rec.complete_percent);
2990 hr_utility.set_location(l_proc, 67);
2991 --
2992 -- check if next_review_date is later that start_date
2993 --
2994 per_obj_bus.chk_next_review_date
2995 (p_objective_id => p_rec.objective_id
2996 ,p_start_date => p_rec.start_date
2997 ,p_next_review_date => p_rec.next_review_date
2998 ,p_object_version_number => p_rec.object_version_number
2999 );
3000 hr_utility.set_location(l_proc, 70);
3001 --
3002 chk_copied_from_lib_id
3003 (p_objective_id => p_rec.objective_id
3004 ,p_object_version_number => p_rec.object_version_number
3005 ,p_copied_from_lib_id => p_rec.copied_from_library_id
3006 );
3007 hr_utility.set_location(l_proc, 72);
3008 --
3009 chk_copied_from_obj_id
3010 (p_objective_id => p_rec.objective_id
3011 ,p_object_version_number => p_rec.object_version_number
3012 ,p_copied_from_obj_id => p_rec.copied_from_objective_id
3013 );
3014 hr_utility.set_location(l_proc, 73);
3015 --
3016 IF p_rec.scorecard_id <> -1 THEN --- added for mass cascasde
3017 chk_aligned_with_obj_id
3018 (p_objective_id => p_rec.objective_id
3019 ,p_object_version_number => p_rec.object_version_number
3020 ,p_aligned_with_obj_id => p_rec.aligned_with_objective_id
3021 ,p_scorecard_id => p_rec.scorecard_id
3022 );
3023 END if;
3024 hr_utility.set_location(l_proc, 74);
3025 --
3026 /*
3027 chk_copied_from_sources
3028 (p_copied_from_obj_id => p_rec.copied_from_objective_id
3029 ,p_copied_from_lib_id => p_rec.copied_from_library_id
3030 );
3031 */
3032 hr_utility.set_location(l_proc, 75);
3033 --
3034 chk_sharing_access_code
3035 (p_objective_id => p_rec.objective_id
3036 ,p_object_version_number => p_rec.object_version_number
3037 ,p_effective_date => p_effective_date
3038 ,p_sharing_access_code => p_rec.sharing_access_code
3039 );
3040 hr_utility.set_location(l_proc, 76);
3041 /*
3042 * End of changes added for WPM --===============================================
3043 */
3044
3045 --
3046 -- Call descriptive flexfield validation routines
3047 --
3048 IF hr_general.get_calling_context <>'FORMS' THEN
3049 per_obj_flex.df(p_rec => p_rec);
3050 END IF;
3051 --
3052 per_obj_bus.chk_df(p_rec => p_rec);
3053 --
3054 hr_utility.set_location(' Leaving:'||l_proc, 10);
3055 End update_validate;
3056 --
3057 -- ----------------------------------------------------------------------------
3058 -- |---------------------------< delete_validate >----------------------------|
3059 -- ----------------------------------------------------------------------------
3060 Procedure delete_validate(p_rec in per_obj_shd.g_rec_type) is
3061 --
3062 l_proc varchar2(72) := g_package||'delete_validate';
3063 --
3064 Begin
3065 hr_utility.set_location('Entering:'||l_proc, 5);
3066 --
3067 -- Call all supporting business operations
3068 --
3069 per_obj_bus.chk_objective_delete
3070 (p_objective_id => p_rec.objective_id
3071 ,p_object_version_number => p_rec.object_version_number
3072 );
3073 hr_utility.set_location(' Leaving:'||l_proc, 10);
3074 End delete_validate;
3075 --
3076 -- ----------------------------------------------------------------------------
3077 -- |-----------------------< return_legislation_code >-------------------------|
3078 -- ----------------------------------------------------------------------------
3079 function return_legislation_code
3080 (p_objective_id in per_objectives.objective_id%TYPE
3081 ) return varchar2 is
3082 --
3083 -- Curson to find legislation code.
3084 --
3085 cursor csr_leg_code is
3086 select legislation_code
3087 from per_business_groups pbg,
3088 per_objectives ppa
3089 where ppa.objective_id = p_objective_id
3090 and pbg.business_group_id = ppa.business_group_id;
3091 --
3092 -- Declare local variables
3093 --
3094 l_proc varchar2(72) := 'return_legislation_code';
3095 l_legislation_code varchar2(150);
3096 --
3097 begin
3098 hr_utility.set_location('Entering:'||l_proc, 10);
3099 --
3100 -- Ensure that all the mandatory parameters are not null
3101 --
3102 hr_api.mandatory_arg_error (p_api_name => l_proc,
3103 p_argument => 'objective_id',
3104 p_argument_value => p_objective_id );
3105 if nvl(g_objective_id, hr_api.g_number) = p_objective_id then
3106 --
3107 -- The legislation code has already been found with a previous
3108 -- call to this function. Just return the value in the global
3109 -- variable.
3110 --
3111 l_legislation_code := g_legislation_code;
3112 hr_utility.set_location(l_proc, 20);
3113 else
3114 --
3115 -- The ID is different to the last call to this function
3116 -- or this is the first call to this function.
3117 --
3118 open csr_leg_code;
3119 fetch csr_leg_code into l_legislation_code;
3120 if csr_leg_code%notfound then
3121 --
3122 -- The primary key is invalid therefore we must error
3123 --
3124 close csr_leg_code;
3125 --
3126 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
3127 hr_utility.raise_error;
3128 end if;
3129 hr_utility.set_location(l_proc, 30);
3130 --
3131 -- Set the global variables so the values are
3132 -- available for the next call to this function
3133 --
3134 close csr_leg_code;
3135 g_objective_id := p_objective_id;
3136 g_legislation_code := l_legislation_code;
3137 end if;
3138 hr_utility.set_location(' Leaving:'||l_proc, 40);
3139 return l_legislation_code;
3140 --
3141 end return_legislation_code;
3142 --
3143 end per_obj_bus;