DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_EPZ_UPD

Source


1 Package Body ben_epz_upd as
2 /* $Header: beepzrhi.pkb 120.1 2006/02/26 23:58:04 rtagarra noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_epz_upd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------------< dt_update_dml >-----------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the execution of dml from the datetrack mode
17 --   of CORRECTION only. It is important to note that the object version
18 --   number is only increment by 1 because the datetrack correction is
19 --   soley for one datetracked row.
20 --   This procedure controls the actual dml update logic. The functions of this
21 --   procedure are as follows:
22 --   1) Get the next object_version_number.
23 --   2) To set and unset the g_api_dml status as required (as we are about to
24 --      perform dml).
25 --   3) To update the specified row in the schema using the primary key in
26 --      the predicates.
27 --   4) To trap any constraint violations that may have occurred.
28 --   5) To raise any other errors.
29 --
30 -- Prerequisites:
31 --   This is an internal private procedure which must be called from the
32 --   update_dml procedure.
33 --
34 -- In Parameters:
35 --   A Pl/Sql record structre.
36 --
37 -- Post Success:
38 --   The specified row will be updated in the schema.
39 --
40 -- Post Failure:
41 --   On the update dml failure it is important to note that we always reset the
42 --   g_api_dml status to false.
43 --   If a check or unique integrity constraint violation is raised the
44 --   constraint_error procedure will be called.
45 --   If any other error is reported, the error will be raised after the
46 --   g_api_dml status is reset.
47 --
48 -- Developer Implementation Notes:
49 --   The update 'set' arguments list should be modified if any of your
50 --   attributes are not updateable.
51 --
52 -- Access Status:
53 --   Internal Row Handler Use Only.
54 --
55 -- {End Of Comments}
56 -- ----------------------------------------------------------------------------
57 Procedure dt_update_dml
58 	(p_rec 			 in out nocopy ben_epz_shd.g_rec_type,
59 	 p_effective_date	 in	date,
60 	 p_datetrack_mode	 in	varchar2,
61 	 p_validation_start_date in	date,
62 	 p_validation_end_date	 in	date) is
63 --
64   l_proc	varchar2(72) := g_package||'dt_update_dml';
65 --
66 Begin
67   hr_utility.set_location('Entering:'||l_proc, 5);
68   --
69   If (p_datetrack_mode = 'CORRECTION') then
70     hr_utility.set_location(l_proc, 10);
71     --
72     -- Because we are updating a row we must get the next object
73     -- version number.
74     --
75     p_rec.object_version_number :=
76       dt_api.get_object_version_number
77 	  (p_base_table_name	=> 'ben_elig_pstl_cd_r_rng_prte_f',
78 	   p_base_key_column	=> 'elig_pstl_cd_r_rng_prte_id',
79 	   p_base_key_value	=> p_rec.elig_pstl_cd_r_rng_prte_id);
80     --
81     ben_epz_shd.g_api_dml := true;  -- Set the api dml status
82     --
83     -- Update the ben_elig_pstl_cd_r_rng_prte_f Row
84     --
85 hr_utility.set_location('********right before the actual update',10);
86 hr_utility.set_location('********pstl zip rng: '||
87                         to_char(p_rec.pstl_zip_rng_id),10);
88 hr_utility.set_location('********eligy_prfl_id : '||
89                         to_char(p_rec.eligy_prfl_id),10);
90 hr_utility.set_location('********excld_flag : '||
91                         p_rec.excld_flag,10);
92 
93     update  ben_elig_pstl_cd_r_rng_prte_f
94     set
95         elig_pstl_cd_r_rng_prte_id      = p_rec.elig_pstl_cd_r_rng_prte_id,
96     ordr_num                        = p_rec.ordr_num,
97     excld_flag                      = p_rec.excld_flag,
98     pstl_zip_rng_id                 = p_rec.pstl_zip_rng_id,
99     eligy_prfl_id                   = p_rec.eligy_prfl_id,
100     business_group_id               = p_rec.business_group_id,
101     epz_attribute_category          = p_rec.epz_attribute_category,
102     epz_attribute1                  = p_rec.epz_attribute1,
103     epz_attribute2                  = p_rec.epz_attribute2,
104     epz_attribute3                  = p_rec.epz_attribute3,
105     epz_attribute4                  = p_rec.epz_attribute4,
106     epz_attribute5                  = p_rec.epz_attribute5,
107     epz_attribute6                  = p_rec.epz_attribute6,
108     epz_attribute7                  = p_rec.epz_attribute7,
109     epz_attribute8                  = p_rec.epz_attribute8,
110     epz_attribute9                  = p_rec.epz_attribute9,
111     epz_attribute10                 = p_rec.epz_attribute10,
112     epz_attribute11                 = p_rec.epz_attribute11,
113     epz_attribute12                 = p_rec.epz_attribute12,
114     epz_attribute13                 = p_rec.epz_attribute13,
115     epz_attribute14                 = p_rec.epz_attribute14,
116     epz_attribute15                 = p_rec.epz_attribute15,
117     epz_attribute16                 = p_rec.epz_attribute16,
118     epz_attribute17                 = p_rec.epz_attribute17,
119     epz_attribute18                 = p_rec.epz_attribute18,
120     epz_attribute19                 = p_rec.epz_attribute19,
121     epz_attribute20                 = p_rec.epz_attribute20,
122     epz_attribute21                 = p_rec.epz_attribute21,
123     epz_attribute22                 = p_rec.epz_attribute22,
124     epz_attribute23                 = p_rec.epz_attribute23,
125     epz_attribute24                 = p_rec.epz_attribute24,
126     epz_attribute25                 = p_rec.epz_attribute25,
127     epz_attribute26                 = p_rec.epz_attribute26,
128     epz_attribute27                 = p_rec.epz_attribute27,
129     epz_attribute28                 = p_rec.epz_attribute28,
130     epz_attribute29                 = p_rec.epz_attribute29,
131     epz_attribute30                 = p_rec.epz_attribute30,
132     object_version_number           = p_rec.object_version_number ,
133     criteria_score                  = p_rec.criteria_score ,
134     criteria_weight                 = p_rec.criteria_weight
135     where   elig_pstl_cd_r_rng_prte_id = p_rec.elig_pstl_cd_r_rng_prte_id
136     and     effective_start_date = p_validation_start_date
137     and     effective_end_date   = p_validation_end_date;
138 hr_utility.set_location('********right after the actual update',10);
139     --
140     ben_epz_shd.g_api_dml := false;   -- Unset the api dml status
141     --
142     -- Set the effective start and end dates
143     --
144     p_rec.effective_start_date := p_validation_start_date;
145     p_rec.effective_end_date   := p_validation_end_date;
146   End If;
147 --
148 hr_utility.set_location(' Leaving:'||l_proc, 15);
149 Exception
150   When hr_api.check_integrity_violated Then
151     -- A check constraint has been violated
152     ben_epz_shd.g_api_dml := false;   -- Unset the api dml status
153     ben_epz_shd.constraint_error
154       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
155   When hr_api.unique_integrity_violated Then
156     -- Unique integrity has been violated
157     ben_epz_shd.g_api_dml := false;   -- Unset the api dml status
158     ben_epz_shd.constraint_error
159       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
160   When Others Then
161     ben_epz_shd.g_api_dml := false;   -- Unset the api dml status
162     Raise;
163 End dt_update_dml;
164 --
165 -- ----------------------------------------------------------------------------
166 -- |------------------------------< update_dml >------------------------------|
167 -- ----------------------------------------------------------------------------
168 -- {Start Of Comments}
169 --
170 -- Description:
171 --   This procedure calls the dt_update_dml control logic which handles
172 --   the actual datetrack dml.
173 --
174 -- Prerequisites:
175 --   This is an internal private procedure which must be called from the upd
176 --   procedure.
177 --
178 -- In Parameters:
179 --   A Pl/Sql record structre.
180 --
181 -- Post Success:
182 --   Processing contines.
183 --
184 -- Post Failure:
185 --   No specific error handling is required within this procedure.
186 --
187 -- Developer Implementation Notes:
188 --   The update 'set' arguments list should be modified if any of your
189 --   attributes are not updateable.
190 --
191 -- Access Status:
192 --   Internal Row Handler Use Only.
193 --
194 -- {End Of Comments}
195 -- ----------------------------------------------------------------------------
196 Procedure update_dml
197 	(p_rec 			 in out nocopy ben_epz_shd.g_rec_type,
198 	 p_effective_date	 in	date,
199 	 p_datetrack_mode	 in	varchar2,
200 	 p_validation_start_date in	date,
201 	 p_validation_end_date	 in	date) is
202 --
203   l_proc	varchar2(72) := g_package||'update_dml';
204 --
205 Begin
206   hr_utility.set_location('Entering:'||l_proc, 5);
207   --
208   dt_update_dml(p_rec			=> p_rec,
209 		p_effective_date	=> p_effective_date,
210 		p_datetrack_mode	=> p_datetrack_mode,
211        		p_validation_start_date	=> p_validation_start_date,
212 		p_validation_end_date	=> p_validation_end_date);
213   --
214   hr_utility.set_location(' Leaving:'||l_proc, 10);
215 End update_dml;
216 --
217 -- ----------------------------------------------------------------------------
218 -- |----------------------------< dt_pre_update >-----------------------------|
219 -- ----------------------------------------------------------------------------
220 -- {Start Of Comments}
221 --
222 -- Description:
223 --   The dt_pre_update procedure controls the execution
224 --   of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
225 --   and UPDATE_CHANGE_INSERT only. The execution required is as
226 --   follows:
227 --
228 --   1) Providing the datetrack update mode is not 'CORRECTION'
229 --      then set the effective end date of the current row (this
230 --      will be the validation_start_date - 1).
231 --   2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
232 --      corresponding delete_dml process to delete any future rows
233 --      where the effective_start_date is greater than or equal to
234 --	the validation_start_date.
235 --   3) Call the insert_dml process to insert the new updated row
236 --      details..
237 --
238 -- Prerequisites:
239 --   This is an internal procedure which is called from the
240 --   pre_update procedure.
241 --
242 -- In Parameters:
243 --
244 -- Post Success:
245 --   Processing continues.
246 --
247 -- Post Failure:
248 --   If an error has occurred, an error message and exception will be raised
249 --   but not handled.
250 --
251 -- Developer Implementation Notes:
252 --   This is an internal procedure which is required by Datetrack. Don't
253 --   remove or modify.
254 --
255 -- Access Status:
256 --   Internal Row Handler Use Only.
257 --
258 -- {End Of Comments}
259 -- ----------------------------------------------------------------------------
260 Procedure dt_pre_update
261 	(p_rec 			 in out nocopy ben_epz_shd.g_rec_type,
262 	 p_effective_date	 in	date,
263 	 p_datetrack_mode	 in	varchar2,
264 	 p_validation_start_date in	date,
265 	 p_validation_end_date	 in	date) is
266 --
267   l_proc	         varchar2(72) := g_package||'dt_pre_update';
268   l_dummy_version_number number;
269 --
270 Begin
271   hr_utility.set_location('Entering:'||l_proc, 5);
272   If (p_datetrack_mode <> 'CORRECTION') then
273     hr_utility.set_location(l_proc, 10);
274     --
275     -- Update the current effective end date
276     --
277     ben_epz_shd.upd_effective_end_date
278      (p_effective_date	       => p_effective_date,
279       p_base_key_value	       => p_rec.elig_pstl_cd_r_rng_prte_id,
280       p_new_effective_end_date => (p_validation_start_date - 1),
281       p_validation_start_date  => p_validation_start_date,
282       p_validation_end_date    => p_validation_end_date,
283       p_object_version_number  => l_dummy_version_number);
284     --
285     If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
286       hr_utility.set_location(l_proc, 15);
287       --
288       -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
289       -- delete any future rows
290       --
291       ben_epz_del.delete_dml
292         (p_rec			 => p_rec,
293 	 p_effective_date	 => p_effective_date,
294 	 p_datetrack_mode	 => p_datetrack_mode,
295 	 p_validation_start_date => p_validation_start_date,
296 	 p_validation_end_date   => p_validation_end_date);
297     End If;
298     hr_utility.set_location(l_proc, 20);
299     --
300     -- We must now insert the updated row
301     --
302     ben_epz_ins.insert_dml
303       (p_rec			=> p_rec,
304        p_effective_date		=> p_effective_date,
305        p_datetrack_mode		=> p_datetrack_mode,
306        p_validation_start_date	=> p_validation_start_date,
307        p_validation_end_date	=> p_validation_end_date);
308   End If;
309   hr_utility.set_location(' Leaving:'||l_proc, 20);
310 End dt_pre_update;
311 --
312 -- ----------------------------------------------------------------------------
313 -- |------------------------------< pre_update >------------------------------|
314 -- ----------------------------------------------------------------------------
315 -- {Start Of Comments}
316 --
317 -- Description:
318 --   This private procedure contains any processing which is required before
319 --   the update dml.
320 --
321 -- Prerequisites:
322 --   This is an internal procedure which is called from the upd procedure.
323 --
324 -- In Parameters:
325 --   A Pl/Sql record structre.
326 --
327 -- Post Success:
328 --   Processing continues.
329 --
330 -- Post Failure:
331 --   If an error has occurred, an error message and exception will be raised
332 --   but not handled.
333 --
334 -- Developer Implementation Notes:
335 --   Any pre-processing required before the update dml is issued should be
336 --   coded within this procedure. It is important to note that any 3rd party
337 --   maintenance should be reviewed before placing in this procedure. The call
338 --   to the dt_update_dml procedure should NOT be removed.
339 --
340 -- Access Status:
341 --   Internal Row Handler Use Only.
342 --
343 -- {End Of Comments}
344 -- ----------------------------------------------------------------------------
345 Procedure pre_update
346 	(p_rec 			 in out nocopy ben_epz_shd.g_rec_type,
347 	 p_effective_date	 in	date,
348 	 p_datetrack_mode	 in	varchar2,
349 	 p_validation_start_date in	date,
350 	 p_validation_end_date	 in	date) is
351 --
352   l_proc	varchar2(72) := g_package||'pre_update';
353 --
354 Begin
355   hr_utility.set_location('Entering:'||l_proc, 5);
356   --
357   --
358   --
359   dt_pre_update
360     (p_rec 		     => p_rec,
361      p_effective_date	     => p_effective_date,
362      p_datetrack_mode	     => p_datetrack_mode,
363      p_validation_start_date => p_validation_start_date,
364      p_validation_end_date   => p_validation_end_date);
365   --
366   hr_utility.set_location(' Leaving:'||l_proc, 10);
367 End pre_update;
368 --
369 -- ----------------------------------------------------------------------------
370 -- |-----------------------------< post_update >------------------------------|
371 -- ----------------------------------------------------------------------------
372 -- {Start Of Comments}
373 --
374 -- Description:
375 --   This private procedure contains any processing which is required after the
376 --   update dml.
377 --
378 -- Prerequisites:
379 --   This is an internal procedure which is called from the upd procedure.
380 --
381 -- In Parameters:
382 --   A Pl/Sql record structre.
383 --
384 -- Post Success:
385 --   Processing continues.
386 --
387 -- Post Failure:
388 --   If an error has occurred, an error message and exception will be raised
389 --   but not handled.
390 --
391 -- Developer Implementation Notes:
392 --   Any post-processing required after the update dml is issued should be
393 --   coded within this procedure. It is important to note that any 3rd party
394 --   maintenance should be reviewed before placing in this procedure.
395 --
396 -- Access Status:
397 --   Internal Row Handler Use Only.
398 --
399 -- {End Of Comments}
400 -- ----------------------------------------------------------------------------
401 Procedure post_update
402 	(p_rec 			 in ben_epz_shd.g_rec_type,
403 	 p_effective_date	 in date,
404 	 p_datetrack_mode	 in varchar2,
405 	 p_validation_start_date in date,
406 	 p_validation_end_date	 in date) is
407 --
408   l_proc	varchar2(72) := g_package||'post_update';
409 --
410 Begin
411   hr_utility.set_location('Entering:'||l_proc, 5);
412 --
413   --
414   -- Start of API User Hook for post_update.
415   --
416   begin
417     --
418     ben_epz_rku.after_update
419       (
420   p_elig_pstl_cd_r_rng_prte_id    =>p_rec.elig_pstl_cd_r_rng_prte_id
421  ,p_effective_start_date          =>p_rec.effective_start_date
422  ,p_effective_end_date            =>p_rec.effective_end_date
423  ,p_ordr_num                      =>p_rec.ordr_num
424  ,p_excld_flag                    =>p_rec.excld_flag
425  ,p_pstl_zip_rng_id               =>p_rec.pstl_zip_rng_id
426  ,p_eligy_prfl_id                 =>p_rec.eligy_prfl_id
427  ,p_business_group_id             =>p_rec.business_group_id
428  ,p_epz_attribute_category        =>p_rec.epz_attribute_category
429  ,p_epz_attribute1                =>p_rec.epz_attribute1
430  ,p_epz_attribute2                =>p_rec.epz_attribute2
431  ,p_epz_attribute3                =>p_rec.epz_attribute3
432  ,p_epz_attribute4                =>p_rec.epz_attribute4
433  ,p_epz_attribute5                =>p_rec.epz_attribute5
434  ,p_epz_attribute6                =>p_rec.epz_attribute6
435  ,p_epz_attribute7                =>p_rec.epz_attribute7
436  ,p_epz_attribute8                =>p_rec.epz_attribute8
437  ,p_epz_attribute9                =>p_rec.epz_attribute9
438  ,p_epz_attribute10               =>p_rec.epz_attribute10
439  ,p_epz_attribute11               =>p_rec.epz_attribute11
440  ,p_epz_attribute12               =>p_rec.epz_attribute12
441  ,p_epz_attribute13               =>p_rec.epz_attribute13
442  ,p_epz_attribute14               =>p_rec.epz_attribute14
443  ,p_epz_attribute15               =>p_rec.epz_attribute15
444  ,p_epz_attribute16               =>p_rec.epz_attribute16
445  ,p_epz_attribute17               =>p_rec.epz_attribute17
446  ,p_epz_attribute18               =>p_rec.epz_attribute18
447  ,p_epz_attribute19               =>p_rec.epz_attribute19
448  ,p_epz_attribute20               =>p_rec.epz_attribute20
449  ,p_epz_attribute21               =>p_rec.epz_attribute21
450  ,p_epz_attribute22               =>p_rec.epz_attribute22
451  ,p_epz_attribute23               =>p_rec.epz_attribute23
452  ,p_epz_attribute24               =>p_rec.epz_attribute24
453  ,p_epz_attribute25               =>p_rec.epz_attribute25
454  ,p_epz_attribute26               =>p_rec.epz_attribute26
455  ,p_epz_attribute27               =>p_rec.epz_attribute27
456  ,p_epz_attribute28               =>p_rec.epz_attribute28
457  ,p_epz_attribute29               =>p_rec.epz_attribute29
458  ,p_epz_attribute30               =>p_rec.epz_attribute30
459  ,p_object_version_number         =>p_rec.object_version_number
460  ,p_effective_date                =>p_effective_date
461  ,p_datetrack_mode                =>p_datetrack_mode
462  ,p_validation_start_date         =>p_validation_start_date
463  ,p_validation_end_date           =>p_validation_end_date
464  ,p_criteria_score                =>p_rec.criteria_score
465  ,p_criteria_weight               =>p_rec.criteria_weight
466  ,p_effective_start_date_o        =>ben_epz_shd.g_old_rec.effective_start_date
467  ,p_effective_end_date_o          =>ben_epz_shd.g_old_rec.effective_end_date
468  ,p_ordr_num_o                    =>ben_epz_shd.g_old_rec.ordr_num
469  ,p_excld_flag_o                  =>ben_epz_shd.g_old_rec.excld_flag
470  ,p_pstl_zip_rng_id_o             =>ben_epz_shd.g_old_rec.pstl_zip_rng_id
471  ,p_eligy_prfl_id_o               =>ben_epz_shd.g_old_rec.eligy_prfl_id
472  ,p_business_group_id_o           =>ben_epz_shd.g_old_rec.business_group_id
473  ,p_epz_attribute_category_o      =>ben_epz_shd.g_old_rec.epz_attribute_category
474  ,p_epz_attribute1_o              =>ben_epz_shd.g_old_rec.epz_attribute1
475  ,p_epz_attribute2_o              =>ben_epz_shd.g_old_rec.epz_attribute2
476  ,p_epz_attribute3_o              =>ben_epz_shd.g_old_rec.epz_attribute3
477  ,p_epz_attribute4_o              =>ben_epz_shd.g_old_rec.epz_attribute4
478  ,p_epz_attribute5_o              =>ben_epz_shd.g_old_rec.epz_attribute5
479  ,p_epz_attribute6_o              =>ben_epz_shd.g_old_rec.epz_attribute6
480  ,p_epz_attribute7_o              =>ben_epz_shd.g_old_rec.epz_attribute7
481  ,p_epz_attribute8_o              =>ben_epz_shd.g_old_rec.epz_attribute8
482  ,p_epz_attribute9_o              =>ben_epz_shd.g_old_rec.epz_attribute9
483  ,p_epz_attribute10_o             =>ben_epz_shd.g_old_rec.epz_attribute10
484  ,p_epz_attribute11_o             =>ben_epz_shd.g_old_rec.epz_attribute11
485  ,p_epz_attribute12_o             =>ben_epz_shd.g_old_rec.epz_attribute12
486  ,p_epz_attribute13_o             =>ben_epz_shd.g_old_rec.epz_attribute13
487  ,p_epz_attribute14_o             =>ben_epz_shd.g_old_rec.epz_attribute14
488  ,p_epz_attribute15_o             =>ben_epz_shd.g_old_rec.epz_attribute15
489  ,p_epz_attribute16_o             =>ben_epz_shd.g_old_rec.epz_attribute16
490  ,p_epz_attribute17_o             =>ben_epz_shd.g_old_rec.epz_attribute17
491  ,p_epz_attribute18_o             =>ben_epz_shd.g_old_rec.epz_attribute18
492  ,p_epz_attribute19_o             =>ben_epz_shd.g_old_rec.epz_attribute19
493  ,p_epz_attribute20_o             =>ben_epz_shd.g_old_rec.epz_attribute20
494  ,p_epz_attribute21_o             =>ben_epz_shd.g_old_rec.epz_attribute21
495  ,p_epz_attribute22_o             =>ben_epz_shd.g_old_rec.epz_attribute22
496  ,p_epz_attribute23_o             =>ben_epz_shd.g_old_rec.epz_attribute23
497  ,p_epz_attribute24_o             =>ben_epz_shd.g_old_rec.epz_attribute24
498  ,p_epz_attribute25_o             =>ben_epz_shd.g_old_rec.epz_attribute25
499  ,p_epz_attribute26_o             =>ben_epz_shd.g_old_rec.epz_attribute26
500  ,p_epz_attribute27_o             =>ben_epz_shd.g_old_rec.epz_attribute27
501  ,p_epz_attribute28_o             =>ben_epz_shd.g_old_rec.epz_attribute28
502  ,p_epz_attribute29_o             =>ben_epz_shd.g_old_rec.epz_attribute29
503  ,p_epz_attribute30_o             =>ben_epz_shd.g_old_rec.epz_attribute30
504  ,p_object_version_number_o       =>ben_epz_shd.g_old_rec.object_version_number
505  ,p_criteria_score_o              =>ben_epz_shd.g_old_rec.criteria_score
506  ,p_criteria_weight_o             =>ben_epz_shd.g_old_rec.criteria_weight
507       );
508     --
509   exception
510     --
511     when hr_api.cannot_find_prog_unit then
512       --
513       hr_api.cannot_find_prog_unit_error
514         (p_module_name => 'ben_elig_pstl_cd_r_rng_prte_f'
515         ,p_hook_type   => 'AU');
516       --
517   end;
518   --
519   -- End of API User Hook for post_update.
520   --
521   --
522   hr_utility.set_location(' Leaving:'||l_proc, 10);
523 End post_update;
524 --
525 -- ----------------------------------------------------------------------------
526 -- |-----------------------------< convert_defs >-----------------------------|
527 -- ----------------------------------------------------------------------------
528 -- {Start Of Comments}
529 --
530 -- Description:
531 --   The Convert_Defs procedure has one very important function:
532 --   It must return the record structure for the row with all system defaulted
533 --   values converted into its corresponding parameter value for update. When
534 --   we attempt to update a row through the Upd process , certain
535 --   parameters can be defaulted which enables flexibility in the calling of
536 --   the upd process (e.g. only attributes which need to be updated need to be
537 --   specified). For the upd process to determine which attributes
538 --   have NOT been specified we need to check if the parameter has a reserved
539 --   system default value. Therefore, for all parameters which have a
540 --   corresponding reserved system default mechanism specified we need to
541 --   check if a system default is being used. If a system default is being
542 --   used then we convert the defaulted value into its corresponding attribute
543 --   value held in the g_old_rec data structure.
544 --
545 -- Prerequisites:
546 --   This private function can only be called from the upd process.
547 --
548 -- In Parameters:
549 --   A Pl/Sql record structre.
550 --
551 -- Post Success:
552 --   The record structure will be returned with all system defaulted parameter
553 --   values converted into its current row attribute value.
554 --
555 -- Post Failure:
556 --   No direct error handling is required within this function. Any possible
557 --   errors within this procedure will be a PL/SQL value error due to conversion
558 --   of datatypes or data lengths.
559 --
560 -- Developer Implementation Notes:
561 --   None.
562 --
563 -- Access Status:
564 --   Internal Row Handler Use Only.
565 --
566 -- {End Of Comments}
567 -- ----------------------------------------------------------------------------
568 Procedure convert_defs(p_rec in out nocopy ben_epz_shd.g_rec_type) is
569 --
570   l_proc  varchar2(72) := g_package||'convert_defs';
571 --
572 Begin
573   --
574   hr_utility.set_location('Entering:'||l_proc, 5);
575   --
576   -- We must now examine each argument value in the
577   -- p_rec plsql record structure
578   -- to see if a system default is being used. If a system default
579   -- is being used then we must set to the 'current' argument value.
580   --
581   If (p_rec.ordr_num = hr_api.g_number) then
582     p_rec.ordr_num :=
583     ben_epz_shd.g_old_rec.ordr_num;
584   End If;
585   If (p_rec.excld_flag = hr_api.g_varchar2) then
586     p_rec.excld_flag :=
587     ben_epz_shd.g_old_rec.excld_flag;
588   End If;
589   If (p_rec.pstl_zip_rng_id = hr_api.g_number) then
590     p_rec.pstl_zip_rng_id :=
591     ben_epz_shd.g_old_rec.pstl_zip_rng_id;
592   End If;
593   If (p_rec.eligy_prfl_id = hr_api.g_number) then
594     p_rec.eligy_prfl_id :=
595     ben_epz_shd.g_old_rec.eligy_prfl_id;
596   End If;
597   If (p_rec.business_group_id = hr_api.g_number) then
598     p_rec.business_group_id :=
599     ben_epz_shd.g_old_rec.business_group_id;
600   End If;
601   If (p_rec.epz_attribute_category = hr_api.g_varchar2) then
602     p_rec.epz_attribute_category :=
603     ben_epz_shd.g_old_rec.epz_attribute_category;
604   End If;
605   If (p_rec.epz_attribute1 = hr_api.g_varchar2) then
606     p_rec.epz_attribute1 :=
607     ben_epz_shd.g_old_rec.epz_attribute1;
608   End If;
609   If (p_rec.epz_attribute2 = hr_api.g_varchar2) then
610     p_rec.epz_attribute2 :=
611     ben_epz_shd.g_old_rec.epz_attribute2;
612   End If;
613   If (p_rec.epz_attribute3 = hr_api.g_varchar2) then
614     p_rec.epz_attribute3 :=
615     ben_epz_shd.g_old_rec.epz_attribute3;
616   End If;
617   If (p_rec.epz_attribute4 = hr_api.g_varchar2) then
618     p_rec.epz_attribute4 :=
619     ben_epz_shd.g_old_rec.epz_attribute4;
620   End If;
621   If (p_rec.epz_attribute5 = hr_api.g_varchar2) then
622     p_rec.epz_attribute5 :=
623     ben_epz_shd.g_old_rec.epz_attribute5;
624   End If;
625   If (p_rec.epz_attribute6 = hr_api.g_varchar2) then
626     p_rec.epz_attribute6 :=
627     ben_epz_shd.g_old_rec.epz_attribute6;
628   End If;
629   If (p_rec.epz_attribute7 = hr_api.g_varchar2) then
630     p_rec.epz_attribute7 :=
631     ben_epz_shd.g_old_rec.epz_attribute7;
632   End If;
633   If (p_rec.epz_attribute8 = hr_api.g_varchar2) then
634     p_rec.epz_attribute8 :=
635     ben_epz_shd.g_old_rec.epz_attribute8;
636   End If;
637   If (p_rec.epz_attribute9 = hr_api.g_varchar2) then
638     p_rec.epz_attribute9 :=
639     ben_epz_shd.g_old_rec.epz_attribute9;
640   End If;
641   If (p_rec.epz_attribute10 = hr_api.g_varchar2) then
642     p_rec.epz_attribute10 :=
643     ben_epz_shd.g_old_rec.epz_attribute10;
644   End If;
645   If (p_rec.epz_attribute11 = hr_api.g_varchar2) then
646     p_rec.epz_attribute11 :=
647     ben_epz_shd.g_old_rec.epz_attribute11;
648   End If;
649   If (p_rec.epz_attribute12 = hr_api.g_varchar2) then
650     p_rec.epz_attribute12 :=
651     ben_epz_shd.g_old_rec.epz_attribute12;
652   End If;
653   If (p_rec.epz_attribute13 = hr_api.g_varchar2) then
654     p_rec.epz_attribute13 :=
655     ben_epz_shd.g_old_rec.epz_attribute13;
656   End If;
657   If (p_rec.epz_attribute14 = hr_api.g_varchar2) then
658     p_rec.epz_attribute14 :=
659     ben_epz_shd.g_old_rec.epz_attribute14;
660   End If;
661   If (p_rec.epz_attribute15 = hr_api.g_varchar2) then
662     p_rec.epz_attribute15 :=
663     ben_epz_shd.g_old_rec.epz_attribute15;
664   End If;
665   If (p_rec.epz_attribute16 = hr_api.g_varchar2) then
666     p_rec.epz_attribute16 :=
667     ben_epz_shd.g_old_rec.epz_attribute16;
668   End If;
669   If (p_rec.epz_attribute17 = hr_api.g_varchar2) then
670     p_rec.epz_attribute17 :=
671     ben_epz_shd.g_old_rec.epz_attribute17;
672   End If;
673   If (p_rec.epz_attribute18 = hr_api.g_varchar2) then
674     p_rec.epz_attribute18 :=
675     ben_epz_shd.g_old_rec.epz_attribute18;
676   End If;
677   If (p_rec.epz_attribute19 = hr_api.g_varchar2) then
678     p_rec.epz_attribute19 :=
679     ben_epz_shd.g_old_rec.epz_attribute19;
680   End If;
681   If (p_rec.epz_attribute20 = hr_api.g_varchar2) then
682     p_rec.epz_attribute20 :=
683     ben_epz_shd.g_old_rec.epz_attribute20;
684   End If;
685   If (p_rec.epz_attribute21 = hr_api.g_varchar2) then
686     p_rec.epz_attribute21 :=
687     ben_epz_shd.g_old_rec.epz_attribute21;
688   End If;
689   If (p_rec.epz_attribute22 = hr_api.g_varchar2) then
690     p_rec.epz_attribute22 :=
691     ben_epz_shd.g_old_rec.epz_attribute22;
692   End If;
693   If (p_rec.epz_attribute23 = hr_api.g_varchar2) then
694     p_rec.epz_attribute23 :=
695     ben_epz_shd.g_old_rec.epz_attribute23;
696   End If;
697   If (p_rec.epz_attribute24 = hr_api.g_varchar2) then
698     p_rec.epz_attribute24 :=
699     ben_epz_shd.g_old_rec.epz_attribute24;
700   End If;
701   If (p_rec.epz_attribute25 = hr_api.g_varchar2) then
702     p_rec.epz_attribute25 :=
703     ben_epz_shd.g_old_rec.epz_attribute25;
704   End If;
705   If (p_rec.epz_attribute26 = hr_api.g_varchar2) then
706     p_rec.epz_attribute26 :=
707     ben_epz_shd.g_old_rec.epz_attribute26;
708   End If;
709   If (p_rec.epz_attribute27 = hr_api.g_varchar2) then
710     p_rec.epz_attribute27 :=
711     ben_epz_shd.g_old_rec.epz_attribute27;
712   End If;
713   If (p_rec.epz_attribute28 = hr_api.g_varchar2) then
714     p_rec.epz_attribute28 :=
715     ben_epz_shd.g_old_rec.epz_attribute28;
716   End If;
717   If (p_rec.epz_attribute29 = hr_api.g_varchar2) then
718     p_rec.epz_attribute29 :=
719     ben_epz_shd.g_old_rec.epz_attribute29;
720   End If;
721   If (p_rec.epz_attribute30 = hr_api.g_varchar2) then
722     p_rec.epz_attribute30 :=
723     ben_epz_shd.g_old_rec.epz_attribute30;
724   End If;
725   If (p_rec.criteria_score = hr_api.g_number) then
726     p_rec.criteria_score :=
727     ben_epz_shd.g_old_rec.criteria_score;
728   End If;
729   If (p_rec.criteria_weight = hr_api.g_number) then
730     p_rec.criteria_weight :=
731     ben_epz_shd.g_old_rec.criteria_weight;
732   End If;
733 
734   --
735   hr_utility.set_location(' Leaving:'||l_proc, 10);
736 --
737 End convert_defs;
738 --
739 -- ----------------------------------------------------------------------------
740 -- |---------------------------------< upd >----------------------------------|
741 -- ----------------------------------------------------------------------------
742 Procedure upd
743   (
744   p_rec			in out nocopy 	ben_epz_shd.g_rec_type,
745   p_effective_date	in 	date,
746   p_datetrack_mode	in 	varchar2
747   ) is
748 --
749   l_proc			varchar2(72) := g_package||'upd';
750   l_validation_start_date	date;
751   l_validation_end_date		date;
752 --
753 Begin
754   hr_utility.set_location('Entering:'||l_proc, 5);
755   --
756   -- Ensure that the DateTrack update mode is valid
757   --
758   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
759   --
760   -- We must lock the row which we need to update.
761   --
762   ben_epz_shd.lck
763 	(p_effective_date	 => p_effective_date,
764       	 p_datetrack_mode	 => p_datetrack_mode,
765       	 p_elig_pstl_cd_r_rng_prte_id	 => p_rec.elig_pstl_cd_r_rng_prte_id,
766       	 p_object_version_number => p_rec.object_version_number,
767       	 p_validation_start_date => l_validation_start_date,
768       	 p_validation_end_date	 => l_validation_end_date);
769   --
770   -- 1. During an update system defaults are used to determine if
771   --    arguments have been defaulted or not. We must therefore
772   --    derive the full record structure values to be updated.
773   --
774   -- 2. Call the supporting update validate operations.
775   --
776   convert_defs(p_rec);
777   ben_epz_bus.update_validate
778 	(p_rec			 => p_rec,
779 	 p_effective_date	 => p_effective_date,
780 	 p_datetrack_mode  	 => p_datetrack_mode,
781 	 p_validation_start_date => l_validation_start_date,
782 	 p_validation_end_date	 => l_validation_end_date);
783   --
784   -- Call the supporting pre-update operation
785   --
786   pre_update
787 	(p_rec			 => p_rec,
788 	 p_effective_date	 => p_effective_date,
789 	 p_datetrack_mode	 => p_datetrack_mode,
790 	 p_validation_start_date => l_validation_start_date,
791 	 p_validation_end_date	 => l_validation_end_date);
792   --
793   -- Update the row.
794   --
795   update_dml
796 	(p_rec			 => p_rec,
797 	 p_effective_date	 => p_effective_date,
798 	 p_datetrack_mode	 => p_datetrack_mode,
799 	 p_validation_start_date => l_validation_start_date,
800 	 p_validation_end_date	 => l_validation_end_date);
801   --
802   -- Call the supporting post-update operation
803   --
804   post_update
805 	(p_rec			 => p_rec,
806 	 p_effective_date	 => p_effective_date,
807 	 p_datetrack_mode	 => p_datetrack_mode,
808 	 p_validation_start_date => l_validation_start_date,
809 	 p_validation_end_date	 => l_validation_end_date);
810 End upd;
811 --
812 -- ----------------------------------------------------------------------------
813 -- |---------------------------------< upd >----------------------------------|
814 -- ----------------------------------------------------------------------------
815 Procedure upd
816   (
817   p_elig_pstl_cd_r_rng_prte_id   in number,
818   p_effective_start_date         out nocopy date,
819   p_effective_end_date           out nocopy date,
820   p_ordr_num                     in number           default hr_api.g_number,
821   p_excld_flag                   in varchar2         default hr_api.g_varchar2,
822   p_pstl_zip_rng_id              in number           default hr_api.g_number,
823   p_eligy_prfl_id                in number           default hr_api.g_number,
824   p_business_group_id            in number           default hr_api.g_number,
825   p_epz_attribute_category       in varchar2         default hr_api.g_varchar2,
826   p_epz_attribute1               in varchar2         default hr_api.g_varchar2,
827   p_epz_attribute2               in varchar2         default hr_api.g_varchar2,
828   p_epz_attribute3               in varchar2         default hr_api.g_varchar2,
829   p_epz_attribute4               in varchar2         default hr_api.g_varchar2,
830   p_epz_attribute5               in varchar2         default hr_api.g_varchar2,
831   p_epz_attribute6               in varchar2         default hr_api.g_varchar2,
832   p_epz_attribute7               in varchar2         default hr_api.g_varchar2,
833   p_epz_attribute8               in varchar2         default hr_api.g_varchar2,
834   p_epz_attribute9               in varchar2         default hr_api.g_varchar2,
835   p_epz_attribute10              in varchar2         default hr_api.g_varchar2,
836   p_epz_attribute11              in varchar2         default hr_api.g_varchar2,
837   p_epz_attribute12              in varchar2         default hr_api.g_varchar2,
838   p_epz_attribute13              in varchar2         default hr_api.g_varchar2,
839   p_epz_attribute14              in varchar2         default hr_api.g_varchar2,
840   p_epz_attribute15              in varchar2         default hr_api.g_varchar2,
841   p_epz_attribute16              in varchar2         default hr_api.g_varchar2,
842   p_epz_attribute17              in varchar2         default hr_api.g_varchar2,
843   p_epz_attribute18              in varchar2         default hr_api.g_varchar2,
844   p_epz_attribute19              in varchar2         default hr_api.g_varchar2,
845   p_epz_attribute20              in varchar2         default hr_api.g_varchar2,
846   p_epz_attribute21              in varchar2         default hr_api.g_varchar2,
847   p_epz_attribute22              in varchar2         default hr_api.g_varchar2,
848   p_epz_attribute23              in varchar2         default hr_api.g_varchar2,
849   p_epz_attribute24              in varchar2         default hr_api.g_varchar2,
850   p_epz_attribute25              in varchar2         default hr_api.g_varchar2,
851   p_epz_attribute26              in varchar2         default hr_api.g_varchar2,
852   p_epz_attribute27              in varchar2         default hr_api.g_varchar2,
853   p_epz_attribute28              in varchar2         default hr_api.g_varchar2,
854   p_epz_attribute29              in varchar2         default hr_api.g_varchar2,
855   p_epz_attribute30              in varchar2         default hr_api.g_varchar2,
856   p_object_version_number        in out nocopy number,
857   p_effective_date		 in date,
858   p_datetrack_mode		 in varchar2 ,
859   p_criteria_score               in number           default hr_api.g_number,
860   p_criteria_weight              in number           default hr_api.g_number
861   ) is
862 --
863   l_rec		ben_epz_shd.g_rec_type;
864   l_proc	varchar2(72) := g_package||'upd';
865 --
866 Begin
867   hr_utility.set_location('Entering:'||l_proc, 5);
868   --
869   -- Call conversion function to turn arguments into the
870   -- l_rec structure.
871   --
872   l_rec :=
873   ben_epz_shd.convert_args
874   (
875   p_elig_pstl_cd_r_rng_prte_id,
876   null,
877   null,
878   p_ordr_num,
879   p_excld_flag,
880   p_pstl_zip_rng_id,
881   p_eligy_prfl_id,
882   p_business_group_id,
883   p_epz_attribute_category,
884   p_epz_attribute1,
885   p_epz_attribute2,
886   p_epz_attribute3,
887   p_epz_attribute4,
888   p_epz_attribute5,
889   p_epz_attribute6,
890   p_epz_attribute7,
891   p_epz_attribute8,
892   p_epz_attribute9,
893   p_epz_attribute10,
894   p_epz_attribute11,
895   p_epz_attribute12,
896   p_epz_attribute13,
897   p_epz_attribute14,
898   p_epz_attribute15,
899   p_epz_attribute16,
900   p_epz_attribute17,
901   p_epz_attribute18,
902   p_epz_attribute19,
903   p_epz_attribute20,
904   p_epz_attribute21,
905   p_epz_attribute22,
906   p_epz_attribute23,
907   p_epz_attribute24,
908   p_epz_attribute25,
909   p_epz_attribute26,
910   p_epz_attribute27,
911   p_epz_attribute28,
912   p_epz_attribute29,
913   p_epz_attribute30,
914   p_object_version_number ,
915   p_criteria_score,
916   p_criteria_weight
917   );
918   --
919   -- Having converted the arguments into the
920   -- plsql record structure we call the corresponding record
921   -- business process.
922   --
923   upd(l_rec, p_effective_date, p_datetrack_mode);
924   p_object_version_number       := l_rec.object_version_number;
925   p_effective_start_date        := l_rec.effective_start_date;
926   p_effective_end_date          := l_rec.effective_end_date;
927   --
928   --
929   hr_utility.set_location(' Leaving:'||l_proc, 10);
930 End upd;
931 --
932 end ben_epz_upd;