DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_EVENT_API

Source


1 PACKAGE BODY OTA_EVENT_API as
2 /* $Header: otevtapi.pkb 120.3 2008/01/29 09:22:27 smahanka noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  OTA_EVENT_API.';
7 --
8 --
9 --
10    FUNCTION istimezonechanged (p_event_id NUMBER, p_timezone VARCHAR2)
11       RETURN BOOLEAN
12    IS
13       l_timezone   VARCHAR2 (30);
14 
15       CURSOR csr_evt_tz (p_event_id NUMBER)
16       IS
17          SELECT TIMEZONE
18            FROM ota_events
19           WHERE event_id = p_event_id
20            AND event_type IN ('SCHEDULED', 'SELFPACED');
21    BEGIN
22 
23       OPEN csr_evt_tz (p_event_id);
24 
25       FETCH csr_evt_tz
26        INTO l_timezone;
27       CLOSE csr_evt_tz;
28 
29       IF l_timezone IS NOT NULL AND p_timezone <> l_timezone
30       THEN
31          RETURN TRUE;
32       ELSE
33          RETURN FALSE;
34       END IF;
35    END;
36 
37 --
38 --
39 --
40    PROCEDURE proc_upd_evt_chat_sess (
41       p_event_id                IN              NUMBER,
42       p_timezone                IN              VARCHAR2,
43       p_effective_date          IN              DATE
44    )
45    IS
46 
47       CURSOR csr_chats (
48          p_event_id                IN   NUMBER
49       )
50       IS
51          SELECT cht.chat_id, cht.NAME, cht.description,chb.business_group_id,chb.object_version_number
52            FROM ota_chats_tl cht, ota_chat_obj_inclusions coi, ota_chats_b chb
53           WHERE coi.chat_id = cht.chat_id
54             AND coi.object_id = p_event_id
55             and cht.language = userenv('LANG')
56             AND chb.chat_id = coi.chat_id;
57 
58 
59       CURSOR csr_sess (
60          p_event_id                IN   NUMBER
61       )
62       IS
63          SELECT event_id,business_group_id,object_version_number
64            FROM ota_events
65           WHERE parent_event_id = p_event_id;
66    BEGIN
67 
68         for csr_chats_row in csr_chats(p_event_id)
69         loop
70 
71         ota_chat_api.update_chat
72                            (p_effective_date             => p_effective_date,
73                             p_name                       => csr_chats_row.name,
74                             p_description                => csr_chats_row.description,
75                             p_business_group_id          => csr_chats_row.business_group_id,
76                             p_timezone_code              => p_timezone,
77                             p_chat_id                    => csr_chats_row.chat_id,
78                             p_object_version_number      => csr_chats_row.object_version_number
79                            );
80 
81         end loop;
82 
83       for csr_sess_row in csr_sess(p_event_id)
84       loop
85 
86 
87       ota_event_api.update_class
88                            (p_event_id                  => csr_sess_row.event_id,
89                             p_effective_date            => p_effective_date,
90                             p_business_group_id         => csr_sess_row.business_group_id,
91                             p_object_version_number     => csr_sess_row.object_version_number,
92                             p_timezone                  => p_timezone
93                            );
94       end loop;
95 
96 
97 
98    END;
99 
100 
101 -- ----------------------------------------------------------------------------
102 -- |-----------------------------< CREATE_CLASS >-----------------------------|
103 -- ----------------------------------------------------------------------------
104 --
105 procedure create_class(
106   p_effective_date                in     date,
107   p_event_id                     out nocopy number,
108   p_vendor_id                    in number           default null,
109   p_activity_version_id          in number           default null,
110   p_business_group_id            in number,
111   p_organization_id              in number           default null,
112   p_event_type                   in varchar2,
113   p_object_version_number        out nocopy number,
114   p_title                        in varchar2,
115   p_budget_cost                  in number           default null,
116   p_actual_cost                  in number           default null,
117   p_budget_currency_code         in varchar2         default null,
118   p_centre                       in varchar2         default null,
119   p_comments                     in varchar2         default null,
120   p_course_end_date              in date             default null,
121   p_course_end_time              in varchar2         default null,
122   p_course_start_date            in date             default null,
123   p_course_start_time            in varchar2         default null,
124   p_duration                     in number           default null,
125   p_duration_units               in varchar2         default null,
126   p_enrolment_end_date           in date             default null,
127   p_enrolment_start_date         in date             default null,
128   p_language_id                  in number           default null,
129   p_user_status                  in varchar2         default null,
130   p_development_event_type       in varchar2         default null,
131   p_event_status                 in varchar2         default null,
132   p_price_basis                  in varchar2         default null,
133   p_currency_code                in varchar2         default null,
134   p_maximum_attendees            in number           default null,
135   p_maximum_internal_attendees   in number           default null,
136   p_minimum_attendees            in number           default null,
137   p_standard_price               in number           default null,
138   p_category_code                in varchar2         default null,
139   p_parent_event_id              in number           default null,
140   p_book_independent_flag        in varchar2         default null,
141   p_public_event_flag            in varchar2         default null,
142   p_secure_event_flag            in varchar2         default null,
143   p_evt_information_category     in varchar2         default null,
144   p_evt_information1             in varchar2         default null,
145   p_evt_information2             in varchar2         default null,
146   p_evt_information3             in varchar2         default null,
147   p_evt_information4             in varchar2         default null,
148   p_evt_information5             in varchar2         default null,
149   p_evt_information6             in varchar2         default null,
150   p_evt_information7             in varchar2         default null,
151   p_evt_information8             in varchar2         default null,
152   p_evt_information9             in varchar2         default null,
153   p_evt_information10            in varchar2         default null,
154   p_evt_information11            in varchar2         default null,
155   p_evt_information12            in varchar2         default null,
156   p_evt_information13            in varchar2         default null,
157   p_evt_information14            in varchar2         default null,
158   p_evt_information15            in varchar2         default null,
159   p_evt_information16            in varchar2         default null,
160   p_evt_information17            in varchar2         default null,
161   p_evt_information18            in varchar2         default null,
162   p_evt_information19            in varchar2         default null,
163   p_evt_information20            in varchar2         default null,
164   p_project_id                   in number           default null,
165   p_owner_id			         in number	         default null,
166   p_line_id				         in number	         default null,
167   p_org_id				         in number	         default null,
168   p_training_center_id           in number           default null,
169   p_location_id                  in number           default null,
170   p_offering_id         	     in number           default null,
171   p_timezone	                 in varchar2         default null,
172   p_parent_offering_id			 in number	         default null,
173   p_data_source	                 in varchar2         default null,
174   p_validate                     in boolean          default false
175   ) is
176   --
177   -- Declare cursors and local variables
178   --
179   l_proc                    varchar2(72) := g_package||' Create Class';
180   l_event_id number;
181   l_object_version_number   number;
182   l_effective_date          date;
183 begin
184   hr_utility.set_location('Entering:'|| l_proc, 10);
185   --
186   -- Issue a savepoint
187   --
188   savepoint CREATE_CLASS;
189   --
190   -- Truncate the time portion from all IN date parameters
191   --
192   l_effective_date := trunc(p_effective_date);
193   --
194   -- Call Before Process User Hook
195   --
196 
197   begin
198     ota_event_bk1.create_class_b
199   (p_effective_date              => l_effective_date,
200   p_vendor_id                    => p_vendor_id,
201   p_activity_version_id          => p_activity_version_id,
202   p_business_group_id            => p_business_group_id,
203   p_organization_id              => p_organization_id,
204   p_event_type                   => p_event_type,
205   p_object_version_number        => l_object_version_number,
206   p_title                        => p_title,
207   p_budget_cost                  => p_budget_cost,
208   p_actual_cost                  => p_actual_cost,
209   p_budget_currency_code         => p_budget_currency_code,
210   p_centre                       => p_centre,
211   p_comments                     => p_comments,
212   p_course_end_date              => p_course_end_date,
213   p_course_end_time              => p_course_end_time,
214   p_course_start_date            => p_course_start_date,
215   p_course_start_time            => p_course_start_time,
216   p_duration                     => p_duration,
217   p_duration_units               => p_duration_units,
218   p_enrolment_end_date           => p_enrolment_end_date,
219   p_enrolment_start_date         => p_enrolment_start_date,
220   p_language_id                  => p_language_id,
221   p_user_status                  => p_user_status,
222   p_development_event_type       => p_development_event_type,
223   p_event_status                 => p_event_status,
224   p_price_basis                  => p_price_basis,
225   p_currency_code                => p_currency_code,
226   p_maximum_attendees            => p_maximum_attendees,
227   p_maximum_internal_attendees   => p_maximum_internal_attendees,
228   p_minimum_attendees            => p_minimum_attendees,
229   p_standard_price               => p_standard_price,
230   p_category_code                => p_category_code,
231   p_parent_event_id              => p_parent_event_id,
232   p_book_independent_flag        => p_book_independent_flag,
233   p_public_event_flag            => p_public_event_flag,
234   p_secure_event_flag            => p_secure_event_flag,
235   p_evt_information_category     => p_evt_information_category,
236   p_evt_information1             => p_evt_information1,
237   p_evt_information2             => p_evt_information2,
238   p_evt_information3             => p_evt_information3,
239   p_evt_information4             => p_evt_information4,
240   p_evt_information5             => p_evt_information5,
241   p_evt_information6             => p_evt_information6,
242   p_evt_information7             => p_evt_information7,
243   p_evt_information8             => p_evt_information8,
244   p_evt_information9             => p_evt_information9,
245   p_evt_information10            => p_evt_information10,
246   p_evt_information11            => p_evt_information11,
247   p_evt_information12            => p_evt_information12,
248   p_evt_information13            => p_evt_information13,
249   p_evt_information14            => p_evt_information14,
250   p_evt_information15            => p_evt_information15,
251   p_evt_information16            => p_evt_information16,
252   p_evt_information17            => p_evt_information17,
253   p_evt_information18            => p_evt_information18,
254   p_evt_information19            => p_evt_information19,
255   p_evt_information20            => p_evt_information20,
256   p_project_id                   => p_project_id,
257   p_owner_id			         => p_owner_id,
258   p_line_id				         => p_line_id,
259   p_org_id				         => p_org_id,
260   p_training_center_id           => p_training_center_id,
261   p_location_id 			     => p_location_id,
262   p_offering_id			         => p_offering_id,
263   p_timezone			         => p_timezone,
264   p_parent_offering_id			 => p_parent_offering_id,
265   p_data_source			         => p_data_source);
266 
267   exception
268     when hr_api.cannot_find_prog_unit then
269       hr_api.cannot_find_prog_unit_error
270         (p_module_name => 'CREATE_CLASS'
271         ,p_hook_type   => 'BP'
272         );
273   end;
274   --
275 
276   -- Validation in addition to Row Handlers
277   --
278   --
279   -- Process Logic
280   --
281   ota_evt_ins.ins(
282   p_vendor_id                    => p_vendor_id,
283   p_activity_version_id          => p_activity_version_id,
284   p_business_group_id            => p_business_group_id,
285   p_organization_id              => p_organization_id,
286   p_event_type                   => p_event_type,
287   p_title                        => p_title,
288   p_budget_cost                  => p_budget_cost,
289   p_actual_cost                  => p_actual_cost,
290   p_budget_currency_code         => p_budget_currency_code,
291   p_centre                       => p_centre,
292   p_comments                     => p_comments,
293   p_course_end_date              => p_course_end_date,
294   p_course_end_time              => p_course_end_time,
295   p_course_start_date            => p_course_start_date,
296   p_course_start_time            => p_course_start_time,
297   p_duration                     => p_duration,
298   p_duration_units               => p_duration_units,
299   p_enrolment_end_date           => p_enrolment_end_date,
300   p_enrolment_start_date         => p_enrolment_start_date,
301   p_language_id                  => p_language_id,
302   p_user_status                  => p_user_status,
303   p_development_event_type       => p_development_event_type,
304   p_event_status                 => p_event_status,
305   p_price_basis                  => p_price_basis,
306   p_currency_code                => p_currency_code,
307   p_maximum_attendees            => p_maximum_attendees,
308   p_maximum_internal_attendees   => p_maximum_internal_attendees,
309   p_minimum_attendees            => p_minimum_attendees,
310   p_standard_price               => p_standard_price,
311   p_category_code                => p_category_code,
312   p_parent_event_id              => p_parent_event_id,
313   p_book_independent_flag        => p_book_independent_flag,
314   p_public_event_flag            => p_public_event_flag,
315   p_secure_event_flag            => p_secure_event_flag,
316   p_evt_information_category     => p_evt_information_category,
317   p_evt_information1             => p_evt_information1,
318   p_evt_information2             => p_evt_information2,
319   p_evt_information3             => p_evt_information3,
320   p_evt_information4             => p_evt_information4,
321   p_evt_information5             => p_evt_information5,
322   p_evt_information6             => p_evt_information6,
323   p_evt_information7             => p_evt_information7,
324   p_evt_information8             => p_evt_information8,
325   p_evt_information9             => p_evt_information9,
326   p_evt_information10            => p_evt_information10,
327   p_evt_information11            => p_evt_information11,
328   p_evt_information12            => p_evt_information12,
329   p_evt_information13            => p_evt_information13,
330   p_evt_information14            => p_evt_information14,
331   p_evt_information15            => p_evt_information15,
332   p_evt_information16            => p_evt_information16,
333   p_evt_information17            => p_evt_information17,
334   p_evt_information18            => p_evt_information18,
335   p_evt_information19            => p_evt_information19,
336   p_evt_information20            => p_evt_information20,
337   p_project_id                   => p_project_id,
338   p_owner_id			         => p_owner_id,
339   p_line_id	                     => p_line_id,
340   p_org_id				         => p_org_id,
341   p_training_center_id           => p_training_center_id,
342   p_location_id                  => p_location_id,
343   p_offering_id         	     => p_offering_id,
344   p_timezone	                 => p_timezone,
345   p_parent_offering_id           => p_parent_offering_id,
346   p_data_source                  => p_data_source,
347   p_validate                     => p_validate,
348   p_event_id                     => l_event_id,
349   p_object_version_number        => l_object_version_number
350   );
351     -- Set all output arguments
352   --
353   p_event_id                     := l_event_id;
354   p_object_version_number        := l_object_version_number;
355 
356   ota_ent_ins.ins_tl(
357   p_effective_date	             => p_effective_date,
358   p_language_code	             => USERENV('LANG'),
359   p_event_id                     => p_event_id,
360   p_title                        => p_title
361   );
362 --
363     --Adding evaluation at class level from the default
364     --class evaluation at the course level.
365     add_evaluation(p_event_id,p_activity_version_id);
366 
367   --
368   -- Call After Process User Hook
369   --
370   begin
371   ota_event_bk1.create_class_a
372  (p_effective_date               => l_effective_date,
373   p_event_id                     => l_event_id,
374   p_vendor_id                    => p_vendor_id,
375   p_activity_version_id          => p_activity_version_id,
376   p_business_group_id            => p_business_group_id,
377   p_organization_id              => p_organization_id,
378   p_event_type                   => p_event_type,
379   p_object_version_number        => l_object_version_number,
380   p_title                        => p_title,
381   p_budget_cost                  => p_budget_cost,
382   p_actual_cost                  => p_actual_cost,
383   p_budget_currency_code         => p_budget_currency_code,
384   p_centre                       => p_centre,
385   p_comments                     => p_comments,
386   p_course_end_date              => p_course_end_date,
387   p_course_end_time              => p_course_end_time,
388   p_course_start_date            => p_course_start_date,
389   p_course_start_time            => p_course_start_time,
390   p_duration                     => p_duration,
391   p_duration_units               => p_duration_units,
392   p_enrolment_end_date           => p_enrolment_end_date,
393   p_enrolment_start_date         => p_enrolment_start_date,
394   p_language_id                  => p_language_id,
395   p_user_status                  => p_user_status,
396   p_development_event_type       => p_development_event_type,
397   p_event_status                 => p_event_status,
398   p_price_basis                  => p_price_basis,
399   p_currency_code                => p_currency_code,
400   p_maximum_attendees            => p_maximum_attendees,
401   p_maximum_internal_attendees   => p_maximum_internal_attendees,
402   p_minimum_attendees            => p_minimum_attendees,
403   p_standard_price               => p_standard_price,
404   p_category_code                => p_category_code,
405   p_parent_event_id              => p_parent_event_id,
406   p_book_independent_flag        => p_book_independent_flag,
407   p_public_event_flag            => p_public_event_flag,
408   p_secure_event_flag            => p_secure_event_flag,
409   p_evt_information_category     => p_evt_information_category,
410   p_evt_information1             => p_evt_information1,
411   p_evt_information2             => p_evt_information2,
412   p_evt_information3             => p_evt_information3,
413   p_evt_information4             => p_evt_information4,
414   p_evt_information5             => p_evt_information5,
415   p_evt_information6             => p_evt_information6,
416   p_evt_information7             => p_evt_information7,
417   p_evt_information8             => p_evt_information8,
418   p_evt_information9             => p_evt_information9,
419   p_evt_information10            => p_evt_information10,
420   p_evt_information11            => p_evt_information11,
421   p_evt_information12            => p_evt_information12,
422   p_evt_information13            => p_evt_information13,
423   p_evt_information14            => p_evt_information14,
424   p_evt_information15            => p_evt_information15,
425   p_evt_information16            => p_evt_information16,
426   p_evt_information17            => p_evt_information17,
427   p_evt_information18            => p_evt_information18,
428   p_evt_information19            => p_evt_information19,
429   p_evt_information20            => p_evt_information20,
430   p_project_id                   => p_project_id,
431   p_owner_id			         => p_owner_id,
432   p_line_id				         => p_line_id,
433   p_org_id				         => p_org_id,
434   p_training_center_id           => p_training_center_id,
435   p_location_id 			     => p_location_id,
436   p_offering_id			         => p_offering_id,
437   p_timezone			         => p_timezone,
438   p_parent_offering_id			 => p_parent_offering_id,
439   p_data_source			         => p_data_source);
440   exception
441     when hr_api.cannot_find_prog_unit then
442       hr_api.cannot_find_prog_unit_error
443         (p_module_name => 'CREATE_CLASS'
444         ,p_hook_type   => 'AP'
445         );
446   end;
447 
448   --
449   -- When in validation only mode raise the Validate_Enabled exception
450   --
451   if p_validate then
452     raise hr_api.validate_enabled;
453   end if;
454   --
455   -- Set all output arguments
456   --
457   p_event_id        := l_event_id;
458   p_object_version_number   := l_object_version_number;
459   --
460   hr_utility.set_location(' Leaving:'||l_proc, 70);
461 exception
462   when hr_api.validate_enabled then
463     --
464     -- As the Validate_Enabled exception has been raised
465     -- we must rollback to the savepoint
466     --
467     rollback to CREATE_CLASS;
468     --
469     -- Only set output warning arguments
470     -- (Any key or derived arguments must be set to null
471     -- when validation only mode is being used.)
472     --
473     p_event_id := null;
474     p_object_version_number   := null;
475     hr_utility.set_location(' Leaving:'||l_proc, 80);
476   when others then
477     --
478     -- A validation or unexpected error has occured
479     --
480     rollback to CREATE_CLASS;
481     p_event_id        := null;
482     p_object_version_number   := null;
483     hr_utility.set_location(' Leaving:'||l_proc, 90);
484     raise;
485 end create_class;
486 -- ----------------------------------------------------------------------------
487 -- |-------------------------< UPDATE_CLASS >---------------------------------|
488 -- ----------------------------------------------------------------------------
489 --
490 procedure update_class
491   (p_event_id                     in number,
492   p_effective_date               in date,
493   p_vendor_id                    in number           default hr_api.g_number,
494   p_activity_version_id          in number           default hr_api.g_number,
495   p_business_group_id            in number           default hr_api.g_number,
496   p_organization_id              in number           default hr_api.g_number,
497   p_event_type                   in varchar2         default hr_api.g_varchar2,
498   p_object_version_number        in out nocopy number,
499   p_title                        in varchar2         default hr_api.g_varchar2,
500   p_budget_cost                  in number           default hr_api.g_number,
501   p_actual_cost                  in number           default hr_api.g_number,
502   p_budget_currency_code         in varchar2         default hr_api.g_varchar2,
503   p_centre                       in varchar2         default hr_api.g_varchar2,
504   p_comments                     in varchar2         default hr_api.g_varchar2,
505   p_course_end_date              in date             default hr_api.g_date,
506   p_course_end_time              in varchar2         default hr_api.g_varchar2,
507   p_course_start_date            in date             default hr_api.g_date,
508   p_course_start_time            in varchar2         default hr_api.g_varchar2,
509   p_duration                     in number           default hr_api.g_number,
510   p_duration_units               in varchar2         default hr_api.g_varchar2,
511   p_enrolment_end_date           in date             default hr_api.g_date,
512   p_enrolment_start_date         in date             default hr_api.g_date,
513   p_language_id                  in number           default hr_api.g_number,
514   p_user_status                  in varchar2         default hr_api.g_varchar2,
515   p_development_event_type       in varchar2         default hr_api.g_varchar2,
516   p_event_status                 in varchar2         default hr_api.g_varchar2,
517   p_price_basis                  in varchar2         default hr_api.g_varchar2,
518   p_currency_code                in varchar2         default hr_api.g_varchar2,
519   p_maximum_attendees            in number           default hr_api.g_number,
520   p_maximum_internal_attendees   in number           default hr_api.g_number,
521   p_minimum_attendees            in number           default hr_api.g_number,
522   p_standard_price               in number           default hr_api.g_number,
523   p_category_code                in varchar2         default hr_api.g_varchar2,
524   p_parent_event_id              in number           default hr_api.g_number,
525   p_book_independent_flag        in varchar2         default hr_api.g_varchar2,
526   p_public_event_flag            in varchar2         default hr_api.g_varchar2,
527   p_secure_event_flag            in varchar2         default hr_api.g_varchar2,
528   p_evt_information_category     in varchar2         default hr_api.g_varchar2,
529   p_evt_information1             in varchar2         default hr_api.g_varchar2,
530   p_evt_information2             in varchar2         default hr_api.g_varchar2,
531   p_evt_information3             in varchar2         default hr_api.g_varchar2,
532   p_evt_information4             in varchar2         default hr_api.g_varchar2,
533   p_evt_information5             in varchar2         default hr_api.g_varchar2,
534   p_evt_information6             in varchar2         default hr_api.g_varchar2,
535   p_evt_information7             in varchar2         default hr_api.g_varchar2,
536   p_evt_information8             in varchar2         default hr_api.g_varchar2,
537   p_evt_information9             in varchar2         default hr_api.g_varchar2,
538   p_evt_information10            in varchar2         default hr_api.g_varchar2,
539   p_evt_information11            in varchar2         default hr_api.g_varchar2,
540   p_evt_information12            in varchar2         default hr_api.g_varchar2,
541   p_evt_information13            in varchar2         default hr_api.g_varchar2,
542   p_evt_information14            in varchar2         default hr_api.g_varchar2,
543   p_evt_information15            in varchar2         default hr_api.g_varchar2,
544   p_evt_information16            in varchar2         default hr_api.g_varchar2,
545   p_evt_information17            in varchar2         default hr_api.g_varchar2,
546   p_evt_information18            in varchar2         default hr_api.g_varchar2,
547   p_evt_information19            in varchar2         default hr_api.g_varchar2,
548   p_evt_information20            in varchar2         default hr_api.g_varchar2,
549   p_project_id                   in number           default hr_api.g_number,
550   p_owner_id                     in number           default hr_api.g_number,
551   p_line_id	                     in number           default hr_api.g_number,
552   p_org_id	                     in number           default hr_api.g_number,
553   p_training_center_id           in number           default hr_api.g_number,
554   p_location_id	               in number             default hr_api.g_number,
555   p_offering_id		         in number               default hr_api.g_number,
556   p_timezone	               in varchar2           default hr_api.g_varchar2,
557 -- Bug#2200078 Corrected default value for offering_id and timezone
558 --  p_offering_id		         in number           default null,
559 --  p_timezone	               in varchar2         default null,
560   p_parent_offering_id 	         in number	         default hr_api.g_number,
561   p_data_source                  in varchar2         default hr_api.g_varchar2,
562   p_validate                     in boolean          default false
563   ) is
564   --
565   -- Declare cursors and local variables
566   --
567   l_proc                    varchar2(72) := g_package||' Update Class';
568   l_effective_date          date;
569   l_object_version_number   number := p_object_version_number;
570    l_timezonechanged BOOLEAN := false;
571 begin
572   hr_utility.set_location('Entering:'|| l_proc, 10);
573   --
574   -- Issue a savepoint
575   --
576   savepoint UPDATE_CLASS;
577   --
578   -- Truncate the time portion from all IN date parameters
579   --
580   IF p_timezone <> hr_api.g_varchar2 THEN
581         l_timezonechanged := istimezonechanged(p_event_id, p_timezone);
582       END IF;
583   --
584   l_effective_date := trunc(p_effective_date);
585   --
586   -- Call Before Process User Hook
587   --
588 
589   begin
590   ota_event_bk2.update_class_b
591  (p_effective_date               => l_effective_date,
592   p_event_id                     => p_event_id,
593   p_vendor_id                    => p_vendor_id,
594   p_activity_version_id          => p_activity_version_id,
595   p_business_group_id            => p_business_group_id,
596   p_organization_id              => p_organization_id,
597   p_event_type                   => p_event_type,
598   p_object_version_number        => l_object_version_number,
599   p_title                        => p_title,
600   p_budget_cost                  => p_budget_cost,
601   p_actual_cost                  => p_actual_cost,
602   p_budget_currency_code         => p_budget_currency_code,
603   p_centre                       => p_centre,
604   p_comments                     => p_comments,
605   p_course_end_date              => p_course_end_date,
606   p_course_end_time              => p_course_end_time,
607   p_course_start_date            => p_course_start_date,
608   p_course_start_time            => p_course_start_time,
609   p_duration                     => p_duration,
610   p_duration_units               => p_duration_units,
611   p_enrolment_end_date           => p_enrolment_end_date,
612   p_enrolment_start_date         => p_enrolment_start_date,
613   p_language_id                  => p_language_id,
614   p_user_status                  => p_user_status,
615   p_development_event_type       => p_development_event_type,
616   p_event_status                 => p_event_status,
617   p_price_basis                  => p_price_basis,
618   p_currency_code                => p_currency_code,
619   p_maximum_attendees            => p_maximum_attendees,
620   p_maximum_internal_attendees   => p_maximum_internal_attendees,
621   p_minimum_attendees            => p_minimum_attendees,
622   p_standard_price               => p_standard_price,
623   p_category_code                => p_category_code,
624   p_parent_event_id              => p_parent_event_id,
625   p_book_independent_flag        => p_book_independent_flag,
626   p_public_event_flag            => p_public_event_flag,
627   p_secure_event_flag            => p_secure_event_flag,
628   p_evt_information_category     => p_evt_information_category,
629   p_evt_information1             => p_evt_information1,
630   p_evt_information2             => p_evt_information2,
631   p_evt_information3             => p_evt_information3,
632   p_evt_information4             => p_evt_information4,
633   p_evt_information5             => p_evt_information5,
634   p_evt_information6             => p_evt_information6,
635   p_evt_information7             => p_evt_information7,
636   p_evt_information8             => p_evt_information8,
637   p_evt_information9             => p_evt_information9,
638   p_evt_information10            => p_evt_information10,
639   p_evt_information11            => p_evt_information11,
640   p_evt_information12            => p_evt_information12,
641   p_evt_information13            => p_evt_information13,
642   p_evt_information14            => p_evt_information14,
643   p_evt_information15            => p_evt_information15,
644   p_evt_information16            => p_evt_information16,
645   p_evt_information17            => p_evt_information17,
646   p_evt_information18            => p_evt_information18,
647   p_evt_information19            => p_evt_information19,
648   p_evt_information20            => p_evt_information20,
649   p_project_id                   => p_project_id,
650   p_owner_id			         => p_owner_id,
651   p_line_id				         => p_line_id,
652   p_org_id				         => p_org_id,
653   p_training_center_id           => p_training_center_id,
654   p_location_id 			     => p_location_id,
655   p_offering_id			         => p_offering_id,
656   p_timezone			         => p_timezone,
657   p_parent_offering_id			 => p_parent_offering_id,
658   p_data_source			         => p_data_source);
659 
660   exception
661     when hr_api.cannot_find_prog_unit then
662       hr_api.cannot_find_prog_unit_error
663         (p_module_name => 'UPDATE_CLASS'
664         ,p_hook_type   => 'BP'
665         );
666   end;
667   --
668 
669   -- Validation in addition to Row Handlers
670   --
671   --
672   -- Process Logic
673   --
674     ota_evt_upd.upd(
675   p_vendor_id                    => p_vendor_id,
676   p_activity_version_id          => p_activity_version_id,
677   p_business_group_id            => p_business_group_id,
678   p_organization_id              => p_organization_id,
679   p_event_type                   => p_event_type,
680   p_title                        => p_title,
681   p_budget_cost                  => p_budget_cost,
682   p_actual_cost                  => p_actual_cost,
683   p_budget_currency_code         => p_budget_currency_code,
684   p_centre                       => p_centre,
685   p_comments                     => p_comments,
686   p_course_end_date              => p_course_end_date,
687   p_course_end_time              => p_course_end_time,
688   p_course_start_date            => p_course_start_date,
689   p_course_start_time            => p_course_start_time,
690   p_duration                     => p_duration,
691   p_duration_units               => p_duration_units,
692   p_enrolment_end_date           => p_enrolment_end_date,
693   p_enrolment_start_date         => p_enrolment_start_date,
694   p_language_id                  => p_language_id,
695   p_user_status                  => p_user_status,
696   p_development_event_type       => p_development_event_type,
697   p_event_status                 => p_event_status,
698   p_price_basis                  => p_price_basis,
699   p_currency_code                => p_currency_code,
700   p_maximum_attendees            => p_maximum_attendees,
701   p_maximum_internal_attendees   => p_maximum_internal_attendees,
702   p_minimum_attendees            => p_minimum_attendees,
703   p_standard_price               => p_standard_price,
704   p_category_code                => p_category_code,
705   p_parent_event_id              => p_parent_event_id,
706   p_book_independent_flag        => p_book_independent_flag,
707   p_public_event_flag            => p_public_event_flag,
708   p_secure_event_flag            => p_secure_event_flag,
709   p_evt_information_category     => p_evt_information_category,
710   p_evt_information1             => p_evt_information1,
711   p_evt_information2             => p_evt_information2,
712   p_evt_information3             => p_evt_information3,
713   p_evt_information4             => p_evt_information4,
714   p_evt_information5             => p_evt_information5,
715   p_evt_information6             => p_evt_information6,
716   p_evt_information7             => p_evt_information7,
717   p_evt_information8             => p_evt_information8,
718   p_evt_information9             => p_evt_information9,
719   p_evt_information10            => p_evt_information10,
720   p_evt_information11            => p_evt_information11,
721   p_evt_information12            => p_evt_information12,
722   p_evt_information13            => p_evt_information13,
723   p_evt_information14            => p_evt_information14,
724   p_evt_information15            => p_evt_information15,
725   p_evt_information16            => p_evt_information16,
726   p_evt_information17            => p_evt_information17,
727   p_evt_information18            => p_evt_information18,
728   p_evt_information19            => p_evt_information19,
729   p_evt_information20            => p_evt_information20,
730   p_project_id                   => p_project_id,
731   p_owner_id			         => p_owner_id,
732   p_line_id	                     => p_line_id,
733   p_org_id				         => p_org_id,
734   p_training_center_id           => p_training_center_id,
735   p_location_id                  => p_location_id,
736   p_offering_id         	     => p_offering_id,
737   p_timezone	                 => p_timezone,
738   p_parent_offering_id           => p_parent_offering_id,
739   p_data_source                  => p_data_source,
740   p_validate                     => p_validate,
741   p_event_id                     => p_event_id,
742   p_object_version_number        => l_object_version_number
743   );
744 
745   ota_ent_upd.upd_tl(
746   p_effective_date	             => p_effective_date,
747   p_language_code	             => USERENV('LANG'),
748   p_event_id                     => p_event_id,
749   p_title                        => p_title
750   );
751 
752 
753 
754   --
755   -- Call After Process User Hook
756   --
757   begin
758   ota_event_bk2.update_class_a
759  (p_effective_date               => l_effective_date,
760   p_event_id                     => p_event_id,
761   p_vendor_id                    => p_vendor_id,
762   p_activity_version_id          => p_activity_version_id,
763   p_business_group_id            => p_business_group_id,
764   p_organization_id              => p_organization_id,
765   p_event_type                   => p_event_type,
766   p_object_version_number        => l_object_version_number,
767   p_title                        => p_title,
768   p_budget_cost                  => p_budget_cost,
769   p_actual_cost                  => p_actual_cost,
770   p_budget_currency_code         => p_budget_currency_code,
771   p_centre                       => p_centre,
772   p_comments                     => p_comments,
773   p_course_end_date              => p_course_end_date,
774   p_course_end_time              => p_course_end_time,
775   p_course_start_date            => p_course_start_date,
776   p_course_start_time            => p_course_start_time,
777   p_duration                     => p_duration,
778   p_duration_units               => p_duration_units,
779   p_enrolment_end_date           => p_enrolment_end_date,
780   p_enrolment_start_date         => p_enrolment_start_date,
781   p_language_id                  => p_language_id,
782   p_user_status                  => p_user_status,
783   p_development_event_type       => p_development_event_type,
784   p_event_status                 => p_event_status,
785   p_price_basis                  => p_price_basis,
786   p_currency_code                => p_currency_code,
787   p_maximum_attendees            => p_maximum_attendees,
788   p_maximum_internal_attendees   => p_maximum_internal_attendees,
789   p_minimum_attendees            => p_minimum_attendees,
790   p_standard_price               => p_standard_price,
791   p_category_code                => p_category_code,
792   p_parent_event_id              => p_parent_event_id,
793   p_book_independent_flag        => p_book_independent_flag,
794   p_public_event_flag            => p_public_event_flag,
795   p_secure_event_flag            => p_secure_event_flag,
796   p_evt_information_category     => p_evt_information_category,
797   p_evt_information1             => p_evt_information1,
798   p_evt_information2             => p_evt_information2,
799   p_evt_information3             => p_evt_information3,
800   p_evt_information4             => p_evt_information4,
801   p_evt_information5             => p_evt_information5,
802   p_evt_information6             => p_evt_information6,
803   p_evt_information7             => p_evt_information7,
804   p_evt_information8             => p_evt_information8,
805   p_evt_information9             => p_evt_information9,
806   p_evt_information10            => p_evt_information10,
807   p_evt_information11            => p_evt_information11,
808   p_evt_information12            => p_evt_information12,
809   p_evt_information13            => p_evt_information13,
810   p_evt_information14            => p_evt_information14,
811   p_evt_information15            => p_evt_information15,
812   p_evt_information16            => p_evt_information16,
813   p_evt_information17            => p_evt_information17,
814   p_evt_information18            => p_evt_information18,
815   p_evt_information19            => p_evt_information19,
816   p_evt_information20            => p_evt_information20,
817   p_project_id                   => p_project_id,
818   p_owner_id			         => p_owner_id,
819   p_line_id				         => p_line_id,
820   p_org_id				         => p_org_id,
821   p_training_center_id           => p_training_center_id,
822   p_location_id 			     => p_location_id,
823   p_offering_id			         => p_offering_id,
824   p_timezone			         => p_timezone,
825   p_parent_offering_id			 => p_parent_offering_id,
826   p_data_source			         => p_data_source);
827 
828   exception
829     when hr_api.cannot_find_prog_unit then
830       hr_api.cannot_find_prog_unit_error
831         (p_module_name => 'UPDATE_CLASS'
832         ,p_hook_type   => 'AP'
833         );
834   end;
835 
836   --
837 
838   IF l_timezonechanged
839       THEN
840          proc_upd_evt_chat_sess (p_event_id,
841                                  p_timezone,
842                                  p_effective_date
843                                 );
844       END IF;
845   --
846   -- When in validation only mode raise the Validate_Enabled exception
847   --
848   if p_validate then
849     raise hr_api.validate_enabled;
850   end if;
851   --
852   -- Set all output arguments
853   --
854   hr_utility.set_location(' Leaving:'||l_proc, 70);
855 exception
856   when hr_api.validate_enabled then
857     --
858     -- As the Validate_Enabled exception has been raised
859     -- we must rollback to the savepoint
860     --
861     rollback to UPDATE_CLASS;
862     --
863     -- Only set output warning arguments
864     -- (Any key or derived arguments must be set to null
865     -- when validation only mode is being used.)
866     --
867     p_object_version_number  := null;
868     hr_utility.set_location(' Leaving:'||l_proc, 80);
869   when others then
870     --
871     -- A validation or unexpected error has occured
872     --
873     rollback to UPDATE_CLASS;
874     p_object_version_number  := l_object_version_number;
875     hr_utility.set_location(' Leaving:'||l_proc, 90);
876     raise;
877 end update_class;
878 --
879 -- ----------------------------------------------------------------------------
880 -- |-------------------------< DELETE_CLASS >---------------------------------|
881 -- ----------------------------------------------------------------------------
882 --
883 procedure delete_class
884   (p_validate                      in     boolean  default false
885   ,p_event_id                   in     number
886   ,p_object_version_number         in     number
887   ) is
888   --
889   -- Declare cursors and local variables
890   --
891   l_proc                    varchar2(72) := g_package||' Delete Class';
892   l_object_version_id       number;
893   --
894   --
895 begin
896   hr_utility.set_location('Entering:'|| l_proc, 10);
897   --
898   -- Issue a savepoint
899   --
900   savepoint DELETE_CLASS;
901   --
902   -- Truncate the time portion from all IN date parameters
903   --
904   --
905 
906   -- Call Before Process User Hook
907   --
908   begin
909     ota_event_bk3.delete_class_b
910   (p_event_id                    => p_event_id,
911    p_object_version_number       => p_object_version_number
912   );
913   exception
914     when hr_api.cannot_find_prog_unit then
915       hr_api.cannot_find_prog_unit_error
916         (p_module_name => 'DELETE_CLASS'
917         ,p_hook_type   => 'BP'
918         );
919   end;
920   --
921 
922   -- Validation in addition to Row Handlers
923   --
924   --
925   -- Process Logic
926   --
927  --
928   ota_ent_del.del_tl
929   (p_event_id                => p_event_id
930   );
931   --
932 
933   ota_evt_del.del
934   (p_event_id                => p_event_id
935   ,p_object_version_number   => p_object_version_number
936   );
937   --
938 
939   -- Call After Process User Hook
940   --
941   begin
942   ota_event_bk3.delete_class_a
943   (p_event_id                    => p_event_id,
944    p_object_version_number       => p_object_version_number
945   );
946   exception
947     when hr_api.cannot_find_prog_unit then
948       hr_api.cannot_find_prog_unit_error
949         (p_module_name => 'DELETE_CLASS'
950         ,p_hook_type   => 'AP'
951         );
952   end;
953 
954   --
955   -- When in validation only mode raise the Validate_Enabled exception
956   --
957   if p_validate then
958     raise hr_api.validate_enabled;
959   end if;
960   --
961   -- Set all output arguments
962   --
963   --
964   hr_utility.set_location(' Leaving:'||l_proc, 170);
965 exception
966   when hr_api.validate_enabled then
967     --
968     -- As the Validate_Enabled exception has been raised
969     -- we must rollback to the savepoint
970     --
971     rollback to DELETE_CLASS;
972     --
973     -- Only set output warning arguments
974     -- (Any key or derived arguments must be set to null
975     -- when validation only mode is being used.)
976     --
977     hr_utility.set_location(' Leaving:'||l_proc, 180);
978   when others then
979     --
980     -- A validation or unexpected error has occured
981     --
982     rollback to DELETE_CLASS;
983     hr_utility.set_location(' Leaving:'||l_proc, 190);
984     raise;
985 end delete_class;
986 --
987 -- ----------------------------------------------------------------------------
988 -- |-----------------------------< add_evaluation >----------------------------|
989 -- ----------------------------------------------------------------------------
990 procedure add_evaluation(p_event_id in number,
991                          p_activity_version_id in number
992                          ) is
993 
994 l_eval_id ota_tests.test_id%type :=null;
995 l_mand_flag ota_evaluations.eval_mandatory_flag%type;
996 
997 Cursor c_dflt_eval is
998 select dflt_class_eval_id,eval_mandatory_flag
999 into l_eval_id,l_mand_flag
1000 from ota_evaluations
1001 where object_id = p_activity_version_id
1002 and object_type = 'A';
1003 
1004 l_proc    varchar2(72) := g_package ||'add_evaluation';
1005 Begin
1006     hr_utility.set_location(' Entering:' || l_proc,10);
1007     open c_dflt_eval;
1008     fetch c_dflt_eval into l_eval_id, l_mand_flag;
1009     close c_dflt_eval;
1010     if l_eval_id is not null then
1011         insert into ota_evaluations (evaluation_id,
1012                                     eval_mandatory_flag,
1013                                     object_id,
1014                                     object_type,
1015                                     object_version_number) values
1016                                     (l_eval_id,
1017                                      l_mand_flag,
1018                                      p_event_id,
1019                                      'E',
1020                                      1);
1021     end if;
1022     hr_utility.set_location(' Exiting:' || l_proc,15);
1023 end add_evaluation;
1024 
1025 end OTA_EVENT_API;