DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_TDB_UPD

Source


1 Package Body ota_tdb_upd as
2 /* $Header: ottdb01t.pkb 120.26 2008/04/22 12:43:15 smahanka noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ota_tdb_upd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< update_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml update logic. The functions of this
17 --   procedure are as follows:
18 --   1) Increment the object_version_number by 1 if the object_version_number
19 --      is defined as an attribute for this entity.
20 --   2) To set and unset the g_api_dml status as required (as we are about to
21 --      perform dml).
22 --   3) To update the specified row in the schema using the primary key in
23 --      the predicates.
24 --   4) To trap any constraint violations that may have occurred.
25 --   5) To raise any other errors.
26 --
27 -- Pre Conditions:
28 --   This is an internal private procedure which must be called from the upd
29 --   procedure.
30 --
31 -- In Arguments:
32 --   A Pl/Sql record structre.
33 --
34 -- Post Success:
35 --   The specified row will be updated in the schema.
36 --
37 -- Post Failure:
38 --   On the update dml failure it is important to note that we always reset the
39 --   g_api_dml status to false.
40 --   If a check, unique or parent integrity constraint violation is raised the
41 --   constraint_error procedure will be called.
42 --   If any other error is reported, the error will be raised after the
43 --   g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 --   The update 'set' arguments list should be modified if any of your
47 --   attributes are not updateable.
48 --
49 -- Access Status:
50 --   Internal Development Use Only.
51 --
52 -- {End Of Comments}
53 -- ----------------------------------------------------------------------------
54 Procedure update_dml(p_rec in out nocopy ota_tdb_shd.g_rec_type) is
55 --
56   l_proc  varchar2(72) := g_package||'update_dml';
57 --
58 Begin
59   hr_utility.set_location('Entering:'||l_proc, 5);
60   --
61   -- Increment the object version
62   --
63   p_rec.object_version_number := p_rec.object_version_number + 1;
64   --
65   ota_tdb_shd.g_api_dml := true;  -- Set the api dml status
66   --
67   -- Update the ota_delegate_bookings Row
68   --
69   update ota_delegate_bookings
70   set
71   booking_id                        = p_rec.booking_id,
72   booking_status_type_id            = p_rec.booking_status_type_id,
73   delegate_person_id                = p_rec.delegate_person_id,
74   contact_id                        = p_rec.contact_id,
75   business_group_id                 = p_rec.business_group_id,
76   event_id                          = p_rec.event_id,
77   customer_id                       = p_rec.customer_id,
78   authorizer_person_id              = p_rec.authorizer_person_id,
79   date_booking_placed               = p_rec.date_booking_placed,
80   corespondent                      = p_rec.corespondent,
81   internal_booking_flag             = p_rec.internal_booking_flag,
82   number_of_places                  = p_rec.number_of_places,
83   object_version_number             = p_rec.object_version_number,
84   administrator                     = p_rec.administrator,
85   booking_priority                  = p_rec.booking_priority,
86   comments                          = p_rec.comments,
87   contact_address_id                = p_rec.contact_address_id,
88   delegate_contact_phone            = p_rec.delegate_contact_phone,
89   delegate_contact_fax              = p_rec.delegate_contact_fax,
90   third_party_customer_id           = p_rec.third_party_customer_id,
91   third_party_contact_id            = p_rec.third_party_contact_id,
92   third_party_address_id            = p_rec.third_party_address_id,
93   third_party_contact_phone         = p_rec.third_party_contact_phone,
94   third_party_contact_fax           = p_rec.third_party_contact_fax,
95   date_status_changed               = p_rec.date_status_changed,
96   failure_reason                    = p_rec.failure_reason,
97   attendance_result                 = p_rec.attendance_result,
98   language_id                       = p_rec.language_id,
99   source_of_booking                 = p_rec.source_of_booking,
100   special_booking_instructions      = p_rec.special_booking_instructions,
101   successful_attendance_flag        = p_rec.successful_attendance_flag,
102   tdb_information_category          = p_rec.tdb_information_category,
103   tdb_information1                  = p_rec.tdb_information1,
104   tdb_information2                  = p_rec.tdb_information2,
105   tdb_information3                  = p_rec.tdb_information3,
106   tdb_information4                  = p_rec.tdb_information4,
107   tdb_information5                  = p_rec.tdb_information5,
108   tdb_information6                  = p_rec.tdb_information6,
109   tdb_information7                  = p_rec.tdb_information7,
110   tdb_information8                  = p_rec.tdb_information8,
111   tdb_information9                  = p_rec.tdb_information9,
112   tdb_information10                 = p_rec.tdb_information10,
113   tdb_information11                 = p_rec.tdb_information11,
114   tdb_information12                 = p_rec.tdb_information12,
115   tdb_information13                 = p_rec.tdb_information13,
116   tdb_information14                 = p_rec.tdb_information14,
117   tdb_information15                 = p_rec.tdb_information15,
118   tdb_information16                 = p_rec.tdb_information16,
119   tdb_information17                 = p_rec.tdb_information17,
120   tdb_information18                 = p_rec.tdb_information18,
121   tdb_information19                 = p_rec.tdb_information19,
122   tdb_information20                 = p_rec.tdb_information20,
123   organization_id                   = p_rec.organization_id,
124   sponsor_person_id                 = p_rec.sponsor_person_id,
125   sponsor_assignment_id             = p_rec.sponsor_assignment_id,
126   person_address_id                 = p_rec.person_address_id,
127   delegate_assignment_id            = p_rec.delegate_assignment_id,
128   delegate_contact_id               = p_rec.delegate_contact_id,
129   delegate_contact_email            = p_rec.delegate_contact_email,
130   third_party_email                 = p_rec.third_party_email,
131   person_address_type               = p_rec.person_address_type,
132   line_id                                       = p_rec.line_id,
133   org_id                                        = p_rec.org_id,
134   daemon_flag                           = p_rec.daemon_flag,
135   daemon_type                           = p_rec.daemon_type,
136   old_event_id                       = p_rec.old_event_id,
137   quote_line_id                      = p_rec.quote_line_id,
138   interface_source                   = p_rec.interface_source,
139   total_training_time                    = p_rec.total_training_time,
140   content_player_status                  = p_rec.content_player_status,
141   score                              = p_rec.score,
142   completed_content                  = p_rec.completed_content,
143   total_content                      = p_rec.total_content,
144   booking_justification_id                   = p_rec.booking_justification_id,
145   is_history_flag                    = p_rec.is_history_flag
146   where booking_id = p_rec.booking_id;
147   --
148   ota_tdb_shd.g_api_dml := false;   -- Unset the api dml status
149   --
150   hr_utility.set_location(' Leaving:'||l_proc, 10);
151 --
152 Exception
153   When hr_api.check_integrity_violated Then
154     -- A check constraint has been violated
155     ota_tdb_shd.g_api_dml := false;   -- Unset the api dml status
156     ota_tdb_shd.constraint_error
157       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
158   When hr_api.parent_integrity_violated Then
159     -- Parent integrity has been violated
160     ota_tdb_shd.g_api_dml := false;   -- Unset the api dml status
161     ota_tdb_shd.constraint_error
162       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
163   When hr_api.unique_integrity_violated Then
164     -- Unique integrity has been violated
165     ota_tdb_shd.g_api_dml := false;   -- Unset the api dml status
166     ota_tdb_shd.constraint_error
167       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
168   When Others Then
169     ota_tdb_shd.g_api_dml := false;   -- Unset the api dml status
170     Raise;
171 End update_dml;
172 --
173 -- ----------------------------------------------------------------------------
174 -- |------------------------------< pre_update >------------------------------|
175 -- ----------------------------------------------------------------------------
176 -- {Start Of Comments}
177 --
178 -- Description:
179 --   This private procedure contains any processing which is required before
180 --   the update dml.
181 --
182 -- Pre Conditions:
183 --   This is an internal procedure which is called from the upd procedure.
184 --
185 -- In Arguments:
186 --   A Pl/Sql record structre.
187 --
188 -- Post Success:
189 --   Processing continues.
190 --
191 -- Post Failure:
192 --   If an error has occurred, an error message and exception will be raised
193 --   but not handled.
194 --
195 -- Developer Implementation Notes:
196 --   Any pre-processing required before the update dml is issued should be
197 --   coded within this procedure. It is important to note that any 3rd party
198 --   maintenance should be reviewed before placing in this procedure.
199 --
200 -- Access Status:
201 --   Internal Development Use Only.
202 --
203 -- {End Of Comments}
204 -- ----------------------------------------------------------------------------
205 Procedure pre_update(p_rec in ota_tdb_shd.g_rec_type) is
206 --
207   l_proc  varchar2(72) := g_package||'pre_update';
208 --
209 Begin
210   hr_utility.set_location('Entering:'||l_proc, 5);
211   --
212 /*ota_tdb_bus.chk_status_changed
213                 (p_line_id              => p_rec.line_id
214                 ,p_status_type_id       => p_rec.booking_status_type_id
215                 ,p_daemon_type  => p_rec.daemon_type
216                 ,p_event_id             => p_rec.event_id
217                 ,p_booking_id   => p_rec.booking_id
218                 ,p_org_id               => p_rec.org_id);  */
219 hr_utility.set_location(' Leaving:'||l_proc, 10);
220 End pre_update;
221 --
222 --
223 -- ----------------------------------------------------------------------------
224 -- |-----------------------------< post_update >------------------------------|
225 -- ----------------------------------------------------------------------------
226 -- {Start Of Comments}
227 --
228 -- Description:
229 --   This private procedure contains any processing which is required after the
230 --   update dml.
231 --
232 -- Pre Conditions:
233 --   This is an internal procedure which is called from the upd procedure.
234 --
235 -- In Arguments:
236 --   A Pl/Sql record structre.
237 --
238 -- Post Success:
239 --   Processing continues.
240 --
241 -- Post Failure:
242 --   If an error has occurred, an error message and exception will be raised
243 --   but not handled.
244 --
245 -- Developer Implementation Notes:
246 --   Any post-processing required after the update dml is issued should be
247 --   coded within this procedure. It is important to note that any 3rd party
248 --   maintenance should be reviewed before placing in this procedure.
249 --
250 -- Access Status:
251 --   Internal Development Use Only.
252 --
253 -- {End Of Comments}
254 -- ----------------------------------------------------------------------------
255 Procedure post_update
256             (p_rec                       in     ota_tdb_shd.g_rec_type) is
257 --
258   l_proc  varchar2(72) := g_package||'post_update';
259 
260 --
261 Begin
262   hr_utility.set_location('Entering:'||l_proc, 5);
263   --
264     ota_tdb_bus.chk_status_changed
265                 (p_line_id              => p_rec.line_id
266                 ,p_status_type_id       => p_rec.booking_status_type_id
267                 ,p_daemon_type  => p_rec.daemon_type
268                 ,p_event_id             => p_rec.event_id
269                 ,p_booking_id   => p_rec.booking_id
270                 ,p_org_id               => p_rec.org_id);
271 
272   --
273   hr_utility.set_location(' Leaving:'||l_proc, 10);
274 End post_update;
275 --
276 -- ----------------------------------------------------------------------------
277 -- |-----------------------------< convert_defs >-----------------------------|
278 -- ----------------------------------------------------------------------------
279 -- {Start Of Comments}
280 --
281 -- Description:
282 --   The Convert_Defs function has one very important function:
283 --   It must return the record structure for the row with all system defaulted
284 --   values converted into its corresponding argument value for update. When
285 --   we attempt to update a row through the Upd business process , certain
286 --   arguments can be defaulted which enables flexibility in the calling of
287 --   the upd process (e.g. only attributes which need to be updated need to be
288 --   specified). For the upd business process to determine which attributes
289 --   have NOT been specified we need to check if the argument has a reserved
290 --   system default value. Therefore, for all attributes which have a
291 --   corresponding reserved system default mechanism specified we need to
292 --   check if a system default is being used. If a system default is being
293 --   used then we convert the defaulted value into its corresponding attribute
294 --   value held in the g_old_rec data structure.
295 --
296 -- Pre Conditions:
297 --   This private function can only be called from the upd process.
298 --
299 -- In Arguments:
300 --   A Pl/Sql record structre.
301 --
302 -- Post Success:
303 --   The record structure will be returned with all system defaulted argument
304 --   values converted into its current row attribute value.
305 --
306 -- Post Failure:
307 --   No direct error handling is required within this function. Any possible
308 --   errors within this function will be a PL/SQL value error due to conversion
309 --   of datatypes or data lengths.
310 --
311 -- Developer Implementation Notes:
312 --   None.
313 --
314 -- Access Status:
315 --   Internal Development Use Only.
316 --
317 -- {End Of Comments}
318 -- ----------------------------------------------------------------------------
319 Function convert_defs(p_rec in out nocopy ota_tdb_shd.g_rec_type)
320          Return ota_tdb_shd.g_rec_type is
321 --
322   l_proc  varchar2(72) := g_package||'convert_defs';
323 --
324 Begin
325   --
326   hr_utility.set_location('Entering:'||l_proc, 5);
327   --
328   -- We must now examine each argument value in the
329   -- p_rec plsql record structure
330   -- to see if a system default is being used. If a system default
331   -- is being used then we must set to the 'current' argument value.
332   --
333   If (p_rec.booking_status_type_id = hr_api.g_number) then
334     p_rec.booking_status_type_id :=
335     ota_tdb_shd.g_old_rec.booking_status_type_id;
336   End If;
337   If (p_rec.delegate_person_id = hr_api.g_number) then
338     p_rec.delegate_person_id :=
339     ota_tdb_shd.g_old_rec.delegate_person_id;
340   End If;
341   If (p_rec.contact_id = hr_api.g_number) then
342     p_rec.contact_id :=
343     ota_tdb_shd.g_old_rec.contact_id;
344   End If;
345   If (p_rec.business_group_id = hr_api.g_number) then
346     p_rec.business_group_id :=
347     ota_tdb_shd.g_old_rec.business_group_id;
348   End If;
349   If (p_rec.event_id = hr_api.g_number) then
350     p_rec.event_id :=
351     ota_tdb_shd.g_old_rec.event_id;
352   End If;
353   If (p_rec.customer_id = hr_api.g_number) then
354     p_rec.customer_id :=
355     ota_tdb_shd.g_old_rec.customer_id;
356   End If;
357   If (p_rec.authorizer_person_id = hr_api.g_number) then
358     p_rec.authorizer_person_id :=
359     ota_tdb_shd.g_old_rec.authorizer_person_id;
360   End If;
361   If (p_rec.date_booking_placed = hr_api.g_date) then
362     p_rec.date_booking_placed :=
363     ota_tdb_shd.g_old_rec.date_booking_placed;
364   End If;
365   If (p_rec.corespondent = hr_api.g_varchar2) then
366     p_rec.corespondent :=
367     ota_tdb_shd.g_old_rec.corespondent;
368   End If;
369   If (p_rec.internal_booking_flag = hr_api.g_varchar2) then
370     p_rec.internal_booking_flag :=
371     ota_tdb_shd.g_old_rec.internal_booking_flag;
372   End If;
373   If (p_rec.number_of_places = hr_api.g_number) then
374     p_rec.number_of_places :=
375     ota_tdb_shd.g_old_rec.number_of_places;
376   End If;
377   If (p_rec.administrator = hr_api.g_number) then
378     p_rec.administrator :=
379     ota_tdb_shd.g_old_rec.administrator;
380   End If;
381   If (p_rec.booking_priority = hr_api.g_varchar2) then
382     p_rec.booking_priority :=
383     ota_tdb_shd.g_old_rec.booking_priority;
384   End If;
385   If (p_rec.comments = hr_api.g_varchar2) then
386     p_rec.comments :=
387     ota_tdb_shd.g_old_rec.comments;
388   End If;
389   If (p_rec.contact_address_id = hr_api.g_number) then
390     p_rec.contact_address_id :=
391     ota_tdb_shd.g_old_rec.contact_address_id;
392   End If;
393   If (p_rec.delegate_contact_phone = hr_api.g_varchar2) then
394     p_rec.delegate_contact_phone :=
395     ota_tdb_shd.g_old_rec.delegate_contact_phone;
396   End If;
397   If (p_rec.delegate_contact_fax = hr_api.g_varchar2) then
398     p_rec.delegate_contact_fax :=
399     ota_tdb_shd.g_old_rec.delegate_contact_fax;
400   End If;
401   If (p_rec.third_party_customer_id = hr_api.g_number) then
402     p_rec.third_party_customer_id :=
403     ota_tdb_shd.g_old_rec.third_party_customer_id;
404   End If;
405   If (p_rec.third_party_contact_id = hr_api.g_number) then
406     p_rec.third_party_contact_id :=
407     ota_tdb_shd.g_old_rec.third_party_contact_id;
408   End If;
409   If (p_rec.third_party_address_id = hr_api.g_number) then
410     p_rec.third_party_address_id :=
411     ota_tdb_shd.g_old_rec.third_party_address_id;
412   End If;
413   If (p_rec.third_party_contact_phone = hr_api.g_varchar2) then
414     p_rec.third_party_contact_phone :=
415     ota_tdb_shd.g_old_rec.third_party_contact_phone;
416   End If;
417   If (p_rec.third_party_contact_fax = hr_api.g_varchar2) then
418     p_rec.third_party_contact_fax :=
419     ota_tdb_shd.g_old_rec.third_party_contact_fax;
420   End If;
421   If (p_rec.date_status_changed = hr_api.g_date) then
422     p_rec.date_status_changed :=
423     ota_tdb_shd.g_old_rec.date_status_changed;
424   End If;
425   If (p_rec.failure_reason = hr_api.g_varchar2) then
426     p_rec.failure_reason :=
427     ota_tdb_shd.g_old_rec.failure_reason;
428   End If;
429   If (p_rec.attendance_result = hr_api.g_varchar2) then
430     p_rec.attendance_result :=
431     ota_tdb_shd.g_old_rec.attendance_result;
432   End If;
433   If (p_rec.language_id = hr_api.g_number) then
434     p_rec.language_id :=
435     ota_tdb_shd.g_old_rec.language_id;
436   End If;
437   If (p_rec.source_of_booking = hr_api.g_varchar2) then
438     p_rec.source_of_booking :=
439     ota_tdb_shd.g_old_rec.source_of_booking;
440   End If;
441   If (p_rec.special_booking_instructions = hr_api.g_varchar2) then
442     p_rec.special_booking_instructions :=
443     ota_tdb_shd.g_old_rec.special_booking_instructions;
444   End If;
445   If (p_rec.successful_attendance_flag = hr_api.g_varchar2) then
446     p_rec.successful_attendance_flag :=
447     ota_tdb_shd.g_old_rec.successful_attendance_flag;
448   End If;
449   If (p_rec.tdb_information_category = hr_api.g_varchar2) then
450     p_rec.tdb_information_category :=
451     ota_tdb_shd.g_old_rec.tdb_information_category;
452   End If;
453   If (p_rec.tdb_information1 = hr_api.g_varchar2) then
454     p_rec.tdb_information1 :=
455     ota_tdb_shd.g_old_rec.tdb_information1;
456   End If;
457   If (p_rec.tdb_information2 = hr_api.g_varchar2) then
458     p_rec.tdb_information2 :=
459     ota_tdb_shd.g_old_rec.tdb_information2;
460   End If;
461   If (p_rec.tdb_information3 = hr_api.g_varchar2) then
462     p_rec.tdb_information3 :=
463     ota_tdb_shd.g_old_rec.tdb_information3;
464   End If;
465   If (p_rec.tdb_information4 = hr_api.g_varchar2) then
466     p_rec.tdb_information4 :=
467     ota_tdb_shd.g_old_rec.tdb_information4;
468   End If;
469   If (p_rec.tdb_information5 = hr_api.g_varchar2) then
470     p_rec.tdb_information5 :=
471     ota_tdb_shd.g_old_rec.tdb_information5;
472   End If;
473   If (p_rec.tdb_information6 = hr_api.g_varchar2) then
474     p_rec.tdb_information6 :=
475     ota_tdb_shd.g_old_rec.tdb_information6;
476   End If;
477   If (p_rec.tdb_information7 = hr_api.g_varchar2) then
478     p_rec.tdb_information7 :=
479     ota_tdb_shd.g_old_rec.tdb_information7;
480   End If;
481   If (p_rec.tdb_information8 = hr_api.g_varchar2) then
482     p_rec.tdb_information8 :=
483     ota_tdb_shd.g_old_rec.tdb_information8;
484   End If;
485   If (p_rec.tdb_information9 = hr_api.g_varchar2) then
486     p_rec.tdb_information9 :=
487     ota_tdb_shd.g_old_rec.tdb_information9;
488   End If;
489   If (p_rec.tdb_information10 = hr_api.g_varchar2) then
490     p_rec.tdb_information10 :=
491     ota_tdb_shd.g_old_rec.tdb_information10;
492   End If;
493   If (p_rec.tdb_information11 = hr_api.g_varchar2) then
494     p_rec.tdb_information11 :=
495     ota_tdb_shd.g_old_rec.tdb_information11;
496   End If;
497   If (p_rec.tdb_information12 = hr_api.g_varchar2) then
498     p_rec.tdb_information12 :=
499     ota_tdb_shd.g_old_rec.tdb_information12;
500   End If;
501   If (p_rec.tdb_information13 = hr_api.g_varchar2) then
502     p_rec.tdb_information13 :=
503     ota_tdb_shd.g_old_rec.tdb_information13;
504   End If;
505   If (p_rec.tdb_information14 = hr_api.g_varchar2) then
506     p_rec.tdb_information14 :=
507     ota_tdb_shd.g_old_rec.tdb_information14;
508   End If;
509   If (p_rec.tdb_information15 = hr_api.g_varchar2) then
510     p_rec.tdb_information15 :=
511     ota_tdb_shd.g_old_rec.tdb_information15;
512   End If;
513   If (p_rec.tdb_information16 = hr_api.g_varchar2) then
514     p_rec.tdb_information16 :=
515     ota_tdb_shd.g_old_rec.tdb_information16;
516   End If;
517   If (p_rec.tdb_information17 = hr_api.g_varchar2) then
518     p_rec.tdb_information17 :=
519     ota_tdb_shd.g_old_rec.tdb_information17;
520   End If;
521   If (p_rec.tdb_information18 = hr_api.g_varchar2) then
522     p_rec.tdb_information18 :=
523     ota_tdb_shd.g_old_rec.tdb_information18;
524   End If;
525   If (p_rec.tdb_information19 = hr_api.g_varchar2) then
526     p_rec.tdb_information19 :=
527     ota_tdb_shd.g_old_rec.tdb_information19;
528   End If;
529   If (p_rec.tdb_information20 = hr_api.g_varchar2) then
530     p_rec.tdb_information20 :=
531     ota_tdb_shd.g_old_rec.tdb_information20;
532   End If;
533   If (p_rec.organization_id = hr_api.g_number) then
534     p_rec.organization_id :=
535     ota_tdb_shd.g_old_rec.organization_id;
536   End If;
537   If (p_rec.sponsor_person_id = hr_api.g_number) then
538     p_rec.sponsor_person_id :=
539     ota_tdb_shd.g_old_rec.sponsor_person_id;
540   End If;
541   If (p_rec.sponsor_assignment_id = hr_api.g_number) then
542     p_rec.sponsor_assignment_id :=
543     ota_tdb_shd.g_old_rec.sponsor_assignment_id;
544   End If;
545   If (p_rec.person_address_id = hr_api.g_number) then
546     p_rec.person_address_id :=
547     ota_tdb_shd.g_old_rec.person_address_id;
548   End If;
549   If (p_rec.delegate_assignment_id = hr_api.g_number) then
550     p_rec.delegate_assignment_id :=
551     ota_tdb_shd.g_old_rec.delegate_assignment_id;
552   End If;
553   If (p_rec.delegate_contact_id = hr_api.g_number) then
554     p_rec.delegate_contact_id :=
555     ota_tdb_shd.g_old_rec.delegate_contact_id;
556   End If;
557   If (p_rec.delegate_contact_email = hr_api.g_varchar2) then
558     p_rec.delegate_contact_email :=
559     ota_tdb_shd.g_old_rec.delegate_contact_email;
560   End If;
561   If (p_rec.third_party_email = hr_api.g_varchar2) then
562     p_rec.third_party_email :=
563     ota_tdb_shd.g_old_rec.third_party_email;
564   End If;
565   If (p_rec.person_address_type = hr_api.g_varchar2) then
566     p_rec.person_address_type :=
567     ota_tdb_shd.g_old_rec.person_address_type;
568   End If;
569   If (p_rec.line_id = hr_api.g_number) then
570     p_rec.line_id :=
571     ota_tdb_shd.g_old_rec.line_id;
572   End If;
573    If (p_rec.org_id = hr_api.g_number) then
574     p_rec.org_id :=
575     ota_tdb_shd.g_old_rec.org_id;
576   End If;
577   If (p_rec.daemon_flag = hr_api.g_varchar2) then
578     p_rec.daemon_flag :=
579     ota_tdb_shd.g_old_rec.daemon_flag;
580   End If;
581    If (p_rec.daemon_type = hr_api.g_varchar2) then
582     p_rec.daemon_type :=
583     ota_tdb_shd.g_old_rec.daemon_type;
584   End If;
585 
586   If (p_rec.old_event_id = hr_api.g_number) then
587     p_rec.old_event_id :=
588     ota_tdb_shd.g_old_rec.old_event_id;
589   End If;
590 
591   If (p_rec.quote_line_id = hr_api.g_number) then
592     p_rec.quote_line_id :=
593     ota_tdb_shd.g_old_rec.quote_line_id;
594   End If;
595 
596   If (p_rec.interface_source = hr_api.g_varchar2) then
597     p_rec.interface_source :=
598     ota_tdb_shd.g_old_rec.interface_source;
599   End If;
600 
601   If (p_rec.total_training_time = hr_api.g_varchar2) then
602     p_rec.total_training_time :=
603     ota_tdb_shd.g_old_rec.total_training_time ;
604   End If;
605 
606  If (p_rec.content_player_status= hr_api.g_varchar2) then
607     p_rec.content_player_status:=
608     ota_tdb_shd.g_old_rec.content_player_status;
609   End If;
610 
611  If (p_rec.score = hr_api.g_number) then
612     p_rec.score:=
613     ota_tdb_shd.g_old_rec.score;
614   End If;
615  If (p_rec.completed_content= hr_api.g_number) then
616     p_rec.completed_content:=
617     ota_tdb_shd.g_old_rec.completed_content;
618   End If;
619  If (p_rec.total_content = hr_api.g_number) then
620     p_rec.total_content :=
621     ota_tdb_shd.g_old_rec.total_content ;
622   End If;
623   if (p_rec.booking_justification_id = hr_api.g_number) then
624     p_rec.booking_justification_id :=
625       ota_tdb_shd.g_old_rec.booking_justification_id;
626   End If;
627   if (p_rec.is_history_flag = hr_api.g_varchar2) then
628     p_rec.is_history_flag :=
629       ota_tdb_shd.g_old_rec.is_history_flag;
630   End If;
631   --
632   -- Return the plsql record structure.
633   --
634   hr_utility.set_location(' Leaving:'||l_proc, 10);
635   Return(p_rec);
636 --
637 End convert_defs;
638 --
639 -- ----------------------------------------------------------------------------
640 -- |---------------------------------< upd >----------------------------------|
641 -- ----------------------------------------------------------------------------
642 Procedure upd
643   (
644   p_rec                       in out nocopy ota_tdb_shd.g_rec_type,
645   p_status_change_comments    in     varchar2,
646   p_update_finance_line       in     varchar2,
647   p_tfl_object_version_number in out nocopy number,
648   p_finance_header_id         in     number,
649   p_finance_line_id           in out nocopy number,
650   p_standard_amount           in     number,
651   p_unitary_amount            in     number,
652   p_money_amount              in     number,
653   p_currency_code             in     varchar2,
654   p_booking_deal_type         in     varchar2,
655   p_booking_deal_id           in     number,
656   p_enrollment_type           in     varchar2,
657   p_validate                  in     boolean
658   ) is
659 --
660   l_proc  varchar2(72) := g_package||'upd';
661 --
662 Begin
663   hr_utility.set_location('Entering:'||l_proc, 5);
664   --
665   -- Determine if the business process is to be validated.
666   --
667   If p_validate then
668     --
669     -- Issue the savepoint.
670     --
671     SAVEPOINT upd_ota_tdb;
672   End If;
673   --
674   -- We must lock the row which we need to update.
675   --
676   ota_tdb_shd.lck
677         (
678         p_rec.booking_id,
679         p_rec.object_version_number
680         );
681   --
682   -- 1. During an update system defaults are used to determine if
683   --    arguments have been defaulted or not. We must therefore
684   --    derive the full record structure values to be updated.
685   --
686   -- 2. Call the supporting update validate operations.
687   --
688   ota_tdb_bus.update_validate(convert_defs(p_rec),p_enrollment_type);
689   --
690   -- Call the supporting pre-update operation
691   --
692   pre_update(p_rec);
693   --
694   -- Update the row.
695   --
696   update_dml(p_rec);
697   --
698   -- Call the supporting post-update operation
699   --
700   post_update(p_rec);
701   --
702   -- If we are validating then raise the Validate_Enabled exception
703   --
704   If p_validate then
705     Raise HR_Api.Validate_Enabled;
706   End If;
707   --
708   hr_utility.set_location(' Leaving:'||l_proc, 10);
709 Exception
710   When HR_Api.Validate_Enabled Then
711     --
712     -- As the Validate_Enabled exception has been raised
713     -- we must rollback to the savepoint
714     --
715     ROLLBACK TO upd_ota_tdb;
716 End upd;
717 --
718 -- ----------------------------------------------------------------------------
719 -- |---------------------------------< upd >----------------------------------|
720 -- ----------------------------------------------------------------------------
721 Procedure upd
722   (
723   p_booking_id                   in number,
724   p_booking_status_type_id       in number           ,
725   p_delegate_person_id           in number           ,
726   p_contact_id                   in number           ,
727   p_business_group_id            in number           ,
728   p_event_id                     in number           ,
729   p_customer_id                  in number           ,
730   p_authorizer_person_id         in number           ,
731   p_date_booking_placed          in date             ,
732   p_corespondent                 in varchar2         ,
733   p_internal_booking_flag        in varchar2         ,
734   p_number_of_places             in number           ,
735   p_object_version_number        in out nocopy number,
736   p_administrator                in number           ,
737   p_booking_priority             in varchar2         ,
738   p_comments                     in varchar2         ,
739   p_contact_address_id           in number           ,
740   p_delegate_contact_phone       in varchar2         ,
741   p_delegate_contact_fax         in varchar2         ,
742   p_third_party_customer_id      in number           ,
743   p_third_party_contact_id       in number           ,
744   p_third_party_address_id       in number           ,
745   p_third_party_contact_phone    in varchar2         ,
746   p_third_party_contact_fax      in varchar2         ,
747   p_date_status_changed          in date             ,
748   p_status_change_comments       in varchar2         ,
749   p_failure_reason               in varchar2         ,
750   p_attendance_result            in varchar2         ,
751   p_language_id                  in number           ,
752   p_source_of_booking            in varchar2         ,
753   p_special_booking_instructions in varchar2         ,
754   p_successful_attendance_flag   in varchar2         ,
755   p_tdb_information_category     in varchar2         ,
756   p_tdb_information1             in varchar2         ,
757   p_tdb_information2             in varchar2         ,
758   p_tdb_information3             in varchar2         ,
759   p_tdb_information4             in varchar2         ,
760   p_tdb_information5             in varchar2         ,
761   p_tdb_information6             in varchar2         ,
762   p_tdb_information7             in varchar2         ,
763   p_tdb_information8             in varchar2         ,
764   p_tdb_information9             in varchar2         ,
765   p_tdb_information10            in varchar2         ,
766   p_tdb_information11            in varchar2         ,
767   p_tdb_information12            in varchar2         ,
768   p_tdb_information13            in varchar2         ,
769   p_tdb_information14            in varchar2         ,
770   p_tdb_information15            in varchar2         ,
771   p_tdb_information16            in varchar2         ,
772   p_tdb_information17            in varchar2         ,
773   p_tdb_information18            in varchar2         ,
774   p_tdb_information19            in varchar2         ,
775   p_tdb_information20            in varchar2         ,
776   p_update_finance_line          in varchar2         ,
777   p_tfl_object_version_number    in out nocopy number,
778   p_finance_header_id            in number           ,
779   p_finance_line_id              in out nocopy number,
780   p_standard_amount              in number           ,
781   p_unitary_amount               in number           ,
782   p_money_amount                 in number           ,
783   p_currency_code                in varchar2         ,
784   p_booking_deal_type            in varchar2         ,
785   p_booking_deal_id              in number           ,
786   p_enrollment_type              in varchar2         ,
787   p_validate                     in boolean          ,
788   p_organization_id              in number           ,
789   p_sponsor_person_id            in number           ,
790   p_sponsor_assignment_id        in number           ,
791   p_person_address_id            in number           ,
792   p_delegate_assignment_id       in number           ,
793   p_delegate_contact_id          in number           ,
794   p_delegate_contact_email       in varchar2         ,
795   p_third_party_email            in varchar2         ,
796   p_person_address_type          in varchar2         ,
797   p_line_id                                in number         ,
798   p_org_id                                 in number         ,
799   p_daemon_flag                    in varchar2       ,
800   p_daemon_type                    in varchar2       ,
801   p_old_event_id                 in number           ,
802   p_quote_line_id                in number           ,
803   p_interface_source             in varchar2         ,
804   p_total_training_time          in varchar2         ,
805   p_content_player_status        in varchar2         ,
806   p_score                              in number             ,
807   p_completed_content              in number         ,
808   p_total_content                      in number               ,
809   p_booking_justification_id               in number,
810   p_is_history_flag in varchar2
811   ) is
812 --
813   l_rec   ota_tdb_shd.g_rec_type;
814   l_proc  varchar2(72) := g_package||'upd';
815 --
816 Begin
817   hr_utility.set_location('Entering:'||l_proc, 5);
818   --
819   -- Call conversion function to turn arguments into the
820   -- l_rec structure.
821   --
822   l_rec :=
823   ota_tdb_shd.convert_args
824   (
825   p_booking_id,
826   p_booking_status_type_id,
827   p_delegate_person_id,
828   p_contact_id,
829   p_business_group_id,
830   p_event_id,
831   p_customer_id,
832   p_authorizer_person_id,
833   p_date_booking_placed,
834   p_corespondent,
835   p_internal_booking_flag,
836   p_number_of_places,
837   p_object_version_number,
838   p_administrator,
839   p_booking_priority,
840   p_comments,
841   p_contact_address_id,
842   p_delegate_contact_phone,
843   p_delegate_contact_fax,
844   p_third_party_customer_id,
845   p_third_party_contact_id,
846   p_third_party_address_id,
847   p_third_party_contact_phone,
848   p_third_party_contact_fax,
849   p_date_status_changed,
850   p_failure_reason,
851   p_attendance_result,
852   p_language_id,
853   p_source_of_booking,
854   p_special_booking_instructions,
855   p_successful_attendance_flag,
856   p_tdb_information_category,
857   p_tdb_information1,
858   p_tdb_information2,
859   p_tdb_information3,
860   p_tdb_information4,
861   p_tdb_information5,
862   p_tdb_information6,
863   p_tdb_information7,
864   p_tdb_information8,
865   p_tdb_information9,
866   p_tdb_information10,
867   p_tdb_information11,
868   p_tdb_information12,
869   p_tdb_information13,
870   p_tdb_information14,
871   p_tdb_information15,
872   p_tdb_information16,
873   p_tdb_information17,
874   p_tdb_information18,
875   p_tdb_information19,
876   p_tdb_information20,
877   p_organization_id,
878   p_sponsor_person_id,
879   p_sponsor_assignment_id,
880   p_person_address_id,
881   p_delegate_assignment_id,
882   p_delegate_contact_id,
883   p_delegate_contact_email,
884   p_third_party_email,
885   p_person_address_type,
886   p_line_id,
887   p_org_id,
888   p_daemon_flag,
889   p_daemon_type,
890   p_old_event_id,
891   p_quote_line_id,
892   p_interface_source,
893   p_total_training_time,
894   p_content_player_status,
895   p_score,
896   p_completed_content,
897   p_total_content ,
898   p_booking_justification_id,
899   p_is_history_flag
900   );
901   --
902   -- Having converted the arguments into the
903   -- plsql record structure we call the corresponding record
904   -- business process.
905   --
906   upd(l_rec,
907       p_status_change_comments,
908       p_update_finance_line,
909       p_tfl_object_version_number,
910       p_finance_header_id,
911       p_finance_line_id ,
912       p_standard_amount,
913       p_unitary_amount ,
914       p_money_amount  ,
915       p_currency_code,
916       p_booking_deal_type,
917       p_booking_deal_id,
918       p_enrollment_type,
919       p_validate
920       );
921 
922   --
923   p_object_version_number := l_rec.object_version_number;
924   --
925   hr_utility.set_location(' Leaving:'||l_proc, 10);
926 End upd;
927 --
928 end ota_tdb_upd;