DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_CTR_UPD

Source


1 Package Body per_ctr_upd as
2 /* $Header: pectrrhi.pkb 120.0.12000000.2 2007/02/19 11:59:36 ssutar ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_ctr_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 processing of
17 --   this procedure is:
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 Parameters:
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' attribute list should be modified if any of your
47 --   attributes are not updateable.
48 --
49 -- Access Status:
50 --   Internal Table Handler Use Only.
51 --
52 -- {End Of Comments}
53 -- ----------------------------------------------------------------------------
54 Procedure update_dml(p_rec in out nocopy per_ctr_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   per_ctr_shd.g_api_dml := true;  -- Set the api dml status
66   --
67   -- Update the per_contact_relationships Row
68   --
69   update per_contact_relationships
70   set
71   contact_type                      = p_rec.contact_type,
72   comments                          = p_rec.comments,
73   primary_contact_flag              = p_rec.primary_contact_flag,
74   request_id                        = p_rec.request_id,
75   program_application_id            = p_rec.program_application_id,
76   program_id                        = p_rec.program_id,
77   program_update_date               = p_rec.program_update_date,
78   date_start                        = p_rec.date_start,
79   start_life_reason_id              = p_rec.start_life_reason_id,
80   date_end                          = p_rec.date_end,
81   end_life_reason_id                = p_rec.end_life_reason_id,
82   rltd_per_rsds_w_dsgntr_flag       = p_rec.rltd_per_rsds_w_dsgntr_flag,
83   personal_flag                     = p_rec.personal_flag,
84   sequence_number                   = p_rec.sequence_number,
85   cont_attribute_category           = p_rec.cont_attribute_category,
86   cont_attribute1                   = p_rec.cont_attribute1,
87   cont_attribute2                   = p_rec.cont_attribute2,
88   cont_attribute3                   = p_rec.cont_attribute3,
89   cont_attribute4                   = p_rec.cont_attribute4,
90   cont_attribute5                   = p_rec.cont_attribute5,
91   cont_attribute6                   = p_rec.cont_attribute6,
92   cont_attribute7                   = p_rec.cont_attribute7,
93   cont_attribute8                   = p_rec.cont_attribute8,
94   cont_attribute9                   = p_rec.cont_attribute9,
95   cont_attribute10                  = p_rec.cont_attribute10,
96   cont_attribute11                  = p_rec.cont_attribute11,
97   cont_attribute12                  = p_rec.cont_attribute12,
98   cont_attribute13                  = p_rec.cont_attribute13,
99   cont_attribute14                  = p_rec.cont_attribute14,
100   cont_attribute15                  = p_rec.cont_attribute15,
101   cont_attribute16                  = p_rec.cont_attribute16,
102   cont_attribute17                  = p_rec.cont_attribute17,
103   cont_attribute18                  = p_rec.cont_attribute18,
104   cont_attribute19                  = p_rec.cont_attribute19,
105   cont_attribute20                  = p_rec.cont_attribute20,
106   cont_information_category           = p_rec.cont_information_category,
107   cont_information1                   = p_rec.cont_information1,
108   cont_information2                   = p_rec.cont_information2,
109   cont_information3                   = p_rec.cont_information3,
110   cont_information4                   = p_rec.cont_information4,
111   cont_information5                   = p_rec.cont_information5,
112   cont_information6                   = p_rec.cont_information6,
113   cont_information7                   = p_rec.cont_information7,
114   cont_information8                   = p_rec.cont_information8,
115   cont_information9                   = p_rec.cont_information9,
116   cont_information10                  = p_rec.cont_information10,
117   cont_information11                  = p_rec.cont_information11,
118   cont_information12                  = p_rec.cont_information12,
119   cont_information13                  = p_rec.cont_information13,
120   cont_information14                  = p_rec.cont_information14,
121   cont_information15                  = p_rec.cont_information15,
122   cont_information16                  = p_rec.cont_information16,
123   cont_information17                  = p_rec.cont_information17,
124   cont_information18                  = p_rec.cont_information18,
125   cont_information19                  = p_rec.cont_information19,
126   cont_information20                  = p_rec.cont_information20,
127   third_party_pay_flag              = p_rec.third_party_pay_flag,
128   bondholder_flag                   = p_rec.bondholder_flag,
129   dependent_flag                    = p_rec.dependent_flag,
130   beneficiary_flag                  = p_rec.beneficiary_flag,
131   object_version_number             = p_rec.object_version_number
132   where contact_relationship_id = p_rec.contact_relationship_id;
133   --
134   per_ctr_shd.g_api_dml := false;   -- Unset the api dml status
135   --
136   hr_utility.set_location(' Leaving:'||l_proc, 10);
137 --
138 Exception
139   When hr_api.check_integrity_violated Then
140     -- A check constraint has been violated
141     per_ctr_shd.g_api_dml := false;   -- Unset the api dml status
142     per_ctr_shd.constraint_error
143       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
144   When hr_api.parent_integrity_violated Then
145     -- Parent integrity has been violated
146     per_ctr_shd.g_api_dml := false;   -- Unset the api dml status
147     per_ctr_shd.constraint_error
148       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
149   When hr_api.unique_integrity_violated Then
150     -- Unique integrity has been violated
151     per_ctr_shd.g_api_dml := false;   -- Unset the api dml status
152     per_ctr_shd.constraint_error
153       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
154   When Others Then
155     per_ctr_shd.g_api_dml := false;   -- Unset the api dml status
156     Raise;
157 End update_dml;
158 --
159 -- ----------------------------------------------------------------------------
160 -- |------------------------------< pre_update >------------------------------|
161 -- ----------------------------------------------------------------------------
162 -- {Start Of Comments}
163 --
164 -- Description:
165 --   This private procedure contains any processing which is required before
166 --   the update dml.
167 --
168 -- Pre Conditions:
169 --   This is an internal procedure which is called from the upd procedure.
170 --
171 -- In Parameters:
172 --   A Pl/Sql record structre.
173 --
174 -- Post Success:
175 --   Processing continues.
176 --
177 -- Post Failure:
178 --   If an error has occurred, an error message and exception will be raised
179 --   but not handled.
180 --
181 -- Developer Implementation Notes:
182 --   Any pre-processing required before the update dml is issued should be
183 --   coded within this procedure. It is important to note that any 3rd party
184 --   maintenance should be reviewed before placing in this procedure.
185 --
186 -- Access Status:
187 --   Internal Table Handler Use Only.
188 --
189 -- {End Of Comments}
190 -- ----------------------------------------------------------------------------
191 Procedure pre_update(p_rec in per_ctr_shd.g_rec_type) is
192 --
193   l_proc  varchar2(72) := g_package||'pre_update';
194 --
195 Begin
196   hr_utility.set_location('Entering:'||l_proc, 5);
197   --
198   hr_utility.set_location(' Leaving:'||l_proc, 10);
199 End pre_update;
200 --
201 -- ----------------------------------------------------------------------------
202 -- |-----------------------------< post_update >------------------------------|
203 -- ----------------------------------------------------------------------------
204 -- {Start Of Comments}
205 --
206 -- Description:
207 --   This private procedure contains any processing which is required after the
208 --   update dml.
209 --
210 -- Pre Conditions:
211 --   This is an internal procedure which is called from the upd procedure.
212 --
213 -- In Parameters:
214 --   A Pl/Sql record structre.
215 --
216 -- Post Success:
217 --   Processing continues.
218 --
219 -- Post Failure:
220 --   If an error has occurred, an error message and exception will be raised
221 --   but not handled.
222 --
223 -- Developer Implementation Notes:
224 --   Any post-processing required after the update dml is issued should be
225 --   coded within this procedure. It is important to note that any 3rd party
226 --   maintenance should be reviewed before placing in this procedure.
227 --
228 -- Access Status:
229 --   Internal Table Handler Use Only.
230 --
231 -- {End Of Comments}
232 -- ----------------------------------------------------------------------------
233 Procedure post_update(p_rec            in per_ctr_shd.g_rec_type,
234                       p_effective_date in date) is
235 --
236   l_proc  varchar2(72) := g_package||'post_update';
237   --
238   -- Start of fix for WWBUG 1408379
239   --
240   l_old ben_con_ler.g_con_ler_rec;
241   l_new ben_con_ler.g_con_ler_rec;
242   --
243   -- End of fix for WWBUG 1408379
244   --
245 --
246 Begin
247   hr_utility.set_location('Entering:'||l_proc, 5);
248   --
249   -- Start of API User Hook for post_update.
250   begin
251     per_ctr_rku.after_update
252       (p_contact_relationship_id        => p_rec.contact_relationship_id
253       ,p_business_group_id              => p_rec.business_group_id
254       ,p_person_id                      => p_rec.person_id
255       ,p_contact_person_id              => p_rec.contact_person_id
256       ,p_contact_type                   => p_rec.contact_type
257       ,p_comments                       => p_rec.comments
258       ,p_primary_contact_flag           => p_rec.primary_contact_flag
259       ,p_request_id                     => p_rec.request_id
260       ,p_program_application_id         => p_rec.program_application_id
261       ,p_program_id                     => p_rec.program_id
262       ,p_program_update_date            => p_rec.program_update_date
263       ,p_date_start                     => p_rec.date_start
264       ,p_start_life_reason_id           => p_rec.start_life_reason_id
265       ,p_date_end                       => p_rec.date_end
266       ,p_end_life_reason_id             => p_rec.end_life_reason_id
267       ,p_rltd_per_rsds_w_dsgntr_flag    => p_rec.rltd_per_rsds_w_dsgntr_flag
268       ,p_personal_flag                  => p_rec.personal_flag
269       ,p_sequence_number                => p_rec.sequence_number
270       ,p_cont_attribute_category        => p_rec.cont_attribute_category
271       ,p_cont_attribute1                => p_rec.cont_attribute1
272       ,p_cont_attribute2                => p_rec.cont_attribute2
273       ,p_cont_attribute3                => p_rec.cont_attribute3
274       ,p_cont_attribute4                => p_rec.cont_attribute4
275       ,p_cont_attribute5                => p_rec.cont_attribute5
276       ,p_cont_attribute6                => p_rec.cont_attribute6
277       ,p_cont_attribute7                => p_rec.cont_attribute7
278       ,p_cont_attribute8                => p_rec.cont_attribute8
279       ,p_cont_attribute9                => p_rec.cont_attribute9
280       ,p_cont_attribute10               => p_rec.cont_attribute10
281       ,p_cont_attribute11               => p_rec.cont_attribute11
282       ,p_cont_attribute12               => p_rec.cont_attribute12
283       ,p_cont_attribute13               => p_rec.cont_attribute13
284       ,p_cont_attribute14               => p_rec.cont_attribute14
285       ,p_cont_attribute15               => p_rec.cont_attribute15
286       ,p_cont_attribute16               => p_rec.cont_attribute16
287       ,p_cont_attribute17               => p_rec.cont_attribute17
288       ,p_cont_attribute18               => p_rec.cont_attribute18
289       ,p_cont_attribute19               => p_rec.cont_attribute19
290       ,p_cont_attribute20               => p_rec.cont_attribute20
291       ,p_cont_information_category        => p_rec.cont_information_category
292       ,p_cont_information1                => p_rec.cont_information1
293       ,p_cont_information2                => p_rec.cont_information2
294       ,p_cont_information3                => p_rec.cont_information3
295       ,p_cont_information4                => p_rec.cont_information4
296       ,p_cont_information5                => p_rec.cont_information5
297       ,p_cont_information6                => p_rec.cont_information6
298       ,p_cont_information7                => p_rec.cont_information7
299       ,p_cont_information8                => p_rec.cont_information8
300       ,p_cont_information9                => p_rec.cont_information9
301       ,p_cont_information10               => p_rec.cont_information10
302       ,p_cont_information11               => p_rec.cont_information11
303       ,p_cont_information12               => p_rec.cont_information12
304       ,p_cont_information13               => p_rec.cont_information13
305       ,p_cont_information14               => p_rec.cont_information14
306       ,p_cont_information15               => p_rec.cont_information15
307       ,p_cont_information16               => p_rec.cont_information16
308       ,p_cont_information17               => p_rec.cont_information17
309       ,p_cont_information18               => p_rec.cont_information18
310       ,p_cont_information19               => p_rec.cont_information19
311       ,p_cont_information20               => p_rec.cont_information20
312       ,p_third_party_pay_flag           => p_rec.third_party_pay_flag
313       ,p_bondholder_flag                => p_rec.bondholder_flag
314       ,p_dependent_flag                 => p_rec.dependent_flag
315       ,p_beneficiary_flag               => p_rec.beneficiary_flag
316       ,p_object_version_number          => p_rec.object_version_number
317       ,p_effective_date                 => p_effective_date
318       ,p_business_group_id_o
319           => per_ctr_shd.g_old_rec.business_group_id
320       ,p_person_id_o
321           => per_ctr_shd.g_old_rec.person_id
322       ,p_contact_person_id_o
323           => per_ctr_shd.g_old_rec.contact_person_id
324       ,p_contact_type_o
325           => per_ctr_shd.g_old_rec.contact_type
326       ,p_comments_o
327           => per_ctr_shd.g_old_rec.comments
328       ,p_primary_contact_flag_o
329           => per_ctr_shd.g_old_rec.primary_contact_flag
330       ,p_request_id_o
331           => per_ctr_shd.g_old_rec.request_id
332       ,p_program_application_id_o
333           => per_ctr_shd.g_old_rec.program_application_id
334       ,p_program_id_o
335           => per_ctr_shd.g_old_rec.program_id
336       ,p_program_update_date_o
337           => per_ctr_shd.g_old_rec.program_update_date
338       ,p_date_start_o
339           => per_ctr_shd.g_old_rec.date_start
340       ,p_start_life_id_o
341           => per_ctr_shd.g_old_rec.start_life_reason_id
342       ,p_date_end_o
343           => per_ctr_shd.g_old_rec.date_end
344       ,p_end_life_id_o
345           => per_ctr_shd.g_old_rec.end_life_reason_id
346       ,p_rltd_per_dsgntr_flag_o
347          => per_ctr_shd.g_old_rec.rltd_per_rsds_w_dsgntr_flag
348       ,p_personal_flag_o
349          => per_ctr_shd.g_old_rec.personal_flag
350       ,p_sequence_number_o
351     => per_ctr_shd.g_old_rec.sequence_number
352       ,p_cont_attribute_category_o
353           => per_ctr_shd.g_old_rec.cont_attribute_category
354       ,p_cont_attribute1_o
355           => per_ctr_shd.g_old_rec.cont_attribute1
356       ,p_cont_attribute2_o
357           => per_ctr_shd.g_old_rec.cont_attribute2
358       ,p_cont_attribute3_o
359           => per_ctr_shd.g_old_rec.cont_attribute3
360       ,p_cont_attribute4_o
361           => per_ctr_shd.g_old_rec.cont_attribute4
362       ,p_cont_attribute5_o
363           => per_ctr_shd.g_old_rec.cont_attribute5
364       ,p_cont_attribute6_o
365           => per_ctr_shd.g_old_rec.cont_attribute6
366       ,p_cont_attribute7_o
367           => per_ctr_shd.g_old_rec.cont_attribute7
368       ,p_cont_attribute8_o
369           => per_ctr_shd.g_old_rec.cont_attribute8
370       ,p_cont_attribute9_o
371           => per_ctr_shd.g_old_rec.cont_attribute9
372       ,p_cont_attribute10_o
373           => per_ctr_shd.g_old_rec.cont_attribute10
374       ,p_cont_attribute11_o
375           => per_ctr_shd.g_old_rec.cont_attribute11
376       ,p_cont_attribute12_o
377           => per_ctr_shd.g_old_rec.cont_attribute12
378       ,p_cont_attribute13_o
379           => per_ctr_shd.g_old_rec.cont_attribute13
380       ,p_cont_attribute14_o
381           => per_ctr_shd.g_old_rec.cont_attribute14
382       ,p_cont_attribute15_o
383           => per_ctr_shd.g_old_rec.cont_attribute15
384       ,p_cont_attribute16_o
385           => per_ctr_shd.g_old_rec.cont_attribute16
386       ,p_cont_attribute17_o
387           => per_ctr_shd.g_old_rec.cont_attribute17
388       ,p_cont_attribute18_o
389           => per_ctr_shd.g_old_rec.cont_attribute18
390       ,p_cont_attribute19_o
391           => per_ctr_shd.g_old_rec.cont_attribute19
392       ,p_cont_attribute20_o
393           => per_ctr_shd.g_old_rec.cont_attribute20
394       ,p_cont_information_category_o
395           => per_ctr_shd.g_old_rec.cont_information_category
396       ,p_cont_information1_o
397           => per_ctr_shd.g_old_rec.cont_information1
398       ,p_cont_information2_o
399           => per_ctr_shd.g_old_rec.cont_information2
400       ,p_cont_information3_o
401           => per_ctr_shd.g_old_rec.cont_information3
402       ,p_cont_information4_o
403           => per_ctr_shd.g_old_rec.cont_information4
404       ,p_cont_information5_o
405           => per_ctr_shd.g_old_rec.cont_information5
406       ,p_cont_information6_o
407           => per_ctr_shd.g_old_rec.cont_information6
408       ,p_cont_information7_o
409           => per_ctr_shd.g_old_rec.cont_information7
410       ,p_cont_information8_o
411           => per_ctr_shd.g_old_rec.cont_information8
412       ,p_cont_information9_o
413           => per_ctr_shd.g_old_rec.cont_information9
414       ,p_cont_information10_o
415           => per_ctr_shd.g_old_rec.cont_information10
416       ,p_cont_information11_o
417           => per_ctr_shd.g_old_rec.cont_information11
418       ,p_cont_information12_o
419           => per_ctr_shd.g_old_rec.cont_information12
420       ,p_cont_information13_o
421           => per_ctr_shd.g_old_rec.cont_information13
422       ,p_cont_information14_o
423           => per_ctr_shd.g_old_rec.cont_information14
424       ,p_cont_information15_o
425           => per_ctr_shd.g_old_rec.cont_information15
426       ,p_cont_information16_o
427           => per_ctr_shd.g_old_rec.cont_information16
428       ,p_cont_information17_o
429           => per_ctr_shd.g_old_rec.cont_information17
430       ,p_cont_information18_o
431           => per_ctr_shd.g_old_rec.cont_information18
432       ,p_cont_information19_o
433           => per_ctr_shd.g_old_rec.cont_information19
434       ,p_cont_information20_o
435           => per_ctr_shd.g_old_rec.cont_information20
436       ,p_third_party_pay_flag_o
437           => per_ctr_shd.g_old_rec.third_party_pay_flag
438       ,p_bondholder_flag_o
439           => per_ctr_shd.g_old_rec.bondholder_flag
440       ,p_dependent_flag_o
441           => per_ctr_shd.g_old_rec.dependent_flag
442       ,p_beneficiary_flag_o
443           => per_ctr_shd.g_old_rec.beneficiary_flag
444       ,p_object_version_number_o
445           => per_ctr_shd.g_old_rec.object_version_number
446       );
447   exception
448     when hr_api.cannot_find_prog_unit then
449       hr_api.cannot_find_prog_unit_error
450         (p_module_name => 'PER_CONTACT_RELATIONSHIPS'
451         ,p_hook_type   => 'AU'
452         );
453   end;
454   --
455   -- Start of Fix for WWBUG 1408379
456   --
457   l_old.person_id := per_ctr_shd.g_old_rec.person_id;
458   l_old.contact_person_id := per_ctr_shd.g_old_rec.contact_person_id;
459   l_old.business_group_id := per_ctr_shd.g_old_rec.business_group_id;
460   l_old.date_start := per_ctr_shd.g_old_rec.date_start;
461   l_old.date_end := per_ctr_shd.g_old_rec.date_end;
462   l_old.contact_type := per_ctr_shd.g_old_rec.contact_type;
463   l_old.personal_flag := per_ctr_shd.g_old_rec.personal_flag;
464   l_old.start_life_reason_id := per_ctr_shd.g_old_rec.start_life_reason_id;
465   l_old.end_life_reason_id := per_ctr_shd.g_old_rec.end_life_reason_id;
466   l_old.rltd_per_rsds_w_dsgntr_flag := per_ctr_shd.g_old_rec.rltd_per_rsds_w_dsgntr_flag;
467   l_old.contact_relationship_id := per_ctr_shd.g_old_rec.contact_relationship_id;
468   l_new.person_id := p_rec.person_id;
469   l_new.contact_person_id := p_rec.contact_person_id;
470   l_new.business_group_id := p_rec.business_group_id;
471   l_new.date_start := p_rec.date_start;
472   l_new.date_end := p_rec.date_end;
473   l_new.contact_type := p_rec.contact_type;
474   l_new.personal_flag := p_rec.personal_flag;
475   l_new.start_life_reason_id := p_rec.start_life_reason_id;
476   l_new.end_life_reason_id := p_rec.end_life_reason_id;
477   l_new.rltd_per_rsds_w_dsgntr_flag := p_rec.rltd_per_rsds_w_dsgntr_flag;
478   l_new.contact_relationship_id := p_rec.contact_relationship_id;
479   --
480   ben_con_ler.ler_chk(p_old            => l_old,
481                       p_new            => l_new,
482                       p_effective_date => p_effective_date);
483   --
484   -- End of Fix for WWBUG 1408379
485   --
486   --
487   -- End of API User Hook for post_update.
488   --
489   hr_utility.set_location(' Leaving:'||l_proc, 10);
490 End post_update;
491 --
492 -- ----------------------------------------------------------------------------
493 -- |-----------------------------< convert_defs >-----------------------------|
494 -- ----------------------------------------------------------------------------
495 -- {Start Of Comments}
496 --
497 -- Description:
498 --   The Convert_Defs procedure has one very important function:
499 --   It must return the record structure for the row with all system defaulted
500 --   values converted into its corresponding parameter value for update. When
501 --   we attempt to update a row through the Upd process , certain
502 --   parameters can be defaulted which enables flexibility in the calling of
503 --   the upd process (e.g. only attributes which need to be updated need to be
504 --   specified). For the upd process to determine which attributes
505 --   have NOT been specified we need to check if the parameter has a reserved
506 --   system default value. Therefore, for all parameters which have a
507 --   corresponding reserved system default mechanism specified we need to
508 --   check if a system default is being used. If a system default is being
509 --   used then we convert the defaulted value into its corresponding attribute
510 --   value held in the g_old_rec data structure.
511 --
512 -- Pre Conditions:
513 --   This private function can only be called from the upd process.
514 --
515 -- In Parameters:
516 --   A Pl/Sql record structre.
517 --
518 -- Post Success:
519 --   The record structure will be returned with all system defaulted parameter
520 --   values converted into its current row attribute value.
521 --
522 -- Post Failure:
523 --   No direct error handling is required within this function. Any possible
524 --   errors within this procedure will be a PL/SQL value error due to conversion
525 
526 --   of datatypes or data lengths.
527 --
528 -- Developer Implementation Notes:
529 --   None.
530 --
531 -- Access Status:
532 --   Internal Table Handler Use Only.
533 --
534 -- {End Of Comments}
535 -- ----------------------------------------------------------------------------
536 Procedure convert_defs(p_rec in out nocopy per_ctr_shd.g_rec_type) is
537 --
538   l_proc  varchar2(72) := g_package||'convert_defs';
539 --
540 Begin
541   --
542   hr_utility.set_location('Entering:'||l_proc, 5);
543   --
544   -- We must now examine each argument value in the
545   -- p_rec plsql record structure
546   -- to see if a system default is being used. If a system default
547   -- is being used then we must set to the 'current' argument value.
548   --
549   If (p_rec.business_group_id = hr_api.g_number) then
550     p_rec.business_group_id :=
551     per_ctr_shd.g_old_rec.business_group_id;
552   End If;
553   If (p_rec.person_id = hr_api.g_number) then
554     p_rec.person_id :=
555     per_ctr_shd.g_old_rec.person_id;
556   End If;
557   If (p_rec.contact_person_id = hr_api.g_number) then
558     p_rec.contact_person_id :=
559     per_ctr_shd.g_old_rec.contact_person_id;
560   End If;
561   If (p_rec.contact_type = hr_api.g_varchar2) then
562     p_rec.contact_type :=
563     per_ctr_shd.g_old_rec.contact_type;
564   End If;
565   If (p_rec.comments = hr_api.g_varchar2) then
566     p_rec.comments :=
567     per_ctr_shd.g_old_rec.comments;
568   End If;
569   If (p_rec.primary_contact_flag = hr_api.g_varchar2) then
570     p_rec.primary_contact_flag :=
571     per_ctr_shd.g_old_rec.primary_contact_flag;
572   End If;
573   If (p_rec.request_id = hr_api.g_number) then
574     p_rec.request_id :=
575     per_ctr_shd.g_old_rec.request_id;
576   End If;
577   If (p_rec.program_application_id = hr_api.g_number) then
578     p_rec.program_application_id :=
579     per_ctr_shd.g_old_rec.program_application_id;
580   End If;
581   If (p_rec.program_id = hr_api.g_number) then
582     p_rec.program_id :=
583     per_ctr_shd.g_old_rec.program_id;
584   End If;
585   If (p_rec.program_update_date = hr_api.g_date) then
586     p_rec.program_update_date :=
587     per_ctr_shd.g_old_rec.program_update_date;
588   End If;
589   If (p_rec.date_start = hr_api.g_date) then
590     p_rec.date_start :=
591      per_ctr_shd.g_old_rec.date_start;
592   End If;
593   If (p_rec.start_life_reason_id = hr_api.g_number) then
594     p_rec.start_life_reason_id :=
595       per_ctr_shd.g_old_rec.start_life_reason_id;
596   End If;
597   If (p_rec.date_end = hr_api.g_date) then
598     p_rec.date_end :=
599        per_ctr_shd.g_old_rec.date_end;
600   End If;
601   If (p_rec.end_life_reason_id = hr_api.g_number) then
602     p_rec.end_life_reason_id :=
603       per_ctr_shd.g_old_rec.end_life_reason_id;
604   End If;
605   If (p_rec.rltd_per_rsds_w_dsgntr_flag = hr_api.g_varchar2) then
606     p_rec.rltd_per_rsds_w_dsgntr_flag :=
607       per_ctr_shd.g_old_rec.rltd_per_rsds_w_dsgntr_flag;
608   End If;
609   If (p_rec.personal_flag = hr_api.g_varchar2) then
610     p_rec.personal_flag :=
611       per_ctr_shd.g_old_rec.personal_flag;
612   End If;
613   If (p_rec.sequence_number = hr_api.g_number) then
614     p_rec.sequence_number :=
615       per_ctr_shd.g_old_rec.sequence_number;
616   End If;
617   If (p_rec.cont_attribute_category = hr_api.g_varchar2) then
618     p_rec.cont_attribute_category :=
619     per_ctr_shd.g_old_rec.cont_attribute_category;
620   End If;
621   If (p_rec.cont_attribute1 = hr_api.g_varchar2) then
622     p_rec.cont_attribute1 :=
623     per_ctr_shd.g_old_rec.cont_attribute1;
624   End If;
625   If (p_rec.cont_attribute2 = hr_api.g_varchar2) then
626     p_rec.cont_attribute2 :=
627     per_ctr_shd.g_old_rec.cont_attribute2;
628   End If;
629   If (p_rec.cont_attribute3 = hr_api.g_varchar2) then
630     p_rec.cont_attribute3 :=
631     per_ctr_shd.g_old_rec.cont_attribute3;
632   End If;
633   If (p_rec.cont_attribute4 = hr_api.g_varchar2) then
634     p_rec.cont_attribute4 :=
635     per_ctr_shd.g_old_rec.cont_attribute4;
636   End If;
637   If (p_rec.cont_attribute5 = hr_api.g_varchar2) then
638     p_rec.cont_attribute5 :=
639     per_ctr_shd.g_old_rec.cont_attribute5;
640   End If;
641   If (p_rec.cont_attribute6 = hr_api.g_varchar2) then
642     p_rec.cont_attribute6 :=
643     per_ctr_shd.g_old_rec.cont_attribute6;
644   End If;
645   If (p_rec.cont_attribute7 = hr_api.g_varchar2) then
646     p_rec.cont_attribute7 :=
647     per_ctr_shd.g_old_rec.cont_attribute7;
648   End If;
649   If (p_rec.cont_attribute8 = hr_api.g_varchar2) then
650     p_rec.cont_attribute8 :=
651     per_ctr_shd.g_old_rec.cont_attribute8;
652   End If;
653   If (p_rec.cont_attribute9 = hr_api.g_varchar2) then
654     p_rec.cont_attribute9 :=
655     per_ctr_shd.g_old_rec.cont_attribute9;
656   End If;
657   If (p_rec.cont_attribute10 = hr_api.g_varchar2) then
658     p_rec.cont_attribute10 :=
659     per_ctr_shd.g_old_rec.cont_attribute10;
660   End If;
661   If (p_rec.cont_attribute11 = hr_api.g_varchar2) then
662     p_rec.cont_attribute11 :=
663     per_ctr_shd.g_old_rec.cont_attribute11;
664   End If;
665   If (p_rec.cont_attribute12 = hr_api.g_varchar2) then
666     p_rec.cont_attribute12 :=
667     per_ctr_shd.g_old_rec.cont_attribute12;
668   End If;
669   If (p_rec.cont_attribute13 = hr_api.g_varchar2) then
670     p_rec.cont_attribute13 :=
671     per_ctr_shd.g_old_rec.cont_attribute13;
672   End If;
673   If (p_rec.cont_attribute14 = hr_api.g_varchar2) then
674     p_rec.cont_attribute14 :=
675     per_ctr_shd.g_old_rec.cont_attribute14;
676   End If;
677   If (p_rec.cont_attribute15 = hr_api.g_varchar2) then
678     p_rec.cont_attribute15 :=
679     per_ctr_shd.g_old_rec.cont_attribute15;
680   End If;
681   If (p_rec.cont_attribute16 = hr_api.g_varchar2) then
682     p_rec.cont_attribute16 :=
683     per_ctr_shd.g_old_rec.cont_attribute16;
684   End If;
685   If (p_rec.cont_attribute17 = hr_api.g_varchar2) then
686     p_rec.cont_attribute17 :=
687     per_ctr_shd.g_old_rec.cont_attribute17;
688   End If;
689   If (p_rec.cont_attribute18 = hr_api.g_varchar2) then
690     p_rec.cont_attribute18 :=
691     per_ctr_shd.g_old_rec.cont_attribute18;
692   End If;
693   If (p_rec.cont_attribute19 = hr_api.g_varchar2) then
694     p_rec.cont_attribute19 :=
695     per_ctr_shd.g_old_rec.cont_attribute19;
696   End If;
697   If (p_rec.cont_attribute20 = hr_api.g_varchar2) then
698     p_rec.cont_attribute20 :=
699     per_ctr_shd.g_old_rec.cont_attribute20;
700   End If;
701   If (p_rec.cont_information_category = hr_api.g_varchar2) then
702     p_rec.cont_information_category :=
703     per_ctr_shd.g_old_rec.cont_information_category;
704   End If;
705   If (p_rec.cont_information1 = hr_api.g_varchar2) then
706     p_rec.cont_information1 :=
707     per_ctr_shd.g_old_rec.cont_information1;
708   End If;
709   If (p_rec.cont_information2 = hr_api.g_varchar2) then
710     p_rec.cont_information2 :=
711     per_ctr_shd.g_old_rec.cont_information2;
712   End If;
713   If (p_rec.cont_information3 = hr_api.g_varchar2) then
714     p_rec.cont_information3 :=
715     per_ctr_shd.g_old_rec.cont_information3;
716   End If;
717   If (p_rec.cont_information4 = hr_api.g_varchar2) then
718     p_rec.cont_information4 :=
719     per_ctr_shd.g_old_rec.cont_information4;
720   End If;
721   If (p_rec.cont_information5 = hr_api.g_varchar2) then
722     p_rec.cont_information5 :=
723     per_ctr_shd.g_old_rec.cont_information5;
724   End If;
725   If (p_rec.cont_information6 = hr_api.g_varchar2) then
726     p_rec.cont_information6 :=
727     per_ctr_shd.g_old_rec.cont_information6;
728   End If;
729   If (p_rec.cont_information7 = hr_api.g_varchar2) then
730     p_rec.cont_information7 :=
731     per_ctr_shd.g_old_rec.cont_information7;
732   End If;
733   If (p_rec.cont_information8 = hr_api.g_varchar2) then
734     p_rec.cont_information8 :=
735     per_ctr_shd.g_old_rec.cont_information8;
736   End If;
737   If (p_rec.cont_information9 = hr_api.g_varchar2) then
738     p_rec.cont_information9 :=
739     per_ctr_shd.g_old_rec.cont_information9;
740   End If;
741   If (p_rec.cont_information10 = hr_api.g_varchar2) then
742     p_rec.cont_information10 :=
743     per_ctr_shd.g_old_rec.cont_information10;
744   End If;
745   If (p_rec.cont_information11 = hr_api.g_varchar2) then
746     p_rec.cont_information11 :=
747     per_ctr_shd.g_old_rec.cont_information11;
748   End If;
749   If (p_rec.cont_information12 = hr_api.g_varchar2) then
750     p_rec.cont_information12 :=
751     per_ctr_shd.g_old_rec.cont_information12;
752   End If;
753   If (p_rec.cont_information13 = hr_api.g_varchar2) then
754     p_rec.cont_information13 :=
755     per_ctr_shd.g_old_rec.cont_information13;
756   End If;
757   If (p_rec.cont_information14 = hr_api.g_varchar2) then
758     p_rec.cont_information14 :=
759     per_ctr_shd.g_old_rec.cont_information14;
760   End If;
761   If (p_rec.cont_information15 = hr_api.g_varchar2) then
762     p_rec.cont_information15 :=
763     per_ctr_shd.g_old_rec.cont_information15;
764   End If;
765   If (p_rec.cont_information16 = hr_api.g_varchar2) then
766     p_rec.cont_information16 :=
767     per_ctr_shd.g_old_rec.cont_information16;
768   End If;
769   If (p_rec.cont_information17 = hr_api.g_varchar2) then
770     p_rec.cont_information17 :=
771     per_ctr_shd.g_old_rec.cont_information17;
772   End If;
773   If (p_rec.cont_information18 = hr_api.g_varchar2) then
774     p_rec.cont_information18 :=
775     per_ctr_shd.g_old_rec.cont_information18;
776   End If;
777   If (p_rec.cont_information19 = hr_api.g_varchar2) then
778     p_rec.cont_information19 :=
779     per_ctr_shd.g_old_rec.cont_information19;
780   End If;
781   If (p_rec.cont_information20 = hr_api.g_varchar2) then
782     p_rec.cont_information20 :=
783     per_ctr_shd.g_old_rec.cont_information20;
784   End If;
785   If (p_rec.third_party_pay_flag = hr_api.g_varchar2) then
786     p_rec.third_party_pay_flag :=
787     per_ctr_shd.g_old_rec.third_party_pay_flag;
788   End If;
789   If (p_rec.bondholder_flag = hr_api.g_varchar2) then
790     p_rec.bondholder_flag :=
791     per_ctr_shd.g_old_rec.bondholder_flag;
792   End If;
793   If (p_rec.dependent_flag = hr_api.g_varchar2) then
794     p_rec.dependent_flag :=
795     per_ctr_shd.g_old_rec.dependent_flag;
796   End If;
797   If (p_rec.beneficiary_flag = hr_api.g_varchar2) then
798     p_rec.beneficiary_flag :=
799     per_ctr_shd.g_old_rec.beneficiary_flag;
800   End If;
801   --
802   hr_utility.set_location(' Leaving:'||l_proc, 10);
803 --
804 End convert_defs;
805 --
806 -- ----------------------------------------------------------------------------
807 -- |---------------------------------< upd >----------------------------------|
808 -- ----------------------------------------------------------------------------
809 Procedure upd
810   (
811   p_rec            in out nocopy per_ctr_shd.g_rec_type,
812   p_effective_date in date,
813   p_validate       in     boolean default false
814   ) is
815 --
816   l_proc  varchar2(72) := g_package||'upd';
817 --
818 Begin
819   hr_utility.set_location('Entering:'||l_proc, 5);
820   --
821   -- Determine if the business process is to be validated.
822   --
823   If p_validate then
824     --
825     -- Issue the savepoint.
826     --
827     SAVEPOINT upd_per_ctr;
828   End If;
829   --
830   -- We must lock the row which we need to update.
831   --
832   per_ctr_shd.lck
833    (
834    p_rec.contact_relationship_id,
835    p_rec.object_version_number
836    );
837   --
838   -- 1. During an update system defaults are used to determine if
839   --    arguments have been defaulted or not. We must therefore
840   --    derive the full record structure values to be updated.
841   --
842   -- 2. Call the supporting update validate operations.
843   --
844   convert_defs(p_rec);
845   per_ctr_bus.update_validate(p_rec
846                              ,p_effective_date);
847   --
848   -- Call the supporting pre-update operation
849   --
850   pre_update(p_rec);
851   --
852   -- Update the row.
853   --
854   update_dml(p_rec);
855   --
856   -- Call the supporting post-update operation
857   --
858   post_update(p_rec
859              ,p_effective_date);
860   --
861   -- If we are validating then raise the Validate_Enabled exception
862   --
863   If p_validate then
864     Raise HR_Api.Validate_Enabled;
865   End If;
866   --
867   hr_utility.set_location(' Leaving:'||l_proc, 10);
868 Exception
869   When HR_Api.Validate_Enabled Then
870     --
871     -- As the Validate_Enabled exception has been raised
872     -- we must rollback to the savepoint
873     --
874     ROLLBACK TO upd_per_ctr;
875 End upd;
876 --
877 -- ----------------------------------------------------------------------------
878 -- |---------------------------------< upd >----------------------------------|
879 -- ----------------------------------------------------------------------------
880 Procedure upd
881   (
882   p_contact_relationship_id      in number,
883   p_contact_type                 in varchar2         default hr_api.g_varchar2,
884   p_comments                     in long             default hr_api.g_varchar2,
885   p_primary_contact_flag         in varchar2         default hr_api.g_varchar2,
886   p_request_id                   in number           default hr_api.g_number,
887   p_program_application_id       in number           default hr_api.g_number,
888   p_program_id                   in number           default hr_api.g_number,
889   p_program_update_date          in date             default hr_api.g_date,
890   p_date_start                   in date             default hr_api.g_date,
891   p_start_life_reason_id         in number           default hr_api.g_number,
892   p_date_end                     in date             default hr_api.g_date,
893   p_end_life_reason_id           in number           default hr_api.g_number,
894   p_rltd_per_rsds_w_dsgntr_flag  in varchar2         default hr_api.g_varchar2,
895   p_personal_flag                in varchar2         default hr_api.g_varchar2,
896   p_sequence_number              in number           default hr_api.g_number,
897   p_cont_attribute_category      in varchar2         default hr_api.g_varchar2,
898   p_cont_attribute1              in varchar2         default hr_api.g_varchar2,
899   p_cont_attribute2              in varchar2         default hr_api.g_varchar2,
900   p_cont_attribute3              in varchar2         default hr_api.g_varchar2,
901   p_cont_attribute4              in varchar2         default hr_api.g_varchar2,
902   p_cont_attribute5              in varchar2         default hr_api.g_varchar2,
903   p_cont_attribute6              in varchar2         default hr_api.g_varchar2,
904   p_cont_attribute7              in varchar2         default hr_api.g_varchar2,
905   p_cont_attribute8              in varchar2         default hr_api.g_varchar2,
906   p_cont_attribute9              in varchar2         default hr_api.g_varchar2,
907   p_cont_attribute10             in varchar2         default hr_api.g_varchar2,
908   p_cont_attribute11             in varchar2         default hr_api.g_varchar2,
909   p_cont_attribute12             in varchar2         default hr_api.g_varchar2,
910   p_cont_attribute13             in varchar2         default hr_api.g_varchar2,
911   p_cont_attribute14             in varchar2         default hr_api.g_varchar2,
912   p_cont_attribute15             in varchar2         default hr_api.g_varchar2,
913   p_cont_attribute16             in varchar2         default hr_api.g_varchar2,
914   p_cont_attribute17             in varchar2         default hr_api.g_varchar2,
915   p_cont_attribute18             in varchar2         default hr_api.g_varchar2,
916   p_cont_attribute19             in varchar2         default hr_api.g_varchar2,
917   p_cont_attribute20             in varchar2         default hr_api.g_varchar2,
918   p_cont_information_category      in varchar2         default hr_api.g_varchar2,
919   p_cont_information1              in varchar2         default hr_api.g_varchar2,
920   p_cont_information2              in varchar2         default hr_api.g_varchar2,
921   p_cont_information3              in varchar2         default hr_api.g_varchar2,
922   p_cont_information4              in varchar2         default hr_api.g_varchar2,
923   p_cont_information5              in varchar2         default hr_api.g_varchar2,
924   p_cont_information6              in varchar2         default hr_api.g_varchar2,
925   p_cont_information7              in varchar2         default hr_api.g_varchar2,
926   p_cont_information8              in varchar2         default hr_api.g_varchar2,
927   p_cont_information9              in varchar2         default hr_api.g_varchar2,
928   p_cont_information10             in varchar2         default hr_api.g_varchar2,
929   p_cont_information11             in varchar2         default hr_api.g_varchar2,
930   p_cont_information12             in varchar2         default hr_api.g_varchar2,
931   p_cont_information13             in varchar2         default hr_api.g_varchar2,
932   p_cont_information14             in varchar2         default hr_api.g_varchar2,
933   p_cont_information15             in varchar2         default hr_api.g_varchar2,
934   p_cont_information16             in varchar2         default hr_api.g_varchar2,
935   p_cont_information17             in varchar2         default hr_api.g_varchar2,
936   p_cont_information18             in varchar2         default hr_api.g_varchar2,
937   p_cont_information19             in varchar2         default hr_api.g_varchar2,
938   p_cont_information20             in varchar2         default hr_api.g_varchar2,
939   p_third_party_pay_flag         in varchar2         default hr_api.g_varchar2,
940   p_bondholder_flag              in varchar2         default hr_api.g_varchar2,
941   p_dependent_flag               in varchar2         default hr_api.g_varchar2,
942   p_beneficiary_flag             in varchar2         default hr_api.g_varchar2,
943   p_object_version_number        in out nocopy number,
944   p_effective_date               in date,
945   p_validate                     in boolean      default false
946   ) is
947 --
948   l_rec    per_ctr_shd.g_rec_type;
949   l_proc  varchar2(72) := g_package||'upd';
950 --
951 Begin
952   hr_utility.set_location('Entering:'||l_proc, 5);
953   --
954   -- Call conversion function to turn arguments into the
955   -- l_rec structure.
956   --
957   l_rec :=
958   per_ctr_shd.convert_args
959   (
960   p_contact_relationship_id,
961   hr_api.g_number,
962   hr_api.g_number,
963   hr_api.g_number,
964   p_contact_type,
965   p_comments,
966   p_primary_contact_flag,
967   p_request_id,
968   p_program_application_id,
969   p_program_id,
970   p_program_update_date,
971   p_date_start,
972   p_start_life_reason_id,
973   p_date_end,
974   p_end_life_reason_id,
975   p_rltd_per_rsds_w_dsgntr_flag,
976   p_personal_flag,
977   p_sequence_number,
978   p_cont_attribute_category,
979   p_cont_attribute1,
980   p_cont_attribute2,
981   p_cont_attribute3,
982   p_cont_attribute4,
983   p_cont_attribute5,
984   p_cont_attribute6,
985   p_cont_attribute7,
986   p_cont_attribute8,
987   p_cont_attribute9,
988   p_cont_attribute10,
989   p_cont_attribute11,
990   p_cont_attribute12,
991   p_cont_attribute13,
992   p_cont_attribute14,
993   p_cont_attribute15,
994   p_cont_attribute16,
995   p_cont_attribute17,
996   p_cont_attribute18,
997   p_cont_attribute19,
998   p_cont_attribute20,
999   p_cont_information_category,
1000   p_cont_information1,
1001   p_cont_information2,
1002   p_cont_information3,
1003   p_cont_information4,
1004   p_cont_information5,
1005   p_cont_information6,
1006   p_cont_information7,
1007   p_cont_information8,
1008   p_cont_information9,
1009   p_cont_information10,
1010   p_cont_information11,
1011   p_cont_information12,
1012   p_cont_information13,
1013   p_cont_information14,
1014   p_cont_information15,
1015   p_cont_information16,
1016   p_cont_information17,
1017   p_cont_information18,
1018   p_cont_information19,
1019   p_cont_information20,
1020   p_third_party_pay_flag,
1021   p_bondholder_flag,
1022   p_dependent_flag,
1023   p_beneficiary_flag,
1024   p_object_version_number
1025   );
1026   --
1027   -- Having converted the arguments into the
1028   -- plsql record structure we call the corresponding record
1029   -- business process.
1030   --
1031   upd(l_rec, p_effective_date, p_validate);
1032   p_object_version_number := l_rec.object_version_number;
1033   --
1034   hr_utility.set_location(' Leaving:'||l_proc, 10);
1035 End upd;
1036 --
1037 end per_ctr_upd;