DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_APR_SHD

Source


1 Package Body per_apr_shd as
2 /* $Header: peaprrhi.pkb 120.29.12020000.2 2012/07/05 00:47:21 amnaraya ship $ */
3 
4 -- ---------------------------------------------------------------------------+
5 -- |                     Private Global Definitions                           |
6 -- ---------------------------------------------------------------------------+
7 
8 g_package  varchar2(33)	:= '  per_apr_shd.';  -- Global package name
9 
13 Procedure constraint_error
10 -- ---------------------------------------------------------------------------+
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ---------------------------------------------------------------------------+
14             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
15 
16   l_proc 	varchar2(72) := g_package||'constraint_error';
17 
18 Begin
19   hr_utility.set_location('Entering:'||l_proc, 5);
20 
21   If (p_constraint_name = 'PER_APPRAISALS_FK1') Then
22     hr_utility.set_message(801, 'HR_7208_API_BUS_GRP_INVALID');
23     hr_utility.set_message_token('PROCEDURE', l_proc);
24     hr_utility.set_message_token('STEP','5');
25     hr_utility.raise_error;
26   ElsIf (p_constraint_name = 'PER_APPRAISALS_FK2') Then
27     hr_utility.set_message(801,'HR_52246_APR_TEMP_NOT_EXIST');
28     hr_utility.set_message_token('PROCEDURE', l_proc);
29     hr_utility.set_message_token('STEP','10');
30     hr_utility.raise_error;
31   ElsIf (p_constraint_name = 'PER_APPRAISALS_FK3') Then
32     hr_utility.set_message(801,'HR_51898_APR_NO_SUCH_LEVEL');
33     hr_utility.set_message_token('PROCEDURE', l_proc);
34     hr_utility.set_message_token('STEP','15');
35     hr_utility.raise_error;
36   ElsIf (p_constraint_name = 'PER_APPRAISALS_PK') Then
37     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38     hr_utility.set_message_token('PROCEDURE', l_proc);
39     hr_utility.set_message_token('STEP','20');
40     hr_utility.raise_error;
41   Else
42     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
43     hr_utility.set_message_token('PROCEDURE', l_proc);
44     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
45     hr_utility.raise_error;
46   End If;
47 
48   hr_utility.set_location(' Leaving:'||l_proc, 10);
49 End constraint_error;
50 
51 -- ---------------------------------------------------------------------------+
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ---------------------------------------------------------------------------+
54 Function api_updating
55   (
56   p_appraisal_id                       in number,
57   p_object_version_number              in number
58   )      Return Boolean Is
59 
60 
61   -- Cursor selects the 'current' row from the HR Schema
62 
63   Cursor C_Sel1 is
64     select
65 	appraisal_id,
66 	business_group_id,
67 	object_version_number,
68 	appraisal_template_id,
69 	appraisee_person_id,
70 	appraiser_person_id,
71 	appraisal_date,
72 	appraisal_period_end_date,
73 	appraisal_period_start_date,
74 	type,
75 	next_appraisal_date,
76 	status,
77 	group_date,
78 	group_initiator_id,
79 	comments,
80 	overall_performance_level_id,
81 	open,
82 	attribute_category,
83 	attribute1,
84 	attribute2,
85 	attribute3,
86 	attribute4,
87 	attribute5,
88 	attribute6,
89 	attribute7,
90 	attribute8,
91 	attribute9,
92 	attribute10,
93 	attribute11,
94 	attribute12,
95 	attribute13,
96 	attribute14,
97 	attribute15,
98 	attribute16,
99 	attribute17,
100 	attribute18,
101 	attribute19,
102 	attribute20,
103 	system_type,
104 	system_params,
105 	appraisee_access,
106 	main_appraiser_id,
107 	assignment_id,
108 	assignment_start_date,
109 	assignment_business_group_id,
110 	assignment_organization_id  ,
111 	assignment_job_id           ,
112 	assignment_position_id      ,
113 	assignment_grade_id ,
114 	appraisal_system_status,
115 	potential_readiness_level,
116 	potential_short_term_workopp,
117 	potential_long_term_workopp,
118 	potential_details,
119 	event_id,
120         show_competency_ratings,
121         show_objective_ratings,
122         show_questionnaire_info,
123         show_participant_details,
124         show_participant_ratings,
125         show_participant_names,
126         show_overall_ratings,
127         show_overall_comments,
128         update_appraisal,
129         provide_overall_feedback,
130         appraisee_comments,
131         plan_id,
132         offline_status,
133         retention_potential ,
134         show_participant_comments -- 8651478 bug fix
135     from	per_appraisals
136     where	appraisal_id = p_appraisal_id;
137 
138   l_proc	varchar2(72)	:= g_package||'api_updating';
139   l_fct_ret	boolean;
140 
141 Begin
142   hr_utility.set_location('Entering:'||l_proc, 5);
143 
144   If (
145 	p_appraisal_id is null and
146 	p_object_version_number is null
147      ) Then
148 
149     -- One of the primary key arguments is null therefore we must
150     -- set the returning function value to false
151 
152     l_fct_ret := false;
153   Else
154     If (
155 	p_appraisal_id = g_old_rec.appraisal_id and
156 	p_object_version_number = g_old_rec.object_version_number
157        ) Then
158       hr_utility.set_location(l_proc, 10);
159 
160       -- The g_old_rec is current therefore we must
161       -- set the returning function to true
162 
163       l_fct_ret := true;
164     Else
165 
166       -- Select the current row into g_old_rec
167 
168       Open C_Sel1;
172 
169       Fetch C_Sel1 Into g_old_rec;
170       If C_Sel1%notfound Then
171         Close C_Sel1;
173         -- The primary key is invalid therefore we must error
174 
175         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
176         hr_utility.raise_error;
177       End If;
178       Close C_Sel1;
179       If (p_object_version_number <> g_old_rec.object_version_number) Then
180         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
181         hr_utility.raise_error;
182       End If;
183       hr_utility.set_location(l_proc, 15);
184       l_fct_ret := true;
185     End If;
186   End If;
187   hr_utility.set_location(' Leaving:'||l_proc, 20);
188   Return (l_fct_ret);
189 
190 End api_updating;
191 
192 -- ---------------------------------------------------------------------------+
193 -- |---------------------------------< lck >----------------------------------|
194 -- ---------------------------------------------------------------------------+
195 Procedure lck
196   (
197   p_appraisal_id                       in number,
198   p_object_version_number              in number
199   ) is
200 
201 -- Cursor selects the 'current' row from the HR Schema
202 
203   Cursor C_Sel1 is
204   select
205 	appraisal_id,
206 	business_group_id,
207 	object_version_number,
208 	appraisal_template_id,
209 	appraisee_person_id,
210 	appraiser_person_id,
211 	appraisal_date,
212 	appraisal_period_end_date,
213 	appraisal_period_start_date,
214 	type,
215 	next_appraisal_date,
216 	status,
217 	group_date,
218 	group_initiator_id,
219 	comments,
220 	overall_performance_level_id,
221 	open,
222 	attribute_category,
223 	attribute1,
224 	attribute2,
225 	attribute3,
226 	attribute4,
227 	attribute5,
228 	attribute6,
229 	attribute7,
230 	attribute8,
231 	attribute9,
232 	attribute10,
233 	attribute11,
234 	attribute12,
235 	attribute13,
236 	attribute14,
237 	attribute15,
238 	attribute16,
239 	attribute17,
240 	attribute18,
241 	attribute19,
242 	attribute20,
243 	system_type,
244 	system_params,
245 	appraisee_access,
246 	main_appraiser_id,
247 	assignment_id,
248 	assignment_start_date,
249 	assignment_business_group_id,
250 	assignment_organization_id  ,
251 	assignment_job_id           ,
252 	assignment_position_id      ,
253 	assignment_grade_id ,
254 	appraisal_system_status,
255 	potential_readiness_level ,
256 	potential_short_term_workopp ,
257 	potential_long_term_workopp ,
258 	potential_details ,
259         event_id,
260         show_competency_ratings,
261         show_objective_ratings,
262         show_questionnaire_info,
263         show_participant_details,
264         show_participant_ratings,
265         show_participant_names,
266         show_overall_ratings,
267         show_overall_comments,
268         update_appraisal,
269         provide_overall_feedback,
270         appraisee_comments,
271         plan_id,
272         offline_status,
273        retention_potential ,
274  show_participant_comments -- 8651478 bug fix
275     from	per_appraisals
276     where	appraisal_id = p_appraisal_id
277     for	update nowait;
278 
279   l_proc	varchar2(72) := g_package||'lck';
280 
281 Begin
282   hr_utility.set_location('Entering:'||l_proc, 5);
283 
284   -- Add any mandatory argument checking here:
285   -- Example:
286   -- hr_api.mandatory_arg_error
287   --   (p_api_name       => l_proc,
288   --    p_argument       => 'object_version_number',
289   --    p_argument_value => p_object_version_number);
290 
291   Open  C_Sel1;
292   Fetch C_Sel1 Into g_old_rec;
293   If C_Sel1%notfound then
294     Close C_Sel1;
295 
296     -- The primary key is invalid therefore we must error
297 
298     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
299     hr_utility.raise_error;
300   End If;
301   Close C_Sel1;
302   If (p_object_version_number <> g_old_rec.object_version_number) Then
303         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
304         hr_utility.raise_error;
305       End If;
306 
307   hr_utility.set_location(' Leaving:'||l_proc, 10);
308 
309 -- We need to trap the ORA LOCK exception
310 
311 Exception
312   When HR_Api.Object_Locked then
313 
314     -- The object is locked therefore we need to supply a meaningful
315     -- error message.
316 
317     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
318     hr_utility.set_message_token('TABLE_NAME', 'per_appraisals');
319     hr_utility.raise_error;
320 End lck;
321 
322 -- ---------------------------------------------------------------------------+
323 -- |-----------------------------< convert_args >-----------------------------|
324 -- ---------------------------------------------------------------------------+
325 Function convert_args
326 	(
327 	p_appraisal_id                  in number,
328 	p_business_group_id             in number,
329 	p_object_version_number         in number,
330 	p_appraisal_template_id         in number,
331 	p_appraisee_person_id           in number,
332 	p_appraiser_person_id           in number,
333 	p_appraisal_date                in date,
334 	p_appraisal_period_end_date     in date,
335 	p_appraisal_period_start_date   in date,
336 	p_type                          in varchar2,
340 	p_group_initiator_id		in number,
337 	p_next_appraisal_date           in date,
338 	p_status                        in varchar2,
339 	p_group_date			in date,
341 	p_comments                      in varchar2,
342 	p_overall_performance_level_id  in number,
343 	p_open                          in varchar2,
344 	p_attribute_category            in varchar2,
345 	p_attribute1                    in varchar2,
346 	p_attribute2                    in varchar2,
347 	p_attribute3                    in varchar2,
348 	p_attribute4                    in varchar2,
349 	p_attribute5                    in varchar2,
350 	p_attribute6                    in varchar2,
351 	p_attribute7                    in varchar2,
352 	p_attribute8                    in varchar2,
353 	p_attribute9                    in varchar2,
354 	p_attribute10                   in varchar2,
355 	p_attribute11                   in varchar2,
356 	p_attribute12                   in varchar2,
357 	p_attribute13                   in varchar2,
358 	p_attribute14                   in varchar2,
359 	p_attribute15                   in varchar2,
360 	p_attribute16                   in varchar2,
361 	p_attribute17                   in varchar2,
362 	p_attribute18                   in varchar2,
363 	p_attribute19                   in varchar2,
364 	p_attribute20                   in varchar2,
365 	p_system_type                   in varchar2,
366 	p_system_params                 in varchar2,
367 	p_appraisee_access              in varchar2,
368 	p_main_appraiser_id             in number,
369 	p_assignment_id                 in number,
370 	p_assignment_start_date         in date,
371 	p_asg_business_group_id         in number,
372 	p_assignment_organization_id    in number,
373 	p_assignment_job_id             in number,
374 	p_assignment_position_id        in number,
375 	p_assignment_grade_id           in number,
376 	p_appraisal_system_status       in varchar2,
377 	p_potential_readiness_level 	in varchar2,
378 	p_potential_short_term_workopp  in varchar2,
379 	p_potential_long_term_workopp   in varchar2,
380 	p_potential_details             in varchar2,
381 	p_event_id                      in number,
382         p_show_competency_ratings      in varchar2,
383         p_show_objective_ratings       in varchar2,
384         p_show_questionnaire_info      in varchar2,
385         p_show_participant_details     in varchar2,
386         p_show_participant_ratings     in varchar2,
387         p_show_participant_names       in varchar2,
388         p_show_overall_ratings         in varchar2,
389         p_show_overall_comments        in varchar2,
390         p_update_appraisal             in varchar2,
391         p_provide_overall_feedback     in varchar2,
392         p_appraisee_comments           in varchar2,
393         p_plan_id                      in number,
394         p_offline_status               in varchar2,
395        p_retention_potential     in        varchar2,
396 p_show_participant_comments     in varchar2   -- 8651478 bug fix
397 	)
398 	Return g_rec_type is
399 
400   l_rec	  g_rec_type;
401   l_proc  varchar2(72) := g_package||'convert_args';
402 
403 Begin
404 
405   hr_utility.set_location('Entering:'||l_proc, 5);
406 
407   -- Convert arguments into local l_rec structure.
408 
409   l_rec.appraisal_id                     := p_appraisal_id;
410   l_rec.business_group_id                := p_business_group_id;
411   l_rec.object_version_number            := p_object_version_number;
412   l_rec.appraisal_template_id            := p_appraisal_template_id;
413   l_rec.appraisee_person_id              := p_appraisee_person_id;
414   l_rec.appraiser_person_id              := p_appraiser_person_id;
415   l_rec.appraisal_date                   := p_appraisal_date;
416   l_rec.appraisal_period_end_date        := p_appraisal_period_end_date;
417   l_rec.appraisal_period_start_date      := p_appraisal_period_start_date;
418 
419   l_rec.assignment_business_group_id     := p_asg_business_group_id;
420   l_rec.assignment_organization_id       := p_assignment_organization_id  ;
421   l_rec.assignment_job_id                := p_assignment_job_id           ;
422   l_rec.assignment_position_id           := p_assignment_position_id      ;
423   l_rec.assignment_grade_id              := p_assignment_grade_id         ;
424 
425   l_rec.type                             := p_type;
426   l_rec.next_appraisal_date              := p_next_appraisal_date;
427   l_rec.status                           := p_status;
428   l_rec.group_date			 := p_group_date;
429   l_rec.group_initiator_id		 := p_group_initiator_id;
430   l_rec.comments                         := p_comments;
431   l_rec.overall_performance_level_id     := p_overall_performance_level_id;
432   l_rec.open                             := p_open;
433   l_rec.attribute_category               := p_attribute_category;
434   l_rec.attribute1                       := p_attribute1;
435   l_rec.attribute2                       := p_attribute2;
436   l_rec.attribute3                       := p_attribute3;
437   l_rec.attribute4                       := p_attribute4;
438   l_rec.attribute5                       := p_attribute5;
439   l_rec.attribute6                       := p_attribute6;
440   l_rec.attribute7                       := p_attribute7;
441   l_rec.attribute8                       := p_attribute8;
442   l_rec.attribute9                       := p_attribute9;
443   l_rec.attribute10                      := p_attribute10;
444   l_rec.attribute11                      := p_attribute11;
445   l_rec.attribute12                      := p_attribute12;
446   l_rec.attribute13                      := p_attribute13;
447   l_rec.attribute14                      := p_attribute14;
448   l_rec.attribute15                      := p_attribute15;
449   l_rec.attribute16                      := p_attribute16;
450   l_rec.attribute17                      := p_attribute17;
451   l_rec.attribute18                      := p_attribute18;
452   l_rec.attribute19                      := p_attribute19;
453   l_rec.attribute20                      := p_attribute20;
454   l_rec.system_type                      := p_system_type;
455   l_rec.system_params                    := p_system_params;
456   l_rec.appraisee_access                 := p_appraisee_access;
457   l_rec.main_appraiser_id                := p_main_appraiser_id;
458   l_rec.assignment_id                    := p_assignment_id;
459   l_rec.assignment_start_date            := p_assignment_start_date;
460   l_rec.assignment_business_group_id     := p_asg_business_group_id;
461   l_rec.assignment_organization_id       := p_assignment_organization_id  ;
462   l_rec.assignment_job_id                := p_assignment_job_id           ;
463   l_rec.assignment_position_id           := p_assignment_position_id      ;
464   l_rec.assignment_grade_id              := p_assignment_grade_id ;
465   l_rec.appraisal_system_status          := p_appraisal_system_status;
466   l_rec.potential_readiness_level        := p_potential_readiness_level;
467   l_rec.potential_short_term_workopp     := p_potential_short_term_workopp  ;
468   l_rec.potential_long_term_workopp      := p_potential_long_term_workopp           ;
469   l_rec.potential_details                := p_potential_details      ;
470   l_rec.event_id                         := p_event_id ;
471   l_rec.show_competency_ratings          := p_show_competency_ratings;
472   l_rec.show_objective_ratings           := p_show_objective_ratings;
473   l_rec.show_questionnaire_info          := p_show_questionnaire_info;
474   l_rec.show_participant_details         := p_show_participant_details;
475   l_rec.show_participant_ratings         := p_show_participant_ratings;
476   l_rec.show_participant_names           := p_show_participant_names;
477   l_rec.show_overall_ratings             := p_show_overall_ratings;
478   l_rec.show_overall_comments            := p_show_overall_comments;
479   l_rec.update_appraisal                 := p_update_appraisal;
480   l_rec.provide_overall_feedback         := p_provide_overall_feedback;
481   l_rec.appraisee_comments               := p_appraisee_comments;
482   l_rec.plan_id                          := p_plan_id;
483   l_rec.offline_status                   := p_offline_status;
484 l_rec.retention_potential   :=  p_retention_potential;
485   l_rec.show_participant_comments         := p_show_participant_comments;   -- 8651478 bug fix
486 
487   -- Return the plsql record structure.
488 
489   hr_utility.set_location(' Leaving:'||l_proc, 10);
490   Return(l_rec);
491 
492 End convert_args;
493 
494 end per_apr_shd;