[Home] [Help]
PACKAGE BODY: APPS.HR_OBJECTIVES_API
Source
1 Package Body hr_objectives_api as
2 /* $Header: peobjapi.pkb 120.4 2006/03/20 14:07:58 svittal noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' hr_objectives_api.';
7 --
8 -- ---------------------------------------------------------------------------
9 -- |-----------------------< <create_objective> >--------------------------|
10 -- ---------------------------------------------------------------------------
11 --
12 procedure create_objective
13 (p_validate in boolean default false,
14 p_effective_date in date,
15 p_business_group_id in number,
16 p_name in varchar2,
17 p_start_date in date,
18 p_owning_person_id in number,
19 p_target_date in date default null,
20 p_achievement_date in date default null,
21 p_detail in varchar2 default null,
22 p_comments in varchar2 default null,
23 p_success_criteria in varchar2 default null,
24 p_appraisal_id in number default null,
25 p_attribute_category in varchar2 default null,
26 p_attribute1 in varchar2 default null,
27 p_attribute2 in varchar2 default null,
28 p_attribute3 in varchar2 default null,
29 p_attribute4 in varchar2 default null,
30 p_attribute5 in varchar2 default null,
31 p_attribute6 in varchar2 default null,
32 p_attribute7 in varchar2 default null,
33 p_attribute8 in varchar2 default null,
34 p_attribute9 in varchar2 default null,
35 p_attribute10 in varchar2 default null,
36 p_attribute11 in varchar2 default null,
37 p_attribute12 in varchar2 default null,
38 p_attribute13 in varchar2 default null,
39 p_attribute14 in varchar2 default null,
40 p_attribute15 in varchar2 default null,
41 p_attribute16 in varchar2 default null,
42 p_attribute17 in varchar2 default null,
43 p_attribute18 in varchar2 default null,
44 p_attribute19 in varchar2 default null,
45 p_attribute20 in varchar2 default null,
46
47 p_attribute21 in varchar2 default null,
48 p_attribute22 in varchar2 default null,
49 p_attribute23 in varchar2 default null,
50 p_attribute24 in varchar2 default null,
51 p_attribute25 in varchar2 default null,
52 p_attribute26 in varchar2 default null,
53 p_attribute27 in varchar2 default null,
54 p_attribute28 in varchar2 default null,
55 p_attribute29 in varchar2 default null,
56 p_attribute30 in varchar2 default null,
57
58 p_scorecard_id in number default null,
59 p_copied_from_library_id in number default null,
60 p_copied_from_objective_id in number default null,
61 p_aligned_with_objective_id in number default null,
62
63 p_next_review_date in date default null,
64 p_group_code in varchar2 default null,
65 p_priority_code in varchar2 default null,
66 p_appraise_flag in varchar2 default null,
67 p_verified_flag in varchar2 default null,
68
69 p_target_value in number default null,
70 p_actual_value in number default null,
71 p_weighting_percent in number default null,
72 p_complete_percent in number default null,
73 p_uom_code in varchar2 default null,
74
75 p_measurement_style_code in varchar2 default null,
76 p_measure_name in varchar2 default null,
77 p_measure_type_code in varchar2 default null,
78 p_measure_comments in varchar2 default null,
79 p_sharing_access_code in varchar2 default null,
80
81 p_weighting_over_100_warning out nocopy boolean,
82 p_weighting_appraisal_warning out nocopy boolean,
83
84 p_objective_id out nocopy number,
85 p_object_version_number out nocopy number
86 )
87 is
88 --
89 -- Declare cursors and local variables
90 --
91 --
92 l_proc varchar2(72) := g_package||'create_objective';
93 l_objective_id per_objectives.objective_id%TYPE;
94 l_object_version_number per_objectives.object_version_number%TYPE;
95 l_effective_date date;
96 l_start_date per_objectives.start_date%TYPE;
97 l_target_date per_objectives.target_date%TYPE;
98 l_achievement_date per_objectives.achievement_date%TYPE;
99
100 l_weighting_over_100_warning boolean := false;
101 l_weighting_appraisal_warning boolean := false;
102 begin
103 hr_utility.set_location('Entering:'|| l_proc, 5);
104 --
105 -- Issue a savepoint
106 --
107 savepoint create_objective;
108 --
109 hr_utility.set_location(l_proc, 6);
110 --
111 -- Validation in addition to Table Handlers
112 --
113 l_effective_date := trunc(p_effective_date);
114 l_start_date := trunc(p_start_date);
115 l_target_date := trunc(p_target_date);
116 l_achievement_date := trunc(p_achievement_date);
117 --
118 begin
119 --
120 -- Start of API User Hook for the before hook of create_objective
121 --
122 hr_objectives_bk1.create_objective_b
123 (
124 p_effective_date => l_effective_date,
125 p_business_group_id => p_business_group_id,
126 p_name => p_name,
127 p_start_date => l_start_date,
128 p_owning_person_id => p_owning_person_id,
129 p_target_date => l_target_date,
130 p_achievement_date => l_achievement_date,
131 p_detail => p_detail,
132 p_comments => p_comments,
133 p_success_criteria => p_success_criteria,
134 p_appraisal_id => p_appraisal_id,
135 p_attribute_category => p_attribute_category,
136 p_attribute1 => p_attribute1,
137 p_attribute2 => p_attribute2,
138 p_attribute3 => p_attribute3,
139 p_attribute4 => p_attribute4,
140 p_attribute5 => p_attribute5,
141 p_attribute6 => p_attribute6,
142 p_attribute7 => p_attribute7,
143 p_attribute8 => p_attribute8,
144 p_attribute9 => p_attribute9,
145 p_attribute10 => p_attribute10,
146 p_attribute11 => p_attribute11,
147 p_attribute12 => p_attribute12,
148 p_attribute13 => p_attribute13,
149 p_attribute14 => p_attribute14,
150 p_attribute15 => p_attribute15,
151 p_attribute16 => p_attribute16,
152 p_attribute17 => p_attribute17,
153 p_attribute18 => p_attribute18,
154 p_attribute19 => p_attribute19,
155 p_attribute20 => p_attribute20,
156
157 p_attribute21 => p_attribute21,
158 p_attribute22 => p_attribute22,
159 p_attribute23 => p_attribute23,
160 p_attribute24 => p_attribute24,
161 p_attribute25 => p_attribute25,
162 p_attribute26 => p_attribute26,
163 p_attribute27 => p_attribute27,
164 p_attribute28 => p_attribute28,
165 p_attribute29 => p_attribute29,
166 p_attribute30 => p_attribute30,
167
168 p_scorecard_id => p_scorecard_id,
169 p_copied_from_library_id => p_copied_from_library_id,
170 p_copied_from_objective_id => p_copied_from_objective_id,
171 p_aligned_with_objective_id => p_aligned_with_objective_id,
172
173 p_next_review_date => p_next_review_date,
174 p_group_code => p_group_code,
175 p_priority_code => p_priority_code,
176 p_appraise_flag => p_appraise_flag,
177 p_verified_flag => p_verified_flag,
178
179 p_target_value => p_target_value,
180 p_actual_value => p_actual_value,
181 p_weighting_percent => p_weighting_percent,
182 p_complete_percent => p_complete_percent,
183 p_uom_code => p_uom_code,
184
185 p_measurement_style_code => p_measurement_style_code,
186 p_measure_name => p_measure_name,
187 p_measure_type_code => p_measure_type_code,
188 p_measure_comments => p_measure_comments ,
189 p_sharing_access_code => p_sharing_access_code
190
191 );
192 exception
193 when hr_api.cannot_find_prog_unit then
194 hr_api.cannot_find_prog_unit_error
195 (p_module_name => 'CREATE_OBJECTIVE'
196 ,p_hook_type => 'BP'
197 );
198 --
199 -- End of API User Hook for the before hook of create_objective
200 --
201 end;
202 --
203 hr_utility.set_location(l_proc, 7);
204 --
205 -- Process Logic
206 --
207 per_obj_ins.ins
208 (p_effective_date => l_effective_date,
209 p_business_group_id => p_business_group_id,
210 p_name => p_name,
211 p_target_date => l_target_date,
212 p_start_date => l_start_date,
213 p_owning_person_id => p_owning_person_id,
214 p_achievement_date => l_achievement_date,
215 p_detail => p_detail,
216 p_comments => p_comments,
217 p_success_criteria => p_success_criteria,
218 p_appraisal_id => p_appraisal_id,
219 p_attribute_category => p_attribute_category,
220 p_attribute1 => p_attribute1,
221 p_attribute2 => p_attribute2,
222 p_attribute3 => p_attribute3,
223 p_attribute4 => p_attribute4,
224 p_attribute5 => p_attribute5,
225 p_attribute6 => p_attribute6,
226 p_attribute7 => p_attribute7,
227 p_attribute8 => p_attribute8,
228 p_attribute9 => p_attribute9,
229 p_attribute10 => p_attribute10,
230 p_attribute11 => p_attribute11,
231 p_attribute12 => p_attribute12,
232 p_attribute13 => p_attribute13,
233 p_attribute14 => p_attribute14,
234 p_attribute15 => p_attribute15,
235 p_attribute16 => p_attribute16,
236 p_attribute17 => p_attribute17,
237 p_attribute18 => p_attribute18,
238 p_attribute19 => p_attribute19,
239 p_attribute20 => p_attribute20,
240
241 p_attribute21 => p_attribute21,
242 p_attribute22 => p_attribute22,
243 p_attribute23 => p_attribute23,
244 p_attribute24 => p_attribute24,
245 p_attribute25 => p_attribute25,
246 p_attribute26 => p_attribute26,
247 p_attribute27 => p_attribute27,
248 p_attribute28 => p_attribute28,
249 p_attribute29 => p_attribute29,
250 p_attribute30 => p_attribute30,
251
252 p_scorecard_id => p_scorecard_id,
253 p_copied_from_library_id => p_copied_from_library_id,
254 p_copied_from_objective_id => p_copied_from_objective_id,
255 p_aligned_with_objective_id => p_aligned_with_objective_id,
256
257 p_next_review_date => p_next_review_date,
258 p_group_code => p_group_code,
259 p_priority_code => p_priority_code,
260 p_appraise_flag => p_appraise_flag,
261 p_verified_flag => p_verified_flag,
262
263 p_target_value => p_target_value,
264 p_actual_value => p_actual_value,
265 p_weighting_percent => p_weighting_percent,
266 p_complete_percent => p_complete_percent,
267 p_uom_code => p_uom_code,
268
269 p_measurement_style_code => p_measurement_style_code,
270 p_measure_name => p_measure_name,
271 p_measure_type_code => p_measure_type_code,
272 p_measure_comments => p_measure_comments ,
273 p_sharing_access_code => p_sharing_access_code,
274
275 p_weighting_over_100_warning => l_weighting_over_100_warning,
276 p_weighting_appraisal_warning => l_weighting_appraisal_warning,
277
278 p_objective_id => l_objective_id,
279 p_object_version_number => l_object_version_number
280 );
281 --
282 hr_utility.set_location(l_proc, 8);
283 --
284 begin
285 --
286 -- Start of API User Hook for the after hook of create_objective
287 --
288 hr_objectives_bk1.create_objective_a
289 (
290 p_effective_date => l_effective_date,
291 p_business_group_id => p_business_group_id,
292 p_name => p_name,
293 p_start_date => l_start_date,
294 p_owning_person_id => p_owning_person_id,
295 p_target_date => l_target_date,
296 p_achievement_date => l_achievement_date,
297 p_detail => p_detail,
298 p_comments => p_comments,
299 p_success_criteria => p_success_criteria,
300 p_appraisal_id => p_appraisal_id,
301 p_attribute_category => p_attribute_category,
302 p_attribute1 => p_attribute1,
303 p_attribute2 => p_attribute2,
304 p_attribute3 => p_attribute3,
305 p_attribute4 => p_attribute4,
306 p_attribute5 => p_attribute5,
307 p_attribute6 => p_attribute6,
308 p_attribute7 => p_attribute7,
309 p_attribute8 => p_attribute8,
310 p_attribute9 => p_attribute9,
311 p_attribute10 => p_attribute10,
312 p_attribute11 => p_attribute11,
313 p_attribute12 => p_attribute12,
314 p_attribute13 => p_attribute13,
315 p_attribute14 => p_attribute14,
316 p_attribute15 => p_attribute15,
317 p_attribute16 => p_attribute16,
318 p_attribute17 => p_attribute17,
319 p_attribute18 => p_attribute18,
320 p_attribute19 => p_attribute19,
321 p_attribute20 => p_attribute20,
322
323 p_attribute21 => p_attribute21,
324 p_attribute22 => p_attribute22,
325 p_attribute23 => p_attribute23,
326 p_attribute24 => p_attribute24,
327 p_attribute25 => p_attribute25,
328 p_attribute26 => p_attribute26,
329 p_attribute27 => p_attribute27,
330 p_attribute28 => p_attribute28,
331 p_attribute29 => p_attribute29,
332 p_attribute30 => p_attribute30,
333
334 p_scorecard_id => p_scorecard_id,
335 p_copied_from_library_id => p_copied_from_library_id,
336 p_copied_from_objective_id => p_copied_from_objective_id,
337 p_aligned_with_objective_id => p_aligned_with_objective_id,
338
339 p_next_review_date => p_next_review_date,
340 p_group_code => p_group_code,
341 p_priority_code => p_priority_code,
342 p_appraise_flag => p_appraise_flag,
343 p_verified_flag => p_verified_flag,
344
345 p_target_value => p_target_value,
346 p_actual_value => p_actual_value,
347 p_weighting_percent => p_weighting_percent,
348 p_complete_percent => p_complete_percent,
349 p_uom_code => p_uom_code,
350
351 p_measurement_style_code => p_measurement_style_code,
352 p_measure_name => p_measure_name,
353 p_measure_type_code => p_measure_type_code,
354 p_measure_comments => p_measure_comments ,
355 p_sharing_access_code => p_sharing_access_code,
356
357 p_weighting_over_100_warning => l_weighting_over_100_warning,
358 p_weighting_appraisal_warning => l_weighting_appraisal_warning,
359
360 p_objective_id => l_objective_id,
361 p_object_version_number => l_object_version_number
362 );
363 exception
364 when hr_api.cannot_find_prog_unit then
365 hr_api.cannot_find_prog_unit_error
366 (p_module_name => 'CREATE_OBJECTIVE'
367 ,p_hook_type => 'AP'
368 );
369 --
370 -- End of API User Hook for the after hook of create_objective
371 --
372 end;
373 --
374 -- When in validation only mode raise the Validate_Enabled exception
375 --
376 if p_validate then
377 raise hr_api.validate_enabled;
378 end if;
379 --
380 -- Set all output arguments
381 --
382 p_objective_id := l_objective_id;
383 p_object_version_number := l_object_version_number;
384 p_weighting_over_100_warning := l_weighting_over_100_warning;
385 p_weighting_appraisal_warning := l_weighting_appraisal_warning;
386 --
387 hr_utility.set_location(' Leaving:'||l_proc, 11);
388 exception
389 when hr_api.validate_enabled then
390 --
391 -- As the Validate_Enabled exception has been raised
392 -- we must rollback to the savepoint
393 --
394 ROLLBACK TO create_objective;
395 --
396 -- Only set output warning arguments
397 -- (Any key or derived arguments must be set to null
398 -- when validation only mode is being used.)
399 --
400 p_objective_id := null;
401 p_object_version_number := null;
402 p_weighting_over_100_warning := l_weighting_over_100_warning;
403 p_weighting_appraisal_warning := l_weighting_appraisal_warning;
404 --
405 hr_utility.set_location(' Leaving:'||l_proc, 12);
406 --
407 when others then
408 --
409 -- A validation or unexpected error has occurred
410 --
411 -- Added as part of the fix to bug 632479
412 --
413 ROLLBACK TO create_objective;
414 --
415 -- set in out parameters and set out parameters
416 --
417 p_objective_id := null;
418 p_object_version_number := null;
419 p_weighting_over_100_warning := null;
420 p_weighting_appraisal_warning := null;
421 --
422 raise;
423 --
424 end create_objective;
425 --
426 -- ---------------------------------------------------------------------------
427 -- |-------------------------< update_objective >-----------------------------|
428 -- ---------------------------------------------------------------------------
429 --
430 procedure update_objective
431 (p_validate in boolean default false,
432 p_effective_date in date,
433 p_objective_id in number,
434 p_object_version_number in out nocopy number,
435 p_name in varchar2 default hr_api.g_varchar2,
436 p_target_date in date default hr_api.g_date,
437 p_start_date in date default hr_api.g_date,
438 p_achievement_date in date default hr_api.g_date,
439 p_detail in varchar2 default hr_api.g_varchar2,
440 p_comments in varchar2 default hr_api.g_varchar2,
441 p_success_criteria in varchar2 default hr_api.g_varchar2,
442 p_attribute_category in varchar2 default hr_api.g_varchar2,
443 p_attribute1 in varchar2 default hr_api.g_varchar2,
444 p_attribute2 in varchar2 default hr_api.g_varchar2,
445 p_attribute3 in varchar2 default hr_api.g_varchar2,
446 p_attribute4 in varchar2 default hr_api.g_varchar2,
447 p_attribute5 in varchar2 default hr_api.g_varchar2,
448 p_attribute6 in varchar2 default hr_api.g_varchar2,
449 p_attribute7 in varchar2 default hr_api.g_varchar2,
450 p_attribute8 in varchar2 default hr_api.g_varchar2,
451 p_attribute9 in varchar2 default hr_api.g_varchar2,
452 p_attribute10 in varchar2 default hr_api.g_varchar2,
453 p_attribute11 in varchar2 default hr_api.g_varchar2,
454 p_attribute12 in varchar2 default hr_api.g_varchar2,
455 p_attribute13 in varchar2 default hr_api.g_varchar2,
456 p_attribute14 in varchar2 default hr_api.g_varchar2,
457 p_attribute15 in varchar2 default hr_api.g_varchar2,
458 p_attribute16 in varchar2 default hr_api.g_varchar2,
459 p_attribute17 in varchar2 default hr_api.g_varchar2,
460 p_attribute18 in varchar2 default hr_api.g_varchar2,
461 p_attribute19 in varchar2 default hr_api.g_varchar2,
462 p_attribute20 in varchar2 default hr_api.g_varchar2,
463
464 p_attribute21 in varchar2 default hr_api.g_varchar2,
465 p_attribute22 in varchar2 default hr_api.g_varchar2,
466 p_attribute23 in varchar2 default hr_api.g_varchar2,
467 p_attribute24 in varchar2 default hr_api.g_varchar2,
468 p_attribute25 in varchar2 default hr_api.g_varchar2,
469 p_attribute26 in varchar2 default hr_api.g_varchar2,
470 p_attribute27 in varchar2 default hr_api.g_varchar2,
471 p_attribute28 in varchar2 default hr_api.g_varchar2,
472 p_attribute29 in varchar2 default hr_api.g_varchar2,
473 p_attribute30 in varchar2 default hr_api.g_varchar2,
474
475 p_scorecard_id in number default hr_api.g_number,
476 p_copied_from_library_id in number default hr_api.g_number,
477 p_copied_from_objective_id in number default hr_api.g_number,
478 p_aligned_with_objective_id in number default hr_api.g_number,
479
480 p_next_review_date in date default hr_api.g_date,
481 p_group_code in varchar2 default hr_api.g_varchar2,
482 p_priority_code in varchar2 default hr_api.g_varchar2,
483 p_appraise_flag in varchar2 default hr_api.g_varchar2,
484 p_verified_flag in varchar2 default hr_api.g_varchar2,
485
486 p_target_value in number default hr_api.g_number,
487 p_actual_value in number default hr_api.g_number,
488 p_weighting_percent in number default hr_api.g_number,
489 p_complete_percent in number default hr_api.g_number,
490 p_uom_code in varchar2 default hr_api.g_varchar2,
491
492 p_measurement_style_code in varchar2 default hr_api.g_varchar2,
493 p_measure_name in varchar2 default hr_api.g_varchar2,
494 p_measure_type_code in varchar2 default hr_api.g_varchar2,
495 p_measure_comments in varchar2 default hr_api.g_varchar2,
496 p_sharing_access_code in varchar2 default hr_api.g_varchar2,
497
498 p_weighting_over_100_warning out nocopy boolean,
499 p_weighting_appraisal_warning out nocopy boolean,
500 p_appraisal_id in number default hr_api.g_number
501
502 ) is
503 --
504 -- Declare cursors and local variables
505 --
506 l_proc varchar2(72) := g_package||'update_objective';
507 l_object_version_number per_objectives.object_version_number%TYPE;
508 l_ovn per_objectives.object_version_number%TYPE := p_object_version_number;
509 l_effective_date date;
510 l_start_date per_objectives.start_date%TYPE;
511 l_target_date per_objectives.target_date%TYPE;
512 l_achievement_date per_objectives.achievement_date%TYPE;
513 l_weighting_over_100_warning boolean := false;
514 l_weighting_appraisal_warning boolean := false;
515 --
516 begin
517 hr_utility.set_location('Entering:'|| l_proc, 5);
518 --
519 -- Issue a savepoint
520 --
521 savepoint update_objective;
522 --
523 -- Process Logic
524 --
525 -- Initialise local variables as appropriate
526 --
527 l_object_version_number := p_object_version_number;
528 --
529 -- Truncate the time portion from all IN date
530 --
531 l_effective_date := trunc(p_effective_date);
532 l_start_date := trunc(p_start_date);
533 l_target_date := trunc(p_target_date);
534 l_achievement_date := trunc(p_achievement_date);
535 --
536 begin
537 --
538 -- Start of API User Hook for the before hook of update_objective
539 --
540 hr_objectives_bk2.update_objective_b
541 (
542 p_effective_date => l_effective_date,
543 p_objective_id => p_objective_id,
544 p_object_version_number => p_object_version_number,
545 p_name => p_name,
546 p_target_date => l_target_date,
547 p_start_date => l_start_date,
548 p_achievement_date => l_achievement_date,
549 p_detail => p_detail,
550 p_comments => p_comments,
551 p_success_criteria => p_success_criteria,
552 p_attribute_category => p_attribute_category,
553 p_attribute1 => p_attribute1,
554 p_attribute2 => p_attribute2,
555 p_attribute3 => p_attribute3,
556 p_attribute4 => p_attribute4,
557 p_attribute5 => p_attribute5,
558 p_attribute6 => p_attribute6,
559 p_attribute7 => p_attribute7,
560 p_attribute8 => p_attribute8,
561 p_attribute9 => p_attribute9,
562 p_attribute10 => p_attribute10,
563 p_attribute11 => p_attribute11,
564 p_attribute12 => p_attribute12,
565 p_attribute13 => p_attribute13,
566 p_attribute14 => p_attribute14,
567 p_attribute15 => p_attribute15,
568 p_attribute16 => p_attribute16,
569 p_attribute17 => p_attribute17,
570 p_attribute18 => p_attribute18,
571 p_attribute19 => p_attribute19,
572 p_attribute20 => p_attribute20,
573
574 p_attribute21 => p_attribute21,
575 p_attribute22 => p_attribute22,
576 p_attribute23 => p_attribute23,
577 p_attribute24 => p_attribute24,
578 p_attribute25 => p_attribute25,
579 p_attribute26 => p_attribute26,
580 p_attribute27 => p_attribute27,
581 p_attribute28 => p_attribute28,
582 p_attribute29 => p_attribute29,
583 p_attribute30 => p_attribute30,
584
585 p_scorecard_id => p_scorecard_id,
586 p_copied_from_library_id => p_copied_from_library_id,
587 p_copied_from_objective_id => p_copied_from_objective_id,
588 p_aligned_with_objective_id => p_aligned_with_objective_id,
589
590 p_next_review_date => p_next_review_date,
591 p_group_code => p_group_code,
592 p_priority_code => p_priority_code,
593 p_appraise_flag => p_appraise_flag,
594 p_verified_flag => p_verified_flag,
595
596 p_target_value => p_target_value,
597 p_actual_value => p_actual_value,
598 p_weighting_percent => p_weighting_percent,
599 p_complete_percent => p_complete_percent,
600 p_uom_code => p_uom_code,
601
602 p_measurement_style_code => p_measurement_style_code,
603 p_measure_name => p_measure_name,
604 p_measure_type_code => p_measure_type_code,
605 p_measure_comments => p_measure_comments ,
606 p_sharing_access_code => p_sharing_access_code ,
607 p_appraisal_id => p_appraisal_id
608
609 );
610 --
611 exception
612 when hr_api.cannot_find_prog_unit then
613 hr_api.cannot_find_prog_unit_error
614 (p_module_name => 'UPDATE_OBJECTIVE'
615 ,p_hook_type => 'BP'
616 );
617 --
618 -- End of API User Hook for the before hook of update_objective
619 --
620 end;
621 --
622 hr_utility.set_location(l_proc, 6);
623 --
624 -- Validation in addition to Table Handlers
625 --
626 hr_utility.set_location(l_proc, 7);
627 --
628 per_obj_upd.upd
629 (p_effective_date => l_effective_date,
630 p_objective_id => p_objective_id,
631 p_object_version_number => l_object_version_number,
632 p_name => p_name,
633 p_target_date => l_target_date,
634 p_start_date => l_start_date,
635 p_achievement_date => l_achievement_date,
636 p_detail => p_detail,
637 p_comments => p_comments,
638 p_success_criteria => p_success_criteria,
639 p_attribute_category => p_attribute_category,
640 p_attribute1 => p_attribute1,
641 p_attribute2 => p_attribute2,
642 p_attribute3 => p_attribute3,
643 p_attribute4 => p_attribute4,
644 p_attribute5 => p_attribute5,
645 p_attribute6 => p_attribute6,
646 p_attribute7 => p_attribute7,
647 p_attribute8 => p_attribute8,
648 p_attribute9 => p_attribute9,
649 p_attribute10 => p_attribute10,
650 p_attribute11 => p_attribute11,
651 p_attribute12 => p_attribute12,
652 p_attribute13 => p_attribute13,
653 p_attribute14 => p_attribute14,
654 p_attribute15 => p_attribute15,
655 p_attribute16 => p_attribute16,
656 p_attribute17 => p_attribute17,
657 p_attribute18 => p_attribute18,
658 p_attribute19 => p_attribute19,
659 p_attribute20 => p_attribute20,
660
661 p_attribute21 => p_attribute21,
662 p_attribute22 => p_attribute22,
663 p_attribute23 => p_attribute23,
664 p_attribute24 => p_attribute24,
665 p_attribute25 => p_attribute25,
666 p_attribute26 => p_attribute26,
667 p_attribute27 => p_attribute27,
668 p_attribute28 => p_attribute28,
669 p_attribute29 => p_attribute29,
670 p_attribute30 => p_attribute30,
671
672 p_scorecard_id => p_scorecard_id,
673 p_copied_from_library_id => p_copied_from_library_id,
674 p_copied_from_objective_id => p_copied_from_objective_id,
675 p_aligned_with_objective_id => p_aligned_with_objective_id,
676
677 p_next_review_date => p_next_review_date,
678 p_group_code => p_group_code,
679 p_priority_code => p_priority_code,
680 p_appraise_flag => p_appraise_flag,
681 p_verified_flag => p_verified_flag,
682
683 p_target_value => p_target_value,
684 p_actual_value => p_actual_value,
685 p_weighting_percent => p_weighting_percent,
686 p_complete_percent => p_complete_percent,
687 p_uom_code => p_uom_code,
688
689 p_measurement_style_code => p_measurement_style_code,
690 p_measure_name => p_measure_name,
691 p_measure_type_code => p_measure_type_code,
692 p_measure_comments => p_measure_comments ,
693 p_sharing_access_code => p_sharing_access_code,
694
695 p_weighting_over_100_warning => l_weighting_over_100_warning,
696 p_weighting_appraisal_warning => l_weighting_appraisal_warning,
697 p_appraisal_id => p_appraisal_id
698
699 );
700 --
701 --
702 hr_utility.set_location(l_proc, 8);
703 --
704 begin
705 --
706 -- Start of API User Hook for the after hook of update_objective
707 --
708 hr_objectives_bk2.update_objective_a
709 (p_effective_date => l_effective_date,
710 p_objective_id => p_objective_id,
711 p_object_version_number => l_object_version_number,
712 p_name => p_name,
713 p_target_date => l_target_date,
714 p_start_date => l_start_date,
715 p_achievement_date => l_achievement_date,
716 p_detail => p_detail,
717 p_comments => p_comments,
718 p_success_criteria => p_success_criteria,
719 p_attribute_category => p_attribute_category,
720 p_attribute1 => p_attribute1,
721 p_attribute2 => p_attribute2,
722 p_attribute3 => p_attribute3,
723 p_attribute4 => p_attribute4,
724 p_attribute5 => p_attribute5,
725 p_attribute6 => p_attribute6,
726 p_attribute7 => p_attribute7,
727 p_attribute8 => p_attribute8,
728 p_attribute9 => p_attribute9,
729 p_attribute10 => p_attribute10,
730 p_attribute11 => p_attribute11,
731 p_attribute12 => p_attribute12,
732 p_attribute13 => p_attribute13,
733 p_attribute14 => p_attribute14,
734 p_attribute15 => p_attribute15,
735 p_attribute16 => p_attribute16,
736 p_attribute17 => p_attribute17,
737 p_attribute18 => p_attribute18,
738 p_attribute19 => p_attribute19,
739 p_attribute20 => p_attribute20,
740
741 p_attribute21 => p_attribute21,
742 p_attribute22 => p_attribute22,
743 p_attribute23 => p_attribute23,
744 p_attribute24 => p_attribute24,
745 p_attribute25 => p_attribute25,
746 p_attribute26 => p_attribute26,
747 p_attribute27 => p_attribute27,
748 p_attribute28 => p_attribute28,
749 p_attribute29 => p_attribute29,
750 p_attribute30 => p_attribute30,
751
752 p_scorecard_id => p_scorecard_id,
753 p_copied_from_library_id => p_copied_from_library_id,
754 p_copied_from_objective_id => p_copied_from_objective_id,
755 p_aligned_with_objective_id => p_aligned_with_objective_id,
756
757 p_next_review_date => p_next_review_date,
758 p_group_code => p_group_code,
759 p_priority_code => p_priority_code,
760 p_appraise_flag => p_appraise_flag,
761 p_verified_flag => p_verified_flag,
762
763 p_target_value => p_target_value,
764 p_actual_value => p_actual_value,
765 p_weighting_percent => p_weighting_percent,
766 p_complete_percent => p_complete_percent,
767 p_uom_code => p_uom_code,
768
769 p_measurement_style_code => p_measurement_style_code,
770 p_measure_name => p_measure_name,
771 p_measure_type_code => p_measure_type_code,
772 p_measure_comments => p_measure_comments ,
773 p_sharing_access_code => p_sharing_access_code,
774
775 p_weighting_over_100_warning => l_weighting_over_100_warning,
776 p_weighting_appraisal_warning => l_weighting_appraisal_warning,
777 p_appraisal_id => p_appraisal_id
778
779 );
780 --
781 exception
782 when hr_api.cannot_find_prog_unit then
783 hr_api.cannot_find_prog_unit_error
784 (p_module_name => 'UPDATE_OBJECTIVE'
785 ,p_hook_type => 'AP'
786 );
787 --
788 -- End of API User Hook for the after hook of update_objective
789 --
790 end;
791 --
792 -- When in validation only mode raise the Validate_Enabled exception
793 --
794 if p_validate then
795 raise hr_api.validate_enabled;
796 end if;
797 --
798 -- Set all output arguments. l_object_version_number now has the new
799 -- object version number as the update was successful
800 --
801 p_object_version_number := l_object_version_number;
802 p_weighting_over_100_warning := l_weighting_over_100_warning;
803 p_weighting_appraisal_warning := l_weighting_appraisal_warning;
804 --
805 hr_utility.set_location(' Leaving:'||l_proc, 11);
806 --
807 exception
808 --
809 when hr_api.validate_enabled then
810 --
811 -- As the Validate_Enabled exception has been raised
812 -- we must rollback to the savepoint
813 --
814 ROLLBACK TO update_objective;
815 --
816 -- Only set output warning arguments and in out arguments back
817 -- to their IN value
818 -- (Any key or derived arguments must be set to null
819 -- when validation only mode is being used.)
820 --
821 hr_utility.set_location(' Leaving:'||l_proc, 12);
822 --
823 when others then
824 --
825 -- A validation or unexpected error has occured
826 --
827 ROLLBACK TO update_objective;
828 --
829 -- set in out parameters and set out parameters
830 --
831 p_object_version_number := l_ovn;
832 p_weighting_over_100_warning := l_weighting_over_100_warning;
833 p_weighting_appraisal_warning := l_weighting_appraisal_warning;
834 --
835 raise;
836 --
837 end update_objective;
838 --
839 -- ---------------------------------------------------------------------------
840 -- |-------------------------< delete_objective> ----------------------------|
841 -- ---------------------------------------------------------------------------
842 --
843 procedure delete_objective
844 (p_validate in boolean default false,
845 p_objective_id in number,
846 p_object_version_number in number
847 ) is
848 --
849 -- Declare cursors and local variables
850 --
851
852 l_objpr per_prt_bus.r_objpr_rec;
853
854 --
855 --
856 l_proc varchar2(72) := g_package||'delete_objective';
857 begin
858 hr_utility.set_location('Entering:'|| l_proc, 5);
859 --
860 -- Issue a savepoint
861 --
862 savepoint delete_objective;
863 --
864 begin
865 --
866 -- Start of API User Hook for the before hook delete_objective
867 --
868 hr_objectives_bk3.delete_objective_b
869 (p_objective_id => p_objective_id,
870 p_object_version_number => p_object_version_number
871 );
872
873 exception
874 when hr_api.cannot_find_prog_unit then
875 hr_api.cannot_find_prog_unit_error
876 (p_module_name => 'DELETE_OBJECTIVE',
877 p_hook_type => 'BP'
878 );
879 end;
880 --
881 -- End of API User Hook for the before hook of delete_objective
882 --
883 hr_utility.set_location(l_proc, 6);
884 --
885 -- Validation in addition to Table Handlers
886 --
887 hr_utility.set_location(l_proc, 7);
888 --
889 -- Process Logic
890 --
891 -- flemonni added cascade delete of obj performance rating
892 --
893 -- get an associated pr for the given obj id
894 -- supply this to the pr api (p_validate = TRUE)
895 -- delete it so that obj delete succeeds
896 -- allow this rollback to undo the delete if necessary
897 --
898 l_objpr :=
899 per_prt_bus.Get_PR_Data
900 ( p_objective_id => p_objective_ID
901 );
902 IF l_objpr.performance_rating_id IS NOT NULL THEN
903 -- delete the performance rating
904 hr_performance_ratings_api.delete_performance_rating
905 ( p_validate => FALSE
906 , p_performance_rating_id => l_objpr.performance_rating_id
907 , p_object_version_number => l_objpr.object_version_number
908 );
909 ELSE
910 -- objective does not have a performance rating
911 NULL;
912 END IF;
913 --
914 -- now delete the objective itself
915 --
916 per_obj_del.del
917 (p_objective_id => p_objective_id
918 ,p_object_version_number => p_object_version_number
919 );
920 --
921 hr_utility.set_location(l_proc, 8);
922 --
923 begin
924 --
925 -- Start of API User Hook for the after hook delete_objective
926 --
927 hr_objectives_bk3.delete_objective_a
928 (p_objective_id => p_objective_id,
929 p_object_version_number => p_object_version_number
930 );
931 exception
932 when hr_api.cannot_find_prog_unit then
933 hr_api.cannot_find_prog_unit_error
934 (p_module_name => 'DELETE_OBJECTIVE',
935 p_hook_type => 'AP'
936 );
937 end;
938 --
939 -- End of API User Hook for the after hook delete_objective
940 --
941 -- When in validation only mode raise the Validate_Enabled exception
942 --
943 if p_validate then
944 raise hr_api.validate_enabled;
945 end if;
946 --
947 hr_utility.set_location(' Leaving:'||l_proc, 11);
948 exception
949 when hr_api.validate_enabled then
950 --
951 -- As the Validate_Enabled exception has been raised
952 -- we must rollback to the savepoint
953 --
954 ROLLBACK TO delete_objective;
955 --
956 -- Only set output warning arguments
957 -- (Any key or derived arguments must be set to null
958 -- when validation only mode is being used.)
959 --
960 hr_utility.set_location(' Leaving:'||l_proc, 12);
961 --
962 when others then
963 --
964 -- A validation or unexpected error has occured
965 --
966 ROLLBACK TO delete_objective;
967 --
968 raise;
969 --
970 end delete_objective;
971 --
972 end hr_objectives_api;