4 -- ----------------------------------------------------------------------------
1 Package Body per_pms_bus as
2 /* $Header: pepmsrhi.pkb 120.6.12020000.3 2012/07/05 03:39:34 amnaraya ship $ */
3 --
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_pms_bus.'; -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- The following two global variables are only to be
12 -- used by the return_legislation_code function.
13 --
14 g_legislation_code varchar2(150) default null;
15 g_scorecard_id number default null;
16 --
17 -- ---------------------------------------------------------------------------
18 -- |----------------------< set_security_group_id >--------------------------|
19 -- ---------------------------------------------------------------------------
20 --
21 Procedure set_security_group_id
22 (p_scorecard_id in number
23 ,p_associated_column1 in varchar2 default null
24 ) is
25 --
26 -- Declare cursor
27 --
28 cursor csr_sec_grp is
29 select pbg.security_group_id,
30 pbg.legislation_code
31 from per_business_groups_perf pbg
32 , per_all_assignments_f paf
33 , per_personal_scorecards pms
34 where pms.scorecard_id = p_scorecard_id
35 and pms.assignment_id = paf.assignment_id
36 and paf.business_group_id = pbg.business_group_id;
37
38 --
39 -- Declare local variables
40 --
41 l_security_group_id number;
42 l_proc varchar2(72) := g_package||'set_security_group_id';
43 l_legislation_code varchar2(150);
44 --
45 begin
46 --
47 hr_utility.set_location('Entering:'|| l_proc, 10);
48 --
49 -- Ensure that all the mandatory parameter are not null
50 --
51 hr_api.mandatory_arg_error
52 (p_api_name => l_proc
53 ,p_argument => 'scorecard_id'
54 ,p_argument_value => p_scorecard_id
55 );
56 --
57 open csr_sec_grp;
58 fetch csr_sec_grp into l_security_group_id
59 , l_legislation_code;
60 --
61 if csr_sec_grp%notfound then
62 --
63 close csr_sec_grp;
64 --
65 -- The primary key is invalid therefore we must error
66 --
67 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
68 hr_multi_message.add
69 (p_associated_column1
70 => nvl(p_associated_column1,'SCORECARD_ID')
71 );
72 --
73 else
74 close csr_sec_grp;
75 --
76 -- Set the security_group_id in CLIENT_INFO
77 --
78 hr_api.set_security_group_id
79 (p_security_group_id => l_security_group_id
80 );
81 --
82 -- Set the sessions legislation context in HR_SESSION_DATA
83 --
84 hr_api.set_legislation_context(l_legislation_code);
85 end if;
86 --
87 hr_utility.set_location(' Leaving:'|| l_proc, 20);
88 --
89 end set_security_group_id;
90 --
91 -- ---------------------------------------------------------------------------
92 -- |---------------------< return_legislation_code >-------------------------|
93 -- ---------------------------------------------------------------------------
94 --
95 Function return_legislation_code
96 (p_scorecard_id in number
97 )
98 Return Varchar2 Is
99 --
100 -- Declare cursor
101 --
102 cursor csr_leg_code is
103 select pbg.legislation_code
104 from per_business_groups_perf pbg
105 , per_all_assignments_f paf
106 , per_personal_scorecards pms
107 where pms.scorecard_id = p_scorecard_id
108 and pms.assignment_id = paf.assignment_id
109 and paf.business_group_id = pbg.business_group_id;
110
111 --
112 -- Declare local variables
113 --
114 l_legislation_code varchar2(150);
115 l_proc varchar2(72) := g_package||'return_legislation_code';
116 --
117 Begin
118 --
119 hr_utility.set_location('Entering:'|| l_proc, 10);
120 --
121 -- Ensure that all the mandatory parameter are not null
122 --
123 hr_api.mandatory_arg_error
124 (p_api_name => l_proc
125 ,p_argument => 'scorecard_id'
126 ,p_argument_value => p_scorecard_id
130 = p_scorecard_id) then
127 );
128 --
129 if ( nvl(per_pms_bus.g_scorecard_id, hr_api.g_number)
131 --
132 -- The legislation code has already been found with a previous
133 -- call to this function. Just return the value in the global
134 -- variable.
135 --
136 l_legislation_code := per_pms_bus.g_legislation_code;
137 hr_utility.set_location(l_proc, 20);
138 else
139 --
140 -- The ID is different to the last call to this function
141 -- or this is the first call to this function.
142 --
143 open csr_leg_code;
144 fetch csr_leg_code into l_legislation_code;
145 --
146 if csr_leg_code%notfound then
147 --
148 -- The primary key is invalid therefore we must error
149 --
150 close csr_leg_code;
151 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
152 fnd_message.raise_error;
153 end if;
154 hr_utility.set_location(l_proc,30);
155 --
156 -- Set the global variables so the values are
157 -- available for the next call to this function.
158 --
159 close csr_leg_code;
160 per_pms_bus.g_scorecard_id := p_scorecard_id;
161 per_pms_bus.g_legislation_code := l_legislation_code;
162 end if;
163 hr_utility.set_location(' Leaving:'|| l_proc, 40);
164 return l_legislation_code;
165 end return_legislation_code;
166 --
167 -- ----------------------------------------------------------------------------
168 -- |------------------------------< chk_df >----------------------------------|
169 -- ----------------------------------------------------------------------------
170 --
171 -- Description:
172 -- Validates all the Descriptive Flexfield values.
173 --
174 -- Prerequisites:
175 -- All other columns have been validated. Must be called as the
176 -- last step from insert_validate and update_validate.
177 --
178 -- In Arguments:
179 -- p_rec
180 --
181 -- Post Success:
182 -- If the Descriptive Flexfield structure column and data values are
183 -- all valid this procedure will end normally and processing will
184 -- continue.
185 --
186 -- Post Failure:
187 -- If the Descriptive Flexfield structure column value or any of
188 -- the data values are invalid then an application error is raised as
189 -- a PL/SQL exception.
190 --
191 -- Access Status:
192 -- Internal Row Handler Use Only.
193 --
194 -- ----------------------------------------------------------------------------
195 procedure chk_df
196 (p_rec in per_pms_shd.g_rec_type
197 ) is
198 --
199 l_proc varchar2(72) := g_package || 'chk_df';
200 --
201 begin
202 hr_utility.set_location('Entering:'||l_proc,10);
203 --
204 if ((p_rec.scorecard_id is not null) and (
205 nvl(per_pms_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
206 nvl(p_rec.attribute_category, hr_api.g_varchar2) or
207 nvl(per_pms_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
208 nvl(p_rec.attribute1, hr_api.g_varchar2) or
209 nvl(per_pms_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
210 nvl(p_rec.attribute2, hr_api.g_varchar2) or
211 nvl(per_pms_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
212 nvl(p_rec.attribute3, hr_api.g_varchar2) or
213 nvl(per_pms_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
214 nvl(p_rec.attribute4, hr_api.g_varchar2) or
215 nvl(per_pms_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
216 nvl(p_rec.attribute5, hr_api.g_varchar2) or
217 nvl(per_pms_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
218 nvl(p_rec.attribute6, hr_api.g_varchar2) or
219 nvl(per_pms_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
220 nvl(p_rec.attribute7, hr_api.g_varchar2) or
221 nvl(per_pms_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
222 nvl(p_rec.attribute8, hr_api.g_varchar2) or
223 nvl(per_pms_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
224 nvl(p_rec.attribute9, hr_api.g_varchar2) or
225 nvl(per_pms_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
226 nvl(p_rec.attribute10, hr_api.g_varchar2) or
227 nvl(per_pms_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
228 nvl(p_rec.attribute11, hr_api.g_varchar2) or
229 nvl(per_pms_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
230 nvl(p_rec.attribute12, hr_api.g_varchar2) or
231 nvl(per_pms_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
232 nvl(p_rec.attribute13, hr_api.g_varchar2) or
233 nvl(per_pms_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
234 nvl(p_rec.attribute14, hr_api.g_varchar2) or
235 nvl(per_pms_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
236 nvl(p_rec.attribute15, hr_api.g_varchar2) or
237 nvl(per_pms_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
238 nvl(p_rec.attribute16, hr_api.g_varchar2) or
239 nvl(per_pms_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
240 nvl(p_rec.attribute17, hr_api.g_varchar2) or
241 nvl(per_pms_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
242 nvl(p_rec.attribute18, hr_api.g_varchar2) or
243 nvl(per_pms_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
244 nvl(p_rec.attribute19, hr_api.g_varchar2) or
245 nvl(per_pms_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
246 nvl(p_rec.attribute20, hr_api.g_varchar2) or
247 nvl(per_pms_shd.g_old_rec.attribute21, hr_api.g_varchar2) <>
248 nvl(p_rec.attribute21, hr_api.g_varchar2) or
249 nvl(per_pms_shd.g_old_rec.attribute22, hr_api.g_varchar2) <>
250 nvl(p_rec.attribute22, hr_api.g_varchar2) or
251 nvl(per_pms_shd.g_old_rec.attribute23, hr_api.g_varchar2) <>
252 nvl(p_rec.attribute23, hr_api.g_varchar2) or
256 nvl(p_rec.attribute25, hr_api.g_varchar2) or
253 nvl(per_pms_shd.g_old_rec.attribute24, hr_api.g_varchar2) <>
254 nvl(p_rec.attribute24, hr_api.g_varchar2) or
255 nvl(per_pms_shd.g_old_rec.attribute25, hr_api.g_varchar2) <>
257 nvl(per_pms_shd.g_old_rec.attribute26, hr_api.g_varchar2) <>
258 nvl(p_rec.attribute26, hr_api.g_varchar2) or
259 nvl(per_pms_shd.g_old_rec.attribute27, hr_api.g_varchar2) <>
260 nvl(p_rec.attribute27, hr_api.g_varchar2) or
261 nvl(per_pms_shd.g_old_rec.attribute28, hr_api.g_varchar2) <>
262 nvl(p_rec.attribute28, hr_api.g_varchar2) or
263 nvl(per_pms_shd.g_old_rec.attribute29, hr_api.g_varchar2) <>
264 nvl(p_rec.attribute29, hr_api.g_varchar2) or
265 nvl(per_pms_shd.g_old_rec.attribute30, hr_api.g_varchar2) <>
266 nvl(p_rec.attribute30, hr_api.g_varchar2) ))
267 or (p_rec.scorecard_id is null) then
268 --
269 -- Only execute the validation if absolutely necessary:
270 -- a) During update, the structure column value or any
271 -- of the attribute values have actually changed.
272 -- b) During insert.
273 --
274 hr_dflex_utility.ins_or_upd_descflex_attribs
275 (p_appl_short_name => 'PER'
276 ,p_descflex_name => 'PER_PERSONAL_SCORECARDS'
277 ,p_attribute_category => p_rec.attribute_category
278 ,p_attribute1_name => 'ATTRIBUTE1'
279 ,p_attribute1_value => p_rec.attribute1
280 ,p_attribute2_name => 'ATTRIBUTE2'
281 ,p_attribute2_value => p_rec.attribute2
282 ,p_attribute3_name => 'ATTRIBUTE3'
283 ,p_attribute3_value => p_rec.attribute3
284 ,p_attribute4_name => 'ATTRIBUTE4'
285 ,p_attribute4_value => p_rec.attribute4
286 ,p_attribute5_name => 'ATTRIBUTE5'
287 ,p_attribute5_value => p_rec.attribute5
288 ,p_attribute6_name => 'ATTRIBUTE6'
289 ,p_attribute6_value => p_rec.attribute6
290 ,p_attribute7_name => 'ATTRIBUTE7'
291 ,p_attribute7_value => p_rec.attribute7
292 ,p_attribute8_name => 'ATTRIBUTE8'
293 ,p_attribute8_value => p_rec.attribute8
294 ,p_attribute9_name => 'ATTRIBUTE9'
295 ,p_attribute9_value => p_rec.attribute9
296 ,p_attribute10_name => 'ATTRIBUTE10'
297 ,p_attribute10_value => p_rec.attribute10
298 ,p_attribute11_name => 'ATTRIBUTE11'
299 ,p_attribute11_value => p_rec.attribute11
300 ,p_attribute12_name => 'ATTRIBUTE12'
301 ,p_attribute12_value => p_rec.attribute12
302 ,p_attribute13_name => 'ATTRIBUTE13'
303 ,p_attribute13_value => p_rec.attribute13
304 ,p_attribute14_name => 'ATTRIBUTE14'
305 ,p_attribute14_value => p_rec.attribute14
306 ,p_attribute15_name => 'ATTRIBUTE15'
307 ,p_attribute15_value => p_rec.attribute15
308 ,p_attribute16_name => 'ATTRIBUTE16'
309 ,p_attribute16_value => p_rec.attribute16
310 ,p_attribute17_name => 'ATTRIBUTE17'
311 ,p_attribute17_value => p_rec.attribute17
312 ,p_attribute18_name => 'ATTRIBUTE18'
313 ,p_attribute18_value => p_rec.attribute18
314 ,p_attribute19_name => 'ATTRIBUTE19'
315 ,p_attribute19_value => p_rec.attribute19
316 ,p_attribute20_name => 'ATTRIBUTE20'
317 ,p_attribute20_value => p_rec.attribute20
318 ,p_attribute21_name => 'ATTRIBUTE21'
319 ,p_attribute21_value => p_rec.attribute21
320 ,p_attribute22_name => 'ATTRIBUTE22'
321 ,p_attribute22_value => p_rec.attribute22
322 ,p_attribute23_name => 'ATTRIBUTE23'
323 ,p_attribute23_value => p_rec.attribute23
324 ,p_attribute24_name => 'ATTRIBUTE24'
325 ,p_attribute24_value => p_rec.attribute24
326 ,p_attribute25_name => 'ATTRIBUTE25'
327 ,p_attribute25_value => p_rec.attribute25
328 ,p_attribute26_name => 'ATTRIBUTE26'
329 ,p_attribute26_value => p_rec.attribute26
330 ,p_attribute27_name => 'ATTRIBUTE27'
331 ,p_attribute27_value => p_rec.attribute27
332 ,p_attribute28_name => 'ATTRIBUTE28'
333 ,p_attribute28_value => p_rec.attribute28
334 ,p_attribute29_name => 'ATTRIBUTE29'
335 ,p_attribute29_value => p_rec.attribute29
336 ,p_attribute30_name => 'ATTRIBUTE30'
337 ,p_attribute30_value => p_rec.attribute30
338 );
339 end if;
340 --
341 hr_utility.set_location(' Leaving:'||l_proc,20);
342 end chk_df;
343 --
344 -- ----------------------------------------------------------------------------
345 -- |-----------------------< chk_non_updateable_args >------------------------|
346 -- ----------------------------------------------------------------------------
347 -- {Start Of Comments}
348 --
349 -- Description:
350 -- This procedure is used to ensure that non updateable attributes have
354 -- g_old_rec has been populated with details of the values currently in
351 -- not been updated. If an attribute has been updated an error is generated.
352 --
353 -- Pre Conditions:
355 -- the database.
356 --
357 -- In Arguments:
358 -- p_rec has been populated with the updated values the user would like the
359 -- record set to.
360 --
361 -- Post Success:
362 -- Processing continues if all the non updateable attributes have not
363 -- changed.
364 --
365 -- Post Failure:
366 -- An application error is raised if any of the non updatable attributes
367 -- have been altered.
368 --
369 -- {End Of Comments}
370 -- ----------------------------------------------------------------------------
371 Procedure chk_non_updateable_args
372 (p_effective_date in date
373 ,p_rec in per_pms_shd.g_rec_type
374 ) IS
375 --
376 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
377 l_error EXCEPTION;
378 l_argument varchar2(30);
379 --
380 Begin
381 --
382 -- Only proceed with the validation if a row exists for the current
383 -- record in the HR Schema.
384 --
385 IF NOT per_pms_shd.api_updating
386 (p_scorecard_id => p_rec.scorecard_id
387 ,p_object_version_number => p_rec.object_version_number
388 ) THEN
389 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
390 fnd_message.set_token('PROCEDURE ', l_proc);
391 fnd_message.set_token('STEP ', '5');
392 fnd_message.raise_error;
393 END IF;
394 --
395 hr_utility.set_location(l_proc, 10);
396 if nvl(p_rec.person_id,hr_api.g_number) <>
397 per_pms_shd.g_old_rec.person_id then
398 l_argument := 'person_id';
399 raise l_error;
400 end if;
401 --
402 hr_utility.set_location(l_proc, 15);
403 if nvl(p_rec.assignment_id,hr_api.g_number) <>
404 per_pms_shd.g_old_rec.assignment_id then
405 l_argument := 'assignment_id';
406 raise l_error;
407 end if;
408 --
409 hr_utility.set_location(l_proc, 20);
410 if nvl(p_rec.creator_type,hr_api.g_varchar2) <>
411 per_pms_shd.g_old_rec.creator_type then
412 l_argument := 'creator_type';
413 raise l_error;
414 end if;
415 --
416 hr_utility.set_location(l_proc, 30);
417 --
418 EXCEPTION
419 WHEN l_error THEN
420 hr_api.argument_changed_error
421 (p_api_name => l_proc
422 ,p_argument => l_argument
423 ,p_base_table => per_pms_shd.g_tab_nam);
424 WHEN OTHERS THEN
425 RAISE;
426 End chk_non_updateable_args;
427 --
428 -- ----------------------------------------------------------------------------
429 -- |-----------------------< chk_assignment_id >------------------------------|
430 -- ----------------------------------------------------------------------------
431 -- {Start Of Comments}
432 --
433 -- Description:
434 -- This procedure is used to ensure that the specified assignment exists
435 -- and that it is not a Benefits ('B') assignment.
436 --
437 -- Pre Conditions:
438 -- The assignment must already exist.
439 --
440 -- In Arguments:
441 --
442 --
443 -- Post Success:
444 -- Processing continues if the assignment is valid.
445 --
446 -- Post Failure:
447 -- An application error is raised if the assignment does not exist
448 -- or is a Benefits assignment.
449 --
450 -- {End Of Comments}
451 -- ----------------------------------------------------------------------------
452 Procedure chk_assignment_id
453 (p_scorecard_id IN number
454 ,p_object_version_number IN number
455 ,p_assignment_id IN number
456 ,p_person_id OUT NOCOPY number
457 ) IS
458
459 --
460 l_proc varchar2(72) := g_package || 'chk_assignment_id';
461 l_api_updating boolean;
462 l_assignment_id number;
463 --
464
465 CURSOR csr_chk_assignment_id IS
466 SELECT asg.assignment_id, asg.person_id
467 FROM per_all_assignments_f asg
468 WHERE asg.assignment_id = p_assignment_id
469 AND asg.assignment_type <> 'B';
470 --
471 BEGIN
472
473 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
474
475 --
476 hr_api.mandatory_arg_error
477 (p_api_name => l_proc
478 ,p_argument => 'p_assignment_id'
479 ,p_argument_value => p_assignment_id
480 );
481
482 --
483 -- Only proceed with validation if :
484 -- a) The current g_old_rec is current and
485 -- b) The date values have changed
486 --
487 l_api_updating := per_pms_shd.api_updating
488 (p_scorecard_id => p_scorecard_id
489 ,p_object_version_number => p_object_version_number);
490 --
491 IF (l_api_updating
492 AND nvl(per_pms_shd.g_old_rec.assignment_id, hr_api.g_number)
493 = nvl(p_assignment_id, hr_api.g_number))
494 THEN
495 RETURN;
496 END IF;
497
498 --
499 -- Check that the assignment is valid.
500 -- No attempt is made to validate the dates of the assignment
501 -- against the scorecard: it is possible to have a scorecard
505 -- unncessarily complex for little benefit.
502 -- that starts before, or ends after, the assignment.
503 -- Such validation would be possible but later changes to
504 -- the assignment could invalidate the rule and it becomes
506 -- Life Events can be used to capture changes to the
507 -- dates of an assignment and early end the scorecard.
508 --
509 OPEN csr_chk_assignment_id;
510 FETCH csr_chk_assignment_id INTO l_assignment_id
511 ,p_person_id;
512 CLOSE csr_chk_assignment_id;
513
514 IF l_assignment_id IS null THEN
515 fnd_message.set_name('PER', 'HR_50263_PMS_INVALID_ASG');
516 fnd_message.raise_error;
517 END IF;
518
519 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
520
521 EXCEPTION
522
523 WHEN app_exception.application_exception THEN
524 IF hr_multi_message.exception_add
525 (p_associated_column1 => 'PER_PERSONAL_SCORECARDS.ASSIGNMENT_ID')
526 THEN
527 hr_utility.set_location(' Leaving:'|| l_proc, 980);
528 RAISE;
529 END IF;
530 hr_utility.set_location(' Leaving:'|| l_proc, 990);
531
532 END chk_assignment_id;
533 --
534 -- ----------------------------------------------------------------------------
535 -- |-----------------------< chk_plan_id >------------------------------------|
536 -- ----------------------------------------------------------------------------
537 -- {Start Of Comments}
538 --
539 -- Description:
540 -- This procedure is used to validate that the specified performance
541 -- management plan exists.
542 --
543 -- Pre Conditions:
544 -- The plan must already exist.
545 --
546 -- In Arguments:
547 --
548 --
549 -- Post Success:
550 -- Processing continues if the plan is valid.
551 --
552 -- Post Failure:
553 -- An application error is raised if the plan does not exist.
554 --
555 -- {End Of Comments}
556 -- ----------------------------------------------------------------------------
557 Procedure chk_plan_id
558 (p_scorecard_id IN number
559 ,p_object_version_number IN number
560 ,p_plan_id IN number
561 ) IS
562
563 --
564 l_proc varchar2(72) := g_package || 'chk_plan_id';
565 l_api_updating boolean;
566 l_plan_id number;
567 --
568
569 CURSOR csr_chk_plan_id IS
570 SELECT pmp.plan_id
571 FROM per_perf_mgmt_plans pmp
572 WHERE pmp.plan_id = p_plan_id;
573 --
574 BEGIN
575
576 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
577
578 --
579 -- Only proceed with validation if :
580 -- a) The current g_old_rec is current and
581 -- b) The date values have changed
582 --
583 l_api_updating := per_pms_shd.api_updating
584 (p_scorecard_id => p_scorecard_id
585 ,p_object_version_number => p_object_version_number);
586 --
587 IF (l_api_updating
588 AND nvl(per_pms_shd.g_old_rec.plan_id, hr_api.g_number)
589 = nvl(p_plan_id, hr_api.g_number))
590 THEN
591 RETURN;
592 END IF;
593
594 IF p_plan_id IS NOT null THEN
595 --
596 -- Check that plan exists.
597 --
598 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
599 OPEN csr_chk_plan_id;
600 FETCH csr_chk_plan_id INTO l_plan_id;
601 CLOSE csr_chk_plan_id;
602
603 IF l_plan_id IS null THEN
604 fnd_message.set_name('PER', 'HR_50264_PMS_INVALID_PLAN');
605 fnd_message.raise_error;
606 END IF;
607
608 END IF;
609
610 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
611
612 EXCEPTION
613
614 WHEN app_exception.application_exception THEN
615 IF hr_multi_message.exception_add
616 (p_associated_column1 => 'PER_PERSONAL_SCORECARDS.PLAN_ID')
617 THEN
618 hr_utility.set_location(' Leaving:'|| l_proc, 980);
619 RAISE;
620 END IF;
621 hr_utility.set_location(' Leaving:'|| l_proc, 990);
622
623 END chk_plan_id;
624 --
625 -- ----------------------------------------------------------------------------
626 -- |-----------------------< chk_duplicate >----------------------------------|
627 -- ----------------------------------------------------------------------------
628 -- {Start Of Comments}
629 --
630 -- Description:
631 -- This procedure is used to validate that a personal scorecard does not
632 -- already exist for the given assignment and given plan.
633 --
634 -- Pre Conditions:
635 -- The plan and assignment must exist and have been validated.
636 --
637 -- In Arguments:
638 --
639 --
640 -- Post Success:
641 -- Processing continues if the scorecard is not a duplicate.
642 --
643 -- Post Failure:
644 -- An application error is raised if the scorecard is a duplicate.
645 --
646 -- {End Of Comments}
647 -- ----------------------------------------------------------------------------
648 Procedure chk_duplicate
649 (p_scorecard_id IN number
650 ,p_object_version_number IN number
651 ,p_plan_id IN number
652 ,p_assignment_id IN number
653 ) IS
654
658 l_dup varchar2(5) := 'FALSE';
655 --
656 l_proc varchar2(72) := g_package || 'chk_duplicate';
657 l_api_updating boolean;
659 --
660
661 CURSOR csr_chk_duplicate IS
662 SELECT 'TRUE'
663 FROM per_personal_scorecards pms
664 WHERE pms.plan_id = p_plan_id
665 AND pms.assignment_id = p_assignment_id
666 AND pms.scorecard_id <> nvl(p_scorecard_id, hr_api.g_number)
667 AND pms.STATUS_CODE <> 'TRANSFER_OUT';
668 --
669 BEGIN
670
671 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
672
673 --
674 hr_api.mandatory_arg_error
675 (p_api_name => l_proc
676 ,p_argument => 'p_assignment_id'
677 ,p_argument_value => p_assignment_id
678 );
679
680 --
681 -- Only proceed with validation if :
682 -- a) The current g_old_rec is current and
683 -- b) The date values have changed
684 --
685 l_api_updating := per_pms_shd.api_updating
686 (p_scorecard_id => p_scorecard_id
687 ,p_object_version_number => p_object_version_number);
688 --
689 IF (l_api_updating
690 AND nvl(per_pms_shd.g_old_rec.plan_id, hr_api.g_number)
691 = nvl(p_plan_id, hr_api.g_number)
692 AND nvl(per_pms_shd.g_old_rec.assignment_id, hr_api.g_number)
693 = nvl(p_assignment_id, hr_api.g_number))
694 THEN
695 RETURN;
696 END IF;
697
698 IF p_plan_id IS NOT null THEN
699 --
700 -- Check that the plan is not a duplicate.
701 --
702 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
703 OPEN csr_chk_duplicate;
704 FETCH csr_chk_duplicate INTO l_dup;
705 CLOSE csr_chk_duplicate;
706
707 IF l_dup = 'TRUE' THEN
708 fnd_message.set_name('PER', 'HR_50265_PMS_DUP_SCORECARD');
709 fnd_message.raise_error;
710 END IF;
711
712 END IF;
713
714 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
715
716 EXCEPTION
717
718 WHEN app_exception.application_exception THEN
719 IF hr_multi_message.exception_add
720 (p_associated_column1 => 'PER_PERSONAL_SCORECARDS.PLAN_ID'
721 ,p_associated_column2 => 'PER_PERSONAL_SCORECARDS.ASSIGNMENT_ID')
722 THEN
723 hr_utility.set_location(' Leaving:'|| l_proc, 980);
724 RAISE;
725 END IF;
726 hr_utility.set_location(' Leaving:'|| l_proc, 990);
727
728 END chk_duplicate;
729 --
730 -- ----------------------------------------------------------------------------
731 -- |-----------------------< chk_dates >--------------------------------------|
732 -- ----------------------------------------------------------------------------
733 -- {Start Of Comments}
734 --
735 -- Description:
736 -- This procedure checks the start and end date of the scorecard. It
737 -- first checks that the start date is earlier than the end date,
738 -- then it checks that the scorecard dates are within the dates of the
739 -- performance management plan and finally it checks that the dates
740 -- against the scorecard's objectives to not exceed the new dates.
741 --
742 -- Pre Conditions:
743 -- Where used, the plan must exist and have been validated.
744 --
745 -- In Arguments:
746 --
747 --
748 -- Post Success:
749 -- Processing continues if the dates are valid.
750 --
751 -- Post Failure:
752 -- An application error is raised if the dates are invalid.
753 --
754 -- {End Of Comments}
755 -- ----------------------------------------------------------------------------
756 Procedure chk_dates
757 (p_scorecard_id IN number
758 ,p_object_version_number IN number
759 ,p_plan_id IN number
760 ,p_start_date IN date
761 ,p_end_date IN date
762 ) IS
763
764 --
765 l_proc varchar2(72) := g_package || 'chk_dates';
766 l_api_updating boolean;
767 l_pmp_start_date date;
768 l_pmp_end_date date;
769 l_row_found varchar2(1) := 'N';
770 --
771
772 CURSOR csr_dates_within_plan IS
773 SELECT pmp.start_date, pmp.end_date
774 FROM per_perf_mgmt_plans pmp
775 WHERE pmp.plan_id = p_plan_id;
776
777 -- Bug 11823464
778 -- CURSOR csr_objs_outside_scorecard IS
779 -- SELECT 'Y'
780 -- FROM per_objectives obj
781 -- WHERE obj.scorecard_id IS NOT NULL
782 -- AND obj.scorecard_id = p_scorecard_id
783 -- AND (obj.start_date < p_start_date OR
784 -- obj.target_date > p_end_date)
785 -- AND rownum = 1;
786
787 --
788 BEGIN
789
790 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
791 --
792 hr_api.mandatory_arg_error
793 (p_api_name => l_proc
794 ,p_argument => 'p_start_date'
795 ,p_argument_value => p_start_date
796 );
797 --
798 hr_api.mandatory_arg_error
799 (p_api_name => l_proc
800 ,p_argument => 'p_end_date'
801 ,p_argument_value => p_end_date
802 );
803
804 --
805 -- Only proceed with validation if :
806 -- a) The current g_old_rec is current and
807 -- b) The date values have changed
808 --
812 --
809 l_api_updating := per_pms_shd.api_updating
810 (p_scorecard_id => p_scorecard_id
811 ,p_object_version_number => p_object_version_number);
813 IF (l_api_updating
814 AND nvl(per_pms_shd.g_old_rec.plan_id, hr_api.g_number)
815 = nvl(p_plan_id, hr_api.g_number)
816 AND nvl(per_pms_shd.g_old_rec.start_date, hr_api.g_date)
817 = nvl(p_start_date, hr_api.g_date)
818 AND nvl(per_pms_shd.g_old_rec.end_date, hr_api.g_date)
819 = nvl(p_end_date, hr_api.g_date))
820 THEN
821 RETURN;
822 END IF;
823
824 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
825
826 --
827 -- Check that the scorecard's start date is not later than the end date.
828 --
829 IF p_start_date > p_end_date THEN
830 fnd_message.set_name('PER', 'HR_50266_PMS_START_END');
831 fnd_message.raise_error;
832 END IF;
833
834 IF g_debug THEN hr_utility.set_location(l_proc, 30); END IF;
835
836 IF p_plan_id IS NOT null THEN
837 --
838 -- Check that the scorecard's dates are within the plan dates.
839 --
840 IF g_debug THEN hr_utility.set_location(l_proc, 40); END IF;
841 OPEN csr_dates_within_plan;
842 FETCH csr_dates_within_plan INTO l_pmp_start_date
843 ,l_pmp_end_date;
844 CLOSE csr_dates_within_plan;
845
846 IF p_start_date < l_pmp_start_date
847 OR p_end_date > l_pmp_end_date
848 THEN
849 fnd_message.set_name('PER', 'HR_50267_PMS_DATES_OUT_PLAN');
850 fnd_message.raise_error;
851 END IF;
852
853 END IF;
854
855 IF g_debug THEN hr_utility.set_location(l_proc, 50); END IF;
856
857 -- Bug 11823464
858 -- IF p_scorecard_id IS NOT null THEN
859 --
860 -- Check that there are no objectives outside the range of this scorecard.
861 --
862 -- IF g_debug THEN hr_utility.set_location(l_proc, 60); END IF;
863 -- OPEN csr_objs_outside_scorecard;
864 -- FETCH csr_objs_outside_scorecard INTO l_row_found;
865 -- CLOSE csr_objs_outside_scorecard;
866 --
867 -- IF l_row_found = 'Y'
868 -- THEN
869 -- fnd_message.set_name('PER', 'HR_50296_PMS_OBJ_DATES');
870 -- fnd_message.raise_error;
871 -- END IF;
872 --
873 -- END IF;
874
875
876 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
877
878 EXCEPTION
879
880 WHEN app_exception.application_exception THEN
881 IF hr_multi_message.exception_add
882 (p_associated_column1 => 'PER_PERSONAL_SCORECARDS.START_DATE'
883 ,p_associated_column2 => 'PER_PERSONAL_SCORECARDS.END_DATE')
884 THEN
885 hr_utility.set_location(' Leaving:'|| l_proc, 980);
886 RAISE;
887 END IF;
888 hr_utility.set_location(' Leaving:'|| l_proc, 990);
889
890 END chk_dates;
891 --
892 -- ----------------------------------------------------------------------------
893 -- |-----------------------< chk_scorecard_name >-----------------------------|
894 -- ----------------------------------------------------------------------------
895 -- {Start Of Comments}
896 --
897 -- Description:
898 -- This procedure checks that the specified assignment does not already
899 -- have a scorecard with a duplicate name.
900 --
901 -- Pre Conditions:
902 -- None.
903 --
904 -- In Arguments:
905 --
906 --
907 -- Post Success:
908 -- Processing continues if the scorecard name is unique for the given
909 -- assignment and the p_duplicate_name_warning is set accordingly
910 -- (true if the name already exists; false if it does not).
911 --
912 -- Post Failure:
913 -- An error is raised if an unhandled exception occurs.
914 --
915 -- {End Of Comments}
916 -- ----------------------------------------------------------------------------
917 Procedure chk_scorecard_name
918 (p_scorecard_id IN number
919 ,p_object_version_number IN number
920 ,p_assignment_id IN number
921 ,p_scorecard_name IN varchar2
922 ,p_duplicate_name_warning OUT NOCOPY boolean
923 ) IS
924
925 --
926 l_proc varchar2(72) := g_package || 'chk_scorecard_name';
927 l_api_updating boolean;
928 l_dup varchar2(5) := 'FALSE';
929 --
930
931 CURSOR csr_chk_scorecard_name IS
932 SELECT 'TRUE'
933 FROM per_personal_scorecards pms
934 WHERE pms.assignment_id = p_assignment_id
935 AND pms.scorecard_id <> nvl(p_scorecard_id, hr_api.g_number)
936 AND upper(trim(pms.scorecard_name)) = upper(trim(p_scorecard_name));
937 --
938 BEGIN
939
940 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
941
942 --
943 hr_api.mandatory_arg_error
944 (p_api_name => l_proc
945 ,p_argument => 'p_assignment_id'
946 ,p_argument_value => p_assignment_id
947 );
948 --
949 hr_api.mandatory_arg_error
950 (p_api_name => l_proc
951 ,p_argument => 'p_scorecard_name'
952 ,p_argument_value => p_scorecard_name
953 );
954
955 --
956 -- Only proceed with validation if :
957 -- a) The current g_old_rec is current and
958 -- b) The date values have changed
959 --
960 l_api_updating := per_pms_shd.api_updating
961 (p_scorecard_id => p_scorecard_id
962 ,p_object_version_number => p_object_version_number);
963 --
967 AND nvl(per_pms_shd.g_old_rec.scorecard_name, hr_api.g_varchar2)
964 IF (l_api_updating
965 AND nvl(per_pms_shd.g_old_rec.assignment_id, hr_api.g_number)
966 = nvl(p_assignment_id, hr_api.g_number)
968 = nvl(p_scorecard_name, hr_api.g_varchar2))
969 THEN
970 RETURN;
971 END IF;
972
973 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
974
975 --
976 -- Warn if a scorecard with the same name already exists
977 -- (case and space insensitive).
978 --
979 OPEN csr_chk_scorecard_name;
980 FETCH csr_chk_scorecard_name INTO l_dup;
981 CLOSE csr_chk_scorecard_name;
982
983 p_duplicate_name_warning := (l_dup = 'TRUE');
984
985 IF g_debug THEN hr_utility.trace('p_duplicate_name_warning: '||l_dup); END IF;
986 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
987
988 END chk_scorecard_name;
989 --
990 -- ----------------------------------------------------------------------------
991 -- |-----------------------< chk_creator_type >-------------------------------|
992 -- ----------------------------------------------------------------------------
993 -- {Start Of Comments}
994 --
995 -- Description:
996 -- This procedure checks the creator type is 'MANUAL' or 'AUTO'.
997 --
998 -- Pre Conditions:
999 -- None.
1000 --
1001 -- In Arguments:
1002 --
1003 --
1004 -- Post Success:
1005 -- Processing continues if p_creator_type is valid.
1006 --
1007 -- Post Failure:
1008 -- An application error is raised if the creator_type is not valid.
1009 --
1010 -- {End Of Comments}
1011 -- ----------------------------------------------------------------------------
1012 Procedure chk_creator_type
1013 (p_creator_type IN varchar2
1014 ) IS
1015
1016 --
1017 l_proc varchar2(72) := g_package || 'chk_creator_type';
1018 --
1019
1020 --
1021 BEGIN
1022
1023 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1024
1025 hr_api.mandatory_arg_error
1026 (p_api_name => l_proc
1027 ,p_argument => 'p_creator_type'
1028 ,p_argument_value => p_creator_type
1029 );
1030
1031 --
1032 -- Check that p_creator_type is valid.
1033 --
1034 IF NOT (p_creator_type = 'MANUAL' OR p_creator_type = 'AUTO')
1035 THEN
1036 fnd_message.set_name('PER', 'HR_50269_PMS_CREATOR_TYPE');
1037 fnd_message.raise_error;
1038 END IF;
1039
1040 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1041
1042 EXCEPTION
1043
1044 WHEN app_exception.application_exception THEN
1045 IF hr_multi_message.exception_add
1046 (p_associated_column1 => 'PER_PERSONAL_SCORECARDS.CREATOR_TYPE')
1047 THEN
1048 hr_utility.set_location(' Leaving:'|| l_proc, 980);
1049 RAISE;
1050 END IF;
1051 hr_utility.set_location(' Leaving:'|| l_proc, 990);
1052
1053 END chk_creator_type;
1054 --
1055 -- ----------------------------------------------------------------------------
1056 -- |-----------------------< chk_status_code >--------------------------------|
1057 -- ----------------------------------------------------------------------------
1058 -- {Start Of Comments}
1059 --
1060 -- Description:
1061 -- This procedure checks the status code is a valid lookup.
1062 --
1063 -- Pre Conditions:
1064 -- The lookup needs to exist and enabled.
1065 --
1066 -- In Arguments:
1067 --
1068 --
1069 -- Post Success:
1070 -- Processing continues if the status code is valid.
1071 --
1072 -- Post Failure:
1073 -- An application error is raised if the status code is not valid.
1074 --
1075 -- {End Of Comments}
1076 -- ----------------------------------------------------------------------------
1077 Procedure chk_status_code
1078 (p_effective_date IN date
1079 ,p_scorecard_id IN number
1080 ,p_object_version_number IN number
1081 ,p_status_code IN varchar2
1082 ) IS
1083
1084 --
1085 l_proc varchar2(72) := g_package || 'chk_status_code';
1086 l_api_updating boolean;
1087 --
1088
1089 --
1090 BEGIN
1091
1092 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1093
1094 hr_api.mandatory_arg_error
1095 (p_api_name => l_proc
1096 ,p_argument => 'p_status_code'
1097 ,p_argument_value => p_status_code
1098 );
1099
1100 --
1101 -- Only proceed with validation if :
1102 -- a) The current g_old_rec is current and
1103 -- b) The date values have changed
1104 --
1105 l_api_updating := per_pms_shd.api_updating
1106 (p_scorecard_id => p_scorecard_id
1107 ,p_object_version_number => p_object_version_number);
1108 --
1109 IF (l_api_updating
1110 AND nvl(per_pms_shd.g_old_rec.status_code, hr_api.g_varchar2)
1111 = nvl(p_status_code, hr_api.g_varchar2))
1112 THEN
1113 RETURN;
1114 END IF;
1115
1116 --
1117 -- Check that the status code is a valid lookup.
1118 --
1119 IF hr_api.not_exists_in_hr_lookups
1120 (p_effective_date => p_effective_date
1121 ,p_lookup_type => 'HR_WPM_SCORECARD_STATUS'
1122 ,p_lookup_code => p_status_code)
1123 THEN
1124 fnd_message.set_name('PER', 'HR_50271_PMS_STATUS_CODE');
1125 fnd_message.raise_error;
1126 END IF;
1127
1131
1128 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1129
1130 EXCEPTION
1132 WHEN app_exception.application_exception THEN
1133 IF hr_multi_message.exception_add
1134 (p_associated_column1 =>'PER_PERSONAL_SCORECARDS.STATUS_CODE')
1135 THEN
1136 hr_utility.set_location(' Leaving:'|| l_proc, 980);
1137 RAISE;
1138 END IF;
1139 hr_utility.set_location(' Leaving:'|| l_proc, 990);
1140
1141 END chk_status_code;
1142
1143 -- Bug#13943955 sussuman
1144 --
1145 -- ----------------------------------------------------------------------------
1146 -- |-----------------------< chk_obj_setting_deadline >------------------------|
1147 -- ----------------------------------------------------------------------------
1148 -- {Start Of Comments}
1149 --
1150 -- Description:
1151 -- This procedure checks if the Objective Setting Dealdine date is not an ambiguous date.
1152 --
1153 -- Pre Conditions:
1154 -- The Objective Setting Deadline must not be alterable beyond the appraisal creation.
1155 --
1156 -- In Arguments:
1157 --
1158 --
1159 -- Post Success:
1160 -- Processing continues if the new Objective Setting Deadline fits all the criteria
1161 --
1162 -- Post Failure:
1163 -- An application error is raised in case it fails any validation.
1164 --
1165 -- {End Of Comments}
1166 -- ----------------------------------------------------------------------------
1167 Procedure chk_obj_setting_deadline
1168 (p_obj_setting_deadline IN date
1169 ,p_scorecard_id IN number
1170 ) IS
1171
1172 CURSOR csr_appr_exists (p_scorecard_id IN number)
1173 IS
1174 SELECT 'Y' from dual where exists( select null
1175 FROM per_personal_scorecards pps
1176 , per_appraisal_periods pap
1177 WHERE scorecard_id = p_scorecard_id
1178 AND pap.plan_id = pps.plan_id
1179 AND NVL(p_obj_setting_deadline, hr_api.g_sot) >= pap.task_start_date
1180 );
1181
1182 l_appr_exists VARCHAR2(1) := 'N';
1183 l_proc VARCHAR2 (72) := g_package || 'plan_admin_actions_obj_deadline';
1184
1185 BEGIN
1186 hr_utility.set_location('Entering:'||l_proc, 5);
1187
1188 OPEN csr_appr_exists(p_scorecard_id);
1189
1190 FETCH csr_appr_exists INTO l_appr_exists;
1191 CLOSE csr_appr_exists;
1192
1193 IF(l_appr_exists = 'Y')
1194 THEN
1195 fnd_message.set_name('PER', 'HR_OBJ_END_DT_BEFR_TASK_ST');
1196 fnd_message.raise_error;
1197 END IF;
1198
1199 hr_utility.set_location(' Leaving:'||l_proc, 980);
1200 END chk_obj_setting_deadline;
1201 -- Bug#13943955 sussuman
1202 --
1203 -- ----------------------------------------------------------------------------
1204 -- |---------------------< chk_auto_creator_type >----------------------------|
1205 -- ----------------------------------------------------------------------------
1206 -- {Start Of Comments}
1207 --
1208 -- Description:
1209 -- This procedure checks if the creator type is 'AUTO'.
1210 --
1211 -- Pre Conditions:
1212 -- None.
1213 --
1214 -- In Arguments:
1215 --
1216 --
1217 -- Post Success:
1218 -- The p_created_by_plan_warning is set accordingly.
1219 --
1220 -- Post Failure:
1221 -- None.
1222 --
1223 -- {End Of Comments}
1224 -- ----------------------------------------------------------------------------
1225 Procedure chk_auto_creator_type
1226 (p_creator_type IN varchar2
1227 ,p_created_by_plan_warning OUT NOCOPY boolean
1228 ) IS
1229
1230 --
1231 l_proc varchar2(72) := g_package || 'chk_auto_creator_type';
1232 --
1233
1234 --
1235 BEGIN
1236
1237 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1238
1239 p_created_by_plan_warning := (p_creator_type = 'AUTO');
1240
1241 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1242
1243 END chk_auto_creator_type;
1244 --
1245 -- ----------------------------------------------------------------------------
1246 -- |---------------------< chk_no_objectives >--------------------------------|
1247 -- ----------------------------------------------------------------------------
1248 -- {Start Of Comments}
1249 --
1250 -- Description:
1251 -- This procedure validates that the scorecard does not have any objectives
1252 -- before it is deleted.
1253 --
1254 -- Pre Conditions:
1255 -- None.
1256 --
1257 -- In Arguments:
1258 --
1259 --
1260 -- Post Success:
1261 -- Processing continues if the scorecard does not have any objectives.
1262 --
1263 -- Post Failure:
1264 -- An application error is raised if the scorecard has objectives.
1265 --
1266 -- {End Of Comments}
1267 -- ----------------------------------------------------------------------------
1268 Procedure chk_no_objectives
1269 (p_scorecard_id IN number
1270 ) IS
1271
1272 --
1273 l_proc varchar2(72) := g_package || 'chk_no_objectives';
1274 l_exists varchar2(1) := 'N';
1275 --
1276 CURSOR csr_has_objectives IS
1277 SELECT 'Y'
1278 FROM per_objectives obj
1279 WHERE obj.scorecard_id IS NOT NULL
1280 AND obj.scorecard_id = p_scorecard_id
1281 AND rownum = 1;
1282
1283 --
1284 BEGIN
1285
1286 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1287
1288 --
1292 FETCH csr_has_objectives INTO l_exists;
1289 -- Check whether this scorecard has any objectives.
1290 --
1291 OPEN csr_has_objectives;
1293 CLOSE csr_has_objectives;
1294
1295 IF l_exists = 'Y' THEN
1296 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1297 fnd_message.set_name('PER', 'HR_50229_PMS_DEL_NO_OBJ');
1298 fnd_message.raise_error;
1299 END IF;
1300
1301 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1302
1303 END chk_no_objectives;
1304 --
1305 -- ----------------------------------------------------------------------------
1306 -- |---------------------------< insert_validate >----------------------------|
1307 -- ----------------------------------------------------------------------------
1308 Procedure insert_validate
1309 (p_effective_date in date
1310 ,p_rec in per_pms_shd.g_rec_type
1311 ,p_person_id out nocopy number
1312 ,p_duplicate_name_warning out nocopy boolean
1313 ) is
1314 --
1315 l_proc varchar2(72) := g_package||'insert_validate';
1316 --
1317 Begin
1318
1319 hr_utility.set_location('Entering:'||l_proc, 5);
1320
1321 --
1322 -- Call all supporting business operations.
1323 --
1324 --
1325 -- Validate the assignment first, so that the call to
1326 -- per_asg_bus1 does not provide a misleading error message.
1327 --
1328 chk_assignment_id
1329 (p_scorecard_id => p_rec.scorecard_id
1330 ,p_object_version_number => p_rec.object_version_number
1331 ,p_assignment_id => p_rec.assignment_id
1332 ,p_person_id => p_person_id);
1333
1334 --
1335 -- As this table does not have a mandatory business_group_id
1336 -- column, ensure client_info is populated by calling a suitable
1337 -- set_security_group_id procedure.
1338 --
1339 per_asg_bus1.set_security_group_id
1340 (p_assignment_id => p_rec.assignment_id);
1341
1342 chk_plan_id
1343 (p_scorecard_id => p_rec.scorecard_id
1344 ,p_object_version_number => p_rec.object_version_number
1345 ,p_plan_id => p_rec.plan_id);
1346
1347 --
1348 -- End important validation
1349 --
1350 hr_multi_message.end_validation_set;
1351
1352 --
1353 -- Validate Independent Attributes
1354 --
1355 chk_duplicate
1356 (p_scorecard_id => p_rec.scorecard_id
1357 ,p_object_version_number => p_rec.object_version_number
1358 ,p_plan_id => p_rec.plan_id
1359 ,p_assignment_id => p_rec.assignment_id);
1360
1361 chk_dates
1362 (p_scorecard_id => p_rec.scorecard_id
1363 ,p_object_version_number => p_rec.object_version_number
1364 ,p_plan_id => p_rec.plan_id
1365 ,p_start_date => p_rec.start_date
1366 ,p_end_date => p_rec.end_date);
1367
1368 chk_scorecard_name
1369 (p_scorecard_id => p_rec.scorecard_id
1370 ,p_object_version_number => p_rec.object_version_number
1371 ,p_assignment_id => p_rec.assignment_id
1372 ,p_scorecard_name => p_rec.scorecard_name
1373 ,p_duplicate_name_warning => p_duplicate_name_warning);
1374
1375 chk_creator_type
1376 (p_creator_type => p_rec.creator_type);
1377
1378 chk_status_code
1379 (p_effective_date => p_effective_date
1380 ,p_scorecard_id => p_rec.scorecard_id
1381 ,p_object_version_number => p_rec.object_version_number
1382 ,p_status_code => p_rec.status_code);
1383
1384 -- Bug#13943955 sussuman
1385 chk_obj_setting_deadline
1386 (p_obj_setting_deadline => p_rec.obj_setting_deadline
1387 ,p_scorecard_id => p_rec.scorecard_id);
1388 -- Bug#13943955 sussuman
1389
1390 per_pms_bus.chk_df(p_rec);
1391 --
1392 hr_utility.set_location(' Leaving:'||l_proc, 10);
1393 End insert_validate;
1394 --
1395 -- ----------------------------------------------------------------------------
1396 -- |---------------------------< update_validate >----------------------------|
1397 -- ----------------------------------------------------------------------------
1398 Procedure update_validate
1399 (p_effective_date in date
1400 ,p_rec in per_pms_shd.g_rec_type
1401 ,p_duplicate_name_warning out nocopy boolean
1402 ) is
1403 --
1404 l_proc varchar2(72) := g_package||'update_validate';
1405 --
1406 Begin
1407 hr_utility.set_location('Entering:'||l_proc, 5);
1408 --
1409 -- Call all supporting business operations
1410 --
1411 --
1412 -- Validate Important Attributes
1413 --
1414 chk_non_updateable_args
1415 (p_effective_date => p_effective_date
1416 ,p_rec => p_rec);
1417
1418 --
1419 -- As this table does not have a mandatory business_group_id
1420 -- column, ensure client_info is populated by calling a suitable
1421 -- set_security_group_id procedure.
1422 --
1423 per_asg_bus1.set_security_group_id
1424 (p_assignment_id => p_rec.assignment_id);
1425
1426 chk_plan_id
1427 (p_scorecard_id => p_rec.scorecard_id
1428 ,p_object_version_number => p_rec.object_version_number
1429 ,p_plan_id => p_rec.plan_id);
1430
1431 --
1432 -- End important validation
1433 --
1434 hr_multi_message.end_validation_set;
1435
1436 --
1437 -- Validate Independent Attributes
1438 --
1439 chk_duplicate
1440 (p_scorecard_id => p_rec.scorecard_id
1441 ,p_object_version_number => p_rec.object_version_number
1442 ,p_plan_id => p_rec.plan_id
1443 ,p_assignment_id => p_rec.assignment_id);
1444
1445 chk_dates
1446 (p_scorecard_id => p_rec.scorecard_id
1447 ,p_object_version_number => p_rec.object_version_number
1448 ,p_plan_id => p_rec.plan_id
1449 ,p_start_date => p_rec.start_date
1450 ,p_end_date => p_rec.end_date);
1451
1452 chk_scorecard_name
1453 (p_scorecard_id => p_rec.scorecard_id
1454 ,p_object_version_number => p_rec.object_version_number
1455 ,p_assignment_id => p_rec.assignment_id
1456 ,p_scorecard_name => p_rec.scorecard_name
1457 ,p_duplicate_name_warning => p_duplicate_name_warning);
1458
1459 chk_status_code
1460 (p_effective_date => p_effective_date
1461 ,p_scorecard_id => p_rec.scorecard_id
1462 ,p_object_version_number => p_rec.object_version_number
1463 ,p_status_code => p_rec.status_code);
1464
1465 -- Bug#13943955 sussuman
1466 chk_obj_setting_deadline
1467 (p_obj_setting_deadline => p_rec.obj_setting_deadline
1468 ,p_scorecard_id => p_rec.scorecard_id);
1469 -- Bug#13943955 sussuman
1470
1471 per_pms_bus.chk_df(p_rec);
1472 --
1473 hr_utility.set_location(' Leaving:'||l_proc, 10);
1474 End update_validate;
1475 --
1476 -- ----------------------------------------------------------------------------
1477 -- |---------------------------< delete_validate >----------------------------|
1478 -- ----------------------------------------------------------------------------
1479 Procedure delete_validate
1480 (p_rec in per_pms_shd.g_rec_type
1481 ,p_created_by_plan_warning out nocopy boolean
1482 ) is
1483 --
1484 l_proc varchar2(72) := g_package||'delete_validate';
1485 --
1486 Begin
1487
1488 hr_utility.set_location('Entering:'||l_proc, 5);
1489
1490 --
1491 -- Call all supporting business operations
1492 --
1493 chk_auto_creator_type
1494 (p_creator_type => p_rec.creator_type
1495 ,p_created_by_plan_warning => p_created_by_plan_warning);
1496
1497 hr_utility.set_location('Entering:'||l_proc, 10);
1498
1499 --
1500 -- Check if the scorecard has any objectives before deleting.
1501 --
1502 chk_no_objectives
1503 (p_scorecard_id => p_rec.scorecard_id);
1504
1505 hr_utility.set_location(' Leaving:'||l_proc, 980);
1506
1507 End delete_validate;
1508 --
1509 end per_pms_bus;