1 Package Body per_pmp_bus as
2 /* $Header: pepmprhi.pkb 120.8 2006/07/28 22:03:57 svittal noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_pmp_bus.'; -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------------< return_status_code >----------------------|
13 -- ----------------------------------------------------------------------------
14 --
15 -- Description:
16 -- Returns the plan's status.
17 --
18 -- Prerequisites:
19 -- The plan must already exist and p_plan_id must have a value.
20 --
21 -- In Arguments:
22 -- p_plan_id
23 --
24 -- Post Success:
25 -- The plan's status is returned as a varchar2.
26 --
27 -- Post Failure:
28 -- Null is returned.
29 --
30 -- Access Status:
31 -- Internal Oracle Use Only.
32 --
33 -- ----------------------------------------------------------------------------
34 function return_status_code
35 (p_plan_id in number) return varchar2
36 is
37 --
38 l_proc varchar2(72) := g_package || 'return_status_code';
39 l_status_code per_perf_mgmt_plans.status_code%TYPE;
40
41 CURSOR csr_get_status_code IS
42 SELECT pmp.status_code
43 FROM per_perf_mgmt_plans pmp
44 WHERE pmp.plan_id = p_plan_id;
45
46 begin
47
48 hr_utility.set_location('Entering:'||l_proc,10);
49
50 --
51 -- Only attempt to get the plan's status if the procedure has been
52 -- called correctly.
53 --
54 IF p_plan_id IS NOT NULL THEN
55
56 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
57 OPEN csr_get_status_code;
58 FETCH csr_get_status_code INTO l_status_code;
59 CLOSE csr_get_status_code;
60
61 END IF;
62
63 hr_utility.set_location('Leaving:'||l_proc,980);
64 RETURN l_status_code;
65
66 end return_status_code;
67 --
68 -- ----------------------------------------------------------------------------
69 -- |------------------------------< return_ovn >------------------------------|
70 -- ----------------------------------------------------------------------------
71 --
72 -- Description:
73 -- Returns the plan's object version number.
74 --
75 -- Prerequisites:
76 -- The plan must already exist and p_plan_id must have a value.
77 --
78 -- In Arguments:
79 -- p_plan_id
80 --
81 -- Post Success:
82 -- The plan's OVN is returned as a number.
83 --
84 -- Post Failure:
85 -- Null is returned.
86 --
87 -- Access Status:
88 -- Internal Oracle Use Only.
89 --
90 -- ----------------------------------------------------------------------------
91 function return_ovn
92 (p_plan_id in number) return number
93 is
94 --
95 l_proc varchar2(72) := g_package || 'return_ovn';
96 l_ovn number;
97
98 CURSOR csr_get_ovn IS
99 SELECT pmp.object_version_number
100 FROM per_perf_mgmt_plans pmp
101 WHERE pmp.plan_id = p_plan_id;
102
103 begin
104
105 hr_utility.set_location('Entering:'||l_proc,10);
106
107 --
108 -- Only attempt to get the plan's status if the procedure has been
109 -- called correctly.
110 --
111 IF p_plan_id IS NOT NULL THEN
112
113 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
114 OPEN csr_get_ovn;
115 FETCH csr_get_ovn INTO l_ovn;
116 CLOSE csr_get_ovn;
117
118 END IF;
119
120 hr_utility.set_location('Leaving:'||l_proc,980);
121 RETURN l_ovn;
122
123 end return_ovn;
124 --
125 -- ----------------------------------------------------------------------------
126 -- |------------------------------< chk_df >----------------------------------|
127 -- ----------------------------------------------------------------------------
128 --
129 -- Description:
130 -- Validates all the Descriptive Flexfield values.
131 --
132 -- Prerequisites:
133 -- All other columns have been validated. Must be called as the
134 -- last step from insert_validate and update_validate.
135 --
136 -- In Arguments:
137 -- p_rec
138 --
139 -- Post Success:
140 -- If the Descriptive Flexfield structure column and data values are
141 -- all valid this procedure will end normally and processing will
142 -- continue.
143 --
144 -- Post Failure:
145 -- If the Descriptive Flexfield structure column value or any of
146 -- the data values are invalid then an application error is raised as
147 -- a PL/SQL exception.
148 --
149 -- Access Status:
150 -- Internal Row Handler Use Only.
151 --
152 -- ----------------------------------------------------------------------------
153 procedure chk_df
154 (p_rec in per_pmp_shd.g_rec_type
155 ) is
156 --
157 l_proc varchar2(72) := g_package || 'chk_df';
158 --
159 begin
160 hr_utility.set_location('Entering:'||l_proc,10);
161 --
162 if ((p_rec.plan_id is not null) and (
163 nvl(per_pmp_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
164 nvl(p_rec.attribute_category, hr_api.g_varchar2) or
165 nvl(per_pmp_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
166 nvl(p_rec.attribute1, hr_api.g_varchar2) or
167 nvl(per_pmp_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
168 nvl(p_rec.attribute2, hr_api.g_varchar2) or
169 nvl(per_pmp_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
170 nvl(p_rec.attribute3, hr_api.g_varchar2) or
171 nvl(per_pmp_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
172 nvl(p_rec.attribute4, hr_api.g_varchar2) or
173 nvl(per_pmp_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
174 nvl(p_rec.attribute5, hr_api.g_varchar2) or
175 nvl(per_pmp_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
176 nvl(p_rec.attribute6, hr_api.g_varchar2) or
177 nvl(per_pmp_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
178 nvl(p_rec.attribute7, hr_api.g_varchar2) or
179 nvl(per_pmp_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
180 nvl(p_rec.attribute8, hr_api.g_varchar2) or
181 nvl(per_pmp_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
182 nvl(p_rec.attribute9, hr_api.g_varchar2) or
183 nvl(per_pmp_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
184 nvl(p_rec.attribute10, hr_api.g_varchar2) or
185 nvl(per_pmp_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
186 nvl(p_rec.attribute11, hr_api.g_varchar2) or
187 nvl(per_pmp_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
188 nvl(p_rec.attribute12, hr_api.g_varchar2) or
189 nvl(per_pmp_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
190 nvl(p_rec.attribute13, hr_api.g_varchar2) or
191 nvl(per_pmp_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
192 nvl(p_rec.attribute14, hr_api.g_varchar2) or
193 nvl(per_pmp_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
194 nvl(p_rec.attribute15, hr_api.g_varchar2) or
195 nvl(per_pmp_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
196 nvl(p_rec.attribute16, hr_api.g_varchar2) or
197 nvl(per_pmp_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
198 nvl(p_rec.attribute17, hr_api.g_varchar2) or
199 nvl(per_pmp_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
200 nvl(p_rec.attribute18, hr_api.g_varchar2) or
201 nvl(per_pmp_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
202 nvl(p_rec.attribute19, hr_api.g_varchar2) or
203 nvl(per_pmp_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
204 nvl(p_rec.attribute20, hr_api.g_varchar2) or
205 nvl(per_pmp_shd.g_old_rec.attribute21, hr_api.g_varchar2) <>
206 nvl(p_rec.attribute21, hr_api.g_varchar2) or
207 nvl(per_pmp_shd.g_old_rec.attribute22, hr_api.g_varchar2) <>
208 nvl(p_rec.attribute22, hr_api.g_varchar2) or
209 nvl(per_pmp_shd.g_old_rec.attribute23, hr_api.g_varchar2) <>
210 nvl(p_rec.attribute23, hr_api.g_varchar2) or
211 nvl(per_pmp_shd.g_old_rec.attribute24, hr_api.g_varchar2) <>
212 nvl(p_rec.attribute24, hr_api.g_varchar2) or
213 nvl(per_pmp_shd.g_old_rec.attribute25, hr_api.g_varchar2) <>
214 nvl(p_rec.attribute25, hr_api.g_varchar2) or
215 nvl(per_pmp_shd.g_old_rec.attribute26, hr_api.g_varchar2) <>
216 nvl(p_rec.attribute26, hr_api.g_varchar2) or
217 nvl(per_pmp_shd.g_old_rec.attribute27, hr_api.g_varchar2) <>
218 nvl(p_rec.attribute27, hr_api.g_varchar2) or
219 nvl(per_pmp_shd.g_old_rec.attribute28, hr_api.g_varchar2) <>
220 nvl(p_rec.attribute28, hr_api.g_varchar2) or
221 nvl(per_pmp_shd.g_old_rec.attribute29, hr_api.g_varchar2) <>
222 nvl(p_rec.attribute29, hr_api.g_varchar2) or
223 nvl(per_pmp_shd.g_old_rec.attribute30, hr_api.g_varchar2) <>
224 nvl(p_rec.attribute30, hr_api.g_varchar2) ))
225 or (p_rec.plan_id is null) then
226 --
227 -- Only execute the validation if absolutely necessary:
228 -- a) During update, the structure column value or any
229 -- of the attribute values have actually changed.
230 -- b) During insert.
231 --
232 hr_dflex_utility.ins_or_upd_descflex_attribs
233 (p_appl_short_name => 'PER'
234 ,p_descflex_name => 'PER_PERF_MGMT_PLANS'
235 ,p_attribute_category => p_rec.attribute_category
236 ,p_attribute1_name => 'ATTRIBUTE1'
237 ,p_attribute1_value => p_rec.attribute1
238 ,p_attribute2_name => 'ATTRIBUTE2'
239 ,p_attribute2_value => p_rec.attribute2
240 ,p_attribute3_name => 'ATTRIBUTE3'
241 ,p_attribute3_value => p_rec.attribute3
242 ,p_attribute4_name => 'ATTRIBUTE4'
243 ,p_attribute4_value => p_rec.attribute4
244 ,p_attribute5_name => 'ATTRIBUTE5'
245 ,p_attribute5_value => p_rec.attribute5
246 ,p_attribute6_name => 'ATTRIBUTE6'
247 ,p_attribute6_value => p_rec.attribute6
248 ,p_attribute7_name => 'ATTRIBUTE7'
249 ,p_attribute7_value => p_rec.attribute7
250 ,p_attribute8_name => 'ATTRIBUTE8'
251 ,p_attribute8_value => p_rec.attribute8
252 ,p_attribute9_name => 'ATTRIBUTE9'
253 ,p_attribute9_value => p_rec.attribute9
254 ,p_attribute10_name => 'ATTRIBUTE10'
255 ,p_attribute10_value => p_rec.attribute10
256 ,p_attribute11_name => 'ATTRIBUTE11'
257 ,p_attribute11_value => p_rec.attribute11
258 ,p_attribute12_name => 'ATTRIBUTE12'
259 ,p_attribute12_value => p_rec.attribute12
260 ,p_attribute13_name => 'ATTRIBUTE13'
261 ,p_attribute13_value => p_rec.attribute13
262 ,p_attribute14_name => 'ATTRIBUTE14'
263 ,p_attribute14_value => p_rec.attribute14
264 ,p_attribute15_name => 'ATTRIBUTE15'
265 ,p_attribute15_value => p_rec.attribute15
266 ,p_attribute16_name => 'ATTRIBUTE16'
267 ,p_attribute16_value => p_rec.attribute16
268 ,p_attribute17_name => 'ATTRIBUTE17'
269 ,p_attribute17_value => p_rec.attribute17
270 ,p_attribute18_name => 'ATTRIBUTE18'
271 ,p_attribute18_value => p_rec.attribute18
272 ,p_attribute19_name => 'ATTRIBUTE19'
273 ,p_attribute19_value => p_rec.attribute19
274 ,p_attribute20_name => 'ATTRIBUTE20'
275 ,p_attribute20_value => p_rec.attribute20
276 ,p_attribute21_name => 'ATTRIBUTE21'
277 ,p_attribute21_value => p_rec.attribute21
278 ,p_attribute22_name => 'ATTRIBUTE22'
279 ,p_attribute22_value => p_rec.attribute22
280 ,p_attribute23_name => 'ATTRIBUTE23'
281 ,p_attribute23_value => p_rec.attribute23
282 ,p_attribute24_name => 'ATTRIBUTE24'
283 ,p_attribute24_value => p_rec.attribute24
284 ,p_attribute25_name => 'ATTRIBUTE25'
285 ,p_attribute25_value => p_rec.attribute25
286 ,p_attribute26_name => 'ATTRIBUTE26'
287 ,p_attribute26_value => p_rec.attribute26
288 ,p_attribute27_name => 'ATTRIBUTE27'
289 ,p_attribute27_value => p_rec.attribute27
290 ,p_attribute28_name => 'ATTRIBUTE28'
291 ,p_attribute28_value => p_rec.attribute28
292 ,p_attribute29_name => 'ATTRIBUTE29'
293 ,p_attribute29_value => p_rec.attribute29
294 ,p_attribute30_name => 'ATTRIBUTE30'
295 ,p_attribute30_value => p_rec.attribute30
296 );
297 end if;
298 --
299 hr_utility.set_location(' Leaving:'||l_proc,20);
300 end chk_df;
301 --
302 -- ----------------------------------------------------------------------------
303 -- |-----------------------< chk_non_updateable_args >------------------------|
304 -- ----------------------------------------------------------------------------
305 -- {Start Of Comments}
306 --
307 -- Description:
308 -- This procedure is used to ensure that non updateable attributes have
309 -- not been updated. If an attribute has been updated an error is generated.
310 --
311 -- Pre Conditions:
312 -- g_old_rec has been populated with details of the values currently in
313 -- the database.
314 --
315 -- In Arguments:
316 -- p_rec has been populated with the updated values the user would like the
317 -- record set to.
318 --
319 -- Post Success:
320 -- Processing continues if all the non updateable attributes have not
321 -- changed.
322 --
323 -- Post Failure:
324 -- An application error is raised if any of the non updatable attributes
325 -- have been altered.
326 --
327 -- {End Of Comments}
328 -- ----------------------------------------------------------------------------
329 Procedure chk_non_updateable_args
330 (p_effective_date in date
331 ,p_rec in per_pmp_shd.g_rec_type
332 ) IS
333 --
334 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
335 --
336 Begin
337 --
338 -- Only proceed with the validation if a row exists for the current
339 -- record in the HR Schema.
340 --
341 IF NOT per_pmp_shd.api_updating
342 (p_plan_id => p_rec.plan_id
343 ,p_object_version_number => p_rec.object_version_number
344 ) THEN
345 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
346 fnd_message.set_token('PROCEDURE ', l_proc);
347 fnd_message.set_token('STEP ', '5');
348 fnd_message.raise_error;
349 END IF;
350
351 End chk_non_updateable_args;
352 --
353 -- ----------------------------------------------------------------------------
354 -- |----------------------------< chk_plan_name >-----------------------------|
355 -- ----------------------------------------------------------------------------
356 -- {Start Of Comments}
357 --
358 -- Description:
359 -- Checks the uniqueness of the plan name.
360 --
361 -- Prerequisites:
362 -- None.
363 --
364 -- In Arguments:
365 --
366 --
367 -- Post Success:
368 -- If the name is a duplicate, a warning is set.
369 --
370 -- Post Failure:
371 -- None.
372 --
373 -- Access Status:
374 -- Internal Row Handler Use Only.
375 --
376 -- {End Of Comments}
377 -- ----------------------------------------------------------------------------
378 procedure chk_plan_name
379 (p_plan_id in number
380 ,p_object_version_number in number
381 ,p_plan_name in varchar2
382 ,p_start_date in date
383 ,p_end_date in date
384 ,p_duplicate_name_warning out nocopy boolean
385 ) is
386
387 -- Declare the cursor
388
389 cursor csr_plan_name is
390 select 'Y'
391 from per_perf_mgmt_plans pmp
392 where pmp.plan_id <> nvl(p_plan_id, hr_api.g_number)
393 and upper(trim(pmp.plan_name)) = upper(trim(p_plan_name))
394 and (p_start_date between pmp.start_date and pmp.end_date OR
395 pmp.start_date between p_start_date and p_end_date);
396
397 -- Declare local variables
398
399 l_proc varchar2(72) := g_package||'chk_plan_name';
400 l_api_updating boolean;
401 l_dup varchar2(1) := 'N';
402
403 Begin
404
405 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
406
407 --
408 hr_api.mandatory_arg_error
409 (p_api_name => l_proc
410 ,p_argument => 'p_plan_name'
411 ,p_argument_value => p_plan_name
412 );
413
414 --
415 -- Only proceed with validation if :
416 -- a) The current g_old_rec is current and
420 (p_plan_id => p_plan_id
417 -- b) The date values have changed
418 --
419 l_api_updating := per_pmp_shd.api_updating
421 ,p_object_version_number => p_object_version_number);
422 --
423 IF (l_api_updating
424 AND nvl(per_pmp_shd.g_old_rec.plan_name, hr_api.g_varchar2)
425 = nvl(p_plan_name, hr_api.g_varchar2))
426 THEN
427 RETURN;
428 END IF;
429
430 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
431
432 --
433 -- Warn if an plan with this name already exists.
434 --
435 open csr_plan_name;
436 fetch csr_plan_name into l_dup;
437 close csr_plan_name;
438
439 p_duplicate_name_warning := (l_dup = 'Y');
440
441 IF g_debug THEN hr_utility.trace('p_duplicate_name_warning: '||l_dup); END IF;
442 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
443
444 End chk_plan_name;
445 --
446 -- ----------------------------------------------------------------------------
447 -- |----------------------< chk_administrator_person_id >---------------------|
448 -- ----------------------------------------------------------------------------
449 -- {Start Of Comments}
450 --
451 -- Description:
452 -- Checks that the person_id of administrator is valid person.
453 --
454 -- Prerequisites:
455 -- None.
456 --
457 -- In Arguments:
458 --
459 --
460 -- Post Success:
461 -- Processing continues if the person_id is valid.
462 --
463 -- Post Failure:
464 -- An application error is raised if the person_id is not valid.
465 --
466 -- Access Status:
467 -- Internal Row Handler Use Only.
468 --
469 -- {End Of Comments}
470 -- ----------------------------------------------------------------------------
471 procedure chk_administrator_person_id
472 (p_plan_id in number
473 ,p_object_version_number in number
474 ,p_effective_date in date
475 ,p_administrator_person_id in number
476 ) is
477
478 -- Declare the cursor
479
480 cursor csr_admin_person_id is
481 select 'Y'
482 from per_all_people_f ppf
483 where ppf.person_id = p_administrator_person_id
484 and p_effective_date between ppf.effective_start_date and ppf.effective_end_date;
485
486
487 -- Declare local variables
488
489 l_proc varchar2(72) := g_package||'chk_administrator_person_id';
490 l_api_updating boolean;
491 l_exists varchar2(1) := 'N';
492
493 Begin
494
495 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
496
497 --
498 hr_api.mandatory_arg_error
499 (p_api_name => l_proc
500 ,p_argument => 'p_administrator_person_id'
501 ,p_argument_value => p_administrator_person_id
502 );
503
504 --
505 -- Only proceed with validation if :
506 -- a) The current g_old_rec is current and
507 -- b) The date values have changed
508 --
509 l_api_updating := per_pmp_shd.api_updating
510 (p_plan_id => p_plan_id
511 ,p_object_version_number => p_object_version_number);
512 --
513 IF (l_api_updating
514 AND nvl(per_pmp_shd.g_old_rec.administrator_person_id, hr_api.g_number)
515 = nvl(p_administrator_person_id, hr_api.g_number))
516 THEN
517 RETURN;
518 END IF;
519
520 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
521
522 --
523 -- check if person exists.
524 --
525 open csr_admin_person_id;
526 fetch csr_admin_person_id into l_exists;
527 close csr_admin_person_id;
528
529 IF (l_exists is null or l_exists <> 'Y') THEN
530 fnd_message.set_name('PER', 'HR_50232_WPM_PLAN_ADMIN');
531 fnd_message.raise_error;
532 END IF;
533
534 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
535
536 exception
537 when app_exception.application_exception then
538 if hr_multi_message.exception_add
539 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.ADMINISTRATOR_PERSON_ID'
540 ) then
541 hr_utility.set_location(' Leaving:'||l_proc, 980);
542 raise;
543 end if;
544 hr_utility.set_location(' Leaving:'||l_proc, 990);
545
546 End chk_administrator_person_id;
547 --
548 -- ----------------------------------------------------------------------------
549 -- |----------------------< chk_previous_plan_id >----------------------------|
550 -- ----------------------------------------------------------------------------
551 -- {Start Of Comments}
552 --
553 -- Description:
554 -- Validates that the previous_plan_id is a valid plan and is different
555 -- to the current plan.
556 --
557 -- Prerequisites:
558 -- None.
559 --
560 -- In Arguments:
561 --
562 --
563 -- Post Success:
564 -- Processing continues if the previous_plan_id is valid.
565 --
566 -- Post Failure:
567 -- An application error is raised if the previous_plan_id is not valid.
568 --
569 -- Access Status:
570 -- Internal Row Handler Use Only.
571 --
572 -- {End Of Comments}
573 -- ----------------------------------------------------------------------------
574 procedure chk_previous_plan_id
575 (p_plan_id in number
576 ,p_object_version_number in number
577 ,p_effective_date in date
578 ,p_start_date in date
579 ,p_previous_plan_id in number
580 ) is
581
585 select 'Y'
582 -- Declare the cursor
583
584 cursor csr_previous_plan is
586 from per_perf_mgmt_plans pmp
587 where pmp.plan_id = p_previous_plan_id
588 and pmp.start_date < p_start_date
589 and pmp.plan_id <> nvl(p_plan_id, hr_api.g_number);
590
591 cursor csr_plan_overlap is
592 select end_date
593 from per_perf_mgmt_plans pmp
594 where pmp.plan_id = p_previous_plan_id;
595
596
597 -- Declare local variables
598
599 l_proc varchar2(72) := g_package||'chk_previous_plan_id';
600 l_api_updating boolean;
601 l_exists varchar2(1) := 'N';
602 l_end_date date;
603
604 Begin
605
606 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
607
608 --
609 -- Only proceed with validation if :
610 -- a) The current g_old_rec is current and
611 -- b) The date values have changed
612 --
613 l_api_updating := per_pmp_shd.api_updating
614 (p_plan_id => p_plan_id
615 ,p_object_version_number => p_object_version_number);
616 --
617 IF (l_api_updating
618 AND nvl(per_pmp_shd.g_old_rec.previous_plan_id, hr_api.g_number)
619 = nvl(p_previous_plan_id, hr_api.g_number)
620 AND nvl(per_pmp_shd.g_old_rec.start_date, hr_api.g_date)
621 = nvl(p_start_date, hr_api.g_date))
622 THEN
623 RETURN;
624 END IF;
625
626 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
627
628 IF p_previous_plan_id IS NOT NULL THEN
629 --
630 -- Check if the previous plan exists.
631 --
632 open csr_previous_plan;
633 fetch csr_previous_plan into l_exists;
634 close csr_previous_plan;
635
636 IF g_debug THEN hr_utility.set_location(l_proc, 30); END IF;
637
638 IF (l_exists is null or l_exists <> 'Y') THEN
639 IF g_debug THEN hr_utility.set_location(l_proc, 40); END IF;
640 fnd_message.set_name('PER', 'HR_50423_WPM_PRVPLAN');
641 fnd_message.raise_error;
642 END IF;
643 --
644 -- Check that the current plan start date is after the previous
645 -- plan end date
646 --
647 open csr_plan_overlap;
648 fetch csr_plan_overlap into l_end_date;
649 close csr_plan_overlap;
650
651 IF g_debug THEN hr_utility.set_location(l_proc, 50); END IF;
652
653 IF (l_end_date > p_start_date) THEN
654 IF g_debug THEN hr_utility.set_location(l_proc, 50); END IF;
655 fnd_message.set_name('PER', 'HR_50419_WPM_PLAN_OVERLAP');
656 fnd_message.raise_error;
657 END IF;
658
659 END IF;
660
661 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
662
663 exception
664 when app_exception.application_exception then
665 if hr_multi_message.exception_add
666 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.PREVIOUS_PLAN_ID'
667 ,p_associated_column2 => 'PER_PERF_MGMT_PLANS.START_DATE'
668 ) then
669 hr_utility.set_location(' Leaving:'||l_proc, 980);
670 raise;
671 end if;
672 hr_utility.set_location(' Leaving:'||l_proc, 990);
673
674 End chk_previous_plan_id;
675 --
676 -- ----------------------------------------------------------------------------
677 -- |------------------------< chk_start_from_to_date >------------------------|
678 -- ----------------------------------------------------------------------------
679 -- {Start Of Comments}
680 --
681 -- Description:
682 -- Checks that the plan start date is not greater than the plan end date.
683 --
684 -- Prerequisites:
685 -- None.
686 --
687 -- In Arguments:
688 --
689 --
690 -- Post Success:
691 -- Processing continues if the dates are valid.
692 --
693 -- Post Failure:
694 -- An application error is raised if the dates are not valid.
695 --
696 -- Access Status:
697 -- Internal Row Handler Use Only.
698 --
699 -- {End Of Comments}
700 -- ----------------------------------------------------------------------------
701 procedure chk_start_from_to_date
702 (p_plan_id in number
703 ,p_object_version_number in number
704 ,p_start_date in date
705 ,p_end_date in date
706 ,p_status_code in varchar2
707 ) is
708
709 -- Declare local variables
710
711 l_proc varchar2(72) := g_package||'chk_start_from_to_date';
712 l_api_updating boolean;
713
714 Begin
715
716 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
717
718 --
719 hr_api.mandatory_arg_error
720 (p_api_name => l_proc
721 ,p_argument => 'p_start_date'
722 ,p_argument_value => p_start_date
723 );
724 --
725 hr_api.mandatory_arg_error
726 (p_api_name => l_proc
727 ,p_argument => 'p_end_date'
728 ,p_argument_value => p_end_date
729 );
730
731 --
732 -- Only proceed with validation if :
733 -- a) The current g_old_rec is current and
734 -- b) The date values have changed
735 --
736 l_api_updating := per_pmp_shd.api_updating
737 (p_plan_id => p_plan_id
738 ,p_object_version_number => p_object_version_number);
739 --
740 IF (l_api_updating
741 AND nvl(per_pmp_shd.g_old_rec.start_date, hr_api.g_date)
742 = nvl(p_start_date, hr_api.g_date)
746 RETURN;
743 AND nvl(per_pmp_shd.g_old_rec.end_date, hr_api.g_date)
744 = nvl(p_end_date, hr_api.g_date))
745 THEN
747 END IF;
748
749 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
750
751 --
752 -- Checks that the valid from date is not greater than the valid to date.
753 --
754 IF (p_start_date > p_end_date) THEN
755 fnd_message.set_name('PER','HR_50233_WPM_PLAN_DATES');
756 fnd_message.raise_error;
757 END IF;
758 --
759 IF g_debug THEN hr_utility.set_location(l_proc, 30); END IF;
760 --
761 IF (l_api_updating AND p_status_code <> 'DRAFT' AND
762 nvl(per_pmp_shd.g_old_rec.start_date, hr_api.g_date)
763 <> nvl(p_start_date, hr_api.g_date))
764 THEN
765 fnd_message.set_name('PER','HR_50395_WPM_ST_DATE_UPD');
766 fnd_message.raise_error;
767 END IF;
768
769 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
770
771 exception
772 when app_exception.application_exception then
773 IF hr_multi_message.exception_add
774 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.START_DATE'
775 ,p_associated_column2 => 'PER_PERF_MGMT_PLANS.END_DATE'
776 ) THEN
777 hr_utility.set_location(' Leaving:'||l_proc, 980);
778 raise;
779 END IF;
780 hr_utility.set_location(' Leaving:'||l_proc, 990);
781
782 End chk_start_from_to_date;
783 --
784 -- ----------------------------------------------------------------------------
785 -- |----------------------------< chk_status_code >----------------------------|
786 -- ----------------------------------------------------------------------------
787 -- {Start Of Comments}
788 --
789 -- Description:
790 -- Checks that the status code is a valid lookup code in the lookup type
791 -- HR_WPM_PLAN_STATUS.
792 --
793 -- Prerequisites:
794 -- None.
795 --
796 -- In Arguments:
797 --
798 --
799 -- Post Success:
800 -- Processing continues if the status code is valid.
801 --
802 -- Post Failure:
803 -- An application error is raised if the status code is not valid.
804 --
805 -- Access Status:
806 -- Internal Row Handler Use Only.
807 --
808 -- {End Of Comments}
809 -- ----------------------------------------------------------------------------
810 procedure chk_status_code
811 (p_plan_id in number
812 ,p_object_version_number in number
813 ,p_effective_date in date
814 ,p_status_code in varchar2
815 ) is
816
817 -- Declare local variables
818
819 l_proc varchar2(72) := g_package||'chk_status_code';
820 l_api_updating boolean;
821
822 Begin
823
824 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
825
826 --
827 hr_api.mandatory_arg_error
828 (p_api_name => l_proc
829 ,p_argument => 'p_status_code'
830 ,p_argument_value => p_status_code
831 );
832 --
833 -- Only proceed with validation if :
834 -- a) The current g_old_rec is current and
835 -- b) The date values have changed
836 --
837 l_api_updating := per_pmp_shd.api_updating
838 (p_plan_id => p_plan_id
839 ,p_object_version_number => p_object_version_number);
840 --
841 IF (l_api_updating
842 AND nvl(per_pmp_shd.g_old_rec.status_code, hr_api.g_varchar2)
843 = nvl(p_status_code, hr_api.g_varchar2))
844 THEN
845 RETURN;
846 END IF;
847
848 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
849
850 --
851 -- Checks that the status code is valid
852 --
853 IF hr_api.not_exists_in_hrstanlookups
854 (p_effective_date => p_effective_date
855 ,p_lookup_type => 'HR_WPM_PLAN_STATUS'
856 ,p_lookup_code => p_status_code
857 ) THEN
858 fnd_message.set_name('PER','HR_50234_WPM_PLAN_STATUS');
859 fnd_message.raise_error;
860 END IF;
861
862 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
863
864 exception
865 when app_exception.application_exception then
866 IF hr_multi_message.exception_add
867 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.STATUS_CODE'
868 ) THEN
869 hr_utility.set_location(' Leaving:'||l_proc, 980);
870 raise;
871 END IF;
872 hr_utility.set_location(' Leaving:'||l_proc, 990);
873
877 -- |------------------------< chk_hierarchy_type_code >-----------------------|
874 End chk_status_code;
875 --
876 -- ----------------------------------------------------------------------------
878 -- ----------------------------------------------------------------------------
879 -- {Start Of Comments}
880 --
881 -- Description:
882 -- Checks that the hierarchy type code is a valid lookup code in the
883 -- lookup type HR_WPM_PLAN_HIER_TYPE.
884 --
885 -- Prerequisites:
886 -- None.
887 --
888 -- In Arguments:
889 --
890 --
891 -- Post Success:
892 -- Processing continues if the hierarchy type code is valid.
893 --
894 -- Post Failure:
895 -- An application error is raised if the hierarchy type code is not valid.
896 --
897 -- Access Status:
898 -- Internal Row Handler Use Only.
899 --
900 -- {End Of Comments}
901 -- ----------------------------------------------------------------------------
902 procedure chk_hierarchy_type_code
903 (p_plan_id in number
904 ,p_object_version_number in number
905 ,p_effective_date in date
906 ,p_hierarchy_type_code in varchar2
907 ) is
908
909 -- Declare local variables
910
911 l_proc varchar2(72) := g_package||'chk_hierarchy_type_code';
912 l_api_updating boolean;
913
914 Begin
915
916 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
917
918 --
919 -- Only proceed with validation if :
920 -- a) The current g_old_rec is current and
921 -- b) The date values have changed
922 --
923 l_api_updating := per_pmp_shd.api_updating
924 (p_plan_id => p_plan_id
925 ,p_object_version_number => p_object_version_number);
926 --
927 IF (l_api_updating
928 AND nvl(per_pmp_shd.g_old_rec.hierarchy_type_code, hr_api.g_varchar2)
929 = nvl(p_hierarchy_type_code, hr_api.g_varchar2))
930 THEN
931 RETURN;
932 END IF;
933
934 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
935
936 --
937 -- Checks that the hierarchy type is valid
938 --
939 IF (p_hierarchy_type_code IS NOT NULL) THEN
940 IF hr_api.not_exists_in_hrstanlookups
941 (p_effective_date => p_effective_date
942 ,p_lookup_type => 'HR_WPM_PLAN_HIER_TYPE'
943 ,p_lookup_code => p_hierarchy_type_code
944 ) THEN
945 fnd_message.set_name('PER','HR_50235_WPM_PLAN_HIER_TYP');
946 fnd_message.raise_error;
947 END IF;
948 END IF;
949
950 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
951
952 exception
953 when app_exception.application_exception then
954 IF hr_multi_message.exception_add
955 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.HIERARCHY_TYPE_CODE'
956 ) THEN
957 hr_utility.set_location(' Leaving:'||l_proc, 980);
958 raise;
959 END IF;
960 hr_utility.set_location(' Leaving:'||l_proc, 990);
961
962 End chk_hierarchy_type_code;
963 --
964 -- ----------------------------------------------------------------------------
965 -- |-------------------------< chk_supervisor_id >----------------------------|
966 -- ----------------------------------------------------------------------------
967 -- {Start Of Comments}
968 --
969 -- Description:
970 -- Checks that the supervisor id is valid person id PER_ALL_PEOPLE_F.
971 --
972 -- Prerequisites:
973 -- None.
974 --
975 -- In Arguments:
976 --
977 --
978 -- Post Success:
982 -- An application error is raised if the supervisor id is not valid.
979 -- Processing continues if the supervisor id is valid.
980 --
981 -- Post Failure:
983 --
984 -- Access Status:
985 -- Internal Row Handler Use Only.
986 --
987 -- {End Of Comments}
988 -- ----------------------------------------------------------------------------
989 procedure chk_supervisor_id
990 (p_plan_id in number
991 ,p_object_version_number in number
992 ,p_effective_date in date
993 ,p_hierarchy_type_code in varchar2
994 ,p_supervisor_id in number
995 ) is
996
997 -- Declare the cursor
998
999 cursor csr_supervisor_id is
1000 select 'Y'
1001 from per_all_people_f ppf
1002 where ppf.person_id = p_supervisor_id
1003 and p_effective_date between ppf.effective_start_date and ppf.effective_end_date;
1004
1005 -- Declare local variables
1006
1007 l_proc varchar2(72) := g_package||'chk_supervisor_id';
1008 l_api_updating boolean;
1009 l_exist varchar2(1);
1010 Begin
1011
1012 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1013
1014 --
1015 -- Only proceed with validation if :
1016 -- a) The current g_old_rec is current and
1017 -- b) The date values have changed
1018 --
1019 l_api_updating := per_pmp_shd.api_updating
1020 (p_plan_id => p_plan_id
1021 ,p_object_version_number => p_object_version_number);
1022 --
1023 IF (l_api_updating
1024 AND nvl(per_pmp_shd.g_old_rec.hierarchy_type_code, hr_api.g_varchar2)
1025 = nvl(p_hierarchy_type_code, hr_api.g_varchar2)
1026 AND nvl(per_pmp_shd.g_old_rec.supervisor_id, hr_api.g_number)
1027 = nvl(p_supervisor_id, hr_api.g_number))
1028 THEN
1029 RETURN;
1030 END IF;
1031
1032 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1033
1034 --
1035 -- Validate the parameter has been entered.
1036 --
1037 IF p_hierarchy_type_code IS NOT null AND
1038 p_hierarchy_type_code = 'SUP' THEN
1039 hr_api.mandatory_arg_error
1040 (p_api_name => l_proc
1041 ,p_argument => 'p_supervisor_id'
1042 ,p_argument_value => p_supervisor_id
1043 );
1044 END IF;
1045
1046 IF p_supervisor_id IS NOT null THEN
1047 --
1048 -- Checks that the supervisor is valid person
1049 --
1050 open csr_supervisor_id;
1051 fetch csr_supervisor_id into l_exist;
1052 close csr_supervisor_id;
1053
1054 IF (l_exist IS NULL) THEN
1055 fnd_message.set_name('PER','HR_50236_WPM_PLAN_SUPERVISOR');
1056 fnd_message.raise_error;
1057 END IF;
1058 END IF;
1059
1060 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1061
1062 exception
1063 when app_exception.application_exception then
1064 IF hr_multi_message.exception_add
1065 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.SUPERVISOR_ID'
1066 ) THEN
1067 hr_utility.set_location(' Leaving:'||l_proc, 980);
1068 raise;
1069 END IF;
1070 hr_utility.set_location(' Leaving:'||l_proc, 990);
1071
1072 End chk_supervisor_id;
1073 --
1074 -- ----------------------------------------------------------------------------
1075 -- |--------------< chk_supervisor_assignment_id >----------------------------|
1076 -- ----------------------------------------------------------------------------
1077 -- {Start Of Comments}
1078 --
1079 -- Description:
1080 -- Checks that the supervisor assignment is a valid person id
1081 -- PER_ALL_ASSIGNMENTS_F.
1082 --
1083 -- Prerequisites:
1084 -- None.
1085 --
1086 -- In Arguments:
1087 --
1088 --
1089 -- Post Success:
1090 -- Processing continues if the supervisor assignment id is valid.
1091 --
1092 -- Post Failure:
1093 -- An application error is raised if the supervisor assignment id is not valid.
1094 --
1095 -- Access Status:
1096 -- Internal Row Handler Use Only.
1097 --
1098 -- {End Of Comments}
1099 -- ----------------------------------------------------------------------------
1100 procedure chk_supervisor_assignment_id
1101 (p_plan_id in number
1102 ,p_object_version_number in number
1103 ,p_effective_date in date
1104 ,p_hierarchy_type_code in varchar2
1105 ,p_supervisor_assignment_id in number
1106 ) is
1107
1108 -- Declare the cursor
1109
1110 cursor csr_supervisor_assignment_id is
1111 select 'Y'
1115 paf.effective_start_date and paf.effective_end_date;
1112 from per_all_assignments_f paf
1113 where paf.assignment_id = p_supervisor_assignment_id
1114 and p_effective_date between
1116
1117 -- Declare local variables
1118
1119 l_proc varchar2(72) := g_package||'chk_supervisor_assignment_id';
1120 l_api_updating boolean;
1121 l_exist varchar2(1);
1122 Begin
1123
1124 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1125
1126 --
1127 -- Only proceed with validation if :
1128 -- a) The current g_old_rec is current and
1129 -- b) The date values have changed
1130 --
1131 l_api_updating := per_pmp_shd.api_updating
1132 (p_plan_id => p_plan_id
1133 ,p_object_version_number => p_object_version_number);
1134 --
1135 IF (l_api_updating
1136 AND nvl(per_pmp_shd.g_old_rec.hierarchy_type_code, hr_api.g_varchar2)
1137 = nvl(p_hierarchy_type_code, hr_api.g_varchar2)
1138 AND nvl(per_pmp_shd.g_old_rec.supervisor_assignment_id, hr_api.g_number)
1139 = nvl(p_supervisor_assignment_id, hr_api.g_number))
1140 THEN
1141 RETURN;
1142 END IF;
1143
1144 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1145
1146 -- Validate the parameter has been entered.
1147 --
1148 IF p_hierarchy_type_code IS NOT null AND
1149 p_hierarchy_type_code = 'SUP_ASG' THEN
1150 hr_api.mandatory_arg_error
1151 (p_api_name => l_proc
1152 ,p_argument => 'p_supervisor_assignment_id'
1153 ,p_argument_value => p_supervisor_assignment_id
1154 );
1155 END IF;
1156
1157 IF p_supervisor_assignment_id IS NOT null THEN
1158 --
1159 -- Checks that the supervisor assignment is valid
1160 --
1161 open csr_supervisor_assignment_id;
1162 fetch csr_supervisor_assignment_id into l_exist;
1163 close csr_supervisor_assignment_id;
1164
1165 IF (l_exist IS NULL) THEN
1166 fnd_message.set_name('PER','HR_50237_WPM_PLAN_SUP_ASG');
1167 fnd_message.raise_error;
1168 END IF;
1169 END IF;
1170
1171 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1172
1173 exception
1174 when app_exception.application_exception then
1175 IF hr_multi_message.exception_add
1176 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.SUPERVISOR_ASSIGNMENT_ID'
1177 ) THEN
1178 hr_utility.set_location(' Leaving:'||l_proc, 980);
1179 raise;
1180 END IF;
1181 hr_utility.set_location(' Leaving:'||l_proc, 990);
1182
1183 End chk_supervisor_assignment_id;
1184 --
1185 -- ----------------------------------------------------------------------------
1186 -- |---------------------< chk_organization_structure_id >--------------------|
1187 -- ----------------------------------------------------------------------------
1188 -- {Start Of Comments}
1189 --
1190 -- Description:
1191 -- Checks that the organization structure id exists in the table
1192 -- PER_ORGANIZATION_STRUCTURES.
1193 --
1194 -- Prerequisites:
1195 -- None.
1196 --
1197 -- In Arguments:
1198 --
1199 --
1200 -- Post Success:
1201 -- Processing continues if the organization structure id exists.
1202 --
1203 -- Post Failure:
1204 -- An application error is raised if the organization structure id does not
1205 -- exists.
1206 --
1207 -- Access Status:
1208 -- Internal Row Handler Use Only.
1209 --
1210 -- {End Of Comments}
1211 -- ----------------------------------------------------------------------------
1212 procedure chk_organization_structure_id
1213 (p_plan_id in number
1214 ,p_object_version_number in number
1215 ,p_hierarchy_type_code in varchar2
1216 ,p_organization_structure_id in number
1217 ) is
1218
1219 -- Declare the cursor
1220
1221 cursor csr_org_structure_id is
1222 select 'Y'
1223 from per_organization_structures pos
1224 where pos.organization_structure_id = p_organization_structure_id;
1225
1226 -- Declare local variables
1227
1228 l_proc varchar2(72) := g_package||'chk_organization_structure_id';
1229 l_api_updating boolean;
1230 l_exist varchar2(1);
1231 Begin
1232
1233 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1234
1235 --
1236 -- Only proceed with validation if :
1237 -- a) The current g_old_rec is current and
1238 -- b) The date values have changed
1239 --
1240 l_api_updating := per_pmp_shd.api_updating
1241 (p_plan_id => p_plan_id
1242 ,p_object_version_number => p_object_version_number);
1243 --
1244 IF (l_api_updating
1245 AND nvl(per_pmp_shd.g_old_rec.hierarchy_type_code, hr_api.g_varchar2)
1246 = nvl(p_hierarchy_type_code, hr_api.g_varchar2)
1247 AND nvl(per_pmp_shd.g_old_rec.organization_structure_id, hr_api.g_number)
1248 = nvl(p_organization_structure_id, hr_api.g_number))
1249 THEN
1250 RETURN;
1251 END IF;
1252
1253 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1254
1255 --
1256 -- Validate the parameter has been entered.
1257 --
1258 IF p_hierarchy_type_code IS NOT null AND
1259 p_hierarchy_type_code = 'ORG' THEN
1260 hr_api.mandatory_arg_error
1261 (p_api_name => l_proc
1262 ,p_argument => 'p_organization_structure_id'
1263 ,p_argument_value => p_organization_structure_id
1264 );
1265 END IF;
1266
1267 IF p_organization_structure_id IS NOT null THEN
1268 --
1269 -- Checks that the organization structure exists
1270 --
1271 open csr_org_structure_id;
1272 fetch csr_org_structure_id into l_exist;
1273 close csr_org_structure_id;
1274
1275 IF (l_exist IS NULL) THEN
1276 fnd_message.set_name('PER','HR_50238_WPM_PLAN_ORG_HIER');
1277 fnd_message.raise_error;
1278 END IF;
1279 END IF;
1280
1281 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1282
1283 exception
1284 when app_exception.application_exception then
1285 IF hr_multi_message.exception_add
1289 raise;
1286 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.ORGANIZATION_STRUCTURE_ID'
1287 ) THEN
1288 hr_utility.set_location(' Leaving:'||l_proc, 980);
1290 END IF;
1291 hr_utility.set_location(' Leaving:'||l_proc, 990);
1292
1293 End chk_organization_structure_id;
1294 --
1295 -- ----------------------------------------------------------------------------
1296 -- |----------------------< chk_org_structure_version_id >--------------------|
1297 -- ----------------------------------------------------------------------------
1298 -- {Start Of Comments}
1299 --
1300 -- Description:
1301 -- Checks that the organization structure version id exists in the table
1302 -- PER_ORG_STRUCTURE_VERSIONS.
1303 --
1304 -- Prerequisites:
1305 -- None.
1306 --
1307 -- In Arguments:
1308 --
1309 --
1310 -- Post Success:
1311 -- Processing continues if the organization structure version id exists.
1312 --
1313 -- Post Failure:
1314 -- An application error is raised if the organization structure version id
1315 -- does not exists.
1316 --
1317 -- Access Status:
1318 -- Internal Row Handler Use Only.
1319 --
1320 -- {End Of Comments}
1321 -- ----------------------------------------------------------------------------
1322 procedure chk_org_structure_version_id
1323 (p_plan_id in number
1324 ,p_object_version_number in number
1325 ,p_hierarchy_type_code in varchar2
1326 ,p_org_structure_version_id in number
1327 ) is
1328
1329 -- Declare the cursor
1330
1331 cursor csr_org_structure_version_id is
1332 select 'Y'
1333 from per_org_structure_versions psv
1334 where psv.org_structure_version_id = p_org_structure_version_id;
1335
1336 -- Declare local variables
1337
1338 l_proc varchar2(72) := g_package||'chk_org_structure_version_id';
1339 l_api_updating boolean;
1340 l_exist varchar2(1);
1341 Begin
1342
1343 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1344
1345 --
1346 -- Only proceed with validation if :
1347 -- a) The current g_old_rec is current and
1348 -- b) The date values have changed
1349 --
1350 l_api_updating := per_pmp_shd.api_updating
1351 (p_plan_id => p_plan_id
1352 ,p_object_version_number => p_object_version_number);
1353 --
1354 IF (l_api_updating
1355 AND nvl(per_pmp_shd.g_old_rec.hierarchy_type_code, hr_api.g_varchar2)
1356 = nvl(p_hierarchy_type_code, hr_api.g_varchar2)
1357 AND nvl(per_pmp_shd.g_old_rec.org_structure_version_id, hr_api.g_number)
1358 = nvl(p_org_structure_version_id, hr_api.g_number))
1359 THEN
1360 RETURN;
1361 END IF;
1362
1363 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1364
1365 --
1366 -- Validate the parameter has been entered.
1367 --
1368 IF p_hierarchy_type_code IS NOT null AND
1369 p_hierarchy_type_code = 'ORG' THEN
1370 hr_api.mandatory_arg_error
1371 (p_api_name => l_proc
1372 ,p_argument => 'p_org_structure_version_id'
1373 ,p_argument_value => p_org_structure_version_id
1374 );
1375 END IF;
1376
1377 IF p_org_structure_version_id IS NOT null THEN
1378 --
1379 -- Checks that the org structure version exists
1380 --
1381 open csr_org_structure_version_id;
1382 fetch csr_org_structure_version_id into l_exist;
1383 close csr_org_structure_version_id;
1384
1385 IF (l_exist IS NULL) THEN
1386 fnd_message.set_name('PER','HR_50239_WPM_PLAN_ORG_HIER_VER');
1387 fnd_message.raise_error;
1388 END IF;
1389 END IF;
1390
1391 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1392
1393 exception
1394 when app_exception.application_exception then
1395 IF hr_multi_message.exception_add
1396 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.ORG_STRUCTURE_VERSION_ID'
1397 ) THEN
1398 hr_utility.set_location(' Leaving:'||l_proc, 980);
1399 raise;
1400 END IF;
1401 hr_utility.set_location(' Leaving:'||l_proc, 990);
1402
1403 End chk_org_structure_version_id;
1404 --
1405 -- ----------------------------------------------------------------------------
1406 -- |----------------------< chk_org_structure_version >-----------------------|
1407 -- ----------------------------------------------------------------------------
1408 -- {Start Of Comments}
1409 --
1410 -- Description:
1411 -- Checks that the hierarchy version is valid for given organization structure.
1412 --
1413 -- Prerequisites:
1414 -- None.
1415 --
1416 -- In Arguments:
1417 --
1418 --
1419 -- Post Success:
1420 -- Processing continues if the organization structure version is valid.
1421 --
1422 -- Post Failure:
1423 -- An application error is raised if the organization structure version is
1424 -- not valid.
1425 --
1426 -- Access Status:
1427 -- Internal Row Handler Use Only.
1428 --
1429 -- {End Of Comments}
1430 -- ----------------------------------------------------------------------------
1431 procedure chk_org_structure_version
1432 (p_plan_id in number
1433 ,p_object_version_number in number
1434 ,p_organization_structure_id in number
1435 ,p_org_structure_version_id in number
1436 ) is
1437
1438 -- Declare the cursor
1439
1440 cursor csr_org_structure_version_id is
1441 select 'Y'
1442 from per_org_structure_versions psv
1443 where psv.organization_structure_id = p_organization_structure_id
1447
1444 and psv.org_structure_version_id = p_org_structure_version_id;
1445
1446 -- Declare local variables
1448 l_proc varchar2(72) := g_package||'chk_org_structure_version';
1449 l_api_updating boolean;
1450 l_exist varchar2(1);
1451 Begin
1452
1453 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1454
1455 --
1456 -- Only proceed with validation if :
1457 -- a) The current g_old_rec is current and
1458 -- b) The date values have changed
1459 --
1460 l_api_updating := per_pmp_shd.api_updating
1461 (p_plan_id => p_plan_id
1462 ,p_object_version_number => p_object_version_number);
1463 --
1464 IF (l_api_updating
1465 AND nvl(per_pmp_shd.g_old_rec.organization_structure_id, hr_api.g_number)
1466 = nvl(p_organization_structure_id, hr_api.g_number)
1467 AND nvl(per_pmp_shd.g_old_rec.org_structure_version_id, hr_api.g_number)
1468 = nvl(p_org_structure_version_id, hr_api.g_number))
1469 THEN
1470 RETURN;
1471 END IF;
1472
1473 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1474
1475 IF p_organization_structure_id IS NOT null AND
1476 p_org_structure_version_id IS NOT null THEN
1477 --
1478 -- Checks that the hierarchy version is valid for given structure
1479 --
1480 open csr_org_structure_version_id;
1481 fetch csr_org_structure_version_id into l_exist;
1482 close csr_org_structure_version_id;
1483
1484 IF (l_exist IS NULL) THEN
1485 fnd_message.set_name('PER','HR_50241_WPM_PLAN_INV_ORG_HIER');
1486 fnd_message.raise_error;
1487 END IF;
1488 END IF;
1489
1490 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1491
1492 exception
1493 when app_exception.application_exception then
1494 IF hr_multi_message.exception_add
1495 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.ORGANIZATION_STRUCTURE_ID'
1496 ,p_associated_column2 => 'PER_PERF_MGMT_PLANS.ORG_STRUCTURE_VERSION_ID'
1497 ) THEN
1498 hr_utility.set_location(' Leaving:'||l_proc, 980);
1499 raise;
1500 END IF;
1501 hr_utility.set_location(' Leaving:'||l_proc, 990);
1502
1503 End chk_org_structure_version;
1504 --
1505 -- ----------------------------------------------------------------------------
1506 -- |------------------------< chk_top_organization_id >-----------------------|
1507 -- ----------------------------------------------------------------------------
1508 -- {Start Of Comments}
1509 --
1510 -- Description:
1511 -- Checks that the organization id exists in the table
1512 -- PER_ORG_STRUCTURE_ELEMENTS.
1513 --
1514 -- Prerequisites:
1515 -- None.
1516 --
1517 -- In Arguments:
1518 --
1519 --
1520 -- Post Success:
1521 -- Processing continues if the organization id exists.
1522 --
1523 -- Post Failure:
1524 -- An application error is raised if the organization id
1525 -- does not exists.
1526 --
1527 -- Access Status:
1528 -- Internal Row Handler Use Only.
1529 --
1530 -- {End Of Comments}
1531 -- ----------------------------------------------------------------------------
1532 procedure chk_top_organization_id
1533 (p_plan_id in number
1534 ,p_object_version_number in number
1535 ,p_hierarchy_type_code in varchar2
1536 ,p_top_organization_id in number
1537 ,p_org_structure_version_id in number
1538 ) is
1539
1540 -- Declare the cursor
1541 cursor csr_org_id is
1542 select 'Y'
1543 from per_org_structure_elements pse
1544 where pse.organization_id_parent = p_top_organization_id
1545 and (p_org_structure_version_id IS null OR
1546 (p_org_structure_version_id IS NOT null AND
1547 pse.org_structure_version_id = p_org_structure_version_id));
1548
1549 -- Declare local variables
1550
1551 l_proc varchar2(72) := g_package||'chk_top_organization_id';
1552 l_api_updating boolean;
1553 l_exist varchar2(1);
1554 Begin
1555
1556 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1557
1558 --
1559 -- Only proceed with validation if :
1560 -- a) The current g_old_rec is current and
1561 -- b) The date values have changed
1562 --
1563 l_api_updating := per_pmp_shd.api_updating
1564 (p_plan_id => p_plan_id
1565 ,p_object_version_number => p_object_version_number);
1566 --
1567 IF (l_api_updating
1568 AND nvl(per_pmp_shd.g_old_rec.hierarchy_type_code, hr_api.g_varchar2)
1569 = nvl(p_hierarchy_type_code, hr_api.g_varchar2)
1570 AND nvl(per_pmp_shd.g_old_rec.org_structure_version_id, hr_api.g_number)
1571 = nvl(p_org_structure_version_id, hr_api.g_number)
1572 AND nvl(per_pmp_shd.g_old_rec.top_organization_id, hr_api.g_number)
1573 = nvl(p_top_organization_id, hr_api.g_number))
1574 THEN
1575 RETURN;
1576 END IF;
1577
1578 --
1579 -- Validate the parameter has been entered.
1580 --
1581 IF p_hierarchy_type_code IS NOT null AND
1582 p_hierarchy_type_code = 'ORG' THEN
1583 hr_api.mandatory_arg_error
1584 (p_api_name => l_proc
1585 ,p_argument => 'p_top_organization_id'
1586 ,p_argument_value => p_top_organization_id
1587 );
1588 END IF;
1589
1590 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1591
1592 IF p_top_organization_id IS NOT null THEN
1593 --
1594 -- Checks that the org exists
1595 --
1596 open csr_org_id;
1600 IF (l_exist IS NULL) THEN
1597 fetch csr_org_id into l_exist;
1598 close csr_org_id;
1599
1601 fnd_message.set_name('PER','HR_50388_WPM_PLAN_ORG');
1602 fnd_message.raise_error;
1603 END IF;
1604 END IF;
1605
1606 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1607
1608 exception
1609 when app_exception.application_exception then
1610 IF hr_multi_message.exception_add
1611 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.TOP_ORGANIZATION_ID'
1612 ) THEN
1613 hr_utility.set_location(' Leaving:'||l_proc, 980);
1614 raise;
1615 END IF;
1616 hr_utility.set_location(' Leaving:'||l_proc, 990);
1617
1618 End chk_top_organization_id;
1619 --
1620 -- ----------------------------------------------------------------------------
1621 -- |-----------------------< chk_position_structure_id >----------------------|
1622 -- ----------------------------------------------------------------------------
1623 -- {Start Of Comments}
1624 --
1625 -- Description:
1626 -- Checks that the position structure id exists in the table
1627 -- PER_POSITION_STRUCTURES.
1628 --
1629 -- Prerequisites:
1630 -- None.
1631 --
1632 -- In Arguments:
1633 --
1634 --
1635 -- Post Success:
1636 -- Processing continues if the position structure id exists.
1637 --
1638 -- Post Failure:
1639 -- An application error is raised if the position structure id does not
1640 -- exists.
1641 --
1642 -- Access Status:
1643 -- Internal Row Handler Use Only.
1644 --
1645 -- {End Of Comments}
1646 -- ----------------------------------------------------------------------------
1647 procedure chk_position_structure_id
1648 (p_plan_id in number
1649 ,p_object_version_number in number
1650 ,p_hierarchy_type_code in varchar2
1651 ,p_position_structure_id in number
1652 ) is
1653
1654 -- Declare the cursor
1655
1656 cursor csr_pos_structure_id is
1657 select 'Y'
1658 from per_position_structures pps
1659 where pps.position_structure_id = p_position_structure_id;
1660
1661 -- Declare local variables
1662
1663 l_proc varchar2(72) := g_package||'chk_position_structure_id';
1664 l_api_updating boolean;
1665 l_exist varchar2(1);
1666 Begin
1667
1668 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1669
1670 --
1671 -- Only proceed with validation if :
1672 -- a) The current g_old_rec is current and
1673 -- b) The date values have changed
1674 --
1675 l_api_updating := per_pmp_shd.api_updating
1676 (p_plan_id => p_plan_id
1677 ,p_object_version_number => p_object_version_number);
1678 --
1679 IF (l_api_updating
1680 AND nvl(per_pmp_shd.g_old_rec.hierarchy_type_code, hr_api.g_varchar2)
1681 = nvl(p_hierarchy_type_code, hr_api.g_varchar2)
1682 AND nvl(per_pmp_shd.g_old_rec.position_structure_id, hr_api.g_number)
1683 = nvl(p_position_structure_id, hr_api.g_number))
1684 THEN
1685 RETURN;
1686 END IF;
1687
1688 --
1689 -- Validate the parameter has been entered.
1690 --
1691 IF p_hierarchy_type_code IS NOT null AND
1692 p_hierarchy_type_code = 'POS' THEN
1693 hr_api.mandatory_arg_error
1694 (p_api_name => l_proc
1695 ,p_argument => 'p_position_structure_id'
1696 ,p_argument_value => p_position_structure_id
1697 );
1698 END IF;
1699
1700 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1701
1702 IF p_position_structure_id IS NOT null THEN
1703 --
1704 -- Checks that the position structure exists
1705 --
1706 open csr_pos_structure_id;
1707 fetch csr_pos_structure_id into l_exist;
1708 close csr_pos_structure_id;
1709
1710 IF (l_exist IS NULL) THEN
1711 fnd_message.set_name('PER','HR_50242_WPM_PLAN_POS_HIER');
1712 fnd_message.raise_error;
1713 END IF;
1714 END IF;
1715
1716 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1717
1718 exception
1719 when app_exception.application_exception then
1720 IF hr_multi_message.exception_add
1721 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.POSITION_STRUCTURE_ID'
1722 ) THEN
1723 hr_utility.set_location(' Leaving:'||l_proc, 980);
1724 raise;
1725 END IF;
1726 hr_utility.set_location(' Leaving:'||l_proc, 990);
1727
1728 End chk_position_structure_id;
1729 --
1730 -- ----------------------------------------------------------------------------
1731 -- |----------------------< chk_pos_structure_version_id >--------------------|
1732 -- ----------------------------------------------------------------------------
1733 -- {Start Of Comments}
1734 --
1735 -- Description:
1736 -- Checks that the position structure version id exists in the table
1737 -- PER_POS_STRUCTURE_VERSIONS.
1738 --
1739 -- Prerequisites:
1740 -- None.
1741 --
1742 -- In Arguments:
1743 --
1744 --
1745 -- Post Success:
1746 -- Processing continues if the position structure version id exists.
1747 --
1748 -- Post Failure:
1749 -- An application error is raised if the position structure version id
1750 -- does not exists.
1751 --
1752 -- Access Status:
1753 -- Internal Row Handler Use Only.
1754 --
1755 -- {End Of Comments}
1756 -- ----------------------------------------------------------------------------
1757 procedure chk_pos_structure_version_id
1758 (p_plan_id in number
1762 ) is
1759 ,p_object_version_number in number
1760 ,p_hierarchy_type_code in varchar2
1761 ,p_pos_structure_version_id in number
1763
1764 -- Declare the cursor
1765
1766 cursor csr_pos_structure_version_id is
1767 select 'Y'
1768 from per_pos_structure_versions ppv
1769 where ppv.pos_structure_version_id = p_pos_structure_version_id;
1770
1771 -- Declare local variables
1772
1773 l_proc varchar2(72) := g_package||'chk_pos_structure_version_id';
1774 l_api_updating boolean;
1775 l_exist varchar2(1);
1776 Begin
1777
1778 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1779
1780 --
1781 -- Only proceed with validation if :
1782 -- a) The current g_old_rec is current and
1783 -- b) The date values have changed
1784 --
1785 l_api_updating := per_pmp_shd.api_updating
1786 (p_plan_id => p_plan_id
1787 ,p_object_version_number => p_object_version_number);
1788 --
1789 IF (l_api_updating
1790 AND nvl(per_pmp_shd.g_old_rec.hierarchy_type_code, hr_api.g_varchar2)
1791 = nvl(p_hierarchy_type_code, hr_api.g_varchar2)
1792 AND nvl(per_pmp_shd.g_old_rec.pos_structure_version_id, hr_api.g_number)
1793 = nvl(p_pos_structure_version_id, hr_api.g_number))
1794 THEN
1795 RETURN;
1796 END IF;
1797
1798 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1799
1800 --
1801 -- Validate the parameter has been entered.
1802 --
1803 IF p_hierarchy_type_code IS NOT null AND
1804 p_hierarchy_type_code = 'POS' THEN
1805 hr_api.mandatory_arg_error
1806 (p_api_name => l_proc
1807 ,p_argument => 'p_pos_structure_version_id'
1808 ,p_argument_value => p_pos_structure_version_id
1809 );
1810 END IF;
1811
1812 IF p_pos_structure_version_id IS NOT null THEN
1813 --
1814 -- Checks that the pos structure version exists
1815 --
1816 open csr_pos_structure_version_id;
1817 fetch csr_pos_structure_version_id into l_exist;
1818 close csr_pos_structure_version_id;
1819
1820 IF (l_exist IS NULL) THEN
1821 fnd_message.set_name('PER','HR_50243_WPM_PLAN_POS_HER_VER');
1822 fnd_message.raise_error;
1823 END IF;
1824 END IF;
1825
1826 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1827
1828 exception
1829 when app_exception.application_exception then
1830 IF hr_multi_message.exception_add
1831 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.POS_STRUCTURE_VERSION_ID'
1832 ) THEN
1833 hr_utility.set_location(' Leaving:'||l_proc, 980);
1834 raise;
1835 END IF;
1836 hr_utility.set_location(' Leaving:'||l_proc, 990);
1837
1838 End chk_pos_structure_version_id;
1839 --
1840 -- ----------------------------------------------------------------------------
1841 -- |----------------------< chk_pos_structure_version >-----------------------|
1842 -- ----------------------------------------------------------------------------
1843 -- {Start Of Comments}
1844 --
1845 -- Description:
1846 -- Checks that the hierarchy version is valid for given position structure.
1847 --
1848 -- Prerequisites:
1849 -- None.
1850 --
1851 -- In Arguments:
1852 --
1853 --
1854 -- Post Success:
1855 -- Processing continues if the position structure version is valid.
1856 --
1857 -- Post Failure:
1858 -- An application error is raised if the position structure version is
1859 -- not valid.
1860 --
1861 -- Access Status:
1862 -- Internal Row Handler Use Only.
1863 --
1864 -- {End Of Comments}
1865 -- ----------------------------------------------------------------------------
1866 procedure chk_pos_structure_version
1867 (p_plan_id in number
1868 ,p_object_version_number in number
1869 ,p_position_structure_id in number
1870 ,p_pos_structure_version_id in number
1871 ) is
1872
1873 -- Declare the cursor
1874
1875 cursor csr_pos_structure_version_id is
1876 select 'Y'
1877 from per_pos_structure_versions psv
1878 where psv.position_structure_id = p_position_structure_id
1879 and psv.pos_structure_version_id = p_pos_structure_version_id;
1880
1881 -- Declare local variables
1882
1883 l_proc varchar2(72) := g_package||'chk_pos_structure_version';
1884 l_api_updating boolean;
1885 l_exist varchar2(1);
1886 Begin
1887
1888 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1889
1890 --
1891 -- Only proceed with validation if :
1892 -- a) The current g_old_rec is current and
1893 -- b) The date values have changed
1894 --
1895 l_api_updating := per_pmp_shd.api_updating
1896 (p_plan_id => p_plan_id
1897 ,p_object_version_number => p_object_version_number);
1898 --
1899 IF (l_api_updating
1900 AND nvl(per_pmp_shd.g_old_rec.position_structure_id, hr_api.g_number)
1901 = nvl(p_position_structure_id, hr_api.g_number)
1902 AND nvl(per_pmp_shd.g_old_rec.pos_structure_version_id, hr_api.g_number)
1903 = nvl(p_pos_structure_version_id, hr_api.g_number))
1904 THEN
1905 RETURN;
1906 END IF;
1907
1908 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
1909
1910 IF p_position_structure_id IS NOT null AND
1911 p_pos_structure_version_id IS NOT null THEN
1912 --
1913 -- Checks that the hierarchy version is valid for given structure
1914 --
1918
1915 open csr_pos_structure_version_id;
1916 fetch csr_pos_structure_version_id into l_exist;
1917 close csr_pos_structure_version_id;
1919 IF (l_exist IS NULL) THEN
1920 fnd_message.set_name('PER','HR_50244_WPM_PLAN_INV_POS_HIER');
1921 fnd_message.raise_error;
1922 END IF;
1923 END IF;
1924
1925 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
1926
1927 exception
1928 when app_exception.application_exception then
1929 IF hr_multi_message.exception_add
1930 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.POSITION_STRUCTURE_ID'
1931 ,p_associated_column2 => 'PER_PERF_MGMT_PLANS.POS_STRUCTURE_VERSION_ID'
1932 ) THEN
1933 hr_utility.set_location(' Leaving:'||l_proc, 980);
1934 raise;
1935 END IF;
1936 hr_utility.set_location(' Leaving:'||l_proc, 990);
1937
1938 End chk_pos_structure_version;
1939 --
1940 -- ----------------------------------------------------------------------------
1941 -- |-------------------------< chk_top_position_id >--------------------------|
1942 -- ----------------------------------------------------------------------------
1943 -- {Start Of Comments}
1944 --
1945 -- Description:
1946 -- Checks that the position id exists in the table
1947 -- HR_ALL_POSITION_F.
1948 --
1949 -- Prerequisites:
1950 -- None.
1951 --
1952 -- In Arguments:
1953 --
1954 --
1955 -- Post Success:
1956 -- Processing continues if the organization id exists.
1957 --
1958 -- Post Failure:
1959 -- An application error is raised if the organization id
1960 -- does not exists.
1961 --
1962 -- Access Status:
1963 -- Internal Row Handler Use Only.
1964 --
1965 -- {End Of Comments}
1966 -- ----------------------------------------------------------------------------
1967 procedure chk_top_position_id
1968 (p_plan_id in number
1969 ,p_object_version_number in number
1970 ,p_hierarchy_type_code in varchar2
1971 ,p_pos_structure_version_id in number
1972 ,p_top_position_id in number
1973 ) is
1974
1975 -- Declare the cursor
1976 cursor csr_pos_id is
1977 select 'Y'
1978 from per_pos_structure_elements pos
1979 where pos.parent_position_id = p_top_position_id
1980 and (p_pos_structure_version_id IS null OR
1981 (p_pos_structure_version_id IS NOT null AND
1982 pos.pos_structure_version_id = p_pos_structure_version_id));
1983
1984 -- Declare local variables
1985
1986 l_proc varchar2(72) := g_package||'chk_top_position_id';
1987 l_api_updating boolean;
1988 l_exist varchar2(1);
1989 Begin
1990
1991 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
1992
1993 --
1994 -- Only proceed with validation if :
1995 -- a) The current g_old_rec is current and
1996 -- b) The date values have changed
1997 --
1998 l_api_updating := per_pmp_shd.api_updating
1999 (p_plan_id => p_plan_id
2000 ,p_object_version_number => p_object_version_number);
2001 --
2002 IF (l_api_updating
2003 AND nvl(per_pmp_shd.g_old_rec.hierarchy_type_code, hr_api.g_varchar2)
2004 = nvl(p_hierarchy_type_code, hr_api.g_varchar2)
2005 AND nvl(per_pmp_shd.g_old_rec.pos_structure_version_id, hr_api.g_number)
2006 = nvl(p_pos_structure_version_id, hr_api.g_number)
2007 AND nvl(per_pmp_shd.g_old_rec.top_position_id, hr_api.g_number)
2008 = nvl(p_top_position_id, hr_api.g_number))
2009 THEN
2010 RETURN;
2011 END IF;
2012
2013 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
2014
2015 --
2016 -- Validate the parameter has been entered.
2017 --
2018 IF p_hierarchy_type_code IS NOT null AND
2019 p_hierarchy_type_code = 'POS' THEN
2020 hr_api.mandatory_arg_error
2021 (p_api_name => l_proc
2022 ,p_argument => 'p_top_position_id'
2023 ,p_argument_value => p_top_position_id
2024 );
2025 END IF;
2026
2027 IF p_top_position_id IS NOT null THEN
2028 --
2029 -- Checks that the pos exists
2030 --
2031 open csr_pos_id;
2032 fetch csr_pos_id into l_exist;
2033 close csr_pos_id;
2034
2035 IF (l_exist IS NULL) THEN
2036 fnd_message.set_name('PER','HR_50389_WPM_PLAN_POS');
2037 fnd_message.raise_error;
2038 END IF;
2039 END IF;
2040
2041 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
2042
2043 exception
2044 when app_exception.application_exception then
2045 IF hr_multi_message.exception_add
2046 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.TOP_POSITION_ID'
2047 ) THEN
2048 hr_utility.set_location(' Leaving:'||l_proc, 980);
2049 raise;
2050 END IF;
2051 hr_utility.set_location(' Leaving:'||l_proc, 990);
2052
2053 End chk_top_position_id;
2054 --
2055 -- ----------------------------------------------------------------------------
2056 -- |--------------------------< chk_hierarchy_levels >------------------------|
2057 -- ----------------------------------------------------------------------------
2058 -- {Start Of Comments}
2059 --
2060 -- Description:
2061 -- Checks that the hierarchy level is not a negative value.
2062 --
2063 -- Prerequisites:
2064 -- None.
2065 --
2066 -- In Arguments:
2067 --
2068 --
2069 -- Post Success:
2070 -- Processing continues if the hierarchy level is valid.
2071 --
2072 -- Post Failure:
2073 -- An application error is raised if the hierarchy level is not valid.
2077 --
2074 --
2075 -- Access Status:
2076 -- Internal Row Handler Use Only.
2078 -- {End Of Comments}
2079 -- ----------------------------------------------------------------------------
2080 procedure chk_hierarchy_levels
2081 (p_plan_id in number
2082 ,p_object_version_number in number
2083 ,p_hierarchy_levels in number
2084 ) is
2085
2086 -- Declare local variables
2087
2088 l_proc varchar2(72) := g_package||'chk_hierarchy_levels';
2089 l_api_updating boolean;
2090
2091 Begin
2092
2093 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
2094
2095 --
2096 -- Only proceed with validation if :
2097 -- a) The current g_old_rec is current and
2098 -- b) The date values have changed
2099 --
2100 l_api_updating := per_pmp_shd.api_updating
2101 (p_plan_id => p_plan_id
2102 ,p_object_version_number => p_object_version_number);
2103 --
2104 IF (l_api_updating
2105 AND nvl(per_pmp_shd.g_old_rec.hierarchy_levels, hr_api.g_number)
2106 = nvl(p_hierarchy_levels, hr_api.g_number))
2107 THEN
2108 RETURN;
2109 END IF;
2110
2111 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
2112
2113 --
2114 -- Checks that the hierarchy levels is not negative number
2115 --
2116 IF (p_hierarchy_levels IS NOT NULL AND p_hierarchy_levels < 0) THEN
2117 fnd_message.set_name('PER','HR_50245_WPM_PLAN_HIER_LEVEL');
2118 fnd_message.raise_error;
2119 END IF;
2120
2121 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
2122
2123 exception
2124 when app_exception.application_exception then
2125 IF hr_multi_message.exception_add
2126 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.HIERARCHY_LEVELS'
2127 ) THEN
2128 hr_utility.set_location(' Leaving:'||l_proc, 980);
2129 raise;
2130 END IF;
2131 hr_utility.set_location(' Leaving:'||l_proc, 990);
2132
2133 End chk_hierarchy_levels;
2134 --
2135 -- ----------------------------------------------------------------------------
2136 -- |---------------------< chk_automatic_enrollment_flag >--------------------|
2137 -- ----------------------------------------------------------------------------
2138 -- {Start Of Comments}
2139 --
2140 -- Description:
2141 -- Checks that the automatic enrollment flag is a valid lookup code in the
2142 -- lookup type YES_NO.
2143 --
2144 -- Prerequisites:
2145 -- None.
2146 --
2147 -- In Arguments:
2148 --
2149 --
2150 -- Post Success:
2151 -- Processing continues if the automatic enrollment flag is valid.
2152 --
2153 -- Post Failure:
2154 -- An application error is raised if the automatic enrollment flag is not valid.
2155 --
2156 -- Access Status:
2157 -- Internal Row Handler Use Only.
2158 --
2159 -- {End Of Comments}
2160 -- ----------------------------------------------------------------------------
2161 procedure chk_automatic_enrollment_flag
2162 (p_plan_id in number
2163 ,p_object_version_number in number
2164 ,p_effective_date in date
2165 ,p_automatic_enrollment_flag in varchar2
2166 ) is
2167
2168 -- Declare local variables
2169
2170 l_proc varchar2(72) := g_package||'chk_automatic_enrollment_flag';
2171 l_api_updating boolean;
2172
2173 Begin
2174
2175 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
2176 --
2177 hr_api.mandatory_arg_error
2178 (p_api_name => l_proc
2179 ,p_argument => 'p_automatic_enrollment_flag'
2180 ,p_argument_value => p_automatic_enrollment_flag
2181 );
2182 --
2183 -- Only proceed with validation if :
2184 -- a) The current g_old_rec is current and
2185 -- b) The date values have changed
2186 --
2187 l_api_updating := per_pmp_shd.api_updating
2188 (p_plan_id => p_plan_id
2189 ,p_object_version_number => p_object_version_number);
2190 --
2191 IF (l_api_updating
2192 AND nvl(per_pmp_shd.g_old_rec.automatic_enrollment_flag, hr_api.g_varchar2)
2193 = nvl(p_automatic_enrollment_flag, hr_api.g_varchar2))
2194 THEN
2195 RETURN;
2196 END IF;
2197
2198 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
2199
2200 --
2201 -- Checks that the status code is valid
2202 --
2203 IF hr_api.not_exists_in_hrstanlookups
2204 (p_effective_date => p_effective_date
2205 ,p_lookup_type => 'YES_NO'
2206 ,p_lookup_code => p_automatic_enrollment_flag
2207 ) THEN
2208 fnd_message.set_name('PER','HR_50246_WPM_PLAN_AUTO_ENROL_E');
2209 fnd_message.raise_error;
2210 END IF;
2211
2212 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
2213
2214 exception
2215 when app_exception.application_exception then
2216 IF hr_multi_message.exception_add
2217 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.AUTOMATIC_ENROLLMENT_FLAG'
2218 ) THEN
2219 hr_utility.set_location(' Leaving:'||l_proc, 980);
2220 raise;
2221 END IF;
2222 hr_utility.set_location(' Leaving:'||l_proc, 990);
2223
2224 End chk_automatic_enrollment_flag;
2225 --
2226 -- ----------------------------------------------------------------------------
2227 -- |------------------------< chk_assignment_types_code >---------------------|
2228 -- ----------------------------------------------------------------------------
2229 -- {Start Of Comments}
2230 --
2231 -- Description:
2235 -- Prerequisites:
2232 -- Checks that the assignment types code is a valid lookup code in the
2233 -- lookup type HR_WPM_ASSIGNMENT_TYPES.
2234 --
2236 -- None.
2237 --
2238 -- In Arguments:
2239 --
2240 --
2241 -- Post Success:
2242 -- Processing continues if the assignment types code is valid.
2243 --
2244 -- Post Failure:
2245 -- An application error is raised if the assignment types code is not valid.
2246 --
2247 -- Access Status:
2248 -- Internal Row Handler Use Only.
2249 --
2250 -- {End Of Comments}
2251 -- ----------------------------------------------------------------------------
2252 procedure chk_assignment_types_code
2253 (p_plan_id in number
2254 ,p_object_version_number in number
2255 ,p_effective_date in date
2256 ,p_assignment_types_code in varchar2
2257 ) is
2258
2259 -- Declare local variables
2260
2261 l_proc varchar2(72) := g_package||'chk_assignment_types_code';
2262 l_api_updating boolean;
2263
2264 Begin
2265
2266 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
2267 --
2268 hr_api.mandatory_arg_error
2269 (p_api_name => l_proc
2270 ,p_argument => 'p_assignment_types_code'
2271 ,p_argument_value => p_assignment_types_code
2272 );
2273 --
2274 -- Only proceed with validation if :
2275 -- a) The current g_old_rec is current and
2276 -- b) The date values have changed
2277 --
2278 l_api_updating := per_pmp_shd.api_updating
2279 (p_plan_id => p_plan_id
2280 ,p_object_version_number => p_object_version_number);
2281 --
2282 IF (l_api_updating
2283 AND nvl(per_pmp_shd.g_old_rec.assignment_types_code, hr_api.g_varchar2)
2284 = nvl(p_assignment_types_code, hr_api.g_varchar2))
2285 THEN
2286 RETURN;
2287 END IF;
2288
2289 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
2290
2291 --
2292 -- Checks that the status code is valid
2293 --
2294 IF hr_api.not_exists_in_hrstanlookups
2295 (p_effective_date => p_effective_date
2296 ,p_lookup_type => 'HR_WPM_ASSIGNMENT_TYPES'
2297 ,p_lookup_code => p_assignment_types_code
2298 ) THEN
2299 fnd_message.set_name('PER','HR_50248_WPM_PLAN_ASG_TYP_CD');
2300 fnd_message.raise_error;
2301 END IF;
2302
2303 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
2304
2305 exception
2306 when app_exception.application_exception then
2307 IF hr_multi_message.exception_add
2308 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.ASSIGNMENT_TYPES_CODE'
2309 ) THEN
2310 hr_utility.set_location(' Leaving:'||l_proc, 980);
2311 raise;
2312 END IF;
2313 hr_utility.set_location(' Leaving:'||l_proc, 990);
2314
2315 End chk_assignment_types_code;
2316 --
2317 -- ----------------------------------------------------------------------------
2318 -- |------------------------< chk_primary_asg_only_flag >---------------------|
2319 -- ----------------------------------------------------------------------------
2320 -- {Start Of Comments}
2321 --
2322 -- Description:
2323 -- Checks that the primary asg only flag is a valid lookup code in the
2324 -- lookup type YES_NO.
2325 --
2326 -- Prerequisites:
2327 -- None.
2328 --
2329 -- In Arguments:
2330 --
2331 --
2332 -- Post Success:
2333 -- Processing continues if the primary asg only flag is valid.
2334 --
2335 -- Post Failure:
2336 -- An application error is raised if the primary asg only flag is not valid.
2337 --
2338 -- Access Status:
2339 -- Internal Row Handler Use Only.
2340 --
2341 -- {End Of Comments}
2342 -- ----------------------------------------------------------------------------
2343 procedure chk_primary_asg_only_flag
2344 (p_plan_id in number
2345 ,p_object_version_number in number
2346 ,p_effective_date in date
2347 ,p_primary_asg_only_flag in varchar2
2348 ) is
2349
2350 -- Declare local variables
2351
2352 l_proc varchar2(72) := g_package||'chk_primary_asg_only_flag';
2353 l_api_updating boolean;
2354
2355 Begin
2356
2357 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
2358 --
2359 hr_api.mandatory_arg_error
2360 (p_api_name => l_proc
2361 ,p_argument => 'p_primary_asg_only_flag'
2362 ,p_argument_value => p_primary_asg_only_flag
2363 );
2364 --
2365 -- Only proceed with validation if :
2366 -- a) The current g_old_rec is current and
2367 -- b) The date values have changed
2368 --
2369 l_api_updating := per_pmp_shd.api_updating
2370 (p_plan_id => p_plan_id
2371 ,p_object_version_number => p_object_version_number);
2372 --
2373 IF (l_api_updating
2374 AND nvl(per_pmp_shd.g_old_rec.primary_asg_only_flag, hr_api.g_varchar2)
2375 = nvl(p_primary_asg_only_flag, hr_api.g_varchar2))
2376 THEN
2377 RETURN;
2378 END IF;
2379
2380 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
2381
2382 --
2383 -- Checks that the status code is valid
2384 --
2385 IF hr_api.not_exists_in_hrstanlookups
2386 (p_effective_date => p_effective_date
2387 ,p_lookup_type => 'YES_NO'
2388 ,p_lookup_code => p_primary_asg_only_flag
2389 ) THEN
2390 fnd_message.set_name('PER','HR_50249_WPM_PLAN_PRI_ASG_FLG');
2394 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
2391 fnd_message.raise_error;
2392 END IF;
2393
2395
2396 exception
2397 when app_exception.application_exception then
2398 IF hr_multi_message.exception_add
2399 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.PRIMARY_ASG_ONLY_FLAG'
2400 ) THEN
2401 hr_utility.set_location(' Leaving:'||l_proc, 980);
2402 raise;
2403 END IF;
2404 hr_utility.set_location(' Leaving:'||l_proc, 990);
2405
2406 End chk_primary_asg_only_flag;
2407 --
2408 -- ----------------------------------------------------------------------------
2409 -- |------------------------< chk_hier_type_primary_asg >---------------------|
2410 -- ----------------------------------------------------------------------------
2411 -- {Start Of Comments}
2412 --
2413 -- Description:
2414 -- Checks that the primary asg only flag is not selected when the plan
2415 -- hiererchy type is 'Supervisor Assignment'.
2416 --
2417 -- Prerequisites:
2418 -- None.
2419 --
2420 -- In Arguments:
2421 --
2422 --
2423 -- Post Success:
2424 -- Processing continues if the primary asg only flag is selected with the plan
2425 -- hiererchy type of 'Supervisor Assignment'.
2426 --
2427 -- Post Failure:
2428 -- An application error is raised if the primary asg only flag is selected with
2429 -- the plan hiererchy type of 'Supervisor Assignment'.
2430 --
2431 -- Access Status:
2432 -- Internal Row Handler Use Only.
2433 --
2434 -- {End Of Comments}
2435 -- ----------------------------------------------------------------------------
2436 procedure chk_hier_type_primary_asg
2437 (p_plan_id in number
2438 ,p_object_version_number in number
2439 ,p_hierarchy_type_code in varchar2
2440 ,p_primary_asg_only_flag in varchar2
2441 ) is
2442
2443 -- Declare local variables
2444
2445 l_proc varchar2(72) := g_package||'chk_hier_type_primary_asg';
2446 l_api_updating boolean;
2447
2448 Begin
2449
2450 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
2451 --
2452 hr_api.mandatory_arg_error
2453 (p_api_name => l_proc
2454 ,p_argument => 'p_primary_asg_only_flag'
2455 ,p_argument_value => p_primary_asg_only_flag
2456 );
2457 --
2458 -- Only proceed with validation if :
2459 -- a) The current g_old_rec is current and
2460 -- b) The date values have changed
2461 --
2462 l_api_updating := per_pmp_shd.api_updating
2463 (p_plan_id => p_plan_id
2464 ,p_object_version_number => p_object_version_number);
2465 --
2466 IF (l_api_updating
2467 AND nvl(per_pmp_shd.g_old_rec.hierarchy_type_code, hr_api.g_varchar2)
2468 = nvl(p_hierarchy_type_code, hr_api.g_varchar2)
2469 AND nvl(per_pmp_shd.g_old_rec.primary_asg_only_flag, hr_api.g_varchar2)
2470 = nvl(p_primary_asg_only_flag, hr_api.g_varchar2))
2471 THEN
2472 RETURN;
2473 END IF;
2474
2475 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
2476
2477 --
2478 -- Checks Primary Asg only option is not selected when plan hierarchy
2479 -- is 'Supervisor Assignment'.
2480 --
2481 IF (p_hierarchy_type_code IS NOT null AND
2482 p_hierarchy_type_code = 'SUP_ASG' AND
2483 p_primary_asg_only_flag = 'Y') THEN
2484 fnd_message.set_name('PER','HR_50251_WPM_PLAN_PRI_ASG_VAL');
2485 fnd_message.raise_error;
2486 END IF;
2487
2488 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
2489
2490 exception
2491 when app_exception.application_exception then
2492 IF hr_multi_message.exception_add
2493 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.PRIMARY_ASG_ONLY_FLAG'
2494 ) THEN
2495 hr_utility.set_location(' Leaving:'||l_proc, 980);
2496 raise;
2497 END IF;
2498 hr_utility.set_location(' Leaving:'||l_proc, 990);
2499
2500 End chk_hier_type_primary_asg;
2501 --
2502 -- ----------------------------------------------------------------------------
2503 -- |------------------------< chk_include_obj_set_flag >----------------------|
2504 -- ----------------------------------------------------------------------------
2505 -- {Start Of Comments}
2506 --
2507 -- Description:
2508 -- Checks that the include objective setting flag is a valid lookup code in
2509 -- lookup type YES_NO.
2510 --
2511 -- Prerequisites:
2512 -- None.
2513 --
2514 -- In Arguments:
2515 --
2516 --
2517 -- Post Success:
2518 -- Processing continues if the include objective setting flag is valid.
2519 --
2520 -- Post Failure:
2521 -- An application error is raised if the include objective setting flag is
2522 -- not valid.
2523 --
2524 -- Access Status:
2525 -- Internal Row Handler Use Only.
2526 --
2527 -- {End Of Comments}
2528 -- ----------------------------------------------------------------------------
2529 procedure chk_include_obj_set_flag
2530 (p_plan_id in number
2531 ,p_object_version_number in number
2532 ,p_effective_date in date
2533 ,p_include_obj_setting_flag in varchar2
2534 ,p_obj_setting_start_date in date
2535 ,p_method_code in varchar2
2536 ,p_notify_population_flag in varchar2
2537 ) is
2538
2539 -- Declare local variables
2540
2541 l_proc varchar2(72) := g_package||'chk_include_obj_set_flag';
2542 l_api_updating boolean;
2543
2544 Begin
2545
2546 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
2547 --
2551 ,p_argument_value => p_include_obj_setting_flag
2548 hr_api.mandatory_arg_error
2549 (p_api_name => l_proc
2550 ,p_argument => 'p_include_obj_setting_flag'
2552 );
2553 --
2554 -- Only proceed with validation if :
2555 -- a) The current g_old_rec is current and
2556 -- b) The date values have changed
2557 --
2558 l_api_updating := per_pmp_shd.api_updating
2559 (p_plan_id => p_plan_id
2560 ,p_object_version_number => p_object_version_number);
2561 --
2562 IF (l_api_updating
2563 AND nvl(per_pmp_shd.g_old_rec.include_obj_setting_flag, hr_api.g_varchar2)
2564 = nvl(p_include_obj_setting_flag, hr_api.g_varchar2)
2565 AND nvl(per_pmp_shd.g_old_rec.obj_setting_start_date, hr_api.g_date)
2566 = nvl(p_obj_setting_start_date, hr_api.g_date)
2567 AND nvl(per_pmp_shd.g_old_rec.method_code, hr_api.g_varchar2)
2568 = nvl(p_method_code, hr_api.g_varchar2)
2569 AND nvl(per_pmp_shd.g_old_rec.notify_population_flag, hr_api.g_varchar2)
2570 = nvl(p_notify_population_flag, hr_api.g_varchar2))
2571 THEN
2572 RETURN;
2573 END IF;
2574
2575 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
2576
2577 --
2578 -- Checks that the status code is valid
2579 --
2580 IF hr_api.not_exists_in_hrstanlookups
2581 (p_effective_date => p_effective_date
2582 ,p_lookup_type => 'YES_NO'
2583 ,p_lookup_code => p_include_obj_setting_flag
2584 ) THEN
2585 fnd_message.set_name('PER','HR_50252_WPM_PLAN_INC_OBJ_SET');
2586 fnd_message.raise_error;
2587 END IF;
2588
2589 IF g_debug THEN hr_utility.set_location(l_proc, 30); END IF;
2590
2591 --
2592 -- If flag is set to 'Y' , then check floowing mandatory fields are entered
2593 --
2594 IF (p_include_obj_setting_flag = 'Y') THEN
2595 --
2596 hr_api.mandatory_arg_error
2597 (p_api_name => l_proc
2598 ,p_argument => 'p_obj_setting_start_date'
2599 ,p_argument_value => p_obj_setting_start_date
2600 );
2601 --
2602 hr_api.mandatory_arg_error
2603 (p_api_name => l_proc
2604 ,p_argument => 'p_method_code'
2605 ,p_argument_value => p_method_code
2606 );
2607 --
2608 hr_api.mandatory_arg_error
2609 (p_api_name => l_proc
2610 ,p_argument => 'p_notify_population_flag'
2611 ,p_argument_value => p_notify_population_flag
2612 );
2613 END IF;
2614
2615 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
2616
2617 exception
2618 when app_exception.application_exception then
2619 IF hr_multi_message.exception_add
2620 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.INCLUDE_OBJ_SETTING_FLAG'
2621 ) THEN
2622 hr_utility.set_location(' Leaving:'||l_proc, 980);
2623 raise;
2624 END IF;
2625 hr_utility.set_location(' Leaving:'||l_proc, 990);
2626
2627 End chk_include_obj_set_flag;
2628 --
2629 -- ----------------------------------------------------------------------------
2630 -- |-------------------------< chk_obj_set_start_end >------------------------|
2631 -- ----------------------------------------------------------------------------
2632 -- {Start Of Comments}
2633 --
2634 -- Description:
2635 -- Checks that the objective setting start date is not greater than the
2636 -- objective setting deadline.
2637 --
2638 -- Prerequisites:
2639 -- None.
2640 --
2641 -- In Arguments:
2642 --
2643 --
2644 -- Post Success:
2645 -- Processing continues if the dates are valid.
2646 --
2647 -- Post Failure:
2648 -- An application error is raised if the dates are not valid.
2649 --
2650 -- Access Status:
2651 -- Internal Row Handler Use Only.
2652 --
2653 -- {End Of Comments}
2654 -- ----------------------------------------------------------------------------
2655 procedure chk_obj_set_start_end
2656 (p_plan_id in number
2657 ,p_object_version_number in number
2658 ,p_obj_setting_start_date in date
2659 ,p_obj_setting_deadline in date
2660 ) is
2661
2662 -- Declare local variables
2663
2664 l_proc varchar2(72) := g_package||'chk_obj_set_start_end';
2665 l_api_updating boolean;
2666
2667 Begin
2668
2669 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
2670
2671 --
2672 -- Only proceed with validation if :
2673 -- a) The current g_old_rec is current and
2674 -- b) The date values have changed
2675 --
2676 l_api_updating := per_pmp_shd.api_updating
2677 (p_plan_id => p_plan_id
2678 ,p_object_version_number => p_object_version_number);
2679 --
2680 IF (l_api_updating
2681 AND nvl(per_pmp_shd.g_old_rec.obj_setting_start_date, hr_api.g_date)
2682 = nvl(p_obj_setting_start_date, hr_api.g_date)
2683 AND nvl(per_pmp_shd.g_old_rec.obj_setting_deadline, hr_api.g_date)
2684 = nvl(p_obj_setting_deadline, hr_api.g_date))
2685 THEN
2686 RETURN;
2687 END IF;
2688
2689 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
2690
2691 IF (p_obj_setting_start_date IS NOT NULL AND
2692 p_obj_setting_deadline IS NOT NULL)
2693 THEN
2694 --
2695 -- Checks that the valid from date is not greater than the valid to date.
2696 --
2697 IF (p_obj_setting_start_date > p_obj_setting_deadline) THEN
2701 END IF;
2698 fnd_message.set_name('PER','HR_50253_WPM_PLAN_OBJ_SET_ST');
2699 fnd_message.raise_error;
2700 END IF;
2702
2703 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
2704
2705 exception
2706 when app_exception.application_exception then
2707 IF hr_multi_message.exception_add
2708 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.OBJ_SETTING_START_DATE'
2709 ,p_associated_column2 => 'PER_PERF_MGMT_PLANS.OBJ_SETTING_DEADLINE'
2710 ) THEN
2711 hr_utility.set_location(' Leaving:'||l_proc, 980);
2712 raise;
2713 END IF;
2714 hr_utility.set_location(' Leaving:'||l_proc, 990);
2715
2716 End chk_obj_set_start_end;
2717 --
2718 -- ----------------------------------------------------------------------------
2719 -- |-----------------------< chk_plan_end_obj_set_end >-----------------------|
2720 -- ----------------------------------------------------------------------------
2721 -- {Start Of Comments}
2722 --
2723 -- Description:
2724 -- Checks that the objective setting deadline is not greater than the
2725 -- plan end date.
2726 --
2727 -- Prerequisites:
2728 -- None.
2729 --
2730 -- In Arguments:
2731 --
2732 --
2733 -- Post Success:
2734 -- Processing continues if the dates are valid.
2735 --
2736 -- Post Failure:
2737 -- An application error is raised if the dates are not valid.
2738 --
2739 -- Access Status:
2740 -- Internal Row Handler Use Only.
2741 --
2742 -- {End Of Comments}
2743 -- ----------------------------------------------------------------------------
2744 procedure chk_plan_end_obj_set_end
2745 (p_plan_id in number
2746 ,p_object_version_number in number
2747 ,p_obj_setting_deadline in date
2748 ,p_end_date in date
2749 ,p_status in varchar
2750 ) is
2751
2752 -- Declare local variables
2753
2754 l_proc varchar2(72) := g_package||'chk_plan_end_obj_set_end';
2755 l_api_updating boolean;
2756 l_sysdate date := trunc(sysdate);
2757
2758 Begin
2759
2760 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
2761
2762 --
2763 -- Only proceed with validation if :
2764 -- a) The current g_old_rec is current and
2765 -- b) The date values have changed
2766 --
2767 l_api_updating := per_pmp_shd.api_updating
2768 (p_plan_id => p_plan_id
2769 ,p_object_version_number => p_object_version_number);
2770 --
2771 IF (l_api_updating
2772 AND nvl(per_pmp_shd.g_old_rec.obj_setting_deadline, hr_api.g_date)
2773 = nvl(p_obj_setting_deadline, hr_api.g_date)
2774 AND nvl(per_pmp_shd.g_old_rec.end_date, hr_api.g_date)
2775 = nvl(p_end_date, hr_api.g_date))
2776 THEN
2777 RETURN;
2778 END IF;
2779
2780 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
2781
2782 IF (p_obj_setting_deadline IS NOT NULL AND
2783 p_end_date IS NOT NULL)
2784 THEN
2785 --
2786 -- Checks that the obj_setting_deadline date is not greater than
2787 -- the plan end date.
2788 --
2789 IF (p_obj_setting_deadline > p_end_date) THEN
2790 fnd_message.set_name('PER','HR_50254_WPM_PLAN_OBJ_SET_END');
2791 fnd_message.raise_error;
2792 END IF;
2793 END IF;
2794
2795 --
2796 -- check that the plan is not being created in the past
2797 --
2798 IF (p_status = 'INSERT') THEN
2799 IF (p_end_date < l_sysdate) THEN
2800 fnd_message.set_name('PER','HR_50422_WPM_EXPIRED_PLAN');
2801 fnd_message.raise_error;
2802 END IF;
2803 END IF;
2804
2805 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
2806
2807 exception
2808 when app_exception.application_exception then
2809 IF hr_multi_message.exception_add
2810 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.OBJ_SETTING_DEADLINE'
2811 ,p_associated_column2 => 'PER_PERF_MGMT_PLANS.END_DATE'
2812 ,p_associated_column3 => 'PER_PERF_MGMT_PLANS.END_DATE'
2813 ) THEN
2814 hr_utility.set_location(' Leaving:'||l_proc, 980);
2815 raise;
2816 END IF;
2817 hr_utility.set_location(' Leaving:'||l_proc, 990);
2818
2819 End chk_plan_end_obj_set_end;
2820 --
2821 -- ----------------------------------------------------------------------------
2822 -- |--------------------< chk_plan_start_obj_start_end >----------------------|
2823 -- ----------------------------------------------------------------------------
2824 -- {Start Of Comments}
2825 --
2826 -- Description:
2827 -- Checks that the objective setting start date is not before the
2828 -- plan start date.
2829 --
2830 -- Prerequisites:
2831 -- None.
2832 --
2833 -- In Arguments:
2834 --
2835 --
2836 -- Post Success:
2837 -- Processing continues if the dates are valid.
2838 --
2839 -- Post Failure:
2840 -- An application error is raised if the dates are not valid.
2841 --
2842 -- Access Status:
2843 -- Internal Row Handler Use Only.
2844 --
2845 -- {End Of Comments}
2846 -- ----------------------------------------------------------------------------
2847 procedure chk_plan_start_obj_set_start
2848 (p_plan_id in number
2849 ,p_object_version_number in number
2850 ,p_obj_setting_start_date in date
2851 ,p_start_date in date
2852 ) is
2853
2854 -- Declare local variables
2855
2856 l_proc varchar2(72) := g_package||'chk_plan_start_obj_set_start';
2857 l_api_updating boolean;
2858
2859 Begin
2860
2861 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
2862
2863 --
2864 -- Only proceed with validation if :
2865 -- a) The current g_old_rec is current and
2866 -- b) The date values have changed
2867 --
2868 l_api_updating := per_pmp_shd.api_updating
2869 (p_plan_id => p_plan_id
2870 ,p_object_version_number => p_object_version_number);
2871 --
2872 IF (l_api_updating
2873 AND nvl(per_pmp_shd.g_old_rec.obj_setting_start_date, hr_api.g_date)
2874 = nvl(p_obj_setting_start_date, hr_api.g_date)
2875 AND nvl(per_pmp_shd.g_old_rec.start_date, hr_api.g_date)
2876 = nvl(p_start_date, hr_api.g_date))
2877 THEN
2878 RETURN;
2879 END IF;
2880
2881 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
2882
2883 IF (p_obj_setting_start_date IS NOT NULL AND
2884 p_start_date IS NOT NULL)
2885 THEN
2886 --
2887 -- Checks that the objective setting start date is not greater than
2888 -- the plan start date.
2889 --
2890 IF (p_obj_setting_start_date < p_start_date) THEN
2891 fnd_message.set_name('PER','HR_50421_WPM_PLAN_OBJ_SET_STRT');
2892 fnd_message.raise_error;
2893 END IF;
2894 END IF;
2895
2896 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
2897
2898 exception
2899 when app_exception.application_exception then
2900 IF hr_multi_message.exception_add
2901 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.OBJ_SETTING_START_DATE'
2902 ,p_associated_column2 => 'PER_PERF_MGMT_PLANS.START_DATE'
2903 ) THEN
2904 hr_utility.set_location(' Leaving:'||l_proc, 980);
2905 raise;
2906 END IF;
2907 hr_utility.set_location(' Leaving:'||l_proc, 990);
2908
2909 END chk_plan_start_obj_set_start;
2910 --
2916 -- Description:
2911 -- ----------------------------------------------------------------------------
2912 -- |------------------------< chk_obj_set_outside_flag >----------------------|
2913 -- ----------------------------------------------------------------------------
2914 -- {Start Of Comments}
2915 --
2917 -- Checks that the objective setting outside the period flag is a valid lookup
2918 -- code in lookup type YES_NO.
2919 --
2920 -- Prerequisites:
2921 -- None.
2922 --
2923 -- In Arguments:
2924 --
2925 --
2926 -- Post Success:
2927 -- Processing continues if the objective setting outside the period flag
2928 -- is valid.
2929 --
2930 -- Post Failure:
2931 -- An application error is raised if the objective setting outside the period
2932 -- flag is not valid.
2933 --
2934 -- Access Status:
2935 -- Internal Row Handler Use Only.
2936 --
2937 -- {End Of Comments}
2938 -- ----------------------------------------------------------------------------
2939 procedure chk_obj_set_outside_flag
2940 (p_plan_id in number
2941 ,p_object_version_number in number
2942 ,p_effective_date in date
2943 ,p_obj_set_outside_period_flag in varchar2
2944 ) is
2945
2946 -- Declare local variables
2947
2948 l_proc varchar2(72) := g_package||'chk_obj_set_outside_flag';
2949 l_api_updating boolean;
2950
2951 Begin
2952
2953 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
2954 --
2955 hr_api.mandatory_arg_error
2956 (p_api_name => l_proc
2957 ,p_argument => 'p_obj_set_outside_period_flag'
2958 ,p_argument_value => p_obj_set_outside_period_flag
2959 );
2960 --
2961 -- Only proceed with validation if :
2962 -- a) The current g_old_rec is current and
2963 -- b) The date values have changed
2964 --
2965 l_api_updating := per_pmp_shd.api_updating
2966 (p_plan_id => p_plan_id
2967 ,p_object_version_number => p_object_version_number);
2968 --
2969 IF (l_api_updating
2970 AND nvl(per_pmp_shd.g_old_rec.obj_set_outside_period_flag, hr_api.g_varchar2)
2971 = nvl(p_obj_set_outside_period_flag, hr_api.g_varchar2))
2972 THEN
2973 RETURN;
2974 END IF;
2975
2976 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
2977
2978 --
2979 -- Checks that the status code is valid
2980 --
2981 IF hr_api.not_exists_in_hrstanlookups
2982 (p_effective_date => p_effective_date
2983 ,p_lookup_type => 'YES_NO'
2984 ,p_lookup_code => p_obj_set_outside_period_flag
2985 ) THEN
2986 fnd_message.set_name('PER','HR_50255_WPM_PLAN_SET_OUT_PRD');
2987 fnd_message.raise_error;
2988 END IF;
2989
2990 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
2991
2992 exception
2993 when app_exception.application_exception then
2994 IF hr_multi_message.exception_add
2995 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.OBJ_SET_OUTSIDE_PERIOD_FLAG'
2996 ) THEN
2997 hr_utility.set_location(' Leaving:'||l_proc, 980);
2998 raise;
2999 END IF;
3000 hr_utility.set_location(' Leaving:'||l_proc, 990);
3001
3002 End chk_obj_set_outside_flag;
3003 --
3004 -- ----------------------------------------------------------------------------
3005 -- |----------------------------< chk_method_code >---------------------------|
3006 -- ----------------------------------------------------------------------------
3007 -- {Start Of Comments}
3008 --
3009 -- Description:
3010 -- Checks that the method code is a valid lookup code in the lookup type
3011 -- HR_WPM_PLAN_METHOD.
3012 --
3013 -- Prerequisites:
3014 -- None.
3015 --
3016 -- In Arguments:
3017 --
3018 --
3019 -- Post Success:
3020 -- Processing continues if the method code is valid.
3021 --
3022 -- Post Failure:
3023 -- An application error is raised if the method code is not valid.
3024 --
3025 -- Access Status:
3026 -- Internal Row Handler Use Only.
3027 --
3028 -- {End Of Comments}
3029 -- ----------------------------------------------------------------------------
3030 procedure chk_method_code
3031 (p_plan_id in number
3032 ,p_object_version_number in number
3033 ,p_effective_date in date
3034 ,p_method_code in varchar2
3035 ) is
3036
3037 -- Declare local variables
3038
3039 l_proc varchar2(72) := g_package||'chk_method_code';
3040 l_api_updating boolean;
3041
3042 Begin
3043
3044 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
3045 --
3046 hr_api.mandatory_arg_error
3047 (p_api_name => l_proc
3048 ,p_argument => 'p_method_code'
3049 ,p_argument_value => p_method_code
3050 );
3051 --
3052 -- Only proceed with validation if :
3053 -- a) The current g_old_rec is current and
3054 -- b) The date values have changed
3055 --
3056 l_api_updating := per_pmp_shd.api_updating
3057 (p_plan_id => p_plan_id
3058 ,p_object_version_number => p_object_version_number);
3059 --
3060 IF (l_api_updating
3061 AND nvl(per_pmp_shd.g_old_rec.method_code, hr_api.g_varchar2)
3062 = nvl(p_method_code, hr_api.g_varchar2))
3063 THEN
3064 RETURN;
3065 END IF;
3066
3067 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
3068
3069 --
3070 -- Checks that the status code is valid
3071 --
3072 IF hr_api.not_exists_in_hrstanlookups
3073 (p_effective_date => p_effective_date
3074 ,p_lookup_type => 'HR_WPM_PLAN_METHOD'
3075 ,p_lookup_code => p_method_code
3076 ) THEN
3077 fnd_message.set_name('PER','HR_50256_WPM_PLAN_MTHD_CODE');
3078 fnd_message.raise_error;
3079 END IF;
3080
3081 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
3082
3083 exception
3084 when app_exception.application_exception then
3085 IF hr_multi_message.exception_add
3086 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.METHOD_CODE'
3087 ) THEN
3088 hr_utility.set_location(' Leaving:'||l_proc, 980);
3089 raise;
3090 END IF;
3091 hr_utility.set_location(' Leaving:'||l_proc, 990);
3092
3093 End chk_method_code;
3094 --
3095 -- ----------------------------------------------------------------------------
3099 --
3096 -- |----------------------< chk_notify_population_flag >----------------------|
3097 -- ----------------------------------------------------------------------------
3098 -- {Start Of Comments}
3100 -- Description:
3101 -- Checks that the notify population flag is a valid lookup code in the
3102 -- lookup type YES_NO.
3103 --
3104 -- Prerequisites:
3105 -- None.
3106 --
3107 -- In Arguments:
3108 --
3109 --
3110 -- Post Success:
3111 -- Processing continues if the notify population flag is valid.
3112 --
3113 -- Post Failure:
3114 -- An application error is raised if the notify population flag is not valid.
3115 --
3116 -- Access Status:
3117 -- Internal Row Handler Use Only.
3118 --
3119 -- {End Of Comments}
3120 -- ----------------------------------------------------------------------------
3121 procedure chk_notify_population_flag
3122 (p_plan_id in number
3123 ,p_object_version_number in number
3124 ,p_effective_date in date
3125 ,p_notify_population_flag in varchar2
3126 ) is
3127
3128 -- Declare local variables
3129
3130 l_proc varchar2(72) := g_package||'chk_notify_population_flag';
3131 l_api_updating boolean;
3132
3133 Begin
3134
3135 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
3136 --
3137 hr_api.mandatory_arg_error
3138 (p_api_name => l_proc
3139 ,p_argument => 'p_notify_population_flag'
3140 ,p_argument_value => p_notify_population_flag
3141 );
3142 --
3143 -- Only proceed with validation if :
3144 -- a) The current g_old_rec is current and
3145 -- b) The date values have changed
3146 --
3147 l_api_updating := per_pmp_shd.api_updating
3148 (p_plan_id => p_plan_id
3149 ,p_object_version_number => p_object_version_number);
3150 --
3151 IF (l_api_updating
3152 AND nvl(per_pmp_shd.g_old_rec.notify_population_flag, hr_api.g_varchar2)
3153 = nvl(p_notify_population_flag, hr_api.g_varchar2))
3154 THEN
3155 RETURN;
3156 END IF;
3157
3158 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
3159
3160 --
3161 -- Checks that the status code is valid
3162 --
3163 IF hr_api.not_exists_in_hrstanlookups
3164 (p_effective_date => p_effective_date
3165 ,p_lookup_type => 'YES_NO'
3166 ,p_lookup_code => p_notify_population_flag
3167 ) THEN
3168 fnd_message.set_name('PER','HR_50415_WPM_PMP_NOTIFY_FLAG');
3169 fnd_message.raise_error;
3170 END IF;
3171
3172 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
3173
3174 exception
3175 when app_exception.application_exception then
3176 IF hr_multi_message.exception_add
3177 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.NOTIFY_POPULATION_FLAG'
3178 ) THEN
3179 hr_utility.set_location(' Leaving:'||l_proc, 980);
3180 raise;
3181 END IF;
3182 hr_utility.set_location(' Leaving:'||l_proc, 990);
3183
3184 End chk_notify_population_flag;
3185 --
3186 -- ----------------------------------------------------------------------------
3187 -- |----------------------< chk_automatic_allocation_flag >-------------------|
3188 -- ----------------------------------------------------------------------------
3192 -- Checks that the automatic allocation flag is a valid lookup code in the
3189 -- {Start Of Comments}
3190 --
3191 -- Description:
3193 -- lookup type YES_NO.
3194 --
3195 -- Prerequisites:
3196 -- None.
3197 --
3198 -- In Arguments:
3199 --
3200 --
3201 -- Post Success:
3202 -- Processing continues if the automatic allocation flag is valid.
3203 --
3204 -- Post Failure:
3205 -- An application error is raised if the automatic allocation flag is not valid.
3206 --
3207 -- Access Status:
3208 -- Internal Row Handler Use Only.
3209 --
3210 -- {End Of Comments}
3211 -- ----------------------------------------------------------------------------
3212 procedure chk_automatic_allocation_flag
3213 (p_plan_id in number
3214 ,p_object_version_number in number
3215 ,p_effective_date in date
3216 ,p_automatic_allocation_flag in varchar2
3217 ) is
3218
3219 -- Declare local variables
3220
3221 l_proc varchar2(72) := g_package||'chk_automatic_allocation_flag';
3222 l_api_updating boolean;
3223
3224 Begin
3225
3226 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
3227 --
3228 hr_api.mandatory_arg_error
3229 (p_api_name => l_proc
3230 ,p_argument => 'p_automatic_allocation_flag'
3231 ,p_argument_value => p_automatic_allocation_flag
3232 );
3233 --
3234 -- Only proceed with validation if :
3235 -- a) The current g_old_rec is current and
3236 -- b) The date values have changed
3237 --
3238 l_api_updating := per_pmp_shd.api_updating
3239 (p_plan_id => p_plan_id
3240 ,p_object_version_number => p_object_version_number);
3241 --
3242 IF (l_api_updating
3243 AND nvl(per_pmp_shd.g_old_rec.automatic_allocation_flag, hr_api.g_varchar2)
3244 = nvl(p_automatic_allocation_flag, hr_api.g_varchar2))
3245 THEN
3246 RETURN;
3247 END IF;
3248
3249 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
3250
3251 --
3252 -- Checks that the status code is valid
3253 --
3254 IF hr_api.not_exists_in_hrstanlookups
3255 (p_effective_date => p_effective_date
3256 ,p_lookup_type => 'YES_NO'
3257 ,p_lookup_code => p_automatic_allocation_flag
3258 ) THEN
3259 fnd_message.set_name('PER','HR_50257_WPM_PLAN_ALLOC_FLG');
3260 fnd_message.raise_error;
3261 END IF;
3262
3263 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
3264
3265 exception
3266 when app_exception.application_exception then
3267 IF hr_multi_message.exception_add
3268 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.AUTOMATIC_ALLOCATION_FLAG'
3269 ) THEN
3270 hr_utility.set_location(' Leaving:'||l_proc, 980);
3271 raise;
3272 END IF;
3273 hr_utility.set_location(' Leaving:'||l_proc, 990);
3274
3275 End chk_automatic_allocation_flag;
3276 --
3277 -- ----------------------------------------------------------------------------
3278 -- |----------------------< chk_copy_past_objectives_flag >-------------------|
3279 -- ----------------------------------------------------------------------------
3280 -- {Start Of Comments}
3281 --
3282 -- Description:
3283 -- Checks that the copy past objectives flag is a valid lookup code in the
3284 -- lookup type YES_NO.
3285 --
3286 -- Prerequisites:
3287 -- None.
3288 --
3289 -- In Arguments:
3290 --
3291 --
3292 -- Post Success:
3293 -- Processing continues if the copy past objectives flag is valid.
3294 --
3295 -- Post Failure:
3296 -- An application error is raised if the copy past objectives flag is not valid.
3297 --
3298 -- Access Status:
3299 -- Internal Row Handler Use Only.
3300 --
3301 -- {End Of Comments}
3302 -- ----------------------------------------------------------------------------
3303 procedure chk_copy_past_objectives_flag
3304 (p_plan_id in number
3305 ,p_object_version_number in number
3306 ,p_effective_date in date
3307 ,p_copy_past_objectives_flag in varchar2
3308 ) is
3309
3310 -- Declare local variables
3311
3312 l_proc varchar2(72) := g_package||'chk_copy_past_objectives_flag';
3313 l_api_updating boolean;
3314
3315 Begin
3316
3317 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
3318 --
3319 hr_api.mandatory_arg_error
3320 (p_api_name => l_proc
3321 ,p_argument => 'p_copy_past_objectives_flag'
3322 ,p_argument_value => p_copy_past_objectives_flag
3323 );
3324 --
3325 -- Only proceed with validation if :
3326 -- a) The current g_old_rec is current and
3327 -- b) The date values have changed
3328 --
3329 l_api_updating := per_pmp_shd.api_updating
3330 (p_plan_id => p_plan_id
3331 ,p_object_version_number => p_object_version_number);
3332 --
3333 IF (l_api_updating
3334 AND nvl(per_pmp_shd.g_old_rec.copy_past_objectives_flag, hr_api.g_varchar2)
3335 = nvl(p_copy_past_objectives_flag, hr_api.g_varchar2))
3336 THEN
3337 RETURN;
3338 END IF;
3339
3340 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
3341
3342 --
3343 -- Checks that the status code is valid
3344 --
3345 IF hr_api.not_exists_in_hrstanlookups
3346 (p_effective_date => p_effective_date
3347 ,p_lookup_type => 'YES_NO'
3351 fnd_message.raise_error;
3348 ,p_lookup_code => p_copy_past_objectives_flag
3349 ) THEN
3350 fnd_message.set_name('PER','HR_123456_X');
3352 END IF;
3353
3354 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
3355
3356 exception
3357 when app_exception.application_exception then
3358 IF hr_multi_message.exception_add
3359 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.COPY_PAST_OBJECTIVES_FLAG'
3360 ) THEN
3361 hr_utility.set_location(' Leaving:'||l_proc, 980);
3362 raise;
3363 END IF;
3364 hr_utility.set_location(' Leaving:'||l_proc, 990);
3365
3366 End chk_copy_past_objectives_flag;
3367 --
3368 -- ----------------------------------------------------------------------------
3369 -- |-----------------------< chk_sharing_alignment_flag >---------------------|
3370 -- ----------------------------------------------------------------------------
3371 -- {Start Of Comments}
3372 --
3373 -- Description:
3374 -- Checks that the sharing alignment flag is a valid lookup code in the
3375 -- lookup type YES_NO.
3376 --
3377 -- Prerequisites:
3378 -- None.
3379 --
3380 -- In Arguments:
3381 --
3382 --
3383 -- Post Success:
3384 -- Processing continues if the sharing alignment flag is valid.
3385 --
3386 -- Post Failure:
3387 -- An application error is raised if the sharing alignment flag is not valid.
3388 --
3389 -- Access Status:
3390 -- Internal Row Handler Use Only.
3391 --
3392 -- {End Of Comments}
3393 -- ----------------------------------------------------------------------------
3394 procedure chk_sharing_alignment_flag
3395 (p_plan_id in number
3396 ,p_object_version_number in number
3397 ,p_effective_date in date
3398 ,p_sharing_alignment_task_flag in varchar2
3399 ) is
3400
3401 -- Declare local variables
3402
3403 l_proc varchar2(72) := g_package||'chk_sharing_alignment_flag';
3404 l_api_updating boolean;
3405
3406 Begin
3407
3408 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
3409 --
3410 hr_api.mandatory_arg_error
3411 (p_api_name => l_proc
3412 ,p_argument => 'p_sharing_alignment_task_flag'
3413 ,p_argument_value => p_sharing_alignment_task_flag
3414 );
3415 --
3416 -- Only proceed with validation if :
3417 -- a) The current g_old_rec is current and
3418 -- b) The date values have changed
3419 --
3420 l_api_updating := per_pmp_shd.api_updating
3421 (p_plan_id => p_plan_id
3422 ,p_object_version_number => p_object_version_number);
3423 --
3424 IF (l_api_updating
3425 AND nvl(per_pmp_shd.g_old_rec.sharing_alignment_task_flag, hr_api.g_varchar2)
3426 = nvl(p_sharing_alignment_task_flag, hr_api.g_varchar2))
3427 THEN
3428 RETURN;
3429 END IF;
3430
3431 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
3432
3433 --
3434 -- Checks that the status code is valid
3435 --
3436 IF hr_api.not_exists_in_hrstanlookups
3437 (p_effective_date => p_effective_date
3438 ,p_lookup_type => 'YES_NO'
3439 ,p_lookup_code => p_sharing_alignment_task_flag
3440 ) THEN
3441 fnd_message.set_name('PER','HR_50258_WPM_PLAN_SHR_ALN_FLG');
3442 fnd_message.raise_error;
3443 END IF;
3444
3445 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
3446
3447 exception
3448 when app_exception.application_exception then
3449 IF hr_multi_message.exception_add
3450 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.SHARING_ALIGNMENT_TASK_FLAG'
3451 ) THEN
3452 hr_utility.set_location(' Leaving:'||l_proc, 980);
3453 raise;
3454 END IF;
3455 hr_utility.set_location(' Leaving:'||l_proc, 990);
3456
3457 End chk_sharing_alignment_flag;
3458 --
3459 -- ----------------------------------------------------------------------------
3460 -- |----------------------< chk_include_appraisals_flag >---------------------|
3461 -- ----------------------------------------------------------------------------
3465 -- Checks that the include appraisals flag is a valid lookup code in the
3462 -- {Start Of Comments}
3463 --
3464 -- Description:
3466 -- lookup type YES_NO.
3467 --
3468 -- Prerequisites:
3469 -- None.
3470 --
3471 -- In Arguments:
3472 --
3473 --
3474 -- Post Success:
3475 -- Processing continues if the include appraisals flag is valid.
3476 --
3477 -- Post Failure:
3478 -- An application error is raised if the include appraisals flag is not valid.
3479 --
3480 -- Access Status:
3481 -- Internal Row Handler Use Only.
3482 --
3483 -- {End Of Comments}
3484 -- ----------------------------------------------------------------------------
3485 procedure chk_include_appraisals_flag
3486 (p_plan_id in number
3487 ,p_object_version_number in number
3488 ,p_effective_date in date
3489 ,p_include_appraisals_flag in varchar2
3490 ) is
3491
3492 -- Declare local variables
3493
3494 l_proc varchar2(72) := g_package||'chk_include_appraisals_flag';
3495 l_api_updating boolean;
3496
3497 Begin
3498
3499 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
3500 --
3501 hr_api.mandatory_arg_error
3502 (p_api_name => l_proc
3503 ,p_argument => 'p_include_appraisals_flag'
3504 ,p_argument_value => p_include_appraisals_flag
3505 );
3506 --
3507 -- Only proceed with validation if :
3508 -- a) The current g_old_rec is current and
3509 -- b) The date values have changed
3510 --
3511 l_api_updating := per_pmp_shd.api_updating
3512 (p_plan_id => p_plan_id
3513 ,p_object_version_number => p_object_version_number);
3514 --
3515 IF (l_api_updating
3516 AND nvl(per_pmp_shd.g_old_rec.include_appraisals_flag, hr_api.g_varchar2)
3517 = nvl(p_include_appraisals_flag, hr_api.g_varchar2))
3518 THEN
3519 RETURN;
3520 END IF;
3521
3522 IF g_debug THEN hr_utility.set_location(l_proc, 20); END IF;
3523
3524 --
3525 -- Checks that the status code is valid
3526 --
3527 IF hr_api.not_exists_in_hrstanlookups
3528 (p_effective_date => p_effective_date
3529 ,p_lookup_type => 'YES_NO'
3530 ,p_lookup_code => p_include_appraisals_flag
3531 ) THEN
3532 fnd_message.set_name('PER','HR_50259_WPM_PLAN_INC_APRSL');
3533 fnd_message.raise_error;
3534 END IF;
3535
3536 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
3537
3538 exception
3539 when app_exception.application_exception then
3540 IF hr_multi_message.exception_add
3541 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.INCLUDE_APPRAISALS_FLAG'
3542 ) THEN
3543 hr_utility.set_location(' Leaving:'||l_proc, 980);
3544 raise;
3545 END IF;
3546 hr_utility.set_location(' Leaving:'||l_proc, 990);
3547
3548 End chk_include_appraisals_flag;
3549 --
3550 -- ----------------------------------------------------------------------------
3551 -- |-------------------------< chk_plan_still_active >------------------------|
3552 -- ----------------------------------------------------------------------------
3553 -- {Start Of Comments}
3554 --
3555 -- Description:
3556 -- Checks that the plan, if published, is active on effective date.
3557 --
3558 -- Prerequisites:
3559 -- None.
3560 --
3561 -- In Arguments:
3562 --
3563 --
3564 -- Post Success:
3565 -- Processing continues when the plan, if published, is active on
3566 -- effective date.
3567 --
3568 -- Post Failure:
3569 -- An application error is raised if the published plan is not active on
3570 -- effective date.
3571 --
3572 -- Access Status:
3573 -- Internal Row Handler Use Only.
3574 --
3575 -- {End Of Comments}
3576 -- ----------------------------------------------------------------------------
3577 procedure chk_plan_still_active
3578 (p_effective_date in date
3579 ,p_status_code in varchar2
3580 ,p_start_date in date
3581 ,p_end_date in date
3582 ) is
3583
3584 -- Declare local variables
3585
3586 l_proc varchar2(72) := g_package||'chk_plan_still_active';
3587 l_api_updating boolean;
3588
3589 Begin
3590
3591 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
3592
3593 --
3594 IF (p_status_code = 'PUBLISHED' AND
3595 p_effective_date > p_end_date)
3596 THEN
3597 fnd_message.set_name('PER','HR_50261_WPM_PLAN_UPD_ACTIVE');
3598 fnd_message.raise_error;
3599 END IF;
3600
3601 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
3602
3603 exception
3604 when app_exception.application_exception then
3605 IF hr_multi_message.exception_add
3606 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.START_DATE'
3607 ,p_associated_column2 => 'PER_PERF_MGMT_PLANS.END_DATE'
3608 ,p_associated_column3 => 'PER_PERF_MGMT_PLANS.STATUS_CODE'
3609 ) THEN
3610 hr_utility.set_location(' Leaving:'||l_proc, 980);
3611 raise;
3612 END IF;
3613 hr_utility.set_location(' Leaving:'||l_proc, 990);
3614
3615 End chk_plan_still_active;
3616 --
3617 -- ----------------------------------------------------------------------------
3618 -- |---------------------------< chk_plan_is_draft >--------------------------|
3619 -- ----------------------------------------------------------------------------
3620 -- {Start Of Comments}
3621 --
3622 -- Description:
3623 -- Checks that the plan status is 'DRAFT'.
3627 --
3624 --
3625 -- Prerequisites:
3626 -- None.
3628 -- In Arguments:
3629 --
3630 --
3631 -- Post Success:
3632 -- Processing continues if the plan is 'DRAFT'.
3633 --
3634 -- Post Failure:
3635 -- An application error is raised if the plan status is not 'DRAFT'.
3636 --
3637 -- Access Status:
3638 -- Internal Row Handler Use Only.
3639 --
3640 -- {End Of Comments}
3641 -- ----------------------------------------------------------------------------
3642 procedure chk_plan_is_draft
3643 (p_status_code in varchar2
3644 ) is
3645
3646 -- Declare local variables
3647
3648 l_proc varchar2(72) := g_package||'chk_plan_is_draft';
3649 l_api_updating boolean;
3650
3651 Begin
3652
3653 IF g_debug THEN hr_utility.set_location('Entering:'|| l_proc, 10); END IF;
3654
3655 --
3656 -- Checks that the status code is 'DRAFT'
3657 --
3658 IF (p_status_code <> 'DRAFT') THEN
3659 fnd_message.set_name('PER','HR_50262_WPM_PLAN_DEL_DRAFT');
3660 fnd_message.raise_error;
3661 END IF;
3662
3663 IF g_debug THEN hr_utility.set_location('Leaving:'|| l_proc, 970); END IF;
3664
3665 exception
3666 when app_exception.application_exception then
3667 IF hr_multi_message.exception_add
3668 (p_associated_column1 => 'PER_PERF_MGMT_PLANS.STATUS_CODE'
3669 ) THEN
3670 hr_utility.set_location(' Leaving:'||l_proc, 980);
3671 raise;
3672 END IF;
3673 hr_utility.set_location(' Leaving:'||l_proc, 990);
3674
3675 End chk_plan_is_draft;
3676 --
3677 -- ----------------------------------------------------------------------------
3678 -- |---------------------------< insert_validate >----------------------------|
3679 -- ----------------------------------------------------------------------------
3680 Procedure insert_validate
3681 (p_effective_date in date
3682 ,p_rec in per_pmp_shd.g_rec_type
3683 ,p_duplicate_name_warning out nocopy boolean
3684 ,p_no_life_events_warning out nocopy boolean
3685 ) is
3686 --
3687 l_proc varchar2(72) := g_package||'insert_validate';
3688 --
3689 Begin
3690 hr_utility.set_location('Entering:'||l_proc, 5);
3691 --
3692 -- Call all supporting business operations
3693 --
3694 -- No business group context. HR_STANDARD_LOOKUPS used for validation.
3695
3696 --
3697 -- Validate Independent Attributes
3698 --
3699 --
3700 -- Check the uniqueness of the plan name.
3701 --
3702 chk_plan_name
3703 (p_plan_id => p_rec.plan_id
3704 ,p_object_version_number => p_rec.object_version_number
3705 ,p_plan_name => p_rec.plan_name
3706 ,p_start_date => p_rec.start_date
3707 ,p_end_date => p_rec.end_date
3708 ,p_duplicate_name_warning => p_duplicate_name_warning
3709 );
3710
3711 hr_utility.set_location('Entering:'||l_proc, 10);
3712
3713 --
3714 -- Check the validity of administrator id
3715 --
3716 chk_administrator_person_id
3717 (p_plan_id => p_rec.plan_id
3718 ,p_object_version_number => p_rec.object_version_number
3719 ,p_effective_date => p_effective_date
3720 ,p_administrator_person_id => p_rec.administrator_person_id
3721 );
3722
3723 --
3724 -- Check the validity of dates
3725 --
3726 chk_start_from_to_date
3727 (p_plan_id => p_rec.plan_id
3728 ,p_object_version_number => p_rec.object_version_number
3729 ,p_start_date => p_rec.start_date
3730 ,p_end_date => p_rec.end_date
3731 ,p_status_code => p_rec.status_code
3732 );
3733
3734 hr_utility.set_location('Entering:'||l_proc, 15);
3735
3736 --
3737 -- Check the validity of status code
3738 --
3739 chk_status_code
3740 (p_plan_id => p_rec.plan_id
3741 ,p_object_version_number => p_rec.object_version_number
3742 ,p_effective_date => p_effective_date
3743 ,p_status_code => p_rec.status_code
3744 );
3745
3746 hr_utility.set_location('Entering:'||l_proc, 20);
3747
3748 --
3749 -- Check the validity of plan hierarchy type
3750 --
3751 chk_hierarchy_type_code
3752 (p_plan_id => p_rec.plan_id
3753 ,p_object_version_number => p_rec.object_version_number
3754 ,p_effective_date => p_effective_date
3755 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
3756 );
3757
3758 hr_utility.set_location('Entering:'||l_proc, 25);
3759
3760 --
3761 -- Check the validity of supervisor id
3762 --
3763 chk_supervisor_id
3764 (p_plan_id => p_rec.plan_id
3765 ,p_object_version_number => p_rec.object_version_number
3766 ,p_effective_date => p_effective_date
3767 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
3768 ,p_supervisor_id => p_rec.supervisor_id
3769 );
3770
3771 hr_utility.set_location('Entering:'||l_proc, 30);
3772
3773 --
3774 -- Check the validity of supervisor assignment id
3775 --
3776 chk_supervisor_assignment_id
3777 (p_plan_id => p_rec.plan_id
3778 ,p_object_version_number => p_rec.object_version_number
3779 ,p_effective_date => p_effective_date
3780 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
3781 ,p_supervisor_assignment_id => p_rec.supervisor_assignment_id
3782 );
3783
3784 hr_utility.set_location('Entering:'||l_proc, 35);
3785
3786 --
3787 -- Check the validity of organization structure id
3788 --
3789 chk_organization_structure_id
3790 (p_plan_id => p_rec.plan_id
3791 ,p_object_version_number => p_rec.object_version_number
3792 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
3793 ,p_organization_structure_id => p_rec.organization_structure_id
3794 );
3795
3796 hr_utility.set_location('Entering:'||l_proc, 40);
3797
3798 --
3799 -- Check the validity of organization structure version id
3800 --
3801 chk_org_structure_version_id
3802 (p_plan_id => p_rec.plan_id
3803 ,p_object_version_number => p_rec.object_version_number
3804 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
3805 ,p_org_structure_version_id => p_rec.org_structure_version_id
3806 );
3807
3808 hr_utility.set_location('Entering:'||l_proc, 45);
3809
3810 --
3811 -- Check the validity of version for organization structure
3812 --
3813 chk_org_structure_version
3814 (p_plan_id => p_rec.plan_id
3815 ,p_object_version_number => p_rec.object_version_number
3816 ,p_organization_structure_id => p_rec.organization_structure_id
3817 ,p_org_structure_version_id => p_rec.org_structure_version_id
3818 );
3819
3820 hr_utility.set_location('Entering:'||l_proc, 50);
3821
3822 --
3823 -- Check the validity of top organization id
3824 --
3825 chk_top_organization_id
3826 (p_plan_id => p_rec.plan_id
3827 ,p_object_version_number => p_rec.object_version_number
3828 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
3829 ,p_org_structure_version_id => p_rec.org_structure_version_id
3830 ,p_top_organization_id => p_rec.top_organization_id
3831 );
3832
3833 hr_utility.set_location('Entering:'||l_proc, 55);
3834
3835 --
3836 -- Check the validity of position structure id
3837 --
3838 chk_position_structure_id
3839 (p_plan_id => p_rec.plan_id
3840 ,p_object_version_number => p_rec.object_version_number
3844
3841 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
3842 ,p_position_structure_id => p_rec.position_structure_id
3843 );
3845 hr_utility.set_location('Entering:'||l_proc, 60);
3846
3847 --
3848 -- Check the validity of position structure version id
3849 --
3850 chk_pos_structure_version_id
3851 (p_plan_id => p_rec.plan_id
3852 ,p_object_version_number => p_rec.object_version_number
3853 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
3854 ,p_pos_structure_version_id => p_rec.pos_structure_version_id
3855 );
3856
3857 hr_utility.set_location('Entering:'||l_proc, 65);
3858
3859 --
3860 -- Check the validity of version for position structure
3861 --
3862 chk_pos_structure_version
3863 (p_plan_id => p_rec.plan_id
3864 ,p_object_version_number => p_rec.object_version_number
3865 ,p_position_structure_id => p_rec.position_structure_id
3866 ,p_pos_structure_version_id => p_rec.pos_structure_version_id
3867 );
3868
3869 hr_utility.set_location('Entering:'||l_proc, 70);
3870
3871 --
3872 -- Check the validity of top position id
3873 --
3874 chk_top_position_id
3875 (p_plan_id => p_rec.plan_id
3876 ,p_object_version_number => p_rec.object_version_number
3877 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
3878 ,p_pos_structure_version_id => p_rec.pos_structure_version_id
3879 ,p_top_position_id => p_rec.top_position_id
3880 );
3881
3882 hr_utility.set_location('Entering:'||l_proc, 75);
3883
3884 --
3885 -- Check the validity of hierarchy level
3886 --
3887 chk_hierarchy_levels
3888 (p_plan_id => p_rec.plan_id
3889 ,p_object_version_number => p_rec.object_version_number
3890 ,p_hierarchy_levels => p_rec.hierarchy_levels
3891 );
3892
3893 hr_utility.set_location('Entering:'||l_proc, 80);
3894
3895 --
3896 -- Check the validity of automatic enrollment flag
3897 --
3898 chk_automatic_enrollment_flag
3899 (p_plan_id => p_rec.plan_id
3900 ,p_object_version_number => p_rec.object_version_number
3901 ,p_effective_date => p_effective_date
3902 ,p_automatic_enrollment_flag => p_rec.automatic_enrollment_flag
3903 );
3904
3905 hr_utility.set_location('Entering:'||l_proc, 85);
3906
3907 --
3908 -- Check the validity of assignment types code
3909 --
3910 chk_assignment_types_code
3911 (p_plan_id => p_rec.plan_id
3912 ,p_object_version_number => p_rec.object_version_number
3913 ,p_effective_date => p_effective_date
3914 ,p_assignment_types_code => p_rec.assignment_types_code
3915 );
3916
3917
3918 hr_utility.set_location('Entering:'||l_proc, 90);
3919
3920 --
3921 -- Check the validity of primary assignment only flag
3922 --
3923 chk_primary_asg_only_flag
3924 (p_plan_id => p_rec.plan_id
3925 ,p_object_version_number => p_rec.object_version_number
3926 ,p_effective_date => p_effective_date
3927 ,p_primary_asg_only_flag => p_rec.primary_asg_only_flag
3928 );
3929
3930 hr_utility.set_location('Entering:'||l_proc, 95);
3931
3932 --
3933 -- Check the validity of primary assignment only flag with plan hierarchy
3934 --
3935 chk_hier_type_primary_asg
3936 (p_plan_id => p_rec.plan_id
3937 ,p_object_version_number => p_rec.object_version_number
3938 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
3939 ,p_primary_asg_only_flag => p_rec.primary_asg_only_flag
3940 );
3941
3942 hr_utility.set_location('Entering:'||l_proc, 100);
3943
3944 --
3945 -- Check the validity of include objective setting flag
3946 --
3947 chk_include_obj_set_flag
3948 (p_plan_id => p_rec.plan_id
3949 ,p_object_version_number => p_rec.object_version_number
3950 ,p_effective_date => p_effective_date
3951 ,p_include_obj_setting_flag => p_rec.include_obj_setting_flag
3952 ,p_obj_setting_start_date => p_rec.obj_setting_start_date
3953 ,p_method_code => p_rec.method_code
3954 ,p_notify_population_flag => p_rec.notify_population_flag
3955 );
3956
3957 hr_utility.set_location('Entering:'||l_proc, 95);
3958
3959 --
3960 -- Check the validity of objective setting dates
3961 --
3962 chk_obj_set_start_end
3963 (p_plan_id => p_rec.plan_id
3964 ,p_object_version_number => p_rec.object_version_number
3965 ,p_obj_setting_start_date => p_rec.obj_setting_start_date
3966 ,p_obj_setting_deadline => p_rec.obj_setting_deadline
3967 );
3968
3969 hr_utility.set_location('Entering:'||l_proc, 105);
3970
3971 --
3972 -- Check the validity of objective setting deadline with plan end date
3973 --
3974 chk_plan_end_obj_set_end
3975 (p_plan_id => p_rec.plan_id
3976 ,p_object_version_number => p_rec.object_version_number
3977 ,p_obj_setting_deadline => p_rec.obj_setting_deadline
3978 ,p_end_date => p_rec.end_date
3979 ,p_status => 'INSERT'
3980 );
3981
3982 hr_utility.set_location('Entering:'||l_proc, 110);
3983
3984 --
3985 -- Check the validity of objective setting outside period flag
3986 --
3987 chk_obj_set_outside_flag
3988 (p_plan_id => p_rec.plan_id
3989 ,p_object_version_number => p_rec.object_version_number
3990 ,p_effective_date => p_effective_date
3991 ,p_obj_set_outside_period_flag => p_rec.obj_set_outside_period_flag
3992 );
3993
3994 hr_utility.set_location('Entering:'||l_proc, 115);
3995
3996 --
3997 -- Check the validity of method code
3998 --
3999 chk_method_code
4000 (p_plan_id => p_rec.plan_id
4001 ,p_object_version_number => p_rec.object_version_number
4002 ,p_effective_date => p_effective_date
4003 ,p_method_code => p_rec.method_code
4004 );
4005
4006 hr_utility.set_location('Entering:'||l_proc, 120);
4007
4008 --
4009 -- Check the validity of notify population flag
4010 --
4011 chk_notify_population_flag
4012 (p_plan_id => p_rec.plan_id
4013 ,p_object_version_number => p_rec.object_version_number
4014 ,p_effective_date => p_effective_date
4015 ,p_notify_population_flag => p_rec.notify_population_flag
4016 );
4017
4018 hr_utility.set_location('Entering:'||l_proc, 123);
4019
4020 --
4021 -- Check the validity of automatic allocation flag
4022 --
4023 chk_automatic_allocation_flag
4024 (p_plan_id => p_rec.plan_id
4025 ,p_object_version_number => p_rec.object_version_number
4029
4026 ,p_effective_date => p_effective_date
4027 ,p_automatic_allocation_flag => p_rec.automatic_allocation_flag
4028 );
4030 hr_utility.set_location('Entering:'||l_proc, 125);
4031
4032 --
4033 -- Check the validity of sharing assignment task flag
4034 --
4035 chk_sharing_alignment_flag
4036 (p_plan_id => p_rec.plan_id
4037 ,p_object_version_number => p_rec.object_version_number
4038 ,p_effective_date => p_effective_date
4039 ,p_sharing_alignment_task_flag => p_rec.sharing_alignment_task_flag
4040 );
4041
4042 hr_utility.set_location('Entering:'||l_proc, 130);
4043
4044 --
4045 -- Check the validity of include appraisals flag
4046 --
4047 chk_include_appraisals_flag
4048 (p_plan_id => p_rec.plan_id
4049 ,p_object_version_number => p_rec.object_version_number
4050 ,p_effective_date => p_effective_date
4051 ,p_include_appraisals_flag => p_rec.include_appraisals_flag
4052 );
4053
4054 hr_utility.set_location('Entering:'||l_proc, 135);
4055
4056 --
4057 -- Check that the previous plan does not overlap with the new plan
4058 --
4059 chk_previous_plan_id
4060 (p_plan_id => p_rec.plan_id
4061 ,p_object_version_number => p_rec.object_version_number
4062 ,p_effective_date => p_effective_date
4063 ,p_start_date => p_rec.start_date
4064 ,p_previous_plan_id => p_rec.previous_plan_id
4065 );
4066
4067 hr_utility.set_location('Entering:'||l_proc, 140);
4068 --
4069 -- Check the validity of objective setting start date with plan start date
4070 --
4071 chk_plan_start_obj_set_start
4072 (p_plan_id => p_rec.plan_id
4073 ,p_object_version_number => p_rec.object_version_number
4074 ,p_obj_setting_start_date => p_rec.obj_setting_start_date
4075 ,p_start_date => p_rec.start_date
4076 );
4077
4078 hr_utility.set_location('Entering:'||l_proc, 145);
4079
4080 --
4081 -- Check the flexfield.
4082 --
4083 per_pmp_bus.chk_df(p_rec);
4084 --
4085 hr_utility.set_location(' Leaving:'||l_proc, 200);
4086 End insert_validate;
4087 --
4088 -- ----------------------------------------------------------------------------
4089 -- |---------------------------< update_validate >----------------------------|
4090 -- ----------------------------------------------------------------------------
4091 Procedure update_validate
4092 (p_effective_date in date
4093 ,p_rec in per_pmp_shd.g_rec_type
4094 ,p_duplicate_name_warning out nocopy boolean
4095 ,p_no_life_events_warning out nocopy boolean
4096 ) is
4097 --
4098 l_proc varchar2(72) := g_package||'update_validate';
4099 --
4100 Begin
4101 hr_utility.set_location('Entering:'||l_proc, 5);
4102 --
4103 -- Call all supporting business operations
4104 --
4105 -- No business group context. HR_STANDARD_LOOKUPS used for validation.
4106 --
4107 chk_non_updateable_args
4108 (p_effective_date => p_effective_date
4109 ,p_rec => p_rec
4110 );
4111 --
4112
4113 --
4114 -- Validate Independent Attributes
4115 --
4116 --
4117 -- Check the uniqueness of the plan name.
4118 --
4119 chk_plan_name
4120 (p_plan_id => p_rec.plan_id
4121 ,p_object_version_number => p_rec.object_version_number
4122 ,p_plan_name => p_rec.plan_name
4123 ,p_start_date => p_rec.start_date
4124 ,p_end_date => p_rec.end_date
4125 ,p_duplicate_name_warning => p_duplicate_name_warning
4126 );
4127
4128 hr_utility.set_location('Entering:'||l_proc, 10);
4129
4130 --
4131 -- Check the validity of administrator id
4132 --
4133 chk_administrator_person_id
4134 (p_plan_id => p_rec.plan_id
4135 ,p_object_version_number => p_rec.object_version_number
4136 ,p_effective_date => p_effective_date
4137 ,p_administrator_person_id => p_rec.administrator_person_id
4138 );
4139
4140 --
4141 -- Check the validity of dates
4142 --
4143 chk_start_from_to_date
4144 (p_plan_id => p_rec.plan_id
4145 ,p_object_version_number => p_rec.object_version_number
4146 ,p_start_date => p_rec.start_date
4147 ,p_end_date => p_rec.end_date
4148 ,p_status_code => p_rec.status_code
4149 );
4150
4151 hr_utility.set_location('Entering:'||l_proc, 15);
4152
4153 --
4154 -- Check the validity of status code
4155 --
4156 chk_status_code
4157 (p_plan_id => p_rec.plan_id
4158 ,p_object_version_number => p_rec.object_version_number
4159 ,p_effective_date => p_effective_date
4160 ,p_status_code => p_rec.status_code
4161 );
4162
4163 hr_utility.set_location('Entering:'||l_proc, 20);
4164
4165 --
4166 -- Check the validity of plan hierarchy type
4167 --
4168 chk_hierarchy_type_code
4169 (p_plan_id => p_rec.plan_id
4170 ,p_object_version_number => p_rec.object_version_number
4171 ,p_effective_date => p_effective_date
4172 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
4173 );
4174
4175 hr_utility.set_location('Entering:'||l_proc, 25);
4176
4177 --
4178 -- Check the validity of supervisor id
4179 --
4180 chk_supervisor_id
4181 (p_plan_id => p_rec.plan_id
4182 ,p_object_version_number => p_rec.object_version_number
4183 ,p_effective_date => p_effective_date
4184 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
4185 ,p_supervisor_id => p_rec.supervisor_id
4186 );
4187
4188 hr_utility.set_location('Entering:'||l_proc, 30);
4189
4190 --
4191 -- Check the validity of supervisor assignment id
4192 --
4193 chk_supervisor_assignment_id
4194 (p_plan_id => p_rec.plan_id
4195 ,p_object_version_number => p_rec.object_version_number
4196 ,p_effective_date => p_effective_date
4197 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
4198 ,p_supervisor_assignment_id => p_rec.supervisor_assignment_id
4199 );
4200
4201 hr_utility.set_location('Entering:'||l_proc, 35);
4202
4203 --
4204 -- Check the validity of organization structure id
4205 --
4206 chk_organization_structure_id
4207 (p_plan_id => p_rec.plan_id
4208 ,p_object_version_number => p_rec.object_version_number
4209 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
4213 hr_utility.set_location('Entering:'||l_proc, 40);
4210 ,p_organization_structure_id => p_rec.organization_structure_id
4211 );
4212
4214
4215 --
4216 -- Check the validity of organization structure version id
4217 --
4218 chk_org_structure_version_id
4219 (p_plan_id => p_rec.plan_id
4220 ,p_object_version_number => p_rec.object_version_number
4224
4221 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
4222 ,p_org_structure_version_id => p_rec.org_structure_version_id
4223 );
4225 hr_utility.set_location('Entering:'||l_proc, 45);
4226
4227 --
4228 -- Check the validity of version for organization structure
4229 --
4230 chk_org_structure_version
4231 (p_plan_id => p_rec.plan_id
4232 ,p_object_version_number => p_rec.object_version_number
4233 ,p_organization_structure_id => p_rec.organization_structure_id
4234 ,p_org_structure_version_id => p_rec.org_structure_version_id
4235 );
4236
4237 hr_utility.set_location('Entering:'||l_proc, 50);
4238
4239 --
4240 -- Check the validity of top organization id
4241 --
4242 chk_top_organization_id
4243 (p_plan_id => p_rec.plan_id
4244 ,p_object_version_number => p_rec.object_version_number
4245 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
4246 ,p_top_organization_id => p_rec.top_organization_id
4247 ,p_org_structure_version_id => p_rec.org_structure_version_id
4248 );
4249
4250 hr_utility.set_location('Entering:'||l_proc, 55);
4251
4252 --
4253 -- Check the validity of position structure id
4254 --
4255 chk_position_structure_id
4256 (p_plan_id => p_rec.plan_id
4257 ,p_object_version_number => p_rec.object_version_number
4258 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
4259 ,p_position_structure_id => p_rec.position_structure_id
4260 );
4261
4262 hr_utility.set_location('Entering:'||l_proc, 60);
4263
4264 --
4265 -- Check the validity of position structure version id
4266 --
4267 chk_pos_structure_version_id
4268 (p_plan_id => p_rec.plan_id
4269 ,p_object_version_number => p_rec.object_version_number
4270 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
4271 ,p_pos_structure_version_id => p_rec.pos_structure_version_id
4272 );
4273
4274 hr_utility.set_location('Entering:'||l_proc, 65);
4275
4276 --
4277 -- Check the validity of version for position structure
4278 --
4279 chk_pos_structure_version
4280 (p_plan_id => p_rec.plan_id
4281 ,p_object_version_number => p_rec.object_version_number
4282 ,p_position_structure_id => p_rec.position_structure_id
4283 ,p_pos_structure_version_id => p_rec.pos_structure_version_id
4284 );
4285
4286 hr_utility.set_location('Entering:'||l_proc, 70);
4287
4288 --
4289 -- Check the validity of top position id
4290 --
4291 chk_top_position_id
4292 (p_plan_id => p_rec.plan_id
4293 ,p_object_version_number => p_rec.object_version_number
4294 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
4295 ,p_pos_structure_version_id => p_rec.pos_structure_version_id
4296 ,p_top_position_id => p_rec.top_position_id
4297 );
4298
4299 hr_utility.set_location('Entering:'||l_proc, 75);
4300
4301 --
4302 -- Check the validity of hierarchy level
4303 --
4304 chk_hierarchy_levels
4305 (p_plan_id => p_rec.plan_id
4306 ,p_object_version_number => p_rec.object_version_number
4307 ,p_hierarchy_levels => p_rec.hierarchy_levels
4308 );
4309
4310 hr_utility.set_location('Entering:'||l_proc, 80);
4311
4312 --
4313 -- Check the validity of automatic enrollment flag
4314 --
4315 chk_automatic_enrollment_flag
4316 (p_plan_id => p_rec.plan_id
4317 ,p_object_version_number => p_rec.object_version_number
4318 ,p_effective_date => p_effective_date
4319 ,p_automatic_enrollment_flag => p_rec.automatic_enrollment_flag
4320 );
4321
4322 hr_utility.set_location('Entering:'||l_proc, 85);
4323
4324 --
4325 -- Check the validity of assignment types code
4326 --
4327 chk_assignment_types_code
4328 (p_plan_id => p_rec.plan_id
4329 ,p_object_version_number => p_rec.object_version_number
4330 ,p_effective_date => p_effective_date
4331 ,p_assignment_types_code => p_rec.assignment_types_code
4332 );
4333
4334
4335 hr_utility.set_location('Entering:'||l_proc, 90);
4336
4337 --
4338 -- Check the validity of primary assignment only flag
4339 --
4340 chk_primary_asg_only_flag
4341 (p_plan_id => p_rec.plan_id
4342 ,p_object_version_number => p_rec.object_version_number
4343 ,p_effective_date => p_effective_date
4344 ,p_primary_asg_only_flag => p_rec.primary_asg_only_flag
4345 );
4346
4347 hr_utility.set_location('Entering:'||l_proc, 95);
4348
4349 --
4350 -- Check the validity of primary assignment only flag with plan hierarchy
4351 --
4352 chk_hier_type_primary_asg
4353 (p_plan_id => p_rec.plan_id
4354 ,p_object_version_number => p_rec.object_version_number
4355 ,p_hierarchy_type_code => p_rec.hierarchy_type_code
4356 ,p_primary_asg_only_flag => p_rec.primary_asg_only_flag
4357 );
4358
4359 hr_utility.set_location('Entering:'||l_proc, 100);
4360
4361 --
4362 -- Check the validity of include objective setting flag
4363 --
4364 chk_include_obj_set_flag
4365 (p_plan_id => p_rec.plan_id
4366 ,p_object_version_number => p_rec.object_version_number
4367 ,p_effective_date => p_effective_date
4368 ,p_include_obj_setting_flag => p_rec.include_obj_setting_flag
4369 ,p_obj_setting_start_date => p_rec.obj_setting_start_date
4370 ,p_method_code => p_rec.method_code
4371 ,p_notify_population_flag => p_rec.notify_population_flag
4372 );
4373
4374 hr_utility.set_location('Entering:'||l_proc, 105);
4375
4379 chk_obj_set_start_end
4376 --
4377 -- Check the validity of objective setting dates
4378 --
4380 (p_plan_id => p_rec.plan_id
4381 ,p_object_version_number => p_rec.object_version_number
4382 ,p_obj_setting_start_date => p_rec.obj_setting_start_date
4383 ,p_obj_setting_deadline => p_rec.obj_setting_deadline
4384 );
4385
4386 hr_utility.set_location('Entering:'||l_proc, 110);
4387
4388 --
4389 -- Check the validity of objective setting deadline with plan end date
4390 --
4391 chk_plan_end_obj_set_end
4395 ,p_end_date => p_rec.end_date
4392 (p_plan_id => p_rec.plan_id
4393 ,p_object_version_number => p_rec.object_version_number
4394 ,p_obj_setting_deadline => p_rec.obj_setting_deadline
4396 ,p_status => 'UPDATE'
4397 );
4398
4399 hr_utility.set_location('Entering:'||l_proc, 115);
4400
4401 --
4402 -- Check the validity of objective setting outside period flag
4403 --
4404 chk_obj_set_outside_flag
4405 (p_plan_id => p_rec.plan_id
4406 ,p_object_version_number => p_rec.object_version_number
4407 ,p_effective_date => p_effective_date
4408 ,p_obj_set_outside_period_flag => p_rec.obj_set_outside_period_flag
4409 );
4410
4411 hr_utility.set_location('Entering:'||l_proc, 120);
4412
4413 --
4414 -- Check the validity of method code
4415 --
4416 chk_method_code
4417 (p_plan_id => p_rec.plan_id
4418 ,p_object_version_number => p_rec.object_version_number
4419 ,p_effective_date => p_effective_date
4420 ,p_method_code => p_rec.method_code
4421 );
4422
4423 hr_utility.set_location('Entering:'||l_proc, 125);
4424
4425 --
4426 -- Check the validity of notify population flag
4427 --
4428 chk_notify_population_flag
4429 (p_plan_id => p_rec.plan_id
4430 ,p_object_version_number => p_rec.object_version_number
4431 ,p_effective_date => p_effective_date
4432 ,p_notify_population_flag => p_rec.notify_population_flag
4433 );
4434
4435 hr_utility.set_location('Entering:'||l_proc, 127);
4436
4437 --
4438 -- Check the validity of automatic allocation flag
4439 --
4440 chk_automatic_allocation_flag
4441 (p_plan_id => p_rec.plan_id
4442 ,p_object_version_number => p_rec.object_version_number
4443 ,p_effective_date => p_effective_date
4444 ,p_automatic_allocation_flag => p_rec.automatic_allocation_flag
4445 );
4446
4447 hr_utility.set_location('Entering:'||l_proc, 130);
4448
4449 --
4450 -- Check the validity of sharing assignment task flag
4451 --
4452 chk_sharing_alignment_flag
4453 (p_plan_id => p_rec.plan_id
4454 ,p_object_version_number => p_rec.object_version_number
4455 ,p_effective_date => p_effective_date
4456 ,p_sharing_alignment_task_flag => p_rec.sharing_alignment_task_flag
4457 );
4458
4459 hr_utility.set_location('Entering:'||l_proc, 135);
4460
4461 --
4462 -- Check the validity of include appraisals flag
4463 --
4464 chk_include_appraisals_flag
4465 (p_plan_id => p_rec.plan_id
4466 ,p_object_version_number => p_rec.object_version_number
4467 ,p_effective_date => p_effective_date
4468 ,p_include_appraisals_flag => p_rec.include_appraisals_flag
4469 );
4470
4471 hr_utility.set_location('Entering:'||l_proc, 140);
4472 --
4473 -- Check the published plan validity on effective date
4474 --
4475 chk_plan_still_active
4476 (p_effective_date => p_effective_date
4477 ,p_status_code => p_rec.status_code
4478 ,p_start_date => p_rec.start_date
4479 ,p_end_date => p_rec.end_date
4483
4480 );
4481
4482 hr_utility.set_location('Entering:'||l_proc, 145);
4484 --
4485 -- Check that the previous plan does not overlap with the new plan
4486 --
4487 chk_previous_plan_id
4488 (p_plan_id => p_rec.plan_id
4489 ,p_object_version_number => p_rec.object_version_number
4490 ,p_effective_date => p_effective_date
4491 ,p_start_date => p_rec.start_date
4492 ,p_previous_plan_id => p_rec.previous_plan_id
4493 );
4494
4495 hr_utility.set_location('Entering:'||l_proc, 150);
4496
4497 --
4498 -- Check the validity of objective setting start date with plan start date
4499 --
4500 chk_plan_start_obj_set_start
4501 (p_plan_id => p_rec.plan_id
4502 ,p_object_version_number => p_rec.object_version_number
4503 ,p_obj_setting_start_date => p_rec.obj_setting_start_date
4504 ,p_start_date => p_rec.start_date
4505 );
4506
4507 hr_utility.set_location('Entering:'||l_proc, 155);
4508
4509 --
4510 -- Check the flexfield.
4511 --
4512 per_pmp_bus.chk_df(p_rec);
4513 --
4514 hr_utility.set_location(' Leaving:'||l_proc, 200);
4515 End update_validate;
4516 --
4517 -- ----------------------------------------------------------------------------
4518 -- |---------------------------< delete_validate >----------------------------|
4519 -- ----------------------------------------------------------------------------
4520 Procedure delete_validate
4521 (p_rec in per_pmp_shd.g_rec_type
4522 ) is
4523 --
4524 l_proc varchar2(72) := g_package||'delete_validate';
4525 --
4526 Begin
4527 hr_utility.set_location('Entering:'||l_proc, 5);
4528 --
4529 -- Call all supporting business operations
4530 --
4531 --
4532 -- Check the plan status is 'DRAFT'
4533 --
4534 chk_plan_is_draft
4535 (p_status_code => p_rec.status_code
4536 );
4537 hr_utility.set_location(' Leaving:'||l_proc, 10);
4538 End delete_validate;
4539 --
4540 end per_pmp_bus;