[Home] [Help]
PACKAGE BODY: APPS.HR_PERSON_ABSENCE_API
Source
1 Package Body hr_person_absence_api as
2 /* $Header: peabsapi.pkb 120.4.12010000.2 2008/08/06 08:52:29 ubhat ship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' hr_person_absence_api.';
7 --
8 procedure populate_ben_absence_rec
9 (p_absence_attendance_id in number,
10 p_rec_type in varchar2,
11 p_ben_rec out nocopy ben_abs_ler.g_abs_ler_rec) is
12
13 cursor c_current_absence is
14 select
15 absence_attendance_id
16 ,business_group_id
17 ,absence_attendance_type_id
18 ,abs_attendance_reason_id
19 ,person_id
20 ,authorising_person_id
21 ,replacement_person_id
22 ,period_of_incapacity_id
23 ,absence_days
24 ,absence_hours
25 ,comments
26 ,date_end
27 ,date_notification
28 ,date_projected_end
29 ,date_projected_start
30 ,date_start
31 ,occurrence
32 ,ssp1_issued
33 ,time_end
34 ,time_projected_end
35 ,time_projected_start
36 ,time_start
37 ,request_id
38 ,program_application_id
39 ,program_id
40 ,program_update_date
41 ,attribute_category
42 ,attribute1
43 ,attribute2
44 ,attribute3
45 ,attribute4
46 ,attribute5
47 ,attribute6
48 ,attribute7
49 ,attribute8
50 ,attribute9
51 ,attribute10
52 ,attribute11
53 ,attribute12
54 ,attribute13
55 ,attribute14
56 ,attribute15
57 ,attribute16
58 ,attribute17
59 ,attribute18
60 ,attribute19
61 ,attribute20
62 ,maternity_id
63 ,sickness_start_date
64 ,sickness_end_date
65 ,pregnancy_related_illness
66 ,reason_for_notification_delay
67 ,accept_late_notification_flag
68 ,linked_absence_id
69 ,abs_information_category
70 ,abs_information1
71 ,abs_information2
72 ,abs_information3
73 ,abs_information4
74 ,abs_information5
75 ,abs_information6
76 ,abs_information7
77 ,abs_information8
78 ,abs_information9
79 ,abs_information10
80 ,abs_information11
81 ,abs_information12
82 ,abs_information13
83 ,abs_information14
84 ,abs_information15
85 ,abs_information16
86 ,abs_information17
87 ,abs_information18
88 ,abs_information19
89 ,abs_information20
90 ,abs_information21
91 ,abs_information22
92 ,abs_information23
93 ,abs_information24
94 ,abs_information25
95 ,abs_information26
96 ,abs_information27
97 ,abs_information28
98 ,abs_information29
99 ,abs_information30
100 ,absence_case_id
101 ,batch_id
102 ,object_version_number
103 from per_absence_attendances
104 where absence_attendance_id = p_absence_attendance_id;
105 --
106 l_absence_rec per_abs_shd.g_rec_type;
107 l_proc varchar2(72) := g_package||'populate_ben_absence_rec';
108
109 begin
110
111 hr_utility.set_location('Entering: '|| l_proc, 10);
112
113 if (p_rec_type = 'O') then
114 l_absence_rec := per_abs_shd.g_old_rec;
115 else
116 open c_current_absence;
117 fetch c_current_absence into l_absence_rec;
118 close c_current_absence;
119 end if;
120
121 p_ben_rec.person_id := l_absence_rec.person_id;
122 p_ben_rec.business_group_id := l_absence_rec.business_group_id;
123 p_ben_rec.date_start := l_absence_rec.date_start;
124 p_ben_rec.date_end := l_absence_rec.date_end;
125 p_ben_rec.absence_attendance_type_id := l_absence_rec.absence_attendance_type_id;
126 p_ben_rec.abs_attendance_reason_id := l_absence_rec.abs_attendance_reason_id;
127 p_ben_rec.absence_attendance_id := l_absence_rec.absence_attendance_id;
128 p_ben_rec.authorising_person_id := l_absence_rec.authorising_person_id;
129 p_ben_rec.replacement_person_id := l_absence_rec.replacement_person_id;
130 p_ben_rec.period_of_incapacity_id := l_absence_rec.period_of_incapacity_id;
131 p_ben_rec.absence_days := l_absence_rec.absence_days;
132 p_ben_rec.absence_hours := l_absence_rec.absence_hours;
133 p_ben_rec.date_notification := l_absence_rec.date_notification;
134 p_ben_rec.date_projected_end := l_absence_rec.date_projected_end;
135 p_ben_rec.date_projected_start := l_absence_rec.date_projected_start;
136 p_ben_rec.occurrence := l_absence_rec.occurrence;
137 p_ben_rec.ssp1_issued := l_absence_rec.ssp1_issued;
138 p_ben_rec.time_end := l_absence_rec.time_end;
139 p_ben_rec.time_projected_end := l_absence_rec.time_projected_end;
140 p_ben_rec.time_projected_start := l_absence_rec.time_projected_start;
141 p_ben_rec.time_start := l_absence_rec.time_start;
142 p_ben_rec.attribute_category := l_absence_rec.attribute_category;
143 p_ben_rec.attribute1 := l_absence_rec.attribute1;
144 p_ben_rec.attribute2 := l_absence_rec.attribute2;
145 p_ben_rec.attribute3 := l_absence_rec.attribute3;
146 p_ben_rec.attribute4 := l_absence_rec.attribute4;
147 p_ben_rec.attribute5 := l_absence_rec.attribute5;
148 p_ben_rec.attribute6 := l_absence_rec.attribute6;
149 p_ben_rec.attribute7 := l_absence_rec.attribute7;
150 p_ben_rec.attribute8 := l_absence_rec.attribute8;
151 p_ben_rec.attribute9 := l_absence_rec.attribute9;
152 p_ben_rec.attribute10 := l_absence_rec.attribute10;
153 p_ben_rec.attribute11 := l_absence_rec.attribute11;
154 p_ben_rec.attribute12 := l_absence_rec.attribute12;
155 p_ben_rec.attribute13 := l_absence_rec.attribute13;
156 p_ben_rec.attribute14 := l_absence_rec.attribute14;
157 p_ben_rec.attribute15 := l_absence_rec.attribute15;
158 p_ben_rec.attribute16 := l_absence_rec.attribute16;
159 p_ben_rec.attribute17 := l_absence_rec.attribute17;
160 p_ben_rec.attribute18 := l_absence_rec.attribute18;
161 p_ben_rec.attribute19 := l_absence_rec.attribute19;
162 p_ben_rec.attribute20 := l_absence_rec.attribute20;
163 p_ben_rec.maternity_id := l_absence_rec.maternity_id;
164 p_ben_rec.sickness_start_date := l_absence_rec.sickness_start_date;
165 p_ben_rec.sickness_end_date := l_absence_rec.sickness_end_date;
166 p_ben_rec.pregnancy_related_illness := l_absence_rec.pregnancy_related_illness;
167 p_ben_rec.reason_for_notification_delay := l_absence_rec.reason_for_notification_delay;
168 p_ben_rec.accept_late_notification_flag := l_absence_rec.accept_late_notification_flag;
169 p_ben_rec.linked_absence_id := l_absence_rec.linked_absence_id;
170 p_ben_rec.batch_id := l_absence_rec.batch_id;
171 p_ben_rec.abs_information_category := l_absence_rec.abs_information_category;
172 p_ben_rec.abs_information1 := l_absence_rec.abs_information1;
173 p_ben_rec.abs_information2 := l_absence_rec.abs_information2;
174 p_ben_rec.abs_information3 := l_absence_rec.abs_information3;
175 p_ben_rec.abs_information4 := l_absence_rec.abs_information4;
176 p_ben_rec.abs_information5 := l_absence_rec.abs_information5;
177 p_ben_rec.abs_information6 := l_absence_rec.abs_information6;
178 p_ben_rec.abs_information7 := l_absence_rec.abs_information7;
179 p_ben_rec.abs_information8 := l_absence_rec.abs_information8;
180 p_ben_rec.abs_information9 := l_absence_rec.abs_information9;
181 p_ben_rec.abs_information10 := l_absence_rec.abs_information10;
182 p_ben_rec.abs_information11 := l_absence_rec.abs_information11;
183 p_ben_rec.abs_information12 := l_absence_rec.abs_information12;
184 p_ben_rec.abs_information13 := l_absence_rec.abs_information13;
185 p_ben_rec.abs_information14 := l_absence_rec.abs_information14;
186 p_ben_rec.abs_information15 := l_absence_rec.abs_information15;
187 p_ben_rec.abs_information16 := l_absence_rec.abs_information16;
188 p_ben_rec.abs_information17 := l_absence_rec.abs_information17;
189 p_ben_rec.abs_information18 := l_absence_rec.abs_information18;
190 p_ben_rec.abs_information19 := l_absence_rec.abs_information19;
191 p_ben_rec.abs_information20 := l_absence_rec.abs_information20;
192 p_ben_rec.abs_information21 := l_absence_rec.abs_information21;
193 p_ben_rec.abs_information22 := l_absence_rec.abs_information22;
194 p_ben_rec.abs_information23 := l_absence_rec.abs_information23;
195 p_ben_rec.abs_information24 := l_absence_rec.abs_information24;
196 p_ben_rec.abs_information25 := l_absence_rec.abs_information25;
197 p_ben_rec.abs_information26 := l_absence_rec.abs_information26;
198 p_ben_rec.abs_information27 := l_absence_rec.abs_information27;
199 p_ben_rec.abs_information28 := l_absence_rec.abs_information28;
200 p_ben_rec.abs_information29 := l_absence_rec.abs_information29;
201 p_ben_rec.abs_information30 := l_absence_rec.abs_information30;
202
203 hr_utility.set_location('Leaving: '|| l_proc, 15);
204 end;
205 --
206 -- ----------------------------------------------------------------------------
207 -- |----------------------< create_person_absence >---------------------------|
208 -- ----------------------------------------------------------------------------
209 --
210 procedure create_person_absence
211 (p_validate in boolean default false
212 ,p_effective_date in date
213 ,p_person_id in number
214 ,p_business_group_id in number
215 ,p_absence_attendance_type_id in number
216 ,p_abs_attendance_reason_id in number default null
217 ,p_comments in long default null
218 ,p_date_notification in date default null
219 ,p_date_projected_start in date default null
220 ,p_time_projected_start in varchar2 default null
221 ,p_date_projected_end in date default null
222 ,p_time_projected_end in varchar2 default null
223 ,p_date_start in date default null
224 ,p_time_start in varchar2 default null
225 ,p_date_end in date default null
226 ,p_time_end in varchar2 default null
227 ,p_absence_days in out nocopy number
228 ,p_absence_hours in out nocopy number
229 ,p_authorising_person_id in number default null
230 ,p_replacement_person_id in number default null
231 ,p_attribute_category in varchar2 default null
232 ,p_attribute1 in varchar2 default null
233 ,p_attribute2 in varchar2 default null
234 ,p_attribute3 in varchar2 default null
235 ,p_attribute4 in varchar2 default null
236 ,p_attribute5 in varchar2 default null
237 ,p_attribute6 in varchar2 default null
238 ,p_attribute7 in varchar2 default null
239 ,p_attribute8 in varchar2 default null
240 ,p_attribute9 in varchar2 default null
241 ,p_attribute10 in varchar2 default null
242 ,p_attribute11 in varchar2 default null
243 ,p_attribute12 in varchar2 default null
244 ,p_attribute13 in varchar2 default null
245 ,p_attribute14 in varchar2 default null
246 ,p_attribute15 in varchar2 default null
247 ,p_attribute16 in varchar2 default null
248 ,p_attribute17 in varchar2 default null
249 ,p_attribute18 in varchar2 default null
250 ,p_attribute19 in varchar2 default null
251 ,p_attribute20 in varchar2 default null
252 ,p_period_of_incapacity_id in number default null
253 ,p_ssp1_issued in varchar2 default 'N'
254 ,p_maternity_id in number default null
255 ,p_sickness_start_date in date default null
256 ,p_sickness_end_date in date default null
257 ,p_pregnancy_related_illness in varchar2 default 'N'
258 ,p_reason_for_notification_dela in varchar2 default null
259 ,p_accept_late_notification_fla in varchar2 default 'N'
260 ,p_linked_absence_id in number default null
261 ,p_batch_id in number default null
262 ,p_create_element_entry in boolean default true
263 ,p_abs_information_category in varchar2 default null
264 ,p_abs_information1 in varchar2 default null
265 ,p_abs_information2 in varchar2 default null
266 ,p_abs_information3 in varchar2 default null
267 ,p_abs_information4 in varchar2 default null
268 ,p_abs_information5 in varchar2 default null
269 ,p_abs_information6 in varchar2 default null
270 ,p_abs_information7 in varchar2 default null
271 ,p_abs_information8 in varchar2 default null
272 ,p_abs_information9 in varchar2 default null
273 ,p_abs_information10 in varchar2 default null
274 ,p_abs_information11 in varchar2 default null
275 ,p_abs_information12 in varchar2 default null
276 ,p_abs_information13 in varchar2 default null
277 ,p_abs_information14 in varchar2 default null
278 ,p_abs_information15 in varchar2 default null
279 ,p_abs_information16 in varchar2 default null
280 ,p_abs_information17 in varchar2 default null
281 ,p_abs_information18 in varchar2 default null
282 ,p_abs_information19 in varchar2 default null
283 ,p_abs_information20 in varchar2 default null
284 ,p_abs_information21 in varchar2 default null
285 ,p_abs_information22 in varchar2 default null
286 ,p_abs_information23 in varchar2 default null
287 ,p_abs_information24 in varchar2 default null
288 ,p_abs_information25 in varchar2 default null
289 ,p_abs_information26 in varchar2 default null
290 ,p_abs_information27 in varchar2 default null
291 ,p_abs_information28 in varchar2 default null
292 ,p_abs_information29 in varchar2 default null
293 ,p_abs_information30 in varchar2 default null
294 ,p_absence_case_id in number default null
295 ,p_absence_attendance_id out nocopy number
296 ,p_object_version_number out nocopy number
297 ,p_occurrence out nocopy number
298 ,p_dur_dys_less_warning out nocopy boolean
299 ,p_dur_hrs_less_warning out nocopy boolean
300 ,p_exceeds_pto_entit_warning out nocopy boolean
301 ,p_exceeds_run_total_warning out nocopy boolean
302 ,p_abs_overlap_warning out nocopy boolean
303 ,p_abs_day_after_warning out nocopy boolean
304 ,p_dur_overwritten_warning out nocopy boolean
305 ) is
306
307 --
308 -- Declare cursors and local variables
309 --
310
311 l_proc varchar2(72) := g_package||'create_person_absence';
312 l_exists number;
313 l_occurrence number;
314 l_input_value_id number;
315 l_date_projected_start date;
316 l_date_projected_end date;
317 l_date_start date;
318 l_date_end date;
319 l_date_notification date;
320 l_effective_date date;
321 l_old ben_abs_ler.g_abs_ler_rec;
322 l_new ben_abs_ler.g_abs_ler_rec;
323 --
324 -- Declare out parameters
325 --
326 l_absence_days number;
327 l_absence_hours number;
328 l_absence_attendance_id number;
329 l_assignment_id number;
330 l_element_entry_id number;
331 l_object_version_number number;
332 l_processing_type pay_element_types_f.processing_type%TYPE;
333 l_dur_dys_less_warning boolean;
334 l_dur_hrs_less_warning boolean;
335 l_exceeds_pto_entit_warning boolean;
336 l_exceeds_run_total_warning boolean;
337 l_abs_overlap_warning boolean;
338 l_abs_day_after_warning boolean;
339 l_dur_overwritten_warning boolean;
340 --
341
342 begin
343 hr_utility.set_location('Entering:'|| l_proc, 10);
344
345 --
346 -- Pipe the main IN / IN OUT parameters for ease of debugging.
347 --
348 hr_utility.trace(' ');
349 hr_utility.trace(' --------------------------------'||
350 '---------------------------------');
351 hr_utility.trace(' IN / IN OUT NOCOPY PARAMETER '||
352 ' VALUE');
353 hr_utility.trace(' --------------------------------'||
354 '+--------------------------------');
355 hr_utility.trace(' p_effective_date '||
356 to_char(p_effective_date));
357 hr_utility.trace(' p_person_id '||
358 to_char(p_person_id));
359 hr_utility.trace(' p_business_group_id '||
360 to_char(p_business_group_id));
361 hr_utility.trace(' p_absence_attendance_type_id '||
362 to_char(p_absence_attendance_type_id));
363 hr_utility.trace(' p_abs_attendance_reason_id '||
364 to_char(p_abs_attendance_reason_id));
365 hr_utility.trace(' p_date_notification '||
366 to_char(p_date_notification));
367 hr_utility.trace(' p_date_projected_start '||
368 to_char(p_date_projected_start));
369 hr_utility.trace(' p_time_projected_start '||
370 p_time_projected_start);
371 hr_utility.trace(' p_date_projected_end '||
372 to_char(p_date_projected_end));
373 hr_utility.trace(' p_time_projected_end '||
374 p_time_projected_end);
375 hr_utility.trace(' p_date_start '||
376 to_char(p_date_start));
377 hr_utility.trace(' p_time_start '||
378 p_time_start);
379 hr_utility.trace(' p_date_end '||
380 to_char(p_date_end));
381 hr_utility.trace(' p_time_end '||
382 p_time_end);
383 hr_utility.trace(' p_absence_days '||
384 to_char(p_absence_days));
385 hr_utility.trace(' p_absence_hours '||
386 to_char(p_absence_hours));
387 hr_utility.trace(' p_authorising_person_id '||
388 to_char(p_authorising_person_id));
389 hr_utility.trace(' p_batch_id '||
390 to_char(p_batch_id));
391 if p_create_element_entry then
392 hr_utility.trace(' p_create_element_entry '||
393 'TRUE');
394 else
395 hr_utility.trace(' p_create_element_entry '||
396 'FALSE');
397 end if;
398 hr_utility.trace(' --------------------------------'||
399 '---------------------------------');
400 hr_utility.trace(' ');
401
402 --
403 -- Create a savepoint.
404 --
405 savepoint create_person_absence;
406 --
407 -- Truncate the time portion from all IN date parameters
408 --
409 l_effective_date := trunc(p_effective_date);
410 l_date_projected_start := trunc(p_date_projected_start);
411 l_date_projected_end := trunc(p_date_projected_end);
412 l_date_start := trunc(p_date_start);
413 l_date_end := trunc(p_date_end);
414 l_date_notification := trunc(p_date_notification);
415 l_absence_days := p_absence_days;
416 l_absence_hours := p_absence_hours;
417
418 --
419 -- Call Before Process User Hook
420 --
421 begin
422 hr_person_absence_bk1.create_person_absence_b
423 (p_effective_date => p_effective_date
424 ,p_person_id => p_person_id
425 ,p_business_group_id => p_business_group_id
426 ,p_absence_attendance_type_id => p_absence_attendance_type_id
427 ,p_abs_attendance_reason_id => p_abs_attendance_reason_id
428 ,p_comments => p_comments
429 ,p_date_notification => p_date_notification
430 ,p_date_projected_start => p_date_projected_start
431 ,p_time_projected_start => p_time_projected_start
432 ,p_date_projected_end => p_date_projected_end
433 ,p_time_projected_end => p_time_projected_end
434 ,p_date_start => p_date_start
435 ,p_time_start => p_time_start
436 ,p_date_end => p_date_end
437 ,p_time_end => p_time_end
438 ,p_absence_days => l_absence_days
439 ,p_absence_hours => l_absence_hours
440 ,p_authorising_person_id => p_authorising_person_id
441 ,p_replacement_person_id => p_replacement_person_id
442 ,p_attribute_category => p_attribute_category
443 ,p_attribute1 => p_attribute1
444 ,p_attribute2 => p_attribute2
445 ,p_attribute3 => p_attribute3
446 ,p_attribute4 => p_attribute4
447 ,p_attribute5 => p_attribute5
448 ,p_attribute6 => p_attribute6
449 ,p_attribute7 => p_attribute7
450 ,p_attribute8 => p_attribute8
451 ,p_attribute9 => p_attribute9
452 ,p_attribute10 => p_attribute10
453 ,p_attribute11 => p_attribute11
454 ,p_attribute12 => p_attribute12
455 ,p_attribute13 => p_attribute13
456 ,p_attribute14 => p_attribute14
457 ,p_attribute15 => p_attribute15
458 ,p_attribute16 => p_attribute16
459 ,p_attribute17 => p_attribute17
460 ,p_attribute18 => p_attribute18
461 ,p_attribute19 => p_attribute19
462 ,p_attribute20 => p_attribute20
463 ,p_period_of_incapacity_id => p_period_of_incapacity_id
464 ,p_ssp1_issued => p_ssp1_issued
465 ,p_maternity_id => p_maternity_id
466 ,p_sickness_start_date => p_sickness_start_date
467 ,p_sickness_end_date => p_sickness_end_date
468 ,p_pregnancy_related_illness => p_pregnancy_related_illness
469 ,p_reason_for_notification_dela => p_reason_for_notification_dela
470 ,p_accept_late_notification_fla => p_accept_late_notification_fla
471 ,p_linked_absence_id => p_linked_absence_id
472 ,p_absence_case_id => p_absence_case_id
473 ,p_batch_id => p_batch_id
474 ,p_create_element_entry => p_create_element_entry
475 ,p_abs_information_category => p_abs_information_category
476 ,p_abs_information1 => p_abs_information1
477 ,p_abs_information2 => p_abs_information2
478 ,p_abs_information3 => p_abs_information3
479 ,p_abs_information4 => p_abs_information4
480 ,p_abs_information5 => p_abs_information5
481 ,p_abs_information6 => p_abs_information6
482 ,p_abs_information7 => p_abs_information7
483 ,p_abs_information8 => p_abs_information8
484 ,p_abs_information9 => p_abs_information9
485 ,p_abs_information10 => p_abs_information10
486 ,p_abs_information11 => p_abs_information11
487 ,p_abs_information12 => p_abs_information12
488 ,p_abs_information13 => p_abs_information13
489 ,p_abs_information14 => p_abs_information14
490 ,p_abs_information15 => p_abs_information15
491 ,p_abs_information16 => p_abs_information16
492 ,p_abs_information17 => p_abs_information17
493 ,p_abs_information18 => p_abs_information18
494 ,p_abs_information19 => p_abs_information19
495 ,p_abs_information20 => p_abs_information20
496 ,p_abs_information21 => p_abs_information21
497 ,p_abs_information22 => p_abs_information22
498 ,p_abs_information23 => p_abs_information23
499 ,p_abs_information24 => p_abs_information24
500 ,p_abs_information25 => p_abs_information25
501 ,p_abs_information26 => p_abs_information26
502 ,p_abs_information27 => p_abs_information27
503 ,p_abs_information28 => p_abs_information28
504 ,p_abs_information29 => p_abs_information29
505 ,p_abs_information30 => p_abs_information30
506 );
507 exception
508 when hr_api.cannot_find_prog_unit then
509 hr_api.cannot_find_prog_unit_error
510 (p_module_name => 'CREATE_PERSON_ABSENCE'
511 ,p_hook_type => 'BP'
512 );
513 end;
514
515 hr_utility.set_location(l_proc, 30);
516 --
517 -- Insert Person Absence
518 per_abs_ins.ins
519 (p_effective_date => l_effective_date
520 ,p_business_group_id => p_business_group_id
521 ,p_absence_attendance_type_id => p_absence_attendance_type_id
522 ,p_person_id => p_person_id
523 ,p_abs_attendance_reason_id => p_abs_attendance_reason_id
524 ,p_authorising_person_id => p_authorising_person_id
525 ,p_replacement_person_id => p_replacement_person_id
526 ,p_absence_days => l_absence_days
527 ,p_absence_hours => l_absence_hours
528 ,p_comments => p_comments
529 ,p_date_end => l_date_end
530 ,p_date_notification => l_date_notification
531 ,p_date_projected_end => l_date_projected_end
532 ,p_date_projected_start => l_date_projected_start
533 ,p_date_start => l_date_start
534 ,p_occurrence => l_occurrence
535 ,p_time_end => p_time_end
536 ,p_time_projected_end => p_time_projected_end
537 ,p_time_projected_start => p_time_projected_start
538 ,p_time_start => p_time_start
539 ,p_attribute_category => p_attribute_category
540 ,p_attribute1 => p_attribute1
541 ,p_attribute2 => p_attribute2
542 ,p_attribute3 => p_attribute3
543 ,p_attribute4 => p_attribute4
544 ,p_attribute5 => p_attribute5
545 ,p_attribute6 => p_attribute6
546 ,p_attribute7 => p_attribute7
547 ,p_attribute8 => p_attribute8
548 ,p_attribute9 => p_attribute9
549 ,p_attribute10 => p_attribute10
550 ,p_attribute11 => p_attribute11
551 ,p_attribute12 => p_attribute12
552 ,p_attribute13 => p_attribute13
553 ,p_attribute14 => p_attribute14
554 ,p_attribute15 => p_attribute15
555 ,p_attribute16 => p_attribute16
556 ,p_attribute17 => p_attribute17
557 ,p_attribute18 => p_attribute18
558 ,p_attribute19 => p_attribute19
559 ,p_attribute20 => p_attribute20
560 ,p_period_of_incapacity_id => p_period_of_incapacity_id
561 ,p_ssp1_issued => p_ssp1_issued
562 ,p_maternity_id => p_maternity_id
563 ,p_sickness_start_date => p_sickness_start_date
564 ,p_sickness_end_date => p_sickness_end_date
565 ,p_pregnancy_related_illness => p_pregnancy_related_illness
566 ,p_reason_for_notification_dela => p_reason_for_notification_dela
567 ,p_accept_late_notification_fla => p_accept_late_notification_fla
568 ,p_linked_absence_id => p_linked_absence_id
569 ,p_absence_case_id => p_absence_case_id
570 ,p_batch_id => p_batch_id
571 ,p_abs_information_category => p_abs_information_category
572 ,p_abs_information1 => p_abs_information1
573 ,p_abs_information2 => p_abs_information2
574 ,p_abs_information3 => p_abs_information3
575 ,p_abs_information4 => p_abs_information4
576 ,p_abs_information5 => p_abs_information5
577 ,p_abs_information6 => p_abs_information6
578 ,p_abs_information7 => p_abs_information7
579 ,p_abs_information8 => p_abs_information8
580 ,p_abs_information9 => p_abs_information9
581 ,p_abs_information10 => p_abs_information10
582 ,p_abs_information11 => p_abs_information11
583 ,p_abs_information12 => p_abs_information12
584 ,p_abs_information13 => p_abs_information13
585 ,p_abs_information14 => p_abs_information14
586 ,p_abs_information15 => p_abs_information15
587 ,p_abs_information16 => p_abs_information16
588 ,p_abs_information17 => p_abs_information17
589 ,p_abs_information18 => p_abs_information18
590 ,p_abs_information19 => p_abs_information19
591 ,p_abs_information20 => p_abs_information20
592 ,p_abs_information21 => p_abs_information21
593 ,p_abs_information22 => p_abs_information22
594 ,p_abs_information23 => p_abs_information23
595 ,p_abs_information24 => p_abs_information24
596 ,p_abs_information25 => p_abs_information25
597 ,p_abs_information26 => p_abs_information26
598 ,p_abs_information27 => p_abs_information27
599 ,p_abs_information28 => p_abs_information28
600 ,p_abs_information29 => p_abs_information29
601 ,p_abs_information30 => p_abs_information30
602 ,p_absence_attendance_id => l_absence_attendance_id
603 ,p_object_version_number => l_object_version_number
604 ,p_dur_dys_less_warning => l_dur_dys_less_warning
605 ,p_dur_hrs_less_warning => l_dur_hrs_less_warning
606 ,p_exceeds_pto_entit_warning => l_exceeds_pto_entit_warning
607 ,p_exceeds_run_total_warning => l_exceeds_run_total_warning
608 ,p_abs_overlap_warning => l_abs_overlap_warning
609 ,p_abs_day_after_warning => l_abs_day_after_warning
610 ,p_dur_overwritten_warning => l_dur_overwritten_warning
611 );
612
613 p_dur_dys_less_warning := l_dur_dys_less_warning;
614 p_dur_hrs_less_warning := l_dur_hrs_less_warning;
615 p_exceeds_pto_entit_warning := l_exceeds_pto_entit_warning;
616 p_exceeds_run_total_warning := l_exceeds_run_total_warning;
617 p_abs_overlap_warning := l_abs_overlap_warning;
618 p_abs_day_after_warning := l_abs_day_after_warning;
619 p_dur_overwritten_warning := l_dur_overwritten_warning;
620
621 hr_utility.set_location('Start of absence element entry section', 40);
622
623 /* Start of Absence Element Entry Section */
624
625 if p_create_element_entry then
626 --
627 -- Insert the absence element element. First we check if the
628 -- absence type is linked to an element type.
629 --
630
631 if linked_to_element
632 (p_absence_attendance_id => l_absence_attendance_id)
633 then
634
635 --
636 -- Get the assignment_id and processing type for use later
637 --
638 l_assignment_id := get_primary_assignment
639 (p_person_id => p_person_id
640 ,p_effective_date => p_date_start);
641
642 l_processing_type := get_processing_type
643 (p_absence_attendance_type_id => p_absence_attendance_type_id);
644
645
646 if (l_processing_type = 'N'
647 and p_date_start is not null
648 and p_date_end is not null)
649 or (l_processing_type = 'R'
650 and p_date_start is not null)
651 then
652
653 insert_absence_element
654 (p_date_start => p_date_start
655 ,p_assignment_id => l_assignment_id
656 ,p_absence_attendance_id => l_absence_attendance_id
657 ,p_element_entry_id => l_element_entry_id);
658
659 if l_processing_type = 'R' and p_date_end is not null then
660 --
661 -- If this is a recurring element entry and we have the
662 -- absence end date, we date effectively delete the
663 -- element immediately, otherwise it remains open until
664 -- the end of time.
665 --
666
667 delete_absence_element
668 (p_dt_delete_mode => 'DELETE'
669 ,p_session_date => p_date_end
670 ,p_element_entry_id => l_element_entry_id);
671
672 end if;
673
674 end if;
675
676 end if;
677
678 end if;
679 /* End of Absence Element Entry Section */
680
681 hr_utility.set_location('End of absence element entry section', 50);
682
683 populate_ben_absence_rec
684 (p_absence_attendance_id => l_absence_attendance_id,
685 p_rec_type => 'N',
686 p_ben_rec => l_new);
687
688 --
689 -- Start of BEN call.
690 --
691 hr_utility.set_location('Start of BEN call', 52);
692
693 ben_abs_ler.ler_chk
694 (p_old => l_old
695 ,p_new => l_new
696 ,p_effective_date => l_effective_date);
697
698 hr_utility.set_location('End of BEN call', 54);
699
700 --
701 -- Call After Process User Hook
702 --
703
704 begin
705 hr_person_absence_bk1.create_person_absence_a
706 (p_effective_date => p_effective_date
707 ,p_person_id => p_person_id
708 ,p_business_group_id => p_business_group_id
709 ,p_absence_attendance_type_id => p_absence_attendance_type_id
710 ,p_abs_attendance_reason_id => p_abs_attendance_reason_id
711 ,p_comments => p_comments
712 ,p_date_notification => p_date_notification
713 ,p_date_projected_start => p_date_projected_start
714 ,p_time_projected_start => p_time_projected_start
715 ,p_date_projected_end => p_date_projected_end
716 ,p_time_projected_end => p_time_projected_end
717 ,p_date_start => p_date_start
718 ,p_time_start => p_time_start
719 ,p_date_end => p_date_end
720 ,p_time_end => p_time_end
721 ,p_absence_days => l_absence_days
722 ,p_absence_hours => l_absence_hours
723 ,p_authorising_person_id => p_authorising_person_id
724 ,p_replacement_person_id => p_replacement_person_id
725 ,p_attribute_category => p_attribute_category
726 ,p_attribute1 => p_attribute1
727 ,p_attribute2 => p_attribute2
728 ,p_attribute3 => p_attribute3
729 ,p_attribute4 => p_attribute4
730 ,p_attribute5 => p_attribute5
731 ,p_attribute6 => p_attribute6
732 ,p_attribute7 => p_attribute7
733 ,p_attribute8 => p_attribute8
734 ,p_attribute9 => p_attribute9
735 ,p_attribute10 => p_attribute10
736 ,p_attribute11 => p_attribute11
737 ,p_attribute12 => p_attribute12
738 ,p_attribute13 => p_attribute13
739 ,p_attribute14 => p_attribute14
740 ,p_attribute15 => p_attribute15
741 ,p_attribute16 => p_attribute16
742 ,p_attribute17 => p_attribute17
743 ,p_attribute18 => p_attribute18
744 ,p_attribute19 => p_attribute19
745 ,p_attribute20 => p_attribute20
746 ,p_occurrence => l_occurrence
747 ,p_period_of_incapacity_id => p_period_of_incapacity_id
748 ,p_ssp1_issued => p_ssp1_issued
749 ,p_maternity_id => p_maternity_id
750 ,p_sickness_start_date => p_sickness_start_date
751 ,p_sickness_end_date => p_sickness_end_date
752 ,p_pregnancy_related_illness => p_pregnancy_related_illness
753 ,p_reason_for_notification_dela => p_reason_for_notification_dela
754 ,p_accept_late_notification_fla => p_accept_late_notification_fla
755 ,p_linked_absence_id => p_linked_absence_id
756 ,p_absence_case_id => p_absence_case_id
757 ,p_batch_id => p_batch_id
758 ,p_create_element_entry => p_create_element_entry
759 ,p_abs_information_category => p_abs_information_category
760 ,p_abs_information1 => p_abs_information1
761 ,p_abs_information2 => p_abs_information2
762 ,p_abs_information3 => p_abs_information3
763 ,p_abs_information4 => p_abs_information4
764 ,p_abs_information5 => p_abs_information5
765 ,p_abs_information6 => p_abs_information6
766 ,p_abs_information7 => p_abs_information7
767 ,p_abs_information8 => p_abs_information8
768 ,p_abs_information9 => p_abs_information9
769 ,p_abs_information10 => p_abs_information10
770 ,p_abs_information11 => p_abs_information11
771 ,p_abs_information12 => p_abs_information12
772 ,p_abs_information13 => p_abs_information13
773 ,p_abs_information14 => p_abs_information14
774 ,p_abs_information15 => p_abs_information15
775 ,p_abs_information16 => p_abs_information16
776 ,p_abs_information17 => p_abs_information17
777 ,p_abs_information18 => p_abs_information18
778 ,p_abs_information19 => p_abs_information19
779 ,p_abs_information20 => p_abs_information20
780 ,p_abs_information21 => p_abs_information21
781 ,p_abs_information22 => p_abs_information22
782 ,p_abs_information23 => p_abs_information23
783 ,p_abs_information24 => p_abs_information24
784 ,p_abs_information25 => p_abs_information25
785 ,p_abs_information26 => p_abs_information26
786 ,p_abs_information27 => p_abs_information27
787 ,p_abs_information28 => p_abs_information28
788 ,p_abs_information29 => p_abs_information29
789 ,p_abs_information30 => p_abs_information30
790 ,p_absence_attendance_id => l_absence_attendance_id
791 ,p_object_version_number => l_object_version_number
792 ,p_dur_dys_less_warning => l_dur_dys_less_warning
793 ,p_dur_hrs_less_warning => l_dur_hrs_less_warning
794 ,p_exceeds_pto_entit_warning => l_exceeds_pto_entit_warning
795 ,p_exceeds_run_total_warning => l_exceeds_run_total_warning
796 ,p_abs_overlap_warning => l_abs_overlap_warning
797 ,p_abs_day_after_warning => l_abs_day_after_warning
798 ,p_dur_overwritten_warning => l_dur_overwritten_warning
799 );
800 exception
801 when hr_api.cannot_find_prog_unit then
802 hr_api.cannot_find_prog_unit_error
803 (p_module_name => 'CREATE_PERSON_ABSENCE'
804 ,p_hook_type => 'AP'
805 );
806 end;
807 --
808 -- When in validation only mode raise the Validate_Enabled exception
809 --
810 if p_validate then
811 raise hr_api.validate_enabled;
812 end if;
813 --
814 -- Set all output arguments
815 --
816 p_absence_attendance_id := l_absence_attendance_id;
817 p_object_version_number := l_object_version_number;
818 p_absence_days := l_absence_days;
819 p_absence_hours := l_absence_hours;
820 p_occurrence := l_occurrence;
821 --
822
823 --
824 -- Pipe the main IN OUT / OUT parameters for ease of debugging.
825 --
826 hr_utility.trace(' ');
827 hr_utility.trace(' --------------------------------'||
828 '---------------------------------');
829 hr_utility.trace(' IN OUT NOCOPY / OUT NOCOPY PARAMETER '||
830 ' VALUE');
831 hr_utility.trace(' --------------------------------'||
832 '+--------------------------------');
833 hr_utility.trace(' p_absence_days '||
834 to_char(p_absence_days));
835 hr_utility.trace(' p_absence_hours '||
836 to_char(p_absence_hours));
837 hr_utility.trace(' p_absence_attendance_id '||
838 to_char(p_absence_attendance_id));
839 hr_utility.trace(' p_object_version_number '||
840 to_char(p_object_version_number));
841 hr_utility.trace(' p_occurrence '||
842 to_char(p_occurrence));
843 hr_utility.trace(' --------------------------------'||
844 '---------------------------------');
845 hr_utility.trace(' ');
846
847 hr_utility.set_location(' Leaving:'||l_proc, 70);
848
849 exception
850 when hr_api.validate_enabled then
851 --
852 -- As the Validate_Enabled exception has been raised
853 -- we must rollback to the savepoint
854 --
855 rollback to create_person_absence;
856 --
857 -- Only set output warning arguments
858 -- (Any key or derived arguments must be set to null
859 -- when validation only mode is being used.)
860 --
861 p_absence_attendance_id := null;
862 p_object_version_number := null;
863 hr_utility.set_location(l_proc, 80);
864 when others then
865 --
866 -- A validation or unexpected error has occured
867 --
868 p_absence_attendance_id := null;
869 p_object_version_number := null;
870 p_occurrence := null;
871 p_dur_dys_less_warning := null;
872 p_dur_hrs_less_warning := null;
873 p_exceeds_pto_entit_warning := null;
874 p_exceeds_run_total_warning := null;
875 p_abs_overlap_warning := null;
876 p_abs_day_after_warning := null;
877 p_dur_overwritten_warning := null;
878
879 rollback to create_person_absence;
880 hr_utility.set_location(' Leaving:'||l_proc, 90);
881 raise;
882 end create_person_absence;
883 --
884 -- ----------------------------------------------------------------------------
885 -- |----------------------< update_person_absence >---------------------------|
886 -- ----------------------------------------------------------------------------
887 --
888 procedure update_person_absence
889 (p_validate in boolean default false
890 ,p_effective_date in date
891 ,p_absence_attendance_id in number
892 ,p_abs_attendance_reason_id in number default hr_api.g_number
893 ,p_comments in long default hr_api.g_varchar2
894 ,p_date_notification in date default hr_api.g_date
895 ,p_date_projected_start in date default hr_api.g_date
896 ,p_time_projected_start in varchar2 default hr_api.g_varchar2
897 ,p_date_projected_end in date default hr_api.g_date
898 ,p_time_projected_end in varchar2 default hr_api.g_varchar2
899 ,p_date_start in date default hr_api.g_date
900 ,p_time_start in varchar2 default hr_api.g_varchar2
901 ,p_date_end in date default hr_api.g_date
902 ,p_time_end in varchar2 default hr_api.g_varchar2
903 ,p_absence_days in out nocopy number
904 ,p_absence_hours in out nocopy number
905 ,p_authorising_person_id in number default hr_api.g_number
906 ,p_replacement_person_id in number default hr_api.g_number
907 ,p_attribute_category in varchar2 default hr_api.g_varchar2
908 ,p_attribute1 in varchar2 default hr_api.g_varchar2
909 ,p_attribute2 in varchar2 default hr_api.g_varchar2
910 ,p_attribute3 in varchar2 default hr_api.g_varchar2
911 ,p_attribute4 in varchar2 default hr_api.g_varchar2
912 ,p_attribute5 in varchar2 default hr_api.g_varchar2
913 ,p_attribute6 in varchar2 default hr_api.g_varchar2
914 ,p_attribute7 in varchar2 default hr_api.g_varchar2
915 ,p_attribute8 in varchar2 default hr_api.g_varchar2
916 ,p_attribute9 in varchar2 default hr_api.g_varchar2
917 ,p_attribute10 in varchar2 default hr_api.g_varchar2
918 ,p_attribute11 in varchar2 default hr_api.g_varchar2
919 ,p_attribute12 in varchar2 default hr_api.g_varchar2
920 ,p_attribute13 in varchar2 default hr_api.g_varchar2
921 ,p_attribute14 in varchar2 default hr_api.g_varchar2
922 ,p_attribute15 in varchar2 default hr_api.g_varchar2
923 ,p_attribute16 in varchar2 default hr_api.g_varchar2
924 ,p_attribute17 in varchar2 default hr_api.g_varchar2
925 ,p_attribute18 in varchar2 default hr_api.g_varchar2
926 ,p_attribute19 in varchar2 default hr_api.g_varchar2
927 ,p_attribute20 in varchar2 default hr_api.g_varchar2
928 ,p_period_of_incapacity_id in number default hr_api.g_number
929 ,p_ssp1_issued in varchar2 default hr_api.g_varchar2
930 ,p_maternity_id in number default hr_api.g_number
931 ,p_sickness_start_date in date default hr_api.g_date
932 ,p_sickness_end_date in date default hr_api.g_date
933 ,p_pregnancy_related_illness in varchar2 default hr_api.g_varchar2
934 ,p_reason_for_notification_dela in varchar2 default hr_api.g_varchar2
935 ,p_accept_late_notification_fla in varchar2 default hr_api.g_varchar2
936 ,p_linked_absence_id in number default hr_api.g_number
937 ,p_batch_id in number default hr_api.g_number
938 ,p_abs_information_category in varchar2 default hr_api.g_varchar2
939 ,p_abs_information1 in varchar2 default hr_api.g_varchar2
940 ,p_abs_information2 in varchar2 default hr_api.g_varchar2
941 ,p_abs_information3 in varchar2 default hr_api.g_varchar2
942 ,p_abs_information4 in varchar2 default hr_api.g_varchar2
943 ,p_abs_information5 in varchar2 default hr_api.g_varchar2
944 ,p_abs_information6 in varchar2 default hr_api.g_varchar2
945 ,p_abs_information7 in varchar2 default hr_api.g_varchar2
946 ,p_abs_information8 in varchar2 default hr_api.g_varchar2
947 ,p_abs_information9 in varchar2 default hr_api.g_varchar2
948 ,p_abs_information10 in varchar2 default hr_api.g_varchar2
949 ,p_abs_information11 in varchar2 default hr_api.g_varchar2
950 ,p_abs_information12 in varchar2 default hr_api.g_varchar2
951 ,p_abs_information13 in varchar2 default hr_api.g_varchar2
952 ,p_abs_information14 in varchar2 default hr_api.g_varchar2
953 ,p_abs_information15 in varchar2 default hr_api.g_varchar2
954 ,p_abs_information16 in varchar2 default hr_api.g_varchar2
955 ,p_abs_information17 in varchar2 default hr_api.g_varchar2
956 ,p_abs_information18 in varchar2 default hr_api.g_varchar2
957 ,p_abs_information19 in varchar2 default hr_api.g_varchar2
958 ,p_abs_information20 in varchar2 default hr_api.g_varchar2
959 ,p_abs_information21 in varchar2 default hr_api.g_varchar2
960 ,p_abs_information22 in varchar2 default hr_api.g_varchar2
961 ,p_abs_information23 in varchar2 default hr_api.g_varchar2
962 ,p_abs_information24 in varchar2 default hr_api.g_varchar2
963 ,p_abs_information25 in varchar2 default hr_api.g_varchar2
964 ,p_abs_information26 in varchar2 default hr_api.g_varchar2
965 ,p_abs_information27 in varchar2 default hr_api.g_varchar2
966 ,p_abs_information28 in varchar2 default hr_api.g_varchar2
967 ,p_abs_information29 in varchar2 default hr_api.g_varchar2
968 ,p_abs_information30 in varchar2 default hr_api.g_varchar2
969 ,p_absence_case_id in number default hr_api.g_number
970 ,p_object_version_number in out nocopy number
971 ,p_dur_dys_less_warning out nocopy boolean
972 ,p_dur_hrs_less_warning out nocopy boolean
973 ,p_exceeds_pto_entit_warning out nocopy boolean
974 ,p_exceeds_run_total_warning out nocopy boolean
975 ,p_abs_overlap_warning out nocopy boolean
976 ,p_abs_day_after_warning out nocopy boolean
977 ,p_dur_overwritten_warning out nocopy boolean
978 ,p_del_element_entry_warning out nocopy boolean
979 ) is
980 --
981 -- Declare cursors and local variables
982 --
983
984 cursor c_get_absence_details is
985 select abs.person_id,
986 abs.absence_attendance_type_id,
987 abs.date_start,
988 abs.date_end
989 from per_absence_attendances abs
990 where abs.absence_attendance_id = p_absence_attendance_id;
991
992
993 l_proc varchar2(72) := g_package||'update_person_absence';
994 l_date_projected_start date;
995 l_date_projected_end date;
996 l_date_start date;
997 l_date_end date;
998 l_date_notification date;
999 l_effective_date date;
1000 l_old ben_abs_ler.g_abs_ler_rec;
1001 l_new ben_abs_ler.g_abs_ler_rec;
1002 --
1003 lv_object_version_number number;
1004 lv_absence_days number;
1005 lv_absence_hours number;
1006
1007 -- For bug 5454141
1008
1009 l_date_start1 date;
1010 l_date_end1 date;
1011 l_date_start_for_absence date;
1012 l_date_end_for_absence date;
1013
1014 -- End of added parameters for bug 5454141
1015
1016 -- Declare out parameters
1017 --
1018 l_object_version_number number;
1019 l_absence_days number;
1020 l_absence_hours number;
1021 l_person_id number;
1022 l_absence_attendance_type_id number;
1023 l_assignment_id number;
1024 l_element_entry_id number;
1025 l_effective_start_date date;
1026 l_effective_end_date date;
1027 l_processing_type pay_element_types_f.processing_type%TYPE;
1028 l_dur_dys_less_warning boolean;
1029 l_dur_hrs_less_warning boolean;
1030 l_exceeds_pto_entit_warning boolean;
1031 l_exceeds_run_total_warning boolean;
1032 l_abs_overlap_warning boolean;
1033 l_abs_day_after_warning boolean;
1034 l_dur_overwritten_warning boolean;
1035 l_del_element_entry_warning boolean := FALSE;
1036
1037 --
1038
1039 begin
1040
1041 hr_utility.set_location('Entering:'|| l_proc, 10);
1042 --
1043 lv_object_version_number := p_object_version_number ;
1044 lv_absence_days := p_absence_days ;
1045 lv_absence_hours := p_absence_hours ;
1046
1047 -- Issue a savepoint
1048 --
1049 savepoint update_person_absence;
1050
1051 --
1052 -- Pipe the main IN / IN OUT parameters for ease of debugging.
1053 --
1054 hr_utility.trace(' ');
1055 hr_utility.trace(' --------------------------------'||
1056 '---------------------------------');
1057 hr_utility.trace(' IN / IN OUT NOCOPY PARAMETER '||
1058 ' VALUE');
1059 hr_utility.trace(' --------------------------------'||
1060 '+--------------------------------');
1061 hr_utility.trace(' p_effective_date '||
1062 to_char(p_effective_date));
1063 hr_utility.trace(' p_absence_attendance_id '||
1064 to_char(p_absence_attendance_id));
1065 hr_utility.trace(' p_abs_attendance_reason_id '||
1066 to_char(p_abs_attendance_reason_id));
1067 hr_utility.trace(' p_date_notification '||
1068 to_char(p_date_notification));
1069 hr_utility.trace(' p_date_projected_start '||
1070 to_char(p_date_projected_start));
1071 hr_utility.trace(' p_time_projected_start '||
1072 p_time_projected_start);
1073 hr_utility.trace(' p_date_projected_end '||
1074 to_char(p_date_projected_end));
1075 hr_utility.trace(' p_time_projected_end '||
1076 p_time_projected_end);
1077 hr_utility.trace(' p_date_start '||
1078 to_char(p_date_start));
1079 hr_utility.trace(' p_time_start '||
1080 p_time_start);
1081 hr_utility.trace(' p_date_end '||
1082 to_char(p_date_end));
1083 hr_utility.trace(' p_time_end '||
1084 p_time_end);
1085 hr_utility.trace(' p_absence_days '||
1086 to_char(p_absence_days));
1087 hr_utility.trace(' p_absence_hours '||
1088 to_char(p_absence_hours));
1089 hr_utility.trace(' p_authorising_person_id '||
1090 to_char(p_authorising_person_id));
1091 hr_utility.trace(' p_batch_id '||
1092 to_char(p_batch_id));
1093 hr_utility.trace(' p_object_version_number '||
1094 to_char(p_object_version_number));
1095 hr_utility.trace(' --------------------------------'||
1096 '---------------------------------');
1097 hr_utility.trace(' ');
1098
1099 --
1100 -- Truncate the time portion from all IN date parameters
1101 --
1102 l_effective_date := trunc(p_effective_date);
1103 l_date_notification := trunc(p_date_notification);
1104 l_date_projected_start := trunc(p_date_projected_start);
1105 l_date_projected_end := trunc(p_date_projected_end);
1106 l_date_start := trunc(p_date_start);
1107 l_date_end := trunc(p_date_end);
1108
1109 l_absence_days := p_absence_days;
1110 l_absence_hours := p_absence_hours;
1111
1112 hr_utility.trace('Old Dur Dys: '||to_char(l_absence_days));
1113 hr_utility.trace('Old Dur Hrs: '||to_char(l_absence_hours));
1114
1115 --
1116 -- Call Before Process User Hook
1117 --
1118 begin
1119 hr_person_absence_bk2.update_person_absence_b
1120 (p_effective_date => l_effective_date
1121 ,p_absence_attendance_id => p_absence_attendance_id
1122 ,p_object_version_number => p_object_version_number
1123 ,p_abs_attendance_reason_id => p_abs_attendance_reason_id
1124 ,p_comments => p_comments
1125 ,p_date_notification => l_date_notification
1126 ,p_date_projected_start => l_date_projected_start
1127 ,p_time_projected_start => p_time_projected_start
1128 ,p_date_projected_end => l_date_projected_end
1129 ,p_time_projected_end => p_time_projected_end
1130 ,p_date_start => l_date_start
1131 ,p_time_start => p_time_start
1132 ,p_date_end => l_date_end
1133 ,p_time_end => p_time_end
1134 ,p_absence_days => l_absence_days
1135 ,p_absence_hours => l_absence_hours
1136 ,p_authorising_person_id => p_authorising_person_id
1137 ,p_replacement_person_id => p_replacement_person_id
1138 ,p_attribute_category => p_attribute_category
1139 ,p_attribute1 => p_attribute1
1140 ,p_attribute2 => p_attribute2
1141 ,p_attribute3 => p_attribute3
1142 ,p_attribute4 => p_attribute4
1143 ,p_attribute5 => p_attribute5
1144 ,p_attribute6 => p_attribute6
1145 ,p_attribute7 => p_attribute7
1146 ,p_attribute8 => p_attribute8
1147 ,p_attribute9 => p_attribute9
1148 ,p_attribute10 => p_attribute10
1149 ,p_attribute11 => p_attribute11
1150 ,p_attribute12 => p_attribute12
1151 ,p_attribute13 => p_attribute13
1152 ,p_attribute14 => p_attribute14
1153 ,p_attribute15 => p_attribute15
1154 ,p_attribute16 => p_attribute16
1155 ,p_attribute17 => p_attribute17
1156 ,p_attribute18 => p_attribute18
1157 ,p_attribute19 => p_attribute19
1158 ,p_attribute20 => p_attribute20
1159 ,p_period_of_incapacity_id => p_period_of_incapacity_id
1160 ,p_ssp1_issued => p_ssp1_issued
1161 ,p_maternity_id => p_maternity_id
1162 ,p_sickness_start_date => p_sickness_start_date
1163 ,p_sickness_end_date => p_sickness_end_date
1164 ,p_pregnancy_related_illness => p_pregnancy_related_illness
1165 ,p_reason_for_notification_dela => p_reason_for_notification_dela
1166 ,p_accept_late_notification_fla => p_accept_late_notification_fla
1167 ,p_linked_absence_id => p_linked_absence_id
1168 ,p_absence_case_id => p_absence_case_id
1169 ,p_batch_id => p_batch_id
1170 ,p_abs_information_category => p_abs_information_category
1171 ,p_abs_information1 => p_abs_information1
1172 ,p_abs_information2 => p_abs_information2
1173 ,p_abs_information3 => p_abs_information3
1174 ,p_abs_information4 => p_abs_information4
1175 ,p_abs_information5 => p_abs_information5
1176 ,p_abs_information6 => p_abs_information6
1177 ,p_abs_information7 => p_abs_information7
1178 ,p_abs_information8 => p_abs_information8
1179 ,p_abs_information9 => p_abs_information9
1180 ,p_abs_information10 => p_abs_information10
1181 ,p_abs_information11 => p_abs_information11
1182 ,p_abs_information12 => p_abs_information12
1183 ,p_abs_information13 => p_abs_information13
1184 ,p_abs_information14 => p_abs_information14
1185 ,p_abs_information15 => p_abs_information15
1186 ,p_abs_information16 => p_abs_information16
1187 ,p_abs_information17 => p_abs_information17
1188 ,p_abs_information18 => p_abs_information18
1189 ,p_abs_information19 => p_abs_information19
1190 ,p_abs_information20 => p_abs_information20
1191 ,p_abs_information21 => p_abs_information21
1192 ,p_abs_information22 => p_abs_information22
1193 ,p_abs_information23 => p_abs_information23
1194 ,p_abs_information24 => p_abs_information24
1195 ,p_abs_information25 => p_abs_information25
1196 ,p_abs_information26 => p_abs_information26
1197 ,p_abs_information27 => p_abs_information27
1198 ,p_abs_information28 => p_abs_information28
1199 ,p_abs_information29 => p_abs_information29
1200 ,p_abs_information30 => p_abs_information30
1201 );
1202 exception
1203 when hr_api.cannot_find_prog_unit then
1204 hr_api.cannot_find_prog_unit_error
1205 (p_module_name => 'UPDATE_PERSON_ABSENCE'
1206 ,p_hook_type => 'BP'
1207 );
1208 end;
1209
1210 --
1211 hr_utility.set_location(l_proc, 30);
1212 --
1213 l_object_version_number := p_object_version_number;
1214 --
1215 -- Update Person Absence
1216 per_abs_upd.upd
1217 (p_effective_date => l_effective_date
1218 ,p_absence_attendance_id => p_absence_attendance_id
1219 ,p_abs_attendance_reason_id => p_abs_attendance_reason_id
1220 ,p_authorising_person_id => p_authorising_person_id
1221 ,p_replacement_person_id => p_replacement_person_id
1222 ,p_absence_days => l_absence_days
1223 ,p_absence_hours => l_absence_hours
1224 ,p_comments => p_comments
1225 ,p_date_notification => l_date_notification
1226 ,p_date_projected_start => l_date_projected_start
1227 ,p_date_projected_end => l_date_projected_end
1228 ,p_date_start => l_date_start
1229 ,p_date_end => l_date_end
1230 ,p_time_start => p_time_start
1231 ,p_time_end => p_time_end
1232 ,p_time_projected_start => p_time_projected_start
1233 ,p_time_projected_end => p_time_projected_end
1234 ,p_attribute_category => p_attribute_category
1235 ,p_attribute1 => p_attribute1
1236 ,p_attribute2 => p_attribute2
1237 ,p_attribute3 => p_attribute3
1238 ,p_attribute4 => p_attribute4
1239 ,p_attribute5 => p_attribute5
1240 ,p_attribute6 => p_attribute6
1241 ,p_attribute7 => p_attribute7
1242 ,p_attribute8 => p_attribute8
1243 ,p_attribute9 => p_attribute9
1244 ,p_attribute10 => p_attribute10
1245 ,p_attribute11 => p_attribute11
1246 ,p_attribute12 => p_attribute12
1247 ,p_attribute13 => p_attribute13
1248 ,p_attribute14 => p_attribute14
1249 ,p_attribute15 => p_attribute15
1250 ,p_attribute16 => p_attribute16
1251 ,p_attribute17 => p_attribute17
1252 ,p_attribute18 => p_attribute18
1253 ,p_attribute19 => p_attribute19
1254 ,p_attribute20 => p_attribute20
1255 ,p_period_of_incapacity_id => p_period_of_incapacity_id
1256 ,p_ssp1_issued => p_ssp1_issued
1257 ,p_maternity_id => p_maternity_id
1258 ,p_sickness_start_date => p_sickness_start_date
1259 ,p_sickness_end_date => p_sickness_end_date
1260 ,p_pregnancy_related_illness => p_pregnancy_related_illness
1261 ,p_reason_for_notification_dela => p_reason_for_notification_dela
1262 ,p_accept_late_notification_fla => p_accept_late_notification_fla
1263 ,p_linked_absence_id => p_linked_absence_id
1264 ,p_batch_id => p_batch_id
1265 ,p_abs_information_category => p_abs_information_category
1266 ,p_abs_information1 => p_abs_information1
1267 ,p_abs_information2 => p_abs_information2
1268 ,p_abs_information3 => p_abs_information3
1269 ,p_abs_information4 => p_abs_information4
1270 ,p_abs_information5 => p_abs_information5
1271 ,p_abs_information6 => p_abs_information6
1272 ,p_abs_information7 => p_abs_information7
1273 ,p_abs_information8 => p_abs_information8
1274 ,p_abs_information9 => p_abs_information9
1275 ,p_abs_information10 => p_abs_information10
1276 ,p_abs_information11 => p_abs_information11
1277 ,p_abs_information12 => p_abs_information12
1278 ,p_abs_information13 => p_abs_information13
1279 ,p_abs_information14 => p_abs_information14
1280 ,p_abs_information15 => p_abs_information15
1281 ,p_abs_information16 => p_abs_information16
1282 ,p_abs_information17 => p_abs_information17
1283 ,p_abs_information18 => p_abs_information18
1284 ,p_abs_information19 => p_abs_information19
1285 ,p_abs_information20 => p_abs_information20
1286 ,p_abs_information21 => p_abs_information21
1287 ,p_abs_information22 => p_abs_information22
1288 ,p_abs_information23 => p_abs_information23
1289 ,p_abs_information24 => p_abs_information24
1290 ,p_abs_information25 => p_abs_information25
1291 ,p_abs_information26 => p_abs_information26
1292 ,p_abs_information27 => p_abs_information27
1293 ,p_abs_information28 => p_abs_information28
1294 ,p_abs_information29 => p_abs_information29
1295 ,p_abs_information30 => p_abs_information30
1296 ,p_absence_case_id => p_absence_case_id
1297 ,p_object_version_number => l_object_version_number
1298 ,p_dur_dys_less_warning => l_dur_dys_less_warning
1299 ,p_dur_hrs_less_warning => l_dur_hrs_less_warning
1300 ,p_exceeds_pto_entit_warning => l_exceeds_pto_entit_warning
1301 ,p_exceeds_run_total_warning => l_exceeds_run_total_warning
1302 ,p_abs_overlap_warning => l_abs_overlap_warning
1303 ,p_abs_day_after_warning => l_abs_day_after_warning
1304 ,p_dur_overwritten_warning => l_dur_overwritten_warning
1305 );
1306
1307 --
1308 -- Assign the out parameters.
1309 --
1310 p_object_version_number := l_object_version_number;
1311 p_dur_dys_less_warning := l_dur_dys_less_warning;
1312 p_dur_hrs_less_warning := l_dur_hrs_less_warning;
1313 p_exceeds_pto_entit_warning := l_exceeds_pto_entit_warning;
1314 p_exceeds_run_total_warning := l_exceeds_run_total_warning;
1315 p_abs_overlap_warning := l_abs_overlap_warning;
1316 p_abs_day_after_warning := l_abs_day_after_warning;
1317 p_dur_overwritten_warning := l_dur_overwritten_warning;
1318 p_del_element_entry_warning := l_del_element_entry_warning;
1319 p_absence_days := l_absence_days;
1320 p_absence_hours := l_absence_hours;
1321
1322 hr_utility.trace('New Dur Dys: '||to_char(l_absence_days));
1323 hr_utility.trace('New Dur Hrs: '||to_char(l_absence_hours));
1324
1325
1326 hr_utility.set_location('Start of absence element entry section', 40);
1327
1328 /* Start of Absence Element Entry Section */
1329 --
1330 -- Update or insert the absence element element. First we
1331 -- check if the absence type is linked to an element type.
1332 --
1333
1334 /* Level 1 */
1335 if linked_to_element
1336 (p_absence_attendance_id => p_absence_attendance_id)
1337 then
1338
1339 --
1340 -- Get the person_id, assignment_id, assignment_type_id
1341 -- and processing type for use later
1342 --
1343
1344 open c_get_absence_details;
1345 fetch c_get_absence_details into l_person_id,
1346 l_absence_attendance_type_id,
1347 l_date_start1,
1348 l_date_end1;
1349 close c_get_absence_details;
1350
1351 --
1352 -- Replace start date and end date by their db row
1353 -- values if they are defaulted to hr_api.g_date
1354 -- for correct element entry validations.
1355 -- This is done for bug 5454141
1356 --
1357
1358 if (p_date_start = hr_api.g_date)
1359 then
1360 l_date_start_for_absence := l_date_start1;
1361 else
1362 l_date_start_for_absence := p_date_start;
1363 end if;
1364
1365 if (p_date_end = hr_api.g_date)
1366 then
1367 l_date_end_for_absence := l_date_end1;
1368 else
1369 l_date_end_for_absence := p_date_end;
1370 end if;
1371
1372 -- End of additions for bug 5454141
1373
1374 l_assignment_id := get_primary_assignment
1375 (p_person_id => l_person_id
1376 ,p_effective_date => l_date_start_for_absence); --fix for bug 7191231
1377
1378 l_processing_type := get_processing_type
1379 (p_absence_attendance_type_id => l_absence_attendance_type_id);
1380
1381 --
1382 -- We determine if an entry already exists.
1383 --
1384 get_absence_element
1385 (p_absence_attendance_id => p_absence_attendance_id
1386 ,p_element_entry_id => l_element_entry_id
1387 ,p_effective_start_date => l_effective_start_date
1388 ,p_effective_end_date => l_effective_end_date);
1389
1390
1391 /* Level 2 */
1392 if l_element_entry_id is null then
1393 --
1394 -- Scenario 1.
1395 -- An entry does not already exist. Insert if we have
1396 -- the appropriate dates.
1397 --
1398 hr_utility.set_location('Scenario 1', 45);
1399
1400 if (l_processing_type = 'N'
1401 and l_date_start_for_absence is not null
1402 and l_date_end_for_absence is not null)
1403 or (l_processing_type = 'R'
1404 and l_date_start_for_absence is not null)
1405 then
1406
1407 insert_absence_element
1408 (p_date_start => l_date_start_for_absence
1409 ,p_assignment_id => l_assignment_id
1410 ,p_absence_attendance_id => p_absence_attendance_id
1411 ,p_element_entry_id => l_element_entry_id);
1412
1413 if l_processing_type = 'R' and l_date_end_for_absence is not null then
1414 --
1415 -- Scenario 2.
1416 -- If this is a recurring element entry and we have the
1417 -- absence end date, we date effectively delete the
1418 -- element immediately, otherwise it remains open until
1419 -- the end of time.
1420 --
1421 hr_utility.set_location('Scenario 2', 50);
1422
1423 delete_absence_element
1424 (p_dt_delete_mode => 'DELETE'
1425 ,p_session_date => l_date_end_for_absence
1426 ,p_element_entry_id => l_element_entry_id);
1427 end if;
1428
1429 end if;
1430
1431 else
1432 --
1433 -- An entry already exists. Update it as appropriate.
1434 --
1435 /* Level 3 */
1436 if (l_processing_type = 'R' and l_date_start_for_absence is null)
1437 or (l_processing_type = 'N' and (l_date_start_for_absence is null
1438 or l_date_end_for_absence is null)) then
1439 --
1440 -- Scenario 3.
1441 -- The element entry should be purged because the
1442 -- actual dates have been removed.
1443 --
1444 hr_utility.set_location('Scenario 3', 55);
1445
1446 --
1447 -- Warn the user before deleting.
1448 --
1449 l_del_element_entry_warning := TRUE;
1450
1451 delete_absence_element
1452 (p_dt_delete_mode => 'ZAP'
1453 ,p_session_date => l_effective_start_date
1454 ,p_element_entry_id => l_element_entry_id);
1455
1456 elsif l_processing_type = 'N' and l_date_start_for_absence not between
1457 l_effective_start_date and l_effective_end_date then
1458 --
1459 -- Scenario 4.
1460 -- The start date cannot be moved outside the entry's
1461 -- current period for non-recurring entries.
1462 --
1463 hr_utility.set_location('Scenario 4', 60);
1464
1465 fnd_message.set_name ('PAY', 'HR_6744_ABS_DET_ENTRY_PERIOD');
1466 fnd_message.set_token ('PERIOD_FROM',
1467 fnd_date.date_to_chardate(l_effective_start_date));
1468 fnd_message.set_token ('PERIOD_TO',
1469 fnd_date.date_to_chardate(l_effective_end_date));
1470 fnd_message.raise_error;
1471
1472 elsif l_processing_type = 'N' then
1473 --
1474 -- Scenario 5.
1475 -- Update the existing entry with the new input values.
1476 -- For simplicity, we make the update even if the value
1477 -- has not changed.
1478 --
1479 hr_utility.set_location('Scenario 5', 65);
1480
1481 update_absence_element
1482 (p_dt_update_mode => 'CORRECTION'
1483 ,p_session_date => l_effective_start_date
1484 ,p_element_entry_id => l_element_entry_id
1485 ,p_absence_attendance_id => p_absence_attendance_id);
1486
1487 elsif l_processing_type = 'R'
1488 and l_date_start_for_absence <> l_effective_start_date then
1489
1490 --
1491 -- Scenario 6.
1492 -- The start date has been moved. As this is part of the
1493 -- primary key we must delete the entry and re-insert it.
1494 --
1495 hr_utility.set_location('Scenario 6', 70);
1496
1497 delete_absence_element
1498 (p_dt_delete_mode => 'ZAP'
1499 ,p_session_date => l_effective_start_date
1500 ,p_element_entry_id => l_element_entry_id);
1501
1502 insert_absence_element
1503 (p_date_start => l_date_start_for_absence
1504 ,p_assignment_id => l_assignment_id
1505 ,p_absence_attendance_id => p_absence_attendance_id
1506 ,p_element_entry_id => l_element_entry_id);
1507
1508 if l_date_end_for_absence is not null then
1509 --
1510 -- We have the absence end date, we date effectively
1511 -- delete the element immediately, otherwise it
1512 -- remains open until the end of time.
1513 --
1514
1515 delete_absence_element
1516 (p_dt_delete_mode => 'DELETE'
1517 ,p_session_date => l_date_end_for_absence
1518 ,p_element_entry_id => l_element_entry_id);
1519 end if;
1520
1521 elsif l_processing_type = 'R' and
1522 (l_date_end_for_absence is null or
1523 l_date_end_for_absence <> l_effective_end_date) then
1524 --
1525 -- Scenario 7.
1526 -- The end date has:
1527 -- . changed
1528 -- . been removed
1529 -- . entered for the first time
1530 -- . still not been entered.
1531 --
1532 hr_utility.set_location('Scenario 7', 75);
1533
1534 if l_effective_end_date <> hr_api.g_eot then
1535 --
1536 -- End date has been changed or removed so we
1537 -- remove the end date so it continues through
1538 -- until the end of time.
1539 --
1540 hr_utility.set_location(l_proc, 76);
1541
1542 delete_absence_element
1543 (p_dt_delete_mode => 'DELETE_NEXT_CHANGE'
1544 ,p_session_date => l_effective_end_date
1545 ,p_element_entry_id => l_element_entry_id);
1546 end if;
1547
1548 if l_date_end_for_absence is not null then
1549 --
1550 -- End date has been changed or entered for
1551 -- the first time. We end the element entry
1552 -- at the end date.
1553 --
1554 hr_utility.set_location(l_proc, 78);
1555
1556 delete_absence_element
1557 (p_dt_delete_mode => 'DELETE'
1558 ,p_session_date => l_date_end_for_absence
1559 ,p_element_entry_id => l_element_entry_id);
1560 end if;
1561
1562 /* Level 3 */
1563 end if;
1564
1565 /* Level 2 */
1566 end if;
1567
1568 /* Level 1 */
1569 end if;
1570
1571
1572 /* End of Absence Element Entry Section */
1573
1574 hr_utility.set_location('End of absence element entry section', 80);
1575
1576 populate_ben_absence_rec
1577 (p_absence_attendance_id => p_absence_attendance_id,
1578 p_rec_type => 'O',
1579 p_ben_rec => l_old);
1580
1581 populate_ben_absence_rec
1582 (p_absence_attendance_id => p_absence_attendance_id,
1583 p_rec_type => 'N',
1584 p_ben_rec => l_new);
1585
1586 --
1587 -- Start of BEN call.
1588 --
1589 hr_utility.set_location('Start of BEN call', 82);
1590
1591 ben_abs_ler.ler_chk
1592 (p_old => l_old
1593 ,p_new => l_new
1594 ,p_effective_date => l_effective_date);
1595
1596 hr_utility.set_location('End of BEN call', 84);
1597
1598 --
1599 -- Call After Process User Hook
1600 --
1601 begin
1602 hr_person_absence_bk2.update_person_absence_a
1603 (p_effective_date => l_effective_date
1604 ,p_absence_attendance_id => p_absence_attendance_id
1605 ,p_object_version_number => l_object_version_number
1606 ,p_abs_attendance_reason_id => p_abs_attendance_reason_id
1607 ,p_comments => p_comments
1608 ,p_date_notification => l_date_notification
1609 ,p_date_projected_start => l_date_projected_start
1610 ,p_time_projected_start => p_time_projected_start
1611 ,p_date_projected_end => l_date_projected_end
1612 ,p_time_projected_end => p_time_projected_end
1613 ,p_date_start => l_date_start
1614 ,p_time_start => p_time_start
1615 ,p_date_end => l_date_end
1616 ,p_time_end => p_time_end
1617 ,p_absence_days => l_absence_days
1618 ,p_absence_hours => l_absence_hours
1619 ,p_authorising_person_id => p_authorising_person_id
1620 ,p_replacement_person_id => p_replacement_person_id
1621 ,p_attribute_category => p_attribute_category
1622 ,p_attribute1 => p_attribute1
1623 ,p_attribute2 => p_attribute2
1624 ,p_attribute3 => p_attribute3
1625 ,p_attribute4 => p_attribute4
1626 ,p_attribute5 => p_attribute5
1627 ,p_attribute6 => p_attribute6
1628 ,p_attribute7 => p_attribute7
1629 ,p_attribute8 => p_attribute8
1630 ,p_attribute9 => p_attribute9
1631 ,p_attribute10 => p_attribute10
1632 ,p_attribute11 => p_attribute11
1633 ,p_attribute12 => p_attribute12
1634 ,p_attribute13 => p_attribute13
1635 ,p_attribute14 => p_attribute14
1636 ,p_attribute15 => p_attribute15
1637 ,p_attribute16 => p_attribute16
1638 ,p_attribute17 => p_attribute17
1639 ,p_attribute18 => p_attribute18
1640 ,p_attribute19 => p_attribute19
1641 ,p_attribute20 => p_attribute20
1642 ,p_period_of_incapacity_id => p_period_of_incapacity_id
1643 ,p_ssp1_issued => p_ssp1_issued
1644 ,p_maternity_id => p_maternity_id
1645 ,p_sickness_start_date => p_sickness_start_date
1646 ,p_sickness_end_date => p_sickness_end_date
1647 ,p_pregnancy_related_illness => p_pregnancy_related_illness
1648 ,p_reason_for_notification_dela => p_reason_for_notification_dela
1649 ,p_accept_late_notification_fla => p_accept_late_notification_fla
1650 ,p_linked_absence_id => p_linked_absence_id
1651 ,p_absence_case_id => p_absence_case_id
1652 ,p_batch_id => p_batch_id
1653 ,p_abs_information_category => p_abs_information_category
1654 ,p_abs_information1 => p_abs_information1
1655 ,p_abs_information2 => p_abs_information2
1656 ,p_abs_information3 => p_abs_information3
1657 ,p_abs_information4 => p_abs_information4
1658 ,p_abs_information5 => p_abs_information5
1659 ,p_abs_information6 => p_abs_information6
1660 ,p_abs_information7 => p_abs_information7
1661 ,p_abs_information8 => p_abs_information8
1662 ,p_abs_information9 => p_abs_information9
1663 ,p_abs_information10 => p_abs_information10
1664 ,p_abs_information11 => p_abs_information11
1665 ,p_abs_information12 => p_abs_information12
1666 ,p_abs_information13 => p_abs_information13
1667 ,p_abs_information14 => p_abs_information14
1668 ,p_abs_information15 => p_abs_information15
1669 ,p_abs_information16 => p_abs_information16
1670 ,p_abs_information17 => p_abs_information17
1671 ,p_abs_information18 => p_abs_information18
1672 ,p_abs_information19 => p_abs_information19
1673 ,p_abs_information20 => p_abs_information20
1674 ,p_abs_information21 => p_abs_information21
1675 ,p_abs_information22 => p_abs_information22
1676 ,p_abs_information23 => p_abs_information23
1677 ,p_abs_information24 => p_abs_information24
1678 ,p_abs_information25 => p_abs_information25
1679 ,p_abs_information26 => p_abs_information26
1680 ,p_abs_information27 => p_abs_information27
1681 ,p_abs_information28 => p_abs_information28
1682 ,p_abs_information29 => p_abs_information29
1683 ,p_abs_information30 => p_abs_information30
1684 ,p_dur_dys_less_warning => l_dur_dys_less_warning
1685 ,p_dur_hrs_less_warning => l_dur_hrs_less_warning
1686 ,p_exceeds_pto_entit_warning => l_exceeds_pto_entit_warning
1687 ,p_exceeds_run_total_warning => l_exceeds_run_total_warning
1688 ,p_abs_overlap_warning => l_abs_overlap_warning
1689 ,p_abs_day_after_warning => l_abs_day_after_warning
1690 ,p_dur_overwritten_warning => l_dur_overwritten_warning
1691 ,p_del_element_entry_warning => l_del_element_entry_warning
1692 );
1693 exception
1694 when hr_api.cannot_find_prog_unit then
1695 hr_api.cannot_find_prog_unit_error
1696 (p_module_name => 'UPDATE_PERSON_ABSENCE'
1697 ,p_hook_type => 'AP'
1698 );
1699 end;
1700
1701 --
1702 -- Pipe the main IN OUT / OUT parameters for ease of debugging.
1703 --
1704 hr_utility.trace(' ');
1705 hr_utility.trace(' --------------------------------'||
1706 '---------------------------------');
1707 hr_utility.trace(' IN OUT NOCOPY / OUT NOCOPY PARAMETER '||
1708 ' VALUE');
1709 hr_utility.trace(' --------------------------------'||
1710 '+--------------------------------');
1711 hr_utility.trace(' p_absence_days '||
1712 to_char(p_absence_days));
1713 hr_utility.trace(' p_absence_hours '||
1714 to_char(p_absence_hours));
1715 hr_utility.trace(' p_object_version_number '||
1716 to_char(p_object_version_number));
1717 hr_utility.trace(' --------------------------------'||
1718 '---------------------------------');
1719 hr_utility.trace(' ');
1720
1721 --
1722 -- When in validation only mode raise the Validate_Enabled exception
1723 --
1724 if p_validate then
1725 raise hr_api.validate_enabled;
1726 end if;
1727 --
1728 hr_utility.set_location(' Leaving:'||l_proc, 90);
1729 exception
1730 when hr_api.validate_enabled then
1731 --
1732 -- As the Validate_Enabled exception has been raised
1733 -- we must rollback to the savepoint
1734 --
1735 rollback to update_person_absence;
1736 --
1737 -- Only set output warning arguments
1738 -- (Any key or derived arguments must be set to null
1739 -- when validation only mode is being used.)
1740 --
1741 p_object_version_number := null;
1742 hr_utility.set_location(' Leaving:'||l_proc, 100);
1743 when others then
1744 --
1745 -- A validation or unexpected error has occured
1746 --
1747 p_object_version_number := lv_object_version_number ;
1748 p_absence_days := lv_absence_days ;
1749 p_absence_hours := lv_absence_hours ;
1750
1751 p_dur_dys_less_warning := null;
1752 p_dur_hrs_less_warning := null;
1753 p_exceeds_pto_entit_warning := null;
1754 p_exceeds_run_total_warning := null;
1755 p_abs_overlap_warning := null;
1756 p_abs_day_after_warning := null;
1757 p_dur_overwritten_warning := null;
1758 p_del_element_entry_warning := null;
1759
1760 rollback to update_person_absence;
1761 hr_utility.set_location(' Leaving:'||l_proc, 110);
1762 raise;
1763 end update_person_absence;
1764 --
1765 -- ----------------------------------------------------------------------------
1766 -- |----------------------< delete_person_absence >---------------------------|
1767 -- ----------------------------------------------------------------------------
1768 --
1769 procedure delete_person_absence
1770 (p_validate in boolean default false
1771 ,p_absence_attendance_id in number
1772 ,p_object_version_number in number
1773 ) is
1774 --
1775 -- Declare cursors and local variables
1776 --
1777 --
1778 l_old ben_abs_ler.g_abs_ler_rec;
1779 l_new ben_abs_ler.g_abs_ler_rec;
1780
1781 l_proc varchar2(72) := g_package||'delete_person_absence';
1782 l_exists number;
1783 l_element_entry_id number;
1784 l_effective_start_date date;
1785 l_effective_end_date date;
1786
1787 begin
1788 hr_utility.set_location('Entering:'|| l_proc, 10);
1789 --
1790 -- Issue a savepoint
1791 --
1792 savepoint delete_person_absence;
1793
1794 --
1795 -- Call Before Process User Hook
1796 --
1797 begin
1798 hr_person_absence_bk3.delete_person_absence_b
1799 (p_absence_attendance_id => p_absence_attendance_id
1800 ,p_object_version_number => p_object_version_number
1801 );
1802 exception
1803 when hr_api.cannot_find_prog_unit then
1804 hr_api.cannot_find_prog_unit_error
1805 (p_module_name => 'DELETE_PERSON_ABSENCE'
1806 ,p_hook_type => 'BP'
1807 );
1808 end;
1809
1810 --
1811 hr_utility.set_location('Start of absence element deletion section', 30);
1812 --
1813 /* Start of Absence Element Deletion Section */
1814
1815 --
1816 -- Delete the absence element entry. First we check if an
1817 -- element has been created for this absence.
1818 -- Added Loop for bug fix 5392984
1819 Loop
1820 get_absence_element
1821 (p_absence_attendance_id => p_absence_attendance_id
1822 ,p_element_entry_id => l_element_entry_id
1823 ,p_effective_start_date => l_effective_start_date
1824 ,p_effective_end_date => l_effective_end_date);
1825
1826 if l_element_entry_id is not null then
1827 --
1828 -- An element entry exists so we delete it.
1829 --
1830
1831 delete_absence_element
1832 (p_dt_delete_mode => 'ZAP'
1833 ,p_session_date => l_effective_start_date
1834 ,p_element_entry_id => l_element_entry_id);
1835 else
1836 exit;
1837 end if;
1838 End loop;
1839 /* End of Absence Element Deletion Section */
1840
1841 hr_utility.set_location('End of absence element deletion section', 40);
1842 --
1843 -- Delete Person Absence
1844
1845 per_abs_del.del
1846 (p_absence_attendance_id => p_absence_attendance_id
1847 ,p_object_version_number => p_object_version_number
1848 );
1849
1850 hr_utility.set_location(l_proc, 50);
1851
1852 populate_ben_absence_rec
1853 (p_absence_attendance_id => p_absence_attendance_id,
1854 p_rec_type => 'O',
1855 p_ben_rec => l_old);
1856 -- fix for bug 4395727.
1857 ben_abs_ler.ler_chk(p_old => l_old,
1858 p_new => l_new,
1859 p_effective_date => l_effective_start_date);
1860
1861 --
1862 -- Call After Process User Hook
1863 --
1864
1865 begin
1866 hr_person_absence_bk3.delete_person_absence_a
1867 (p_absence_attendance_id => p_absence_attendance_id
1868 ,p_object_version_number => p_object_version_number
1869 );
1870 exception
1871 when hr_api.cannot_find_prog_unit then
1872 hr_api.cannot_find_prog_unit_error
1873 (p_module_name => 'DELETE_PERSON_ABSENCE'
1874 ,p_hook_type => 'AP'
1875 );
1876 end;
1877 --
1878 -- When in validation only mode raise the Validate_Enabled exception
1879 --
1880 if p_validate then
1881 raise hr_api.validate_enabled;
1882 end if;
1883
1884 --
1885 hr_utility.set_location(' Leaving:'||l_proc, 70);
1886 exception
1887 when hr_api.validate_enabled then
1888 --
1889 -- As the Validate_Enabled exception has been raised
1890 -- we must rollback to the savepoint
1891 --
1892 rollback to delete_person_absence;
1893 --
1894 -- Only set output warning arguments
1895 -- (Any key or derived arguments must be set to null
1896 -- when validation only mode is being used.)
1897 --
1898 hr_utility.set_location(' Leaving:'||l_proc, 80);
1899 when others then
1900 --
1901 -- A validation or unexpected error has occured
1902 --
1903 rollback to delete_person_absence;
1904 hr_utility.set_location(' Leaving:'||l_proc, 90);
1905 raise;
1906 --
1907 end delete_person_absence;
1908
1909 --
1910 -- ----------------------------------------------------------------------------
1911 -- |----------------------< get_primary_assignment >--------------------------|
1912 -- ----------------------------------------------------------------------------
1913 --
1914 function get_primary_assignment
1915 (p_person_id in number,
1916 p_effective_date in date) return number is
1917
1918
1919 -- It is acceptable for one person to have several simultaneous assignments
1920 -- with the benefits functionality so we exclude assignment types of 'B'
1921 -- to prevent the wrong assignment being picked up.
1922
1923 cursor c_get_primary_assignment is
1924 select asg.assignment_id
1925 from per_all_assignments_f asg
1926 where asg.person_id = p_person_id
1927 and p_effective_date between
1928 asg.effective_start_date and asg.effective_end_date
1929 and asg.primary_flag = 'Y'
1930 and asg.assignment_type <> 'B';
1931
1932
1933 l_proc varchar2(72) := g_package||'get_primary_assignment';
1934 l_assignment_id number;
1935
1936
1937 begin
1938
1939 hr_utility.set_location('Entering:'|| l_proc, 10);
1940
1941 open c_get_primary_assignment;
1942 fetch c_get_primary_assignment into l_assignment_id;
1943 close c_get_primary_assignment;
1944
1945
1946 hr_utility.set_location('Leaving:'|| l_proc, 20);
1947
1948 return l_assignment_id;
1949
1950 end get_primary_assignment;
1951
1952 --
1953 -- ----------------------------------------------------------------------------
1954 -- |----------------------< linked_to_element >-------------------------------|
1955 -- ----------------------------------------------------------------------------
1956 --
1957 function linked_to_element
1958 (p_absence_attendance_id in number) return boolean is
1959
1960 cursor c_linked_to_element is
1961 select abt.input_value_id
1962 from per_absence_attendances aba,
1963 per_absence_attendance_types abt
1964 where aba.absence_attendance_id = p_absence_attendance_id
1965 and aba.absence_attendance_type_id = abt.absence_attendance_type_id;
1966
1967
1968 l_proc varchar2(72) := g_package||'linked_to_element';
1969 l_input_value_id number;
1970 l_linked_to_element boolean;
1971
1972
1973 begin
1974
1975 hr_utility.set_location('Entering:'|| l_proc, 10);
1976
1977 open c_linked_to_element;
1978 fetch c_linked_to_element into l_input_value_id;
1979 close c_linked_to_element;
1980
1981
1982 if l_input_value_id is not null then
1983 l_linked_to_element := TRUE;
1984 else
1985 l_linked_to_element := FALSE;
1986 end if;
1987
1988
1989 hr_utility.set_location('Leaving:'|| l_proc, 20);
1990
1991 return l_linked_to_element;
1992
1993 end linked_to_element;
1994
1995 --
1996 -- ----------------------------------------------------------------------------
1997 -- |----------------------< get_absence_element >-----------------------------|
1998 -- ----------------------------------------------------------------------------
1999 --
2000 procedure get_absence_element
2001 (p_absence_attendance_id in number
2002 ,p_element_entry_id out nocopy number
2003 ,p_effective_start_date out nocopy date
2004 ,p_effective_end_date out nocopy date) is
2005
2006 --
2007 -- Bug 2782577. Performance tuned for the CBO.
2008 --
2009 cursor c_get_absence_element is
2010 select distinct pee.element_entry_id
2011 ,pee.effective_start_date
2012 ,pee.effective_end_date
2013 from per_absence_attendances abs
2014 ,per_all_assignments_f asg
2015 ,per_absence_attendance_types abt
2016 ,pay_input_values_f piv
2017 ,pay_element_types_f pet
2018 ,pay_element_links_f pel
2019 ,pay_element_entries_f pee
2020 where abs.absence_attendance_id = p_absence_attendance_id
2021 and abs.person_id = asg.person_id
2022 and abs.absence_attendance_type_id = abt.absence_attendance_type_id
2023 and abt.input_value_id is not null
2024 and abt.input_value_id = piv.input_value_id
2025 and piv.element_type_id = pet.element_type_id
2026 and pet.element_type_id = pel.element_type_id
2027 and pel.element_link_id = pee.element_link_id
2028 and pee.assignment_id = asg.assignment_id
2029 and pee.creator_id = abs.absence_attendance_id
2030 and pee.creator_type = 'A';
2031
2032 l_proc varchar2(72) := g_package||'get_absence_element';
2033
2034 begin
2035
2036 hr_utility.set_location('Entering:'|| l_proc, 10);
2037
2038 open c_get_absence_element;
2039 fetch c_get_absence_element into p_element_entry_id,
2040 p_effective_start_date,
2041 p_effective_end_date;
2042 close c_get_absence_element;
2043
2044
2045 hr_utility.set_location('Leaving:'|| l_proc, 20);
2046 exception
2047 when others then
2048 p_element_entry_id := null;
2049 p_effective_start_date := null;
2050 p_effective_end_date := null;
2051
2052 end get_absence_element;
2053
2054 -- ----------------------------------------------------------------------------
2055 -- |----------------------< get_processing_type >-----------------------------|
2056 -- ----------------------------------------------------------------------------
2057 --
2058 function get_processing_type
2059 (p_absence_attendance_type_id in number) return varchar2 is
2060
2061 cursor c_get_processing_type is
2062 select upper(pet.processing_type)
2063 from per_absence_attendance_types abt,
2064 pay_input_values_f piv,
2065 pay_element_types_f pet
2066 where abt.absence_attendance_type_id = p_absence_attendance_type_id
2067 and abt.input_value_id = piv.input_value_id
2068 and piv.element_type_id = pet.element_type_id;
2069
2070
2071 l_proc varchar2(72) := g_package||'get_processing_type';
2072 l_processing_type pay_element_types_f.processing_type%TYPE;
2073
2074
2075 begin
2076
2077 hr_utility.set_location('Entering:'|| l_proc, 10);
2078
2079 --
2080 -- Fetch the processing type. If no records are found, the absence type
2081 -- does not have an associated element so null is returned.
2082 --
2083 open c_get_processing_type;
2084 fetch c_get_processing_type into l_processing_type;
2085 close c_get_processing_type;
2086
2087 hr_utility.set_location('Leaving:'|| l_proc, 20);
2088
2089 return l_processing_type;
2090
2091 end get_processing_type;
2092
2093 --
2094 -- ----------------------------------------------------------------------------
2095 -- |----------------------< get_element_details >-----------------------------|
2096 -- ----------------------------------------------------------------------------
2097 --
2098 procedure get_element_details
2099 (p_absence_attendance_id in number
2100 ,p_element_type_id out nocopy number
2101 ,p_input_value_id out nocopy number
2102 ,p_entry_value out nocopy number
2103 ) is
2104
2105
2106 cursor c_get_element_details is
2107 select aba.absence_hours,
2108 aba.absence_days,
2109 abt.hours_or_days,
2110 abt.increasing_or_decreasing_flag,
2111 abt.input_value_id,
2112 pet.element_type_id,
2113 pet.processing_type
2114 from per_absence_attendances aba,
2115 per_absence_attendance_types abt,
2116 pay_input_values_f piv,
2117 pay_element_types_f pet
2118 where aba.absence_attendance_id = p_absence_attendance_id
2119 and aba.absence_attendance_type_id = abt.absence_attendance_type_id
2120 and abt.input_value_id = piv.input_value_id
2121 and piv.element_type_id = pet.element_type_id;
2122
2123
2124 l_proc varchar2(72) := g_package||'get_element_details';
2125 l_absence_hours per_absence_attendances.absence_hours%TYPE;
2126 l_absence_days per_absence_attendances.absence_days%TYPE;
2127 l_hours_or_days per_absence_attendance_types.hours_or_days%TYPE;
2128 l_processing_type pay_element_types_f.processing_type%TYPE;
2129 l_inc_or_dec_flag per_absence_attendance_types.increasing_or_decreasing_flag%TYPE;
2130
2131
2132 begin
2133
2134 hr_utility.set_location('Entering:'|| l_proc, 10);
2135
2136
2137 -- This should always return a row because this procedure is only
2138 -- called when the absence type has an associated element type.
2139
2140 open c_get_element_details;
2141 fetch c_get_element_details into l_absence_hours,
2142 l_absence_days,
2143 l_hours_or_days,
2144 l_inc_or_dec_flag,
2145 p_input_value_id,
2146 p_element_type_id,
2147 l_processing_type;
2148 close c_get_element_details;
2149
2150
2151 hr_utility.set_location('Setting entry value', 20);
2152
2153 if upper(l_processing_type) = 'N' then
2154 --
2155 -- p_entry_value is only set when the element type is
2156 -- non-recurring, otherwise it remains null.
2157 --
2158 if upper(l_hours_or_days) = 'H' then
2159
2160 if l_inc_or_dec_flag = 'D' then
2161 --
2162 -- Invert the absence duration for decreasing balances.
2163 --
2164 hr_utility.set_location(l_proc, 30);
2165 p_entry_value := l_absence_hours * -1;
2166
2167 else
2168
2169 hr_utility.set_location(l_proc, 40);
2170 p_entry_value := l_absence_hours;
2171
2172 end if;
2173
2174 else
2175
2176 if l_inc_or_dec_flag = 'D' then
2177 --
2178 -- Invert the absence duration for decreasing balances.
2179 --
2180 hr_utility.set_location(l_proc, 50);
2181 p_entry_value := l_absence_days * -1;
2182
2183 else
2184
2185 hr_utility.set_location(l_proc, 60);
2186 p_entry_value := l_absence_days;
2187
2188 end if;
2189
2190 end if;
2191
2192 end if;
2193
2194 hr_utility.set_location('Leaving:'|| l_proc, 70);
2195
2196 exception
2197 when others then
2198 p_element_type_id := null ;
2199 p_input_value_id := null ;
2200 p_entry_value := null ;
2201
2202 raise;
2203
2204 --
2205 end get_element_details;
2206 --
2207 -- ----------------------------------------------------------------------------
2208 -- |----------------------< insert_absence_element >--------------------------|
2209 -- ----------------------------------------------------------------------------
2210 --
2211 procedure insert_absence_element
2212 (p_date_start in date
2213 ,p_assignment_id in number
2214 ,p_absence_attendance_id in number
2215 ,p_element_entry_id out nocopy number
2216 ) is
2217
2218
2219 l_proc varchar2(72) := g_package||'insert_absence_element';
2220 l_date_start date := p_date_start;
2221 l_date_end date;
2222 l_element_type_id number;
2223 l_element_link_id number;
2224 l_input_value_id number;
2225 l_entry_value number;
2226
2227 begin
2228
2229
2230 hr_utility.set_location('Entering:'|| l_proc, 10);
2231
2232 get_element_details
2233 (p_absence_attendance_id => p_absence_attendance_id
2234 ,p_element_type_id => l_element_type_id
2235 ,p_input_value_id => l_input_value_id
2236 ,p_entry_value => l_entry_value);
2237
2238
2239 hr_utility.set_location('Checking element link', 20);
2240
2241 l_element_link_id := hr_entry_api.get_link
2242 (p_assignment_id => p_assignment_id
2243 ,p_element_type_id => l_element_type_id
2244 ,p_session_date => p_date_start);
2245
2246 If l_element_link_id is null then
2247 -- Assignment is not eligible for the element type
2248 -- associated with this absence.
2249 fnd_message.set_name ('PAY','HR_7448_ELE_PER_NOT_ELIGIBLE');
2250 hr_utility.raise_error;
2251 end if;
2252
2253
2254 hr_utility.set_location('Inserting element', 30);
2255
2256 -- We know the assignment is eligible for this element because
2257 -- we have the element_link_id. The entries API will handle
2258 -- all other validation (e.g., non-recurring entries must
2259 -- have a valid payroll).
2260
2261 hr_entry_api.insert_element_entry
2262 (p_effective_start_date => l_date_start
2263 ,p_effective_end_date => l_date_end
2264 ,p_element_entry_id => p_element_entry_id
2265 ,p_assignment_id => p_assignment_id
2266 ,p_element_link_id => l_element_link_id
2267 ,p_creator_type => 'A'
2268 ,p_entry_type => 'E'
2269 ,p_creator_id => p_absence_attendance_id
2270 ,p_input_value_id1 => l_input_value_id
2271 ,p_entry_value1 => l_entry_value);
2272
2273
2274 hr_utility.set_location('EE ID: '|| to_char(p_element_entry_id), 40);
2275 hr_utility.set_location('Leaving:'|| l_proc, 50);
2276
2277 exception
2278 when others then
2279 p_element_entry_id := null ;
2280 raise;
2281
2282 end insert_absence_element;
2283 --
2284 -- ----------------------------------------------------------------------------
2285 -- |----------------------< update_absence_element >--------------------------|
2286 -- ----------------------------------------------------------------------------
2287 --
2288 procedure update_absence_element
2289 (p_dt_update_mode in varchar2
2290 ,p_session_date in date
2291 ,p_element_entry_id in number
2292 ,p_absence_attendance_id in number
2293 ) is
2294
2295
2296 l_proc varchar2(72) := g_package||'update_absence_element';
2297 l_element_type_id number;
2298 l_input_value_id number;
2299 l_entry_value number;
2300
2301 begin
2302
2303
2304 hr_utility.set_location('Entering:'|| l_proc, 10);
2305
2306 get_element_details
2307 (p_absence_attendance_id => p_absence_attendance_id
2308 ,p_element_type_id => l_element_type_id
2309 ,p_input_value_id => l_input_value_id
2310 ,p_entry_value => l_entry_value);
2311
2312
2313 hr_utility.set_location('Updating element', 20);
2314
2315 -- We know the assignment is eligible for this element because
2316 -- we have the element_link_id. The entries API will handle
2317 -- all other validation (e.g., non-recurring entries must
2318 -- have a valid payroll).
2319
2320 hr_entry_api.update_element_entry
2321 (p_dt_update_mode => p_dt_update_mode
2322 ,p_session_date => p_session_date
2323 ,p_element_entry_id => p_element_entry_id
2324 ,p_creator_type => 'A'
2325 ,p_creator_id => p_absence_attendance_id
2326 ,p_input_value_id1 => l_input_value_id
2327 ,p_entry_value1 => l_entry_value);
2328
2329
2330 hr_utility.set_location('Leaving:'|| l_proc, 30);
2331
2332 end update_absence_element;
2333 --
2334 -- ----------------------------------------------------------------------------
2335 -- |----------------------< delete_absence_element >--------------------------|
2336 -- ----------------------------------------------------------------------------
2337 --
2338 procedure delete_absence_element
2339 (p_dt_delete_mode in varchar2
2340 ,p_session_date in date
2341 ,p_element_entry_id in number
2342 ) is
2343
2344
2345 l_proc varchar2(72) := g_package||'delete_absence_element';
2346 l_input_value_id number;
2347 l_entry_value number;
2348
2349 begin
2350
2351
2352 hr_utility.set_location('Entering:'|| l_proc, 10);
2353
2354 hr_entry_api.delete_element_entry
2355 (p_dt_delete_mode => p_dt_delete_mode
2356 ,p_session_date => p_session_date
2357 ,p_element_entry_id => p_element_entry_id);
2358
2359
2360 hr_utility.set_location('Leaving:'|| l_proc, 20);
2361
2362 end delete_absence_element;
2363 --
2364 end hr_person_absence_api;