1 Package Body ben_esh_upd as
2 /* $Header: beeshrhi.pkb 120.0 2005/05/28 02:56:41 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_esh_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_esh_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_schedd_hrs_prte_f',
78 p_base_key_column => 'elig_schedd_hrs_prte_id',
79 p_base_key_value => p_rec.elig_schedd_hrs_prte_id);
80 --
81 ben_esh_shd.g_api_dml := true; -- Set the api dml status
82 --
83 -- Update the ben_elig_schedd_hrs_prte_f Row
84 --
85 update ben_elig_schedd_hrs_prte_f
86 set
87 elig_schedd_hrs_prte_id = p_rec.elig_schedd_hrs_prte_id,
88 business_group_id = p_rec.business_group_id,
89 hrs_num = p_rec.hrs_num,
90 determination_cd = p_rec.determination_cd,
91 determination_rl = p_rec.determination_rl,
92 rounding_cd = p_rec.rounding_cd,
93 rounding_rl = p_rec.rounding_rl,
94 max_hrs_num = p_rec.max_hrs_num,
95 schedd_hrs_rl = p_rec.schedd_hrs_rl,
96 freq_cd = p_rec.freq_cd,
97 ordr_num = p_rec.ordr_num,
98 excld_flag = p_rec.excld_flag,
99 eligy_prfl_id = p_rec.eligy_prfl_id,
100 esh_attribute_category = p_rec.esh_attribute_category,
101 esh_attribute1 = p_rec.esh_attribute1,
102 esh_attribute2 = p_rec.esh_attribute2,
103 esh_attribute3 = p_rec.esh_attribute3,
104 esh_attribute4 = p_rec.esh_attribute4,
105 esh_attribute5 = p_rec.esh_attribute5,
106 esh_attribute6 = p_rec.esh_attribute6,
107 esh_attribute7 = p_rec.esh_attribute7,
108 esh_attribute8 = p_rec.esh_attribute8,
109 esh_attribute9 = p_rec.esh_attribute9,
110 esh_attribute10 = p_rec.esh_attribute10,
111 esh_attribute11 = p_rec.esh_attribute11,
112 esh_attribute12 = p_rec.esh_attribute12,
113 esh_attribute13 = p_rec.esh_attribute13,
114 esh_attribute14 = p_rec.esh_attribute14,
115 esh_attribute15 = p_rec.esh_attribute15,
116 esh_attribute16 = p_rec.esh_attribute16,
117 esh_attribute17 = p_rec.esh_attribute17,
118 esh_attribute18 = p_rec.esh_attribute18,
119 esh_attribute19 = p_rec.esh_attribute19,
120 esh_attribute20 = p_rec.esh_attribute20,
121 esh_attribute21 = p_rec.esh_attribute21,
122 esh_attribute22 = p_rec.esh_attribute22,
123 esh_attribute23 = p_rec.esh_attribute23,
124 esh_attribute24 = p_rec.esh_attribute24,
125 esh_attribute25 = p_rec.esh_attribute25,
126 esh_attribute26 = p_rec.esh_attribute26,
127 esh_attribute27 = p_rec.esh_attribute27,
128 esh_attribute28 = p_rec.esh_attribute28,
129 esh_attribute29 = p_rec.esh_attribute29,
130 esh_attribute30 = p_rec.esh_attribute30,
131 object_version_number = p_rec.object_version_number ,
132 criteria_score = p_rec.criteria_score ,
133 criteria_weight = p_rec.criteria_weight
134 where elig_schedd_hrs_prte_id = p_rec.elig_schedd_hrs_prte_id
135 and effective_start_date = p_validation_start_date
136 and effective_end_date = p_validation_end_date;
137 --
138 ben_esh_shd.g_api_dml := false; -- Unset the api dml status
139 --
140 -- Set the effective start and end dates
141 --
142 p_rec.effective_start_date := p_validation_start_date;
143 p_rec.effective_end_date := p_validation_end_date;
144 End If;
145 --
146 hr_utility.set_location(' Leaving:'||l_proc, 15);
147 Exception
148 When hr_api.check_integrity_violated Then
149 -- A check constraint has been violated
150 ben_esh_shd.g_api_dml := false; -- Unset the api dml status
151 ben_esh_shd.constraint_error
152 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
153 When hr_api.unique_integrity_violated Then
154 -- Unique integrity has been violated
155 ben_esh_shd.g_api_dml := false; -- Unset the api dml status
156 ben_esh_shd.constraint_error
157 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
158 When Others Then
159 ben_esh_shd.g_api_dml := false; -- Unset the api dml status
160 Raise;
161 End dt_update_dml;
162 --
163 -- ----------------------------------------------------------------------------
164 -- |------------------------------< update_dml >------------------------------|
165 -- ----------------------------------------------------------------------------
166 -- {Start Of Comments}
167 --
168 -- Description:
169 -- This procedure calls the dt_update_dml control logic which handles
170 -- the actual datetrack dml.
171 --
172 -- Prerequisites:
173 -- This is an internal private procedure which must be called from the upd
174 -- procedure.
175 --
176 -- In Parameters:
177 -- A Pl/Sql record structre.
178 --
179 -- Post Success:
180 -- Processing contines.
181 --
182 -- Post Failure:
183 -- No specific error handling is required within this procedure.
184 --
185 -- Developer Implementation Notes:
186 -- The update 'set' arguments list should be modified if any of your
187 -- attributes are not updateable.
188 --
189 -- Access Status:
190 -- Internal Row Handler Use Only.
191 --
192 -- {End Of Comments}
193 -- ----------------------------------------------------------------------------
194 Procedure update_dml
195 (p_rec in out nocopy ben_esh_shd.g_rec_type,
196 p_effective_date in date,
197 p_datetrack_mode in varchar2,
198 p_validation_start_date in date,
199 p_validation_end_date in date) is
200 --
201 l_proc varchar2(72) := g_package||'update_dml';
202 --
203 Begin
204 hr_utility.set_location('Entering:'||l_proc, 5);
205 --
206 dt_update_dml(p_rec => p_rec,
207 p_effective_date => p_effective_date,
208 p_datetrack_mode => p_datetrack_mode,
209 p_validation_start_date => p_validation_start_date,
210 p_validation_end_date => p_validation_end_date);
211 --
212 hr_utility.set_location(' Leaving:'||l_proc, 10);
213 End update_dml;
214 --
215 -- ----------------------------------------------------------------------------
216 -- |----------------------------< dt_pre_update >-----------------------------|
217 -- ----------------------------------------------------------------------------
218 -- {Start Of Comments}
219 --
220 -- Description:
221 -- The dt_pre_update procedure controls the execution
222 -- of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
223 -- and UPDATE_CHANGE_INSERT only. The execution required is as
224 -- follows:
225 --
226 -- 1) Providing the datetrack update mode is not 'CORRECTION'
227 -- then set the effective end date of the current row (this
228 -- will be the validation_start_date - 1).
229 -- 2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
230 -- corresponding delete_dml process to delete any future rows
231 -- where the effective_start_date is greater than or equal to
232 -- the validation_start_date.
233 -- 3) Call the insert_dml process to insert the new updated row
234 -- details..
235 --
236 -- Prerequisites:
237 -- This is an internal procedure which is called from the
238 -- pre_update procedure.
239 --
240 -- In Parameters:
241 --
242 -- Post Success:
243 -- Processing continues.
244 --
245 -- Post Failure:
246 -- If an error has occurred, an error message and exception will be raised
247 -- but not handled.
248 --
249 -- Developer Implementation Notes:
250 -- This is an internal procedure which is required by Datetrack. Don't
251 -- remove or modify.
252 --
253 -- Access Status:
254 -- Internal Row Handler Use Only.
255 --
256 -- {End Of Comments}
257 -- ----------------------------------------------------------------------------
258 Procedure dt_pre_update
259 (p_rec in out nocopy ben_esh_shd.g_rec_type,
260 p_effective_date in date,
261 p_datetrack_mode in varchar2,
262 p_validation_start_date in date,
263 p_validation_end_date in date) is
264 --
265 l_proc varchar2(72) := g_package||'dt_pre_update';
266 l_dummy_version_number number;
267 --
268 Begin
269 hr_utility.set_location('Entering:'||l_proc, 5);
270 If (p_datetrack_mode <> 'CORRECTION') then
271 hr_utility.set_location(l_proc, 10);
272 --
273 -- Update the current effective end date
274 --
275 ben_esh_shd.upd_effective_end_date
276 (p_effective_date => p_effective_date,
277 p_base_key_value => p_rec.elig_schedd_hrs_prte_id,
278 p_new_effective_end_date => (p_validation_start_date - 1),
279 p_validation_start_date => p_validation_start_date,
280 p_validation_end_date => p_validation_end_date,
281 p_object_version_number => l_dummy_version_number);
282 --
283 If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
284 hr_utility.set_location(l_proc, 15);
285 --
286 -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
287 -- delete any future rows
288 --
289 ben_esh_del.delete_dml
290 (p_rec => p_rec,
291 p_effective_date => p_effective_date,
292 p_datetrack_mode => p_datetrack_mode,
293 p_validation_start_date => p_validation_start_date,
294 p_validation_end_date => p_validation_end_date);
295 End If;
296 hr_utility.set_location(l_proc, 20);
297 --
298 -- We must now insert the updated row
299 --
300 ben_esh_ins.insert_dml
301 (p_rec => p_rec,
302 p_effective_date => p_effective_date,
303 p_datetrack_mode => p_datetrack_mode,
304 p_validation_start_date => p_validation_start_date,
305 p_validation_end_date => p_validation_end_date);
306 End If;
307 hr_utility.set_location(' Leaving:'||l_proc, 20);
308 End dt_pre_update;
309 --
310 -- ----------------------------------------------------------------------------
311 -- |------------------------------< pre_update >------------------------------|
312 -- ----------------------------------------------------------------------------
313 -- {Start Of Comments}
314 --
315 -- Description:
316 -- This private procedure contains any processing which is required before
317 -- the update dml.
318 --
319 -- Prerequisites:
320 -- This is an internal procedure which is called from the upd procedure.
321 --
322 -- In Parameters:
323 -- A Pl/Sql record structre.
324 --
325 -- Post Success:
326 -- Processing continues.
327 --
328 -- Post Failure:
329 -- If an error has occurred, an error message and exception will be raised
330 -- but not handled.
331 --
332 -- Developer Implementation Notes:
333 -- Any pre-processing required before the update dml is issued should be
334 -- coded within this procedure. It is important to note that any 3rd party
335 -- maintenance should be reviewed before placing in this procedure. The call
336 -- to the dt_update_dml procedure should NOT be removed.
337 --
338 -- Access Status:
339 -- Internal Row Handler Use Only.
340 --
341 -- {End Of Comments}
342 -- ----------------------------------------------------------------------------
343 Procedure pre_update
344 (p_rec in out nocopy ben_esh_shd.g_rec_type,
345 p_effective_date in date,
346 p_datetrack_mode in varchar2,
347 p_validation_start_date in date,
348 p_validation_end_date in date) is
349 --
350 l_proc varchar2(72) := g_package||'pre_update';
351 --
352 Begin
353 hr_utility.set_location('Entering:'||l_proc, 5);
354 --
355 --
356 --
357 dt_pre_update
358 (p_rec => p_rec,
359 p_effective_date => p_effective_date,
360 p_datetrack_mode => p_datetrack_mode,
361 p_validation_start_date => p_validation_start_date,
362 p_validation_end_date => p_validation_end_date);
363 --
364 hr_utility.set_location(' Leaving:'||l_proc, 10);
365 End pre_update;
366 --
367 -- ----------------------------------------------------------------------------
368 -- |-----------------------------< post_update >------------------------------|
369 -- ----------------------------------------------------------------------------
370 -- {Start Of Comments}
371 --
372 -- Description:
373 -- This private procedure contains any processing which is required after the
374 -- update dml.
375 --
376 -- Prerequisites:
377 -- This is an internal procedure which is called from the upd procedure.
378 --
379 -- In Parameters:
380 -- A Pl/Sql record structre.
381 --
382 -- Post Success:
383 -- Processing continues.
384 --
385 -- Post Failure:
386 -- If an error has occurred, an error message and exception will be raised
387 -- but not handled.
388 --
389 -- Developer Implementation Notes:
390 -- Any post-processing required after the update dml is issued should be
391 -- coded within this procedure. It is important to note that any 3rd party
392 -- maintenance should be reviewed before placing in this procedure.
393 --
394 -- Access Status:
395 -- Internal Row Handler Use Only.
396 --
397 -- {End Of Comments}
398 -- ----------------------------------------------------------------------------
399 Procedure post_update
400 (p_rec in ben_esh_shd.g_rec_type,
401 p_effective_date in date,
402 p_datetrack_mode in varchar2,
403 p_validation_start_date in date,
404 p_validation_end_date in date) is
405 --
406 l_proc varchar2(72) := g_package||'post_update';
407 --
408 Begin
409 hr_utility.set_location('Entering:'||l_proc, 5);
410 --
411 --
412 -- Start of API User Hook for post_update.
413 --
414 begin
415 --
416 ben_esh_rku.after_update
417 (
418 p_elig_schedd_hrs_prte_id =>p_rec.elig_schedd_hrs_prte_id
419 ,p_effective_start_date =>p_rec.effective_start_date
420 ,p_effective_end_date =>p_rec.effective_end_date
421 ,p_business_group_id =>p_rec.business_group_id
422 ,p_hrs_num =>p_rec.hrs_num
423 ,p_determination_cd =>p_rec.determination_cd
424 ,p_determination_rl =>p_rec.determination_rl
425 ,p_rounding_cd =>p_rec.rounding_cd
426 ,p_rounding_rl =>p_rec.rounding_rl
427 ,p_max_hrs_num =>p_rec.max_hrs_num
428 ,p_schedd_hrs_rl =>p_rec.schedd_hrs_rl
429 ,p_freq_cd =>p_rec.freq_cd
430 ,p_ordr_num =>p_rec.ordr_num
431 ,p_excld_flag =>p_rec.excld_flag
432 ,p_eligy_prfl_id =>p_rec.eligy_prfl_id
433 ,p_esh_attribute_category =>p_rec.esh_attribute_category
434 ,p_esh_attribute1 =>p_rec.esh_attribute1
435 ,p_esh_attribute2 =>p_rec.esh_attribute2
436 ,p_esh_attribute3 =>p_rec.esh_attribute3
437 ,p_esh_attribute4 =>p_rec.esh_attribute4
438 ,p_esh_attribute5 =>p_rec.esh_attribute5
439 ,p_esh_attribute6 =>p_rec.esh_attribute6
440 ,p_esh_attribute7 =>p_rec.esh_attribute7
441 ,p_esh_attribute8 =>p_rec.esh_attribute8
442 ,p_esh_attribute9 =>p_rec.esh_attribute9
443 ,p_esh_attribute10 =>p_rec.esh_attribute10
444 ,p_esh_attribute11 =>p_rec.esh_attribute11
445 ,p_esh_attribute12 =>p_rec.esh_attribute12
446 ,p_esh_attribute13 =>p_rec.esh_attribute13
447 ,p_esh_attribute14 =>p_rec.esh_attribute14
448 ,p_esh_attribute15 =>p_rec.esh_attribute15
449 ,p_esh_attribute16 =>p_rec.esh_attribute16
450 ,p_esh_attribute17 =>p_rec.esh_attribute17
451 ,p_esh_attribute18 =>p_rec.esh_attribute18
452 ,p_esh_attribute19 =>p_rec.esh_attribute19
453 ,p_esh_attribute20 =>p_rec.esh_attribute20
454 ,p_esh_attribute21 =>p_rec.esh_attribute21
455 ,p_esh_attribute22 =>p_rec.esh_attribute22
456 ,p_esh_attribute23 =>p_rec.esh_attribute23
457 ,p_esh_attribute24 =>p_rec.esh_attribute24
458 ,p_esh_attribute25 =>p_rec.esh_attribute25
459 ,p_esh_attribute26 =>p_rec.esh_attribute26
460 ,p_esh_attribute27 =>p_rec.esh_attribute27
461 ,p_esh_attribute28 =>p_rec.esh_attribute28
462 ,p_esh_attribute29 =>p_rec.esh_attribute29
463 ,p_esh_attribute30 =>p_rec.esh_attribute30
464 ,p_object_version_number =>p_rec.object_version_number
465 ,p_effective_date =>p_effective_date
466 ,p_datetrack_mode =>p_datetrack_mode
467 ,p_validation_start_date =>p_validation_start_date
468 ,p_validation_end_date =>p_validation_end_date
469 ,p_criteria_score =>p_rec.criteria_score
470 ,p_criteria_weight =>p_rec.criteria_weight
471 ,p_effective_start_date_o =>ben_esh_shd.g_old_rec.effective_start_date
472 ,p_effective_end_date_o =>ben_esh_shd.g_old_rec.effective_end_date
473 ,p_business_group_id_o =>ben_esh_shd.g_old_rec.business_group_id
474 ,p_hrs_num_o =>ben_esh_shd.g_old_rec.hrs_num
475 ,p_determination_cd_o =>ben_esh_shd.g_old_rec.determination_cd
476 ,p_determination_rl_o =>ben_esh_shd.g_old_rec.determination_rl
477 ,p_rounding_cd_o =>ben_esh_shd.g_old_rec.rounding_cd
478 ,p_rounding_rl_o =>ben_esh_shd.g_old_rec.rounding_rl
479 ,p_max_hrs_num_o =>ben_esh_shd.g_old_rec.max_hrs_num
480 ,p_schedd_hrs_rl_o =>ben_esh_shd.g_old_rec.schedd_hrs_rl
481 ,p_freq_cd_o =>ben_esh_shd.g_old_rec.freq_cd
482 ,p_ordr_num_o =>ben_esh_shd.g_old_rec.ordr_num
483 ,p_excld_flag_o =>ben_esh_shd.g_old_rec.excld_flag
484 ,p_eligy_prfl_id_o =>ben_esh_shd.g_old_rec.eligy_prfl_id
485 ,p_esh_attribute_category_o =>ben_esh_shd.g_old_rec.esh_attribute_category
486 ,p_esh_attribute1_o =>ben_esh_shd.g_old_rec.esh_attribute1
487 ,p_esh_attribute2_o =>ben_esh_shd.g_old_rec.esh_attribute2
488 ,p_esh_attribute3_o =>ben_esh_shd.g_old_rec.esh_attribute3
489 ,p_esh_attribute4_o =>ben_esh_shd.g_old_rec.esh_attribute4
490 ,p_esh_attribute5_o =>ben_esh_shd.g_old_rec.esh_attribute5
491 ,p_esh_attribute6_o =>ben_esh_shd.g_old_rec.esh_attribute6
492 ,p_esh_attribute7_o =>ben_esh_shd.g_old_rec.esh_attribute7
493 ,p_esh_attribute8_o =>ben_esh_shd.g_old_rec.esh_attribute8
494 ,p_esh_attribute9_o =>ben_esh_shd.g_old_rec.esh_attribute9
495 ,p_esh_attribute10_o =>ben_esh_shd.g_old_rec.esh_attribute10
496 ,p_esh_attribute11_o =>ben_esh_shd.g_old_rec.esh_attribute11
497 ,p_esh_attribute12_o =>ben_esh_shd.g_old_rec.esh_attribute12
498 ,p_esh_attribute13_o =>ben_esh_shd.g_old_rec.esh_attribute13
499 ,p_esh_attribute14_o =>ben_esh_shd.g_old_rec.esh_attribute14
500 ,p_esh_attribute15_o =>ben_esh_shd.g_old_rec.esh_attribute15
501 ,p_esh_attribute16_o =>ben_esh_shd.g_old_rec.esh_attribute16
502 ,p_esh_attribute17_o =>ben_esh_shd.g_old_rec.esh_attribute17
503 ,p_esh_attribute18_o =>ben_esh_shd.g_old_rec.esh_attribute18
504 ,p_esh_attribute19_o =>ben_esh_shd.g_old_rec.esh_attribute19
505 ,p_esh_attribute20_o =>ben_esh_shd.g_old_rec.esh_attribute20
506 ,p_esh_attribute21_o =>ben_esh_shd.g_old_rec.esh_attribute21
507 ,p_esh_attribute22_o =>ben_esh_shd.g_old_rec.esh_attribute22
508 ,p_esh_attribute23_o =>ben_esh_shd.g_old_rec.esh_attribute23
509 ,p_esh_attribute24_o =>ben_esh_shd.g_old_rec.esh_attribute24
510 ,p_esh_attribute25_o =>ben_esh_shd.g_old_rec.esh_attribute25
511 ,p_esh_attribute26_o =>ben_esh_shd.g_old_rec.esh_attribute26
512 ,p_esh_attribute27_o =>ben_esh_shd.g_old_rec.esh_attribute27
513 ,p_esh_attribute28_o =>ben_esh_shd.g_old_rec.esh_attribute28
514 ,p_esh_attribute29_o =>ben_esh_shd.g_old_rec.esh_attribute29
515 ,p_esh_attribute30_o =>ben_esh_shd.g_old_rec.esh_attribute30
516 ,p_object_version_number_o =>ben_esh_shd.g_old_rec.object_version_number
517 ,p_criteria_score_o =>ben_esh_shd.g_old_rec.criteria_score
518 ,p_criteria_weight_o =>ben_esh_shd.g_old_rec.criteria_weight
519 );
520 --
521 exception
522 --
523 when hr_api.cannot_find_prog_unit then
524 --
525 hr_api.cannot_find_prog_unit_error
526 (p_module_name => 'ben_elig_schedd_hrs_prte_f'
527 ,p_hook_type => 'AU');
528 --
529 end;
530 --
531 -- End of API User Hook for post_update.
532 --
533 --
534 hr_utility.set_location(' Leaving:'||l_proc, 10);
535 End post_update;
536 --
537 -- ----------------------------------------------------------------------------
538 -- |-----------------------------< convert_defs >-----------------------------|
539 -- ----------------------------------------------------------------------------
540 -- {Start Of Comments}
541 --
542 -- Description:
543 -- The Convert_Defs procedure has one very important function:
544 -- It must return the record structure for the row with all system defaulted
545 -- values converted into its corresponding parameter value for update. When
546 -- we attempt to update a row through the Upd process , certain
547 -- parameters can be defaulted which enables flexibility in the calling of
548 -- the upd process (e.g. only attributes which need to be updated need to be
549 -- specified). For the upd process to determine which attributes
550 -- have NOT been specified we need to check if the parameter has a reserved
551 -- system default value. Therefore, for all parameters which have a
552 -- corresponding reserved system default mechanism specified we need to
553 -- check if a system default is being used. If a system default is being
554 -- used then we convert the defaulted value into its corresponding attribute
555 -- value held in the g_old_rec data structure.
556 --
557 -- Prerequisites:
558 -- This private function can only be called from the upd process.
559 --
560 -- In Parameters:
561 -- A Pl/Sql record structre.
562 --
563 -- Post Success:
564 -- The record structure will be returned with all system defaulted parameter
565 -- values converted into its current row attribute value.
566 --
567 -- Post Failure:
568 -- No direct error handling is required within this function. Any possible
569 -- errors within this procedure will be a PL/SQL value error due to conversion
570 -- of datatypes or data lengths.
571 --
572 -- Developer Implementation Notes:
573 -- None.
574 --
575 -- Access Status:
576 -- Internal Row Handler Use Only.
577 --
578 -- {End Of Comments}
579 -- ----------------------------------------------------------------------------
580 Procedure convert_defs(p_rec in out nocopy ben_esh_shd.g_rec_type) is
581 --
582 l_proc varchar2(72) := g_package||'convert_defs';
583 --
584 Begin
585 --
586 hr_utility.set_location('Entering:'||l_proc, 5);
587 --
588 -- We must now examine each argument value in the
589 -- p_rec plsql record structure
590 -- to see if a system default is being used. If a system default
591 -- is being used then we must set to the 'current' argument value.
592 --
593 If (p_rec.business_group_id = hr_api.g_number) then
594 p_rec.business_group_id :=
595 ben_esh_shd.g_old_rec.business_group_id;
596 End If;
597 -- If (p_rec.schedd_hrs_fctr_id = hr_api.g_number) then
598 -- p_rec.schedd_hrs_fctr_id :=
599 -- ben_esh_shd.g_old_rec.schedd_hrs_fctr_id;
600 -- End If;
601 If (p_rec.hrs_num = hr_api.g_number) then
602 p_rec.hrs_num :=
603 ben_esh_shd.g_old_rec.hrs_num;
604 End If;
605 If (p_rec.freq_cd = hr_api.g_varchar2) then
606 p_rec.freq_cd :=
607 ben_esh_shd.g_old_rec.freq_cd;
608 End If;
609
610 If (p_rec.determination_cd = hr_api.g_varchar2) then
611 p_rec.determination_cd :=
612 ben_esh_shd.g_old_rec.determination_cd;
613 End If;
614 If (p_rec.determination_rl = hr_api.g_number) then
615 p_rec.determination_rl :=
616 ben_esh_shd.g_old_rec.determination_rl;
617 End If;
618 If (p_rec.rounding_cd = hr_api.g_varchar2) then
619 p_rec.rounding_cd :=
620 ben_esh_shd.g_old_rec.rounding_cd;
621 End If;
622 If (p_rec.rounding_rl = hr_api.g_number) then
623 p_rec.rounding_rl :=
624 ben_esh_shd.g_old_rec.rounding_rl;
625 End If;
626 If (p_rec.max_hrs_num = hr_api.g_number) then
627 p_rec.max_hrs_num :=
628 ben_esh_shd.g_old_rec.max_hrs_num;
629 End If;
630 If (p_rec.schedd_hrs_rl = hr_api.g_number) then
631 p_rec.schedd_hrs_rl :=
632 ben_esh_shd.g_old_rec.schedd_hrs_rl;
633 End If;
634
635 If (p_rec.ordr_num = hr_api.g_number) then
636 p_rec.ordr_num :=
637 ben_esh_shd.g_old_rec.ordr_num;
638 End If;
639 If (p_rec.excld_flag = hr_api.g_varchar2) then
640 p_rec.excld_flag :=
641 ben_esh_shd.g_old_rec.excld_flag;
642 End If;
643 If (p_rec.eligy_prfl_id = hr_api.g_number) then
644 p_rec.eligy_prfl_id :=
645 ben_esh_shd.g_old_rec.eligy_prfl_id;
646 End If;
647 If (p_rec.esh_attribute_category = hr_api.g_varchar2) then
648 p_rec.esh_attribute_category :=
649 ben_esh_shd.g_old_rec.esh_attribute_category;
650 End If;
651 If (p_rec.esh_attribute1 = hr_api.g_varchar2) then
652 p_rec.esh_attribute1 :=
653 ben_esh_shd.g_old_rec.esh_attribute1;
654 End If;
655 If (p_rec.esh_attribute2 = hr_api.g_varchar2) then
656 p_rec.esh_attribute2 :=
657 ben_esh_shd.g_old_rec.esh_attribute2;
658 End If;
659 If (p_rec.esh_attribute3 = hr_api.g_varchar2) then
660 p_rec.esh_attribute3 :=
661 ben_esh_shd.g_old_rec.esh_attribute3;
662 End If;
663 If (p_rec.esh_attribute4 = hr_api.g_varchar2) then
664 p_rec.esh_attribute4 :=
665 ben_esh_shd.g_old_rec.esh_attribute4;
666 End If;
667 If (p_rec.esh_attribute5 = hr_api.g_varchar2) then
668 p_rec.esh_attribute5 :=
669 ben_esh_shd.g_old_rec.esh_attribute5;
670 End If;
671 If (p_rec.esh_attribute6 = hr_api.g_varchar2) then
672 p_rec.esh_attribute6 :=
673 ben_esh_shd.g_old_rec.esh_attribute6;
674 End If;
675 If (p_rec.esh_attribute7 = hr_api.g_varchar2) then
676 p_rec.esh_attribute7 :=
677 ben_esh_shd.g_old_rec.esh_attribute7;
678 End If;
679 If (p_rec.esh_attribute8 = hr_api.g_varchar2) then
680 p_rec.esh_attribute8 :=
681 ben_esh_shd.g_old_rec.esh_attribute8;
682 End If;
683 If (p_rec.esh_attribute9 = hr_api.g_varchar2) then
684 p_rec.esh_attribute9 :=
685 ben_esh_shd.g_old_rec.esh_attribute9;
686 End If;
687 If (p_rec.esh_attribute10 = hr_api.g_varchar2) then
688 p_rec.esh_attribute10 :=
689 ben_esh_shd.g_old_rec.esh_attribute10;
690 End If;
691 If (p_rec.esh_attribute11 = hr_api.g_varchar2) then
692 p_rec.esh_attribute11 :=
693 ben_esh_shd.g_old_rec.esh_attribute11;
694 End If;
695 If (p_rec.esh_attribute12 = hr_api.g_varchar2) then
696 p_rec.esh_attribute12 :=
697 ben_esh_shd.g_old_rec.esh_attribute12;
698 End If;
699 If (p_rec.esh_attribute13 = hr_api.g_varchar2) then
700 p_rec.esh_attribute13 :=
701 ben_esh_shd.g_old_rec.esh_attribute13;
702 End If;
703 If (p_rec.esh_attribute14 = hr_api.g_varchar2) then
704 p_rec.esh_attribute14 :=
705 ben_esh_shd.g_old_rec.esh_attribute14;
706 End If;
707 If (p_rec.esh_attribute15 = hr_api.g_varchar2) then
708 p_rec.esh_attribute15 :=
709 ben_esh_shd.g_old_rec.esh_attribute15;
710 End If;
711 If (p_rec.esh_attribute16 = hr_api.g_varchar2) then
712 p_rec.esh_attribute16 :=
713 ben_esh_shd.g_old_rec.esh_attribute16;
714 End If;
715 If (p_rec.esh_attribute17 = hr_api.g_varchar2) then
716 p_rec.esh_attribute17 :=
717 ben_esh_shd.g_old_rec.esh_attribute17;
718 End If;
719 If (p_rec.esh_attribute18 = hr_api.g_varchar2) then
720 p_rec.esh_attribute18 :=
721 ben_esh_shd.g_old_rec.esh_attribute18;
722 End If;
723 If (p_rec.esh_attribute19 = hr_api.g_varchar2) then
724 p_rec.esh_attribute19 :=
725 ben_esh_shd.g_old_rec.esh_attribute19;
726 End If;
727 If (p_rec.esh_attribute20 = hr_api.g_varchar2) then
728 p_rec.esh_attribute20 :=
729 ben_esh_shd.g_old_rec.esh_attribute20;
730 End If;
731 If (p_rec.esh_attribute21 = hr_api.g_varchar2) then
732 p_rec.esh_attribute21 :=
733 ben_esh_shd.g_old_rec.esh_attribute21;
734 End If;
735 If (p_rec.esh_attribute22 = hr_api.g_varchar2) then
736 p_rec.esh_attribute22 :=
737 ben_esh_shd.g_old_rec.esh_attribute22;
738 End If;
739 If (p_rec.esh_attribute23 = hr_api.g_varchar2) then
740 p_rec.esh_attribute23 :=
741 ben_esh_shd.g_old_rec.esh_attribute23;
742 End If;
743 If (p_rec.esh_attribute24 = hr_api.g_varchar2) then
744 p_rec.esh_attribute24 :=
745 ben_esh_shd.g_old_rec.esh_attribute24;
746 End If;
747 If (p_rec.esh_attribute25 = hr_api.g_varchar2) then
748 p_rec.esh_attribute25 :=
749 ben_esh_shd.g_old_rec.esh_attribute25;
750 End If;
751 If (p_rec.esh_attribute26 = hr_api.g_varchar2) then
752 p_rec.esh_attribute26 :=
753 ben_esh_shd.g_old_rec.esh_attribute26;
754 End If;
755 If (p_rec.esh_attribute27 = hr_api.g_varchar2) then
756 p_rec.esh_attribute27 :=
757 ben_esh_shd.g_old_rec.esh_attribute27;
758 End If;
759 If (p_rec.esh_attribute28 = hr_api.g_varchar2) then
760 p_rec.esh_attribute28 :=
761 ben_esh_shd.g_old_rec.esh_attribute28;
762 End If;
763 If (p_rec.esh_attribute29 = hr_api.g_varchar2) then
764 p_rec.esh_attribute29 :=
765 ben_esh_shd.g_old_rec.esh_attribute29;
766 End If;
767 If (p_rec.esh_attribute30 = hr_api.g_varchar2) then
768 p_rec.esh_attribute30 :=
769 ben_esh_shd.g_old_rec.esh_attribute30;
770 End If;
771 If (p_rec.criteria_score = hr_api.g_number) then
772 p_rec.criteria_score :=
773 ben_esh_shd.g_old_rec.criteria_score;
774 End If;
775 If (p_rec.criteria_weight = hr_api.g_number) then
776 p_rec.criteria_weight :=
777 ben_esh_shd.g_old_rec.criteria_weight;
778 End If;
779
780 --
781 hr_utility.set_location(' Leaving:'||l_proc, 10);
782 --
783 End convert_defs;
784 --
785 -- ----------------------------------------------------------------------------
786 -- |---------------------------------< upd >----------------------------------|
787 -- ----------------------------------------------------------------------------
788 Procedure upd
789 (
790 p_rec in out nocopy ben_esh_shd.g_rec_type,
791 p_effective_date in date,
792 p_datetrack_mode in varchar2
793 ) is
794 --
795 l_proc varchar2(72) := g_package||'upd';
796 l_validation_start_date date;
797 l_validation_end_date date;
798 --
799 Begin
800 hr_utility.set_location('Entering:'||l_proc, 5);
801 --
802 -- Ensure that the DateTrack update mode is valid
803 --
804 dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
805 --
806 -- We must lock the row which we need to update.
807 --
808 ben_esh_shd.lck
809 (p_effective_date => p_effective_date,
810 p_datetrack_mode => p_datetrack_mode,
811 p_elig_schedd_hrs_prte_id => p_rec.elig_schedd_hrs_prte_id,
812 p_object_version_number => p_rec.object_version_number,
813 p_validation_start_date => l_validation_start_date,
814 p_validation_end_date => l_validation_end_date);
815 --
816 -- 1. During an update system defaults are used to determine if
817 -- arguments have been defaulted or not. We must therefore
818 -- derive the full record structure values to be updated.
819 --
820 -- 2. Call the supporting update validate operations.
821 --
822 convert_defs(p_rec);
823 ben_esh_bus.update_validate
824 (p_rec => p_rec,
825 p_effective_date => p_effective_date,
826 p_datetrack_mode => p_datetrack_mode,
827 p_validation_start_date => l_validation_start_date,
828 p_validation_end_date => l_validation_end_date);
829 --
830 -- Call the supporting pre-update operation
831 --
832 pre_update
833 (p_rec => p_rec,
834 p_effective_date => p_effective_date,
835 p_datetrack_mode => p_datetrack_mode,
836 p_validation_start_date => l_validation_start_date,
837 p_validation_end_date => l_validation_end_date);
838 --
839 -- Update the row.
840 --
841 update_dml
842 (p_rec => p_rec,
843 p_effective_date => p_effective_date,
844 p_datetrack_mode => p_datetrack_mode,
845 p_validation_start_date => l_validation_start_date,
846 p_validation_end_date => l_validation_end_date);
847 --
848 -- Call the supporting post-update operation
849 --
850 post_update
851 (p_rec => p_rec,
852 p_effective_date => p_effective_date,
853 p_datetrack_mode => p_datetrack_mode,
854 p_validation_start_date => l_validation_start_date,
855 p_validation_end_date => l_validation_end_date);
856 End upd;
857 --
858 -- ----------------------------------------------------------------------------
859 -- |---------------------------------< upd >----------------------------------|
860 -- ----------------------------------------------------------------------------
861 Procedure upd
862 (
863 p_elig_schedd_hrs_prte_id in number,
864 p_effective_start_date out nocopy date,
865 p_effective_end_date out nocopy date,
866 p_business_group_id in number default hr_api.g_number,
867 p_hrs_num in number default hr_api.g_number,
868 p_determination_cd in varchar2 default hr_api.g_varchar2,
869 p_determination_rl in number default hr_api.g_number,
870 p_rounding_cd in varchar2 default hr_api.g_varchar2,
871 p_rounding_rl in number default hr_api.g_number,
872 p_max_hrs_num in number default hr_api.g_number,
873 p_schedd_hrs_rl in number default hr_api.g_number,
874 p_freq_cd in varchar2 default hr_api.g_varchar2,
875 p_ordr_num in number default hr_api.g_number,
876 p_excld_flag in varchar2 default hr_api.g_varchar2,
877 p_eligy_prfl_id in number default hr_api.g_number,
878 p_esh_attribute_category in varchar2 default hr_api.g_varchar2,
879 p_esh_attribute1 in varchar2 default hr_api.g_varchar2,
880 p_esh_attribute2 in varchar2 default hr_api.g_varchar2,
881 p_esh_attribute3 in varchar2 default hr_api.g_varchar2,
882 p_esh_attribute4 in varchar2 default hr_api.g_varchar2,
883 p_esh_attribute5 in varchar2 default hr_api.g_varchar2,
884 p_esh_attribute6 in varchar2 default hr_api.g_varchar2,
885 p_esh_attribute7 in varchar2 default hr_api.g_varchar2,
886 p_esh_attribute8 in varchar2 default hr_api.g_varchar2,
887 p_esh_attribute9 in varchar2 default hr_api.g_varchar2,
888 p_esh_attribute10 in varchar2 default hr_api.g_varchar2,
889 p_esh_attribute11 in varchar2 default hr_api.g_varchar2,
890 p_esh_attribute12 in varchar2 default hr_api.g_varchar2,
891 p_esh_attribute13 in varchar2 default hr_api.g_varchar2,
892 p_esh_attribute14 in varchar2 default hr_api.g_varchar2,
893 p_esh_attribute15 in varchar2 default hr_api.g_varchar2,
894 p_esh_attribute16 in varchar2 default hr_api.g_varchar2,
895 p_esh_attribute17 in varchar2 default hr_api.g_varchar2,
896 p_esh_attribute18 in varchar2 default hr_api.g_varchar2,
897 p_esh_attribute19 in varchar2 default hr_api.g_varchar2,
898 p_esh_attribute20 in varchar2 default hr_api.g_varchar2,
899 p_esh_attribute21 in varchar2 default hr_api.g_varchar2,
900 p_esh_attribute22 in varchar2 default hr_api.g_varchar2,
901 p_esh_attribute23 in varchar2 default hr_api.g_varchar2,
902 p_esh_attribute24 in varchar2 default hr_api.g_varchar2,
903 p_esh_attribute25 in varchar2 default hr_api.g_varchar2,
904 p_esh_attribute26 in varchar2 default hr_api.g_varchar2,
905 p_esh_attribute27 in varchar2 default hr_api.g_varchar2,
906 p_esh_attribute28 in varchar2 default hr_api.g_varchar2,
907 p_esh_attribute29 in varchar2 default hr_api.g_varchar2,
908 p_esh_attribute30 in varchar2 default hr_api.g_varchar2,
909 p_object_version_number in out nocopy number,
910 p_effective_date in date,
911 p_datetrack_mode in varchar2 ,
912 p_criteria_score in number default hr_api.g_number,
913 p_criteria_weight in number default hr_api.g_number
914 ) is
915 --
916 l_rec ben_esh_shd.g_rec_type;
917 l_proc varchar2(72) := g_package||'upd';
918 --
919 Begin
920 hr_utility.set_location('Entering:'||l_proc, 5);
921 --
922 -- Call conversion function to turn arguments into the
923 -- l_rec structure.
924 --
925 l_rec :=
926 ben_esh_shd.convert_args
927 (
928 p_elig_schedd_hrs_prte_id,
929 null,
930 null,
931 p_business_group_id,
932 p_hrs_num,
933 p_determination_cd,
934 p_determination_rl,
935 p_rounding_cd,
936 p_rounding_rl,
937 p_max_hrs_num,
938 p_schedd_hrs_rl,
939 p_freq_cd,
940 p_ordr_num,
941 p_excld_flag,
942 p_eligy_prfl_id,
943 p_esh_attribute_category,
944 p_esh_attribute1,
945 p_esh_attribute2,
946 p_esh_attribute3,
947 p_esh_attribute4,
948 p_esh_attribute5,
949 p_esh_attribute6,
950 p_esh_attribute7,
951 p_esh_attribute8,
952 p_esh_attribute9,
953 p_esh_attribute10,
954 p_esh_attribute11,
955 p_esh_attribute12,
956 p_esh_attribute13,
957 p_esh_attribute14,
958 p_esh_attribute15,
959 p_esh_attribute16,
960 p_esh_attribute17,
961 p_esh_attribute18,
962 p_esh_attribute19,
963 p_esh_attribute20,
964 p_esh_attribute21,
965 p_esh_attribute22,
966 p_esh_attribute23,
967 p_esh_attribute24,
968 p_esh_attribute25,
969 p_esh_attribute26,
970 p_esh_attribute27,
971 p_esh_attribute28,
972 p_esh_attribute29,
973 p_esh_attribute30,
974 p_object_version_number ,
975 p_criteria_score,
976 p_criteria_weight
977 );
978 --
979 -- Having converted the arguments into the
980 -- plsql record structure we call the corresponding record
981 -- business process.
982 --
983 upd(l_rec, p_effective_date, p_datetrack_mode);
984 p_object_version_number := l_rec.object_version_number;
985 p_effective_start_date := l_rec.effective_start_date;
986 p_effective_end_date := l_rec.effective_end_date;
987 --
988 --
989 hr_utility.set_location(' Leaving:'||l_proc, 10);
990 End upd;
991 --
992 end ben_esh_upd;