DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_TDB_UPD

Source


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