DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_TAV_SHD

Source


4 -- ----------------------------------------------------------------------------
1 PACKAGE BODY ota_tav_shd as
2 /* $Header: ottav01t.pkb 120.2.12010000.3 2009/08/11 13:44:21 smahanka ship $ */
3 --
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   --
25 -- ----------------------------------------------------------------------------
22   hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
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       eres_enabled
165 
166     from	ota_activity_versions
167     where	activity_version_id = p_activity_version_id;
168 --
169   l_proc	varchar2(72)	:= g_package||'api_updating';
170   l_fct_ret	boolean;
171 --
172 Begin
173   hr_utility.set_location('Entering:'||l_proc, 5);
174   --
175   If (
176 	p_activity_version_id is null and
177 	p_object_version_number is null
178      ) Then
179     --
180     -- One of the primary key arguments is null therefore we must
181     -- set the returning function value to false
182     --
183     l_fct_ret := false;
184   Else
185     If (
186 	p_activity_version_id = g_old_rec.activity_version_id and
187 	p_object_version_number = g_old_rec.object_version_number
188        ) Then
189       hr_utility.set_location(l_proc, 10);
190       --
191       -- The g_old_rec is current therefore we must
192       -- set the returning function to true
193       --
194       l_fct_ret := true;
195     Else
196       --
197       -- Select the current row into g_old_rec
198       --
199       Open C_Sel1;
200       Fetch C_Sel1 Into g_old_rec;
201       If C_Sel1%notfound Then
202         Close C_Sel1;
203         --
204         -- The primary key is invalid therefore we must error
205         --
206         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
207         hr_utility.raise_error;
208       End If;
209       Close C_Sel1;
210       If (p_object_version_number <> g_old_rec.object_version_number) Then
211         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
212         hr_utility.raise_error;
213       End If;
214       hr_utility.set_location(l_proc, 15);
215       l_fct_ret := true;
216     End If;
217   End If;
218   hr_utility.set_location(' Leaving:'||l_proc, 20);
219   Return (l_fct_ret);
220 --
221 End api_updating;
222 --
223 -- ----------------------------------------------------------------------------
224 -- |---------------------------------< lck >----------------------------------|
225 -- ----------------------------------------------------------------------------
226 Procedure lck
227   (
228   p_activity_version_id                in number,
229   p_object_version_number              in number
230   ) is
231 --
232 -- Cursor selects the 'current' row from the HR Schema
233 --
234   Cursor C_Sel1 is
235     select 	activity_version_id,
236 	activity_id,
237 	superseded_by_act_version_id,
238 	developer_organization_id,
239 	controlling_person_id,
240 	object_version_number,
241 	version_name,
242 	comments,
243 	description,
244 	duration,
245 	duration_units,
246 	end_date,
247 	intended_audience,
248 	language_id,
249 	maximum_attendees,
250 	minimum_attendees,
251 	objectives,
252 	start_date,
253 	success_criteria,
254 	user_status,
255       vendor_id,
256       actual_cost,
257       budget_cost,
258       budget_currency_code,
259       expenses_allowed,
260       professional_credit_type,
261       professional_credits,
262       maximum_internal_attendees,
263 	tav_information_category,
264 	tav_information1,
265 	tav_information2,
266 	tav_information3,
267 	tav_information4,
268 	tav_information5,
269 	tav_information6,
270 	tav_information7,
271 	tav_information8,
272 	tav_information9,
273 	tav_information10,
274 	tav_information11,
275 	tav_information12,
276 	tav_information13,
277 	tav_information14,
278 	tav_information15,
279 	tav_information16,
280 	tav_information17,
281 	tav_information18,
282 	tav_information19,
283 	tav_information20,
284       inventory_item_id,
285       organization_id,
286       rco_id,
287       version_code,
288       business_group_id,
289       data_source
290       ,competency_update_level,
291       eres_enabled
292 
293     from	ota_activity_versions
294     where	activity_version_id = p_activity_version_id
295     for	update nowait;
296 --
297   l_proc	varchar2(72) := g_package||'lck';
298 --
299 Begin
300   hr_utility.set_location('Entering:'||l_proc, 5);
301   --
302   -- Add any mandatory argument checking here:
303   -- Example:
304   -- hr_api.mandatory_arg_error
305   --   (p_api_name       => l_proc,
306   --    p_argument       => 'object_version_number',
307   --    p_argument_value => p_object_version_number);
308   --
309   Open  C_Sel1;
310   Fetch C_Sel1 Into g_old_rec;
311   If C_Sel1%notfound then
312     Close C_Sel1;
313     --
314     -- The primary key is invalid therefore we must error
315     --
316     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
317     hr_utility.raise_error;
318   End If;
319   Close C_Sel1;
320   If (p_object_version_number <> g_old_rec.object_version_number) Then
321         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
322         hr_utility.raise_error;
323       End If;
324 --
325   hr_utility.set_location(' Leaving:'||l_proc, 10);
326 --
327 -- We need to trap the ORA LOCK exception
328 --
329 Exception
330   When HR_Api.Object_Locked then
331     --
332     -- The object is locked therefore we need to supply a meaningful
333     -- error message.
334     --
335     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
336     hr_utility.set_message_token('TABLE_NAME', 'ota_activity_versions');
337     hr_utility.raise_error;
338 End lck;
339 --
340 -- ----------------------------------------------------------------------------
341 -- |-----------------------------< convert_args >-----------------------------|
342 -- ----------------------------------------------------------------------------
343 Function convert_args
344 	(
345 	p_activity_version_id           in number,
346 	p_activity_id                   in number,
347 	p_superseded_by_act_version_id  in number,
348 	p_developer_organization_id     in number,
349 	p_controlling_person_id         in number,
350 	p_object_version_number         in number,
351 	p_version_name                  in varchar2,
352 	p_comments                      in varchar2,
353 	p_description                   in varchar2,
354 	p_duration                      in number,
355 	p_duration_units                in varchar2,
356 	p_end_date                      in date,
357 	p_intended_audience             in varchar2,
358 	p_language_id                   in number,
359 	p_maximum_attendees             in number,
360 	p_minimum_attendees             in number,
361 	p_objectives                    in varchar2,
362 	p_start_date                    in date,
363 	p_success_criteria              in varchar2,
364 	p_user_status                   in varchar2,
365       p_vendor_id                     in number,
366       p_actual_cost                   in number,
367       p_budget_cost                   in number,
368       p_budget_currency_code          in varchar2,
369       p_expenses_allowed              in varchar2,
370       p_professional_credit_type      in varchar2,
371       p_professional_credits          in number,
372       p_maximum_internal_attendees    in number,
373 	p_tav_information_category      in varchar2,
374 	p_tav_information1              in varchar2,
375 	p_tav_information2              in varchar2,
376 	p_tav_information3              in varchar2,
377 	p_tav_information4              in varchar2,
378 	p_tav_information5              in varchar2,
379 	p_tav_information6              in varchar2,
380 	p_tav_information7              in varchar2,
381 	p_tav_information8              in varchar2,
382 	p_tav_information9              in varchar2,
383 	p_tav_information10             in varchar2,
384 	p_tav_information11             in varchar2,
385 	p_tav_information12             in varchar2,
386 	p_tav_information13             in varchar2,
387 	p_tav_information14             in varchar2,
388 	p_tav_information15             in varchar2,
389 	p_tav_information16             in varchar2,
390 	p_tav_information17             in varchar2,
391 	p_tav_information18             in varchar2,
392 	p_tav_information19             in varchar2,
393 	p_tav_information20             in varchar2,
394       p_inventory_item_id  		  in number,
395       p_organization_id  		  in number,
396       p_rco_id				  in number,
397       p_version_code          in varchar2,
398       p_business_group_id              in number,
399       p_data_source           in varchar2
400       ,p_competency_update_level        in     varchar2,
401       p_eres_enabled          in varchar2
402 
403 	)
404 	Return g_rec_type is
405 --
406   l_rec	  g_rec_type;
407   l_proc  varchar2(72) := g_package||'convert_args';
408 --
409 Begin
410   --
411   hr_utility.set_location('Entering:'||l_proc, 5);
412   --
413   -- Convert arguments into local l_rec structure.
414   --
415   l_rec.activity_version_id              := p_activity_version_id;
416   l_rec.activity_id                      := p_activity_id;
417   l_rec.superseded_by_act_version_id     := p_superseded_by_act_version_id;
418   l_rec.developer_organization_id        := p_developer_organization_id;
419   l_rec.controlling_person_id            := p_controlling_person_id;
420   l_rec.object_version_number            := p_object_version_number;
421   l_rec.version_name                     := p_version_name;
422   l_rec.comments                         := p_comments;
423   l_rec.description                      := p_description;
424   l_rec.duration                         := p_duration;
425   l_rec.duration_units                   := p_duration_units;
426   l_rec.end_date                         := p_end_date;
427   l_rec.intended_audience                := p_intended_audience;
428   l_rec.language_id                      := p_language_id;
429   l_rec.maximum_attendees                := p_maximum_attendees;
430   l_rec.minimum_attendees                := p_minimum_attendees;
431   l_rec.objectives                       := p_objectives;
432   l_rec.start_date                       := p_start_date;
433   l_rec.success_criteria                 := p_success_criteria;
434   l_rec.user_status                      := p_user_status;
435   l_rec.vendor_id                        := p_vendor_id;
436   l_rec.actual_cost                      := p_actual_cost;
437   l_rec.budget_cost                      := p_budget_cost;
438   l_rec.budget_currency_code             := p_budget_currency_code;
439   l_rec.expenses_allowed                 := p_expenses_allowed;
440   l_rec.professional_credit_type         := p_professional_credit_type;
441   l_rec.professional_credits             := p_professional_credits;
442   l_rec.maximum_internal_attendees       := p_maximum_internal_attendees;
443   l_rec.tav_information_category         := p_tav_information_category;
444   l_rec.tav_information1                 := p_tav_information1;
445   l_rec.tav_information2                 := p_tav_information2;
446   l_rec.tav_information3                 := p_tav_information3;
447   l_rec.tav_information4                 := p_tav_information4;
448   l_rec.tav_information5                 := p_tav_information5;
449   l_rec.tav_information6                 := p_tav_information6;
450   l_rec.tav_information7                 := p_tav_information7;
451   l_rec.tav_information8                 := p_tav_information8;
452   l_rec.tav_information9                 := p_tav_information9;
453   l_rec.tav_information10                := p_tav_information10;
454   l_rec.tav_information11                := p_tav_information11;
455   l_rec.tav_information12                := p_tav_information12;
456   l_rec.tav_information13                := p_tav_information13;
457   l_rec.tav_information14                := p_tav_information14;
458   l_rec.tav_information15                := p_tav_information15;
459   l_rec.tav_information16                := p_tav_information16;
460   l_rec.tav_information17                := p_tav_information17;
461   l_rec.tav_information18                := p_tav_information18;
462   l_rec.tav_information19                := p_tav_information19;
463   l_rec.tav_information20                := p_tav_information20;
464   l_rec.inventory_item_id		     := p_inventory_item_id;
465   l_rec.organization_id			     := p_organization_id;
466   l_rec.rco_id			     	     := p_rco_id;
467   l_rec.version_code                 := p_version_code;
468   l_rec.business_group_id            := p_business_group_id;
469   l_rec.data_source                  := p_data_source;
470    l_rec.competency_update_level          := p_competency_update_level  ;
471   l_rec.eres_enabled                 := p_eres_enabled  ;
472 
473   --
474   -- Return the plsql record structure.
475   --
476   hr_utility.set_location(' Leaving:'||l_proc, 10);
477   Return(l_rec);
478 --
479 End convert_args;
480 --
481 end ota_tav_shd;