DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_APT_SHD

Source


1 Package Body per_apt_shd as
2 /* $Header: peaptrhi.pkb 120.10.12020000.1 2012/06/29 00:43:57 appldev ship $ */
3 
4 -- ---------------------------------------------------------------------------+
5 -- |                     Private Global Definitions                           |
6 -- ---------------------------------------------------------------------------+
7 
8 g_package  varchar2(33)	:= '  per_apt_shd.';  -- Global package name
9 -- ---------------------------------------------------------------------------+
10 -- |---------------------------< constraint_error >---------------------------|
11 -- ---------------------------------------------------------------------------+
12 Procedure constraint_error
13             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
14 
15   l_proc 	varchar2(72) := g_package||'constraint_error';
16 
17 Begin
18   hr_utility.set_location('Entering:'||l_proc, 5);
19 
20   If (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_FK1') Then
21     hr_utility.set_message(801, 'HR_7208_API_BUS_GRP_INVALID');
22     hr_utility.set_message_token('PROCEDURE', l_proc);
23     hr_utility.set_message_token('STEP','5');
24     hr_utility.raise_error;
25   ElsIf (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_FK2') Then
26     hr_utility.set_message(801, 'HR_51912_APT_AST_NOT_EXIST');
27     hr_utility.set_message_token('PROCEDURE', l_proc);
28     hr_utility.set_message_token('STEP','10');
29     hr_utility.raise_error;
30   ElsIf (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_FK3') Then
31     hr_utility.set_message(801, 'HR_51928_APT_RSC_NOT_EXIST');
32     hr_utility.set_message_token('PROCEDURE', l_proc);
33     hr_utility.set_message_token('STEP','15');
34     hr_utility.raise_error;
35   ElsIf (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_FK4') Then
36     hr_utility.set_message(801, 'HR_51915_APT_QST_NOT_EXIST');
37     hr_utility.set_message_token('PROCEDURE', l_proc);
38     hr_utility.set_message_token('STEP','20');
39     hr_utility.raise_error;
40   ElsIf (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_FK5') Then
41     fnd_message.set_name(801, 'HR_6153_ALL_PROCEDURE_FAIL');
42     fnd_message.set_token('PROCEDURE', l_proc);
43     fnd_message.set_token('STEP','25');
44     fnd_message.raise_error;
45   ElsIf (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_FK6') Then
46     fnd_message.set_name(801, 'HR_6153_ALL_PROCEDURE_FAIL');
47     fnd_message.set_token('PROCEDURE', l_proc);
48     fnd_message.set_token('STEP','30');
49     fnd_message.raise_error;
50   ElsIf (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_PK') Then
51     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
52     hr_utility.set_message_token('PROCEDURE', l_proc);
53     hr_utility.set_message_token('STEP','25');
54     hr_utility.raise_error;
55   ElsIf (p_constraint_name = 'PER_APPRAISAL_TEMPLATES_UK2') Then
56     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
57     hr_utility.set_message_token('PROCEDURE', l_proc);
58     hr_utility.set_message_token('STEP','30');
59     hr_utility.raise_error;
60   Else
61     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
62     hr_utility.set_message_token('PROCEDURE', l_proc);
63     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
64     hr_utility.raise_error;
65   End If;
66 
67   hr_utility.set_location(' Leaving:'||l_proc, 10);
68 End constraint_error;
69 
70 -- ---------------------------------------------------------------------------+
71 -- |-----------------------------< api_updating >-----------------------------|
72 -- ---------------------------------------------------------------------------+
73 Function api_updating
74   (
75   p_appraisal_template_id              in number,
76   p_object_version_number              in number
77   )      Return Boolean Is
78 
79 
80   -- Cursor selects the 'current' row from the HR Schema
81 
82   Cursor C_Sel1 is
83     select
84 		appraisal_template_id,
85 	business_group_id,
86 	object_version_number,
87 	name,
88 	description,
89 	instructions,
90 	date_from,
91 	date_to,
92 	assessment_type_id,
93 	rating_scale_id,
94 	questionnaire_template_id,
95 	attribute_category,
96 	attribute1,
97 	attribute2,
98 	attribute3,
99 	attribute4,
100 	attribute5,
101 	attribute6,
102 	attribute7,
103 	attribute8,
104 	attribute9,
105 	attribute10,
106 	attribute11,
107 	attribute12,
108 	attribute13,
109 	attribute14,
110 	attribute15,
111 	attribute16,
112 	attribute17,
113 	attribute18,
114 	attribute19,
115 	attribute20,
116 	objective_asmnt_type_id,
117     ma_quest_template_id,
118     link_appr_to_learning_path,
119     final_score_formula_id,
120     update_personal_comp_profile,
121     comp_profile_source_type,
122     show_competency_ratings,
123     show_objective_ratings,
124     show_overall_ratings,
125     show_overall_comments,
126     provide_overall_feedback,
127     show_participant_details,
128     allow_add_participant,
129     show_additional_details,
130     show_participant_names,
131     show_participant_ratings,
132     available_flag,
133 	  show_questionnaire_info,
134     ma_off_template_code,
135 	  appraisee_off_template_code,
136 	  other_part_off_template_code,
137 	  part_rev_off_template_code,
138 	  part_app_off_template_code,
139                            show_participant_comments -- 8651478 bug fix
140 ,show_term_employee
141 ,show_term_contigent
142 ,disp_term_emp_period_from
143 ,show_future_term_employee
144 
145     from	per_appraisal_templates
146     where	appraisal_template_id = p_appraisal_template_id;
147 
148   l_proc	varchar2(72)	:= g_package||'api_updating';
149   l_fct_ret	boolean;
150 
151 Begin
152   hr_utility.set_location('Entering:'||l_proc, 5);
153 
154   If (
155 	p_appraisal_template_id is null and
156 	p_object_version_number is null
157      ) Then
158 
159     -- One of the primary key arguments is null therefore we must
160     -- set the returning function value to false
161 
162     l_fct_ret := false;
163   Else
164     If (
165 	p_appraisal_template_id = g_old_rec.appraisal_template_id and
166 	p_object_version_number = g_old_rec.object_version_number
167        ) Then
168       hr_utility.set_location(l_proc, 10);
169 
170       -- The g_old_rec is current therefore we must
171       -- set the returning function to true
172 
173       l_fct_ret := true;
174     Else
175 
176       -- Select the current row into g_old_rec
177 
178       Open C_Sel1;
179       Fetch C_Sel1 Into g_old_rec;
180       If C_Sel1%notfound Then
181         Close C_Sel1;
182 
183         -- The primary key is invalid therefore we must error
184 
185         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
186         hr_utility.raise_error;
187       End If;
188       Close C_Sel1;
189       If (p_object_version_number <> g_old_rec.object_version_number) Then
190         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
191         hr_utility.raise_error;
192       End If;
193       hr_utility.set_location(l_proc, 15);
194       l_fct_ret := true;
195     End If;
196   End If;
197   hr_utility.set_location(' Leaving:'||l_proc, 20);
198   Return (l_fct_ret);
199 
200 End api_updating;
201 
202 -- ---------------------------------------------------------------------------+
203 -- |---------------------------------< lck >----------------------------------|
204 -- ---------------------------------------------------------------------------+
205 Procedure lck
206   (
207   p_appraisal_template_id              in number,
208   p_object_version_number              in number
209   ) is
210 
211 -- Cursor selects the 'current' row from the HR Schema
212 
213   Cursor C_Sel1 is
214     select 	appraisal_template_id,
215 	business_group_id,
216 	object_version_number,
217 	name,
218 	description,
219 	instructions,
220 	date_from,
221 	date_to,
222 	assessment_type_id,
223 	rating_scale_id,
224 	questionnaire_template_id,
225 	attribute_category,
226 	attribute1,
227 	attribute2,
228 	attribute3,
229 	attribute4,
230 	attribute5,
231 	attribute6,
232 	attribute7,
233 	attribute8,
234 	attribute9,
235 	attribute10,
236 	attribute11,
237 	attribute12,
238 	attribute13,
239 	attribute14,
240 	attribute15,
241 	attribute16,
242 	attribute17,
243 	attribute18,
244 	attribute19,
245 	attribute20,
246 	objective_asmnt_type_id,
247     ma_quest_template_id,
248     link_appr_to_learning_path,
249     final_score_formula_id,
250     update_personal_comp_profile,
251     comp_profile_source_type,
252     show_competency_ratings,
253     show_objective_ratings,
254     show_overall_ratings,
255     show_overall_comments,
256     provide_overall_feedback,
257     show_participant_details,
258     allow_add_participant,
259     show_additional_details,
260     show_participant_names,
261     show_participant_ratings,
262     available_flag,
263 	  show_questionnaire_info,
264     ma_off_template_code,
265 	  appraisee_off_template_code,
266 	  other_part_off_template_code,
267 	  part_rev_off_template_code,
268 	  part_app_off_template_code,
269                             show_participant_comments -- 8651478 bug fix
270 ,show_term_employee
271 ,show_term_contigent
272 ,disp_term_emp_period_from
273 ,show_future_term_employee
274 
275     from	per_appraisal_templates
276     where	appraisal_template_id = p_appraisal_template_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_appraisal_templates');
319     hr_utility.raise_error;
320 End lck;
321 
322 -- ---------------------------------------------------------------------------+
323 -- |-----------------------------< convert_args >-----------------------------|
324 -- ---------------------------------------------------------------------------+
325 Function convert_args
326 	(
327 p_appraisal_template_id         in number,
328 	p_business_group_id             in number,
329 	p_object_version_number         in number,
330 	p_name                          in varchar2,
331 	p_description                   in varchar2,
332 	p_instructions                  in varchar2,
333 	p_date_from                     in date,
334 	p_date_to                       in date,
335 	p_assessment_type_id            in number,
336 	p_rating_scale_id               in number,
337 	p_questionnaire_template_id     in number,
338 	p_attribute_category            in varchar2,
339 	p_attribute1                    in varchar2,
340 	p_attribute2                    in varchar2,
341 	p_attribute3                    in varchar2,
342 	p_attribute4                    in varchar2,
343 	p_attribute5                    in varchar2,
344 	p_attribute6                    in varchar2,
345 	p_attribute7                    in varchar2,
346 	p_attribute8                    in varchar2,
347 	p_attribute9                    in varchar2,
348 	p_attribute10                   in varchar2,
349 	p_attribute11                   in varchar2,
350 	p_attribute12                   in varchar2,
351 	p_attribute13                   in varchar2,
352 	p_attribute14                   in varchar2,
353 	p_attribute15                   in varchar2,
354 	p_attribute16                   in varchar2,
355 	p_attribute17                   in varchar2,
356 	p_attribute18                   in varchar2,
357 	p_attribute19                   in varchar2,
358 	p_attribute20                   in varchar2
359    ,p_objective_asmnt_type_id        in number
360    ,p_ma_quest_template_id           in number
361   ,p_link_appr_to_learning_path     in varchar2
362   ,p_final_score_formula_id         in number
363   ,p_update_personal_comp_profile   in varchar2
364   ,p_comp_profile_source_type       in varchar2
365   ,p_show_competency_ratings        in varchar2
366   ,p_show_objective_ratings         in varchar2
367   ,p_show_overall_ratings           in varchar2
368   ,p_show_overall_comments          in varchar2
369   ,p_provide_overall_feedback       in varchar2
370   ,p_show_participant_details       in varchar2
371   ,p_allow_add_participant          in varchar2
372   ,p_show_additional_details        in varchar2
373   ,p_show_participant_names         in varchar2
374   ,p_show_participant_ratings       in varchar2
375   ,p_available_flag                 in varchar2
376   ,p_show_questionnaire_info        in varchar2
377   ,p_ma_off_template_code			      in varchar2
378   ,p_apraisee_off_template_code	 	  in varchar2
379   ,p_other_part_off_template_code  	in varchar2
380   ,p_part_app_off_template_code	  	in varchar2
381   ,p_part_rev_off_template_code 	  in varchar2
382 ,p_show_participant_comments     in varchar2    -- 8651478 bug fix
383   ,p_show_term_employee            in varchar2   -- 6181267 bug fix
384   ,p_show_term_contigent           in varchar2    -- 6181267 bug fix
385   ,p_disp_term_emp_period_from     in     number     -- 6181267 bug fix
386   ,p_show_future_term_employee          in varchar2    -- 6181267 bug fix
387 
388 	)
389 	Return g_rec_type is
390 
391   l_rec	  g_rec_type;
392   l_proc  varchar2(72) := g_package||'convert_args';
393 
394 Begin
395 
396   hr_utility.set_location('Entering:'||l_proc, 5);
397 
398   -- Convert arguments into local l_rec structure.
399 
400   l_rec.appraisal_template_id            := p_appraisal_template_id;
401   l_rec.business_group_id                := p_business_group_id;
402   l_rec.object_version_number            := p_object_version_number;
403   l_rec.name                             := p_name;
404   l_rec.description                      := p_description;
405   l_rec.instructions                     := p_instructions;
406   l_rec.date_from                        := p_date_from;
407   l_rec.date_to                          := p_date_to;
408   l_rec.assessment_type_id               := p_assessment_type_id;
409   l_rec.rating_scale_id                  := p_rating_scale_id;
410   l_rec.questionnaire_template_id        := p_questionnaire_template_id;
411   l_rec.attribute_category               := p_attribute_category;
412   l_rec.attribute1                       := p_attribute1;
413   l_rec.attribute2                       := p_attribute2;
414   l_rec.attribute3                       := p_attribute3;
415   l_rec.attribute4                       := p_attribute4;
416   l_rec.attribute5                       := p_attribute5;
417   l_rec.attribute6                       := p_attribute6;
418   l_rec.attribute7                       := p_attribute7;
419   l_rec.attribute8                       := p_attribute8;
420   l_rec.attribute9                       := p_attribute9;
421   l_rec.attribute10                      := p_attribute10;
422   l_rec.attribute11                      := p_attribute11;
423   l_rec.attribute12                      := p_attribute12;
424   l_rec.attribute13                      := p_attribute13;
425   l_rec.attribute14                      := p_attribute14;
426   l_rec.attribute15                      := p_attribute15;
427   l_rec.attribute16                      := p_attribute16;
428   l_rec.attribute17                      := p_attribute17;
429   l_rec.attribute18                      := p_attribute18;
430   l_rec.attribute19                      := p_attribute19;
431   l_rec.attribute20                      := p_attribute20;
432   l_rec.objective_asmnt_type_id          := p_objective_asmnt_type_id;
433   l_rec.ma_quest_template_id             := p_ma_quest_template_id;
434   l_rec.link_appr_to_learning_path       := p_link_appr_to_learning_path;
435   l_rec.final_score_formula_id           := p_final_score_formula_id;
436   l_rec.update_personal_comp_profile     := p_update_personal_comp_profile;
437   l_rec.comp_profile_source_type         := p_comp_profile_source_type;
438   l_rec.show_competency_ratings          := p_show_competency_ratings;
439   l_rec.show_objective_ratings           := p_show_objective_ratings;
440   l_rec.show_overall_ratings             := p_show_overall_ratings;
441   l_rec.show_overall_comments            := p_show_overall_comments;
442   l_rec.provide_overall_feedback         := p_provide_overall_feedback;
443   l_rec.show_participant_details         := p_show_participant_details;
444   l_rec.allow_add_participant            := p_allow_add_participant;
445   l_rec.show_additional_details          := p_show_additional_details;
446   l_rec.show_participant_names           := p_show_participant_names;
447   l_rec.show_participant_ratings         := p_show_participant_ratings;
448   l_rec.available_flag                   := p_available_flag;
449   l_rec.show_questionnaire_info          := p_show_questionnaire_info;
450   l_rec.ma_off_template_code			       := p_ma_off_template_code;
451   l_rec.appraisee_off_template_code		   := p_apraisee_off_template_code;
452   l_rec.other_part_off_template_code	   := p_other_part_off_template_code;
453   l_rec.part_app_off_template_code		   := p_part_app_off_template_code;
454   l_rec.part_rev_off_template_code		   :=	p_part_rev_off_template_code;
455   l_rec.show_participant_comments         := p_show_participant_comments;   -- 8651478 bug fix
456 
457   l_rec.show_term_employee           := p_show_term_employee;  -- 6181267 bug fix
458   l_rec.show_term_contigent          := p_show_term_contigent;   -- 6181267 bug fix
459   l_rec.disp_term_emp_period_from    := p_disp_term_emp_period_from;   -- 6181267 bug fix
460   l_rec.show_future_term_employee    := p_show_future_term_employee; -- 6181267 bug fix
461 
462   -- Return the plsql record structure.
463 
464   hr_utility.set_location(' Leaving:'||l_proc, 10);
465   Return(l_rec);
466 
467 End convert_args;
468 
469 end per_apt_shd;