DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_TAV_SHD

Source


1 PACKAGE BODY ota_tav_shd as
2 /* $Header: ottav01t.pkb 120.2.12010000.2 2008/12/19 09:26:32 shwnayak ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ota_tav_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15   l_proc 	varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18   hr_utility.set_location('Entering:'||l_proc, 5);
19   --
20   Return (nvl(g_api_dml, false));
21   --
22   hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29             (p_constraint_name in varchar2) Is
30 --
31   l_proc 	varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34   hr_utility.set_location('Entering:'||l_proc, 5);
35   --
36   If (p_constraint_name = 'OTA_ACTIVITY_VERSIONS_FK1') Then
37     fnd_message.set_name('OTA', 'OTA_13292_TAV_NO_TAD');
38     fnd_message.raise_error;
39   ElsIf (p_constraint_name = 'OTA_ACTIVITY_VERSIONS_FK2') Then
40     fnd_message.set_name('OTA', 'OTA_13293_TAV_NO_SUP');
41     fnd_message.raise_error;
42   ElsIf (p_constraint_name = 'OTA_ACTIVITY_VERSIONS_FK3') Then
43     fnd_message.set_name('OTA', 'OTA_13294_TAV_NO_DEV');
44     fnd_message.raise_error;
45   ElsIf (p_constraint_name = 'OTA_TAV_MAX_INTERNAL_MAX_ORDER') Then
46     fnd_message.set_name('OTA', 'OTA_13385_TAV_MAX_INT_ATTS');
47     fnd_message.raise_error;
48   ElsIf (p_constraint_name = 'OTA_TAV_MAX_INT_ATTS_POSITIVE') Then
49     fnd_message.set_name('OTA', 'OTA_13385_TAV_MAX_INT_ATTS');
50     fnd_message.raise_error;
51   ElsIf (p_constraint_name = 'OTA_TAV_MAX_ATTENDEES_POSITIVE') Then
52     fnd_message.set_name('OTA', 'OTA_13296_GEN_MINMAX_POS');
53     fnd_message.raise_error;
54   ElsIf (p_constraint_name = 'OTA_TAV_MAX_OCCUR_POSITIVE') Then
55     fnd_message.set_name('OTA', 'OTA_13296_GEN_MINMAX_POS');
56     fnd_message.raise_error;
57   ElsIf (p_constraint_name = 'OTA_TAV_MIN_ATTENDEES_POSITIVE') Then
58     fnd_message.set_name('OTA', 'OTA_13296_GEN_MINMAX_POS');
59     fnd_message.raise_error;
60   ElsIf (p_constraint_name = 'OTA_TAV_MIN_MAX_ORDER') Then
61     fnd_message.set_name('OTA', 'OTA_13298_GEN_MINMAX_ORDER');
62     fnd_message.raise_error;
63   ElsIf (p_constraint_name = 'OTA_TAV_EXPENSES_ALLOWED_CHK') Then
64     fnd_message.set_name('OTA', 'OTA_13204_GEN_INVALID_LOOKUP');
65     fnd_message.set_token('FIELD','EXPENSES_ALLOWED');
66     fnd_message.set_token('LOOKUP_TYPE','YES_NO');
67     fnd_message.raise_error;
68   ElsIf (p_constraint_name = 'OTA_TAV_VERS_START_END_ORDER') Then
69     fnd_message.set_name('OTA', 'OTA_13312_GEN_DATE_ORDER');
70     fnd_message.raise_error;
71   ElsIf (p_constraint_name = 'OTA_ACTIVITY_VERSIONS_PK') Then
72     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
73     hr_utility.set_message_token('PROCEDURE', l_proc);
74     hr_utility.set_message_token('STEP','5');
75     hr_utility.raise_error;
76   ElsIf (p_constraint_name = 'OTA_ACTIVITY_VERSIONS_UK2') Then
77     fnd_message.set_name('OTA', 'OTA_13301_TAV_DUPLICATE');
78     fnd_message.raise_error;
79   ElsIf (p_constraint_name = 'OTA_ACTIVITY_VERSIONS_UK4') Then
80     fnd_message.set_name('OTA', 'OTA_13694_TAV_DUPLICATE');
81     fnd_message.raise_error;
82   ElsIf (p_constraint_name = 'OTA_ACTIVITY_VERSIONS_UK5') Then
83     fnd_message.set_name('OTA', 'OTA_TAV_DUPLICATE_RCO');
84     fnd_message.raise_error;
85   Else
86     fnd_message.set_name('OTA','OTA_GEN_UNKN_CONSTRAINT');
87     fnd_message.set_token('CONSTRAINT',p_constraint_name);
88     fnd_message.raise_error;
89   End If;
90   --
91   hr_utility.set_location(' Leaving:'||l_proc, 10);
92 End constraint_error;
93 --
94 -- ----------------------------------------------------------------------------
95 -- |-----------------------------< api_updating >-----------------------------|
96 -- ----------------------------------------------------------------------------
97 Function api_updating
98   (
99   p_activity_version_id                in number,
100   p_object_version_number              in number
101   )      Return Boolean Is
102 --
103   --
104   -- Cursor selects the 'current' row from the HR Schema
105   --
106   Cursor C_Sel1 is
107     select
108 		activity_version_id,
109 	activity_id,
110 	superseded_by_act_version_id,
111 	developer_organization_id,
112 	controlling_person_id,
113 	object_version_number,
114 	version_name,
115 	comments,
116 	description,
117 	duration,
118 	duration_units,
119 	end_date,
120 	intended_audience,
121 	language_id,
122 	maximum_attendees,
123 	minimum_attendees,
124 	objectives,
125 	start_date,
126 	success_criteria,
127 	user_status,
128       vendor_id,
129       actual_cost,
130       budget_cost,
131       budget_currency_code,
132       expenses_allowed,
133       professional_credit_type,
134       professional_credits,
135       maximum_internal_attendees,
136 	tav_information_category,
137 	tav_information1,
138 	tav_information2,
139 	tav_information3,
140 	tav_information4,
141 	tav_information5,
142 	tav_information6,
143 	tav_information7,
144 	tav_information8,
145 	tav_information9,
146 	tav_information10,
147 	tav_information11,
148 	tav_information12,
149 	tav_information13,
150 	tav_information14,
151 	tav_information15,
152 	tav_information16,
153 	tav_information17,
154 	tav_information18,
155 	tav_information19,
156 	tav_information20,
157       inventory_item_id,
158       organization_id,
159       rco_id,
160       version_code,
161       business_group_id,
162       data_source
163       ,competency_update_level
164 
165     from	ota_activity_versions
166     where	activity_version_id = p_activity_version_id;
167 --
168   l_proc	varchar2(72)	:= g_package||'api_updating';
169   l_fct_ret	boolean;
170 --
171 Begin
172   hr_utility.set_location('Entering:'||l_proc, 5);
173   --
174   If (
175 	p_activity_version_id is null and
176 	p_object_version_number is null
177      ) Then
178     --
179     -- One of the primary key arguments is null therefore we must
180     -- set the returning function value to false
181     --
182     l_fct_ret := false;
183   Else
184     If (
185 	p_activity_version_id = g_old_rec.activity_version_id and
186 	p_object_version_number = g_old_rec.object_version_number
187        ) Then
188       hr_utility.set_location(l_proc, 10);
189       --
190       -- The g_old_rec is current therefore we must
191       -- set the returning function to true
192       --
193       l_fct_ret := true;
194     Else
195       --
196       -- Select the current row into g_old_rec
197       --
198       Open C_Sel1;
199       Fetch C_Sel1 Into g_old_rec;
200       If C_Sel1%notfound Then
201         Close C_Sel1;
202         --
203         -- The primary key is invalid therefore we must error
204         --
205         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
206         hr_utility.raise_error;
207       End If;
208       Close C_Sel1;
209       If (p_object_version_number <> g_old_rec.object_version_number) Then
210         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
211         hr_utility.raise_error;
212       End If;
213       hr_utility.set_location(l_proc, 15);
214       l_fct_ret := true;
215     End If;
216   End If;
217   hr_utility.set_location(' Leaving:'||l_proc, 20);
218   Return (l_fct_ret);
219 --
220 End api_updating;
221 --
222 -- ----------------------------------------------------------------------------
223 -- |---------------------------------< lck >----------------------------------|
224 -- ----------------------------------------------------------------------------
225 Procedure lck
226   (
227   p_activity_version_id                in number,
228   p_object_version_number              in number
229   ) is
230 --
231 -- Cursor selects the 'current' row from the HR Schema
232 --
233   Cursor C_Sel1 is
234     select 	activity_version_id,
235 	activity_id,
236 	superseded_by_act_version_id,
237 	developer_organization_id,
238 	controlling_person_id,
239 	object_version_number,
240 	version_name,
241 	comments,
242 	description,
243 	duration,
244 	duration_units,
245 	end_date,
246 	intended_audience,
247 	language_id,
248 	maximum_attendees,
249 	minimum_attendees,
250 	objectives,
251 	start_date,
252 	success_criteria,
253 	user_status,
254       vendor_id,
255       actual_cost,
256       budget_cost,
257       budget_currency_code,
258       expenses_allowed,
259       professional_credit_type,
260       professional_credits,
261       maximum_internal_attendees,
262 	tav_information_category,
263 	tav_information1,
264 	tav_information2,
265 	tav_information3,
266 	tav_information4,
267 	tav_information5,
268 	tav_information6,
269 	tav_information7,
270 	tav_information8,
271 	tav_information9,
272 	tav_information10,
273 	tav_information11,
274 	tav_information12,
275 	tav_information13,
276 	tav_information14,
277 	tav_information15,
278 	tav_information16,
279 	tav_information17,
280 	tav_information18,
281 	tav_information19,
282 	tav_information20,
283       inventory_item_id,
284       organization_id,
285       rco_id,
286       version_code,
287       business_group_id,
288       data_source
289       ,competency_update_level
290 
291     from	ota_activity_versions
292     where	activity_version_id = p_activity_version_id
293     for	update nowait;
294 --
295   l_proc	varchar2(72) := g_package||'lck';
296 --
297 Begin
298   hr_utility.set_location('Entering:'||l_proc, 5);
299   --
300   -- Add any mandatory argument checking here:
301   -- Example:
302   -- hr_api.mandatory_arg_error
303   --   (p_api_name       => l_proc,
304   --    p_argument       => 'object_version_number',
305   --    p_argument_value => p_object_version_number);
306   --
307   Open  C_Sel1;
308   Fetch C_Sel1 Into g_old_rec;
309   If C_Sel1%notfound then
310     Close C_Sel1;
311     --
312     -- The primary key is invalid therefore we must error
313     --
314     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
315     hr_utility.raise_error;
316   End If;
317   Close C_Sel1;
318   If (p_object_version_number <> g_old_rec.object_version_number) Then
319         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
320         hr_utility.raise_error;
321       End If;
322 --
323   hr_utility.set_location(' Leaving:'||l_proc, 10);
324 --
325 -- We need to trap the ORA LOCK exception
326 --
327 Exception
328   When HR_Api.Object_Locked then
329     --
330     -- The object is locked therefore we need to supply a meaningful
331     -- error message.
332     --
333     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
334     hr_utility.set_message_token('TABLE_NAME', 'ota_activity_versions');
335     hr_utility.raise_error;
336 End lck;
337 --
338 -- ----------------------------------------------------------------------------
339 -- |-----------------------------< convert_args >-----------------------------|
340 -- ----------------------------------------------------------------------------
341 Function convert_args
342 	(
343 	p_activity_version_id           in number,
344 	p_activity_id                   in number,
345 	p_superseded_by_act_version_id  in number,
346 	p_developer_organization_id     in number,
347 	p_controlling_person_id         in number,
348 	p_object_version_number         in number,
349 	p_version_name                  in varchar2,
350 	p_comments                      in varchar2,
351 	p_description                   in varchar2,
352 	p_duration                      in number,
353 	p_duration_units                in varchar2,
354 	p_end_date                      in date,
355 	p_intended_audience             in varchar2,
356 	p_language_id                   in number,
357 	p_maximum_attendees             in number,
358 	p_minimum_attendees             in number,
359 	p_objectives                    in varchar2,
360 	p_start_date                    in date,
361 	p_success_criteria              in varchar2,
362 	p_user_status                   in varchar2,
363       p_vendor_id                     in number,
364       p_actual_cost                   in number,
365       p_budget_cost                   in number,
366       p_budget_currency_code          in varchar2,
367       p_expenses_allowed              in varchar2,
368       p_professional_credit_type      in varchar2,
369       p_professional_credits          in number,
370       p_maximum_internal_attendees    in number,
371 	p_tav_information_category      in varchar2,
372 	p_tav_information1              in varchar2,
373 	p_tav_information2              in varchar2,
374 	p_tav_information3              in varchar2,
375 	p_tav_information4              in varchar2,
376 	p_tav_information5              in varchar2,
377 	p_tav_information6              in varchar2,
378 	p_tav_information7              in varchar2,
379 	p_tav_information8              in varchar2,
380 	p_tav_information9              in varchar2,
381 	p_tav_information10             in varchar2,
382 	p_tav_information11             in varchar2,
383 	p_tav_information12             in varchar2,
384 	p_tav_information13             in varchar2,
385 	p_tav_information14             in varchar2,
386 	p_tav_information15             in varchar2,
387 	p_tav_information16             in varchar2,
388 	p_tav_information17             in varchar2,
389 	p_tav_information18             in varchar2,
390 	p_tav_information19             in varchar2,
391 	p_tav_information20             in varchar2,
392       p_inventory_item_id  		  in number,
393       p_organization_id  		  in number,
394       p_rco_id				  in number,
395       p_version_code          in varchar2,
396       p_business_group_id              in number,
397       p_data_source           in varchar2
398       ,p_competency_update_level        in     varchar2
399 
400 	)
401 	Return g_rec_type is
402 --
403   l_rec	  g_rec_type;
404   l_proc  varchar2(72) := g_package||'convert_args';
405 --
406 Begin
407   --
408   hr_utility.set_location('Entering:'||l_proc, 5);
409   --
410   -- Convert arguments into local l_rec structure.
411   --
415   l_rec.developer_organization_id        := p_developer_organization_id;
412   l_rec.activity_version_id              := p_activity_version_id;
413   l_rec.activity_id                      := p_activity_id;
414   l_rec.superseded_by_act_version_id     := p_superseded_by_act_version_id;
416   l_rec.controlling_person_id            := p_controlling_person_id;
417   l_rec.object_version_number            := p_object_version_number;
418   l_rec.version_name                     := p_version_name;
419   l_rec.comments                         := p_comments;
420   l_rec.description                      := p_description;
421   l_rec.duration                         := p_duration;
422   l_rec.duration_units                   := p_duration_units;
423   l_rec.end_date                         := p_end_date;
424   l_rec.intended_audience                := p_intended_audience;
425   l_rec.language_id                      := p_language_id;
426   l_rec.maximum_attendees                := p_maximum_attendees;
427   l_rec.minimum_attendees                := p_minimum_attendees;
428   l_rec.objectives                       := p_objectives;
429   l_rec.start_date                       := p_start_date;
430   l_rec.success_criteria                 := p_success_criteria;
431   l_rec.user_status                      := p_user_status;
432   l_rec.vendor_id                        := p_vendor_id;
433   l_rec.actual_cost                      := p_actual_cost;
434   l_rec.budget_cost                      := p_budget_cost;
435   l_rec.budget_currency_code             := p_budget_currency_code;
436   l_rec.expenses_allowed                 := p_expenses_allowed;
437   l_rec.professional_credit_type         := p_professional_credit_type;
438   l_rec.professional_credits             := p_professional_credits;
439   l_rec.maximum_internal_attendees       := p_maximum_internal_attendees;
440   l_rec.tav_information_category         := p_tav_information_category;
441   l_rec.tav_information1                 := p_tav_information1;
442   l_rec.tav_information2                 := p_tav_information2;
443   l_rec.tav_information3                 := p_tav_information3;
444   l_rec.tav_information4                 := p_tav_information4;
445   l_rec.tav_information5                 := p_tav_information5;
446   l_rec.tav_information6                 := p_tav_information6;
447   l_rec.tav_information7                 := p_tav_information7;
448   l_rec.tav_information8                 := p_tav_information8;
449   l_rec.tav_information9                 := p_tav_information9;
450   l_rec.tav_information10                := p_tav_information10;
451   l_rec.tav_information11                := p_tav_information11;
452   l_rec.tav_information12                := p_tav_information12;
453   l_rec.tav_information13                := p_tav_information13;
454   l_rec.tav_information14                := p_tav_information14;
455   l_rec.tav_information15                := p_tav_information15;
456   l_rec.tav_information16                := p_tav_information16;
457   l_rec.tav_information17                := p_tav_information17;
458   l_rec.tav_information18                := p_tav_information18;
459   l_rec.tav_information19                := p_tav_information19;
460   l_rec.tav_information20                := p_tav_information20;
461   l_rec.inventory_item_id		     := p_inventory_item_id;
462   l_rec.organization_id			     := p_organization_id;
463   l_rec.rco_id			     	     := p_rco_id;
464   l_rec.version_code                 := p_version_code;
465   l_rec.business_group_id            := p_business_group_id;
466   l_rec.data_source                  := p_data_source;
467    l_rec.competency_update_level          := p_competency_update_level  ;
468 
469 
470   --
471   -- Return the plsql record structure.
472   --
473   hr_utility.set_location(' Leaving:'||l_proc, 10);
474   Return(l_rec);
475 --
476 End convert_args;
477 --
478 end ota_tav_shd;