[Home] [Help]
PACKAGE BODY: APPS.BEN_EXT_CHLG
Source
1 package body ben_ext_chlg as
2 /* $Header: benxchlg.pkb 120.14.12010000.3 2008/08/05 14:56:26 ubhat ship $ */
3 --------------------------------------------------------------------------------
4 /*
5 +==============================================================================+
6 | Copyright (c) 1997 Oracle Corporation |
7 | Redwood Shores, California, USA |
8 | All rights reserved. |
9 +==============================================================================+
10 --
11 Name
12 Benefit Extract Change Log
13 Purpose
14 This package is used to log changes for benefit extract
15 History
16 Date Who Version What?
17 10/28/98 Pdas 115.0 Created.
18 11/04/98 Pdas 115.1 Added change_exists_in_mem
19 procedure
20 12/18/98 Pdas 115.2 Modified log_per_chg
21 procedure
22 12/18/98 Pdas 115.3 Modified log_per_chg to include
23 session date
24 12/21/98 Pdas 115.4 Added History Info.
25 12/29/98 Pdas 115.5 Added prmtr_03..prmtr_07.
26 02/24/99 mhoyes 115.6 Modified log_add_chg passed in
27 old business_group_id to
28 ben_ext_chg_evt_api.create_ext_chg_evt
29 rather than the new value
30 03/08/99 tmathers 115.7 Changed MON-YYYY to /MM/YYYY.
31 09 Mar 99 G Perry 115.8 IS to AS.
32 23 Mar 99 thayden 115.9 Added procedure log_benefit_chg.
33 12 May 99 isen 115.10 Added new change events
34 26 May 99 thayden 115.11 Remove 'bobby' etc.
35 16 Jun 99 isen 115.12 Added new change events
36 24 Jun 99 isen 115.13 Added new change events, period of service etc.
37 13 Jul 99 isen 115.14 Removed change of primary address logging for
38 insert of new primary address record - bug 2485
39 15 Jul 99 isen 115.15 Fixed bug arising out of above change
40 20 Jul 99 isen 115.16 Added log_abs_chg for absence change events
41 09 Aug 99 isen 115.17 Added new and old values
42 29 Sep 99 isen 115.18 Added new change events
43 05 Oct 99 thayden 115.19 Added Reinstate Benefit.
44 12 Oct 99 thayden 115.20 Fixed person type usages bug.
45 19 Oct 99 thayden 115.21 Fixed application bug.
46 09 Nov 99 thayden 115.22 Fix BC date format bug. 1050311
47 25 Jan 99 thayden 115.23 New arguments for TBBC and TBAC.
48 26 Jan 99 thayden 115.24 Added log_dependent_chg.
49 28 Jan 99 thayden 115.25 Old New values for COPR
50 30 Jan 99 thayden 115.26 Added element entries.
51 15 Mar 00 shdas 115.27 fixed bug 1187479. changed log_benefit_chg.
52 15 Mar 00 thayden 115.28 COUN old and new values.
53 20 Mar 00 shdas 115.29 CCFN,CCPA,CCMA,CCGE,CCDB,
54 added log_cont_chg
55 07 Nov 00 tilak 115.30 COCN- update primary country is added
56 01 Dec 00 rchase 115.31 Bug 1518466. Make sure the payroll is
57 a change and not an add.
58 09 Jan 00 tmathers 115.32 Bug 1530471. Added nvl
59 around p_new_rec.date_start.
60 in log_cont_chg.
61 24 jul 01 tilak 115.31 email can be more than 200 char ,change logh support
62 200 only so the value is substr to 200
63 26 jul o1 tilak 115.32 COPOS cahnge of periods of service added
64 27 oct 01 tjesumic 115.33 l_full_name lenght was 50 , changed to full name type
65 bug : 2070576 fixed
66 06 feb 02 tjesdumic 115.36 delete EE entry fixed by changing UPDATE to DELETE
67 11 mar 02 tjesumic 115.37 UTF8 changes , variable size set dynomically
68 14 Mar 02 rpillay 115.38 UTF Changes Bug 2254683
69 23 May 02 tjesumic 115.39 change log for per_information1, per_informatiuon10
70 uses_tobacco_flag added
71 30 may 02 tjesumic 115.40 log_per_pay procedured added for base salary change
72 log_school_chg procedure added
73 log_prem_mo_chg proecude added
74 Address are substring to 600 fro bug 2383576
75 31 may 02 tjesumic 115.41 Curosr c_old_sal cahnged ,date param added
76
77 13-Aug 02 glingapp 115.42 Bug 1554477 Modified code to trigger extract change event when
78 home phone, fax, work phone, mobile is entered deleted or updated,
79 date_to for phones is entered, when working hours of assignment is
80 updated
81 15-Jul-03 tjesumic 115.43 for COTR the effective date is passed instead of sysdate to
82 change event effective date
83 18-Jul-03 tjesumic 115.44 for COTR the actual termn date is passed instead of sysdate
84 Since the changes effected from termination date, termn date
85 became effective date for the changes
86 09-Jan-04 rpgupta 115.45 Bug 3361237 Do not pass date to find business group.
87 A person can only have one business group. Hence its ok
88 if we get from the first record returned
89 10-Jan-03 tjesumic 115.46 coen added for employee number
90 09-Jan-04 rpgupta 115.47 Make change eff dt for delete phones as
91 greatest(nvl(dt_to, dt_from), sysdate)
92 26-Jan-04 vjhanak 115.48 Changes made to track the creation of secondary
93 employeee assignment for NL.
94 24-Feb-05 vborkar 115.49 In calls to ben_ext_chg_evt_api.create_ext_chg_evt,
95 whenever person's full name was getting truncated
96 to 200 characters, increased it to 240 characters.
97 24-mar-05 tjesumic 115.50 position added in log
98 11-Aug-05 rgajula 115.51 Bug 4539732 Changed the date type of l_chg_eff_dt to
99 date table type in procedure log_pos_chg.
100 30-Aug-05 tjesumic 115.52 log_per_chg overload procedure created,
101 that will be called from SSHR api
102 26-Sep-05 tjesumic 115.53 ethnick orign lookup values stored for old value and new values
103 insted of the codes
104 14-Oct-05 vjhanak 115.54 Changes made to track the change to ASG Softcoded KFF id
105 28-Oct-05 rgajula 115.55 Bug 4699556 Made changes in the log_add_chg where previously when APA
106 and AMA both were triggered at the same time only APA was logged .
107 Chaged the code so as to log the events independent of each other.
108 31-Oct-05 rbingi 115.55 4705814, passing person_type ( Initially passed NULLs )
109 to Old, New Values for 'A%PTU' change event
110 27-Dec-05 rtagarra 115.57 Function "HR_GENERAL.DECODE_LOOKUP" has been called for
111 bug#4699913 so that meaning ll be
112 populated instead of lookup code for Assignment Category.
113 01-Sep-06 tjesumic 115.59 new change event added to log changes of contact of any person type
114 CCNFN,CCNDB,CCNDD,CCNSS,CCNGE,CCNRE,CCNPC,CCNPA,CCNMA
115 14-Sep-06 tjesumic 115.60 log_per_pay_chg's cursor c_person is opend withing the changes
116 14-Nov-06 tjesumic 115.62 per_pay_proposal trigger moved to api (pepyprhi.pkb 115.60)
117 the global record changed to have all the column of the table
118 for future requirements.
119 Rqd: pepyprhi.pkb,115.60 benxchglg.pkb 115.28,benxbstg.sql 115.3
120 14-Nov-06 tjesumic 115.63 approved status for old record is fixed
121 09-Jan-07 tjesumic 115.64 the lookup code COPMPRM changed to CCOPMPRM
122 09-Jan-07 tjesumic 115.65 the lookup code COPMPRM changed to CCOPMPRM
123 08-Jul-08 pvelugul 115.66 Modified for 6517369.
124
125 */
126 --
127
128 function change_exists_in_db
129 (p_person_id in number
130 ,p_chg_evt_cd in varchar2
131 ,p_chg_eff_dt in date
132 ) return boolean is
133 --
134 cursor get_change is
135 SELECT null
136 FROM ben_ext_chg_evt_log a
137 WHERE a.person_id = p_person_id
138 AND a.chg_evt_cd = p_chg_evt_cd
139 AND trunc(a.chg_eff_dt) = trunc(p_chg_eff_dt);
140 --
141 l_proc varchar2(80) := 'ben_ext_chlg.change_exists_in_db';
142 l_dummy varchar2(30);
143 l_return boolean;
144 --
145 begin
146 --
147 hr_utility.set_location('Entering:'|| l_proc, 10);
148 --
149 open get_change;
150 fetch get_change into l_dummy;
151 --
152 if get_change%found then
153 l_return := TRUE;
154 else
155 l_return := FALSE;
156 end if;
157 --
158 close get_change;
159 --
160 return (l_return);
161 --
162 hr_utility.set_location('Exiting:'|| l_proc, 99);
163 --
164 end change_exists_in_db;
165 --
166 --
167 function change_exists_in_mem
168 (p_chg_evt_tab in g_char_tab_type
169 ,p_chg_eff_tab in g_date_tab_type
170 ,p_chg_evt_cd in varchar2
171 ,p_chg_eff_dt in date
172 ) return boolean is
173 --
174 l_proc varchar2(80) := 'ben_ext_chlg.change_exists_in_mem';
175 l_counter number := 0;
176 l_return boolean := FALSE;
177 --
178 begin
179 --
180 hr_utility.set_location('Entering:'|| l_proc, 10);
181 --
182 for l_counter in 1..p_chg_evt_tab.count loop
183 if p_chg_evt_tab(l_counter) = p_chg_evt_cd
184 and p_chg_eff_tab(l_counter) = p_chg_eff_dt then
185 l_return := TRUE;
186 exit;
187 end if;
188 end loop;
189 --
190 return (l_return);
191 --
192 hr_utility.set_location('Exiting:'|| l_proc, 99);
193 --
194 end change_exists_in_mem;
195 --
196 ------------------------------------------------------------------------
197 function change_event_is_enabled
198 (p_chg_evt_cd in varchar2
199 ,p_effective_date in date
200 ) return boolean is
201 --
202 cursor c_lookup_is_enabled is
203 SELECT null
204 FROM hr_lookups h
205 WHERE h.lookup_type = 'BEN_EXT_CHG_EVT'
206 AND h.lookup_code = p_chg_evt_cd
207 AND h.enabled_flag = 'Y'
208 AND p_effective_date between nvl(start_date_active,p_effective_date)
209 and nvl(end_date_active,p_effective_date);
210 --
211 l_proc varchar2(80) := 'ben_ext_chlg.change_event_is_enabled';
212 l_dummy varchar2(30);
213 l_return boolean;
214 --
215 begin
216 --
217 hr_utility.set_location('Entering:'|| l_proc, 10);
218 --
219 open c_lookup_is_enabled;
220 fetch c_lookup_is_enabled into l_dummy;
221 --
222 if c_lookup_is_enabled%found then
223 l_return := TRUE;
224 else
225 l_return := FALSE;
226 end if;
227 --
228 close c_lookup_is_enabled;
229 --
230 return (l_return);
231 --
232 hr_utility.set_location('Exiting:'|| l_proc, 99);
233 --
234 end change_event_is_enabled;
235 --
236
237
238
239 --- this is a overlaod procedure to call from SSHR4
240 procedure log_per_chg
241 (p_event in varchar2
242 ,p_old_rec in per_per_shd.g_rec_type
243 ,p_new_rec in per_per_shd.g_rec_type
244 -- ,p_mode in varchar2
245 )is
246
247 l_old_rec ben_ext_chlg.g_per_rec_type;
248 l_new_rec ben_ext_chlg.g_per_rec_type;
249 l_event varchar2(10) ;
250 --
251 l_proc varchar2(100) := 'ben_ext_chlg.log_per_chg';
252 begin
253
254 hr_utility.set_location('Entering:'|| l_proc, 05);
255
256
257 l_old_rec.national_identifier := p_old_rec.national_identifier;
258 l_old_rec.full_name := p_old_rec.full_name;
259 l_old_rec.last_name := p_old_rec.last_name;
260 l_old_rec.first_name := p_old_rec.first_name;
261 l_old_rec.middle_names := p_old_rec.middle_names;
262 l_old_rec.title := p_old_rec.title;
263 l_old_rec.pre_name_adjunct := p_old_rec.pre_name_adjunct;
264 l_old_rec.suffix := p_old_rec.suffix;
265 l_old_rec.known_as := p_old_rec.known_as;
266 l_old_rec.previous_last_name := p_old_rec.previous_last_name;
267 l_old_rec.date_of_birth := p_old_rec.date_of_birth;
268 l_old_rec.sex := p_old_rec.sex;
269 l_old_rec.marital_status := p_old_rec.marital_status;
270 l_old_rec.person_id := p_old_rec.person_id;
271 l_old_rec.person_type_id := p_old_rec.person_type_id;
272 l_old_rec.business_group_id := p_old_rec.business_group_id;
273 l_old_rec.registered_disabled_flag := p_old_rec.registered_disabled_flag;
274 l_old_rec.benefit_group_id := p_old_rec.benefit_group_id;
275 l_old_rec.student_status := p_old_rec.student_status;
276 l_old_rec.date_of_death := p_old_rec.date_of_death;
277 l_old_rec.date_employee_data_verified := p_old_rec.date_employee_data_verified;
278 l_old_rec.effective_start_date :=p_old_rec.effective_start_date;
279 l_old_rec.effective_end_date :=p_old_rec.effective_end_date;
280 l_old_rec.attribute1 :=p_old_rec.attribute1;
281 l_old_rec.attribute2 :=p_old_rec.attribute2;
282 l_old_rec.attribute3 :=p_old_rec.attribute3;
283 l_old_rec.attribute4 :=p_old_rec.attribute4;
284 l_old_rec.attribute5 :=p_old_rec.attribute5;
285 l_old_rec.attribute6 :=p_old_rec.attribute6;
286 l_old_rec.attribute7 :=p_old_rec.attribute7;
287 l_old_rec.attribute8 :=p_old_rec.attribute8;
288 l_old_rec.attribute9 :=p_old_rec.attribute9;
289 l_old_rec.attribute10 :=p_old_rec.attribute10;
290 l_old_rec.email_address :=p_old_rec.email_address;
291 l_old_rec.per_information1 :=p_old_rec.per_information1;
292 l_old_rec.per_information2 :=p_old_rec.per_information2;
293 l_old_rec.per_information3 :=p_old_rec.per_information3;
294 l_old_rec.per_information4 :=p_old_rec.per_information4;
295 l_old_rec.attribute5 :=p_old_rec.attribute5;
296 l_old_rec.attribute6 :=p_old_rec.attribute6;
297 l_old_rec.attribute7 :=p_old_rec.attribute7;
298 l_old_rec.attribute8 :=p_old_rec.attribute8;
299 l_old_rec.attribute9 :=p_old_rec.attribute9;
300 l_old_rec.attribute10 :=p_old_rec.attribute10;
301 l_old_rec.email_address :=p_old_rec.email_address;
302 l_old_rec.per_information1 :=p_old_rec.per_information1;
303 l_old_rec.per_information2 :=p_old_rec.per_information2;
304 l_old_rec.per_information3 :=p_old_rec.per_information3;
305 l_old_rec.per_information4 :=p_old_rec.per_information4;
306 l_old_rec.per_information5 :=p_old_rec.per_information5;
307 l_old_rec.per_information6 :=p_old_rec.per_information6;
308 l_old_rec.per_information7 :=p_old_rec.per_information7;
309 l_old_rec.per_information8 :=p_old_rec.per_information8;
310 l_old_rec.per_information9 :=p_old_rec.per_information9;
311 l_old_rec.per_information10 :=p_old_rec.per_information10;
312 l_old_rec.per_information11 :=p_old_rec.per_information11;
313 l_old_rec.per_information12 :=p_old_rec.per_information12;
314 l_old_rec.per_information13 :=p_old_rec.per_information13;
315 l_old_rec.per_information14 :=p_old_rec.per_information14;
316 l_old_rec.per_information15 :=p_old_rec.per_information15;
317 l_old_rec.per_information16 :=p_old_rec.per_information16;
318 l_old_rec.per_information17 :=p_old_rec.per_information17;
319 l_old_rec.per_information18 :=p_old_rec.per_information18;
320 l_old_rec.per_information19 :=p_old_rec.per_information19;
321 l_old_rec.per_information20 :=p_old_rec.per_information20;
322 l_old_rec.per_information21 :=p_old_rec.per_information21;
323 l_old_rec.per_information22 :=p_old_rec.per_information22;
324 l_old_rec.per_information23 :=p_old_rec.per_information23;
325 l_old_rec.per_information24 :=p_old_rec.per_information24;
326 l_old_rec.per_information25 :=p_old_rec.per_information25;
327 l_old_rec.per_information26 :=p_old_rec.per_information26;
328 l_old_rec.per_information27 :=p_old_rec.per_information27;
329 l_old_rec.per_information28 :=p_old_rec.per_information28;
330 l_old_rec.per_information29 :=p_old_rec.per_information29;
331 l_old_rec.per_information30 :=p_old_rec.per_information30;
332 l_old_rec.correspondence_language :=p_old_rec.correspondence_language;
333 l_old_rec.uses_tobacco_flag :=p_old_rec.uses_tobacco_flag;
334 l_old_rec.employee_number :=p_old_rec.employee_number;
335 --
336 l_new_rec.national_identifier := p_new_rec.national_identifier;
337 l_new_rec.full_name := p_new_rec.full_name;
338 l_new_rec.last_name := p_new_rec.last_name;
339 l_new_rec.first_name := p_new_rec.first_name;
340 l_new_rec.middle_names := p_new_rec.middle_names;
341 l_new_rec.title := p_new_rec.title;
342 l_new_rec.pre_name_adjunct := p_new_rec.pre_name_adjunct;
343 l_new_rec.suffix := p_new_rec.suffix;
344 l_new_rec.known_as := p_new_rec.known_as;
345 l_new_rec.previous_last_name := p_new_rec.previous_last_name;
346 l_new_rec.date_of_birth := p_new_rec.date_of_birth;
347 l_new_rec.sex := p_new_rec.sex;
348 l_new_rec.marital_status := p_new_rec.marital_status;
349 l_new_rec.person_id := p_new_rec.person_id;
350 l_new_rec.person_type_id := p_new_rec.person_type_id;
351 l_new_rec.business_group_id := p_new_rec.business_group_id;
352 l_new_rec.registered_disabled_flag := p_new_rec.registered_disabled_flag;
353 l_new_rec.benefit_group_id := p_new_rec.benefit_group_id;
354 l_new_rec.student_status := p_new_rec.student_status;
355 l_new_rec.date_of_death := p_new_rec.date_of_death;
356 l_new_rec.date_employee_data_verified := p_new_rec.date_employee_data_verified;
357 l_new_rec.effective_start_date :=p_new_rec.effective_start_date;
358 l_new_rec.effective_end_date :=p_new_rec.effective_end_date;
359 l_new_rec.attribute1 :=p_new_rec.attribute1;
360 l_new_rec.attribute2 :=p_new_rec.attribute2;
361 l_new_rec.attribute3 :=p_new_rec.attribute3;
362 l_new_rec.attribute4 :=p_new_rec.attribute4;
363 l_new_rec.attribute5 :=p_new_rec.attribute5;
364 l_new_rec.attribute6 :=p_new_rec.attribute6;
365 l_new_rec.attribute7 :=p_new_rec.attribute7;
366 l_new_rec.attribute8 :=p_new_rec.attribute8;
367 l_new_rec.attribute9 :=p_new_rec.attribute9;
368 l_new_rec.attribute10 :=p_new_rec.attribute10;
369 l_new_rec.email_address :=p_new_rec.email_address;
370 l_new_rec.per_information1 :=p_new_rec.per_information1;
371 l_new_rec.per_information2 :=p_new_rec.per_information2;
372 l_new_rec.per_information3 :=p_new_rec.per_information3;
373 l_new_rec.per_information4 :=p_new_rec.per_information4;
374 l_new_rec.per_information5 :=p_new_rec.per_information5;
375 l_new_rec.per_information6 :=p_new_rec.per_information6;
376 l_new_rec.per_information7 :=p_new_rec.per_information7;
377 l_new_rec.per_information8 :=p_new_rec.per_information8;
378 l_new_rec.per_information9 :=p_new_rec.per_information9;
379 l_new_rec.per_information10 :=p_new_rec.per_information10;
380 l_new_rec.per_information11 :=p_new_rec.per_information11;
381 l_new_rec.per_information12 :=p_new_rec.per_information12;
382 l_new_rec.per_information13 :=p_new_rec.per_information13;
383 l_new_rec.per_information14 :=p_new_rec.per_information14;
384 l_new_rec.per_information15 :=p_new_rec.per_information15;
385 l_new_rec.per_information16 :=p_new_rec.per_information16;
386 l_new_rec.per_information17 :=p_new_rec.per_information17;
387 l_new_rec.per_information18 :=p_new_rec.per_information18;
388 l_new_rec.per_information19 :=p_new_rec.per_information19;
389 l_new_rec.per_information20 :=p_new_rec.per_information20;
390 l_new_rec.per_information21 :=p_new_rec.per_information21;
391 l_new_rec.per_information22 :=p_new_rec.per_information22;
392 l_new_rec.per_information23 :=p_new_rec.per_information23;
393 l_new_rec.per_information24 :=p_new_rec.per_information24;
394 l_new_rec.per_information25 :=p_new_rec.per_information25;
395 l_new_rec.per_information26 :=p_new_rec.per_information26;
396 l_new_rec.per_information27 :=p_new_rec.per_information27;
397 l_new_rec.per_information28 :=p_new_rec.per_information28;
398 l_new_rec.per_information29 :=p_new_rec.per_information29;
399 l_new_rec.per_information30 :=p_new_rec.per_information30;
400 l_new_rec.correspondence_language :=p_new_rec.correspondence_language;
401 l_new_rec.uses_tobacco_flag :=p_new_rec.uses_tobacco_flag;
402 l_new_rec.employee_number :=p_new_rec.employee_number;
403
404 if p_new_rec.effective_start_date = p_old_rec.effective_start_date then
405 l_new_rec.update_mode := 'CORRECTION';
406 l_old_rec.update_mode := 'CORRECTION';
407 else
408 l_new_rec.update_mode := 'UPDATE';
409 l_old_rec.update_mode := 'UPDATE';
410 end if;
411
412 l_event := nvl(p_event ,'UPDATE') ;
413
414 log_per_chg
415 (p_event => p_event
416 ,p_old_rec => l_old_rec
417 ,p_new_rec => l_new_rec
418 );
419 hr_utility.set_location('Exiting:'|| l_proc, 99);
420 end ;
421
422 ------------------------------------------------------------------------------------------
423 procedure log_per_chg
424 (p_event in varchar2
425 ,p_old_rec in g_per_rec_type
426 ,p_new_rec in g_per_rec_type
427 ) is
428 --
429 l_chg_evt_tab g_char_tab_type;
430 l_cont_chg_evt_tab g_char_tab_type;
431 l_prmtr_01_tab g_char_tab_type;
432 l_prmtr_02_tab g_char_tab_type;
433 l_prmtr_03_tab g_char_tab_type;
434 l_prmtr_04_tab g_char_tab_type;
435 l_prmtr_05_tab g_char_tab_type;
436 l_prmtr_06_tab g_char_tab_type;
437 l_prmtr_07_tab g_char_tab_type;
438 l_old_val1 g_old_val;
439 l_old_val2 g_old_val;
440 l_old_val3 g_old_val;
441 l_old_val4 g_old_val;
442 l_old_val5 g_old_val;
443 l_old_val6 g_old_val;
444 l_new_val1 g_new_val;
445 l_new_val2 g_new_val;
446 l_new_val3 g_new_val;
447 l_new_val4 g_new_val;
448 l_new_val5 g_new_val;
449 l_new_val6 g_new_val;
450 l_tab_counter binary_integer := 0;
451 l_ini_tab_counter binary_integer ;
452 l_chg_eff_dt date;
453 l_count number;
454 l_ext_chg_evt_log_id number;
455 l_object_version_number number;
456 --
457 cursor c_lookup_value
458 (p_lookup_type hr_lookups.lookup_type%type
459 ,p_lookup_code hr_lookups.lookup_code%type
460 )
461 is
462 select meaning
463 from hr_lookups hl
464 where hl.lookup_type = p_lookup_type
465 and hl.lookup_code = p_lookup_code;
466
467 cursor c_benefits_group(p_benfts_grp_id ben_benfts_grp.benfts_grp_id%type)
468 is
469 select name
470 from ben_benfts_grp bbg
471 where bbg.benfts_grp_id = p_benfts_grp_id;
472 --
473 cursor c_relationship(p_person_id number) is
474 SELECT pcr.contact_relationship_id,pcr.person_id
475 FROM per_contact_relationships pcr,
476 hr_lookups hl
477 WHERE pcr.contact_person_id = p_person_id
478 AND pcr.contact_type = hl.lookup_code
479 AND hl.lookup_type = 'CONTACT';
480 --
481 cursor c_person_type(p_person_type_id number) is
482 select ppt.system_person_type
483 from per_person_types ppt
484 where ppt.person_type_id = p_person_type_id;
485
486 -- Get all the contact relationship person
487 cursor c_con_relationship(p_person_id number , p_date date ) is
488 SELECT pcr.contact_relationship_id, pcr.person_id,pcr.contact_type
489 FROM per_contact_relationships pcr
490 WHERE pcr.contact_person_id = p_person_id
491 AND pcr.personal_flag = 'Y'
492 and p_date between pcr.date_start and nvl(pcr.date_end, p_date)
493 ;
494
495
496
497
498 l_old_marital_status hr_lookups.meaning%type ;
499 l_new_marital_status hr_lookups.meaning%type ;
500 l_old_sex hr_lookups.meaning%type ;
501 l_new_sex hr_lookups.meaning%type ;
502 l_old_disability_status hr_lookups.meaning%type ;
503 l_new_disability_status hr_lookups.meaning%type ;
504 l_old_benefits_group ben_benfts_grp.name%type;
505 l_new_benefits_group ben_benfts_grp.name%type;
506 l_old_student_status hr_lookups.meaning%type ;
507 l_new_student_status hr_lookups.meaning%type ;
508 l_old_ethnic_group hr_lookups.meaning%type ;
509 l_new_ethnic_group hr_lookups.meaning%type ;
510 l_relationship per_all_people_f.person_id%type;
511 l_contact per_contact_relationships.contact_relationship_id%type;
512 l_person_type per_person_types.system_person_type%type ;
513 --
514 l_proc varchar2(100) := 'ben_ext_chlg.log_per_chg';
515 --
516 begin
517 --
518 hr_utility.set_location('Entering:'|| l_proc, 10);
519 --
520 if p_event = 'UPDATE' then
521 --
522 if nvl(p_old_rec.national_identifier, '000-00-0000')
523 <> nvl(p_new_rec.national_identifier, '000-00-0000') then
524 l_tab_counter := l_tab_counter + 1;
525 l_chg_evt_tab(l_tab_counter) := 'COSS';
526 l_prmtr_01_tab(l_tab_counter) := null;
527 l_prmtr_02_tab(l_tab_counter) := null;
528 l_prmtr_03_tab(l_tab_counter) := null;
529 l_prmtr_04_tab(l_tab_counter) := null;
530 l_prmtr_05_tab(l_tab_counter) := null;
531 l_prmtr_06_tab(l_tab_counter) := null;
532 l_prmtr_07_tab(l_tab_counter) := null;
533 l_old_val1(l_tab_counter) := p_old_rec.national_identifier;
534 l_new_val1(l_tab_counter) := p_new_rec.national_identifier;
535 l_old_val2(l_tab_counter) := null;
536 l_old_val3(l_tab_counter) := null;
537 l_old_val4(l_tab_counter) := null;
538 l_old_val5(l_tab_counter) := null;
539 l_old_val6(l_tab_counter) := null;
540 l_new_val2(l_tab_counter) := null;
541 l_new_val3(l_tab_counter) := null;
542 l_new_val4(l_tab_counter) := null;
543 l_new_val5(l_tab_counter) := null;
544 l_new_val6(l_tab_counter) := null;
545 end if;
546 if nvl(p_old_rec.full_name, '$$$$$&&&')
547 <> nvl(p_new_rec.full_name, '$$$$$&&&') then
548 l_tab_counter := l_tab_counter + 1;
549 l_chg_evt_tab(l_tab_counter) := 'COUN';
550 l_prmtr_01_tab(l_tab_counter) := null;
551 l_prmtr_02_tab(l_tab_counter) := null;
552 l_prmtr_03_tab(l_tab_counter) := null;
553 l_prmtr_04_tab(l_tab_counter) := null;
554 l_prmtr_05_tab(l_tab_counter) := null;
555 l_prmtr_06_tab(l_tab_counter) := null;
556 l_prmtr_07_tab(l_tab_counter) := null;
557 l_old_val1(l_tab_counter) := substr(p_old_rec.full_name,1,240);
558 l_old_val2(l_tab_counter) := p_old_rec.title;
559 l_old_val3(l_tab_counter) := p_old_rec.first_name;
560 l_old_val4(l_tab_counter) := p_old_rec.middle_names;
561 l_old_val5(l_tab_counter) := p_old_rec.last_name;
562 l_old_val6(l_tab_counter) := p_old_rec.suffix;
563 l_new_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
564 l_new_val2(l_tab_counter) := p_new_rec.title;
565 l_new_val3(l_tab_counter) := p_new_rec.first_name;
566 l_new_val4(l_tab_counter) := p_new_rec.middle_names;
567 l_new_val5(l_tab_counter) := p_new_rec.last_name;
568 l_new_val6(l_tab_counter) := p_new_rec.suffix;
569 end if;
570 if nvl(p_old_rec.first_name, '$$$$$&&&')
571 <> nvl(p_new_rec.first_name, '$$$$$&&&') then
572 l_tab_counter := l_tab_counter + 1;
573 l_chg_evt_tab(l_tab_counter) := 'COFN';
574 l_prmtr_01_tab(l_tab_counter) := null;
575 l_prmtr_02_tab(l_tab_counter) := null;
576 l_prmtr_03_tab(l_tab_counter) := null;
577 l_prmtr_04_tab(l_tab_counter) := null;
578 l_prmtr_05_tab(l_tab_counter) := null;
579 l_prmtr_06_tab(l_tab_counter) := null;
580 l_prmtr_07_tab(l_tab_counter) := null;
581 l_old_val1(l_tab_counter) := p_old_rec.first_name;
582 l_new_val1(l_tab_counter) := p_new_rec.first_name;
583 l_old_val2(l_tab_counter) := null;
584 l_old_val3(l_tab_counter) := null;
585 l_old_val4(l_tab_counter) := null;
586 l_old_val5(l_tab_counter) := null;
587 l_old_val6(l_tab_counter) := null;
588 l_new_val2(l_tab_counter) := null;
589 l_new_val3(l_tab_counter) := null;
590 l_new_val4(l_tab_counter) := null;
591 l_new_val5(l_tab_counter) := null;
592 l_new_val6(l_tab_counter) := null;
593 end if;
594 if nvl(p_old_rec.last_name, '$$$$$&&&')
595 <> nvl(p_new_rec.last_name, '$$$$$&&&') then
596 l_tab_counter := l_tab_counter + 1;
597 l_chg_evt_tab(l_tab_counter) := 'COLN';
598 l_prmtr_01_tab(l_tab_counter) := null;
599 l_prmtr_02_tab(l_tab_counter) := null;
600 l_prmtr_03_tab(l_tab_counter) := null;
601 l_prmtr_04_tab(l_tab_counter) := null;
602 l_prmtr_05_tab(l_tab_counter) := null;
603 l_prmtr_06_tab(l_tab_counter) := null;
604 l_prmtr_07_tab(l_tab_counter) := null;
605 l_old_val1(l_tab_counter) := p_old_rec.last_name;
606 l_new_val1(l_tab_counter) := p_new_rec.last_name;
607 l_old_val2(l_tab_counter) := null;
608 l_old_val3(l_tab_counter) := null;
609 l_old_val4(l_tab_counter) := null;
610 l_old_val5(l_tab_counter) := null;
611 l_old_val6(l_tab_counter) := null;
612 l_new_val2(l_tab_counter) := null;
613 l_new_val3(l_tab_counter) := null;
614 l_new_val4(l_tab_counter) := null;
615 l_new_val5(l_tab_counter) := null;
616 l_new_val6(l_tab_counter) := null;
617 end if;
618 if nvl(p_old_rec.middle_names, '$$$$$&&&')
619 <> nvl(p_new_rec.middle_names, '$$$$$&&&') then
620 l_tab_counter := l_tab_counter + 1;
621 l_chg_evt_tab(l_tab_counter) := 'COMN';
622 l_prmtr_01_tab(l_tab_counter) := null;
623 l_prmtr_02_tab(l_tab_counter) := null;
624 l_prmtr_03_tab(l_tab_counter) := null;
625 l_prmtr_04_tab(l_tab_counter) := null;
626 l_prmtr_05_tab(l_tab_counter) := null;
627 l_prmtr_06_tab(l_tab_counter) := null;
628 l_prmtr_07_tab(l_tab_counter) := null;
629 l_old_val1(l_tab_counter) := p_old_rec.middle_names;
630 l_new_val1(l_tab_counter) := p_new_rec.middle_names;
631 l_old_val2(l_tab_counter) := null;
632 l_old_val3(l_tab_counter) := null;
633 l_old_val4(l_tab_counter) := null;
634 l_old_val5(l_tab_counter) := null;
635 l_old_val6(l_tab_counter) := null;
636 l_new_val2(l_tab_counter) := null;
637 l_new_val3(l_tab_counter) := null;
638 l_new_val4(l_tab_counter) := null;
639 l_new_val5(l_tab_counter) := null;
640 l_new_val6(l_tab_counter) := null;
641 end if;
642 if nvl(p_old_rec.title, '$$$$$&&&')
643 <> nvl(p_new_rec.title, '$$$$$&&&') then
644 l_tab_counter := l_tab_counter + 1;
645 l_chg_evt_tab(l_tab_counter) := 'CONT';
646 l_prmtr_01_tab(l_tab_counter) := null;
647 l_prmtr_02_tab(l_tab_counter) := null;
648 l_prmtr_03_tab(l_tab_counter) := null;
649 l_prmtr_04_tab(l_tab_counter) := null;
650 l_prmtr_05_tab(l_tab_counter) := null;
651 l_prmtr_06_tab(l_tab_counter) := null;
652 l_prmtr_07_tab(l_tab_counter) := null;
653 l_old_val1(l_tab_counter) := p_old_rec.title;
654 l_new_val1(l_tab_counter) := p_new_rec.title;
655 l_old_val2(l_tab_counter) := null;
656 l_old_val3(l_tab_counter) := null;
657 l_old_val4(l_tab_counter) := null;
658 l_old_val5(l_tab_counter) := null;
659 l_old_val6(l_tab_counter) := null;
660 l_new_val2(l_tab_counter) := null;
661 l_new_val3(l_tab_counter) := null;
662 l_new_val4(l_tab_counter) := null;
663 l_new_val5(l_tab_counter) := null;
664 l_new_val6(l_tab_counter) := null;
665 end if;
666 if nvl(p_old_rec.suffix, '$$$$$&&&')
667 <> nvl(p_new_rec.suffix, '$$$$$&&&') then
668 l_tab_counter := l_tab_counter + 1;
669 l_chg_evt_tab(l_tab_counter) := 'CONS';
670 l_prmtr_01_tab(l_tab_counter) := null;
671 l_prmtr_02_tab(l_tab_counter) := null;
672 l_prmtr_03_tab(l_tab_counter) := null;
673 l_prmtr_04_tab(l_tab_counter) := null;
674 l_prmtr_05_tab(l_tab_counter) := null;
675 l_prmtr_06_tab(l_tab_counter) := null;
676 l_prmtr_07_tab(l_tab_counter) := null;
677 l_old_val1(l_tab_counter) := p_old_rec.suffix;
678 l_new_val1(l_tab_counter) := p_new_rec.suffix;
679 l_old_val2(l_tab_counter) := null;
680 l_old_val3(l_tab_counter) := null;
681 l_old_val4(l_tab_counter) := null;
682 l_old_val5(l_tab_counter) := null;
683 l_old_val6(l_tab_counter) := null;
684 l_new_val2(l_tab_counter) := null;
685 l_new_val3(l_tab_counter) := null;
686 l_new_val4(l_tab_counter) := null;
687 l_new_val5(l_tab_counter) := null;
688 l_new_val6(l_tab_counter) := null;
689 end if;
690 if nvl(p_old_rec.pre_name_adjunct, '$$$$$&&&')
691 <> nvl(p_new_rec.pre_name_adjunct, '$$$$$&&&') then
692 l_tab_counter := l_tab_counter + 1;
693 l_chg_evt_tab(l_tab_counter) := 'CONA';
694 l_prmtr_01_tab(l_tab_counter) := null;
695 l_prmtr_02_tab(l_tab_counter) := null;
696 l_prmtr_03_tab(l_tab_counter) := null;
697 l_prmtr_04_tab(l_tab_counter) := null;
698 l_prmtr_05_tab(l_tab_counter) := null;
699 l_prmtr_06_tab(l_tab_counter) := null;
700 l_prmtr_07_tab(l_tab_counter) := null;
701 l_old_val1(l_tab_counter) := p_old_rec.pre_name_adjunct;
702 l_new_val1(l_tab_counter) := p_new_rec.pre_name_adjunct;
703 l_old_val2(l_tab_counter) := null;
704 l_old_val3(l_tab_counter) := null;
705 l_old_val4(l_tab_counter) := null;
706 l_old_val5(l_tab_counter) := null;
707 l_old_val6(l_tab_counter) := null;
708 l_new_val2(l_tab_counter) := null;
709 l_new_val3(l_tab_counter) := null;
710 l_new_val4(l_tab_counter) := null;
711 l_new_val5(l_tab_counter) := null;
712 l_new_val6(l_tab_counter) := null;
713 end if;
714 if nvl(p_old_rec.known_as, '$$$$$&&&')
715 <> nvl(p_new_rec.known_as, '$$$$$&&&') then
716 l_tab_counter := l_tab_counter + 1;
717 l_chg_evt_tab(l_tab_counter) := 'COKA';
718 l_prmtr_01_tab(l_tab_counter) := null;
719 l_prmtr_02_tab(l_tab_counter) := null;
720 l_prmtr_03_tab(l_tab_counter) := null;
721 l_prmtr_04_tab(l_tab_counter) := null;
722 l_prmtr_05_tab(l_tab_counter) := null;
723 l_prmtr_06_tab(l_tab_counter) := null;
724 l_prmtr_07_tab(l_tab_counter) := null;
725 l_old_val1(l_tab_counter) := p_old_rec.known_as;
726 l_new_val1(l_tab_counter) := p_new_rec.known_as;
727 l_old_val2(l_tab_counter) := null;
728 l_old_val3(l_tab_counter) := null;
729 l_old_val4(l_tab_counter) := null;
730 l_old_val5(l_tab_counter) := null;
731 l_old_val6(l_tab_counter) := null;
732 l_new_val2(l_tab_counter) := null;
733 l_new_val3(l_tab_counter) := null;
734 l_new_val4(l_tab_counter) := null;
735 l_new_val5(l_tab_counter) := null;
736 l_new_val6(l_tab_counter) := null;
737 end if;
738 if nvl(p_old_rec.previous_last_name, '$$$$$&&&')
739 <> nvl(p_new_rec.previous_last_name, '$$$$$&&&') then
740 l_tab_counter := l_tab_counter + 1;
741 l_chg_evt_tab(l_tab_counter) := 'COPL';
742 l_prmtr_01_tab(l_tab_counter) := null;
743 l_prmtr_02_tab(l_tab_counter) := null;
744 l_prmtr_03_tab(l_tab_counter) := null;
745 l_prmtr_04_tab(l_tab_counter) := null;
746 l_prmtr_05_tab(l_tab_counter) := null;
747 l_prmtr_06_tab(l_tab_counter) := null;
748 l_prmtr_07_tab(l_tab_counter) := null;
749 l_old_val1(l_tab_counter) := p_old_rec.previous_last_name;
750 l_new_val1(l_tab_counter) := p_new_rec.previous_last_name;
751 l_old_val2(l_tab_counter) := null;
752 l_old_val3(l_tab_counter) := null;
753 l_old_val4(l_tab_counter) := null;
754 l_old_val5(l_tab_counter) := null;
755 l_old_val6(l_tab_counter) := null;
756 l_new_val2(l_tab_counter) := null;
757 l_new_val3(l_tab_counter) := null;
758 l_new_val4(l_tab_counter) := null;
759 l_new_val5(l_tab_counter) := null;
760 l_new_val6(l_tab_counter) := null;
761 end if;
762 if nvl(p_old_rec.date_of_birth, to_date('01/01/0001', 'dd/mm/yyyy'))
763 <> nvl(p_new_rec.date_of_birth, to_date('01/01/0001', 'dd/mm/yyyy')) then
764 l_tab_counter := l_tab_counter + 1;
765 l_chg_evt_tab(l_tab_counter) := 'CODB';
766 l_prmtr_01_tab(l_tab_counter) := null;
767 l_prmtr_02_tab(l_tab_counter) := null;
768 l_prmtr_03_tab(l_tab_counter) := null;
769 l_prmtr_04_tab(l_tab_counter) := null;
770 l_prmtr_05_tab(l_tab_counter) := null;
771 l_prmtr_06_tab(l_tab_counter) := null;
772 l_prmtr_07_tab(l_tab_counter) := null;
773 l_old_val1(l_tab_counter) := to_char(p_old_rec.date_of_birth, 'mm/dd/yyyy');
774 l_new_val1(l_tab_counter) := to_char(p_new_rec.date_of_birth, 'mm/dd/yyyy');
775 l_old_val2(l_tab_counter) := null;
776 l_old_val3(l_tab_counter) := null;
777 l_old_val4(l_tab_counter) := null;
778 l_old_val5(l_tab_counter) := null;
779 l_old_val6(l_tab_counter) := null;
780 l_new_val2(l_tab_counter) := null;
781 l_new_val3(l_tab_counter) := null;
782 l_new_val4(l_tab_counter) := null;
783 l_new_val5(l_tab_counter) := null;
784 l_new_val6(l_tab_counter) := null;
785 end if;
786 if nvl(p_old_rec.date_of_death, to_date('01/01/0001', 'dd/mm/yyyy'))
787 <> nvl(p_new_rec.date_of_death, to_date('01/01/0001', 'dd/mm/yyyy')) then
788 l_tab_counter := l_tab_counter + 1;
789 l_chg_evt_tab(l_tab_counter) := 'CODD';
790 l_prmtr_01_tab(l_tab_counter) := null;
791 l_prmtr_02_tab(l_tab_counter) := null;
792 l_prmtr_03_tab(l_tab_counter) := null;
793 l_prmtr_04_tab(l_tab_counter) := null;
794 l_prmtr_05_tab(l_tab_counter) := null;
795 l_prmtr_06_tab(l_tab_counter) := null;
796 l_prmtr_07_tab(l_tab_counter) := null;
797 l_old_val1(l_tab_counter) := to_char(p_old_rec.date_of_death, 'mm/dd/yyyy');
798 l_new_val1(l_tab_counter) := to_char(p_new_rec.date_of_death, 'mm/dd/yyyy');
799 l_old_val2(l_tab_counter) := null;
800 l_old_val3(l_tab_counter) := null;
801 l_old_val4(l_tab_counter) := null;
802 l_old_val5(l_tab_counter) := null;
803 l_old_val6(l_tab_counter) := null;
804 l_new_val2(l_tab_counter) := null;
805 l_new_val3(l_tab_counter) := null;
806 l_new_val4(l_tab_counter) := null;
807 l_new_val5(l_tab_counter) := null;
808 l_new_val6(l_tab_counter) := null;
809 end if;
810 if (nvl(p_old_rec.date_employee_data_verified, to_date('01/01/0001', 'dd/mm/yyyy'))
811 <> nvl(p_new_rec.date_employee_data_verified, to_date('01/01/0001', 'dd/mm/yyyy')) or
812 (p_old_rec.date_employee_data_verified is null and
813 p_new_rec.date_employee_data_verified is not null) or
814 (p_old_rec.date_employee_data_verified is not null and
815 p_new_rec.date_employee_data_verified is null)) then
816 l_tab_counter := l_tab_counter + 1;
817 l_chg_evt_tab(l_tab_counter) := 'COPV';
818 l_prmtr_01_tab(l_tab_counter) := null;
819 l_prmtr_02_tab(l_tab_counter) := null;
820 l_prmtr_03_tab(l_tab_counter) := null;
821 l_prmtr_04_tab(l_tab_counter) := null;
822 l_prmtr_05_tab(l_tab_counter) := null;
823 l_prmtr_06_tab(l_tab_counter) := null;
824 l_prmtr_07_tab(l_tab_counter) := null;
825 l_old_val1(l_tab_counter) := to_char(p_old_rec.date_employee_data_verified, 'mm/dd/yyyy');
826 l_new_val1(l_tab_counter) := to_char(p_new_rec.date_employee_data_verified, 'mm/dd/yyyy');
827 l_old_val2(l_tab_counter) := null;
828 l_old_val3(l_tab_counter) := null;
829 l_old_val4(l_tab_counter) := null;
830 l_old_val5(l_tab_counter) := null;
831 l_old_val6(l_tab_counter) := null;
832 l_new_val2(l_tab_counter) := null;
833 l_new_val3(l_tab_counter) := null;
834 l_new_val4(l_tab_counter) := null;
835 l_new_val5(l_tab_counter) := null;
836 l_new_val6(l_tab_counter) := null;
837 end if;
838 if nvl(p_old_rec.marital_status, '$')
839 <> nvl(p_new_rec.marital_status, '$') then
840 -- read marital status from lookup table
841 open c_lookup_value('MAR_STATUS', p_old_rec.marital_status);
842 fetch c_lookup_value into l_old_marital_status;
843 close c_lookup_value;
844 open c_lookup_value('MAR_STATUS', p_new_rec.marital_status);
845 fetch c_lookup_value into l_new_marital_status;
846 close c_lookup_value;
847
848 l_tab_counter := l_tab_counter + 1;
849 l_chg_evt_tab(l_tab_counter) := 'COM';
850 l_prmtr_01_tab(l_tab_counter) := null;
851 l_prmtr_02_tab(l_tab_counter) := null;
852 l_prmtr_03_tab(l_tab_counter) := null;
853 l_prmtr_04_tab(l_tab_counter) := null;
854 l_prmtr_05_tab(l_tab_counter) := null;
855 l_prmtr_06_tab(l_tab_counter) := null;
856 l_prmtr_07_tab(l_tab_counter) := null;
857 l_old_val1(l_tab_counter) := l_old_marital_status;
858 l_new_val1(l_tab_counter) := l_new_marital_status;
859 l_old_val2(l_tab_counter) := null;
860 l_old_val3(l_tab_counter) := null;
861 l_old_val4(l_tab_counter) := null;
862 l_old_val5(l_tab_counter) := null;
863 l_old_val6(l_tab_counter) := null;
864 l_new_val2(l_tab_counter) := null;
865 l_new_val3(l_tab_counter) := null;
866 l_new_val4(l_tab_counter) := null;
867 l_new_val5(l_tab_counter) := null;
868 l_new_val6(l_tab_counter) := null;
869 end if;
870 if nvl(p_old_rec.sex, '$')
871 <> nvl(p_new_rec.sex, '$') then
872 -- read gender from lookup table
873 open c_lookup_value('SEX', p_old_rec.sex);
874 fetch c_lookup_value into l_old_sex;
875 close c_lookup_value;
876 open c_lookup_value('SEX', p_new_rec.sex);
877 fetch c_lookup_value into l_new_sex;
878 close c_lookup_value;
879
880 l_tab_counter := l_tab_counter + 1;
881 l_chg_evt_tab(l_tab_counter) := 'COG';
882 l_prmtr_01_tab(l_tab_counter) := null;
883 l_prmtr_02_tab(l_tab_counter) := null;
884 l_prmtr_03_tab(l_tab_counter) := null;
885 l_prmtr_04_tab(l_tab_counter) := null;
886 l_prmtr_05_tab(l_tab_counter) := null;
887 l_prmtr_06_tab(l_tab_counter) := null;
888 l_prmtr_07_tab(l_tab_counter) := null;
889 l_old_val1(l_tab_counter) := l_old_sex;
890 l_new_val1(l_tab_counter) := l_new_sex;
891 l_old_val2(l_tab_counter) := null;
892 l_old_val3(l_tab_counter) := null;
893 l_old_val4(l_tab_counter) := null;
894 l_old_val5(l_tab_counter) := null;
895 l_old_val6(l_tab_counter) := null;
896 l_new_val2(l_tab_counter) := null;
897 l_new_val3(l_tab_counter) := null;
898 l_new_val4(l_tab_counter) := null;
899 l_new_val5(l_tab_counter) := null;
900 l_new_val6(l_tab_counter) := null;
901 end if;
902 if nvl(p_old_rec.registered_disabled_flag, '$')
903 <> nvl(p_new_rec.registered_disabled_flag, '$') then
904 -- read disability status from lookup table
905 open c_lookup_value('REGISTERED_DISABLED', p_old_rec.registered_disabled_flag);
906 fetch c_lookup_value into l_old_disability_status;
907 close c_lookup_value;
908 open c_lookup_value('REGISTERED_DISABLED', p_new_rec.registered_disabled_flag);
909 fetch c_lookup_value into l_new_disability_status;
910 close c_lookup_value;
911
912 l_tab_counter := l_tab_counter + 1;
913 l_chg_evt_tab(l_tab_counter) := 'CODS';
914 l_prmtr_01_tab(l_tab_counter) := null;
915 l_prmtr_02_tab(l_tab_counter) := null;
916 l_prmtr_03_tab(l_tab_counter) := null;
917 l_prmtr_04_tab(l_tab_counter) := null;
918 l_prmtr_05_tab(l_tab_counter) := null;
919 l_prmtr_06_tab(l_tab_counter) := null;
920 l_prmtr_07_tab(l_tab_counter) := null;
921 l_old_val1(l_tab_counter) := l_old_disability_status;
922 l_new_val1(l_tab_counter) := l_new_disability_status;
923 l_old_val2(l_tab_counter) := null;
924 l_old_val3(l_tab_counter) := null;
925 l_old_val4(l_tab_counter) := null;
926 l_old_val5(l_tab_counter) := null;
927 l_old_val6(l_tab_counter) := null;
928 l_new_val2(l_tab_counter) := null;
929 l_new_val3(l_tab_counter) := null;
930 l_new_val4(l_tab_counter) := null;
931 l_new_val5(l_tab_counter) := null;
932 l_new_val6(l_tab_counter) := null;
933 end if;
934 if nvl(p_old_rec.benefit_group_id, 1)
935 <> nvl(p_new_rec.benefit_group_id, 1) then
936 -- read old and new benefits group values
937 open c_benefits_group(p_old_rec.benefit_group_id);
938 fetch c_benefits_group into l_old_benefits_group;
939 close c_benefits_group;
940 open c_benefits_group(p_new_rec.benefit_group_id);
941 fetch c_benefits_group into l_new_benefits_group;
942 close c_benefits_group;
943
944 l_tab_counter := l_tab_counter + 1;
945 l_chg_evt_tab(l_tab_counter) := 'COBG';
946 l_prmtr_01_tab(l_tab_counter) := p_old_rec.benefit_group_id;
947 l_prmtr_02_tab(l_tab_counter) := p_new_rec.benefit_group_id;
948 l_prmtr_03_tab(l_tab_counter) := null;
949 l_prmtr_04_tab(l_tab_counter) := null;
950 l_prmtr_05_tab(l_tab_counter) := null;
951 l_prmtr_06_tab(l_tab_counter) := null;
952 l_prmtr_07_tab(l_tab_counter) := null;
953 l_old_val1(l_tab_counter) := l_old_benefits_group;
954 l_new_val1(l_tab_counter) := l_new_benefits_group;
955 l_old_val2(l_tab_counter) := null;
956 l_old_val3(l_tab_counter) := null;
957 l_old_val4(l_tab_counter) := null;
958 l_old_val5(l_tab_counter) := null;
959 l_old_val6(l_tab_counter) := null;
960 l_new_val2(l_tab_counter) := null;
961 l_new_val3(l_tab_counter) := null;
962 l_new_val4(l_tab_counter) := null;
963 l_new_val5(l_tab_counter) := null;
964 l_new_val6(l_tab_counter) := null;
965 end if;
966 if nvl(p_old_rec.student_status, '$')
967 <> nvl(p_new_rec.student_status, '$') then
968 -- read student status from lookup table
969 open c_lookup_value('STUDENT_STATUS', p_old_rec.student_status);
970 fetch c_lookup_value into l_old_student_status;
971 close c_lookup_value;
972 open c_lookup_value('STUDENT_STATUS', p_new_rec.student_status);
973 fetch c_lookup_value into l_new_student_status;
974 close c_lookup_value;
975
976 l_tab_counter := l_tab_counter + 1;
977 l_chg_evt_tab(l_tab_counter) := 'COST';
978 l_prmtr_01_tab(l_tab_counter) := null;
979 l_prmtr_02_tab(l_tab_counter) := null;
980 l_prmtr_03_tab(l_tab_counter) := null;
981 l_prmtr_04_tab(l_tab_counter) := null;
982 l_prmtr_05_tab(l_tab_counter) := null;
983 l_prmtr_06_tab(l_tab_counter) := null;
984 l_prmtr_07_tab(l_tab_counter) := null;
985 l_old_val1(l_tab_counter) := l_old_student_status;
986 l_new_val1(l_tab_counter) := l_new_student_status;
987 l_old_val2(l_tab_counter) := null;
988 l_old_val3(l_tab_counter) := null;
989 l_old_val4(l_tab_counter) := null;
990 l_old_val5(l_tab_counter) := null;
991 l_old_val6(l_tab_counter) := null;
992 l_new_val2(l_tab_counter) := null;
993 l_new_val3(l_tab_counter) := null;
994 l_new_val4(l_tab_counter) := null;
995 l_new_val5(l_tab_counter) := null;
996 l_new_val6(l_tab_counter) := null;
997 end if;
998 if nvl(p_old_rec.attribute1, '$')
999 <> nvl(p_new_rec.attribute1, '$') then
1000 l_tab_counter := l_tab_counter + 1;
1001 l_chg_evt_tab(l_tab_counter) := 'COPF01';
1002 l_prmtr_01_tab(l_tab_counter) := null;
1003 l_prmtr_02_tab(l_tab_counter) := null;
1004 l_prmtr_03_tab(l_tab_counter) := null;
1005 l_prmtr_04_tab(l_tab_counter) := null;
1006 l_prmtr_05_tab(l_tab_counter) := null;
1007 l_prmtr_06_tab(l_tab_counter) := null;
1008 l_prmtr_07_tab(l_tab_counter) := null;
1009 l_old_val1(l_tab_counter) := p_old_rec.attribute1;
1010 l_new_val1(l_tab_counter) := p_new_rec.attribute1;
1011 l_old_val2(l_tab_counter) := null;
1012 l_old_val3(l_tab_counter) := null;
1013 l_old_val4(l_tab_counter) := null;
1014 l_old_val5(l_tab_counter) := null;
1015 l_old_val6(l_tab_counter) := null;
1016 l_new_val2(l_tab_counter) := null;
1017 l_new_val3(l_tab_counter) := null;
1018 l_new_val4(l_tab_counter) := null;
1019 l_new_val5(l_tab_counter) := null;
1020 l_new_val6(l_tab_counter) := null;
1021 end if;
1022 if nvl(p_old_rec.attribute2, '$')
1023 <> nvl(p_new_rec.attribute2, '$') then
1024 l_tab_counter := l_tab_counter + 1;
1025 l_chg_evt_tab(l_tab_counter) := 'COPF02';
1026 l_prmtr_01_tab(l_tab_counter) := null;
1027 l_prmtr_02_tab(l_tab_counter) := null;
1028 l_prmtr_03_tab(l_tab_counter) := null;
1029 l_prmtr_04_tab(l_tab_counter) := null;
1030 l_prmtr_05_tab(l_tab_counter) := null;
1031 l_prmtr_06_tab(l_tab_counter) := null;
1032 l_prmtr_07_tab(l_tab_counter) := null;
1033 l_old_val1(l_tab_counter) := p_old_rec.attribute2;
1034 l_new_val1(l_tab_counter) := p_new_rec.attribute2;
1035 l_old_val2(l_tab_counter) := null;
1036 l_old_val3(l_tab_counter) := null;
1037 l_old_val4(l_tab_counter) := null;
1038 l_old_val5(l_tab_counter) := null;
1039 l_old_val6(l_tab_counter) := null;
1040 l_new_val2(l_tab_counter) := null;
1041 l_new_val3(l_tab_counter) := null;
1042 l_new_val4(l_tab_counter) := null;
1043 l_new_val5(l_tab_counter) := null;
1044 l_new_val6(l_tab_counter) := null;
1045 end if;
1046 if nvl(p_old_rec.attribute3, '$')
1047 <> nvl(p_new_rec.attribute3, '$') then
1048 l_tab_counter := l_tab_counter + 1;
1049 l_chg_evt_tab(l_tab_counter) := 'COPF03';
1050 l_prmtr_01_tab(l_tab_counter) := null;
1051 l_prmtr_02_tab(l_tab_counter) := null;
1052 l_prmtr_03_tab(l_tab_counter) := null;
1053 l_prmtr_04_tab(l_tab_counter) := null;
1054 l_prmtr_05_tab(l_tab_counter) := null;
1055 l_prmtr_06_tab(l_tab_counter) := null;
1056 l_prmtr_07_tab(l_tab_counter) := null;
1057 l_old_val1(l_tab_counter) := p_old_rec.attribute3;
1058 l_new_val1(l_tab_counter) := p_new_rec.attribute3;
1059 l_old_val2(l_tab_counter) := null;
1060 l_old_val3(l_tab_counter) := null;
1061 l_old_val4(l_tab_counter) := null;
1062 l_old_val5(l_tab_counter) := null;
1063 l_old_val6(l_tab_counter) := null;
1064 l_new_val2(l_tab_counter) := null;
1065 l_new_val3(l_tab_counter) := null;
1066 l_new_val4(l_tab_counter) := null;
1067 l_new_val5(l_tab_counter) := null;
1068 l_new_val6(l_tab_counter) := null;
1069 end if;
1070 if nvl(p_old_rec.attribute4, '$')
1071 <> nvl(p_new_rec.attribute4, '$') then
1072 l_tab_counter := l_tab_counter + 1;
1073 l_chg_evt_tab(l_tab_counter) := 'COPF04';
1074 l_prmtr_01_tab(l_tab_counter) := null;
1075 l_prmtr_02_tab(l_tab_counter) := null;
1076 l_prmtr_03_tab(l_tab_counter) := null;
1077 l_prmtr_04_tab(l_tab_counter) := null;
1078 l_prmtr_05_tab(l_tab_counter) := null;
1079 l_prmtr_06_tab(l_tab_counter) := null;
1080 l_prmtr_07_tab(l_tab_counter) := null;
1081 l_old_val1(l_tab_counter) := p_old_rec.attribute4;
1082 l_new_val1(l_tab_counter) := p_new_rec.attribute4;
1083 l_old_val2(l_tab_counter) := null;
1084 l_old_val3(l_tab_counter) := null;
1085 l_old_val4(l_tab_counter) := null;
1086 l_old_val5(l_tab_counter) := null;
1087 l_old_val6(l_tab_counter) := null;
1088 l_new_val2(l_tab_counter) := null;
1089 l_new_val3(l_tab_counter) := null;
1090 l_new_val4(l_tab_counter) := null;
1091 l_new_val5(l_tab_counter) := null;
1092 l_new_val6(l_tab_counter) := null;
1093 end if;
1094 if nvl(p_old_rec.attribute5, '$')
1095 <> nvl(p_new_rec.attribute5, '$') then
1096 l_tab_counter := l_tab_counter + 1;
1097 l_chg_evt_tab(l_tab_counter) := 'COPF05';
1098 l_prmtr_01_tab(l_tab_counter) := null;
1099 l_prmtr_02_tab(l_tab_counter) := null;
1100 l_prmtr_03_tab(l_tab_counter) := null;
1101 l_prmtr_04_tab(l_tab_counter) := null;
1102 l_prmtr_05_tab(l_tab_counter) := null;
1103 l_prmtr_06_tab(l_tab_counter) := null;
1104 l_prmtr_07_tab(l_tab_counter) := null;
1105 l_old_val1(l_tab_counter) := p_old_rec.attribute5;
1106 l_new_val1(l_tab_counter) := p_new_rec.attribute5;
1107 l_old_val2(l_tab_counter) := null;
1108 l_old_val3(l_tab_counter) := null;
1109 l_old_val4(l_tab_counter) := null;
1110 l_old_val5(l_tab_counter) := null;
1111 l_old_val6(l_tab_counter) := null;
1112 l_new_val2(l_tab_counter) := null;
1113 l_new_val3(l_tab_counter) := null;
1114 l_new_val4(l_tab_counter) := null;
1115 l_new_val5(l_tab_counter) := null;
1116 l_new_val6(l_tab_counter) := null;
1117 end if;
1118 if nvl(p_old_rec.attribute6, '$')
1119 <> nvl(p_new_rec.attribute6, '$') then
1120 l_tab_counter := l_tab_counter + 1;
1121 l_chg_evt_tab(l_tab_counter) := 'COPF06';
1122 l_prmtr_01_tab(l_tab_counter) := null;
1123 l_prmtr_02_tab(l_tab_counter) := null;
1124 l_prmtr_03_tab(l_tab_counter) := null;
1125 l_prmtr_04_tab(l_tab_counter) := null;
1126 l_prmtr_05_tab(l_tab_counter) := null;
1127 l_prmtr_06_tab(l_tab_counter) := null;
1128 l_prmtr_07_tab(l_tab_counter) := null;
1129 l_old_val1(l_tab_counter) := p_old_rec.attribute6;
1130 l_new_val1(l_tab_counter) := p_new_rec.attribute6;
1131 l_old_val2(l_tab_counter) := null;
1132 l_old_val3(l_tab_counter) := null;
1133 l_old_val4(l_tab_counter) := null;
1134 l_old_val5(l_tab_counter) := null;
1135 l_old_val6(l_tab_counter) := null;
1136 l_new_val2(l_tab_counter) := null;
1137 l_new_val3(l_tab_counter) := null;
1138 l_new_val4(l_tab_counter) := null;
1139 l_new_val5(l_tab_counter) := null;
1140 l_new_val6(l_tab_counter) := null;
1141 end if;
1142 if nvl(p_old_rec.attribute7, '$')
1143 <> nvl(p_new_rec.attribute7, '$') then
1144 l_tab_counter := l_tab_counter + 1;
1145 l_chg_evt_tab(l_tab_counter) := 'COPF07';
1146 l_prmtr_01_tab(l_tab_counter) := null;
1147 l_prmtr_02_tab(l_tab_counter) := null;
1148 l_prmtr_03_tab(l_tab_counter) := null;
1149 l_prmtr_04_tab(l_tab_counter) := null;
1150 l_prmtr_05_tab(l_tab_counter) := null;
1151 l_prmtr_06_tab(l_tab_counter) := null;
1152 l_prmtr_07_tab(l_tab_counter) := null;
1153 l_old_val1(l_tab_counter) := p_old_rec.attribute7;
1154 l_new_val1(l_tab_counter) := p_new_rec.attribute7;
1155 l_old_val2(l_tab_counter) := null;
1156 l_old_val3(l_tab_counter) := null;
1157 l_old_val4(l_tab_counter) := null;
1158 l_old_val5(l_tab_counter) := null;
1159 l_old_val6(l_tab_counter) := null;
1160 l_new_val2(l_tab_counter) := null;
1161 l_new_val3(l_tab_counter) := null;
1162 l_new_val4(l_tab_counter) := null;
1163 l_new_val5(l_tab_counter) := null;
1164 l_new_val6(l_tab_counter) := null;
1165 end if;
1166 if nvl(p_old_rec.attribute8, '$')
1167 <> nvl(p_new_rec.attribute8, '$') then
1168 l_tab_counter := l_tab_counter + 1;
1169 l_chg_evt_tab(l_tab_counter) := 'COPF08';
1170 l_prmtr_01_tab(l_tab_counter) := null;
1171 l_prmtr_02_tab(l_tab_counter) := null;
1172 l_prmtr_03_tab(l_tab_counter) := null;
1173 l_prmtr_04_tab(l_tab_counter) := null;
1174 l_prmtr_05_tab(l_tab_counter) := null;
1175 l_prmtr_06_tab(l_tab_counter) := null;
1176 l_prmtr_07_tab(l_tab_counter) := null;
1177 l_old_val1(l_tab_counter) := p_old_rec.attribute8;
1178 l_new_val1(l_tab_counter) := p_new_rec.attribute8;
1179 l_old_val2(l_tab_counter) := null;
1180 l_old_val3(l_tab_counter) := null;
1181 l_old_val4(l_tab_counter) := null;
1182 l_old_val5(l_tab_counter) := null;
1183 l_old_val6(l_tab_counter) := null;
1184 l_new_val2(l_tab_counter) := null;
1185 l_new_val3(l_tab_counter) := null;
1186 l_new_val4(l_tab_counter) := null;
1187 l_new_val5(l_tab_counter) := null;
1188 l_new_val6(l_tab_counter) := null;
1189 end if;
1190 if nvl(p_old_rec.attribute9, '$')
1191 <> nvl(p_new_rec.attribute9, '$') then
1192 l_tab_counter := l_tab_counter + 1;
1193 l_chg_evt_tab(l_tab_counter) := 'COPF09';
1194 l_prmtr_01_tab(l_tab_counter) := null;
1195 l_prmtr_02_tab(l_tab_counter) := null;
1196 l_prmtr_03_tab(l_tab_counter) := null;
1197 l_prmtr_04_tab(l_tab_counter) := null;
1198 l_prmtr_05_tab(l_tab_counter) := null;
1199 l_prmtr_06_tab(l_tab_counter) := null;
1200 l_prmtr_07_tab(l_tab_counter) := null;
1201 l_old_val1(l_tab_counter) := p_old_rec.attribute9;
1202 l_new_val1(l_tab_counter) := p_new_rec.attribute9;
1203 l_old_val2(l_tab_counter) := null;
1204 l_old_val3(l_tab_counter) := null;
1205 l_old_val4(l_tab_counter) := null;
1206 l_old_val5(l_tab_counter) := null;
1207 l_old_val6(l_tab_counter) := null;
1208 l_new_val2(l_tab_counter) := null;
1209 l_new_val3(l_tab_counter) := null;
1210 l_new_val4(l_tab_counter) := null;
1211 l_new_val5(l_tab_counter) := null;
1212 l_new_val6(l_tab_counter) := null;
1213 end if;
1214 if nvl(p_old_rec.attribute10, '$')
1215 <> nvl(p_new_rec.attribute10, '$') then
1216 l_tab_counter := l_tab_counter + 1;
1217 l_chg_evt_tab(l_tab_counter) := 'COPF10';
1218 l_prmtr_01_tab(l_tab_counter) := null;
1219 l_prmtr_02_tab(l_tab_counter) := null;
1220 l_prmtr_03_tab(l_tab_counter) := null;
1221 l_prmtr_04_tab(l_tab_counter) := null;
1222 l_prmtr_05_tab(l_tab_counter) := null;
1223 l_prmtr_06_tab(l_tab_counter) := null;
1224 l_prmtr_07_tab(l_tab_counter) := null;
1225 l_old_val1(l_tab_counter) := p_old_rec.attribute10;
1226 l_new_val1(l_tab_counter) := p_new_rec.attribute10;
1227 l_old_val2(l_tab_counter) := null;
1228 l_old_val3(l_tab_counter) := null;
1229 l_old_val4(l_tab_counter) := null;
1230 l_old_val5(l_tab_counter) := null;
1231 l_old_val6(l_tab_counter) := null;
1232 l_new_val2(l_tab_counter) := null;
1233 l_new_val3(l_tab_counter) := null;
1234 l_new_val4(l_tab_counter) := null;
1235 l_new_val5(l_tab_counter) := null;
1236 l_new_val6(l_tab_counter) := null;
1237 end if;
1238 if nvl(p_old_rec.email_address, '$')
1239 <> nvl(p_new_rec.email_address, '$') then
1240 l_tab_counter := l_tab_counter + 1;
1241 l_chg_evt_tab(l_tab_counter) := 'COEA';
1242 l_prmtr_01_tab(l_tab_counter) := null;
1243 l_prmtr_02_tab(l_tab_counter) := null;
1244 l_prmtr_03_tab(l_tab_counter) := null;
1245 l_prmtr_04_tab(l_tab_counter) := null;
1246 l_prmtr_05_tab(l_tab_counter) := null;
1247 l_prmtr_06_tab(l_tab_counter) := null;
1248 l_prmtr_07_tab(l_tab_counter) := null;
1249 l_old_val1(l_tab_counter) := substr(p_old_rec.email_address,1,240);
1250 l_new_val1(l_tab_counter) := substr(p_new_rec.email_address,1,240);
1251 l_old_val2(l_tab_counter) := null;
1252 l_old_val3(l_tab_counter) := null;
1253 l_old_val4(l_tab_counter) := null;
1254 l_old_val5(l_tab_counter) := null;
1255 l_old_val6(l_tab_counter) := null;
1256 l_new_val2(l_tab_counter) := null;
1257 l_new_val3(l_tab_counter) := null;
1258 l_new_val4(l_tab_counter) := null;
1259 l_new_val5(l_tab_counter) := null;
1260 l_new_val6(l_tab_counter) := null;
1261 end if;
1262 if nvl(p_old_rec.per_information10, '$')
1263 <> nvl(p_new_rec.per_information10, '$') then
1264 l_tab_counter := l_tab_counter + 1;
1265 l_chg_evt_tab(l_tab_counter) := 'CCOPMD';
1266 l_prmtr_01_tab(l_tab_counter) := null;
1267 l_prmtr_02_tab(l_tab_counter) := null;
1268 l_prmtr_03_tab(l_tab_counter) := null;
1269 l_prmtr_04_tab(l_tab_counter) := null;
1270 l_prmtr_05_tab(l_tab_counter) := null;
1271 l_prmtr_06_tab(l_tab_counter) := null;
1272 l_prmtr_07_tab(l_tab_counter) := null;
1273 l_old_val1(l_tab_counter) := p_old_rec.per_information10;
1274 l_new_val1(l_tab_counter) := p_new_rec.per_information10;
1275 l_old_val2(l_tab_counter) := null;
1276 l_old_val3(l_tab_counter) := null;
1277 l_old_val4(l_tab_counter) := null;
1278 l_old_val5(l_tab_counter) := null;
1279 l_old_val6(l_tab_counter) := null;
1280 l_new_val2(l_tab_counter) := null;
1281 l_new_val3(l_tab_counter) := null;
1282 l_new_val4(l_tab_counter) := null;
1283 l_new_val5(l_tab_counter) := null;
1284 l_new_val6(l_tab_counter) := null;
1285 end if;
1286 if nvl(p_old_rec.per_information1, '$')
1287 <> nvl(p_new_rec.per_information1, '$') then
1288
1289 -- read ethnic group from lookup table
1290 open c_lookup_value('US_ETHNIC_GROUP', p_old_rec.per_information1);
1291 fetch c_lookup_value into l_old_ethnic_group;
1292 close c_lookup_value;
1293 open c_lookup_value('US_ETHNIC_GROUP', p_new_rec.per_information1);
1294 fetch c_lookup_value into l_new_ethnic_group;
1295 close c_lookup_value;
1296 ---
1297
1298 l_tab_counter := l_tab_counter + 1;
1299 l_chg_evt_tab(l_tab_counter) := 'CETHORG';
1300 l_prmtr_01_tab(l_tab_counter) := null;
1301 l_prmtr_02_tab(l_tab_counter) := null;
1302 l_prmtr_03_tab(l_tab_counter) := null;
1303 l_prmtr_04_tab(l_tab_counter) := null;
1304 l_prmtr_05_tab(l_tab_counter) := null;
1305 l_prmtr_06_tab(l_tab_counter) := null;
1306 l_prmtr_07_tab(l_tab_counter) := null;
1307 l_old_val1(l_tab_counter) := l_old_ethnic_group;
1308 l_new_val1(l_tab_counter) := l_new_ethnic_group;
1309 l_old_val2(l_tab_counter) := null;
1310 l_old_val3(l_tab_counter) := null;
1311 l_old_val4(l_tab_counter) := null;
1312 l_old_val5(l_tab_counter) := null;
1313 l_old_val6(l_tab_counter) := null;
1314 l_new_val2(l_tab_counter) := null;
1315 l_new_val3(l_tab_counter) := null;
1316 l_new_val4(l_tab_counter) := null;
1317 l_new_val5(l_tab_counter) := null;
1318 l_new_val6(l_tab_counter) := null;
1319 end if;
1320 if nvl(p_old_rec.correspondence_language, '$')
1321 <> nvl(p_new_rec.correspondence_language, '$') then
1322 l_tab_counter := l_tab_counter + 1;
1323 l_chg_evt_tab(l_tab_counter) := 'CLANG';
1324 l_prmtr_01_tab(l_tab_counter) := null;
1325 l_prmtr_02_tab(l_tab_counter) := null;
1326 l_prmtr_03_tab(l_tab_counter) := null;
1327 l_prmtr_04_tab(l_tab_counter) := null;
1328 l_prmtr_05_tab(l_tab_counter) := null;
1329 l_prmtr_06_tab(l_tab_counter) := null;
1330 l_prmtr_07_tab(l_tab_counter) := null;
1331 l_old_val1(l_tab_counter) := p_old_rec.correspondence_language;
1332 l_new_val1(l_tab_counter) := p_new_rec.correspondence_language;
1333 l_old_val2(l_tab_counter) := null;
1334 l_old_val3(l_tab_counter) := null;
1335 l_old_val4(l_tab_counter) := null;
1336 l_old_val5(l_tab_counter) := null;
1337 l_old_val6(l_tab_counter) := null;
1338 l_new_val2(l_tab_counter) := null;
1339 l_new_val3(l_tab_counter) := null;
1340 l_new_val4(l_tab_counter) := null;
1341 l_new_val5(l_tab_counter) := null;
1342 l_new_val6(l_tab_counter) := null;
1343 end if;
1344
1345 if nvl(p_old_rec.uses_tobacco_flag, '$')
1346 <> nvl(p_new_rec.uses_tobacco_flag, '$') then
1347 l_tab_counter := l_tab_counter + 1;
1348 l_chg_evt_tab(l_tab_counter) := 'CTOBAC';
1349 l_prmtr_01_tab(l_tab_counter) := null;
1350 l_prmtr_02_tab(l_tab_counter) := null;
1351 l_prmtr_03_tab(l_tab_counter) := null;
1352 l_prmtr_04_tab(l_tab_counter) := null;
1353 l_prmtr_05_tab(l_tab_counter) := null;
1354 l_prmtr_06_tab(l_tab_counter) := null;
1355 l_prmtr_07_tab(l_tab_counter) := null;
1356 l_old_val1(l_tab_counter) := p_old_rec.uses_tobacco_flag;
1357 l_new_val1(l_tab_counter) := p_new_rec.uses_tobacco_flag;
1358 l_old_val2(l_tab_counter) := null;
1359 l_old_val3(l_tab_counter) := null;
1360 l_old_val4(l_tab_counter) := null;
1361 l_old_val5(l_tab_counter) := null;
1362 l_old_val6(l_tab_counter) := null;
1363 l_new_val2(l_tab_counter) := null;
1364 l_new_val3(l_tab_counter) := null;
1365 l_new_val4(l_tab_counter) := null;
1366 l_new_val5(l_tab_counter) := null;
1367 l_new_val6(l_tab_counter) := null;
1368 end if;
1369
1370
1371
1372 if nvl(p_old_rec.employee_number, '$')
1373 <> nvl(p_new_rec.employee_number, '$') then
1374 l_tab_counter := l_tab_counter + 1;
1375 l_chg_evt_tab(l_tab_counter) := 'COEN';
1376 l_prmtr_01_tab(l_tab_counter) := null;
1377 l_prmtr_02_tab(l_tab_counter) := null;
1378 l_prmtr_03_tab(l_tab_counter) := null;
1379 l_prmtr_04_tab(l_tab_counter) := null;
1380 l_prmtr_05_tab(l_tab_counter) := null;
1381 l_prmtr_06_tab(l_tab_counter) := null;
1382 l_prmtr_07_tab(l_tab_counter) := null;
1383 l_old_val1(l_tab_counter) := p_old_rec.employee_number;
1384 l_new_val1(l_tab_counter) := p_new_rec.employee_number;
1385 l_old_val2(l_tab_counter) := null;
1386 l_old_val3(l_tab_counter) := null;
1387 l_old_val4(l_tab_counter) := null;
1388 l_old_val5(l_tab_counter) := null;
1389 l_old_val6(l_tab_counter) := null;
1390 l_new_val2(l_tab_counter) := null;
1391 l_new_val3(l_tab_counter) := null;
1392 l_new_val4(l_tab_counter) := null;
1393 l_new_val5(l_tab_counter) := null;
1394 l_new_val6(l_tab_counter) := null;
1395 end if;
1396
1397 end if;
1398 for l_count in 1..l_chg_evt_tab.count loop
1399 if change_event_is_enabled(l_chg_evt_tab(l_count),p_new_rec.effective_start_date) then
1400 ben_ext_chg_evt_api.create_ext_chg_evt
1401 (p_validate => FALSE
1402 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
1403 ,p_chg_evt_cd => l_chg_evt_tab(l_count)
1404 ,p_chg_eff_dt => p_new_rec.effective_start_date
1405 ,p_prmtr_01 => l_prmtr_01_tab(l_count)
1406 ,p_prmtr_02 => l_prmtr_02_tab(l_count)
1407 ,p_prmtr_03 => l_prmtr_03_tab(l_count)
1408 ,p_prmtr_04 => l_prmtr_04_tab(l_count)
1409 ,p_prmtr_05 => l_prmtr_05_tab(l_count)
1410 ,p_prmtr_06 => l_prmtr_06_tab(l_count)
1411 ,p_prmtr_07 => l_prmtr_07_tab(l_count)
1412 ,p_prmtr_10 => p_new_rec.update_mode
1413 ,p_person_id => p_new_rec.person_id
1414 ,p_business_group_id => p_new_rec.business_group_id
1415 ,p_object_version_number => l_object_version_number
1416 ,p_effective_date => p_new_rec.effective_start_date
1417 ,p_old_val1 => l_old_val1(l_count)
1418 ,p_old_val2 => l_old_val2(l_count)
1419 ,p_old_val3 => l_old_val3(l_count)
1420 ,p_old_val4 => l_old_val4(l_count)
1421 ,p_old_val5 => l_old_val5(l_count)
1422 ,p_old_val6 => l_old_val6(l_count)
1423 ,p_new_val1 => l_new_val1(l_count)
1424 ,p_new_val2 => l_new_val2(l_count)
1425 ,p_new_val3 => l_new_val3(l_count)
1426 ,p_new_val4 => l_new_val4(l_count)
1427 ,p_new_val5 => l_new_val5(l_count)
1428 ,p_new_val6 => l_new_val6(l_count)
1429 );
1430 end if;
1431 end loop;
1432 --
1433 --for contact data change
1434 -- For contact there will be two type og log will be created
1435 -- only when the person type is contact - this is old one and maintained for backwdrd compatibility
1436 -- aonther one for all the contact person regardless of person type - this is new one
1437
1438 open c_relationship(p_new_rec.person_id);
1439 fetch c_relationship into l_contact,l_relationship;
1440 if c_relationship%notfound then
1441 close c_relationship;
1442 elsif c_relationship%found then
1443 close c_relationship;
1444 open c_person_type(p_new_rec.person_type_id);
1445 fetch c_person_type into l_person_type;
1446 if c_person_type%notfound then
1447 close c_person_type;
1448 else
1449 if l_person_type = 'OTHER' then
1450 close c_person_type;
1451 l_ini_tab_counter := l_tab_counter;
1452 if nvl(p_old_rec.full_name, '$$$$$&&&')
1453 <> nvl(p_new_rec.full_name, '$$$$$&&&') then
1454 l_tab_counter := l_tab_counter + 1;
1455 l_cont_chg_evt_tab(l_tab_counter) := 'CCFN';
1456 l_prmtr_01_tab(l_tab_counter) := null;
1457 l_prmtr_02_tab(l_tab_counter) := null;
1458 l_prmtr_03_tab(l_tab_counter) := null;
1459 l_prmtr_04_tab(l_tab_counter) := null;
1460 l_prmtr_05_tab(l_tab_counter) := null;
1461 l_prmtr_06_tab(l_tab_counter) := null;
1462 l_prmtr_07_tab(l_tab_counter) := null;
1463 l_old_val1(l_tab_counter) := substr(p_old_rec.full_name,1,240);
1464 l_old_val2(l_tab_counter) := p_old_rec.title;
1465 l_old_val3(l_tab_counter) := p_old_rec.first_name;
1466 l_old_val4(l_tab_counter) := p_old_rec.middle_names;
1467 l_old_val5(l_tab_counter) := p_old_rec.last_name;
1468 l_old_val6(l_tab_counter) := p_old_rec.suffix;
1469 l_new_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1470 l_new_val2(l_tab_counter) := p_new_rec.title;
1471 l_new_val3(l_tab_counter) := p_new_rec.first_name;
1472 l_new_val4(l_tab_counter) := p_new_rec.middle_names;
1473 l_new_val5(l_tab_counter) := p_new_rec.last_name;
1474 l_new_val6(l_tab_counter) := p_new_rec.suffix;
1475 end if;
1476 if nvl(p_old_rec.date_of_birth, to_date('01/01/0001', 'dd/mm/yyyy'))
1477 <> nvl(p_new_rec.date_of_birth, to_date('01/01/0001', 'dd/mm/yyyy')) then
1478 l_tab_counter := l_tab_counter + 1;
1479 l_cont_chg_evt_tab(l_tab_counter) := 'CCDB';
1480 l_prmtr_01_tab(l_tab_counter) := null;
1481 l_prmtr_02_tab(l_tab_counter) := null;
1482 l_prmtr_03_tab(l_tab_counter) := null;
1483 l_prmtr_04_tab(l_tab_counter) := null;
1484 l_prmtr_05_tab(l_tab_counter) := null;
1485 l_prmtr_06_tab(l_tab_counter) := null;
1486 l_prmtr_07_tab(l_tab_counter) := null;
1487 l_old_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1488 l_new_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1489 l_old_val2(l_tab_counter) := to_char(p_old_rec.date_of_birth, 'mm/dd/yyyy');
1490 l_new_val2(l_tab_counter) := to_char(p_new_rec.date_of_birth, 'mm/dd/yyyy');
1491 l_old_val3(l_tab_counter) := null;
1492 l_old_val4(l_tab_counter) := null;
1493 l_old_val5(l_tab_counter) := null;
1494 l_old_val6(l_tab_counter) := null;
1495 l_new_val3(l_tab_counter) := null;
1496 l_new_val4(l_tab_counter) := null;
1497 l_new_val5(l_tab_counter) := null;
1498 l_new_val6(l_tab_counter) := null;
1499 end if;
1500 if nvl(p_old_rec.date_of_death, to_date('01/01/0001', 'dd/mm/yyyy'))
1501 <> nvl(p_new_rec.date_of_death, to_date('01/01/0001', 'dd/mm/yyyy')) then
1502 l_tab_counter := l_tab_counter + 1;
1503 l_cont_chg_evt_tab(l_tab_counter) := 'CCDD';
1504 l_prmtr_01_tab(l_tab_counter) := null;
1505 l_prmtr_02_tab(l_tab_counter) := null;
1506 l_prmtr_03_tab(l_tab_counter) := null;
1507 l_prmtr_04_tab(l_tab_counter) := null;
1508 l_prmtr_05_tab(l_tab_counter) := null;
1509 l_prmtr_06_tab(l_tab_counter) := null;
1510 l_prmtr_07_tab(l_tab_counter) := null;
1511 l_old_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1512 l_new_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1513 l_old_val2(l_tab_counter) := to_char(p_old_rec.date_of_death, 'mm/dd/yyyy');
1514 l_new_val2(l_tab_counter) := to_char(p_new_rec.date_of_death, 'mm/dd/yyyy');
1515 l_old_val3(l_tab_counter) := null;
1516 l_old_val4(l_tab_counter) := null;
1517 l_old_val5(l_tab_counter) := null;
1518 l_old_val6(l_tab_counter) := null;
1519 l_new_val3(l_tab_counter) := null;
1520 l_new_val4(l_tab_counter) := null;
1521 l_new_val5(l_tab_counter) := null;
1522 l_new_val6(l_tab_counter) := null;
1523 end if;
1524 if nvl(p_old_rec.national_identifier, '000-00-0000')
1525 <> nvl(p_new_rec.national_identifier, '000-00-0000') then
1526 l_tab_counter := l_tab_counter + 1;
1527 l_cont_chg_evt_tab(l_tab_counter) := 'CCSS';
1528 l_prmtr_01_tab(l_tab_counter) := null;
1529 l_prmtr_02_tab(l_tab_counter) := null;
1530 l_prmtr_03_tab(l_tab_counter) := null;
1531 l_prmtr_04_tab(l_tab_counter) := null;
1532 l_prmtr_05_tab(l_tab_counter) := null;
1533 l_prmtr_06_tab(l_tab_counter) := null;
1534 l_prmtr_07_tab(l_tab_counter) := null;
1535 l_old_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1536 l_new_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1537 l_old_val2(l_tab_counter) := p_old_rec.national_identifier;
1538 l_new_val2(l_tab_counter) := p_new_rec.national_identifier;
1539 l_old_val3(l_tab_counter) := null;
1540 l_old_val4(l_tab_counter) := null;
1541 l_old_val5(l_tab_counter) := null;
1542 l_old_val6(l_tab_counter) := null;
1543 l_new_val3(l_tab_counter) := null;
1544 l_new_val4(l_tab_counter) := null;
1545 l_new_val5(l_tab_counter) := null;
1546 l_new_val6(l_tab_counter) := null;
1547 end if;
1548 if nvl(p_old_rec.sex, '$')
1549 <> nvl(p_new_rec.sex, '$') then
1550 -- read gender from lookup table
1551 open c_lookup_value('SEX', p_old_rec.sex);
1552 fetch c_lookup_value into l_old_sex;
1553 close c_lookup_value;
1554 open c_lookup_value('SEX', p_new_rec.sex);
1555 fetch c_lookup_value into l_new_sex;
1556 close c_lookup_value;
1557
1558 l_tab_counter := l_tab_counter + 1;
1559 l_cont_chg_evt_tab(l_tab_counter) := 'CCGE';
1560 l_prmtr_01_tab(l_tab_counter) := null;
1561 l_prmtr_02_tab(l_tab_counter) := null;
1562 l_prmtr_03_tab(l_tab_counter) := null;
1563 l_prmtr_04_tab(l_tab_counter) := null;
1564 l_prmtr_05_tab(l_tab_counter) := null;
1565 l_prmtr_06_tab(l_tab_counter) := null;
1566 l_prmtr_07_tab(l_tab_counter) := null;
1567 l_old_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1568 l_new_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1569 l_old_val2(l_tab_counter) := l_old_sex;
1570 l_new_val2(l_tab_counter) := l_new_sex;
1571 l_old_val3(l_tab_counter) := null;
1572 l_old_val4(l_tab_counter) := null;
1573 l_old_val5(l_tab_counter) := null;
1574 l_old_val6(l_tab_counter) := null;
1575 l_new_val3(l_tab_counter) := null;
1576 l_new_val4(l_tab_counter) := null;
1577 l_new_val5(l_tab_counter) := null;
1578 l_new_val6(l_tab_counter) := null;
1579 end if;
1580 for l_count in l_ini_tab_counter+1..l_ini_tab_counter+l_cont_chg_evt_tab.count loop
1581 if change_event_is_enabled(l_cont_chg_evt_tab(l_count),p_new_rec.effective_start_date)
1582 then
1583
1584 ben_ext_chg_evt_api.create_ext_chg_evt
1585 (p_validate => FALSE
1586 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
1587 ,p_chg_evt_cd => l_cont_chg_evt_tab(l_count)
1588 ,p_chg_eff_dt => p_new_rec.effective_start_date
1589 ,p_prmtr_01 => to_char(l_contact)
1590 ,p_prmtr_02 => l_prmtr_02_tab(l_count)
1591 ,p_prmtr_03 => l_prmtr_03_tab(l_count)
1592 ,p_prmtr_04 => l_prmtr_04_tab(l_count)
1593 ,p_prmtr_05 => l_prmtr_05_tab(l_count)
1594 ,p_prmtr_06 => to_char(p_new_rec.person_id)
1595 ,p_prmtr_07 => l_prmtr_07_tab(l_count)
1596 ,p_prmtr_10 => p_new_rec.update_mode
1597 ,p_person_id => l_relationship
1598 ,p_business_group_id => p_new_rec.business_group_id
1599 ,p_object_version_number => l_object_version_number
1600 ,p_effective_date => p_new_rec.effective_start_date
1601 ,p_old_val1 => l_old_val1(l_count)
1602 ,p_old_val2 => l_old_val2(l_count)
1603 ,p_old_val3 => l_old_val3(l_count)
1604 ,p_old_val4 => l_old_val4(l_count)
1605 ,p_old_val5 => l_old_val5(l_count)
1606 ,p_old_val6 => l_old_val6(l_count)
1607 ,p_new_val1 => l_new_val1(l_count)
1608 ,p_new_val2 => l_new_val2(l_count)
1609 ,p_new_val3 => l_new_val3(l_count)
1610 ,p_new_val4 => l_new_val4(l_count)
1611 ,p_new_val5 => l_new_val5(l_count)
1612 ,p_new_val6 => l_new_val6(l_count)
1613 );
1614 end if;
1615 end loop;
1616 end if;
1617 ------
1618
1619 end if;
1620
1621 -- the counter logic changed here, cause the person id may change for every row
1622
1623 open c_con_relationship(p_new_rec.person_id , p_new_rec.effective_start_date );
1624 Loop
1625 fetch c_con_relationship into l_contact,l_relationship , l_person_type ;
1626 Exit When c_con_relationship%notfound ;
1627 hr_utility.set_location ( 'Contact person ' || l_relationship , 11 ) ;
1628 hr_utility.set_location ( 'relation type ' || l_person_type , 11 ) ;
1629 l_ini_tab_counter := 1 ;
1630 l_tab_counter := 0 ;
1631 l_cont_chg_evt_tab.delete ;
1632
1633 if nvl(p_old_rec.full_name, '$$$$$&&&')
1634 <> nvl(p_new_rec.full_name, '$$$$$&&&') then
1635 l_tab_counter := l_tab_counter + 1;
1636 l_cont_chg_evt_tab(l_tab_counter) := 'CCNFN';
1637 l_prmtr_01_tab(l_tab_counter) := l_contact;
1638 l_prmtr_02_tab(l_tab_counter) := l_person_type;
1639 l_prmtr_03_tab(l_tab_counter) := null;
1640 l_prmtr_04_tab(l_tab_counter) := null;
1641 l_prmtr_05_tab(l_tab_counter) := null;
1642 l_prmtr_06_tab(l_tab_counter) := null;
1643 l_prmtr_07_tab(l_tab_counter) := null;
1644 l_old_val1(l_tab_counter) := substr(p_old_rec.full_name,1,240);
1645 l_old_val2(l_tab_counter) := p_old_rec.title;
1646 l_old_val3(l_tab_counter) := p_old_rec.first_name;
1647 l_old_val4(l_tab_counter) := p_old_rec.middle_names;
1648 l_old_val5(l_tab_counter) := p_old_rec.last_name;
1649 l_old_val6(l_tab_counter) := p_old_rec.suffix;
1650 l_new_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1651 l_new_val2(l_tab_counter) := p_new_rec.title;
1652 l_new_val3(l_tab_counter) := p_new_rec.first_name;
1653 l_new_val4(l_tab_counter) := p_new_rec.middle_names;
1654 l_new_val5(l_tab_counter) := p_new_rec.last_name;
1655 l_new_val6(l_tab_counter) := p_new_rec.suffix;
1656 end if;
1657 if nvl(p_old_rec.date_of_birth, to_date('01/01/0001', 'dd/mm/yyyy'))
1658 <> nvl(p_new_rec.date_of_birth, to_date('01/01/0001', 'dd/mm/yyyy')) then
1659 l_tab_counter := l_tab_counter + 1;
1660 l_cont_chg_evt_tab(l_tab_counter) := 'CCNDB';
1661 l_prmtr_01_tab(l_tab_counter) := l_contact;
1662 l_prmtr_02_tab(l_tab_counter) := l_person_type;
1663 l_prmtr_03_tab(l_tab_counter) := null;
1664 l_prmtr_04_tab(l_tab_counter) := null;
1665 l_prmtr_05_tab(l_tab_counter) := null;
1666 l_prmtr_06_tab(l_tab_counter) := null;
1667 l_prmtr_07_tab(l_tab_counter) := null;
1668 l_old_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1669 l_new_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1670 l_old_val2(l_tab_counter) := to_char(p_old_rec.date_of_birth, 'mm/dd/yyyy');
1671 l_new_val2(l_tab_counter) := to_char(p_new_rec.date_of_birth, 'mm/dd/yyyy');
1672 l_old_val3(l_tab_counter) := null;
1673 l_old_val4(l_tab_counter) := null;
1674 l_old_val5(l_tab_counter) := null;
1675 l_old_val6(l_tab_counter) := null;
1676 l_new_val3(l_tab_counter) := null;
1677 l_new_val4(l_tab_counter) := null;
1678 l_new_val5(l_tab_counter) := null;
1679 l_new_val6(l_tab_counter) := null;
1680 end if;
1681 if nvl(p_old_rec.date_of_death, to_date('01/01/0001', 'dd/mm/yyyy'))
1682 <> nvl(p_new_rec.date_of_death, to_date('01/01/0001', 'dd/mm/yyyy')) then
1683 l_tab_counter := l_tab_counter + 1;
1684 l_cont_chg_evt_tab(l_tab_counter) := 'CCNDD';
1685 l_prmtr_01_tab(l_tab_counter) := l_contact;
1686 l_prmtr_02_tab(l_tab_counter) := l_person_type;
1687 l_prmtr_03_tab(l_tab_counter) := null;
1688 l_prmtr_04_tab(l_tab_counter) := null;
1689 l_prmtr_05_tab(l_tab_counter) := null;
1690 l_prmtr_06_tab(l_tab_counter) := null;
1691 l_prmtr_07_tab(l_tab_counter) := null;
1692 l_old_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1693 l_new_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1694 l_old_val2(l_tab_counter) := to_char(p_old_rec.date_of_death, 'mm/dd/yyyy');
1695 l_new_val2(l_tab_counter) := to_char(p_new_rec.date_of_death, 'mm/dd/yyyy');
1696 l_old_val3(l_tab_counter) := null;
1697 l_old_val4(l_tab_counter) := null;
1698 l_old_val5(l_tab_counter) := null;
1699 l_old_val6(l_tab_counter) := null;
1700 l_new_val3(l_tab_counter) := null;
1701 l_new_val4(l_tab_counter) := null;
1702 l_new_val5(l_tab_counter) := null;
1703 l_new_val6(l_tab_counter) := null;
1704 end if;
1705 if nvl(p_old_rec.national_identifier, '000-00-0000')
1706 <> nvl(p_new_rec.national_identifier, '000-00-0000') then
1707 l_tab_counter := l_tab_counter + 1;
1708 l_cont_chg_evt_tab(l_tab_counter) := 'CCNSS';
1709 l_prmtr_01_tab(l_tab_counter) := l_contact;
1710 l_prmtr_02_tab(l_tab_counter) := l_person_type;
1711 l_prmtr_03_tab(l_tab_counter) := null;
1712 l_prmtr_04_tab(l_tab_counter) := null;
1713 l_prmtr_05_tab(l_tab_counter) := null;
1714 l_prmtr_06_tab(l_tab_counter) := null;
1715 l_prmtr_07_tab(l_tab_counter) := null;
1716 l_old_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1717 l_new_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1718 l_old_val2(l_tab_counter) := p_old_rec.national_identifier;
1719 l_new_val2(l_tab_counter) := p_new_rec.national_identifier;
1720 l_old_val3(l_tab_counter) := null;
1721 l_old_val4(l_tab_counter) := null;
1722 l_old_val5(l_tab_counter) := null;
1723 l_old_val6(l_tab_counter) := null;
1724 l_new_val3(l_tab_counter) := null;
1725 l_new_val4(l_tab_counter) := null;
1726 l_new_val5(l_tab_counter) := null;
1727 l_new_val6(l_tab_counter) := null;
1728 end if;
1729 if nvl(p_old_rec.sex, '$')
1730 <> nvl(p_new_rec.sex, '$') then
1731 -- read gender from lookup table
1732 open c_lookup_value('SEX', p_old_rec.sex);
1733 fetch c_lookup_value into l_old_sex;
1734 close c_lookup_value;
1735 open c_lookup_value('SEX', p_new_rec.sex);
1736 fetch c_lookup_value into l_new_sex;
1737 close c_lookup_value;
1738
1739 l_tab_counter := l_tab_counter + 1;
1740 l_cont_chg_evt_tab(l_tab_counter) := 'CCNGE';
1741 l_prmtr_01_tab(l_tab_counter) := l_contact;
1742 l_prmtr_02_tab(l_tab_counter) := l_person_type;
1743 l_prmtr_03_tab(l_tab_counter) := null;
1744 l_prmtr_04_tab(l_tab_counter) := null;
1745 l_prmtr_05_tab(l_tab_counter) := null;
1746 l_prmtr_06_tab(l_tab_counter) := null;
1747 l_prmtr_07_tab(l_tab_counter) := null;
1748 l_old_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1749 l_new_val1(l_tab_counter) := substr(p_new_rec.full_name,1,240);
1750 l_old_val2(l_tab_counter) := l_old_sex;
1751 l_new_val2(l_tab_counter) := l_new_sex;
1752 l_old_val3(l_tab_counter) := null;
1753 l_old_val4(l_tab_counter) := null;
1754 l_old_val5(l_tab_counter) := null;
1755 l_old_val6(l_tab_counter) := null;
1756 l_new_val3(l_tab_counter) := null;
1757 l_new_val4(l_tab_counter) := null;
1758 l_new_val5(l_tab_counter) := null;
1759 l_new_val6(l_tab_counter) := null;
1760 end if;
1761 -- insert the row for every relation , the person id may change for every row
1762 for l_count in 1 .. l_tab_counter loop
1763
1764 hr_utility.set_location ( ' change event ' || l_cont_chg_evt_tab(l_count) , 11 ) ;
1765 if change_event_is_enabled(l_cont_chg_evt_tab(l_count),p_new_rec.effective_start_date)
1766 then
1767
1768 ben_ext_chg_evt_api.create_ext_chg_evt
1769 (p_validate => FALSE
1770 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
1771 ,p_chg_evt_cd => l_cont_chg_evt_tab(l_count)
1772 ,p_chg_eff_dt => p_new_rec.effective_start_date
1773 ,p_prmtr_01 => l_prmtr_01_tab(l_count)
1774 ,p_prmtr_02 => l_prmtr_02_tab(l_count)
1775 ,p_prmtr_03 => l_prmtr_03_tab(l_count)
1776 ,p_prmtr_04 => l_prmtr_04_tab(l_count)
1777 ,p_prmtr_05 => l_prmtr_05_tab(l_count)
1778 ,p_prmtr_06 => to_char(p_new_rec.person_id)
1779 ,p_prmtr_07 => l_prmtr_07_tab(l_count)
1780 ,p_prmtr_10 => p_new_rec.update_mode
1781 ,p_person_id => l_relationship
1782 ,p_business_group_id => p_new_rec.business_group_id
1783 ,p_object_version_number => l_object_version_number
1784 ,p_effective_date => p_new_rec.effective_start_date
1785 ,p_old_val1 => l_old_val1(l_count)
1786 ,p_old_val2 => l_old_val2(l_count)
1787 ,p_old_val3 => l_old_val3(l_count)
1788 ,p_old_val4 => l_old_val4(l_count)
1789 ,p_old_val5 => l_old_val5(l_count)
1790 ,p_old_val6 => l_old_val6(l_count)
1791 ,p_new_val1 => l_new_val1(l_count)
1792 ,p_new_val2 => l_new_val2(l_count)
1793 ,p_new_val3 => l_new_val3(l_count)
1794 ,p_new_val4 => l_new_val4(l_count)
1795 ,p_new_val5 => l_new_val5(l_count)
1796 ,p_new_val6 => l_new_val6(l_count)
1797 );
1798 end if;
1799 end loop;
1800
1801 End Loop ;
1802 close c_con_relationship ;
1803 ----
1804 end if;
1805 --
1806 hr_utility.set_location('Exiting:'|| l_proc, 99);
1807 --
1808 end log_per_chg;
1809 --
1810 procedure log_cont_chg
1811 (
1812 p_old_rec in g_cont_rec_type
1813 ,p_new_rec in g_cont_rec_type
1814 ) is
1815 --
1816 l_proc varchar2(100) := 'ben_ext_chlg.log_cont_chg';
1817 l_tab_counter binary_integer := 0;
1818 l_old_contact_type varchar2(100) ;
1819 l_new_contact_type varchar2(100) ;
1820 l_person_type per_person_types.system_person_type%type;
1821 l_full_name per_all_people_f.full_name%type ;
1822 l_chg_evt_tab g_char_tab_type;
1823 l_chg_eff_tab g_date_tab_type;
1824 l_prmtr_01_tab g_char_tab_type;
1825 l_prmtr_02_tab g_char_tab_type;
1826 l_prmtr_03_tab g_char_tab_type;
1827 l_prmtr_04_tab g_char_tab_type;
1828 l_prmtr_05_tab g_char_tab_type;
1829 l_prmtr_06_tab g_char_tab_type;
1830 l_prmtr_07_tab g_char_tab_type;
1831 l_old_val1 g_old_val;
1832 l_old_val2 g_old_val;
1833 l_old_val3 g_old_val;
1834 l_old_val4 g_old_val;
1835 l_old_val5 g_old_val;
1836 l_old_val6 g_old_val;
1837 l_new_val1 g_new_val;
1838 l_new_val2 g_new_val;
1839 l_new_val3 g_new_val;
1840 l_new_val4 g_new_val;
1841 l_new_val5 g_new_val;
1842 l_new_val6 g_new_val;
1843 l_chg_eff_dt date;
1844 l_count number;
1845 l_ext_chg_evt_log_id number;
1846 l_object_version_number number;
1847 --
1848 cursor c_person_type(p_person_id number) is
1849 select ppt.system_person_type,ppf.full_name
1850 from per_person_types ppt,per_all_people_f ppf
1851 where ppf.person_type_id = ppt.person_type_id
1852 and ppf.person_id = p_person_id;
1853 --
1854 cursor c_lookup_value
1855 (p_lookup_code hr_lookups.lookup_code%type
1856 )
1857 is
1858 select meaning
1859 from hr_lookups hl
1860 where hl.lookup_type = 'CONTACT'
1861 and hl.lookup_code = p_lookup_code;
1862 begin
1863 --
1864 hr_utility.set_location('Entering:'|| l_proc, 10);
1865 --
1866 open c_person_type(p_new_rec.contact_person_id);
1867 fetch c_person_type into l_person_type,l_full_name;
1868 if c_person_type%notfound then
1869 close c_person_type;
1870 else
1871
1872 close c_person_type;
1873 open c_lookup_value( p_old_rec.contact_type);
1874 fetch c_lookup_value into l_old_contact_type;
1875 close c_lookup_value;
1876 hr_utility.set_location ( 'old contact ' || l_old_contact_type,99) ;
1877 open c_lookup_value( p_new_rec.contact_type);
1878 fetch c_lookup_value into l_new_contact_type;
1879 close c_lookup_value;
1880 hr_utility.set_location ( 'new contact ' || l_new_contact_type,99) ;
1881
1882 if l_person_type = 'OTHER' then
1883 l_tab_counter := l_tab_counter + 1;
1884
1885 hr_utility.set_location ( 'change evnt ' ,99) ;
1886 --
1887 -- Handle web case where date_start is null
1888 --
1889 l_chg_evt_tab(l_tab_counter) := 'CCRE';
1890 l_chg_eff_tab(l_tab_counter) := nvl(p_new_rec.date_start,sysdate);
1891 l_prmtr_01_tab(l_tab_counter) := null;
1892 l_prmtr_02_tab(l_tab_counter) := null;
1893 l_prmtr_03_tab(l_tab_counter) := null;
1894 l_prmtr_04_tab(l_tab_counter) := null;
1895 l_prmtr_05_tab(l_tab_counter) := null;
1896 l_prmtr_06_tab(l_tab_counter) := null;
1897 l_prmtr_07_tab(l_tab_counter) := null;
1898 l_old_val1(l_tab_counter) := substr(l_full_name,1,240);
1899 l_new_val1(l_tab_counter) := substr(l_full_name,1,240);
1900 l_old_val2(l_tab_counter) := l_old_contact_type;
1901 l_new_val2(l_tab_counter) := l_new_contact_type;
1902 l_old_val3(l_tab_counter) := null;
1903 l_old_val4(l_tab_counter) := null;
1904 l_old_val5(l_tab_counter) := null;
1905 l_old_val6(l_tab_counter) := null;
1906 l_new_val3(l_tab_counter) := null;
1907 l_new_val4(l_tab_counter) := null;
1908 l_new_val5(l_tab_counter) := null;
1909 l_new_val6(l_tab_counter) := null;
1910 end if ;
1911 --- for every person contact changes
1912 l_tab_counter := l_tab_counter + 1;
1913
1914 hr_utility.set_location ( 'change evnt ' ,99) ;
1915 --
1916 -- Handle web case where date_start is null
1917 --
1918 l_chg_evt_tab(l_tab_counter) := 'CCNRE';
1919 l_chg_eff_tab(l_tab_counter) := nvl(p_new_rec.date_start,sysdate);
1920 l_prmtr_01_tab(l_tab_counter) := null;
1921 l_prmtr_02_tab(l_tab_counter) := null;
1922 l_prmtr_03_tab(l_tab_counter) := null;
1923 l_prmtr_04_tab(l_tab_counter) := null;
1924 l_prmtr_05_tab(l_tab_counter) := null;
1925 l_prmtr_06_tab(l_tab_counter) := null;
1926 l_prmtr_07_tab(l_tab_counter) := null;
1927 l_old_val1(l_tab_counter) := substr(l_full_name,1,240);
1928 l_new_val1(l_tab_counter) := substr(l_full_name,1,240);
1929 l_old_val2(l_tab_counter) := l_old_contact_type;
1930 l_new_val2(l_tab_counter) := l_new_contact_type;
1931 l_old_val3(l_tab_counter) := null;
1932 l_old_val4(l_tab_counter) := null;
1933 l_old_val5(l_tab_counter) := null;
1934 l_old_val6(l_tab_counter) := null;
1935 l_new_val3(l_tab_counter) := null;
1936 l_new_val4(l_tab_counter) := null;
1937 l_new_val5(l_tab_counter) := null;
1938 l_new_val6(l_tab_counter) := null;
1939
1940 end if;
1941 for l_count in 1..l_chg_evt_tab.count loop
1942 if change_event_is_enabled(l_chg_evt_tab(l_count),trunc(sysdate)) then
1943 hr_utility.set_location ( 'calling api ' ,99) ;
1944 ben_ext_chg_evt_api.create_ext_chg_evt
1945 (p_validate => FALSE
1946 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
1947 ,p_chg_evt_cd => l_chg_evt_tab(l_count)
1948 ,p_chg_eff_dt => l_chg_eff_tab(l_count)
1949 ,p_prmtr_01 => l_prmtr_01_tab(l_count)
1950 ,p_prmtr_02 => l_prmtr_02_tab(l_count)
1951 ,p_prmtr_03 => l_prmtr_03_tab(l_count)
1952 ,p_prmtr_04 => l_prmtr_04_tab(l_count)
1953 ,p_prmtr_05 => l_prmtr_05_tab(l_count)
1954 ,p_prmtr_06 => l_prmtr_06_tab(l_count)
1955 ,p_prmtr_07 => l_prmtr_07_tab(l_count)
1956 ,p_person_id => p_new_rec.person_id
1957 ,p_business_group_id => p_new_rec.business_group_id
1958 ,p_object_version_number => l_object_version_number
1959 ,p_effective_date => trunc(sysdate)
1960 ,p_old_val1 => l_old_val1(l_count)
1961 ,p_old_val2 => l_old_val2(l_count)
1962 ,p_old_val3 => l_old_val3(l_count)
1963 ,p_old_val4 => l_old_val4(l_count)
1964 ,p_old_val5 => l_old_val5(l_count)
1965 ,p_old_val6 => l_old_val6(l_count)
1966 ,p_new_val1 => l_new_val1(l_count)
1967 ,p_new_val2 => l_new_val2(l_count)
1968 ,p_new_val3 => l_new_val3(l_count)
1969 ,p_new_val4 => l_new_val4(l_count)
1970 ,p_new_val5 => l_new_val5(l_count)
1971 ,p_new_val6 => l_new_val6(l_count)
1972 );
1973 end if;
1974 end loop;
1975 --
1976 hr_utility.set_location('Exiting:'|| l_proc, 99);
1977 --
1978 end log_cont_chg;
1979 --
1980 procedure log_add_chg
1981 (p_event in varchar2
1982 ,p_old_rec in g_add_rec_type
1983 ,p_new_rec in g_add_rec_type
1984 ) is
1985 --
1986 l_proc varchar2(100) := 'ben_ext_chlg.log_add_chg';
1987 --
1988 l_chg_evt_tab g_char_tab_type;
1989 l_chg_eff_tab g_date_tab_type;
1990 l_prmtr_01_tab g_char_tab_type;
1991 l_prmtr_02_tab g_char_tab_type;
1992 l_prmtr_03_tab g_char_tab_type;
1993 l_prmtr_04_tab g_char_tab_type;
1994 l_prmtr_05_tab g_char_tab_type;
1995 l_prmtr_06_tab g_char_tab_type;
1996 l_prmtr_07_tab g_char_tab_type;
1997 l_old_val1 g_old_val;
1998 l_old_val2 g_old_val;
1999 l_old_val3 g_old_val;
2000 l_old_val4 g_old_val;
2001 l_old_val5 g_old_val;
2002 l_old_val6 g_old_val;
2003 l_new_val1 g_new_val;
2004 l_new_val2 g_new_val;
2005 l_new_val3 g_new_val;
2006 l_new_val4 g_new_val;
2007 l_new_val5 g_new_val;
2008 l_new_val6 g_new_val;
2009 l_tab_counter binary_integer := 0;
2010 l_ini_tab_counter binary_integer ;
2011 l_chg_eff_dt date;
2012 l_chg_occured boolean := FALSE;
2013 l_chg_mail_add boolean := FALSE;
2014 l_count number;
2015 l_ext_chg_evt_log_id number;
2016 l_object_version_number number;
2017 l_person_id number;
2018 l_business_group_id number;
2019 l_relationship per_all_people_f.person_id%type;
2020 l_name per_all_people_f.full_name%type;
2021 l_contact per_contact_relationships.contact_relationship_id%type;
2022 --
2023 cursor c_relationship(p_person_id number) is
2024 SELECT pcr.contact_relationship_id,pcr.person_id,ppf.full_name
2025 FROM per_contact_relationships pcr,
2026 per_all_people_f ppf,
2027 per_person_types ppt,
2028 hr_lookups hl
2029 WHERE pcr.contact_person_id = p_person_id
2030 AND ppf.person_id = p_person_id
2031 AND ppf.person_type_id = ppt.person_type_id
2032 AND ppt.system_person_type = 'OTHER'
2033 AND pcr.contact_type = hl.lookup_code
2034 AND hl.lookup_type = 'CONTACT';
2035
2036 cursor c_con_relationship(p_person_id number,p_effective_date date) is
2037 SELECT pcr.contact_relationship_id,pcr.person_id,ppf.full_name
2038 FROM per_contact_relationships pcr,
2039 per_all_people_f ppf,
2040 hr_lookups hl
2041 WHERE pcr.contact_person_id = p_person_id
2042 AND ppf.person_id = p_person_id
2043 AND pcr.contact_type = hl.lookup_code
2044 AND hl.lookup_type = 'CONTACT'
2045 AND pcr.personal_flag = 'Y'
2046 and p_effective_date between pcr.date_start and nvl(pcr.date_end, p_effective_date)
2047
2048 ;
2049 --
2050 begin
2051 --
2052 hr_utility.set_location('Entering:'|| l_proc, 10);
2053 --
2054 if p_event = 'INSERT' then
2055 l_person_id := p_new_rec.person_id;
2056 l_business_group_id := p_new_rec.business_group_id;
2057 --
2058 if p_new_rec.primary_flag = 'Y' then
2059 -- if this is the first primary address then 'APA' (add primary address)
2060 -- if it is not the first primary address then 'COPR'
2061 --(change of primary address)
2062 if g_prev_upd_adr_person_id = p_new_rec.person_id and
2063 g_prev_upd_adr_primary_flag = p_new_rec.primary_flag and
2064 g_prev_upd_adr_to_date = (p_new_rec.date_from-1) then
2065
2066 l_chg_eff_dt := p_new_rec.date_from;
2067 l_tab_counter := l_tab_counter + 1;
2068 l_chg_evt_tab(l_tab_counter) := 'COPR';
2069 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2070 l_prmtr_01_tab(l_tab_counter) := p_new_rec.address_id;
2071 l_prmtr_02_tab(l_tab_counter) := g_prev_upd_adr_address_id;
2072 l_prmtr_03_tab(l_tab_counter) := null;
2073 l_prmtr_04_tab(l_tab_counter) := null;
2074 l_prmtr_05_tab(l_tab_counter) := null;
2075 l_prmtr_06_tab(l_tab_counter) := null;
2076 l_prmtr_07_tab(l_tab_counter) := null;
2077 l_old_val1(l_tab_counter) :=rtrim(substrb(g_prev_upd_adr_address_line1||' '||
2078 g_prev_upd_adr_address_line2||' '||
2079 g_prev_upd_adr_address_line3,1,600));
2080 l_old_val2(l_tab_counter) := g_prev_upd_adr_town_or_city;
2081 l_old_val3(l_tab_counter) := g_prev_upd_adr_region_2;
2082 l_old_val4(l_tab_counter) := g_prev_upd_adr_postal_code;
2083 l_old_val5(l_tab_counter) := g_prev_upd_adr_region_3;
2084 l_old_val6(l_tab_counter) := g_prev_upd_adr_region_1;
2085 l_new_val1(l_tab_counter) := rtrim(substrb(p_new_rec.address_line1||' '||
2086 p_new_rec.address_line2||' '||
2087 p_new_rec.address_line3,1,600));
2088 l_new_val2(l_tab_counter) := p_new_rec.town_or_city;
2089 l_new_val3(l_tab_counter) := p_new_rec.region_2;
2090 l_new_val4(l_tab_counter) := p_new_rec.postal_code;
2091 l_new_val5(l_tab_counter) := p_new_rec.region_3;
2092 l_new_val6(l_tab_counter) := p_new_rec.region_1;
2093 else
2094 l_chg_eff_dt := p_new_rec.date_from;
2095 l_tab_counter := l_tab_counter + 1;
2096 l_chg_evt_tab(l_tab_counter) := 'APA';
2097 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2098 l_prmtr_01_tab(l_tab_counter) := p_new_rec.address_id;
2099 l_prmtr_02_tab(l_tab_counter) := null;
2100 l_prmtr_03_tab(l_tab_counter) := null;
2101 l_prmtr_04_tab(l_tab_counter) := null;
2102 l_prmtr_05_tab(l_tab_counter) := null;
2103 l_prmtr_06_tab(l_tab_counter) := null;
2104 l_prmtr_07_tab(l_tab_counter) := null;
2105 l_old_val1(l_tab_counter) := null;
2106 l_old_val2(l_tab_counter) := null;
2107 l_old_val3(l_tab_counter) := null;
2108 l_old_val4(l_tab_counter) := null;
2109 l_old_val5(l_tab_counter) := null;
2110 l_old_val6(l_tab_counter) := null;
2111 l_new_val1(l_tab_counter) := rtrim(substrb( p_new_rec.address_line1||' '||
2112 p_new_rec.address_line2||' '||
2113 p_new_rec.address_line3 , 1,600));
2114 l_new_val2(l_tab_counter) := p_new_rec.town_or_city;
2115 l_new_val3(l_tab_counter) := p_new_rec.region_2;
2116 l_new_val4(l_tab_counter) := p_new_rec.postal_code;
2117 l_new_val5(l_tab_counter) := p_new_rec.region_3;
2118 l_new_val6(l_tab_counter) := p_new_rec.region_1;
2119 end if;
2120 --
2121 --record change event(update contact's primary address) for participant.
2122 --- create only for the person, his person type is contact
2123 open c_relationship(p_new_rec.person_id);
2124 fetch c_relationship into l_contact,l_relationship,l_name;
2125 if c_relationship%notfound then
2126 close c_relationship;
2127 elsif c_relationship%found then
2128 close c_relationship;
2129 if g_prev_upd_adr_person_id = p_new_rec.person_id and
2130 g_prev_upd_adr_primary_flag = p_new_rec.primary_flag and
2131 g_prev_upd_adr_to_date = (p_new_rec.date_from-1) then
2132 l_chg_eff_dt := p_new_rec.date_from;
2133 l_tab_counter := l_tab_counter + 1;
2134 l_chg_evt_tab(l_tab_counter) := 'CCPA';
2135 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2136 l_prmtr_01_tab(l_tab_counter) := to_char(l_contact);
2137 l_prmtr_02_tab(l_tab_counter) := p_new_rec.address_id;
2138 l_prmtr_03_tab(l_tab_counter) := g_prev_upd_adr_address_id;
2139 l_prmtr_04_tab(l_tab_counter) := null;
2140 l_prmtr_05_tab(l_tab_counter) := null;
2141 l_prmtr_06_tab(l_tab_counter) := null;
2142 l_prmtr_07_tab(l_tab_counter) := null;
2143 l_old_val1(l_tab_counter) := rtrim(substrb(l_name,1,240));
2144 l_new_val1(l_tab_counter) := rtrim(substrb(l_name,1,240));
2145 l_old_val2(l_tab_counter) := rtrim(substrb( g_prev_upd_adr_address_line1||' '||
2146 g_prev_upd_adr_address_line2||' '||
2147 g_prev_upd_adr_address_line3,1,600));
2148 l_old_val3(l_tab_counter) := g_prev_upd_adr_town_or_city;
2149 l_old_val4(l_tab_counter) := g_prev_upd_adr_region_2;
2150 l_old_val5(l_tab_counter) := g_prev_upd_adr_postal_code;
2151 l_old_val6(l_tab_counter) := g_prev_upd_adr_region_3;
2152 l_new_val2(l_tab_counter) := rtrim(substrb( p_new_rec.address_line1||' '||
2153 p_new_rec.address_line2||' '||
2154 p_new_rec.address_line3,1,600));
2155 l_new_val3(l_tab_counter) := p_new_rec.town_or_city;
2156 l_new_val4(l_tab_counter) := p_new_rec.region_2;
2157 l_new_val5(l_tab_counter) := p_new_rec.postal_code;
2158 l_new_val6(l_tab_counter) := p_new_rec.region_3;
2159 end if;
2160 end if;
2161
2162 --- create log for all the person from relationship
2163 open c_con_relationship(p_new_rec.person_id,l_chg_eff_dt);
2164 Loop
2165 fetch c_con_relationship into l_contact,l_relationship,l_name;
2166 Exit when c_con_relationship%notfound ;
2167 if g_prev_upd_adr_person_id = p_new_rec.person_id and
2168 g_prev_upd_adr_primary_flag = p_new_rec.primary_flag and
2169 g_prev_upd_adr_to_date = (p_new_rec.date_from-1) then
2170 l_chg_eff_dt := p_new_rec.date_from;
2171 l_tab_counter := l_tab_counter + 1;
2172 l_chg_evt_tab(l_tab_counter) := 'CCNPA';
2173 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2174 l_prmtr_01_tab(l_tab_counter) := to_char(l_contact);
2175 l_prmtr_02_tab(l_tab_counter) := p_new_rec.address_id;
2176 l_prmtr_03_tab(l_tab_counter) := g_prev_upd_adr_address_id;
2177 l_prmtr_04_tab(l_tab_counter) := null;
2178 l_prmtr_05_tab(l_tab_counter) := null;
2179 l_prmtr_06_tab(l_tab_counter) := null;
2180 l_prmtr_07_tab(l_tab_counter) := l_relationship;
2181 l_old_val1(l_tab_counter) := rtrim(substrb(l_name,1,240));
2182 l_new_val1(l_tab_counter) := rtrim(substrb(l_name,1,240));
2183 l_old_val2(l_tab_counter) := rtrim(substrb( g_prev_upd_adr_address_line1||' '||
2184 g_prev_upd_adr_address_line2||' '||
2185 g_prev_upd_adr_address_line3,1,600));
2186 l_old_val3(l_tab_counter) := g_prev_upd_adr_town_or_city;
2187 l_old_val4(l_tab_counter) := g_prev_upd_adr_region_2;
2188 l_old_val5(l_tab_counter) := g_prev_upd_adr_postal_code;
2189 l_old_val6(l_tab_counter) := g_prev_upd_adr_region_3;
2190 l_new_val2(l_tab_counter) := rtrim(substrb( p_new_rec.address_line1||' '||
2191 p_new_rec.address_line2||' '||
2192 p_new_rec.address_line3,1,600));
2193 l_new_val3(l_tab_counter) := p_new_rec.town_or_city;
2194 l_new_val4(l_tab_counter) := p_new_rec.region_2;
2195 l_new_val5(l_tab_counter) := p_new_rec.postal_code;
2196 l_new_val6(l_tab_counter) := p_new_rec.region_3;
2197 end if ;
2198 --- change of mailing address
2199 if (p_new_rec.address_type <> nvl(p_old_rec.address_type,'$$')
2200 and p_new_rec.address_type = 'M' ) OR
2201 (p_old_rec.address_type = 'M' and p_new_rec.date_to is null
2202 and p_old_rec.date_to is not null ) then
2203
2204 l_chg_eff_dt := p_new_rec.date_from;
2205 l_tab_counter := l_tab_counter + 1;
2206 l_chg_evt_tab(l_tab_counter) := 'CCNMA';
2207 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2208 l_prmtr_01_tab(l_tab_counter) := to_char(l_contact);
2209 l_prmtr_02_tab(l_tab_counter) := p_new_rec.address_id;
2210 l_prmtr_03_tab(l_tab_counter) := null;
2211 l_prmtr_04_tab(l_tab_counter) := null;
2212 l_prmtr_05_tab(l_tab_counter) := null;
2213 l_prmtr_06_tab(l_tab_counter) := null;
2214 l_prmtr_07_tab(l_tab_counter) := l_relationship;
2215 l_old_val1(l_tab_counter) := substr(l_name,1,240);
2216 l_new_val1(l_tab_counter) := substr(l_name,1,240);
2217 l_old_val2(l_tab_counter) := rtrim(substrb( p_old_rec.address_line1||' '||
2218 p_old_rec.address_line2||' '||
2219 p_old_rec.address_line3,1,600));
2220 l_old_val3(l_tab_counter) := p_old_rec.town_or_city;
2221 l_old_val4(l_tab_counter) := p_old_rec.region_2;
2222 l_old_val5(l_tab_counter) := p_old_rec.postal_code;
2223 l_old_val6(l_tab_counter) := p_old_rec.region_3;
2224 l_new_val2(l_tab_counter) := rtrim(substrb( p_new_rec.address_line1||' '||
2225 p_new_rec.address_line2||' '||
2226 p_new_rec.address_line3,1,600));
2227 l_new_val3(l_tab_counter) := p_new_rec.town_or_city;
2228 l_new_val4(l_tab_counter) := p_new_rec.region_2;
2229 l_new_val5(l_tab_counter) := p_new_rec.postal_code;
2230 l_new_val6(l_tab_counter) := p_new_rec.region_3;
2231
2232 end if ;
2233
2234 End Loop ;
2235 close c_con_relationship;
2236
2237
2238 --Bug 4699556 removed the elseif for AMA and added the below statement
2239 -- so that if both APA and AMA are triggered at the same time both get logged.
2240 end if;
2241 --End Bug 4699556
2242 -- record change events for creation of mailing address
2243
2244 if p_new_rec.address_type = 'M' then
2245 l_chg_eff_dt := p_new_rec.date_from;
2246 l_tab_counter := l_tab_counter + 1;
2247 l_chg_evt_tab(l_tab_counter) := 'AMA';
2248 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2249 l_prmtr_01_tab(l_tab_counter) := p_new_rec.address_id;
2250 l_prmtr_02_tab(l_tab_counter) := null;
2251 l_prmtr_03_tab(l_tab_counter) := null;
2252 l_prmtr_04_tab(l_tab_counter) := null;
2253 l_prmtr_05_tab(l_tab_counter) := null;
2254 l_prmtr_06_tab(l_tab_counter) := null;
2255 l_prmtr_07_tab(l_tab_counter) := null;
2256 l_old_val1(l_tab_counter) := null;
2257 l_old_val2(l_tab_counter) := null;
2258 l_old_val3(l_tab_counter) := null;
2259 l_old_val4(l_tab_counter) := null;
2260 l_old_val5(l_tab_counter) := null;
2261 l_old_val6(l_tab_counter) := null;
2262 l_new_val1(l_tab_counter) := rtrim(substrb( p_new_rec.address_line1||' '||
2263 p_new_rec.address_line2||' '||
2264 p_new_rec.address_line3,1,600));
2265 l_new_val2(l_tab_counter) := p_new_rec.town_or_city;
2266 l_new_val3(l_tab_counter) := p_new_rec.region_2;
2267 l_new_val4(l_tab_counter) := p_new_rec.postal_code;
2268 l_new_val5(l_tab_counter) := p_new_rec.region_3;
2269 l_new_val6(l_tab_counter) := p_new_rec.region_1;
2270 --record change event(update contact's mailing address) for participant.
2271 open c_relationship(p_new_rec.person_id);
2272 fetch c_relationship into l_contact,l_relationship,l_name;
2273 if c_relationship%notfound then
2274 close c_relationship;
2275 elsif c_relationship%found then
2276 close c_relationship;
2277 l_chg_eff_dt := p_new_rec.date_from;
2278 l_tab_counter := l_tab_counter + 1;
2279 l_chg_evt_tab(l_tab_counter) := 'CCMA';
2280 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2281 l_prmtr_01_tab(l_tab_counter) := to_char(l_contact);
2282 l_prmtr_02_tab(l_tab_counter) := p_new_rec.address_id;
2283 l_prmtr_03_tab(l_tab_counter) := null;
2284 l_prmtr_04_tab(l_tab_counter) := null;
2285 l_prmtr_05_tab(l_tab_counter) := null;
2286 l_prmtr_06_tab(l_tab_counter) := null;
2287 l_prmtr_07_tab(l_tab_counter) := l_relationship;
2288 l_old_val1(l_tab_counter) := substr(l_name,1,240);
2289 l_new_val1(l_tab_counter) := substr(l_name,1,240);
2290 l_old_val2(l_tab_counter) := null;
2291 l_old_val3(l_tab_counter) := null;
2292 l_old_val4(l_tab_counter) := null;
2293 l_old_val5(l_tab_counter) := null;
2294 l_old_val6(l_tab_counter) := null;
2295 l_new_val2(l_tab_counter) := rtrim(substrb( p_new_rec.address_line1||' '||
2296 p_new_rec.address_line2||' '||
2297 p_new_rec.address_line3,1,600));
2298 l_new_val3(l_tab_counter) := p_new_rec.town_or_city;
2299 l_new_val4(l_tab_counter) := p_new_rec.region_2;
2300 l_new_val5(l_tab_counter) := p_new_rec.postal_code;
2301 l_new_val6(l_tab_counter) := p_new_rec.region_3;
2302 end if;
2303 end if;
2304 --
2305 --
2306 elsif p_event = 'DELETE' then
2307 l_person_id := p_old_rec.person_id;
2308 l_business_group_id := p_old_rec.business_group_id;
2309 --
2310 -- record change events for deletion of mailing address
2311 if p_old_rec.address_type = 'M' and p_old_rec.primary_flag = 'N'
2312 and p_old_rec.date_to is null then
2313 l_chg_eff_dt:= trunc(sysdate);
2314 l_tab_counter := l_tab_counter + 1;
2315 l_chg_evt_tab(l_tab_counter) := 'DMA';
2316 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2317 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2318 l_prmtr_02_tab(l_tab_counter) := null;
2319 l_prmtr_03_tab(l_tab_counter) := null;
2320 l_prmtr_04_tab(l_tab_counter) := null;
2321 l_prmtr_05_tab(l_tab_counter) := null;
2322 l_prmtr_06_tab(l_tab_counter) := null;
2323 l_prmtr_07_tab(l_tab_counter) := null;
2324 l_old_val1(l_tab_counter) := rtrim(substrb( p_old_rec.address_line1||' '||
2325 p_old_rec.address_line2||' '||
2326 p_old_rec.address_line3,1,600));
2327 l_old_val2(l_tab_counter) := p_old_rec.town_or_city;
2328 l_old_val3(l_tab_counter) := p_old_rec.region_2;
2329 l_old_val4(l_tab_counter) := p_old_rec.postal_code;
2330 l_old_val5(l_tab_counter) := p_old_rec.region_3;
2331 l_old_val6(l_tab_counter) := p_old_rec.region_1;
2332 l_new_val1(l_tab_counter) := null;
2333 l_new_val2(l_tab_counter) := null;
2334 l_new_val3(l_tab_counter) := null;
2335 l_new_val4(l_tab_counter) := null;
2336 l_new_val5(l_tab_counter) := null;
2337 l_new_val6(l_tab_counter) := null;
2338 end if;
2339 --
2340 --
2341 elsif p_event = 'UPDATE' then
2342 -- cache this data for later use.
2343 hr_utility.set_location(' in address changes ' , 673);
2344 g_prev_upd_adr_person_id := p_new_rec.person_id;
2345 g_prev_upd_adr_primary_flag := p_new_rec.primary_flag;
2346 g_prev_upd_adr_to_date := p_new_rec.date_to;
2347 g_prev_upd_adr_address_line1 := p_new_rec.address_line1;
2348 g_prev_upd_adr_address_line2 := p_new_rec.address_line2;
2349 g_prev_upd_adr_address_line3 := p_new_rec.address_line3;
2350 g_prev_upd_adr_country := p_new_rec.country;
2351 g_prev_upd_adr_postal_code := p_new_rec.postal_code;
2352 g_prev_upd_adr_region_1 := p_new_rec.region_1;
2353 g_prev_upd_adr_region_2 := p_new_rec.region_2;
2354 g_prev_upd_adr_region_3 := p_new_rec.region_3;
2355 g_prev_upd_adr_town_or_city := p_new_rec.town_or_city;
2356 g_prev_upd_adr_address_id := p_new_rec.address_id;
2357 --
2358
2359 l_person_id := p_new_rec.person_id;
2360 l_business_group_id := p_new_rec.business_group_id;
2361 --
2362 if p_old_rec.primary_flag = p_new_rec.primary_flag
2363 and p_new_rec.primary_flag = 'Y' and p_old_rec.date_to is null then
2364
2365 l_chg_eff_dt := p_new_rec.date_from;
2366 if nvl(p_old_rec.address_line1, 'address_line1')
2367 <> nvl(p_new_rec.address_line1, 'address_line1')
2368 or
2369 nvl(p_old_rec.address_line2, 'address_line2')
2370 <> nvl(p_new_rec.address_line2, 'address_line2')
2371 or
2372 nvl(p_old_rec.address_line3, 'address_line3')
2373 <> nvl(p_new_rec.address_line3, 'address_line3')
2374 then
2375 l_chg_occured := TRUE;
2376 l_tab_counter := l_tab_counter + 1;
2377 l_chg_evt_tab(l_tab_counter) := 'CORS';
2378 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2379 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2380 l_prmtr_02_tab(l_tab_counter) := null;
2381 l_prmtr_03_tab(l_tab_counter) := null;
2382 l_prmtr_04_tab(l_tab_counter) := null;
2383 l_prmtr_05_tab(l_tab_counter) := null;
2384 l_prmtr_06_tab(l_tab_counter) := null;
2385 l_prmtr_07_tab(l_tab_counter) := null;
2386 l_old_val1(l_tab_counter) := rtrim(substrb( p_old_rec.address_line1||' '||
2387 p_old_rec.address_line2||' '||
2388 p_old_rec.address_line3,1,600));
2389 l_old_val2(l_tab_counter) := null;
2390 l_old_val3(l_tab_counter) := null;
2391 l_old_val4(l_tab_counter) := null;
2392 l_old_val5(l_tab_counter) := null;
2393 l_old_val6(l_tab_counter) := null;
2394 l_new_val1(l_tab_counter) := rtrim(substrb( p_new_rec.address_line1||' '||
2395 p_new_rec.address_line2||' '||
2396 p_new_rec.address_line3,1,600));
2397 l_new_val2(l_tab_counter) := null;
2398 l_new_val3(l_tab_counter) := null;
2399 l_new_val4(l_tab_counter) := null;
2400 l_new_val5(l_tab_counter) := null;
2401 l_new_val6(l_tab_counter) := null;
2402 end if;
2403 if upper(nvl(p_old_rec.postal_code, 'postal_code'))
2404 <> upper(nvl(p_new_rec.postal_code, 'postal_code')) then
2405 l_chg_occured := TRUE;
2406 l_tab_counter := l_tab_counter + 1;
2407 l_chg_evt_tab(l_tab_counter) := 'CORP';
2408 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2409 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2410 l_prmtr_02_tab(l_tab_counter) := null;
2411 l_prmtr_03_tab(l_tab_counter) := null;
2412 l_prmtr_04_tab(l_tab_counter) := null;
2413 l_prmtr_05_tab(l_tab_counter) := null;
2414 l_prmtr_06_tab(l_tab_counter) := null;
2415 l_prmtr_07_tab(l_tab_counter) := null;
2416 l_old_val1(l_tab_counter) := p_old_rec.postal_code;
2417 l_old_val2(l_tab_counter) := null;
2418 l_old_val3(l_tab_counter) := null;
2419 l_old_val4(l_tab_counter) := null;
2420 l_old_val5(l_tab_counter) := null;
2421 l_old_val6(l_tab_counter) := null;
2422 l_new_val1(l_tab_counter) := p_new_rec.postal_code;
2423 l_new_val2(l_tab_counter) := null;
2424 l_new_val3(l_tab_counter) := null;
2425 l_new_val4(l_tab_counter) := null;
2426 l_new_val5(l_tab_counter) := null;
2427 l_new_val6(l_tab_counter) := null;
2428 end if;
2429 if upper(nvl(p_old_rec.region_1, 'region_1'))
2430 <> upper(nvl(p_new_rec.region_1, 'region_1')) then
2431 l_chg_occured := TRUE;
2432 l_tab_counter := l_tab_counter + 1;
2433 l_chg_evt_tab(l_tab_counter) := 'COPE';
2434 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2435 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2436 l_prmtr_02_tab(l_tab_counter) := null;
2437 l_prmtr_03_tab(l_tab_counter) := null;
2438 l_prmtr_04_tab(l_tab_counter) := null;
2439 l_prmtr_05_tab(l_tab_counter) := null;
2440 l_prmtr_06_tab(l_tab_counter) := null;
2441 l_prmtr_07_tab(l_tab_counter) := null;
2442 l_old_val1(l_tab_counter) := p_old_rec.region_1;
2443 l_old_val2(l_tab_counter) := null;
2444 l_old_val3(l_tab_counter) := null;
2445 l_old_val4(l_tab_counter) := null;
2446 l_old_val5(l_tab_counter) := null;
2447 l_old_val6(l_tab_counter) := null;
2448 l_new_val1(l_tab_counter) := p_new_rec.region_1;
2449 l_new_val2(l_tab_counter) := null;
2450 l_new_val3(l_tab_counter) := null;
2451 l_new_val4(l_tab_counter) := null;
2452 l_new_val5(l_tab_counter) := null;
2453 l_new_val6(l_tab_counter) := null;
2454 end if;
2455 if upper(nvl(p_old_rec.region_2, 'region_2'))
2456 <> upper(nvl(p_new_rec.region_2, 'region_2')) then
2457 l_chg_occured := TRUE;
2458 l_tab_counter := l_tab_counter + 1;
2459 l_chg_evt_tab(l_tab_counter) := 'COPS';
2460 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2461 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2462 l_prmtr_02_tab(l_tab_counter) := null;
2463 l_prmtr_03_tab(l_tab_counter) := null;
2464 l_prmtr_04_tab(l_tab_counter) := null;
2465 l_prmtr_05_tab(l_tab_counter) := null;
2466 l_prmtr_06_tab(l_tab_counter) := null;
2467 l_prmtr_07_tab(l_tab_counter) := null;
2468 l_old_val1(l_tab_counter) := p_old_rec.region_2;
2469 l_old_val2(l_tab_counter) := null;
2470 l_old_val3(l_tab_counter) := null;
2471 l_old_val4(l_tab_counter) := null;
2472 l_old_val5(l_tab_counter) := null;
2473 l_old_val6(l_tab_counter) := null;
2474 l_new_val1(l_tab_counter) := p_new_rec.region_2;
2475 l_new_val2(l_tab_counter) := null;
2476 l_new_val3(l_tab_counter) := null;
2477 l_new_val4(l_tab_counter) := null;
2478 l_new_val5(l_tab_counter) := null;
2479 l_new_val6(l_tab_counter) := null;
2480 end if;
2481 if upper(nvl(p_old_rec.region_3, 'region_3'))
2482 <> upper(nvl(p_new_rec.region_3, 'region_3')) then
2483 l_chg_occured := TRUE;
2484 l_tab_counter := l_tab_counter + 1;
2485 l_chg_evt_tab(l_tab_counter) := 'COPC';
2486 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2487 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2488 l_prmtr_02_tab(l_tab_counter) := null;
2489 l_prmtr_03_tab(l_tab_counter) := null;
2490 l_prmtr_04_tab(l_tab_counter) := null;
2491 l_prmtr_05_tab(l_tab_counter) := null;
2492 l_prmtr_06_tab(l_tab_counter) := null;
2493 l_prmtr_07_tab(l_tab_counter) := null;
2494 l_old_val1(l_tab_counter) := p_old_rec.region_3;
2495 l_old_val2(l_tab_counter) := null;
2496 l_old_val3(l_tab_counter) := null;
2497 l_old_val4(l_tab_counter) := null;
2498 l_old_val5(l_tab_counter) := null;
2499 l_old_val6(l_tab_counter) := null;
2500 l_new_val1(l_tab_counter) := p_new_rec.region_3;
2501 l_new_val2(l_tab_counter) := null;
2502 l_new_val3(l_tab_counter) := null;
2503 l_new_val4(l_tab_counter) := null;
2504 l_new_val5(l_tab_counter) := null;
2505 l_new_val6(l_tab_counter) := null;
2506 end if;
2507 if upper(nvl(p_old_rec.town_or_city, 'town_or_city'))
2508 <> upper(nvl(p_new_rec.town_or_city, 'town_or_city')) then
2509 l_chg_occured := TRUE;
2510 l_tab_counter := l_tab_counter + 1;
2511 l_chg_evt_tab(l_tab_counter) := 'CORC';
2512 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2513 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2514 l_prmtr_02_tab(l_tab_counter) := null;
2515 l_prmtr_03_tab(l_tab_counter) := null;
2516 l_prmtr_04_tab(l_tab_counter) := null;
2517 l_prmtr_05_tab(l_tab_counter) := null;
2518 l_prmtr_06_tab(l_tab_counter) := null;
2519 l_prmtr_07_tab(l_tab_counter) := null;
2520 l_old_val1(l_tab_counter) := p_old_rec.town_or_city;
2521 l_old_val2(l_tab_counter) := null;
2522 l_old_val3(l_tab_counter) := null;
2523 l_old_val4(l_tab_counter) := null;
2524 l_old_val5(l_tab_counter) := null;
2525 l_old_val6(l_tab_counter) := null;
2526 l_new_val1(l_tab_counter) := p_new_rec.town_or_city;
2527 l_new_val2(l_tab_counter) := null;
2528 l_new_val3(l_tab_counter) := null;
2529 l_new_val4(l_tab_counter) := null;
2530 l_new_val5(l_tab_counter) := null;
2531 l_new_val6(l_tab_counter) := null;
2532 end if;
2533
2534 if upper(nvl(p_old_rec.country, 'country'))
2535 <> upper(nvl(p_new_rec.country, 'country')) then
2536 l_chg_occured := TRUE;
2537 l_tab_counter := l_tab_counter + 1;
2538 l_chg_evt_tab(l_tab_counter) := 'COCN';
2539 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2540 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2541 l_prmtr_02_tab(l_tab_counter) := null;
2542 l_prmtr_03_tab(l_tab_counter) := null;
2543 l_prmtr_04_tab(l_tab_counter) := null;
2544 l_prmtr_05_tab(l_tab_counter) := null;
2545 l_prmtr_06_tab(l_tab_counter) := null;
2546 l_prmtr_07_tab(l_tab_counter) := null;
2547 l_old_val1(l_tab_counter) := p_old_rec.country;
2548 l_old_val2(l_tab_counter) := null;
2549 l_old_val3(l_tab_counter) := null;
2550 l_old_val4(l_tab_counter) := null;
2551 l_old_val5(l_tab_counter) := null;
2552 l_old_val6(l_tab_counter) := null;
2553 l_new_val1(l_tab_counter) := p_new_rec.country;
2554 l_new_val2(l_tab_counter) := null;
2555 l_new_val3(l_tab_counter) := null;
2556 l_new_val4(l_tab_counter) := null;
2557 l_new_val5(l_tab_counter) := null;
2558 l_new_val6(l_tab_counter) := null;
2559 end if;
2560 if l_chg_occured then
2561 l_tab_counter := l_tab_counter + 1;
2562 l_chg_evt_tab(l_tab_counter) := 'COPR';
2563 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2564 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2565 l_prmtr_02_tab(l_tab_counter) := null;
2566 l_prmtr_03_tab(l_tab_counter) := null;
2567 l_prmtr_04_tab(l_tab_counter) := null;
2568 l_prmtr_05_tab(l_tab_counter) := null;
2569 l_prmtr_06_tab(l_tab_counter) := null;
2570 l_prmtr_07_tab(l_tab_counter) := null;
2571 l_old_val1(l_tab_counter) := rtrim(substrb( p_old_rec.address_line1||' '||
2572 p_old_rec.address_line2||' '||
2573 p_old_rec.address_line3,1,600));
2574 l_old_val2(l_tab_counter) := p_old_rec.town_or_city;
2575 l_old_val3(l_tab_counter) := p_old_rec.region_2;
2576 l_old_val4(l_tab_counter) := p_old_rec.postal_code;
2577 l_old_val5(l_tab_counter) := p_old_rec.region_3;
2578 l_old_val6(l_tab_counter) := p_old_rec.region_1;
2579 l_new_val1(l_tab_counter) := rtrim(substrb( p_new_rec.address_line1||' '||
2580 p_new_rec.address_line2||' '||
2581 p_new_rec.address_line3,1,600));
2582 l_new_val2(l_tab_counter) := p_new_rec.town_or_city;
2583 l_new_val3(l_tab_counter) := p_new_rec.region_2;
2584 l_new_val4(l_tab_counter) := p_new_rec.postal_code;
2585 l_new_val5(l_tab_counter) := p_new_rec.region_3;
2586 l_new_val6(l_tab_counter) := p_new_rec.region_1;
2587 end if;
2588 --for contact data change
2589 if ((l_chg_occured)
2590 or (nvl(p_old_rec.date_from,
2591 to_date('01/01/0001', 'DD/MM/YYYY'))
2592 <> nvl(p_new_rec.date_from,
2593 to_date('01/01/0001', 'DD/MM/YYYY')))) then
2594
2595 open c_relationship(p_new_rec.person_id);
2596 fetch c_relationship into l_contact,l_relationship,l_name;
2597 if c_relationship%notfound then
2598 close c_relationship;
2599 elsif c_relationship%found then
2600 close c_relationship;
2601 l_tab_counter := l_tab_counter + 1;
2602 l_chg_evt_tab(l_tab_counter) := 'CCPA';
2603 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2604 l_prmtr_01_tab(l_tab_counter) := to_char(l_contact);
2605 l_prmtr_02_tab(l_tab_counter) := p_new_rec.address_id;
2606 l_prmtr_03_tab(l_tab_counter) := null;
2607 l_prmtr_04_tab(l_tab_counter) := null;
2608 l_prmtr_05_tab(l_tab_counter) := null;
2609 l_prmtr_06_tab(l_tab_counter) := null;
2610 l_prmtr_07_tab(l_tab_counter) := l_relationship;
2611 l_old_val1(l_tab_counter) := substr(l_name,1,240);
2612 l_new_val1(l_tab_counter) := substr(l_name,1,240);
2613 l_old_val2(l_tab_counter) := rtrim(substrb(p_old_rec.address_line1||' '||
2614 p_old_rec.address_line2||' '||
2615 p_old_rec.address_line3,1,600));
2616 l_old_val3(l_tab_counter) := p_old_rec.town_or_city;
2617 l_old_val4(l_tab_counter) := p_old_rec.region_2;
2618 l_old_val5(l_tab_counter) := p_old_rec.postal_code;
2619 l_old_val6(l_tab_counter) := p_old_rec.region_3;
2620 l_new_val2(l_tab_counter) := rtrim(substrb( p_new_rec.address_line1||' '||
2621 p_new_rec.address_line2||' '||
2622 p_new_rec.address_line3,1,600));
2623 l_new_val3(l_tab_counter) := p_new_rec.town_or_city;
2624 l_new_val4(l_tab_counter) := p_new_rec.region_2;
2625 l_new_val5(l_tab_counter) := p_new_rec.postal_code;
2626 l_new_val6(l_tab_counter) := p_new_rec.region_3;
2627 end if;
2628 end if;
2629 if nvl(p_old_rec.date_from,
2630 to_date('01/01/0001', 'DD/MM/YYYY'))
2631 <> nvl(p_new_rec.date_from,
2632 to_date('01/01/0001', 'DD/MM/YYYY')) then
2633 l_tab_counter := l_tab_counter + 1;
2634 l_chg_evt_tab(l_tab_counter) := 'COPR';
2635 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2636 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2637 l_prmtr_02_tab(l_tab_counter) := null;
2638 l_prmtr_03_tab(l_tab_counter) := null;
2639 l_prmtr_04_tab(l_tab_counter) := null;
2640 l_prmtr_05_tab(l_tab_counter) := null;
2641 l_prmtr_06_tab(l_tab_counter) := null;
2642 l_prmtr_07_tab(l_tab_counter) := null;
2643 l_old_val1(l_tab_counter) := rtrim(substrb( p_old_rec.address_line1||' '||
2644 p_old_rec.address_line2||' '||
2645 p_old_rec.address_line3,1,600));
2646 l_old_val2(l_tab_counter) := p_old_rec.town_or_city;
2647 l_old_val3(l_tab_counter) := p_old_rec.region_2;
2648 l_old_val4(l_tab_counter) := p_old_rec.postal_code;
2649 l_old_val5(l_tab_counter) := p_old_rec.region_3;
2650 l_old_val6(l_tab_counter) := p_old_rec.region_1;
2651 l_new_val1(l_tab_counter) := rtrim(substrb( p_new_rec.address_line1||' '||
2652 p_new_rec.address_line2||' '||
2653 p_new_rec.address_line3,1,600));
2654 l_new_val2(l_tab_counter) := p_new_rec.town_or_city;
2655 l_new_val3(l_tab_counter) := p_new_rec.region_2;
2656 l_new_val4(l_tab_counter) := p_new_rec.postal_code;
2657 l_new_val5(l_tab_counter) := p_new_rec.region_3;
2658 l_new_val6(l_tab_counter) := p_new_rec.region_1;
2659 end if;
2660
2661
2662 end if;
2663 --
2664 -- also log change events for mailing address
2665 if p_new_rec.address_type <> nvl(p_old_rec.address_type,'$$')
2666 and p_new_rec.address_type = 'M' then
2667 l_chg_eff_dt := p_new_rec.date_from;
2668 l_tab_counter := l_tab_counter + 1;
2669 l_chg_evt_tab(l_tab_counter) := 'AMA';
2670 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2671 l_prmtr_01_tab(l_tab_counter) := p_new_rec.address_id;
2672 l_prmtr_02_tab(l_tab_counter) := null;
2673 l_prmtr_03_tab(l_tab_counter) := null;
2674 l_prmtr_04_tab(l_tab_counter) := null;
2675 l_prmtr_05_tab(l_tab_counter) := null;
2676 l_prmtr_06_tab(l_tab_counter) := null;
2677 l_prmtr_07_tab(l_tab_counter) := null;
2678 l_old_val1(l_tab_counter) := null;
2679 l_old_val2(l_tab_counter) := null;
2680 l_old_val3(l_tab_counter) := null;
2681 l_old_val4(l_tab_counter) := null;
2682 l_old_val5(l_tab_counter) := null;
2683 l_old_val6(l_tab_counter) := null;
2684 l_new_val1(l_tab_counter) := rtrim(substrb( p_new_rec.address_line1||' '||
2685 p_new_rec.address_line2||' '||
2686 p_new_rec.address_line3,1,600));
2687 l_new_val2(l_tab_counter) := p_new_rec.town_or_city;
2688 l_new_val3(l_tab_counter) := p_new_rec.region_2;
2689 l_new_val4(l_tab_counter) := p_new_rec.postal_code;
2690 l_new_val5(l_tab_counter) := p_new_rec.region_3;
2691 l_new_val6(l_tab_counter) := p_new_rec.region_1;
2692 end if;
2693
2694 if p_old_rec.address_type = 'M'
2695 and p_new_rec.date_to is null
2696 and p_old_rec.date_to is not null then
2697 l_chg_eff_dt := p_new_rec.date_from;
2698 l_tab_counter := l_tab_counter + 1;
2699 l_chg_evt_tab(l_tab_counter) := 'AMA';
2700 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2701 l_prmtr_01_tab(l_tab_counter) := p_new_rec.address_id;
2702 l_prmtr_02_tab(l_tab_counter) := null;
2703 l_prmtr_03_tab(l_tab_counter) := null;
2704 l_prmtr_04_tab(l_tab_counter) := null;
2705 l_prmtr_05_tab(l_tab_counter) := null;
2706 l_prmtr_06_tab(l_tab_counter) := null;
2707 l_prmtr_07_tab(l_tab_counter) := null;
2708 l_old_val1(l_tab_counter) := null;
2709 l_old_val2(l_tab_counter) := null;
2710 l_old_val3(l_tab_counter) := null;
2711 l_old_val4(l_tab_counter) := null;
2712 l_old_val5(l_tab_counter) := null;
2713 l_old_val6(l_tab_counter) := null;
2714 l_new_val1(l_tab_counter) := rtrim(substrb( p_new_rec.address_line1||' '||
2715 p_new_rec.address_line2||' '||
2716 p_new_rec.address_line3,1,600));
2717 l_new_val2(l_tab_counter) := p_new_rec.town_or_city;
2718 l_new_val3(l_tab_counter) := p_new_rec.region_2;
2719 l_new_val4(l_tab_counter) := p_new_rec.postal_code;
2720 l_new_val5(l_tab_counter) := p_new_rec.region_3;
2721 l_new_val6(l_tab_counter) := p_new_rec.region_1;
2722 end if;
2723
2724 if nvl(p_new_rec.address_type,'$$') <> p_old_rec.address_type
2725 and p_old_rec.address_type = 'M' then
2726 l_chg_eff_dt := trunc(sysdate);
2727 l_tab_counter := l_tab_counter + 1;
2728 l_chg_evt_tab(l_tab_counter) := 'DMA';
2729 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2730 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2731 l_prmtr_02_tab(l_tab_counter) := null;
2732 l_prmtr_03_tab(l_tab_counter) := null;
2733 l_prmtr_04_tab(l_tab_counter) := null;
2734 l_prmtr_05_tab(l_tab_counter) := null;
2735 l_prmtr_06_tab(l_tab_counter) := null;
2736 l_prmtr_07_tab(l_tab_counter) := null;
2737 l_old_val1(l_tab_counter) := rtrim(substrb( p_old_rec.address_line1||' '||
2738 p_old_rec.address_line2||' '||
2739 p_old_rec.address_line3,1,600));
2740 l_old_val2(l_tab_counter) := p_old_rec.town_or_city;
2741 l_old_val3(l_tab_counter) := p_old_rec.region_2;
2742 l_old_val4(l_tab_counter) := p_old_rec.postal_code;
2743 l_old_val5(l_tab_counter) := p_old_rec.region_3;
2744 l_old_val6(l_tab_counter) := p_old_rec.region_1;
2745 l_new_val1(l_tab_counter) := null;
2746 l_new_val2(l_tab_counter) := null;
2747 l_new_val3(l_tab_counter) := null;
2748 l_new_val4(l_tab_counter) := null;
2749 l_new_val5(l_tab_counter) := null;
2750 l_new_val6(l_tab_counter) := null;
2751 end if;
2752
2753 if p_old_rec.address_type = 'M'
2754 and p_new_rec.date_to is not null
2755 and p_old_rec.date_to is null then
2756 l_chg_eff_dt := p_new_rec.date_to;
2757 l_tab_counter := l_tab_counter + 1;
2758 l_chg_evt_tab(l_tab_counter) := 'DMA';
2759 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2760 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2761 l_prmtr_02_tab(l_tab_counter) := null;
2762 l_prmtr_03_tab(l_tab_counter) := null;
2763 l_prmtr_04_tab(l_tab_counter) := null;
2764 l_prmtr_05_tab(l_tab_counter) := null;
2765 l_prmtr_06_tab(l_tab_counter) := null;
2766 l_prmtr_07_tab(l_tab_counter) := null;
2767 l_old_val1(l_tab_counter) := rtrim(substrb( p_old_rec.address_line1||' '||
2768 p_old_rec.address_line2||' '||
2769 p_old_rec.address_line3,1,600));
2770 l_old_val2(l_tab_counter) := p_old_rec.town_or_city;
2771 l_old_val3(l_tab_counter) := p_old_rec.region_2;
2772 l_old_val4(l_tab_counter) := p_old_rec.postal_code;
2773 l_old_val5(l_tab_counter) := p_old_rec.region_3;
2774 l_old_val6(l_tab_counter) := p_old_rec.region_1;
2775 l_new_val1(l_tab_counter) := null;
2776 l_new_val2(l_tab_counter) := null;
2777 l_new_val3(l_tab_counter) := null;
2778 l_new_val4(l_tab_counter) := null;
2779 l_new_val5(l_tab_counter) := null;
2780 l_new_val6(l_tab_counter) := null;
2781 end if;
2782 --
2783 if p_old_rec.address_type = p_new_rec.address_type
2784 and p_new_rec.address_type = 'M' then
2785 if nvl(p_new_rec.date_from,
2786 to_date('01/01/0001', 'DD/MM/YYYY'))
2787 < trunc(sysdate) then
2788 if nvl(p_new_rec.date_to,
2789 to_date('31/12/4712', 'DD/MM/YYYY'))
2790 < trunc(sysdate) then
2791 l_chg_eff_dt := p_new_rec.date_to;
2792 else
2793 l_chg_eff_dt := trunc(sysdate);
2794 end if;
2795 else
2796 l_chg_eff_dt := p_new_rec.date_from;
2797 end if;
2798 if upper(nvl(p_old_rec.town_or_city, 'town_or_city'))
2799 <> upper(nvl(p_new_rec.town_or_city, 'town_or_city')) then
2800 l_chg_occured := TRUE;
2801 l_tab_counter := l_tab_counter + 1;
2802 l_chg_evt_tab(l_tab_counter) := 'COMC';
2803 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2804 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2805 l_prmtr_02_tab(l_tab_counter) := null;
2806 l_prmtr_03_tab(l_tab_counter) := null;
2807 l_prmtr_04_tab(l_tab_counter) := null;
2808 l_prmtr_05_tab(l_tab_counter) := null;
2809 l_prmtr_06_tab(l_tab_counter) := null;
2810 l_prmtr_07_tab(l_tab_counter) := null;
2811 l_old_val1(l_tab_counter) := p_old_rec.town_or_city;
2812 l_old_val2(l_tab_counter) := null;
2813 l_old_val3(l_tab_counter) := null;
2814 l_old_val4(l_tab_counter) := null;
2815 l_old_val5(l_tab_counter) := null;
2816 l_old_val6(l_tab_counter) := null;
2817 l_new_val1(l_tab_counter) := p_new_rec.town_or_city;
2818 l_new_val2(l_tab_counter) := null;
2819 l_new_val3(l_tab_counter) := null;
2820 l_new_val4(l_tab_counter) := null;
2821 l_new_val5(l_tab_counter) := null;
2822 l_new_val6(l_tab_counter) := null;
2823 end if;
2824 if upper(nvl(p_old_rec.postal_code, 'postal_code'))
2825 <> upper(nvl(p_new_rec.postal_code, 'postal_code')) then
2826 l_chg_occured := TRUE;
2827 l_tab_counter := l_tab_counter + 1;
2828 l_chg_evt_tab(l_tab_counter) := 'COMP';
2829 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2830 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2831 l_prmtr_02_tab(l_tab_counter) := null;
2832 l_prmtr_03_tab(l_tab_counter) := null;
2833 l_prmtr_04_tab(l_tab_counter) := null;
2834 l_prmtr_05_tab(l_tab_counter) := null;
2835 l_prmtr_06_tab(l_tab_counter) := null;
2836 l_prmtr_07_tab(l_tab_counter) := null;
2837 l_old_val1(l_tab_counter) := p_old_rec.postal_code;
2838 l_old_val2(l_tab_counter) := null;
2839 l_old_val3(l_tab_counter) := null;
2840 l_old_val4(l_tab_counter) := null;
2841 l_old_val5(l_tab_counter) := null;
2842 l_old_val6(l_tab_counter) := null;
2843 l_new_val1(l_tab_counter) := p_new_rec.postal_code;
2844 l_new_val2(l_tab_counter) := null;
2845 l_new_val3(l_tab_counter) := null;
2846 l_new_val4(l_tab_counter) := null;
2847 l_new_val5(l_tab_counter) := null;
2848 l_new_val6(l_tab_counter) := null;
2849 end if;
2850 if nvl(p_old_rec.address_line1, 'address_line1')
2851 <> nvl(p_new_rec.address_line1, 'address_line1')
2852 or
2853 nvl(p_old_rec.address_line2, 'address_line2')
2854 <> nvl(p_new_rec.address_line2, 'address_line2')
2855 or
2856 nvl(p_old_rec.address_line3, 'address_line3')
2857 <> nvl(p_new_rec.address_line3, 'address_line3')
2858 then
2859 l_chg_occured := TRUE;
2860 l_tab_counter := l_tab_counter + 1;
2861 l_chg_evt_tab(l_tab_counter) := 'COMS';
2862 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2863 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2864 l_prmtr_02_tab(l_tab_counter) := null;
2865 l_prmtr_03_tab(l_tab_counter) := null;
2866 l_prmtr_04_tab(l_tab_counter) := null;
2867 l_prmtr_05_tab(l_tab_counter) := null;
2868 l_prmtr_06_tab(l_tab_counter) := null;
2869 l_prmtr_07_tab(l_tab_counter) := null;
2870 l_old_val1(l_tab_counter) := rtrim(substrb( p_old_rec.address_line1||' '||
2871 p_old_rec.address_line2||' '||
2872 p_old_rec.address_line3,1,600));
2873 l_old_val2(l_tab_counter) := null;
2874 l_old_val3(l_tab_counter) := null;
2875 l_old_val4(l_tab_counter) := null;
2876 l_old_val5(l_tab_counter) := null;
2877 l_old_val6(l_tab_counter) := null;
2878 l_new_val1(l_tab_counter) := rtrim(substrb( p_new_rec.address_line1||' '||
2879 p_new_rec.address_line2||' '||
2880 p_new_rec.address_line3,1,600));
2881 l_new_val2(l_tab_counter) := null;
2882 l_new_val3(l_tab_counter) := null;
2883 l_new_val4(l_tab_counter) := null;
2884 l_new_val5(l_tab_counter) := null;
2885 l_new_val6(l_tab_counter) := null;
2886 end if;
2887 if upper(nvl(p_old_rec.region_1, 'region_1'))
2888 <> upper(nvl(p_new_rec.region_1, 'region_1')) then
2889 l_chg_occured := TRUE;
2890 l_tab_counter := l_tab_counter + 1;
2891 l_chg_evt_tab(l_tab_counter) := 'COMR';
2892 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2893 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2894 l_prmtr_02_tab(l_tab_counter) := null;
2895 l_prmtr_03_tab(l_tab_counter) := null;
2896 l_prmtr_04_tab(l_tab_counter) := null;
2897 l_prmtr_05_tab(l_tab_counter) := null;
2898 l_prmtr_06_tab(l_tab_counter) := null;
2899 l_prmtr_07_tab(l_tab_counter) := null;
2900 l_old_val1(l_tab_counter) := p_old_rec.region_1;
2901 l_old_val2(l_tab_counter) := null;
2902 l_old_val3(l_tab_counter) := null;
2903 l_old_val4(l_tab_counter) := null;
2904 l_old_val5(l_tab_counter) := null;
2905 l_old_val6(l_tab_counter) := null;
2906 l_new_val1(l_tab_counter) := p_new_rec.region_1;
2907 l_new_val2(l_tab_counter) := null;
2908 l_new_val3(l_tab_counter) := null;
2909 l_new_val4(l_tab_counter) := null;
2910 l_new_val5(l_tab_counter) := null;
2911 l_new_val6(l_tab_counter) := null;
2912 end if;
2913 if upper(nvl(p_old_rec.region_2, 'region_2'))
2914 <> upper(nvl(p_new_rec.region_2, 'region_2')) then
2915 l_chg_occured := TRUE;
2916 l_tab_counter := l_tab_counter + 1;
2917 l_chg_evt_tab(l_tab_counter) := 'COMT';
2918 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2919 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2920 l_prmtr_02_tab(l_tab_counter) := null;
2921 l_prmtr_03_tab(l_tab_counter) := null;
2922 l_prmtr_04_tab(l_tab_counter) := null;
2923 l_prmtr_05_tab(l_tab_counter) := null;
2924 l_prmtr_06_tab(l_tab_counter) := null;
2925 l_prmtr_07_tab(l_tab_counter) := null;
2926 l_old_val1(l_tab_counter) := p_old_rec.region_2;
2927 l_old_val2(l_tab_counter) := null;
2928 l_old_val3(l_tab_counter) := null;
2929 l_old_val4(l_tab_counter) := null;
2930 l_old_val5(l_tab_counter) := null;
2931 l_old_val6(l_tab_counter) := null;
2932 l_new_val1(l_tab_counter) := p_new_rec.region_2;
2933 l_new_val2(l_tab_counter) := null;
2934 l_new_val3(l_tab_counter) := null;
2935 l_new_val4(l_tab_counter) := null;
2936 l_new_val5(l_tab_counter) := null;
2937 l_new_val6(l_tab_counter) := null;
2938 end if;
2939 if upper(nvl(p_old_rec.region_3, 'region_3'))
2940 <> upper(nvl(p_new_rec.region_3, 'region_3')) then
2941 l_chg_occured := TRUE;
2942 l_tab_counter := l_tab_counter + 1;
2943 l_chg_evt_tab(l_tab_counter) := 'COMO';
2944 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2945 l_prmtr_01_tab(l_tab_counter) := p_old_rec.address_id;
2946 l_prmtr_02_tab(l_tab_counter) := null;
2947 l_prmtr_03_tab(l_tab_counter) := null;
2948 l_prmtr_04_tab(l_tab_counter) := null;
2949 l_prmtr_05_tab(l_tab_counter) := null;
2950 l_prmtr_06_tab(l_tab_counter) := null;
2951 l_prmtr_07_tab(l_tab_counter) := null;
2952 l_old_val1(l_tab_counter) := p_old_rec.region_3;
2953 l_old_val2(l_tab_counter) := null;
2954 l_old_val3(l_tab_counter) := null;
2955 l_old_val4(l_tab_counter) := null;
2956 l_old_val5(l_tab_counter) := null;
2957 l_old_val6(l_tab_counter) := null;
2958 l_new_val1(l_tab_counter) := p_new_rec.region_3;
2959 l_new_val2(l_tab_counter) := null;
2960 l_new_val3(l_tab_counter) := null;
2961 l_new_val4(l_tab_counter) := null;
2962 l_new_val5(l_tab_counter) := null;
2963 l_new_val6(l_tab_counter) := null;
2964 end if;
2965 --
2966 -- for contact change of mailing address
2967 if p_new_rec.address_type <> nvl(p_old_rec.address_type,'$$')
2968 and p_new_rec.address_type = 'M' then
2969 l_chg_mail_add := true;
2970 elsif p_old_rec.address_type = 'M'
2971 and p_new_rec.date_to is null
2972 and p_old_rec.date_to is not null then
2973 l_chg_mail_add := true;
2974 end if;
2975 if l_chg_occured or l_chg_mail_add then
2976 --fnd_message.set_name('BEN','ddddsss'||to_char(l_relationship));
2977 --fnd_message.raise_error;
2978 open c_relationship(p_new_rec.person_id);
2979 fetch c_relationship into l_contact,l_relationship,l_name;
2980 if c_relationship%notfound then
2981 close c_relationship;
2982 elsif c_relationship%found then
2983 close c_relationship;
2984 l_tab_counter := l_tab_counter + 1;
2985 l_chg_evt_tab(l_tab_counter) := 'CCMA';
2986 l_chg_eff_tab(l_tab_counter) := l_chg_eff_dt;
2987 l_prmtr_01_tab(l_tab_counter) := to_char(l_contact);
2988 l_prmtr_02_tab(l_tab_counter) := p_new_rec.address_id;
2989 l_prmtr_03_tab(l_tab_counter) := null;
2990 l_prmtr_04_tab(l_tab_counter) := null;
2991 l_prmtr_05_tab(l_tab_counter) := null;
2992 l_prmtr_06_tab(l_tab_counter) := null;
2993 l_prmtr_07_tab(l_tab_counter) := l_relationship;
2994 l_old_val1(l_tab_counter) := substr(l_name,1,240);
2995 l_new_val1(l_tab_counter) := substr(l_name,1,240);
2996 l_old_val2(l_tab_counter) := rtrim(substrb( p_old_rec.address_line1||' '||
2997 p_old_rec.address_line2||' '||
2998 p_old_rec.address_line3,1,600));
2999 l_old_val3(l_tab_counter) := p_old_rec.town_or_city;
3000 l_old_val4(l_tab_counter) := p_old_rec.region_2;
3001 l_old_val5(l_tab_counter) := p_old_rec.postal_code;
3002 l_old_val6(l_tab_counter) := p_old_rec.region_3;
3003 l_new_val2(l_tab_counter) := rtrim(substrb( p_new_rec.address_line1||' '||
3004 p_new_rec.address_line2||' '||
3005 p_new_rec.address_line3,1,600));
3006 l_new_val3(l_tab_counter) := p_new_rec.town_or_city;
3007 l_new_val4(l_tab_counter) := p_new_rec.region_2;
3008 l_new_val5(l_tab_counter) := p_new_rec.postal_code;
3009 l_new_val6(l_tab_counter) := p_new_rec.region_3;
3010 end if;
3011 end if;
3012 end if;
3013 end if;
3014 --
3015 hr_utility.set_location('Continuing:'|| l_proc, 20);
3016 hr_utility.set_location('BGP ID:'||p_new_rec.business_group_id||' '||l_proc, 30);
3017 for l_count in 1..l_chg_evt_tab.count loop
3018 if change_event_is_enabled(l_chg_evt_tab(l_count),trunc(sysdate)) then
3019 if l_chg_evt_tab(l_count) in ('CCPA','CCMA','CCNPA','CCNMA') then
3020 l_person_id := nvl(l_prmtr_07_tab(l_count),l_relationship);
3021 end if;
3022 ben_ext_chg_evt_api.create_ext_chg_evt
3023 (p_validate => FALSE
3024 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
3025 ,p_chg_evt_cd => l_chg_evt_tab(l_count)
3026 ,p_chg_eff_dt => l_chg_eff_tab(l_count)
3027 ,p_person_id => l_person_id
3028 --
3029 -- <BUG_FIX> Passed in old rec rather than new rec on delete
3030 -- no new rec will exist
3031 --
3032 ,p_prmtr_01 => l_prmtr_01_tab(l_count)
3033 ,p_prmtr_02 => l_prmtr_02_tab(l_count)
3034 ,p_prmtr_03 => l_prmtr_03_tab(l_count)
3035 ,p_prmtr_04 => l_prmtr_04_tab(l_count)
3036 ,p_prmtr_05 => l_prmtr_05_tab(l_count)
3037 ,p_prmtr_06 => l_prmtr_06_tab(l_count)
3038 ,p_prmtr_07 => l_prmtr_07_tab(l_count)
3039 ,p_business_group_id => l_business_group_id
3040 ,p_object_version_number => l_object_version_number
3041 ,p_effective_date => trunc(sysdate)
3042 ,p_old_val1 => l_old_val1(l_count)
3043 ,p_old_val2 => l_old_val2(l_count)
3044 ,p_old_val3 => l_old_val3(l_count)
3045 ,p_old_val4 => l_old_val4(l_count)
3046 ,p_old_val5 => l_old_val5(l_count)
3047 ,p_old_val6 => l_old_val6(l_count)
3048 ,p_new_val1 => l_new_val1(l_count)
3049 ,p_new_val2 => l_new_val2(l_count)
3050 ,p_new_val3 => l_new_val3(l_count)
3051 ,p_new_val4 => l_new_val4(l_count)
3052 ,p_new_val5 => l_new_val5(l_count)
3053 ,p_new_val6 => l_new_val6(l_count)
3054 );
3055 end if;
3056 end loop;
3057 --
3058 hr_utility.set_location('Exiting:'|| l_proc, 99);
3059 --
3060 end log_add_chg;
3061 --
3062 procedure log_asg_chg
3063 (p_event in varchar2
3064 ,p_old_rec in g_asg_rec_type
3065 ,p_new_rec in g_asg_rec_type
3066 ) is
3067 --
3068 l_chg_evt_tab g_char_tab_type;
3069 l_prmtr_01_tab g_char_tab_type;
3070 l_prmtr_02_tab g_char_tab_type;
3071 l_prmtr_03_tab g_char_tab_type;
3072 l_prmtr_04_tab g_char_tab_type;
3073 l_prmtr_05_tab g_char_tab_type;
3074 l_prmtr_06_tab g_char_tab_type;
3075 l_prmtr_07_tab g_char_tab_type;
3076 l_new_val1 g_new_val;
3077 l_new_val2 g_new_val;
3078 l_new_val3 g_new_val;
3079 l_new_val4 g_new_val;
3080 l_new_val5 g_new_val;
3081 l_new_val6 g_new_val;
3082 l_old_val1 g_old_val;
3083 l_old_val2 g_old_val;
3084 l_old_val3 g_old_val;
3085 l_old_val4 g_old_val;
3086 l_old_val5 g_old_val;
3087 l_old_val6 g_old_val;
3088 l_tab_counter binary_integer := 0;
3089 l_chg_eff_dt date;
3090 l_count number;
3091 l_ext_chg_evt_log_id number;
3092 l_object_version_number number;
3093 --
3094
3095
3096 cursor c_position(p_position_id number ,
3097 p_effective_date date )
3098 is
3099 select name
3100 from HR_ALL_POSITIONS_F pos
3101 where pos.position_id = p_position_id
3102 and p_effective_date between nvl(pos.effective_start_date, sysdate)
3103 and nvl(pos.effective_end_date, sysdate)
3104 ;
3105
3106
3107 cursor c_location(p_location_id hr_locations_all.location_id%type)
3108 is
3109 select location_code
3110 from hr_locations_all hl
3111 where hl.location_id = p_location_id;
3112
3113 cursor c_assignment_status
3114 (p_assignment_status_type_id per_assignment_status_types.assignment_status_type_id%type)
3115 is
3116 select ast.user_status
3117 from per_assignment_status_types ast
3118 where ast.assignment_status_type_id = p_assignment_status_type_id;
3119
3120 cursor c_payroll_name
3121 (p_payroll_id pay_all_payrolls_f.payroll_id%type
3122 ,p_effective_date date)
3123 is
3124 select ppf.payroll_name
3125 from pay_all_payrolls_f ppf
3126 where payroll_id = p_payroll_id
3127 and p_effective_date between nvl(ppf.effective_start_date, sysdate)
3128 and nvl(ppf.effective_end_date, sysdate);
3129
3130 cursor c_grade_name
3131 (p_grade_id number ,p_effective_date date) is
3132 select g.name
3133 from per_grades g
3134 where g.grade_id = p_grade_id
3135 and g.date_from <= p_effective_date
3136 and ((g.date_to is null) or (g.date_to >= p_effective_date )) ;
3137 --
3138
3139 l_old_position HR_ALL_POSITIONS_F.name%type;
3140 l_new_position HR_ALL_POSITIONS_F.name%type;
3141 l_old_location hr_locations_all.location_code%type; -- UTF Change Bug 2254683
3142 l_new_location hr_locations_all.location_code%type; -- UTF Change Bug 2254683
3143 l_old_assignment_status per_assignment_status_types.user_status%type; -- UTF Change Bug 2254683
3144 l_new_assignment_status per_assignment_status_types.user_status%type; -- UTF Change Bug 2254683
3145 l_old_payroll_name pay_all_payrolls_f.payroll_name%type; --UTF Change Bug 2254683
3146 l_new_payroll_name pay_all_payrolls_f.payroll_name%type; --UTF Change Bug 2254683
3147 l_old_grade_name per_grades.name%type;
3148 l_new_grade_name per_grades.name%type;
3149 --
3150 l_proc varchar2(80) := 'ben_ext_chlg.log_asg_chg';
3151 --
3152 begin
3153 --
3154 hr_utility.set_location('Entering:'|| l_proc, 10);
3155 --
3156 if p_event = 'UPDATE' then
3157 --
3158 if nvl(p_old_rec.assignment_status_type_id, 1)
3159 <> nvl(p_new_rec.assignment_status_type_id, 1) then
3160
3161 -- read old and new assignment status
3162 open c_assignment_status(p_old_rec.assignment_status_type_id);
3163 fetch c_assignment_status into l_old_assignment_status;
3164 close c_assignment_status;
3165 open c_assignment_status(p_new_rec.assignment_status_type_id);
3166 fetch c_assignment_status into l_new_assignment_status;
3167 close c_assignment_status;
3168
3169 l_tab_counter := l_tab_counter + 1;
3170 l_chg_evt_tab(l_tab_counter) := 'COAS';
3171 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3172 l_prmtr_02_tab(l_tab_counter) := null;
3173 l_prmtr_03_tab(l_tab_counter) := null;
3174 l_prmtr_04_tab(l_tab_counter) := null;
3175 l_prmtr_05_tab(l_tab_counter) := null;
3176 l_prmtr_06_tab(l_tab_counter) := null;
3177 l_prmtr_07_tab(l_tab_counter) := null;
3178 l_old_val1(l_tab_counter) := l_old_assignment_status;
3179 l_new_val1(l_tab_counter) := l_new_assignment_status;
3180 end if;
3181 if nvl(p_old_rec.hourly_salaried_code, '$')
3182 <> nvl(p_new_rec.hourly_salaried_code, '$') then
3183 l_tab_counter := l_tab_counter + 1;
3184 l_chg_evt_tab(l_tab_counter) := 'COHS';
3185 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3186 l_prmtr_02_tab(l_tab_counter) := null;
3187 l_prmtr_03_tab(l_tab_counter) := null;
3188 l_prmtr_04_tab(l_tab_counter) := null;
3189 l_prmtr_05_tab(l_tab_counter) := null;
3190 l_prmtr_06_tab(l_tab_counter) := null;
3191 l_prmtr_07_tab(l_tab_counter) := null;
3192 l_old_val1(l_tab_counter) := p_old_rec.hourly_salaried_code;
3193 l_new_val1(l_tab_counter) := p_new_rec.hourly_salaried_code;
3194 end if;
3195 if nvl(p_old_rec.location_id, 1)
3196 <> nvl(p_new_rec.location_id, 1) then
3197 -- read old and new locations
3198 open c_location(p_old_rec.location_id);
3199 fetch c_location into l_old_location;
3200 close c_location;
3201 open c_location(p_new_rec.location_id);
3202 fetch c_location into l_new_location;
3203 close c_location;
3204 l_tab_counter := l_tab_counter + 1;
3205 l_chg_evt_tab(l_tab_counter) := 'COAL';
3206 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3207 l_prmtr_02_tab(l_tab_counter) := null;
3208 l_prmtr_03_tab(l_tab_counter) := null;
3209 l_prmtr_04_tab(l_tab_counter) := null;
3210 l_prmtr_05_tab(l_tab_counter) := null;
3211 l_prmtr_06_tab(l_tab_counter) := null;
3212 l_prmtr_07_tab(l_tab_counter) := null;
3213 l_old_val1(l_tab_counter) := l_old_location;
3214 l_new_val1(l_tab_counter) := l_new_location;
3215 end if;
3216
3217 if nvl(p_old_rec.position_id, 1)
3218 <> nvl(p_new_rec.position_id, 1) then
3219 -- read old and new position
3220 open c_position(p_old_rec.position_id , p_new_rec.effective_start_date );
3221 fetch c_position into l_old_position;
3222 close c_position;
3223 open c_position(p_new_rec.position_id , p_new_rec.effective_start_date );
3224 fetch c_position into l_new_position;
3225 close c_position;
3226 l_tab_counter := l_tab_counter + 1;
3227 l_chg_evt_tab(l_tab_counter) := 'COAPOS';
3228 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3229 l_prmtr_02_tab(l_tab_counter) := null;
3230 l_prmtr_03_tab(l_tab_counter) := null;
3231 l_prmtr_04_tab(l_tab_counter) := null;
3232 l_prmtr_05_tab(l_tab_counter) := null;
3233 l_prmtr_06_tab(l_tab_counter) := null;
3234 l_prmtr_07_tab(l_tab_counter) := null;
3235 l_old_val1(l_tab_counter) := l_old_position;
3236 l_new_val1(l_tab_counter) := l_new_position;
3237 end if;
3238
3239 if nvl(p_old_rec.employment_category, '$')
3240 <> nvl(p_new_rec.employment_category, '$') then
3241 l_tab_counter := l_tab_counter + 1;
3242 l_chg_evt_tab(l_tab_counter) := 'COEC';
3243 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3244 l_prmtr_02_tab(l_tab_counter) := null;
3245 l_prmtr_03_tab(l_tab_counter) := null;
3246 l_prmtr_04_tab(l_tab_counter) := null;
3247 l_prmtr_05_tab(l_tab_counter) := null;
3248 l_prmtr_06_tab(l_tab_counter) := null;
3249 l_prmtr_07_tab(l_tab_counter) := null;
3250 l_old_val1(l_tab_counter) := HR_GENERAL.DECODE_LOOKUP('EMP_CAT',p_old_rec.employment_category); --bug#4699913
3251 l_new_val1(l_tab_counter) := HR_GENERAL.DECODE_LOOKUP('EMP_CAT',p_new_rec.employment_category); --bug#4699913;
3252 end if;
3253 if nvl(p_old_rec.assignment_type, '$') <> 'B' and p_new_rec.assignment_type = 'B' then
3254 l_tab_counter := l_tab_counter + 1;
3255 l_chg_evt_tab(l_tab_counter) := 'ABA';
3256 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3257 l_prmtr_02_tab(l_tab_counter) := null;
3258 l_prmtr_03_tab(l_tab_counter) := null;
3259 l_prmtr_04_tab(l_tab_counter) := null;
3260 l_prmtr_05_tab(l_tab_counter) := null;
3261 l_prmtr_06_tab(l_tab_counter) := null;
3262 l_prmtr_07_tab(l_tab_counter) := null;
3263 l_old_val1(l_tab_counter) := null;
3264 l_new_val1(l_tab_counter) := null;
3265 end if;
3266 if nvl(p_old_rec.ass_attribute1, '$')
3267 <> nvl(p_new_rec.ass_attribute1, '$') then
3268 l_tab_counter := l_tab_counter + 1;
3269 l_chg_evt_tab(l_tab_counter) := 'COAF01';
3270 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3271 l_prmtr_02_tab(l_tab_counter) := null;
3272 l_prmtr_03_tab(l_tab_counter) := null;
3273 l_prmtr_04_tab(l_tab_counter) := null;
3274 l_prmtr_05_tab(l_tab_counter) := null;
3275 l_prmtr_06_tab(l_tab_counter) := null;
3276 l_prmtr_07_tab(l_tab_counter) := null;
3277 l_old_val1(l_tab_counter) := p_old_rec.ass_attribute1;
3278 l_new_val1(l_tab_counter) := p_new_rec.ass_attribute1;
3279 end if;
3280 if nvl(p_old_rec.ass_attribute2, '$')
3281 <> nvl(p_new_rec.ass_attribute2, '$') then
3282 l_tab_counter := l_tab_counter + 1;
3283 l_chg_evt_tab(l_tab_counter) := 'COAF02';
3284 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3285 l_prmtr_02_tab(l_tab_counter) := null;
3286 l_prmtr_03_tab(l_tab_counter) := null;
3287 l_prmtr_04_tab(l_tab_counter) := null;
3288 l_prmtr_05_tab(l_tab_counter) := null;
3289 l_prmtr_06_tab(l_tab_counter) := null;
3290 l_prmtr_07_tab(l_tab_counter) := null;
3291 l_old_val1(l_tab_counter) := p_old_rec.ass_attribute2;
3292 l_new_val1(l_tab_counter) := p_new_rec.ass_attribute2;
3293 end if;
3294 if nvl(p_old_rec.ass_attribute3, '$')
3295 <> nvl(p_new_rec.ass_attribute3, '$') then
3296 l_tab_counter := l_tab_counter + 1;
3297 l_chg_evt_tab(l_tab_counter) := 'COAF03';
3298 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3299 l_prmtr_02_tab(l_tab_counter) := null;
3300 l_prmtr_03_tab(l_tab_counter) := null;
3301 l_prmtr_04_tab(l_tab_counter) := null;
3302 l_prmtr_05_tab(l_tab_counter) := null;
3303 l_prmtr_06_tab(l_tab_counter) := null;
3304 l_prmtr_07_tab(l_tab_counter) := null;
3305 l_old_val1(l_tab_counter) := p_old_rec.ass_attribute3;
3306 l_new_val1(l_tab_counter) := p_new_rec.ass_attribute3;
3307 end if;
3308 if nvl(p_old_rec.ass_attribute4, '$')
3309 <> nvl(p_new_rec.ass_attribute4, '$') then
3310 l_tab_counter := l_tab_counter + 1;
3311 l_chg_evt_tab(l_tab_counter) := 'COAF04';
3312 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3313 l_prmtr_02_tab(l_tab_counter) := null;
3314 l_prmtr_03_tab(l_tab_counter) := null;
3315 l_prmtr_04_tab(l_tab_counter) := null;
3316 l_prmtr_05_tab(l_tab_counter) := null;
3317 l_prmtr_06_tab(l_tab_counter) := null;
3318 l_prmtr_07_tab(l_tab_counter) := null;
3319 l_old_val1(l_tab_counter) := p_old_rec.ass_attribute4;
3320 l_new_val1(l_tab_counter) := p_new_rec.ass_attribute4;
3321 end if;
3322 if nvl(p_old_rec.ass_attribute5, '$')
3323 <> nvl(p_new_rec.ass_attribute5, '$') then
3324 l_tab_counter := l_tab_counter + 1;
3325 l_chg_evt_tab(l_tab_counter) := 'COAF05';
3326 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3327 l_prmtr_02_tab(l_tab_counter) := null;
3328 l_prmtr_03_tab(l_tab_counter) := null;
3329 l_prmtr_04_tab(l_tab_counter) := null;
3330 l_prmtr_05_tab(l_tab_counter) := null;
3331 l_prmtr_06_tab(l_tab_counter) := null;
3332 l_prmtr_07_tab(l_tab_counter) := null;
3333 l_old_val1(l_tab_counter) := p_old_rec.ass_attribute5;
3334 l_new_val1(l_tab_counter) := p_new_rec.ass_attribute5;
3335 end if;
3336 if nvl(p_old_rec.ass_attribute6, '$')
3337 <> nvl(p_new_rec.ass_attribute6, '$') then
3338 l_tab_counter := l_tab_counter + 1;
3339 l_chg_evt_tab(l_tab_counter) := 'COAF06';
3340 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3341 l_prmtr_02_tab(l_tab_counter) := null;
3342 l_prmtr_03_tab(l_tab_counter) := null;
3343 l_prmtr_04_tab(l_tab_counter) := null;
3344 l_prmtr_05_tab(l_tab_counter) := null;
3345 l_prmtr_06_tab(l_tab_counter) := null;
3346 l_prmtr_07_tab(l_tab_counter) := null;
3347 l_old_val1(l_tab_counter) := p_old_rec.ass_attribute6;
3348 l_new_val1(l_tab_counter) := p_new_rec.ass_attribute6;
3349 end if;
3350 if nvl(p_old_rec.ass_attribute7, '$')
3351 <> nvl(p_new_rec.ass_attribute7, '$') then
3352 l_tab_counter := l_tab_counter + 1;
3353 l_chg_evt_tab(l_tab_counter) := 'COAF07';
3354 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3355 l_prmtr_02_tab(l_tab_counter) := null;
3356 l_prmtr_03_tab(l_tab_counter) := null;
3357 l_prmtr_04_tab(l_tab_counter) := null;
3358 l_prmtr_05_tab(l_tab_counter) := null;
3359 l_prmtr_06_tab(l_tab_counter) := null;
3360 l_prmtr_07_tab(l_tab_counter) := null;
3361 l_old_val1(l_tab_counter) := p_old_rec.ass_attribute7;
3362 l_new_val1(l_tab_counter) := p_new_rec.ass_attribute7;
3363 end if;
3364 if nvl(p_old_rec.ass_attribute8, '$')
3365 <> nvl(p_new_rec.ass_attribute8, '$') then
3366 l_tab_counter := l_tab_counter + 1;
3367 l_chg_evt_tab(l_tab_counter) := 'COAF08';
3368 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3369 l_prmtr_02_tab(l_tab_counter) := null;
3370 l_prmtr_03_tab(l_tab_counter) := null;
3371 l_prmtr_04_tab(l_tab_counter) := null;
3372 l_prmtr_05_tab(l_tab_counter) := null;
3373 l_prmtr_06_tab(l_tab_counter) := null;
3374 l_prmtr_07_tab(l_tab_counter) := null;
3375 l_old_val1(l_tab_counter) := p_old_rec.ass_attribute8;
3376 l_new_val1(l_tab_counter) := p_new_rec.ass_attribute8;
3377 end if;
3378 if nvl(p_old_rec.ass_attribute9, '$')
3379 <> nvl(p_new_rec.ass_attribute9, '$') then
3380 l_tab_counter := l_tab_counter + 1;
3381 l_chg_evt_tab(l_tab_counter) := 'COAF09';
3382 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3383 l_prmtr_02_tab(l_tab_counter) := null;
3384 l_prmtr_03_tab(l_tab_counter) := null;
3385 l_prmtr_04_tab(l_tab_counter) := null;
3386 l_prmtr_05_tab(l_tab_counter) := null;
3387 l_prmtr_06_tab(l_tab_counter) := null;
3388 l_prmtr_07_tab(l_tab_counter) := null;
3389 l_old_val1(l_tab_counter) := p_old_rec.ass_attribute9;
3390 l_new_val1(l_tab_counter) := p_new_rec.ass_attribute9;
3391 end if;
3392 if nvl(p_old_rec.ass_attribute10, '$')
3393 <> nvl(p_new_rec.ass_attribute10, '$') then
3394 l_tab_counter := l_tab_counter + 1;
3395 l_chg_evt_tab(l_tab_counter) := 'COAF10';
3396 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3397 l_prmtr_02_tab(l_tab_counter) := null;
3398 l_prmtr_03_tab(l_tab_counter) := null;
3399 l_prmtr_04_tab(l_tab_counter) := null;
3400 l_prmtr_05_tab(l_tab_counter) := null;
3401 l_prmtr_06_tab(l_tab_counter) := null;
3402 l_prmtr_07_tab(l_tab_counter) := null;
3403 l_old_val1(l_tab_counter) := p_old_rec.ass_attribute10;
3404 l_new_val1(l_tab_counter) := p_new_rec.ass_attribute10;
3405 end if;
3406 if (nvl(p_old_rec.payroll_id, -1)
3407 <> nvl(p_new_rec.payroll_id, -1))
3408 --RCHASE make sure the payroll is a change and not an add
3409 and (p_old_rec.payroll_id is not null) then
3410 open c_payroll_name(p_old_rec.payroll_id, p_new_rec.effective_start_date);
3411 fetch c_payroll_name into l_old_payroll_name;
3412 close c_payroll_name;
3413 open c_payroll_name(p_new_rec.payroll_id, p_new_rec.effective_start_date);
3414 fetch c_payroll_name into l_new_payroll_name;
3415 close c_payroll_name;
3416 l_tab_counter := l_tab_counter + 1;
3417 l_chg_evt_tab(l_tab_counter) := 'COPP';
3418 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3419 l_prmtr_02_tab(l_tab_counter) := p_old_rec.payroll_id;
3420 l_prmtr_03_tab(l_tab_counter) := p_new_rec.payroll_id;
3421 l_prmtr_04_tab(l_tab_counter) := null;
3422 l_prmtr_05_tab(l_tab_counter) := null;
3423 l_prmtr_06_tab(l_tab_counter) := null;
3424 l_prmtr_07_tab(l_tab_counter) := null;
3425 l_old_val1(l_tab_counter) := l_old_payroll_name;
3426 l_new_val1(l_tab_counter) := l_new_payroll_name;
3427 end if;
3428 if (nvl(p_old_rec.grade_id, -1)
3429 <> nvl(p_new_rec.grade_id, -1)) then
3430 open c_grade_name(p_old_rec.grade_id, p_new_rec.effective_start_date);
3431 fetch c_grade_name into l_old_grade_name;
3432 close c_grade_name;
3433 open c_grade_name(p_new_rec.grade_id, p_new_rec.effective_start_date);
3434 fetch c_grade_name into l_new_grade_name;
3435 close c_grade_name;
3436 l_tab_counter := l_tab_counter + 1;
3437 l_chg_evt_tab(l_tab_counter) := 'CGRDID';
3438 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3439 l_prmtr_02_tab(l_tab_counter) := p_old_rec.grade_id;
3440 l_prmtr_03_tab(l_tab_counter) := p_new_rec.grade_id;
3441 l_prmtr_04_tab(l_tab_counter) := null;
3442 l_prmtr_05_tab(l_tab_counter) := null;
3443 l_prmtr_06_tab(l_tab_counter) := null;
3444 l_prmtr_07_tab(l_tab_counter) := null;
3445 l_old_val1(l_tab_counter) := l_old_grade_name;
3446 l_new_val1(l_tab_counter) := l_new_grade_name;
3447 end if;
3448
3449 --Start Bug 1554477
3450 if nvl(p_old_rec.normal_hours, '0')
3451 <> nvl(p_new_rec.normal_hours, '0') then
3452 l_tab_counter := l_tab_counter + 1;
3453 l_chg_evt_tab(l_tab_counter) := 'CWH';
3454 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3455 l_prmtr_02_tab(l_tab_counter) := null;
3456 l_prmtr_03_tab(l_tab_counter) := null;
3457 l_prmtr_04_tab(l_tab_counter) := null;
3458 l_prmtr_05_tab(l_tab_counter) := null;
3459 l_prmtr_06_tab(l_tab_counter) := null;
3460 l_prmtr_07_tab(l_tab_counter) := null;
3461 l_old_val1(l_tab_counter) := p_old_rec.normal_hours;
3462 l_new_val1(l_tab_counter) := p_new_rec.normal_hours;
3463 end if;
3464 --End Bug 1554477
3465 --
3466 -- vjhanak
3467 if nvl(p_old_rec.soft_coding_keyflex_id, '0')
3468 <> nvl(p_new_rec.soft_coding_keyflex_id, '0') then
3469 l_tab_counter := l_tab_counter + 1;
3470 l_chg_evt_tab(l_tab_counter) := 'COSCKFF';
3471 l_prmtr_01_tab(l_tab_counter) := p_old_rec.assignment_id;
3472 l_prmtr_02_tab(l_tab_counter) := fnd_date.date_to_canonical(TRUNC(p_old_rec.effective_start_date));
3473 l_prmtr_03_tab(l_tab_counter) := fnd_date.date_to_canonical(TRUNC(p_old_rec.effective_end_date));
3474 l_prmtr_04_tab(l_tab_counter) := fnd_date.date_to_canonical(TRUNC(p_new_rec.effective_start_date));
3475 l_prmtr_05_tab(l_tab_counter) := fnd_date.date_to_canonical(TRUNC(p_new_rec.effective_end_date));
3476 l_prmtr_06_tab(l_tab_counter) := null;
3477 l_prmtr_07_tab(l_tab_counter) := null;
3478 l_old_val1(l_tab_counter) := p_old_rec.soft_coding_keyflex_id;
3479 l_new_val1(l_tab_counter) := p_new_rec.soft_coding_keyflex_id;
3480 end if;
3481 -- vjhanak
3482
3483 elsif p_event = 'INSERT' then
3484 if p_new_rec.assignment_type = 'B' then
3485 --l_person_id := p_new_rec.person_id;
3486 --l_business_group_id := p_new_rec.business_group_id;
3487 l_tab_counter := l_tab_counter + 1;
3488 l_chg_evt_tab(l_tab_counter) := 'ABA';
3489 l_prmtr_01_tab(l_tab_counter) := p_new_rec.assignment_id;
3490 l_prmtr_02_tab(l_tab_counter) := null;
3491 l_prmtr_03_tab(l_tab_counter) := null;
3492 l_prmtr_04_tab(l_tab_counter) := null;
3493 l_prmtr_05_tab(l_tab_counter) := null;
3494 l_prmtr_06_tab(l_tab_counter) := null;
3495 l_prmtr_07_tab(l_tab_counter) := null;
3496 l_old_val1(l_tab_counter) := null;
3497 l_new_val1(l_tab_counter) := null;
3498 end if;
3499
3500 -- rpinjala
3501 IF p_new_rec.assignment_type = 'E' AND
3502 nvl(p_new_rec.primary_flag,'N') = 'N' THEN
3503 l_tab_counter := l_tab_counter + 1;
3504 l_chg_evt_tab(l_tab_counter) := 'ASEA';
3505 l_prmtr_01_tab(l_tab_counter) := p_new_rec.assignment_id;
3506 l_prmtr_02_tab(l_tab_counter) := null;
3507 l_prmtr_03_tab(l_tab_counter) := null;
3508 l_prmtr_04_tab(l_tab_counter) := null;
3509 l_prmtr_05_tab(l_tab_counter) := null;
3510 l_prmtr_06_tab(l_tab_counter) := null;
3511 l_prmtr_07_tab(l_tab_counter) := null;
3512 l_old_val1(l_tab_counter) := null;
3513 l_new_val1(l_tab_counter) := p_new_rec.effective_start_date;
3514 END IF;
3515 -- rpinjala
3516
3517 --Start Bug 1554477
3518 if p_new_rec.normal_hours is not null then
3519 l_tab_counter := l_tab_counter + 1;
3520 l_chg_evt_tab(l_tab_counter) := 'CWH';
3521 l_prmtr_01_tab(l_tab_counter) := p_new_rec.assignment_id;
3522 l_prmtr_02_tab(l_tab_counter) := null;
3523 l_prmtr_03_tab(l_tab_counter) := null;
3524 l_prmtr_04_tab(l_tab_counter) := null;
3525 l_prmtr_05_tab(l_tab_counter) := null;
3526 l_prmtr_06_tab(l_tab_counter) := null;
3527 l_prmtr_07_tab(l_tab_counter) := null;
3528 l_old_val1(l_tab_counter) := null;
3529 l_new_val1(l_tab_counter) := p_new_rec.normal_hours;
3530 end if;
3531 --End Bug 1554477
3532 --
3533 end if;
3534 --
3535 for l_count in 1..l_chg_evt_tab.count loop
3536 if change_event_is_enabled(l_chg_evt_tab(l_count),p_new_rec.effective_start_date) then
3537 ben_ext_chg_evt_api.create_ext_chg_evt
3538 (p_validate => FALSE
3539 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
3540 ,p_chg_evt_cd => l_chg_evt_tab(l_count)
3541 ,p_chg_eff_dt => p_new_rec.effective_start_date
3542 ,p_prmtr_01 => l_prmtr_01_tab(l_count)
3543 ,p_prmtr_02 => l_prmtr_02_tab(l_count)
3544 ,p_prmtr_03 => l_prmtr_03_tab(l_count)
3545 ,p_prmtr_04 => l_prmtr_04_tab(l_count)
3546 ,p_prmtr_05 => l_prmtr_05_tab(l_count)
3547 ,p_prmtr_06 => l_prmtr_06_tab(l_count)
3548 ,p_prmtr_07 => l_prmtr_07_tab(l_count)
3549 ,p_prmtr_10 => p_new_rec.update_mode
3550 ,p_person_id => p_new_rec.person_id
3551 ,p_business_group_id => p_new_rec.business_group_id
3552 ,p_object_version_number => l_object_version_number
3553 ,p_effective_date => p_new_rec.effective_start_date
3554 ,p_new_val1 => l_new_val1(l_count)
3555 ,p_old_val1 => l_old_val1(l_count)
3556 );
3557 end if;
3558 end loop;
3559 --
3560 hr_utility.set_location('Exiting:'|| l_proc, 99);
3561 --
3562 end log_asg_chg;
3563 --
3564 procedure log_abs_chg
3565 (p_event in varchar2
3566 ,p_old_rec in g_abs_rec_type
3567 ,p_new_rec in g_abs_rec_type
3568 ) is
3569 --
3570 l_chg_evt_tab g_char_tab_type;
3571 l_prmtr_01_tab g_char_tab_type;
3572 l_prmtr_02_tab g_char_tab_type;
3573 l_prmtr_03_tab g_char_tab_type;
3574 l_prmtr_04_tab g_char_tab_type;
3575 l_prmtr_05_tab g_char_tab_type;
3576 l_prmtr_06_tab g_char_tab_type;
3577 l_prmtr_07_tab g_char_tab_type;
3578 l_new_val1 g_new_val;
3579 l_new_val2 g_new_val;
3580 l_new_val3 g_new_val;
3581 l_new_val4 g_new_val;
3582 l_new_val5 g_new_val;
3583 l_new_val6 g_new_val;
3584 l_old_val1 g_old_val;
3585 l_old_val2 g_old_val;
3586 l_old_val3 g_old_val;
3587 l_old_val4 g_old_val;
3588 l_old_val5 g_old_val;
3589 l_old_val6 g_old_val;
3590 l_tab_counter binary_integer := 0;
3591 l_chg_eff_dt date;
3592 l_person_id number;
3593 l_business_group_id number;
3594 l_count number;
3595 l_ext_chg_evt_log_id number;
3596 l_object_version_number number;
3597 --
3598 l_old_absence_type varchar2(100);
3599 l_new_absence_type varchar2(100);
3600 l_old_absence_reason varchar2(100);
3601 l_new_absence_reason varchar2(100);
3602 --
3603 l_proc varchar2(80) := 'ben_ext_chlg.log_abs_chg';
3604 --
3605 -- cursor definitions
3606 --
3607 cursor c_absence_type(p_absence_attendance_type_id number)
3608 is
3609 select aat.name
3610 from per_absence_attendance_types aat
3611 where aat.absence_attendance_type_id = p_absence_attendance_type_id;
3612
3613 cursor c_absence_reason(p_abs_attendance_reason_id number)
3614 is
3615 select aar.name
3616 from per_abs_attendance_reasons aar
3617 where aar.abs_attendance_reason_id = p_abs_attendance_reason_id;
3618 --
3619 begin
3620 --
3621 hr_utility.set_location('Entering:'|| l_proc, 10);
3622 --
3623 if p_event = 'UPDATE' then
3624 --
3625 l_business_group_id := p_new_rec.business_group_id;
3626 l_person_id := p_new_rec.person_id;
3627 if nvl(p_old_rec.abs_attendance_reason_id, 1)
3628 <> nvl(p_new_rec.abs_attendance_reason_id, 1) then
3629
3630 -- get old and new absence reason
3631 open c_absence_reason(p_old_rec.abs_attendance_reason_id);
3632 fetch c_absence_reason into l_old_absence_reason;
3633 close c_absence_reason;
3634 open c_absence_reason(p_new_rec.abs_attendance_reason_id);
3635 fetch c_absence_reason into l_new_absence_reason;
3636 close c_absence_reason;
3637
3638 l_chg_eff_dt := trunc(sysdate);
3639 l_tab_counter := l_tab_counter + 1;
3640 l_chg_evt_tab(l_tab_counter) := 'COAR';
3641 l_prmtr_01_tab(l_tab_counter) := p_old_rec.absence_attendance_id;
3642 l_prmtr_02_tab(l_tab_counter) := null;
3643 l_prmtr_03_tab(l_tab_counter) := null;
3644 l_prmtr_04_tab(l_tab_counter) := null;
3645 l_prmtr_05_tab(l_tab_counter) := null;
3646 l_prmtr_06_tab(l_tab_counter) := null;
3647 l_prmtr_07_tab(l_tab_counter) := null;
3648 l_old_val1(l_tab_counter) := l_old_absence_reason;
3649 l_old_val2(l_tab_counter) := null;
3650 l_old_val3(l_tab_counter) := null;
3651 l_old_val4(l_tab_counter) := null;
3652 l_new_val1(l_tab_counter) := l_new_absence_reason;
3653 l_new_val2(l_tab_counter) := null;
3654 l_new_val3(l_tab_counter) := null;
3655 l_new_val4(l_tab_counter) := null;
3656 end if;
3657 if nvl(p_old_rec.date_start, to_date('01/01/0001', 'dd/mm/yyyy'))
3658 <> nvl(p_new_rec.date_start, to_date('01/01/0001', 'dd/mm/yyyy')) then
3659 l_chg_eff_dt := trunc(sysdate);
3660 l_tab_counter := l_tab_counter + 1;
3661 l_chg_evt_tab(l_tab_counter) := 'COAAS';
3662 l_prmtr_01_tab(l_tab_counter) := p_old_rec.absence_attendance_id;
3663 l_prmtr_02_tab(l_tab_counter) := null;
3664 l_prmtr_03_tab(l_tab_counter) := null;
3665 l_prmtr_04_tab(l_tab_counter) := null;
3666 l_prmtr_05_tab(l_tab_counter) := null;
3667 l_prmtr_06_tab(l_tab_counter) := null;
3668 l_prmtr_07_tab(l_tab_counter) := null;
3669 l_old_val1(l_tab_counter) := to_char(p_old_rec.date_start, 'mm/dd/yyyy');
3670 l_old_val2(l_tab_counter) := null;
3671 l_old_val3(l_tab_counter) := null;
3672 l_old_val4(l_tab_counter) := null;
3673 l_new_val1(l_tab_counter) := to_char(p_new_rec.date_start, 'mm/dd/yyyy');
3674 l_new_val2(l_tab_counter) := null;
3675 l_new_val3(l_tab_counter) := null;
3676 l_new_val4(l_tab_counter) := null;
3677 end if;
3678 if nvl(p_old_rec.date_end, to_date('01/01/0001', 'dd/mm/yyyy'))
3679 <> nvl(p_new_rec.date_end, to_date('01/01/0001', 'dd/mm/yyyy')) then
3680 l_chg_eff_dt := trunc(sysdate);
3681 l_tab_counter := l_tab_counter + 1;
3682 l_chg_evt_tab(l_tab_counter) := 'COAAE';
3683 l_prmtr_01_tab(l_tab_counter) := p_old_rec.absence_attendance_id;
3684 l_prmtr_02_tab(l_tab_counter) := null;
3685 l_prmtr_03_tab(l_tab_counter) := null;
3686 l_prmtr_04_tab(l_tab_counter) := null;
3687 l_prmtr_05_tab(l_tab_counter) := null;
3688 l_prmtr_06_tab(l_tab_counter) := null;
3689 l_prmtr_07_tab(l_tab_counter) := null;
3690 l_old_val1(l_tab_counter) := to_char(p_old_rec.date_end, 'mm/dd/yyyy');
3691 l_old_val2(l_tab_counter) := null;
3692 l_old_val3(l_tab_counter) := null;
3693 l_old_val4(l_tab_counter) := null;
3694 l_new_val1(l_tab_counter) := to_char(p_new_rec.date_end, 'mm/dd/yyyy');
3695 l_new_val2(l_tab_counter) := null;
3696 l_new_val3(l_tab_counter) := null;
3697 l_new_val4(l_tab_counter) := null;
3698 end if;
3699 --
3700 elsif p_event = 'INSERT' then
3701 --
3702 open c_absence_type(p_new_rec.absence_attendance_type_id);
3703 fetch c_absence_type into l_new_absence_type;
3704 close c_absence_type;
3705 open c_absence_reason(p_new_rec.abs_attendance_reason_id);
3706 fetch c_absence_reason into l_new_absence_reason;
3707 close c_absence_reason;
3708 --
3709 l_business_group_id := p_new_rec.business_group_id;
3710 l_person_id := p_new_rec.person_id;
3711 l_chg_eff_dt := trunc(nvl(nvl(p_new_rec.date_start,p_new_rec.date_projected_start), sysdate));
3712 l_tab_counter := l_tab_counter + 1;
3713 l_chg_evt_tab(l_tab_counter) := 'AA';
3714 l_prmtr_01_tab(l_tab_counter) := p_new_rec.absence_attendance_id;
3715 l_prmtr_02_tab(l_tab_counter) := null;
3716 l_prmtr_03_tab(l_tab_counter) := null;
3717 l_prmtr_04_tab(l_tab_counter) := null;
3718 l_prmtr_05_tab(l_tab_counter) := null;
3719 l_prmtr_06_tab(l_tab_counter) := null;
3720 l_prmtr_07_tab(l_tab_counter) := null;
3721 l_old_val1(l_tab_counter) := null;
3722 l_old_val2(l_tab_counter) := null;
3723 l_old_val3(l_tab_counter) := null;
3724 l_old_val4(l_tab_counter) := null;
3725 l_new_val1(l_tab_counter) := l_new_absence_type;
3726 l_new_val2(l_tab_counter) := l_new_absence_reason;
3727 l_new_val3(l_tab_counter) := p_new_rec.date_start;
3728 l_new_val4(l_tab_counter) := p_new_rec.date_end;
3729 --
3730 elsif p_event = 'DELETE' then
3731 --
3732 open c_absence_type(p_old_rec.absence_attendance_type_id);
3733 fetch c_absence_type into l_old_absence_type;
3734 close c_absence_type;
3735 open c_absence_reason(p_old_rec.abs_attendance_reason_id);
3736 fetch c_absence_reason into l_old_absence_reason;
3737 close c_absence_reason;
3738 --
3739 l_business_group_id := p_old_rec.business_group_id;
3740 l_person_id := p_old_rec.person_id;
3741 l_chg_eff_dt := trunc(sysdate);
3742 l_tab_counter := l_tab_counter + 1;
3743 l_chg_evt_tab(l_tab_counter) := 'DA';
3744 l_prmtr_01_tab(l_tab_counter) := p_old_rec.absence_attendance_id;
3745 l_prmtr_02_tab(l_tab_counter) := null;
3746 l_prmtr_03_tab(l_tab_counter) := null;
3747 l_prmtr_04_tab(l_tab_counter) := null;
3748 l_prmtr_05_tab(l_tab_counter) := null;
3749 l_prmtr_06_tab(l_tab_counter) := null;
3750 l_prmtr_07_tab(l_tab_counter) := null;
3751 l_old_val1(l_tab_counter) := l_old_absence_type;
3752 l_old_val2(l_tab_counter) := l_old_absence_reason;
3753 l_old_val3(l_tab_counter) := p_old_rec.date_start;
3754 l_old_val4(l_tab_counter) := p_old_rec.date_end;
3755 l_new_val1(l_tab_counter) := null;
3756 l_new_val2(l_tab_counter) := null;
3757 l_new_val3(l_tab_counter) := null;
3758 l_new_val4(l_tab_counter) := null;
3759 --
3760 end if;
3761 --
3762 --
3763 for l_count in 1..l_chg_evt_tab.count loop
3764 if change_event_is_enabled(l_chg_evt_tab(l_count),l_chg_eff_dt) then
3765 ben_ext_chg_evt_api.create_ext_chg_evt
3766 (p_validate => FALSE
3767 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
3768 ,p_chg_evt_cd => l_chg_evt_tab(l_count)
3769 ,p_chg_eff_dt => l_chg_eff_dt
3770 ,p_prmtr_01 => l_prmtr_01_tab(l_count)
3771 ,p_prmtr_02 => l_prmtr_02_tab(l_count)
3772 ,p_prmtr_03 => l_prmtr_03_tab(l_count)
3773 ,p_prmtr_04 => l_prmtr_04_tab(l_count)
3774 ,p_prmtr_05 => l_prmtr_05_tab(l_count)
3775 ,p_prmtr_06 => l_prmtr_06_tab(l_count)
3776 ,p_prmtr_07 => l_prmtr_07_tab(l_count)
3777 ,p_prmtr_10 => p_new_rec.update_mode
3778 ,p_person_id => l_person_id
3779 ,p_business_group_id => l_business_group_id
3780 ,p_object_version_number => l_object_version_number
3781 ,p_effective_date => l_chg_eff_dt
3782 ,p_new_val1 => l_new_val1(l_count)
3783 ,p_new_val2 => l_new_val2(l_count)
3784 ,p_new_val3 => l_new_val3(l_count)
3785 ,p_new_val4 => l_new_val4(l_count)
3786 ,p_old_val1 => l_old_val1(l_count)
3787 ,p_old_val2 => l_old_val2(l_count)
3788 ,p_old_val3 => l_old_val3(l_count)
3789 ,p_old_val4 => l_old_val4(l_count)
3790 );
3791 end if;
3792 end loop;
3793 --
3794 hr_utility.set_location('Exiting:'|| l_proc, 99);
3795 --
3796 end log_abs_chg;
3797 --
3798 --
3799 procedure log_benefit_chg(
3800 p_action in varchar2, -- CREATE, REINSTATE, UPDATE, or DELETE
3801 p_pl_id in number default null,
3802 p_old_pl_id in number default null,
3803 p_oipl_id in number default null,
3804 p_old_oipl_id in number default null,
3805 p_enrt_cvg_strt_dt in date default null,
3806 p_enrt_cvg_end_dt in date default null,
3807 p_old_enrt_cvg_strt_dt in date default null,
3808 p_old_enrt_cvg_end_dt in date default null,
3809 p_bnft_amt in number default null,
3810 p_old_bnft_amt in number default null,
3811 p_pen_attribute1 in varchar2 default null,
3812 p_pen_attribute2 in varchar2 default null,
3813 p_pen_attribute3 in varchar2 default null,
3814 p_pen_attribute4 in varchar2 default null,
3815 p_pen_attribute5 in varchar2 default null,
3816 p_pen_attribute6 in varchar2 default null,
3817 p_pen_attribute7 in varchar2 default null,
3818 p_pen_attribute8 in varchar2 default null,
3819 p_pen_attribute9 in varchar2 default null,
3820 p_pen_attribute10 in varchar2 default null,
3821 p_old_pen_attribute1 in varchar2 default null,
3822 p_old_pen_attribute2 in varchar2 default null,
3823 p_old_pen_attribute3 in varchar2 default null,
3824 p_old_pen_attribute4 in varchar2 default null,
3825 p_old_pen_attribute5 in varchar2 default null,
3826 p_old_pen_attribute6 in varchar2 default null,
3827 p_old_pen_attribute7 in varchar2 default null,
3828 p_old_pen_attribute8 in varchar2 default null,
3829 p_old_pen_attribute9 in varchar2 default null,
3830 p_old_pen_attribute10 in varchar2 default null,
3831 p_effective_start_date in date default null,
3832 p_effective_end_date in date default null,
3833 p_prtt_enrt_rslt_id in number default null,
3834 p_old_prtt_enrt_rslt_id in number default null,
3835 p_per_in_ler_id in number default null,
3836 p_old_per_in_ler_id in number default null,
3837 p_person_id in number,
3838 p_business_group_id in number,
3839 p_effective_date in date ) is
3840
3841 -- Local variable declarations
3842 --
3843 l_proc varchar2(72) := 'ben_ext_chlg.log_benefit_chg';
3844
3845 l_new_plan_name ben_pl_f.name%type;
3846 l_old_plan_name ben_pl_f.name%type;
3847 l_new_option_name ben_opt_f.name%type;
3848 l_old_option_name ben_opt_f.name%type;
3849 --
3850 l_ext_chg_evt_log_id number;
3851 l_object_version_number number;
3852 --
3853 -- Cursor declarations.
3854 cursor c_plan_name(p_pl_id number)
3855 is
3856 select name
3857 from ben_pl_f pl
3858 where pl.pl_id = p_pl_id
3859 and p_effective_date between pl.effective_start_date and pl.effective_end_date;
3860
3861 cursor c_option_name(p_oipl_id number)
3862 is
3863 select opt.name
3864 from ben_oipl_f cop,
3865 ben_opt_f opt
3866 where cop.oipl_id = p_oipl_id
3867 and p_effective_date between cop.effective_start_date and cop.effective_end_date
3868 and cop.opt_id = opt.opt_id
3869 and p_effective_date between opt.effective_start_date and opt.effective_end_date;
3870 --
3871 begin
3872 --
3873 hr_utility.set_location('Entering:'||l_proc, 10);
3874 --
3875 -- Get the new values to be store or updated
3876 --
3877 if p_prtt_enrt_rslt_id is not null then
3878 -- fetch descriptions for old and new values.
3879 null;
3880 end if;
3881 --
3882 if p_action = 'CREATE' then
3883 --
3884 open c_plan_name(p_pl_id);
3885 fetch c_plan_name into l_new_plan_name;
3886 close c_plan_name;
3887 open c_option_name(p_oipl_id);
3888 fetch c_option_name into l_new_option_name;
3889 close c_option_name;
3890 --
3891 /* updating benefit amount actually creates a new result.
3892 so we need to add the following check to see if it's only
3893 a benefit amount update in which case we want the change log
3894 to show 'Update enrollment coverage amount'--shdas*/
3895
3896 if p_old_pl_id is not null and p_pl_id = p_old_pl_id then
3897 if p_old_oipl_id is null or (p_old_oipl_id
3898 is not null and p_oipl_id = p_old_oipl_id) then
3899 if nvl(p_bnft_amt,0) <> nvl(p_old_bnft_amt,0) and
3900 change_event_is_enabled('COECA',p_effective_date) then
3901 ben_ext_chg_evt_api.create_ext_chg_evt
3902 (p_validate => FALSE
3903 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
3904 ,p_chg_evt_cd => 'COECA' -- Change Coverage Amount
3905 ,p_chg_eff_dt => p_effective_date
3906 ,p_prmtr_01 => to_char(p_pl_id)
3907 ,p_prmtr_02 => to_char(p_oipl_id)
3908 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
3909 ,p_prmtr_05 => to_char(p_per_in_ler_id)
3910 ,p_person_id => p_person_id
3911 ,p_business_group_id => p_business_group_id
3912 ,p_object_version_number => l_object_version_number
3913 ,p_effective_date => p_effective_date
3914 ,p_old_val1 => p_old_bnft_amt
3915 ,p_new_val1 => p_bnft_amt
3916 );
3917 end if;
3918 end if;
3919 --
3920 else
3921
3922 if change_event_is_enabled('AB',p_effective_date) then
3923 ben_ext_chg_evt_api.create_ext_chg_evt
3924 (p_validate => FALSE
3925 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
3926 ,p_chg_evt_cd => 'AB' -- Add Benefit
3927 ,p_chg_eff_dt => p_effective_date
3928 ,p_prmtr_01 => to_char(p_pl_id)
3929 ,p_prmtr_02 => to_char(p_oipl_id)
3930 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
3931 ,p_prmtr_05 => to_char(p_per_in_ler_id)
3932 ,p_person_id => p_person_id
3933 ,p_business_group_id => p_business_group_id
3934 ,p_object_version_number => l_object_version_number
3935 ,p_effective_date => p_effective_date
3936 ,p_new_val1 => l_new_plan_name
3937 ,p_new_val2 => l_new_option_name
3938 ,p_new_val3 => p_enrt_cvg_strt_dt
3939 ,p_new_val4 => p_enrt_cvg_end_dt
3940 );
3941 end if;
3942 --
3943 end if;
3944 end if; -- CREATE
3945 --
3946 if p_action = 'REINSTATE' then
3947 --
3948 open c_plan_name(p_pl_id);
3949 fetch c_plan_name into l_new_plan_name;
3950 close c_plan_name;
3951 open c_option_name(p_oipl_id);
3952 fetch c_option_name into l_new_option_name;
3953 close c_option_name;
3954 --
3955 if change_event_is_enabled('RB',p_effective_date) then
3956 ben_ext_chg_evt_api.create_ext_chg_evt
3957 (p_validate => FALSE
3958 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
3959 ,p_chg_evt_cd => 'RB' -- Reinstate Benefit
3960 ,p_chg_eff_dt => p_effective_date
3961 ,p_prmtr_01 => to_char(p_pl_id)
3962 ,p_prmtr_02 => to_char(p_oipl_id)
3963 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
3964 ,p_prmtr_05 => to_char(p_per_in_ler_id)
3965 ,p_person_id => p_person_id
3966 ,p_business_group_id => p_business_group_id
3967 ,p_object_version_number => l_object_version_number
3968 ,p_effective_date => p_effective_date
3969 ,p_old_val1 => l_new_plan_name --same as old
3970 ,p_old_val2 => l_new_option_name -- same as old
3971 ,p_old_val3 => p_old_enrt_cvg_strt_dt
3972 ,p_old_val4 => p_old_enrt_cvg_end_dt
3973 ,p_new_val1 => l_new_plan_name
3974 ,p_new_val2 => l_new_option_name
3975 ,p_new_val3 => p_enrt_cvg_strt_dt
3976 ,p_new_val4 => p_enrt_cvg_end_dt
3977 );
3978 end if;
3979 --
3980 end if; -- REINSTATE
3981 --
3982 if p_action = 'UPDATE' then
3983
3984 if p_pl_id <> p_old_pl_id then
3985 --
3986 -- For Extract purposes, we recognize an update to plan as 2 separate
3987 -- changes: Terminate Benefit, and Add Benefit.
3988 --
3989 if p_effective_date < p_old_enrt_cvg_strt_dt then
3990 --
3991 open c_plan_name(p_old_pl_id);
3992 fetch c_plan_name into l_old_plan_name;
3993 close c_plan_name;
3994 open c_option_name(p_old_oipl_id);
3995 fetch c_option_name into l_old_option_name;
3996 close c_option_name;
3997 --
3998 if change_event_is_enabled('TBBC',p_effective_date) then
3999 ben_ext_chg_evt_api.create_ext_chg_evt
4000 (p_validate => FALSE
4001 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4002 ,p_chg_evt_cd => 'TBBC' -- Terminate Benefit before Coverage
4003 ,p_chg_eff_dt => p_effective_date --??
4004 ,p_prmtr_01 => to_char(p_old_pl_id)
4005 ,p_prmtr_02 => to_char(p_old_oipl_id)
4006 ,p_prmtr_03 => to_char(p_old_prtt_enrt_rslt_id)
4007 ,p_prmtr_05 => to_char(p_old_per_in_ler_id)
4008 ,p_person_id => p_person_id
4009 ,p_business_group_id => p_business_group_id
4010 ,p_object_version_number => l_object_version_number
4011 ,p_effective_date => p_effective_date
4012 ,p_old_val1 => l_old_plan_name
4013 ,p_old_val2 => l_old_option_name
4014 ,p_old_val3 => p_old_enrt_cvg_strt_dt
4015 ,p_old_val4 => p_old_enrt_cvg_end_dt
4016 ,p_new_val1 => l_old_plan_name --same value as new
4017 ,p_new_val2 => l_old_option_name --same value as new
4018 ,p_new_val3 => p_old_enrt_cvg_strt_dt
4019 ,p_new_val4 => (p_old_enrt_cvg_strt_dt-1)--?
4020 );
4021 end if;
4022 --
4023 else
4024 --
4025 open c_plan_name(p_old_pl_id);
4026 fetch c_plan_name into l_old_plan_name;
4027 close c_plan_name;
4028 open c_option_name(p_old_oipl_id);
4029 fetch c_option_name into l_old_option_name;
4030 close c_option_name;
4031
4032 if change_event_is_enabled('TBAC',p_effective_date) then
4033 ben_ext_chg_evt_api.create_ext_chg_evt
4034 (p_validate => FALSE
4035 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4036 ,p_chg_evt_cd => 'TBAC' -- Terminate Benefit after Coverage
4037 ,p_chg_eff_dt => p_effective_date --??
4038 ,p_prmtr_01 => to_char(p_old_pl_id)
4039 ,p_prmtr_02 => to_char(p_old_oipl_id)
4040 ,p_prmtr_03 => to_char(p_old_prtt_enrt_rslt_id)
4041 ,p_prmtr_05 => to_char(p_old_per_in_ler_id)
4042 ,p_person_id => p_person_id
4043 ,p_business_group_id => p_business_group_id
4044 ,p_object_version_number => l_object_version_number
4045 ,p_effective_date => p_effective_date
4046 ,p_old_val1 => l_old_plan_name
4047 ,p_old_val2 => l_old_option_name
4048 ,p_old_val3 => p_old_enrt_cvg_strt_dt
4049 ,p_old_val4 => p_old_enrt_cvg_end_dt
4050 ,p_new_val1 => l_old_plan_name --same value as new
4051 ,p_new_val2 => l_old_option_name --same value as new
4052 ,p_new_val3 => p_old_enrt_cvg_strt_dt
4053 ,p_new_val4 => (p_old_enrt_cvg_strt_dt-1)--?
4054 );
4055 end if;
4056 --
4057 end if; -- eff date
4058 --
4059 open c_plan_name(p_pl_id);
4060 fetch c_plan_name into l_new_plan_name;
4061 close c_plan_name;
4062 open c_option_name(p_oipl_id);
4063 fetch c_option_name into l_new_option_name;
4064 close c_option_name;
4065
4066 if change_event_is_enabled('AB',p_effective_date) then
4067 ben_ext_chg_evt_api.create_ext_chg_evt
4068 (p_validate => FALSE
4069 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4070 ,p_chg_evt_cd => 'AB' -- Add Benefit
4071 ,p_chg_eff_dt => p_effective_date
4072 ,p_prmtr_01 => to_char(p_pl_id)
4073 ,p_prmtr_02 => to_char(p_oipl_id)
4074 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4075 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4076 ,p_person_id => p_person_id
4077 ,p_business_group_id => p_business_group_id
4078 ,p_object_version_number => l_object_version_number
4079 ,p_effective_date => p_effective_date
4080 ,p_new_val1 => l_new_plan_name
4081 ,p_new_val2 => l_new_option_name
4082 ,p_new_val3 => p_enrt_cvg_strt_dt
4083 ,p_new_val4 => hr_api.g_eot --?
4084 );
4085 end if;
4086 --
4087 else -- plan did not change
4088 --
4089 if p_oipl_id <> p_old_oipl_id then
4090 --
4091 open c_plan_name(p_pl_id);
4092 fetch c_plan_name into l_new_plan_name;
4093 close c_plan_name;
4094 open c_option_name(p_oipl_id);
4095 fetch c_option_name into l_new_option_name;
4096 close c_option_name;
4097 open c_option_name(p_old_oipl_id);
4098 fetch c_option_name into l_old_option_name;
4099 close c_option_name;
4100 --
4101 if change_event_is_enabled('UOBO',p_effective_date) then
4102 ben_ext_chg_evt_api.create_ext_chg_evt
4103 (p_validate => FALSE
4104 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4105 ,p_chg_evt_cd => 'UOBO' -- Change of Option
4106 ,p_chg_eff_dt => p_effective_date
4107 ,p_prmtr_01 => to_char(p_pl_id)
4108 ,p_prmtr_02 => to_char(p_oipl_id)
4109 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4110 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4111 ,p_prmtr_07 => to_char(p_old_oipl_id)
4112 ,p_person_id => p_person_id
4113 ,p_business_group_id => p_business_group_id
4114 ,p_object_version_number => l_object_version_number
4115 ,p_effective_date => p_effective_date
4116 ,p_old_val1 => l_new_plan_name -- same val as old
4117 ,p_old_val2 => l_old_option_name
4118 ,p_new_val1 => l_new_plan_name
4119 ,p_new_val2 => l_new_option_name
4120 );
4121 end if;
4122 --
4123 end if;
4124 --
4125 if p_enrt_cvg_strt_dt <> p_old_enrt_cvg_strt_dt then
4126 --
4127 if change_event_is_enabled('CCSD',p_effective_date) then
4128 ben_ext_chg_evt_api.create_ext_chg_evt
4129 (p_validate => FALSE
4130 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4131 ,p_chg_evt_cd => 'CCSD' -- Change Coverage Start Date
4132 ,p_chg_eff_dt => p_effective_date
4133 ,p_prmtr_01 => to_char(p_pl_id)
4134 ,p_prmtr_02 => to_char(p_oipl_id)
4135 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4136 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4137 ,p_person_id => p_person_id
4138 ,p_business_group_id => p_business_group_id
4139 ,p_object_version_number => l_object_version_number
4140 ,p_effective_date => p_effective_date
4141 ,p_old_val3 => p_old_enrt_cvg_strt_dt
4142 ,p_new_val3 => p_enrt_cvg_strt_dt
4143 );
4144 end if;
4145 end if;
4146 --
4147 if p_enrt_cvg_end_dt <> p_old_enrt_cvg_end_dt then
4148 --
4149 if change_event_is_enabled('CCED',p_effective_date) then
4150 ben_ext_chg_evt_api.create_ext_chg_evt
4151 (p_validate => FALSE
4152 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4153 ,p_chg_evt_cd => 'CCED' -- Change Coverage End Date
4154 ,p_chg_eff_dt => p_effective_date
4155 ,p_prmtr_01 => to_char(p_pl_id)
4156 ,p_prmtr_02 => to_char(p_oipl_id)
4157 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4158 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4159 ,p_person_id => p_person_id
4160 ,p_business_group_id => p_business_group_id
4161 ,p_object_version_number => l_object_version_number
4162 ,p_effective_date => p_effective_date
4163 ,p_old_val4 => p_old_enrt_cvg_end_dt
4164 ,p_new_val4 => p_enrt_cvg_end_dt
4165 );
4166 end if;
4167 end if;
4168 --
4169 if p_bnft_amt <> p_old_bnft_amt then
4170 --
4171 if change_event_is_enabled('COECA',p_effective_date) then
4172 ben_ext_chg_evt_api.create_ext_chg_evt
4173 (p_validate => FALSE
4174 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4175 ,p_chg_evt_cd => 'COECA' -- Change Coverage Amount
4176 ,p_chg_eff_dt => p_effective_date
4177 ,p_prmtr_01 => to_char(p_pl_id)
4178 ,p_prmtr_02 => to_char(p_oipl_id)
4179 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4180 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4181 ,p_person_id => p_person_id
4182 ,p_business_group_id => p_business_group_id
4183 ,p_object_version_number => l_object_version_number
4184 ,p_effective_date => p_effective_date
4185 ,p_old_val1 => p_old_bnft_amt
4186 ,p_new_val1 => p_bnft_amt
4187 );
4188 end if;
4189 end if;
4190 --
4191 if p_pen_attribute1 <> p_old_pen_attribute1 then
4192 --
4193 if change_event_is_enabled('COEF01',p_effective_date) then
4194 ben_ext_chg_evt_api.create_ext_chg_evt
4195 (p_validate => FALSE
4196 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4197 ,p_chg_evt_cd => 'COEF01' -- Change Flex field
4198 ,p_chg_eff_dt => p_effective_date
4199 ,p_prmtr_01 => to_char(p_pl_id)
4200 ,p_prmtr_02 => to_char(p_oipl_id)
4201 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4202 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4203 ,p_person_id => p_person_id
4204 ,p_business_group_id => p_business_group_id
4205 ,p_object_version_number => l_object_version_number
4206 ,p_effective_date => p_effective_date
4207 ,p_old_val1 => p_old_pen_attribute1
4208 ,p_new_val1 => p_pen_attribute1
4209 );
4210 end if;
4211 end if;
4212 --
4213 if p_pen_attribute2 <> p_old_pen_attribute2 then
4214 --
4215 if change_event_is_enabled('COEF02',p_effective_date) then
4216 ben_ext_chg_evt_api.create_ext_chg_evt
4217 (p_validate => FALSE
4218 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4219 ,p_chg_evt_cd => 'COEF02' -- Change Flex field
4220 ,p_chg_eff_dt => p_effective_date
4221 ,p_prmtr_01 => to_char(p_pl_id)
4222 ,p_prmtr_02 => to_char(p_oipl_id)
4223 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4224 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4225 ,p_person_id => p_person_id
4226 ,p_business_group_id => p_business_group_id
4227 ,p_object_version_number => l_object_version_number
4228 ,p_effective_date => p_effective_date
4229 ,p_old_val1 => p_old_pen_attribute2
4230 ,p_new_val1 => p_pen_attribute2
4231 );
4232 end if;
4233 end if;
4234 --
4235 --
4236 if p_pen_attribute3 <> p_old_pen_attribute3 then
4237 --
4238 if change_event_is_enabled('COEF03',p_effective_date) then
4239 ben_ext_chg_evt_api.create_ext_chg_evt
4240 (p_validate => FALSE
4241 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4242 ,p_chg_evt_cd => 'COEF03' -- Change Flex field
4243 ,p_chg_eff_dt => p_effective_date
4244 ,p_prmtr_01 => to_char(p_pl_id)
4245 ,p_prmtr_02 => to_char(p_oipl_id)
4246 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4247 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4248 ,p_person_id => p_person_id
4249 ,p_business_group_id => p_business_group_id
4250 ,p_object_version_number => l_object_version_number
4251 ,p_effective_date => p_effective_date
4252 ,p_old_val1 => p_old_pen_attribute3
4253 ,p_new_val1 => p_pen_attribute3
4254 );
4255 end if;
4256 end if;
4257 --
4258 if p_pen_attribute4 <> p_old_pen_attribute4 then
4259 --
4260 if change_event_is_enabled('COEF04',p_effective_date) then
4261 ben_ext_chg_evt_api.create_ext_chg_evt
4262 (p_validate => FALSE
4263 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4264 ,p_chg_evt_cd => 'COEF04' -- Change Flex field
4265 ,p_chg_eff_dt => p_effective_date
4266 ,p_prmtr_01 => to_char(p_pl_id)
4267 ,p_prmtr_02 => to_char(p_oipl_id)
4268 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4269 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4270 ,p_person_id => p_person_id
4271 ,p_business_group_id => p_business_group_id
4272 ,p_object_version_number => l_object_version_number
4273 ,p_effective_date => p_effective_date
4274 ,p_old_val1 => p_old_pen_attribute4
4275 ,p_new_val1 => p_pen_attribute4
4276 );
4277 end if;
4278 end if;
4279 --
4280 if p_pen_attribute5 <> p_old_pen_attribute5 then
4281 --
4282 if change_event_is_enabled('COEF05',p_effective_date) then
4283 ben_ext_chg_evt_api.create_ext_chg_evt
4284 (p_validate => FALSE
4285 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4286 ,p_chg_evt_cd => 'COEF05' -- Change Flex field
4287 ,p_chg_eff_dt => p_effective_date
4288 ,p_prmtr_01 => to_char(p_pl_id)
4289 ,p_prmtr_02 => to_char(p_oipl_id)
4290 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4291 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4292 ,p_person_id => p_person_id
4293 ,p_business_group_id => p_business_group_id
4294 ,p_object_version_number => l_object_version_number
4295 ,p_effective_date => p_effective_date
4296 ,p_old_val1 => p_old_pen_attribute5
4297 ,p_new_val1 => p_pen_attribute5
4298 );
4299 end if;
4300 end if;
4301 --
4302 if p_pen_attribute6 <> p_old_pen_attribute6 then
4303 --
4304 if change_event_is_enabled('COEF06',p_effective_date) then
4305 ben_ext_chg_evt_api.create_ext_chg_evt
4306 (p_validate => FALSE
4307 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4308 ,p_chg_evt_cd => 'COEF06' -- Change Flex field
4309 ,p_chg_eff_dt => p_effective_date
4310 ,p_prmtr_01 => to_char(p_pl_id)
4311 ,p_prmtr_02 => to_char(p_oipl_id)
4312 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4313 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4314 ,p_person_id => p_person_id
4315 ,p_business_group_id => p_business_group_id
4316 ,p_object_version_number => l_object_version_number
4317 ,p_effective_date => p_effective_date
4318 ,p_old_val1 => p_old_pen_attribute6
4319 ,p_new_val1 => p_pen_attribute6
4320 );
4321 end if;
4322 end if;
4323 --
4324 if p_pen_attribute7 <> p_old_pen_attribute7 then
4325 --
4326 if change_event_is_enabled('COEF07',p_effective_date) then
4327 ben_ext_chg_evt_api.create_ext_chg_evt
4328 (p_validate => FALSE
4329 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4330 ,p_chg_evt_cd => 'COEF07' -- Change Flex field
4331 ,p_chg_eff_dt => p_effective_date
4332 ,p_prmtr_01 => to_char(p_pl_id)
4333 ,p_prmtr_02 => to_char(p_oipl_id)
4334 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4335 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4336 ,p_person_id => p_person_id
4337 ,p_business_group_id => p_business_group_id
4338 ,p_object_version_number => l_object_version_number
4339 ,p_effective_date => p_effective_date
4340 ,p_old_val1 => p_old_pen_attribute7
4341 ,p_new_val1 => p_pen_attribute7
4342 );
4343 end if;
4344 end if;
4345 --
4346 if p_pen_attribute8 <> p_old_pen_attribute8 then
4347 --
4348 if change_event_is_enabled('COEF08',p_effective_date) then
4349 ben_ext_chg_evt_api.create_ext_chg_evt
4350 (p_validate => FALSE
4351 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4352 ,p_chg_evt_cd => 'COEF08' -- Change Flex field
4353 ,p_chg_eff_dt => p_effective_date
4354 ,p_prmtr_01 => to_char(p_pl_id)
4355 ,p_prmtr_02 => to_char(p_oipl_id)
4356 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4357 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4358 ,p_person_id => p_person_id
4359 ,p_business_group_id => p_business_group_id
4360 ,p_object_version_number => l_object_version_number
4361 ,p_effective_date => p_effective_date
4362 ,p_old_val1 => p_old_pen_attribute8
4363 ,p_new_val1 => p_pen_attribute8
4364 );
4365 end if;
4366 end if;
4367 --
4368 if p_pen_attribute9 <> p_old_pen_attribute9 then
4369 --
4370 if change_event_is_enabled('COEF09',p_effective_date) then
4371 ben_ext_chg_evt_api.create_ext_chg_evt
4372 (p_validate => FALSE
4373 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4374 ,p_chg_evt_cd => 'COEF09' -- Change Flex field
4375 ,p_chg_eff_dt => p_effective_date
4376 ,p_prmtr_01 => to_char(p_pl_id)
4377 ,p_prmtr_02 => to_char(p_oipl_id)
4378 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4379 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4380 ,p_person_id => p_person_id
4381 ,p_business_group_id => p_business_group_id
4382 ,p_object_version_number => l_object_version_number
4383 ,p_effective_date => p_effective_date
4384 ,p_old_val1 => p_old_pen_attribute9
4385 ,p_new_val1 => p_pen_attribute9
4386 );
4387 end if;
4388 end if;
4389 --
4390 if p_pen_attribute10 <> p_old_pen_attribute10 then
4391 --
4392 if change_event_is_enabled('COEF10',p_effective_date) then
4393 ben_ext_chg_evt_api.create_ext_chg_evt
4394 (p_validate => FALSE
4395 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4396 ,p_chg_evt_cd => 'COEF10' -- Change Flex field
4397 ,p_chg_eff_dt => p_effective_date
4398 ,p_prmtr_01 => to_char(p_pl_id)
4399 ,p_prmtr_02 => to_char(p_oipl_id)
4400 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4401 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4402 ,p_person_id => p_person_id
4403 ,p_business_group_id => p_business_group_id
4404 ,p_object_version_number => l_object_version_number
4405 ,p_effective_date => p_effective_date
4406 ,p_old_val1 => p_old_pen_attribute10
4407 ,p_new_val1 => p_pen_attribute10
4408 );
4409 end if;
4410 end if; -- attribute10 <>...
4411 --
4412 end if; -- plan changed?
4413 --
4414 end if; -- UPDATE
4415 --
4416 if p_action = 'DELETE' then
4417 --
4418 if nvl(p_enrt_cvg_end_dt,p_effective_date) < p_enrt_cvg_strt_dt then
4419 --
4420 open c_plan_name(p_old_pl_id);
4421 fetch c_plan_name into l_old_plan_name;
4422 close c_plan_name;
4423 open c_option_name(p_old_oipl_id);
4424 fetch c_option_name into l_old_option_name;
4425 close c_option_name;
4426 --
4427 if change_event_is_enabled('TBBC',p_effective_date) then
4428 ben_ext_chg_evt_api.create_ext_chg_evt
4429 (p_validate => FALSE
4430 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4431 ,p_chg_evt_cd => 'TBBC' -- Terminate Benefit before Coverage
4432 ,p_chg_eff_dt => p_effective_date
4433 ,p_prmtr_01 => to_char(p_old_pl_id)
4434 ,p_prmtr_02 => to_char(p_old_oipl_id)
4435 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4436 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4437 ,p_person_id => p_person_id
4438 ,p_business_group_id => p_business_group_id
4439 ,p_object_version_number => l_object_version_number
4440 ,p_effective_date => p_effective_date
4441 ,p_old_val1 => l_old_plan_name
4442 ,p_old_val2 => l_old_option_name
4443 ,p_old_val3 => p_old_enrt_cvg_strt_dt
4444 ,p_old_val4 => p_old_enrt_cvg_end_dt
4445 ,p_new_val1 => l_old_plan_name --same value as new
4446 ,p_new_val2 => l_old_option_name --same value as new
4447 ,p_new_val3 => p_enrt_cvg_strt_dt
4448 ,p_new_val4 => p_enrt_cvg_end_dt
4449 );
4450 end if;
4451 --
4452 else
4453 --
4454 open c_plan_name(p_old_pl_id);
4455 fetch c_plan_name into l_old_plan_name;
4456 close c_plan_name;
4457 open c_option_name(p_old_oipl_id);
4458 fetch c_option_name into l_old_option_name;
4459 close c_option_name;
4460
4461 if change_event_is_enabled('TBAC',p_effective_date) then
4462 ben_ext_chg_evt_api.create_ext_chg_evt
4463 (p_validate => FALSE
4464 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4465 ,p_chg_evt_cd => 'TBAC' -- Terminate Benefit after Coverage
4466 ,p_chg_eff_dt => p_effective_date
4467 ,p_prmtr_01 => to_char(p_old_pl_id)
4468 ,p_prmtr_02 => to_char(p_old_oipl_id)
4469 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4470 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4471 ,p_person_id => p_person_id
4472 ,p_business_group_id => p_business_group_id
4473 ,p_object_version_number => l_object_version_number
4474 ,p_effective_date => p_effective_date
4475 ,p_old_val1 => l_old_plan_name
4476 ,p_old_val2 => l_old_option_name
4477 ,p_old_val3 => p_old_enrt_cvg_strt_dt
4478 ,p_old_val4 => p_old_enrt_cvg_end_dt
4479 ,p_new_val1 => l_old_plan_name --same value as new
4480 ,p_new_val2 => l_old_option_name --same value as new
4481 ,p_new_val3 => p_enrt_cvg_strt_dt
4482 ,p_new_val4 => p_enrt_cvg_end_dt
4483 );
4484 end if;
4485 --
4486 end if; -- eff date
4487 --
4488 end if; -- DELETE
4489 --
4490 --
4491 hr_utility.set_location('Exiting:'||l_proc, 99);
4492 --
4493 END log_benefit_chg;
4494 --
4495 procedure log_dependent_chg(
4496 p_action in varchar2, -- CREATE, REINSTATE, or DELETE
4497 p_pl_id in number default null,
4498 p_oipl_id in number default null,
4499 p_cvg_strt_dt in date default null,
4500 p_cvg_end_dt in date default null,
4501 p_old_cvg_strt_dt in date default null,
4502 p_old_cvg_end_dt in date default null,
4503 p_effective_start_date in date default null,
4504 p_effective_end_date in date default null,
4505 p_prtt_enrt_rslt_id in number default null,
4506 p_per_in_ler_id in number default null,
4507 p_elig_cvrd_dpnt_id in number default null,
4508 p_person_id in number,
4509 p_dpnt_person_id in number,
4510 p_business_group_id in number,
4511 p_effective_date in date) is
4512
4513 -- Local variable declarations
4514 --
4515 l_proc varchar2(72) := 'ben_ext_chlg.log_dependent_chg';
4516
4517 l_plan_name ben_pl_f.name%type;
4518 l_option_name ben_opt_f.name%type;
4519 l_dpnt_full_name per_all_people_f.full_name%type;
4520 l_relationship varchar2(200);
4521 --
4522 l_ext_chg_evt_log_id number;
4523 l_object_version_number number;
4524 --
4525 -- Cursor declarations.
4526 cursor c_plan_name(p_pl_id number) is
4527 select pl.name
4528 from ben_pl_f pl
4529 where pl.pl_id = p_pl_id
4530 and p_effective_date between pl.effective_start_date and pl.effective_end_date;
4531 --
4532 cursor c_option_name(p_oipl_id number)
4533 is
4534 select opt.name
4535 from ben_oipl_f cop,
4536 ben_opt_f opt
4537 where cop.oipl_id = p_oipl_id
4538 and p_effective_date between cop.effective_start_date and cop.effective_end_date
4539 and cop.opt_id = opt.opt_id
4540 and p_effective_date between opt.effective_start_date and opt.effective_end_date;
4541 --
4542 cursor c_dpnt_full_name (p_person_id number) is
4543 SELECT ppf.full_name
4544 FROM per_all_people_f ppf
4545 WHERE ppf.person_id = p_person_id
4546 AND p_effective_date between ppf.effective_start_date
4547 and ppf.effective_end_date
4548 AND ppf.business_group_id = p_business_group_id;
4549 --
4550 cursor c_relationship(p_person_id number
4551 ,p_dpnt_person_id number)is
4552 SELECT hl.meaning
4553 FROM per_contact_relationships pcr,
4554 hr_lookups hl
4555 WHERE pcr.person_id = p_person_id
4556 AND pcr.contact_person_id = p_dpnt_person_id
4557 AND pcr.contact_type = hl.lookup_code
4558 AND hl.lookup_type = 'CONTACT';
4559 --
4560 --
4561 begin
4562 --
4563 hr_utility.set_location('Entering:'||l_proc, 10);
4564 --
4565 -- Get the new values to be store or updated
4566 --
4567 open c_plan_name(p_pl_id);
4568 fetch c_plan_name into l_plan_name;
4569 close c_plan_name;
4570 open c_option_name(p_oipl_id);
4571 fetch c_option_name into l_option_name;
4572 close c_option_name;
4573 open c_dpnt_full_name(p_dpnt_person_id);
4574 fetch c_dpnt_full_name into l_dpnt_full_name;
4575 close c_dpnt_full_name;
4576 open c_relationship(p_person_id, p_dpnt_person_id);
4577 fetch c_relationship into l_relationship;
4578 close c_relationship;
4579 --
4580 if p_action = 'CREATE' then
4581 --
4582 -- When we are creating a new dependent record we must record 2 records to
4583 -- the change log. 'Add Dependent' for the employee person, and 'Add Benefit'
4584 -- for the dependent person.
4585 --
4586 if change_event_is_enabled('AB',p_effective_date) then
4587 ben_ext_chg_evt_api.create_ext_chg_evt
4588 (p_validate => FALSE
4589 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4590 ,p_chg_evt_cd => 'AB' -- Add Benefit
4591 ,p_chg_eff_dt => p_effective_date
4592 ,p_prmtr_01 => to_char(p_pl_id)
4593 ,p_prmtr_02 => to_char(p_oipl_id)
4594 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4595 ,p_prmtr_04 => to_char(p_elig_cvrd_dpnt_id)
4596 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4597 ,p_prmtr_06 => to_char(p_person_id)
4598 ,p_person_id => p_dpnt_person_id
4599 ,p_business_group_id => p_business_group_id
4600 ,p_object_version_number => l_object_version_number
4601 ,p_effective_date => p_effective_date
4602 ,p_new_val1 => l_plan_name
4603 ,p_new_val2 => l_option_name
4604 ,p_new_val3 => p_cvg_strt_dt
4605 ,p_new_val4 => p_cvg_end_dt
4606 );
4607 end if;
4608 --
4609 if change_event_is_enabled('AD',p_effective_date) then
4610 ben_ext_chg_evt_api.create_ext_chg_evt
4611 (p_validate => FALSE
4612 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4613 ,p_chg_evt_cd => 'AD' -- Add Dependent
4614 ,p_chg_eff_dt => p_effective_date
4615 ,p_prmtr_01 => to_char(p_pl_id)
4616 ,p_prmtr_02 => to_char(p_oipl_id)
4617 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4618 ,p_prmtr_04 => to_char(p_elig_cvrd_dpnt_id)
4619 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4620 ,p_prmtr_06 => to_char(p_dpnt_person_id)
4621 ,p_person_id => p_person_id
4622 ,p_business_group_id => p_business_group_id
4623 ,p_object_version_number => l_object_version_number
4624 ,p_effective_date => p_effective_date
4625 ,p_new_val1 => l_plan_name
4626 ,p_new_val2 => l_option_name
4627 ,p_new_val3 => p_cvg_strt_dt
4628 ,p_new_val4 => p_cvg_end_dt
4629 ,p_new_val5 => l_dpnt_full_name
4630 ,p_new_val6 => l_relationship
4631 );
4632 end if;
4633 --
4634 elsif p_action = 'REINSTATE' then
4635 --
4636 if change_event_is_enabled('RB',p_effective_date) then
4637 ben_ext_chg_evt_api.create_ext_chg_evt
4638 (p_validate => FALSE
4639 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4640 ,p_chg_evt_cd => 'RB' -- Reinstate Benefit
4641 ,p_chg_eff_dt => p_effective_date
4642 ,p_prmtr_01 => to_char(p_pl_id)
4643 ,p_prmtr_02 => to_char(p_oipl_id)
4644 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4645 ,p_prmtr_04 => to_char(p_elig_cvrd_dpnt_id)
4646 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4647 ,p_prmtr_06 => to_char(p_person_id)
4648 ,p_person_id => p_dpnt_person_id
4649 ,p_business_group_id => p_business_group_id
4650 ,p_object_version_number => l_object_version_number
4651 ,p_effective_date => p_effective_date
4652 ,p_old_val1 => l_plan_name
4653 ,p_old_val2 => l_option_name
4654 ,p_old_val3 => p_old_cvg_strt_dt
4655 ,p_old_val4 => p_old_cvg_end_dt
4656 ,p_new_val1 => l_plan_name
4657 ,p_new_val2 => l_option_name
4658 ,p_new_val3 => p_cvg_strt_dt
4659 ,p_new_val4 => p_cvg_end_dt
4660 );
4661 end if;
4662 --
4663 if change_event_is_enabled('AD',p_effective_date) then
4664 ben_ext_chg_evt_api.create_ext_chg_evt
4665 (p_validate => FALSE
4666 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4667 ,p_chg_evt_cd => 'AD' -- Add dependent This should later change to
4668 -- Reinstate Dependent.
4669 ,p_chg_eff_dt => p_effective_date
4670 ,p_prmtr_01 => to_char(p_pl_id)
4671 ,p_prmtr_02 => to_char(p_oipl_id)
4672 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4673 ,p_prmtr_04 => to_char(p_elig_cvrd_dpnt_id)
4674 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4675 ,p_prmtr_06 => to_char(p_dpnt_person_id)
4676 ,p_person_id => p_person_id
4677 ,p_business_group_id => p_business_group_id
4678 ,p_object_version_number => l_object_version_number
4679 ,p_effective_date => p_effective_date
4680 ,p_old_val1 => l_plan_name
4681 ,p_old_val2 => l_option_name
4682 ,p_old_val3 => p_old_cvg_strt_dt
4683 ,p_old_val4 => p_old_cvg_end_dt
4684 ,p_old_val5 => l_dpnt_full_name
4685 ,p_old_val6 => l_relationship
4686 ,p_new_val1 => l_plan_name
4687 ,p_new_val2 => l_option_name
4688 ,p_new_val3 => p_cvg_strt_dt
4689 ,p_new_val4 => p_cvg_end_dt
4690 ,p_new_val5 => l_dpnt_full_name
4691 ,p_new_val6 => l_relationship
4692 );
4693 end if;
4694 --
4695 elsif p_action = 'DELETE' then
4696 --
4697 if p_cvg_end_dt < p_cvg_strt_dt then
4698 --
4699 if change_event_is_enabled('TBBC',p_effective_date) then
4700 ben_ext_chg_evt_api.create_ext_chg_evt
4701 (p_validate => FALSE
4702 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4703 ,p_chg_evt_cd => 'TBBC' -- Terminate Benefit before Coverage
4704 ,p_chg_eff_dt => p_effective_date
4705 ,p_prmtr_01 => to_char(p_pl_id)
4706 ,p_prmtr_02 => to_char(p_oipl_id)
4707 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4708 ,p_prmtr_04 => to_char(p_elig_cvrd_dpnt_id)
4709 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4710 ,p_prmtr_06 => to_char(p_person_id)
4711 ,p_person_id => p_dpnt_person_id
4712 ,p_business_group_id => p_business_group_id
4713 ,p_object_version_number => l_object_version_number
4714 ,p_effective_date => p_effective_date
4715 ,p_old_val1 => l_plan_name
4716 ,p_old_val2 => l_option_name
4717 ,p_old_val3 => p_old_cvg_strt_dt
4718 ,p_old_val4 => p_old_cvg_end_dt
4719 ,p_new_val1 => l_plan_name
4720 ,p_new_val2 => l_option_name
4721 ,p_new_val3 => p_cvg_strt_dt
4722 ,p_new_val4 => p_cvg_end_dt
4723 );
4724 end if;
4725 --
4726 else
4727 --
4728 if change_event_is_enabled('TBAC',p_effective_date) then
4729 ben_ext_chg_evt_api.create_ext_chg_evt
4730 (p_validate => FALSE
4731 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4732 ,p_chg_evt_cd => 'TBAC' -- Terminate Benefit after Coverage
4733 ,p_chg_eff_dt => p_effective_date
4734 ,p_prmtr_01 => to_char(p_pl_id)
4735 ,p_prmtr_02 => to_char(p_oipl_id)
4736 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4737 ,p_prmtr_04 => to_char(p_elig_cvrd_dpnt_id)
4738 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4739 ,p_prmtr_06 => to_char(p_person_id)
4740 ,p_person_id => p_dpnt_person_id
4741 ,p_business_group_id => p_business_group_id
4742 ,p_object_version_number => l_object_version_number
4743 ,p_effective_date => p_effective_date
4744 ,p_old_val1 => l_plan_name
4745 ,p_old_val2 => l_option_name
4746 ,p_old_val3 => p_old_cvg_strt_dt
4747 ,p_old_val4 => p_old_cvg_end_dt
4748 ,p_new_val1 => l_plan_name
4749 ,p_new_val2 => l_option_name
4750 ,p_new_val3 => p_cvg_strt_dt
4751 ,p_new_val4 => p_cvg_end_dt
4752 );
4753 end if;
4754 --
4755 end if; -- eff date
4756 --
4757 if change_event_is_enabled('DD',p_effective_date) then
4758 ben_ext_chg_evt_api.create_ext_chg_evt
4759 (p_validate => FALSE
4760 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4761 ,p_chg_evt_cd => 'DD' -- Delete Dependent
4762 ,p_chg_eff_dt => p_effective_date
4763 ,p_prmtr_01 => to_char(p_pl_id)
4764 ,p_prmtr_02 => to_char(p_oipl_id)
4765 ,p_prmtr_03 => to_char(p_prtt_enrt_rslt_id)
4766 ,p_prmtr_04 => to_char(p_elig_cvrd_dpnt_id)
4767 ,p_prmtr_05 => to_char(p_per_in_ler_id)
4768 ,p_prmtr_06 => to_char(p_dpnt_person_id)
4769 ,p_person_id => p_person_id
4770 ,p_business_group_id => p_business_group_id
4771 ,p_object_version_number => l_object_version_number
4772 ,p_effective_date => p_effective_date
4773 ,p_old_val1 => l_plan_name
4774 ,p_old_val2 => l_option_name
4775 ,p_old_val3 => p_old_cvg_strt_dt
4776 ,p_old_val4 => p_old_cvg_end_dt
4777 ,p_old_val5 => l_dpnt_full_name
4778 ,p_old_val6 => l_relationship
4779 ,p_new_val1 => l_plan_name
4780 ,p_new_val2 => l_option_name
4781 ,p_new_val3 => p_cvg_strt_dt
4782 ,p_new_val4 => p_cvg_end_dt
4783 ,p_new_val5 => l_dpnt_full_name
4784 ,p_new_val6 => l_relationship
4785 );
4786 end if;
4787 end if;
4788 --
4789 hr_utility.set_location('Exiting:'||l_proc, 99);
4790 --
4791 end log_dependent_chg;
4792 --
4793 procedure log_pcp_chg(
4794 p_action in varchar2,
4795 p_ext_ident in varchar2 default null,
4796 p_old_ext_ident in varchar2 default null,
4797 p_name in varchar2 default null,
4798 p_old_name in varchar2 default null,
4799 p_prmry_care_prvdr_typ_cd in varchar2 default null,
4800 p_old_prmry_care_prvdr_typ_cd in varchar2 default null,
4801 p_prmry_care_prvdr_id in number default null,
4802 p_elig_cvrd_dpnt_id in number default null,
4803 p_prtt_enrt_rslt_id in number default null,
4804 p_effective_start_date in date default null,
4805 p_effective_end_date in date default null,
4806 p_business_group_id in number,
4807 p_effective_date in date) is
4808 --
4809 -- Local variable declarations
4810 --
4811 l_proc varchar2(72) := 'ben_ext_chlg.log_pcp_chg';
4812 l_relationship per_all_people_f.person_id%type;
4813 l_contact per_contact_relationships.contact_relationship_id%type;
4814 l_name per_all_people_f.full_name%type;
4815 --
4816 cursor c_relationship(p_person_id number) is
4817 SELECT pcr.contact_relationship_id,pcr.person_id,ppf.full_name
4818 FROM per_contact_relationships pcr,
4819 per_all_people_f ppf,
4820 per_person_types ppt,
4821 hr_lookups hl
4822 WHERE pcr.contact_person_id = p_person_id
4823 AND ppf.person_id = p_person_id
4824 AND ppf.person_type_id = ppt.person_type_id
4825 AND ppt.system_person_type = 'OTHER'
4826 AND pcr.contact_type = hl.lookup_code
4827 AND hl.lookup_type = 'CONTACT';
4828
4829 cursor c_con_relationship(p_person_id number) is
4830 SELECT pcr.contact_relationship_id,pcr.person_id,ppf.full_name
4831 FROM per_contact_relationships pcr,
4832 per_all_people_f ppf,
4833 hr_lookups hl
4834 WHERE pcr.contact_person_id = p_person_id
4835 AND ppf.person_id = p_person_id
4836 AND pcr.contact_type = hl.lookup_code
4837 AND hl.lookup_type = 'CONTACT'
4838 AND pcr.personal_flag = 'Y'
4839 and p_effective_date between pcr.date_start and nvl(pcr.date_end, p_effective_date)
4840 ;
4841
4842 --
4843 cursor c_prtt_person_id
4844 is
4845 select pen.person_id
4846 from ben_prtt_enrt_rslt_f pen
4847 where pen.prtt_enrt_rslt_id = p_prtt_enrt_rslt_id
4848 and pen.business_group_id = p_business_group_id
4849 and p_effective_date between pen.effective_start_date and pen.effective_end_date;
4850
4851 cursor c_elig_cvrd_person_id
4852 is
4853 select ecd.dpnt_person_id
4854 from ben_elig_cvrd_dpnt_f ecd
4855 where ecd.elig_cvrd_dpnt_id = p_elig_cvrd_dpnt_id
4856 and ecd.business_group_id = p_business_group_id
4857 and p_effective_date between ecd.effective_start_date and ecd.effective_end_date;
4858
4859 cursor c_prmry_care_prvdr_type(prmry_care_prvdr_typ_cd in varchar2)
4860 is
4861 select hl.meaning
4862 from hr_lookups hl
4863 where hl.lookup_type = 'BEN_PRMRY_CARE_PRVDR_TYP'
4864 and hl.lookup_code = prmry_care_prvdr_typ_cd;
4865 --
4866 l_person_id number;
4867 l_prmry_care_prvdr_typ_cd varchar2(50);
4868 v_prmry_care_prvdr_typ_cd varchar2(50);
4869 l_old_prmry_care_prvdr_typ_cd varchar2(50);
4870 l_object_version_number number;
4871 l_ext_chg_evt_log_id number;
4872 l_pcp_chg boolean := FALSE;
4873 --
4874 begin
4875 --
4876 hr_utility.set_location('Entering:'||l_proc, 10);
4877 --
4878 -- Get the values to be store or updated
4879 if p_prtt_enrt_rslt_id is not null then
4880 open c_prtt_person_id;
4881 fetch c_prtt_person_id into l_person_id;
4882 close c_prtt_person_id;
4883 elsif p_elig_cvrd_dpnt_id is not null then
4884 open c_elig_cvrd_person_id;
4885 fetch c_elig_cvrd_person_id into l_person_id;
4886 close c_elig_cvrd_person_id;
4887 end if;
4888 if p_prmry_care_prvdr_typ_cd is not null then
4889 open c_prmry_care_prvdr_type(p_prmry_care_prvdr_typ_cd);
4890 fetch c_prmry_care_prvdr_type into l_prmry_care_prvdr_typ_cd;
4891 close c_prmry_care_prvdr_type;
4892 end if;
4893 if p_old_prmry_care_prvdr_typ_cd is not null then
4894 open c_prmry_care_prvdr_type(p_old_prmry_care_prvdr_typ_cd);
4895 fetch c_prmry_care_prvdr_type into l_old_prmry_care_prvdr_typ_cd;
4896 close c_prmry_care_prvdr_type;
4897 end if;
4898 --
4899 --
4900 if p_action = 'CREATE' then
4901 if change_event_is_enabled('APCP',p_effective_date) then
4902 l_pcp_chg := TRUE;
4903 if l_person_id is not null then
4904 ben_ext_chg_evt_api.create_ext_chg_evt
4905 (p_validate => FALSE
4906 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4907 ,p_chg_evt_cd => 'APCP'
4908 ,p_chg_eff_dt => p_effective_date
4909 ,p_prmtr_03 => p_prtt_enrt_rslt_id
4910 ,p_prmtr_04 => p_elig_cvrd_dpnt_id
4911 ,p_prmtr_08 => p_prmry_care_prvdr_id
4912 ,p_person_id => l_person_id
4913 ,p_business_group_id => p_business_group_id
4914 ,p_object_version_number => l_object_version_number
4915 ,p_effective_date => p_effective_date
4916 ,p_new_val1 => p_name
4917 ,p_new_val2 => p_ext_ident
4918 ,p_new_val3 => l_prmry_care_prvdr_typ_cd);
4919 end if;
4920 end if;
4921 --
4922 elsif p_action = 'UPDATE' then
4923
4924 if p_prmry_care_prvdr_typ_cd <> p_old_prmry_care_prvdr_typ_cd then
4925 --
4926 if change_event_is_enabled('COPT',p_effective_date) then
4927 l_pcp_chg := TRUE;
4928 ben_ext_chg_evt_api.create_ext_chg_evt
4929 (p_validate => FALSE
4930 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4931 ,p_chg_evt_cd => 'COPT'
4932 ,p_chg_eff_dt => p_effective_date
4933 ,p_prmtr_03 => p_prtt_enrt_rslt_id
4934 ,p_prmtr_04 => p_elig_cvrd_dpnt_id
4935 ,p_prmtr_08 => p_prmry_care_prvdr_id
4936 ,p_person_id => l_person_id
4937 ,p_business_group_id => p_business_group_id
4938 ,p_object_version_number => l_object_version_number
4939 ,p_effective_date => p_effective_date
4940 ,p_old_val1 => p_old_name
4941 ,p_old_val2 => p_old_ext_ident
4942 ,p_old_val3 => l_old_prmry_care_prvdr_typ_cd
4943 ,p_new_val1 => p_old_name
4944 ,p_new_val2 => p_old_ext_ident
4945 ,p_new_val3 => l_prmry_care_prvdr_typ_cd);
4946 end if;
4947 --
4948 end if;
4949 --
4950 if p_name <> p_old_name then
4951 --
4952 if change_event_is_enabled('COPN',p_effective_date) then
4953 l_pcp_chg := TRUE;
4954 ben_ext_chg_evt_api.create_ext_chg_evt
4955 (p_validate => FALSE
4956 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4957 ,p_chg_evt_cd => 'COPN'
4958 ,p_chg_eff_dt => p_effective_date
4959 ,p_prmtr_03 => p_prtt_enrt_rslt_id
4960 ,p_prmtr_04 => p_elig_cvrd_dpnt_id
4961 ,p_prmtr_08 => p_prmry_care_prvdr_id
4962 ,p_person_id => l_person_id
4963 ,p_business_group_id => p_business_group_id
4964 ,p_object_version_number => l_object_version_number
4965 ,p_effective_date => p_effective_date
4966 ,p_old_val1 => p_old_name
4967 ,p_old_val2 => p_old_ext_ident
4968 ,p_old_val3 => l_old_prmry_care_prvdr_typ_cd
4969 ,p_new_val1 => p_name
4970 ,p_new_val2 => p_old_ext_ident
4971 ,p_new_val3 => l_old_prmry_care_prvdr_typ_cd);
4972 end if;
4973 --
4974 end if;
4975 --
4976 if p_ext_ident <> p_old_ext_ident then
4977 if change_event_is_enabled('COPI',p_effective_date) then
4978 ben_ext_chg_evt_api.create_ext_chg_evt
4979 (p_validate => FALSE
4980 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
4981 ,p_chg_evt_cd => 'COPI'
4982 ,p_chg_eff_dt => p_effective_date
4983 ,p_prmtr_03 => p_prtt_enrt_rslt_id
4984 ,p_prmtr_04 => p_elig_cvrd_dpnt_id
4985 ,p_prmtr_08 => p_prmry_care_prvdr_id
4986 ,p_person_id => l_person_id
4987 ,p_business_group_id => p_business_group_id
4988 ,p_object_version_number => l_object_version_number
4989 ,p_effective_date => p_effective_date
4990 ,p_old_val1 => p_old_name
4991 ,p_old_val2 => p_old_ext_ident
4992 ,p_old_val3 => l_old_prmry_care_prvdr_typ_cd
4993 ,p_new_val1 => p_old_name
4994 ,p_new_val2 => p_ext_ident
4995 ,p_new_val3 => l_old_prmry_care_prvdr_typ_cd);
4996 end if;
4997 --
4998 end if;
4999 --
5000 elsif p_action = 'DELETE' then
5001 --
5002 if change_event_is_enabled('DPCP',p_effective_date) then
5003 l_pcp_chg := TRUE;
5004 ben_ext_chg_evt_api.create_ext_chg_evt
5005 (p_validate => FALSE
5006 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
5007 ,p_chg_evt_cd => 'DPCP'
5008 ,p_chg_eff_dt => p_effective_date
5009 ,p_prmtr_03 => p_prtt_enrt_rslt_id
5010 ,p_prmtr_04 => p_elig_cvrd_dpnt_id
5011 ,p_prmtr_08 => p_prmry_care_prvdr_id
5012 ,p_person_id => l_person_id
5013 ,p_business_group_id => p_business_group_id
5014 ,p_object_version_number => l_object_version_number
5015 ,p_effective_date => p_effective_date
5016 ,p_old_val1 => p_old_name
5017 ,p_old_val2 => p_old_ext_ident
5018 ,p_old_val3 => l_old_prmry_care_prvdr_typ_cd);
5019 end if;
5020 --
5021 end if; --p_action
5022 --record change event(update contact's primary care provider) for participant.
5023 if l_pcp_chg then
5024 -- only the person type is contact
5025 open c_relationship(l_person_id);
5026 fetch c_relationship into l_contact,l_relationship,l_name;
5027 if c_relationship%notfound then
5028 close c_relationship;
5029 elsif c_relationship%found then
5030 close c_relationship;
5031 l_person_id := l_relationship;
5032 if p_action = 'CREATE' then
5033 ben_ext_chg_evt_api.create_ext_chg_evt
5034 (p_validate => FALSE
5035 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
5036 ,p_chg_evt_cd => 'CCPC'
5037 ,p_chg_eff_dt => p_effective_date
5038 ,p_prmtr_01 => l_relationship
5039 ,p_prmtr_03 => p_prtt_enrt_rslt_id
5040 ,p_prmtr_04 => p_elig_cvrd_dpnt_id
5041 ,p_prmtr_08 => p_prmry_care_prvdr_id
5042 ,p_person_id => l_person_id
5043 ,p_business_group_id => p_business_group_id
5044 ,p_object_version_number => l_object_version_number
5045 ,p_effective_date => p_effective_date
5046 ,p_new_val1 => substr(l_name,1,240)
5047 ,p_new_val2 => substr(p_name,1,240)
5048 ,p_new_val3 => l_prmry_care_prvdr_typ_cd);
5049 elsif p_action = 'UPDATE' then
5050 if p_prmry_care_prvdr_typ_cd is not null then
5051 v_prmry_care_prvdr_typ_cd := l_prmry_care_prvdr_typ_cd;
5052 else
5053 v_prmry_care_prvdr_typ_cd := l_old_prmry_care_prvdr_typ_cd;
5054 end if;
5055 ben_ext_chg_evt_api.create_ext_chg_evt
5056 (p_validate => FALSE
5057 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
5058 ,p_chg_evt_cd => 'CCPC'
5059 ,p_chg_eff_dt => p_effective_date
5060 ,p_prmtr_01 => l_relationship
5061 ,p_prmtr_03 => p_prtt_enrt_rslt_id
5062 ,p_prmtr_04 => p_elig_cvrd_dpnt_id
5063 ,p_prmtr_08 => p_prmry_care_prvdr_id
5064 ,p_person_id => l_person_id
5065 ,p_business_group_id => p_business_group_id
5066 ,p_object_version_number => l_object_version_number
5067 ,p_effective_date => p_effective_date
5068 ,p_old_val1 => substr(l_name,1,200)
5069 ,p_old_val2 => p_old_name
5070 ,p_old_val3 => l_old_prmry_care_prvdr_typ_cd
5071 ,p_new_val1 => substr(l_name,1,240)
5072 ,p_new_val2 => substr(p_name,1,240)
5073 ,p_new_val3 => v_prmry_care_prvdr_typ_cd);
5074 elsif p_action = 'DELETE' then
5075 ben_ext_chg_evt_api.create_ext_chg_evt
5076 (p_validate => FALSE
5077 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
5078 ,p_chg_evt_cd => 'CCPC'
5079 ,p_chg_eff_dt => p_effective_date
5080 ,p_prmtr_01 => l_relationship
5081 ,p_prmtr_03 => p_prtt_enrt_rslt_id
5082 ,p_prmtr_04 => p_elig_cvrd_dpnt_id
5083 ,p_prmtr_08 => p_prmry_care_prvdr_id
5084 ,p_person_id => l_person_id
5085 ,p_business_group_id => p_business_group_id
5086 ,p_object_version_number => l_object_version_number
5087 ,p_effective_date => p_effective_date
5088 ,p_old_val1 => substr(l_name,1,240)
5089 ,p_old_val2 => p_old_name
5090 ,p_old_val3 => l_old_prmry_care_prvdr_typ_cd);
5091 end if;
5092 end if;
5093
5094 --- all the contact relationship person
5095
5096 open c_con_relationship(l_person_id);
5097 Loop
5098 fetch c_con_relationship into l_contact,l_relationship,l_name;
5099 exit when c_con_relationship%notfound ;
5100 l_person_id := l_relationship;
5101 if p_action = 'CREATE' then
5102 ben_ext_chg_evt_api.create_ext_chg_evt
5103 (p_validate => FALSE
5104 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
5105 ,p_chg_evt_cd => 'CCNPC'
5106 ,p_chg_eff_dt => p_effective_date
5107 ,p_prmtr_01 => l_relationship
5108 ,p_prmtr_03 => p_prtt_enrt_rslt_id
5109 ,p_prmtr_04 => p_elig_cvrd_dpnt_id
5110 ,p_prmtr_08 => p_prmry_care_prvdr_id
5111 ,p_person_id => l_person_id
5112 ,p_business_group_id => p_business_group_id
5113 ,p_object_version_number => l_object_version_number
5114 ,p_effective_date => p_effective_date
5115 ,p_new_val1 => substr(l_name,1,240)
5116 ,p_new_val2 => substr(p_name,1,240)
5117 ,p_new_val3 => l_prmry_care_prvdr_typ_cd);
5118 elsif p_action = 'UPDATE' then
5119 if p_prmry_care_prvdr_typ_cd is not null then
5120 v_prmry_care_prvdr_typ_cd := l_prmry_care_prvdr_typ_cd;
5121 else
5122 v_prmry_care_prvdr_typ_cd := l_old_prmry_care_prvdr_typ_cd;
5123 end if;
5124 ben_ext_chg_evt_api.create_ext_chg_evt
5125 (p_validate => FALSE
5126 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
5127 ,p_chg_evt_cd => 'CCNPC'
5128 ,p_chg_eff_dt => p_effective_date
5129 ,p_prmtr_01 => l_relationship
5130 ,p_prmtr_03 => p_prtt_enrt_rslt_id
5131 ,p_prmtr_04 => p_elig_cvrd_dpnt_id
5132 ,p_prmtr_08 => p_prmry_care_prvdr_id
5133 ,p_person_id => l_person_id
5134 ,p_business_group_id => p_business_group_id
5135 ,p_object_version_number => l_object_version_number
5136 ,p_effective_date => p_effective_date
5137 ,p_old_val1 => substr(l_name,1,200)
5138 ,p_old_val2 => p_old_name
5139 ,p_old_val3 => l_old_prmry_care_prvdr_typ_cd
5140 ,p_new_val1 => substr(l_name,1,240)
5141 ,p_new_val2 => substr(p_name,1,240)
5142 ,p_new_val3 => v_prmry_care_prvdr_typ_cd);
5143 elsif p_action = 'DELETE' then
5144 ben_ext_chg_evt_api.create_ext_chg_evt
5145 (p_validate => FALSE
5146 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
5147 ,p_chg_evt_cd => 'CCNPC'
5148 ,p_chg_eff_dt => p_effective_date
5149 ,p_prmtr_01 => l_relationship
5150 ,p_prmtr_03 => p_prtt_enrt_rslt_id
5151 ,p_prmtr_04 => p_elig_cvrd_dpnt_id
5152 ,p_prmtr_08 => p_prmry_care_prvdr_id
5153 ,p_person_id => l_person_id
5154 ,p_business_group_id => p_business_group_id
5155 ,p_object_version_number => l_object_version_number
5156 ,p_effective_date => p_effective_date
5157 ,p_old_val1 => substr(l_name,1,240)
5158 ,p_old_val2 => p_old_name
5159 ,p_old_val3 => l_old_prmry_care_prvdr_typ_cd);
5160 end if;
5161 End Loop ;
5162 close c_con_relationship;
5163 -- end of creating log for all relationship
5164 --
5165 end if; --p_action
5166 hr_utility.set_location('Exiting:'||l_proc, 99);
5167 --
5168 end log_pcp_chg;
5169 --
5170 procedure log_pos_chg
5171 (p_event in varchar2
5172 ,p_old_rec in g_pos_rec_type
5173 ,p_new_rec in g_pos_rec_type
5174 ) is
5175 --
5176 l_chg_evt_tab g_char_tab_type;
5177 l_prmtr_01_tab g_char_tab_type;
5178 l_prmtr_02_tab g_char_tab_type;
5179 l_prmtr_03_tab g_char_tab_type;
5180 l_prmtr_04_tab g_char_tab_type;
5181 l_prmtr_05_tab g_char_tab_type;
5182 l_prmtr_06_tab g_char_tab_type;
5183 l_prmtr_07_tab g_char_tab_type;
5184 l_new_val1 g_new_val;
5185 l_new_val2 g_new_val;
5186 l_new_val3 g_new_val;
5187 l_new_val4 g_new_val;
5188 l_new_val5 g_new_val;
5189 l_new_val6 g_new_val;
5190 l_old_val1 g_old_val;
5191 l_old_val2 g_old_val;
5192 l_old_val3 g_old_val;
5193 l_old_val4 g_old_val;
5194 l_old_val5 g_old_val;
5195 l_old_val6 g_old_val;
5196 l_tab_counter binary_integer := 0;
5197 --Bug 4539732 Changed the date type of l_chg_eff_dt to date table type
5198 l_chg_eff_dt g_date_tab_type;
5199 --End Bug 4539732
5200 l_count number;
5201 l_ext_chg_evt_log_id number;
5202 l_object_version_number number;
5203 --
5204 l_proc varchar2(72) := 'ben_ext_chlg.log_pos_chg';
5205 --
5206 begin
5207 --
5208 hr_utility.set_location('Entering:'||l_proc, 10);
5209
5210
5211 --
5212 if p_event = 'UPDATE' then
5213 --
5214 if p_old_rec.actual_termination_date is null and p_new_rec.actual_termination_date is not null then
5215 l_tab_counter := l_tab_counter + 1;
5216 --Bug 4539732 Store the change effective date for each event in its own place
5217 l_chg_eff_dt(l_tab_counter) := p_new_rec.actual_termination_date;
5218 --End Bug 4539732
5219 l_chg_evt_tab(l_tab_counter) := 'AAT';
5220 l_prmtr_01_tab(l_tab_counter) := p_old_rec.period_of_service_id;
5221 l_prmtr_02_tab(l_tab_counter) := null;
5222 l_prmtr_03_tab(l_tab_counter) := null;
5223 l_prmtr_04_tab(l_tab_counter) := null;
5224 l_prmtr_05_tab(l_tab_counter) := null;
5225 l_prmtr_06_tab(l_tab_counter) := null;
5226 l_prmtr_07_tab(l_tab_counter) := null;
5227 l_old_val1(l_tab_counter) := p_old_rec.actual_termination_date;
5228 l_new_val1(l_tab_counter) := p_new_rec.actual_termination_date;
5229 end if;
5230 if p_old_rec.actual_termination_date is not null and
5231 p_new_rec.actual_termination_date is not null and
5232 p_old_rec.actual_termination_date <> p_new_rec.actual_termination_date then
5233 l_tab_counter := l_tab_counter + 1;
5234 --Bug 4539732 Store the change effective date for each event in its own place
5235 l_chg_eff_dt(l_tab_counter) := p_new_rec.actual_termination_date;
5236 --End Bug 4539732
5237 l_chg_evt_tab(l_tab_counter) := 'COAT';
5238 l_prmtr_01_tab(l_tab_counter) := p_old_rec.period_of_service_id;
5239 l_prmtr_02_tab(l_tab_counter) := null;
5240 l_prmtr_03_tab(l_tab_counter) := null;
5241 l_prmtr_04_tab(l_tab_counter) := null;
5242 l_prmtr_05_tab(l_tab_counter) := null;
5243 l_prmtr_06_tab(l_tab_counter) := null;
5244 l_prmtr_07_tab(l_tab_counter) := null;
5245 l_old_val1(l_tab_counter) := p_old_rec.actual_termination_date;
5246 l_new_val1(l_tab_counter) := p_new_rec.actual_termination_date;
5247 end if;
5248 if p_old_rec.actual_termination_date is not null and p_new_rec.actual_termination_date is null then
5249 l_tab_counter := l_tab_counter + 1;
5250 --Bug 4539732 Store the change effective date for each event in its own place
5251 l_chg_eff_dt(l_tab_counter) := p_old_rec.actual_termination_date;
5252 --End Bug 4539732
5253 l_chg_evt_tab(l_tab_counter) := 'DAT';
5254 l_prmtr_01_tab(l_tab_counter) := p_old_rec.period_of_service_id;
5255 l_prmtr_02_tab(l_tab_counter) := null;
5256 l_prmtr_03_tab(l_tab_counter) := null;
5257 l_prmtr_04_tab(l_tab_counter) := null;
5258 l_prmtr_05_tab(l_tab_counter) := null;
5259 l_prmtr_06_tab(l_tab_counter) := null;
5260 l_prmtr_07_tab(l_tab_counter) := null;
5261 l_old_val1(l_tab_counter) := p_old_rec.actual_termination_date;
5262 l_new_val1(l_tab_counter) := null;
5263 end if;
5264 if nvl(p_old_rec.leaving_reason,'*') <> nvl(p_new_rec.leaving_reason,'*') then
5265 l_tab_counter := l_tab_counter + 1;
5266 --Bug 4539732 Store the change effective date for each event in its own place
5267 l_chg_eff_dt(l_tab_counter) := nvl(p_old_rec.actual_termination_date,trunc(sysdate));
5268 -- truncated the sysdate so that only date gets into rather than time also getting into the table
5269 --End Bug 4539732
5270 l_chg_evt_tab(l_tab_counter) := 'COTR';
5271 l_prmtr_01_tab(l_tab_counter) := p_old_rec.period_of_service_id;
5272 l_prmtr_02_tab(l_tab_counter) := null;
5273 l_prmtr_03_tab(l_tab_counter) := null;
5274 l_prmtr_04_tab(l_tab_counter) := null;
5275 l_prmtr_05_tab(l_tab_counter) := null;
5276 l_prmtr_06_tab(l_tab_counter) := null;
5277 l_prmtr_07_tab(l_tab_counter) := null;
5278 l_old_val1(l_tab_counter) := p_old_rec.leaving_reason;
5279 l_new_val1(l_tab_counter) := p_new_rec.leaving_reason;
5280 end if;
5281 if p_old_rec.date_start is not null and
5282 p_new_rec.date_start is not null and
5283 p_old_rec.date_start <> p_new_rec.date_start then
5284 l_tab_counter := l_tab_counter + 1;
5285 --Bug 4539732 Store the change effective date for each event in its own place
5286 l_chg_eff_dt(l_tab_counter) := p_new_rec.date_start;
5287 --End Bug 4539732
5288 l_chg_evt_tab(l_tab_counter) := 'COPOS';
5289 l_prmtr_01_tab(l_tab_counter) := p_old_rec.period_of_service_id;
5290 l_prmtr_02_tab(l_tab_counter) := null;
5291 l_prmtr_03_tab(l_tab_counter) := null;
5292 l_prmtr_04_tab(l_tab_counter) := null;
5293 l_prmtr_05_tab(l_tab_counter) := null;
5294 l_prmtr_06_tab(l_tab_counter) := null;
5295 l_prmtr_07_tab(l_tab_counter) := null;
5296 l_old_val1(l_tab_counter) := p_old_rec.date_start;
5297 l_new_val1(l_tab_counter) := p_new_rec.date_start;
5298 end if;
5299 --
5300 elsif p_event = 'INSERT' then
5301 l_tab_counter := l_tab_counter + 1;
5302 --Bug 4539732 Store the change effective date for each event in its own place
5303 l_chg_eff_dt(l_tab_counter) := p_new_rec.date_start;
5304 --End Bug 4539732
5305 l_chg_evt_tab(l_tab_counter) := 'APS';
5306 l_prmtr_01_tab(l_tab_counter) := p_new_rec.period_of_service_id;
5307 l_prmtr_02_tab(l_tab_counter) := null;
5308 l_prmtr_03_tab(l_tab_counter) := null;
5309 l_prmtr_04_tab(l_tab_counter) := null;
5310 l_prmtr_05_tab(l_tab_counter) := null;
5311 l_prmtr_06_tab(l_tab_counter) := null;
5312 l_prmtr_07_tab(l_tab_counter) := null;
5313 l_old_val1(l_tab_counter) := null;
5314 l_new_val1(l_tab_counter) := p_new_rec.date_start;
5315 end if;
5316 --
5317 for l_count in 1..l_chg_evt_tab.count loop
5318 if change_event_is_enabled(l_chg_evt_tab(l_count),l_chg_eff_dt(l_count)) then
5319 --Bug 4539732 Create ext change event with each event having its own l_chg_eff_dt
5320 ben_ext_chg_evt_api.create_ext_chg_evt
5321 (p_validate => FALSE
5322 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
5323 ,p_chg_evt_cd => l_chg_evt_tab(l_count)
5324 ,p_chg_eff_dt => l_chg_eff_dt(l_count)
5325 ,p_prmtr_01 => l_prmtr_01_tab(l_count)
5326 ,p_prmtr_02 => l_prmtr_02_tab(l_count)
5327 ,p_prmtr_03 => l_prmtr_03_tab(l_count)
5328 ,p_prmtr_04 => l_prmtr_04_tab(l_count)
5329 ,p_prmtr_05 => l_prmtr_05_tab(l_count)
5330 ,p_prmtr_06 => l_prmtr_06_tab(l_count)
5331 ,p_prmtr_07 => l_prmtr_07_tab(l_count)
5332 ,p_prmtr_10 => p_new_rec.update_mode
5333 ,p_person_id => p_new_rec.person_id
5334 ,p_business_group_id => p_new_rec.business_group_id
5335 ,p_object_version_number => l_object_version_number
5336 ,p_effective_date => l_chg_eff_dt(l_count)
5337 ,p_new_val1 => l_new_val1(l_count)
5338 ,p_old_val1 => l_old_val1(l_count)
5339 );
5340 --End Bug 4539732
5341 end if;
5342 end loop;
5343 --
5344 hr_utility.set_location('Exiting:'||l_proc, 99);
5345 --
5346 end log_pos_chg;
5347 --
5348 procedure log_apl_chg
5349 (p_event in varchar2
5350 ,p_old_rec in g_apl_rec_type
5351 ,p_new_rec in g_apl_rec_type
5352 ) is
5353 --
5354 l_chg_evt_tab g_char_tab_type;
5355 l_prmtr_01_tab g_char_tab_type;
5356 l_prmtr_02_tab g_char_tab_type;
5357 l_prmtr_03_tab g_char_tab_type;
5358 l_prmtr_04_tab g_char_tab_type;
5359 l_prmtr_05_tab g_char_tab_type;
5360 l_prmtr_06_tab g_char_tab_type;
5361 l_prmtr_07_tab g_char_tab_type;
5362 l_new_val1 g_new_val;
5363 l_new_val2 g_new_val;
5364 l_new_val3 g_new_val;
5365 l_new_val4 g_new_val;
5366 l_new_val5 g_new_val;
5367 l_new_val6 g_new_val;
5368 l_old_val1 g_old_val;
5369 l_old_val2 g_old_val;
5370 l_old_val3 g_old_val;
5371 l_old_val4 g_old_val;
5372 l_old_val5 g_old_val;
5373 l_old_val6 g_old_val;
5374 l_tab_counter binary_integer := 0;
5375 l_chg_eff_dt date;
5376 l_count number;
5377 l_ext_chg_evt_log_id number;
5378 l_object_version_number number;
5379 --
5380 l_proc varchar2(72) := 'ben_ext_chlg.log_apl_chg';
5381 --
5382 cursor c_termination_reason (p_termination_reason per_applications.termination_reason%type)
5383 is
5384 select hl.meaning
5385 from hr_lookups hl
5386 where hl.lookup_type = 'TERM_APL_REASON'
5387 and hl.lookup_code = p_termination_reason
5388 and hl.enabled_flag = 'Y';
5389 --
5390 l_old_termination_reason varchar2(50);
5391 l_new_termination_reason varchar2(50);
5392 --
5393 begin
5394 --
5395 hr_utility.set_location('Entering:'||l_proc, 10);
5396 -- removed because the pos leaving reason should
5397 -- have been used.
5398 null;
5399 --
5400 hr_utility.set_location('Exiting:'||l_proc, 99);
5401 --
5402 end log_apl_chg;
5403 --
5404
5405
5406 procedure log_prem_mo_chg
5407 (p_event in varchar2
5408 ,p_old_rec in g_prem_mo_rec_type
5409 ,p_new_rec in g_prem_mo_rec_type
5410 )is
5411 --
5412 l_person_id number ;
5413 l_ext_chg_evt_log_id number ;
5414 l_object_version_number number;
5415
5416 Cursor c_person(p_prtt_prem_id number) is
5417 select person_id
5418 from ben_per_in_ler pil,
5419 ben_prtt_prem_f ppe
5420 where ppe.prtt_prem_id = p_prtt_prem_id
5421 and ppe.per_in_ler_id = pil.per_in_ler_id ;
5422 --
5423 l_proc varchar2(72) := 'ben_ext_chlg.log_prem_mo_chg';
5424 Begin
5425 hr_utility.set_location('Entering:'||l_proc, 10);
5426 open c_person(p_new_rec.prtt_prem_id) ;
5427 fetch c_person into l_person_id ;
5428 close c_person ;
5429
5430 if p_new_rec.val <> p_old_rec.val then
5431 -- before the fix there was a typo in lookp code
5432 -- lookup code is COPMPRM, event logged for CCOPMPRM
5433 -- this is fixed by obsolete the COPMPRM and added CCOPMPRM in lookup
5434 -- the code support for COPMPRM to make sure the customer has no problem
5435 -- if the data is logged, ct can get the data by changing the setup at anytime
5436
5437 hr_utility.set_location('valiating chg evt cd :', 10);
5438 if (change_event_is_enabled('COPMPRM',p_new_rec.effective_start_date) or
5439 change_event_is_enabled('CCOPMPRM',p_new_rec.effective_start_date) ) then
5440
5441 hr_utility.set_location('calling log event :', 10);
5442
5443 ben_ext_chg_evt_api.create_ext_chg_evt
5444 (p_validate => FALSE
5445 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
5446 ,p_chg_evt_cd => 'CCOPMPRM'
5447 ,p_chg_eff_dt => p_new_rec.effective_start_date
5448 ,p_business_group_id => p_new_rec.business_group_id
5449 ,p_person_id => l_person_id
5450 ,p_object_version_number => l_object_version_number
5451 ,p_effective_date => p_new_rec.effective_start_date
5452 ,p_old_val1 => p_old_rec.val
5453 ,p_old_val2 => p_old_rec.cr_val
5454 ,p_old_val3 => p_old_rec.mo_num
5455 ,p_old_val4 => p_old_rec.yr_num
5456 ,p_new_val1 => p_new_rec.val
5457 ,p_new_val2 => p_new_rec.cr_val
5458 ,p_new_val3 => p_new_rec.mo_num
5459 ,p_new_val4 => p_new_rec.yr_num
5460 );
5461
5462 end if ;
5463 end if ;
5464 --
5465 hr_utility.set_location('Exiting:'||l_proc, 99);
5466 --
5467 end log_prem_mo_chg;
5468
5469 --
5470 procedure log_school_chg
5471 (p_event in varchar2
5472 ,p_old_rec in g_per_school_rec_type
5473 ,p_new_rec in g_per_school_rec_type
5474 ) is
5475 --
5476 l_old_name PER_ESTABLISHMENTS.name%type ;
5477 l_new_name PER_ESTABLISHMENTS.name%type ;
5478 l_ext_chg_evt_log_id number ;
5479 l_object_version_number number;
5480
5481 Cursor c_name(p_establishment_id number) is
5482 select name from PER_ESTABLISHMENTS
5483 where establishment_id = p_establishment_id ;
5484
5485 --
5486 l_proc varchar2(72) := 'ben_ext_chlg.log_school_chg';
5487 Begin
5488 hr_utility.set_location('Entering:'||l_proc, 10);
5489 open c_name(p_old_rec.establishment_id) ;
5490 fetch c_name into l_old_name ;
5491 close c_name ;
5492
5493 open c_name(p_new_rec.establishment_id) ;
5494 fetch c_name into l_new_name ;
5495 close c_name ;
5496
5497 if nvl(l_new_name,'$$$$') <> nvl(l_old_name,'$$$$')
5498 or p_new_rec.attended_start_date <> p_old_rec.attended_start_date
5499 or p_new_rec.attended_end_date <> p_old_rec.attended_end_date then
5500 if change_event_is_enabled('COSCOL',p_new_rec.attended_start_date) then
5501 ben_ext_chg_evt_api.create_ext_chg_evt
5502 (p_validate => FALSE
5503 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
5504 ,p_chg_evt_cd => 'COSCOL'
5505 ,p_chg_eff_dt => p_new_rec.attended_start_date
5506 ,p_business_group_id => p_new_rec.business_group_id
5507 ,p_person_id => p_new_rec.person_id
5508 ,p_object_version_number => l_object_version_number
5509 ,p_effective_date => p_new_rec.attended_start_date
5510 ,p_old_val1 => l_old_name
5511 ,p_old_val2 => p_old_rec.attended_start_date
5512 ,p_old_val3 => p_old_rec.attended_end_date
5513 ,p_new_val1 => l_new_name
5514 ,p_new_val2 => p_new_rec.attended_start_date
5515 ,p_new_val3 => p_new_rec.attended_end_date
5516 );
5517 end if ;
5518 end if ;
5519 --
5520 hr_utility.set_location('Exiting:'||l_proc, 99);
5521 --
5522 end log_school_chg;
5523
5524
5525
5526
5527 procedure log_per_pay_chg
5528 (p_event in varchar2
5529 ,p_old_rec in g_per_pay_rec_type
5530 ,p_new_rec in g_per_pay_rec_type
5531 ) is
5532 --
5533 l_chg_eff_dt date;
5534 l_count number;
5535 l_ext_chg_evt_log_id number;
5536 l_object_version_number number;
5537 --
5538 l_proc varchar2(72) := 'ben_ext_chlg.log_per_pay_chg';
5539 cursor c_person (p_assignment_id number)
5540 is
5541 select person_id ,business_group_id
5542 from per_all_Assignments_f asg
5543 where asg.assignment_id = p_assignment_id ;
5544 --
5545 cursor c_old_sal(p_assignment_id number,p_change_date date) is
5546 select
5547 proposed_salary_n, approved
5548 from per_pay_proposals b
5549 where
5550 b.assignment_id = p_assignment_id
5551 and b.change_date =
5552 (select max(d.change_date)
5553 from per_pay_proposals d
5554 where d.assignment_id = b.assignment_id
5555 and approved = 'Y'
5556 and change_date < p_change_date )
5557 ;
5558
5559
5560 l_person_id number ;
5561 l_business_group_id number ;
5562 l_old_proposed_salary_n per_pay_proposals.proposed_salary_n%type := p_old_rec.proposed_salary_n;
5563 l_old_approved per_pay_proposals.approved%type ;
5564 --
5565 begin
5566 --
5567
5568 hr_utility.set_location('Entering:'||l_proc, 10);
5569 hr_utility.set_location('assignment_id:'||p_new_rec.assignment_id, 10);
5570 /*
5571 open c_person(p_new_rec.assignment_id);
5572 fetch c_person into l_person_id,l_business_group_id ;
5573 close c_person ;
5574 */
5575 hr_utility.set_location(' EVENT ' || p_event, 99 );
5576
5577 --- previously part of trigger now the trigger moved to api (pepyprhi.pkb)
5578 --- so the approved validation moved here
5579
5580 if nvl(p_new_rec.approved,'N') = 'Y' then
5581 if p_event = 'INSERT' then
5582 hr_utility.set_location('change_date' || p_new_rec.change_date,10);
5583 open c_old_sal(p_new_rec.assignment_id,p_new_rec.change_date);
5584 fetch c_old_sal into l_old_proposed_salary_n ,l_old_approved ;
5585 close c_old_sal ;
5586 hr_utility.set_location('salary ' || l_old_proposed_salary_n,10);
5587 end if ;
5588
5589
5590
5591 if nvl(l_old_proposed_salary_n,-1) <> nvl(p_new_rec.proposed_salary_n,-1)
5592 or nvl(nvl(l_old_approved,p_old_rec.approved),'N') <> nvl(p_new_rec.approved,'N') then
5593
5594 if change_event_is_enabled('COBSAL',p_new_rec.change_date) then
5595
5596 open c_person(p_new_rec.assignment_id);
5597 fetch c_person into l_person_id,l_business_group_id ;
5598 close c_person ;
5599
5600 ben_ext_chg_evt_api.create_ext_chg_evt
5601 (p_validate => FALSE
5602 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
5603 ,p_chg_evt_cd => 'COBSAL'
5604 ,p_chg_eff_dt => p_new_rec.change_date
5605 ,p_business_group_id => l_business_group_id
5606 ,p_person_id => l_person_id
5607 ,p_object_version_number => l_object_version_number
5608 ,p_effective_date => nvl(p_new_rec.change_date,p_new_rec.last_change_date)
5609 ,p_old_val1 => l_old_proposed_salary_n
5610 ,p_old_val2 => nvl(l_old_approved,p_old_rec.approved)
5611 ,p_new_val1 => p_new_rec.proposed_salary_n
5612 ,p_new_val2 => p_new_rec.approved
5613 );
5614 End if;
5615 end if ;
5616 end if ;
5617 --
5618 hr_utility.set_location('Exiting:'||l_proc, 99);
5619 --
5620 end log_per_pay_chg;
5621
5622 ----
5623
5624 procedure log_phn_chg
5625 (p_event in varchar2
5626 ,p_old_rec in g_phn_rec_type
5627 ,p_new_rec in g_phn_rec_type
5628 ) is
5629 --
5630 l_chg_evt_tab g_char_tab_type;
5631 l_prmtr_01_tab g_char_tab_type;
5632 l_prmtr_02_tab g_char_tab_type;
5633 l_prmtr_03_tab g_char_tab_type;
5634 l_prmtr_04_tab g_char_tab_type;
5635 l_prmtr_05_tab g_char_tab_type;
5636 l_prmtr_06_tab g_char_tab_type;
5637 l_prmtr_07_tab g_char_tab_type;
5638 l_new_val1 g_new_val;
5639 l_new_val2 g_new_val;
5640 l_new_val3 g_new_val;
5641 l_new_val4 g_new_val;
5642 l_new_val5 g_new_val;
5643 l_new_val6 g_new_val;
5644 l_old_val1 g_old_val;
5645 l_old_val2 g_old_val;
5646 l_old_val3 g_old_val;
5647 l_old_val4 g_old_val;
5648 l_old_val5 g_old_val;
5649 l_old_val6 g_old_val;
5650 l_tab_counter binary_integer := 0;
5651 l_chg_eff_dt date;
5652 l_count number := 0;
5653 l_ext_chg_evt_log_id number;
5654 l_object_version_number number;
5655 --
5656 l_proc varchar2(72) := 'ben_ext_chlg.log_phn_chg';
5657 --
5658 cursor c_termination_reason (p_termination_reason per_applications.termination_reason%type)
5659 is
5660 select meaning
5661 from hr_lookups hl
5662 where hl.lookup_type = 'TERM_APL_REASON'
5663 and hl.lookup_code = p_termination_reason
5664 and hl.enabled_flag = 'Y';
5665 --
5666 cursor c_business_group_id(p_person_id per_all_people_f.person_id%type
5667 /* ,p_effective_dt date */-- commented for bug 3361237
5668 )
5669 is
5670 select ppf.business_group_id
5671 from per_all_people_f ppf
5672 where ppf.person_id = p_person_id;
5673 /* and p_effective_dt between nvl(ppf.effective_start_date, sysdate)
5674 and nvl(ppf.effective_end_date, sysdate);*/
5675 -- commented for bug 3361237
5676 --
5677 l_old_termination_reason varchar2(50);
5678 l_new_termination_reason varchar2(50);
5679 l_chg_evt_code varchar2(10);
5680 l_business_group_id number;
5681 l_person_id number; --Bug 1554477
5682 l_update_mode varchar2(15); --Bug 1554477
5683 --
5684 begin
5685 --
5686 hr_utility.set_location('Entering:'||l_proc, 10);
5687 --
5688 if p_event = 'UPDATE' and p_new_rec.parent_table = 'PER_ALL_PEOPLE_F'
5689 and p_new_rec.phone_type in ('H1', 'W1', 'HF','M') then
5690 --
5691 --Start Bug 1554477
5692 if p_old_rec.date_to is null and
5693 p_new_rec.date_to is not null then
5694
5695 if p_new_rec.phone_type = 'H1' then
5696 l_chg_evt_code := 'AHPDT';
5697 elsif p_new_rec.phone_type = 'W1' then
5698 l_chg_evt_code := 'AWPDT';
5699 elsif p_new_rec.phone_type = 'HF' then
5700 l_chg_evt_code := 'AFPDT';
5701 elsif p_new_rec.phone_type = 'M' then
5702 l_chg_evt_code := 'AMDT';
5703 end if;
5704 l_chg_eff_dt := nvl(p_new_rec.date_to, sysdate);
5705 l_tab_counter := l_tab_counter + 1;
5706 l_chg_evt_tab(l_tab_counter) := l_chg_evt_code;
5707 l_prmtr_01_tab(l_tab_counter) := p_old_rec.phone_id;
5708 l_prmtr_02_tab(l_tab_counter) := null;
5709 l_prmtr_03_tab(l_tab_counter) := null;
5710 l_prmtr_04_tab(l_tab_counter) := null;
5711 l_prmtr_05_tab(l_tab_counter) := null;
5712 l_prmtr_06_tab(l_tab_counter) := null;
5713 l_prmtr_07_tab(l_tab_counter) := null;
5714 l_old_val1(l_tab_counter) := p_old_rec.phone_number;
5715 l_new_val1(l_tab_counter) := null;
5716 --
5717 l_update_mode := p_new_rec.update_mode;
5718 l_person_id := p_new_rec.parent_id;
5719 end if;
5720 --End Bug 1554477
5721
5722 if nvl(p_old_rec.phone_number, '$') <>
5723 nvl(p_new_rec.phone_number, '$') then
5724 if p_new_rec.phone_type = 'H1' then
5725 l_chg_evt_code := 'COHP';
5726 elsif p_new_rec.phone_type = 'W1' then
5727 l_chg_evt_code := 'COWP';
5728 elsif p_new_rec.phone_type = 'HF' then
5729 l_chg_evt_code := 'COFP';
5730 elsif p_new_rec.phone_type = 'M' then --Bug 1554477
5731 l_chg_evt_code := 'CMP';
5732 end if;
5733 l_chg_eff_dt := nvl(p_new_rec.date_from, sysdate);
5734 l_tab_counter := l_tab_counter + 1;
5735 l_chg_evt_tab(l_tab_counter) := l_chg_evt_code;
5736 l_prmtr_01_tab(l_tab_counter) := p_old_rec.phone_id;
5737 l_prmtr_02_tab(l_tab_counter) := null;
5738 l_prmtr_03_tab(l_tab_counter) := null;
5739 l_prmtr_04_tab(l_tab_counter) := null;
5740 l_prmtr_05_tab(l_tab_counter) := null;
5741 l_prmtr_06_tab(l_tab_counter) := null;
5742 l_prmtr_07_tab(l_tab_counter) := null;
5743 l_old_val1(l_tab_counter) := p_old_rec.phone_number;
5744 l_new_val1(l_tab_counter) := p_new_rec.phone_number;
5745 --
5746 l_update_mode := p_new_rec.update_mode;
5747 l_person_id := p_new_rec.parent_id;
5748 end if;
5749
5750 --Start Bug 1554477
5751 elsif p_event = 'INSERT' and p_new_rec.parent_table = 'PER_ALL_PEOPLE_F'
5752 and p_new_rec.phone_type in ('H1', 'W1', 'HF', 'M') then
5753 --
5754 if p_old_rec.date_to is null and
5755 p_new_rec.date_to is not null then
5756 if p_new_rec.phone_type = 'H1' then
5757 l_chg_evt_code := 'AHPDT';
5758 elsif p_new_rec.phone_type = 'W1' then
5759 l_chg_evt_code := 'AWPDT';
5760 elsif p_new_rec.phone_type = 'HF' then
5761 l_chg_evt_code := 'AFPDT';
5762 elsif p_new_rec.phone_type = 'M' then
5763 l_chg_evt_code := 'AMDT';
5764 end if;
5765 l_chg_eff_dt := nvl(p_new_rec.date_to, sysdate);
5766 l_tab_counter := l_tab_counter + 1;
5767 l_chg_evt_tab(l_tab_counter) := l_chg_evt_code;
5768 l_prmtr_01_tab(l_tab_counter) := p_old_rec.phone_id;
5769 l_prmtr_02_tab(l_tab_counter) := null;
5770 l_prmtr_03_tab(l_tab_counter) := null;
5771 l_prmtr_04_tab(l_tab_counter) := null;
5772 l_prmtr_05_tab(l_tab_counter) := null;
5773 l_prmtr_06_tab(l_tab_counter) := null;
5774 l_prmtr_07_tab(l_tab_counter) := null;
5775 l_old_val1(l_tab_counter) := p_new_rec.phone_number;
5776 l_new_val1(l_tab_counter) := null;
5777 --
5778 l_update_mode := p_new_rec.update_mode;
5779 l_person_id := p_new_rec.parent_id;
5780 end if;
5781
5782 if p_new_rec.phone_type = 'H1' then
5783 l_chg_evt_code := 'AHP';
5784 elsif p_new_rec.phone_type = 'W1' then
5785 l_chg_evt_code := 'AWP';
5786 elsif p_new_rec.phone_type = 'HF' then
5787 l_chg_evt_code := 'AFP';
5788 elsif p_new_rec.phone_type = 'M' then
5789 l_chg_evt_code := 'AMP';
5790 end if;
5791 l_chg_eff_dt := nvl(p_new_rec.date_from, sysdate);
5792 l_tab_counter := l_tab_counter + 1;
5793 l_chg_evt_tab(l_tab_counter) := l_chg_evt_code;
5794 l_prmtr_01_tab(l_tab_counter) := p_new_rec.phone_id;
5795 l_prmtr_02_tab(l_tab_counter) := null;
5796 l_prmtr_03_tab(l_tab_counter) := null;
5797 l_prmtr_04_tab(l_tab_counter) := null;
5798 l_prmtr_05_tab(l_tab_counter) := null;
5799 l_prmtr_06_tab(l_tab_counter) := null;
5800 l_prmtr_07_tab(l_tab_counter) := null;
5801 l_old_val1(l_tab_counter) := null;
5802 l_new_val1(l_tab_counter) := p_new_rec.phone_number;
5803 --
5804
5805 l_update_mode := p_new_rec.update_mode;
5806 l_person_id := p_new_rec.parent_id;
5807
5808 elsif p_event = 'DELETE' and p_old_rec.parent_table = 'PER_ALL_PEOPLE_F'
5809 and p_old_rec.phone_type in ('H1', 'W1', 'HF', 'M') then
5810 --
5811
5812 if p_old_rec.phone_type = 'H1' then
5813 l_chg_evt_code := 'DHP';
5814 elsif p_old_rec.phone_type = 'W1' then
5815 l_chg_evt_code := 'DWP';
5816 elsif p_old_rec.phone_type = 'HF' then
5817 l_chg_evt_code := 'DFP';
5818 elsif p_old_rec.phone_type = 'M' then
5819 l_chg_evt_code := 'DMP';
5820 end if;
5821 --l_chg_eff_dt := nvl(p_old_rec.date_from, sysdate);-- 3361237
5822 l_chg_eff_dt := greatest(nvl(p_old_rec.date_to, p_old_rec.date_from), sysdate);
5823 l_tab_counter := l_tab_counter + 1;
5824 l_chg_evt_tab(l_tab_counter) := l_chg_evt_code;
5825 l_prmtr_01_tab(l_tab_counter) := p_old_rec.phone_id;
5826 l_prmtr_02_tab(l_tab_counter) := null;
5827 l_prmtr_03_tab(l_tab_counter) := null;
5828 l_prmtr_04_tab(l_tab_counter) := null;
5829 l_prmtr_05_tab(l_tab_counter) := null;
5830 l_prmtr_06_tab(l_tab_counter) := null;
5831 l_prmtr_07_tab(l_tab_counter) := null;
5832 l_old_val1(l_tab_counter) := p_old_rec.phone_number;
5833 l_new_val1(l_tab_counter) := null;
5834 --
5835
5836 l_update_mode := p_old_rec.update_mode;
5837 l_person_id := p_old_rec.parent_id;
5838 end if;
5839
5840 --Bug 1554477
5841
5842 --
5843 open c_business_group_id(l_person_id); --, l_chg_eff_dt); -- commented for bug 3361237
5844 -- Bug 1554477
5845 fetch c_business_group_id into l_business_group_id;
5846 close c_business_group_id;
5847 hr_utility.set_location('l_business_group_id:'||l_business_group_id, 876);
5848
5849 for l_count in 1..l_chg_evt_tab.count loop
5850 if change_event_is_enabled(l_chg_evt_tab(l_count),l_chg_eff_dt) then
5851
5852 ben_ext_chg_evt_api.create_ext_chg_evt
5853 (p_validate => FALSE
5854 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
5855 ,p_chg_evt_cd => l_chg_evt_tab(l_count)
5856 ,p_chg_eff_dt => l_chg_eff_dt
5857 ,p_prmtr_01 => l_prmtr_01_tab(l_count)
5858 ,p_prmtr_02 => l_prmtr_02_tab(l_count)
5859 ,p_prmtr_03 => l_prmtr_03_tab(l_count)
5860 ,p_prmtr_04 => l_prmtr_04_tab(l_count)
5861 ,p_prmtr_05 => l_prmtr_05_tab(l_count)
5862 ,p_prmtr_06 => l_prmtr_06_tab(l_count)
5863 ,p_prmtr_07 => l_prmtr_07_tab(l_count)
5864 ,p_prmtr_10 => l_update_mode --Bug 1554477
5865 ,p_person_id => l_person_id --Bug 1554477
5866 ,p_business_group_id => l_business_group_id
5867 ,p_object_version_number => l_object_version_number
5868 ,p_effective_date => l_chg_eff_dt
5869 ,p_new_val1 => l_new_val1(l_count)
5870 ,p_old_val1 => l_old_val1(l_count)
5871 );
5872
5873 end if;
5874 end loop;
5875 --
5876 hr_utility.set_location('Exiting:'||l_proc, 99);
5877 --
5878 end log_phn_chg;
5879 --
5880 procedure log_ptu_chg
5881 (p_event in varchar2
5882 ,p_old_rec in g_ptu_rec_type
5883 ,p_new_rec in g_ptu_rec_type
5884 ) is
5885 --
5886 l_chg_evt_tab g_char_tab_type;
5887 l_prmtr_01_tab g_char_tab_type;
5888 l_prmtr_02_tab g_char_tab_type;
5889 l_prmtr_03_tab g_char_tab_type;
5890 l_prmtr_04_tab g_char_tab_type;
5891 l_prmtr_05_tab g_char_tab_type;
5892 l_prmtr_06_tab g_char_tab_type;
5893 l_prmtr_07_tab g_char_tab_type;
5894 l_new_val1 g_new_val;
5895 l_new_val2 g_new_val;
5896 l_new_val3 g_new_val;
5897 l_new_val4 g_new_val;
5898 l_new_val5 g_new_val;
5899 l_new_val6 g_new_val;
5900 l_old_val1 g_old_val;
5901 l_old_val2 g_old_val;
5902 l_old_val3 g_old_val;
5903 l_old_val4 g_old_val;
5904 l_old_val5 g_old_val;
5905 l_old_val6 g_old_val;
5906 l_tab_counter binary_integer := 0;
5907 l_chg_eff_dt date;
5908 l_count number := 0;
5909 l_ext_chg_evt_log_id number;
5910 l_object_version_number number;
5911 l_old_user_person_type ben_ext_chg_evt_log.old_val1%TYPE;
5912 l_old_person_typ ben_ext_chg_evt_log.old_val1%TYPE;
5913 l_new_user_person_type ben_ext_chg_evt_log.new_val1%TYPE;
5914 -- Bug 4705814.
5915 --
5916 l_proc varchar2(72) := 'ben_ext_chlg.log_ptu_chg';
5917 --
5918 cursor c_person_type(p_person_type_id per_person_types.person_type_id%type)
5919 is
5920 select ppt.system_person_type, ppt.user_person_type, ppt.business_group_id
5921 from per_person_types ppt
5922 where ppt.person_type_id = p_person_type_id;
5923 --
5924 l_chg_evt_code varchar2(30);
5925 l_person_type varchar2(30);
5926 l_business_group_id number;
5927 --
5928 begin
5929 --
5930 hr_utility.set_location('Entering:'||l_proc, 10);
5931 --
5932 if p_event = 'INSERT' then
5933 --
5934 open c_person_type(p_new_rec.person_type_id);
5935 fetch c_person_type into l_person_type, l_new_user_person_type, l_business_group_id;
5936 close c_person_type;
5937
5938 l_chg_evt_code := null;
5939 if l_person_type = 'EMP' then
5940 l_chg_evt_code := 'AEPTU';
5941 elsif l_person_type = 'BNF' then
5942 l_chg_evt_code := 'ABPTU';
5943 elsif l_person_type = 'DPNT' then
5944 l_chg_evt_code := 'ADPTU';
5945 elsif l_person_type = 'PRTN' then
5946 l_chg_evt_code := 'APPTU';
5947 end if;
5948
5949 open c_person_type(p_old_rec.person_type_id);
5950 fetch c_person_type into l_old_person_typ, l_old_user_person_type, l_business_group_id;
5951 close c_person_type;
5952
5953 if l_chg_evt_code is not null then
5954
5955 l_chg_eff_dt := nvl(p_new_rec.effective_start_date, sysdate);
5956 l_tab_counter := l_tab_counter + 1;
5957 l_chg_evt_tab(l_tab_counter) := l_chg_evt_code;
5958 l_prmtr_01_tab(l_tab_counter) := p_new_rec.person_type_usage_id;
5959 l_prmtr_02_tab(l_tab_counter) := null;
5960 l_prmtr_03_tab(l_tab_counter) := null;
5961 l_prmtr_04_tab(l_tab_counter) := null;
5962 l_prmtr_05_tab(l_tab_counter) := null;
5963 l_prmtr_06_tab(l_tab_counter) := null;
5964 l_prmtr_07_tab(l_tab_counter) := null;
5965 l_old_val1(l_tab_counter) := l_old_user_person_type; -- null;
5966 l_new_val1(l_tab_counter) := l_new_user_person_type; -- null;
5967 -- Bug 4705814, passing person_type ( Initially passed NULLs ) to Old, New Values
5968
5969 end if;
5970
5971 end if;
5972 --
5973 for l_count in 1..l_chg_evt_tab.count loop
5974 if change_event_is_enabled(l_chg_evt_tab(l_count),l_chg_eff_dt) then
5975 ben_ext_chg_evt_api.create_ext_chg_evt
5976 (p_validate => FALSE
5977 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
5978 ,p_chg_evt_cd => l_chg_evt_tab(l_count)
5979 ,p_chg_eff_dt => l_chg_eff_dt
5980 ,p_prmtr_01 => l_prmtr_01_tab(l_count)
5981 ,p_prmtr_02 => l_prmtr_02_tab(l_count)
5982 ,p_prmtr_03 => l_prmtr_03_tab(l_count)
5983 ,p_prmtr_04 => l_prmtr_04_tab(l_count)
5984 ,p_prmtr_05 => l_prmtr_05_tab(l_count)
5985 ,p_prmtr_06 => l_prmtr_06_tab(l_count)
5986 ,p_prmtr_07 => l_prmtr_07_tab(l_count)
5987 ,p_prmtr_10 => p_new_rec.update_mode
5988 ,p_person_id => p_new_rec.person_id
5989 ,p_business_group_id => l_business_group_id
5990 ,p_object_version_number => l_object_version_number
5991 ,p_effective_date => l_chg_eff_dt
5992 ,p_new_val1 => l_new_val1(l_count)
5993 ,p_old_val1 => l_old_val1(l_count)
5994 );
5995 end if;
5996 end loop;
5997 --
5998 hr_utility.set_location('Exiting:'||l_proc, 99);
5999 --
6000 end log_ptu_chg;
6001 --
6002 procedure log_element_chg(
6003 p_action in varchar2,
6004 p_amt in number default null,
6005 p_old_amt in number default null,
6006 p_input_value_id in number default null,
6007 p_element_entry_id in number default null,
6008 p_person_id in number default null,
6009 p_effective_start_date in date default null,
6010 p_effective_end_date in date default null,
6011 p_business_group_id in number,
6012 p_effective_date in date) is
6013 --
6014 l_proc varchar2(72) := 'ben_ext_chlg.log_element_chg';
6015 --
6016 l_object_version_number number;
6017 l_ext_chg_evt_log_id number;
6018 --
6019 cursor c_get_element_info (p_input_value_id number) is
6020 select iv.name, et.element_name
6021 from pay_input_values_f iv,
6022 pay_element_types_f et
6023 where iv.input_value_id = p_input_value_id
6024 and iv.element_type_id = et.element_type_id
6025 and p_effective_date between iv.effective_start_date and iv.effective_end_date
6026 and p_effective_date between et.effective_start_date and et.effective_end_date;
6027 --
6028 l_element_info c_get_element_info%rowtype;
6029
6030 --
6031 begin
6032 --
6033 hr_utility.set_location('Entering:'||l_proc, 10);
6034 --
6035 open c_get_element_info(p_input_value_id);
6036 fetch c_get_element_info into l_element_info;
6037 close c_get_element_info;
6038 --
6039 if p_action = 'CREATE' then
6040 if change_event_is_enabled('AEE',p_effective_date) then
6041 ben_ext_chg_evt_api.create_ext_chg_evt
6042 (p_validate => FALSE
6043 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
6044 ,p_chg_evt_cd => 'AEE'
6045 ,p_chg_eff_dt => p_effective_date
6046 ,p_prmtr_01 => p_element_entry_id
6047 ,p_prmtr_02 => p_input_value_id
6048 ,p_person_id => p_person_id
6049 ,p_business_group_id => p_business_group_id
6050 ,p_object_version_number => l_object_version_number
6051 ,p_effective_date => p_effective_date
6052 ,p_new_val1 => l_element_info.element_name
6053 ,p_new_val2 => l_element_info.name
6054 ,p_new_val3 => p_amt);
6055 end if;
6056 --
6057 elsif p_action = 'UPDATE' then
6058 if change_event_is_enabled('UEE',p_effective_date) then
6059 ben_ext_chg_evt_api.create_ext_chg_evt
6060 (p_validate => FALSE
6061 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
6062 ,p_chg_evt_cd => 'UEE'
6063 ,p_chg_eff_dt => p_effective_date
6064 ,p_prmtr_01 => p_element_entry_id
6065 ,p_prmtr_02 => p_input_value_id
6066 ,p_person_id => p_person_id
6067 ,p_business_group_id => p_business_group_id
6068 ,p_object_version_number => l_object_version_number
6069 ,p_effective_date => p_effective_date
6070 ,p_old_val1 => l_element_info.element_name
6071 ,p_old_val2 => l_element_info.name
6072 ,p_old_val3 => p_old_amt
6073 ,p_new_val1 => l_element_info.element_name
6074 ,p_new_val2 => l_element_info.name
6075 ,p_new_val3 => p_amt);
6076 end if;
6077 --
6078 elsif p_action = 'DELETE' then
6079 hr_utility.set_location('deleteing element entry ' , 195);
6080 if change_event_is_enabled('DEE',p_effective_date) then
6081 ben_ext_chg_evt_api.create_ext_chg_evt
6082 (p_validate => FALSE
6083 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
6084 ,p_chg_evt_cd => 'DEE'
6085 ,p_chg_eff_dt => p_effective_date
6086 ,p_prmtr_01 => p_element_entry_id
6087 ,p_prmtr_02 => p_input_value_id
6088 ,p_person_id => p_person_id
6089 ,p_business_group_id => p_business_group_id
6090 ,p_object_version_number => l_object_version_number
6091 ,p_effective_date => p_effective_date
6092 ,p_old_val1 => l_element_info.element_name
6093 ,p_old_val2 => l_element_info.name
6094 ,p_old_val3 => p_old_amt);
6095 end if;
6096 end if;
6097 --
6098 --
6099 hr_utility.set_location('Exiting:'||l_proc, 99);
6100 --
6101 end log_element_chg;
6102 --
6103 -- procedure for logging changes to per_disabilities_f
6104 procedure log_per_dis_chg
6105 (p_event in varchar2
6106 ,p_old_rec in per_dis_rec_type
6107 ,p_new_rec in per_dis_rec_type
6108 ) is
6109 --
6110 l_chg_evt_tab g_char_tab_type;
6111 l_prmtr_01_tab g_char_tab_type;
6112 l_prmtr_02_tab g_char_tab_type;
6113 l_prmtr_03_tab g_char_tab_type;
6114 l_prmtr_04_tab g_char_tab_type;
6115 l_prmtr_05_tab g_char_tab_type;
6116 l_prmtr_06_tab g_char_tab_type;
6117 l_prmtr_07_tab g_char_tab_type;
6118 l_old_val1 g_old_val;
6119 l_old_val2 g_old_val;
6120 l_old_val3 g_old_val;
6121 l_old_val4 g_old_val;
6122 l_old_val5 g_old_val;
6123 l_old_val6 g_old_val;
6124 l_new_val1 g_new_val;
6125 l_new_val2 g_new_val;
6126 l_new_val3 g_new_val;
6127 l_new_val4 g_new_val;
6128 l_new_val5 g_new_val;
6129 l_new_val6 g_new_val;
6130 l_tab_counter binary_integer := 0;
6131 l_chg_eff_dt date;
6132 l_count number;
6133 l_ext_chg_evt_log_id number;
6134 l_object_version_number number;
6135 --
6136 cursor c_lookup_value
6137 (p_lookup_type hr_lookups.lookup_type%type
6138 ,p_lookup_code hr_lookups.lookup_code%type
6139 )
6140 is
6141 select meaning
6142 from hr_lookups hl
6143 where hl.lookup_type = p_lookup_type
6144 and hl.lookup_code = p_lookup_code;
6145
6146 --
6147 l_proc varchar2(100) := 'ben_ext_chlg.log_per_dis_chg';
6148 --
6149
6150 --
6151 l_old_categoryname hr_lookups.meaning%type;
6152 l_new_categoryname hr_lookups.meaning%type;
6153 l_old_reason hr_lookups.meaning%type;
6154 l_new_reason hr_lookups.meaning%type;
6155 l_old_status hr_lookups.meaning%type;
6156 l_new_status hr_lookups.meaning%type;
6157 l_old_incident per_work_incidents.incident_reference%type;
6158 l_new_incident per_work_incidents.incident_reference%type;
6159 l_old_organization hr_all_organization_units.name%type;
6160 l_new_organization hr_all_organization_units.name%type;
6161
6162 --
6163 begin
6164 --
6165 hr_utility.set_location('Entering:'|| l_proc, 10);
6166 --
6167 if p_event = 'UPDATE' then
6168
6169 if nvl(p_old_rec.incident_id,1) <> nvl(p_new_rec.incident_id,1) then
6170
6171 select incident_reference into l_old_incident
6172 from per_work_incidents
6173 where incident_id = p_old_rec.incident_id ;
6174
6175 select incident_reference into l_new_incident
6176 from per_work_incidents
6177 where incident_id = l_new_incident ;
6178
6179 l_tab_counter := l_tab_counter + 1;
6180 l_chg_evt_tab(l_tab_counter) := 'CINCID';
6181 l_prmtr_01_tab(l_tab_counter) := null;
6182 l_prmtr_02_tab(l_tab_counter) := null;
6183 l_prmtr_03_tab(l_tab_counter) := null;
6184 l_prmtr_04_tab(l_tab_counter) := null;
6185 l_prmtr_05_tab(l_tab_counter) := null;
6186 l_prmtr_06_tab(l_tab_counter) := null;
6187 l_prmtr_07_tab(l_tab_counter) := null;
6188 l_old_val1(l_tab_counter) := l_old_incident;
6189 l_new_val1(l_tab_counter) := l_new_incident;
6190 l_old_val2(l_tab_counter) := null;
6191 l_old_val3(l_tab_counter) := null;
6192 l_old_val4(l_tab_counter) := null;
6193 l_old_val5(l_tab_counter) := null;
6194 l_old_val6(l_tab_counter) := null;
6195 l_new_val2(l_tab_counter) := null;
6196 l_new_val3(l_tab_counter) := null;
6197 l_new_val4(l_tab_counter) := null;
6198 l_new_val5(l_tab_counter) := null;
6199 l_new_val6(l_tab_counter) := null;
6200 end if;
6201
6202 if nvl(p_old_rec.organization_id,1) <> nvl(p_new_rec.organization_id,1) then
6203
6204 select name into l_old_organization
6205 from hr_all_organization_units
6206 where organization_id = p_old_rec.organization_id ;
6207
6208 select name into l_new_organization
6209 from hr_all_organization_units
6210 where organization_id = p_new_rec.organization_id ;
6211
6212 l_tab_counter := l_tab_counter + 1;
6213 l_chg_evt_tab(l_tab_counter) := 'CORGID';
6214 l_prmtr_01_tab(l_tab_counter) := null;
6215 l_prmtr_02_tab(l_tab_counter) := null;
6216 l_prmtr_03_tab(l_tab_counter) := null;
6217 l_prmtr_04_tab(l_tab_counter) := null;
6218 l_prmtr_05_tab(l_tab_counter) := null;
6219 l_prmtr_06_tab(l_tab_counter) := null;
6220 l_prmtr_07_tab(l_tab_counter) := null;
6221 l_old_val1(l_tab_counter) := l_old_organization;
6222 l_new_val1(l_tab_counter) := l_new_organization;
6223 l_old_val2(l_tab_counter) := null;
6224 l_old_val3(l_tab_counter) := null;
6225 l_old_val4(l_tab_counter) := null;
6226 l_old_val5(l_tab_counter) := null;
6227 l_old_val6(l_tab_counter) := null;
6228 l_new_val2(l_tab_counter) := null;
6229 l_new_val3(l_tab_counter) := null;
6230 l_new_val4(l_tab_counter) := null;
6231 l_new_val5(l_tab_counter) := null;
6232 l_new_val6(l_tab_counter) := null;
6233 end if;
6234
6235 if nvl(p_old_rec.registration_id,'$$$$$') <> nvl(p_new_rec.registration_id,'$$$$$') then
6236 l_tab_counter := l_tab_counter + 1;
6237 l_chg_evt_tab(l_tab_counter) := 'CREGID';
6238 l_prmtr_01_tab(l_tab_counter) := null;
6239 l_prmtr_02_tab(l_tab_counter) := null;
6240 l_prmtr_03_tab(l_tab_counter) := null;
6241 l_prmtr_04_tab(l_tab_counter) := null;
6242 l_prmtr_05_tab(l_tab_counter) := null;
6243 l_prmtr_06_tab(l_tab_counter) := null;
6244 l_prmtr_07_tab(l_tab_counter) := null;
6245 l_old_val1(l_tab_counter) := p_old_rec.registration_id;
6246 l_new_val1(l_tab_counter) := p_new_rec.registration_id;
6247 l_old_val2(l_tab_counter) := null;
6248 l_old_val3(l_tab_counter) := null;
6249 l_old_val4(l_tab_counter) := null;
6250 l_old_val5(l_tab_counter) := null;
6251 l_old_val6(l_tab_counter) := null;
6252 l_new_val2(l_tab_counter) := null;
6253 l_new_val3(l_tab_counter) := null;
6254 l_new_val4(l_tab_counter) := null;
6255 l_new_val5(l_tab_counter) := null;
6256 l_new_val6(l_tab_counter) := null;
6257 end if;
6258
6259 if nvl(p_old_rec.registration_date,to_date('01/01/0001', 'dd/mm/yyyy')) <> nvl(p_new_rec.registration_date,to_date('01/01/0001', 'dd/mm/yyyy')) then
6260 l_tab_counter := l_tab_counter + 1;
6261 l_chg_evt_tab(l_tab_counter) := 'CREGDT';
6262 l_prmtr_01_tab(l_tab_counter) := null;
6263 l_prmtr_02_tab(l_tab_counter) := null;
6264 l_prmtr_03_tab(l_tab_counter) := null;
6265 l_prmtr_04_tab(l_tab_counter) := null;
6266 l_prmtr_05_tab(l_tab_counter) := null;
6267 l_prmtr_06_tab(l_tab_counter) := null;
6268 l_prmtr_07_tab(l_tab_counter) := null;
6269 l_old_val1(l_tab_counter) := p_old_rec.registration_date;
6270 l_new_val1(l_tab_counter) := p_new_rec.registration_date;
6271 l_old_val2(l_tab_counter) := null;
6272 l_old_val3(l_tab_counter) := null;
6273 l_old_val4(l_tab_counter) := null;
6274 l_old_val5(l_tab_counter) := null;
6275 l_old_val6(l_tab_counter) := null;
6276 l_new_val2(l_tab_counter) := null;
6277 l_new_val3(l_tab_counter) := null;
6278 l_new_val4(l_tab_counter) := null;
6279 l_new_val5(l_tab_counter) := null;
6280 l_new_val6(l_tab_counter) := null;
6281 end if;
6282
6283 if nvl(p_old_rec.registration_exp_date,to_date('01/01/0001', 'dd/mm/yyyy')) <> nvl(p_new_rec.registration_exp_date,to_date('01/01/0001', 'dd/mm/yyyy')) then
6284 l_tab_counter := l_tab_counter + 1;
6285 l_chg_evt_tab(l_tab_counter) := 'CREGEXPDT';
6286 l_prmtr_01_tab(l_tab_counter) := null;
6287 l_prmtr_02_tab(l_tab_counter) := null;
6288 l_prmtr_03_tab(l_tab_counter) := null;
6289 l_prmtr_04_tab(l_tab_counter) := null;
6290 l_prmtr_05_tab(l_tab_counter) := null;
6291 l_prmtr_06_tab(l_tab_counter) := null;
6292 l_prmtr_07_tab(l_tab_counter) := null;
6293 l_old_val1(l_tab_counter) := p_old_rec.registration_exp_date;
6294 l_new_val1(l_tab_counter) := p_new_rec.registration_exp_date;
6295 l_old_val2(l_tab_counter) := null;
6296 l_old_val3(l_tab_counter) := null;
6297 l_old_val4(l_tab_counter) := null;
6298 l_old_val5(l_tab_counter) := null;
6299 l_old_val6(l_tab_counter) := null;
6300 l_new_val2(l_tab_counter) := null;
6301 l_new_val3(l_tab_counter) := null;
6302 l_new_val4(l_tab_counter) := null;
6303 l_new_val5(l_tab_counter) := null;
6304 l_new_val6(l_tab_counter) := null;
6305 end if;
6306
6307 if nvl(p_old_rec.categoryname,'$$$$$') <> nvl(p_new_rec.categoryname,'$$$$$') then
6308 -- read category name from lookup table
6309 open c_lookup_value('DISABILITY_CATEGORY', p_old_rec.categoryname);
6310 fetch c_lookup_value into l_old_categoryname;
6311 close c_lookup_value;
6312 open c_lookup_value('DISABILITY_CATEGORY', p_new_rec.categoryname);
6313 fetch c_lookup_value into l_new_categoryname;
6314 close c_lookup_value;
6315 l_tab_counter := l_tab_counter + 1;
6316 l_chg_evt_tab(l_tab_counter) := 'CDISCAT';
6317 l_prmtr_01_tab(l_tab_counter) := null;
6318 l_prmtr_02_tab(l_tab_counter) := null;
6319 l_prmtr_03_tab(l_tab_counter) := null;
6320 l_prmtr_04_tab(l_tab_counter) := null;
6321 l_prmtr_05_tab(l_tab_counter) := null;
6322 l_prmtr_06_tab(l_tab_counter) := null;
6323 l_prmtr_07_tab(l_tab_counter) := null;
6324 l_old_val1(l_tab_counter) := l_old_categoryname ;
6325 l_new_val1(l_tab_counter) := l_new_categoryname;
6326 l_old_val2(l_tab_counter) := null;
6327 l_old_val3(l_tab_counter) := null;
6328 l_old_val4(l_tab_counter) := null;
6329 l_old_val5(l_tab_counter) := null;
6330 l_old_val6(l_tab_counter) := null;
6331 l_new_val2(l_tab_counter) := null;
6332 l_new_val3(l_tab_counter) := null;
6333 l_new_val4(l_tab_counter) := null;
6334 l_new_val5(l_tab_counter) := null;
6335 l_new_val6(l_tab_counter) := null;
6336 end if;
6337
6338 if nvl(p_old_rec.description,'$$$$$') <> nvl(p_new_rec.description,'$$$$$') then
6339 l_tab_counter := l_tab_counter + 1;
6340 l_chg_evt_tab(l_tab_counter) := 'CDESC';
6341 l_prmtr_01_tab(l_tab_counter) := null;
6342 l_prmtr_02_tab(l_tab_counter) := null;
6343 l_prmtr_03_tab(l_tab_counter) := null;
6344 l_prmtr_04_tab(l_tab_counter) := null;
6345 l_prmtr_05_tab(l_tab_counter) := null;
6346 l_prmtr_06_tab(l_tab_counter) := null;
6347 l_prmtr_07_tab(l_tab_counter) := null;
6348 l_old_val1(l_tab_counter) := p_old_rec.description;
6349 l_new_val1(l_tab_counter) := p_new_rec.description;
6350 l_old_val2(l_tab_counter) := null;
6351 l_old_val3(l_tab_counter) := null;
6352 l_old_val4(l_tab_counter) := null;
6353 l_old_val5(l_tab_counter) := null;
6354 l_old_val6(l_tab_counter) := null;
6355 l_new_val2(l_tab_counter) := null;
6356 l_new_val3(l_tab_counter) := null;
6357 l_new_val4(l_tab_counter) := null;
6358 l_new_val5(l_tab_counter) := null;
6359 l_new_val6(l_tab_counter) := null;
6360 end if;
6361
6362 if nvl(p_old_rec.degree,1) <> nvl(p_new_rec.degree,1) then
6363 l_tab_counter := l_tab_counter + 1;
6364 l_chg_evt_tab(l_tab_counter) := 'CDEG';
6365 l_prmtr_01_tab(l_tab_counter) := null;
6366 l_prmtr_02_tab(l_tab_counter) := null;
6367 l_prmtr_03_tab(l_tab_counter) := null;
6368 l_prmtr_04_tab(l_tab_counter) := null;
6369 l_prmtr_05_tab(l_tab_counter) := null;
6370 l_prmtr_06_tab(l_tab_counter) := null;
6371 l_prmtr_07_tab(l_tab_counter) := null;
6372 l_old_val1(l_tab_counter) := p_old_rec.degree;
6373 l_new_val1(l_tab_counter) := p_new_rec.degree;
6374 l_old_val2(l_tab_counter) := null;
6375 l_old_val3(l_tab_counter) := null;
6376 l_old_val4(l_tab_counter) := null;
6377 l_old_val5(l_tab_counter) := null;
6378 l_old_val6(l_tab_counter) := null;
6379 l_new_val2(l_tab_counter) := null;
6380 l_new_val3(l_tab_counter) := null;
6381 l_new_val4(l_tab_counter) := null;
6382 l_new_val5(l_tab_counter) := null;
6383 l_new_val6(l_tab_counter) := null;
6384 end if;
6385
6386 if nvl(p_old_rec.quota_fte,1) <> nvl(p_new_rec.quota_fte,1) then
6387 l_tab_counter := l_tab_counter + 1;
6388 l_chg_evt_tab(l_tab_counter) := 'CQTA';
6389 l_prmtr_01_tab(l_tab_counter) := null;
6390 l_prmtr_02_tab(l_tab_counter) := null;
6391 l_prmtr_03_tab(l_tab_counter) := null;
6392 l_prmtr_04_tab(l_tab_counter) := null;
6393 l_prmtr_05_tab(l_tab_counter) := null;
6394 l_prmtr_06_tab(l_tab_counter) := null;
6395 l_prmtr_07_tab(l_tab_counter) := null;
6396 l_old_val1(l_tab_counter) := p_old_rec.quota_fte;
6397 l_new_val1(l_tab_counter) := p_new_rec.quota_fte;
6398 l_old_val2(l_tab_counter) := null;
6399 l_old_val3(l_tab_counter) := null;
6400 l_old_val4(l_tab_counter) := null;
6401 l_old_val5(l_tab_counter) := null;
6402 l_old_val6(l_tab_counter) := null;
6403 l_new_val2(l_tab_counter) := null;
6404 l_new_val3(l_tab_counter) := null;
6405 l_new_val4(l_tab_counter) := null;
6406 l_new_val5(l_tab_counter) := null;
6407 l_new_val6(l_tab_counter) := null;
6408 end if;
6409
6410 if nvl(p_old_rec.reason,'$$$$$') <> nvl(p_new_rec.reason,'$$$$$') then
6411 -- read reason from lookup table
6412 open c_lookup_value('DISABILITY_REASON', p_old_rec.reason);
6413 fetch c_lookup_value into l_old_reason;
6414 close c_lookup_value;
6415 open c_lookup_value('DISABILITY_REASON', p_new_rec.reason);
6416 fetch c_lookup_value into l_new_reason;
6417 close c_lookup_value;
6418 l_tab_counter := l_tab_counter + 1;
6419 l_chg_evt_tab(l_tab_counter) := 'CDISRSN';
6420 l_prmtr_01_tab(l_tab_counter) := null;
6421 l_prmtr_02_tab(l_tab_counter) := null;
6422 l_prmtr_03_tab(l_tab_counter) := null;
6423 l_prmtr_04_tab(l_tab_counter) := null;
6424 l_prmtr_05_tab(l_tab_counter) := null;
6425 l_prmtr_06_tab(l_tab_counter) := null;
6426 l_prmtr_07_tab(l_tab_counter) := null;
6427 l_old_val1(l_tab_counter) := l_old_reason;
6428 l_new_val1(l_tab_counter) := l_new_reason;
6429 l_old_val2(l_tab_counter) := null;
6430 l_old_val3(l_tab_counter) := null;
6431 l_old_val4(l_tab_counter) := null;
6432 l_old_val5(l_tab_counter) := null;
6433 l_old_val6(l_tab_counter) := null;
6434 l_new_val2(l_tab_counter) := null;
6435 l_new_val3(l_tab_counter) := null;
6436 l_new_val4(l_tab_counter) := null;
6437 l_new_val5(l_tab_counter) := null;
6438 l_new_val6(l_tab_counter) := null;
6439 end if;
6440
6441 if nvl(p_old_rec.pre_registration_job,'$$$$$') <> nvl(p_new_rec.pre_registration_job,'$$$$$') then
6442 l_tab_counter := l_tab_counter + 1;
6443 l_chg_evt_tab(l_tab_counter) := 'CPRREGJOB';
6444 l_prmtr_01_tab(l_tab_counter) := null;
6445 l_prmtr_02_tab(l_tab_counter) := null;
6446 l_prmtr_03_tab(l_tab_counter) := null;
6447 l_prmtr_04_tab(l_tab_counter) := null;
6448 l_prmtr_05_tab(l_tab_counter) := null;
6449 l_prmtr_06_tab(l_tab_counter) := null;
6450 l_prmtr_07_tab(l_tab_counter) := null;
6451 l_old_val1(l_tab_counter) := p_old_rec.pre_registration_job;
6452 l_new_val1(l_tab_counter) := p_new_rec.pre_registration_job;
6453 l_old_val2(l_tab_counter) := null;
6454 l_old_val3(l_tab_counter) := null;
6455 l_old_val4(l_tab_counter) := null;
6456 l_old_val5(l_tab_counter) := null;
6457 l_old_val6(l_tab_counter) := null;
6458 l_new_val2(l_tab_counter) := null;
6459 l_new_val3(l_tab_counter) := null;
6460 l_new_val4(l_tab_counter) := null;
6461 l_new_val5(l_tab_counter) := null;
6462 l_new_val6(l_tab_counter) := null;
6463 end if;
6464
6465 if nvl(p_old_rec.work_restriction,'$$$$$') <> nvl(p_new_rec.work_restriction,'$$$$$') then
6466 l_tab_counter := l_tab_counter + 1;
6467 l_chg_evt_tab(l_tab_counter) := 'CWRKRESTR';
6468 l_prmtr_01_tab(l_tab_counter) := null;
6469 l_prmtr_02_tab(l_tab_counter) := null;
6470 l_prmtr_03_tab(l_tab_counter) := null;
6471 l_prmtr_04_tab(l_tab_counter) := null;
6472 l_prmtr_05_tab(l_tab_counter) := null;
6473 l_prmtr_06_tab(l_tab_counter) := null;
6474 l_prmtr_07_tab(l_tab_counter) := null;
6475 l_old_val1(l_tab_counter) := p_old_rec.work_restriction;
6476 l_new_val1(l_tab_counter) := p_new_rec.work_restriction;
6477 l_old_val2(l_tab_counter) := null;
6478 l_old_val3(l_tab_counter) := null;
6479 l_old_val4(l_tab_counter) := null;
6480 l_old_val5(l_tab_counter) := null;
6481 l_old_val6(l_tab_counter) := null;
6482 l_new_val2(l_tab_counter) := null;
6483 l_new_val3(l_tab_counter) := null;
6484 l_new_val4(l_tab_counter) := null;
6485 l_new_val5(l_tab_counter) := null;
6486 l_new_val6(l_tab_counter) := null;
6487 end if;
6488
6489
6490 if nvl(p_old_rec.status,'$$$$$') <> nvl(p_new_rec.status,'$$$$$') then
6491 -- read status from lookup table
6492 open c_lookup_value('DISABILITY_STATUS', p_old_rec.status);
6493 fetch c_lookup_value into l_old_status;
6494 close c_lookup_value;
6495 open c_lookup_value('DISABILITY_STATUS', p_new_rec.status);
6496 fetch c_lookup_value into l_new_status;
6497 close c_lookup_value;
6498 l_tab_counter := l_tab_counter + 1;
6499 l_chg_evt_tab(l_tab_counter) := 'CODS';
6500 l_prmtr_01_tab(l_tab_counter) := null;
6501 l_prmtr_02_tab(l_tab_counter) := null;
6502 l_prmtr_03_tab(l_tab_counter) := null;
6503 l_prmtr_04_tab(l_tab_counter) := null;
6504 l_prmtr_05_tab(l_tab_counter) := null;
6505 l_prmtr_06_tab(l_tab_counter) := null;
6506 l_prmtr_07_tab(l_tab_counter) := null;
6507 l_old_val1(l_tab_counter) := l_old_status;
6508 l_new_val1(l_tab_counter) := l_new_status;
6509 l_old_val2(l_tab_counter) := null;
6510 l_old_val3(l_tab_counter) := null;
6511 l_old_val4(l_tab_counter) := null;
6512 l_old_val5(l_tab_counter) := null;
6513 l_old_val6(l_tab_counter) := null;
6514 l_new_val2(l_tab_counter) := null;
6515 l_new_val3(l_tab_counter) := null;
6516 l_new_val4(l_tab_counter) := null;
6517 l_new_val5(l_tab_counter) := null;
6518 l_new_val6(l_tab_counter) := null;
6519 end if;
6520
6521 if nvl(p_old_rec.attribute1,'$$$$$') <> nvl(p_new_rec.attribute1,'$$$$$') then
6522 l_tab_counter := l_tab_counter + 1;
6523 l_chg_evt_tab(l_tab_counter) := 'CATTR1';
6524 l_prmtr_01_tab(l_tab_counter) := null;
6525 l_prmtr_02_tab(l_tab_counter) := null;
6526 l_prmtr_03_tab(l_tab_counter) := null;
6527 l_prmtr_04_tab(l_tab_counter) := null;
6528 l_prmtr_05_tab(l_tab_counter) := null;
6529 l_prmtr_06_tab(l_tab_counter) := null;
6530 l_prmtr_07_tab(l_tab_counter) := null;
6531 l_old_val1(l_tab_counter) := p_old_rec.attribute1;
6532 l_new_val1(l_tab_counter) := p_new_rec.attribute1;
6533 l_old_val2(l_tab_counter) := null;
6534 l_old_val3(l_tab_counter) := null;
6535 l_old_val4(l_tab_counter) := null;
6536 l_old_val5(l_tab_counter) := null;
6537 l_old_val6(l_tab_counter) := null;
6538 l_new_val2(l_tab_counter) := null;
6539 l_new_val3(l_tab_counter) := null;
6540 l_new_val4(l_tab_counter) := null;
6541 l_new_val5(l_tab_counter) := null;
6542 l_new_val6(l_tab_counter) := null;
6543 end if;
6544
6545 if nvl(p_old_rec.attribute2,'$$$$$') <> nvl(p_new_rec.attribute2,'$$$$$') then
6546 l_tab_counter := l_tab_counter + 1;
6547 l_chg_evt_tab(l_tab_counter) := 'CATTR2';
6548 l_prmtr_01_tab(l_tab_counter) := null;
6549 l_prmtr_02_tab(l_tab_counter) := null;
6550 l_prmtr_03_tab(l_tab_counter) := null;
6551 l_prmtr_04_tab(l_tab_counter) := null;
6552 l_prmtr_05_tab(l_tab_counter) := null;
6553 l_prmtr_06_tab(l_tab_counter) := null;
6554 l_prmtr_07_tab(l_tab_counter) := null;
6555 l_old_val1(l_tab_counter) := p_old_rec.attribute2;
6556 l_new_val1(l_tab_counter) := p_new_rec.attribute2;
6557 l_old_val2(l_tab_counter) := null;
6558 l_old_val3(l_tab_counter) := null;
6559 l_old_val4(l_tab_counter) := null;
6560 l_old_val5(l_tab_counter) := null;
6561 l_old_val6(l_tab_counter) := null;
6562 l_new_val2(l_tab_counter) := null;
6563 l_new_val3(l_tab_counter) := null;
6564 l_new_val4(l_tab_counter) := null;
6565 l_new_val5(l_tab_counter) := null;
6566 l_new_val6(l_tab_counter) := null;
6567 end if;
6568
6569 if nvl(p_old_rec.attribute3,'$$$$$') <> nvl(p_new_rec.attribute3,'$$$$$') then
6570 l_tab_counter := l_tab_counter + 1;
6571 l_chg_evt_tab(l_tab_counter) := 'CATTR3';
6572 l_prmtr_01_tab(l_tab_counter) := null;
6573 l_prmtr_02_tab(l_tab_counter) := null;
6574 l_prmtr_03_tab(l_tab_counter) := null;
6575 l_prmtr_04_tab(l_tab_counter) := null;
6576 l_prmtr_05_tab(l_tab_counter) := null;
6577 l_prmtr_06_tab(l_tab_counter) := null;
6578 l_prmtr_07_tab(l_tab_counter) := null;
6579 l_old_val1(l_tab_counter) := p_old_rec.attribute3;
6580 l_new_val1(l_tab_counter) := p_new_rec.attribute3;
6581 l_old_val2(l_tab_counter) := null;
6582 l_old_val3(l_tab_counter) := null;
6583 l_old_val4(l_tab_counter) := null;
6584 l_old_val5(l_tab_counter) := null;
6585 l_old_val6(l_tab_counter) := null;
6586 l_new_val2(l_tab_counter) := null;
6587 l_new_val3(l_tab_counter) := null;
6588 l_new_val4(l_tab_counter) := null;
6589 l_new_val5(l_tab_counter) := null;
6590 l_new_val6(l_tab_counter) := null;
6591 end if;
6592
6593 if nvl(p_old_rec.attribute4,'$$$$$') <> nvl(p_new_rec.attribute4,'$$$$$') then
6594 l_tab_counter := l_tab_counter + 1;
6595 l_chg_evt_tab(l_tab_counter) := 'CATTR4';
6596 l_prmtr_01_tab(l_tab_counter) := null;
6597 l_prmtr_02_tab(l_tab_counter) := null;
6598 l_prmtr_03_tab(l_tab_counter) := null;
6599 l_prmtr_04_tab(l_tab_counter) := null;
6600 l_prmtr_05_tab(l_tab_counter) := null;
6601 l_prmtr_06_tab(l_tab_counter) := null;
6602 l_prmtr_07_tab(l_tab_counter) := null;
6603 l_old_val1(l_tab_counter) := p_old_rec.attribute4;
6604 l_new_val1(l_tab_counter) := p_new_rec.attribute4;
6605 l_old_val2(l_tab_counter) := null;
6606 l_old_val3(l_tab_counter) := null;
6607 l_old_val4(l_tab_counter) := null;
6608 l_old_val5(l_tab_counter) := null;
6609 l_old_val6(l_tab_counter) := null;
6610 l_new_val2(l_tab_counter) := null;
6611 l_new_val3(l_tab_counter) := null;
6612 l_new_val4(l_tab_counter) := null;
6613 l_new_val5(l_tab_counter) := null;
6614 l_new_val6(l_tab_counter) := null;
6615 end if;
6616
6617 if nvl(p_old_rec.attribute5,'$$$$$') <> nvl(p_new_rec.attribute5,'$$$$$') then
6618 l_tab_counter := l_tab_counter + 1;
6619 l_chg_evt_tab(l_tab_counter) := 'CATTR5';
6620 l_prmtr_01_tab(l_tab_counter) := null;
6621 l_prmtr_02_tab(l_tab_counter) := null;
6622 l_prmtr_03_tab(l_tab_counter) := null;
6623 l_prmtr_04_tab(l_tab_counter) := null;
6624 l_prmtr_05_tab(l_tab_counter) := null;
6625 l_prmtr_06_tab(l_tab_counter) := null;
6626 l_prmtr_07_tab(l_tab_counter) := null;
6627 l_old_val1(l_tab_counter) := p_old_rec.attribute5;
6628 l_new_val1(l_tab_counter) := p_new_rec.attribute5;
6629 l_old_val2(l_tab_counter) := null;
6630 l_old_val3(l_tab_counter) := null;
6631 l_old_val4(l_tab_counter) := null;
6632 l_old_val5(l_tab_counter) := null;
6633 l_old_val6(l_tab_counter) := null;
6634 l_new_val2(l_tab_counter) := null;
6635 l_new_val3(l_tab_counter) := null;
6636 l_new_val4(l_tab_counter) := null;
6637 l_new_val5(l_tab_counter) := null;
6638 l_new_val6(l_tab_counter) := null;
6639 end if;
6640
6641 if nvl(p_old_rec.attribute6,'$$$$$') <> nvl(p_new_rec.attribute6,'$$$$$') then
6642 l_tab_counter := l_tab_counter + 1;
6643 l_chg_evt_tab(l_tab_counter) := 'CATTR6';
6644 l_prmtr_01_tab(l_tab_counter) := null;
6645 l_prmtr_02_tab(l_tab_counter) := null;
6646 l_prmtr_03_tab(l_tab_counter) := null;
6647 l_prmtr_04_tab(l_tab_counter) := null;
6648 l_prmtr_05_tab(l_tab_counter) := null;
6649 l_prmtr_06_tab(l_tab_counter) := null;
6650 l_prmtr_07_tab(l_tab_counter) := null;
6651 l_old_val1(l_tab_counter) := p_old_rec.attribute6;
6652 l_new_val1(l_tab_counter) := p_new_rec.attribute6;
6653 l_old_val2(l_tab_counter) := null;
6654 l_old_val3(l_tab_counter) := null;
6655 l_old_val4(l_tab_counter) := null;
6656 l_old_val5(l_tab_counter) := null;
6657 l_old_val6(l_tab_counter) := null;
6658 l_new_val2(l_tab_counter) := null;
6659 l_new_val3(l_tab_counter) := null;
6660 l_new_val4(l_tab_counter) := null;
6661 l_new_val5(l_tab_counter) := null;
6662 l_new_val6(l_tab_counter) := null;
6663 end if;
6664
6665 if nvl(p_old_rec.attribute7,'$$$$$') <> nvl(p_new_rec.attribute7,'$$$$$') then
6666 l_tab_counter := l_tab_counter + 1;
6667 l_chg_evt_tab(l_tab_counter) := 'CATTR7';
6668 l_prmtr_01_tab(l_tab_counter) := null;
6669 l_prmtr_02_tab(l_tab_counter) := null;
6670 l_prmtr_03_tab(l_tab_counter) := null;
6671 l_prmtr_04_tab(l_tab_counter) := null;
6672 l_prmtr_05_tab(l_tab_counter) := null;
6673 l_prmtr_06_tab(l_tab_counter) := null;
6674 l_prmtr_07_tab(l_tab_counter) := null;
6675 l_old_val1(l_tab_counter) := p_old_rec.attribute7;
6676 l_new_val1(l_tab_counter) := p_new_rec.attribute7;
6677 l_old_val2(l_tab_counter) := null;
6678 l_old_val3(l_tab_counter) := null;
6679 l_old_val4(l_tab_counter) := null;
6680 l_old_val5(l_tab_counter) := null;
6681 l_old_val6(l_tab_counter) := null;
6682 l_new_val2(l_tab_counter) := null;
6683 l_new_val3(l_tab_counter) := null;
6684 l_new_val4(l_tab_counter) := null;
6685 l_new_val5(l_tab_counter) := null;
6686 l_new_val6(l_tab_counter) := null;
6687 end if;
6688
6689 if nvl(p_old_rec.attribute8,'$$$$$') <> nvl(p_new_rec.attribute8,'$$$$$') then
6690 l_tab_counter := l_tab_counter + 1;
6691 l_chg_evt_tab(l_tab_counter) := 'CATTR8';
6692 l_prmtr_01_tab(l_tab_counter) := null;
6693 l_prmtr_02_tab(l_tab_counter) := null;
6694 l_prmtr_03_tab(l_tab_counter) := null;
6695 l_prmtr_04_tab(l_tab_counter) := null;
6696 l_prmtr_05_tab(l_tab_counter) := null;
6697 l_prmtr_06_tab(l_tab_counter) := null;
6698 l_prmtr_07_tab(l_tab_counter) := null;
6699 l_old_val1(l_tab_counter) := p_old_rec.attribute8;
6700 l_new_val1(l_tab_counter) := p_new_rec.attribute8;
6701 l_old_val2(l_tab_counter) := null;
6702 l_old_val3(l_tab_counter) := null;
6703 l_old_val4(l_tab_counter) := null;
6704 l_old_val5(l_tab_counter) := null;
6705 l_old_val6(l_tab_counter) := null;
6706 l_new_val2(l_tab_counter) := null;
6707 l_new_val3(l_tab_counter) := null;
6708 l_new_val4(l_tab_counter) := null;
6709 l_new_val5(l_tab_counter) := null;
6710 l_new_val6(l_tab_counter) := null;
6711 end if;
6712
6713 if nvl(p_old_rec.attribute9,'$$$$$') <> nvl(p_new_rec.attribute9,'$$$$$') then
6714 l_tab_counter := l_tab_counter + 1;
6715 l_chg_evt_tab(l_tab_counter) := 'CATTR9';
6716 l_prmtr_01_tab(l_tab_counter) := null;
6717 l_prmtr_02_tab(l_tab_counter) := null;
6718 l_prmtr_03_tab(l_tab_counter) := null;
6719 l_prmtr_04_tab(l_tab_counter) := null;
6720 l_prmtr_05_tab(l_tab_counter) := null;
6721 l_prmtr_06_tab(l_tab_counter) := null;
6722 l_prmtr_07_tab(l_tab_counter) := null;
6723 l_old_val1(l_tab_counter) := p_old_rec.attribute9;
6724 l_new_val1(l_tab_counter) := p_new_rec.attribute9;
6725 l_old_val2(l_tab_counter) := null;
6726 l_old_val3(l_tab_counter) := null;
6727 l_old_val4(l_tab_counter) := null;
6728 l_old_val5(l_tab_counter) := null;
6729 l_old_val6(l_tab_counter) := null;
6730 l_new_val2(l_tab_counter) := null;
6731 l_new_val3(l_tab_counter) := null;
6732 l_new_val4(l_tab_counter) := null;
6733 l_new_val5(l_tab_counter) := null;
6734 l_new_val6(l_tab_counter) := null;
6735 end if;
6736
6737 if nvl(p_old_rec.attribute10,'$$$$$') <> nvl(p_new_rec.attribute10,'$$$$$') then
6738 l_tab_counter := l_tab_counter + 1;
6739 l_chg_evt_tab(l_tab_counter) := 'CATTR10';
6740 l_prmtr_01_tab(l_tab_counter) := null;
6741 l_prmtr_02_tab(l_tab_counter) := null;
6742 l_prmtr_03_tab(l_tab_counter) := null;
6743 l_prmtr_04_tab(l_tab_counter) := null;
6744 l_prmtr_05_tab(l_tab_counter) := null;
6745 l_prmtr_06_tab(l_tab_counter) := null;
6746 l_prmtr_07_tab(l_tab_counter) := null;
6747 l_old_val1(l_tab_counter) := p_old_rec.attribute10;
6748 l_new_val1(l_tab_counter) := p_new_rec.attribute10;
6749 l_old_val2(l_tab_counter) := null;
6750 l_old_val3(l_tab_counter) := null;
6751 l_old_val4(l_tab_counter) := null;
6752 l_old_val5(l_tab_counter) := null;
6753 l_old_val6(l_tab_counter) := null;
6754 l_new_val2(l_tab_counter) := null;
6755 l_new_val3(l_tab_counter) := null;
6756 l_new_val4(l_tab_counter) := null;
6757 l_new_val5(l_tab_counter) := null;
6758 l_new_val6(l_tab_counter) := null;
6759 end if;
6760
6761 if nvl(p_old_rec.dis_information1,'$$$$$') <> nvl(p_new_rec.dis_information1,'$$$$$') then
6762 l_tab_counter := l_tab_counter + 1;
6763 l_chg_evt_tab(l_tab_counter) := 'CDISINF1';
6764 l_prmtr_01_tab(l_tab_counter) := null;
6765 l_prmtr_02_tab(l_tab_counter) := null;
6766 l_prmtr_03_tab(l_tab_counter) := null;
6767 l_prmtr_04_tab(l_tab_counter) := null;
6768 l_prmtr_05_tab(l_tab_counter) := null;
6769 l_prmtr_06_tab(l_tab_counter) := null;
6770 l_prmtr_07_tab(l_tab_counter) := null;
6771 l_old_val1(l_tab_counter) := p_old_rec.dis_information1;
6772 l_new_val1(l_tab_counter) := p_new_rec.dis_information1;
6773 l_old_val2(l_tab_counter) := null;
6774 l_old_val3(l_tab_counter) := null;
6775 l_old_val4(l_tab_counter) := null;
6776 l_old_val5(l_tab_counter) := null;
6777 l_old_val6(l_tab_counter) := null;
6778 l_new_val2(l_tab_counter) := null;
6779 l_new_val3(l_tab_counter) := null;
6780 l_new_val4(l_tab_counter) := null;
6781 l_new_val5(l_tab_counter) := null;
6782 l_new_val6(l_tab_counter) := null;
6783 end if;
6784
6785 if nvl(p_old_rec.dis_information2,'$$$$$') <> nvl(p_new_rec.dis_information2,'$$$$$') then
6786 l_tab_counter := l_tab_counter + 1;
6787 l_chg_evt_tab(l_tab_counter) := 'CDISINF2';
6788 l_prmtr_01_tab(l_tab_counter) := null;
6789 l_prmtr_02_tab(l_tab_counter) := null;
6790 l_prmtr_03_tab(l_tab_counter) := null;
6791 l_prmtr_04_tab(l_tab_counter) := null;
6792 l_prmtr_05_tab(l_tab_counter) := null;
6793 l_prmtr_06_tab(l_tab_counter) := null;
6794 l_prmtr_07_tab(l_tab_counter) := null;
6795 l_old_val1(l_tab_counter) := p_old_rec.attribute2;
6796 l_new_val1(l_tab_counter) := p_new_rec.attribute2;
6797 l_old_val2(l_tab_counter) := null;
6798 l_old_val3(l_tab_counter) := null;
6799 l_old_val4(l_tab_counter) := null;
6800 l_old_val5(l_tab_counter) := null;
6801 l_old_val6(l_tab_counter) := null;
6802 l_new_val2(l_tab_counter) := null;
6803 l_new_val3(l_tab_counter) := null;
6804 l_new_val4(l_tab_counter) := null;
6805 l_new_val5(l_tab_counter) := null;
6806 l_new_val6(l_tab_counter) := null;
6807 end if;
6808
6809 if nvl(p_old_rec.dis_information3,'$$$$$') <> nvl(p_new_rec.dis_information3,'$$$$$') then
6810 l_tab_counter := l_tab_counter + 1;
6811 l_chg_evt_tab(l_tab_counter) := 'CDISINF3';
6812 l_prmtr_01_tab(l_tab_counter) := null;
6813 l_prmtr_02_tab(l_tab_counter) := null;
6814 l_prmtr_03_tab(l_tab_counter) := null;
6815 l_prmtr_04_tab(l_tab_counter) := null;
6816 l_prmtr_05_tab(l_tab_counter) := null;
6817 l_prmtr_06_tab(l_tab_counter) := null;
6818 l_prmtr_07_tab(l_tab_counter) := null;
6819 l_old_val1(l_tab_counter) := p_old_rec.dis_information3;
6820 l_new_val1(l_tab_counter) := p_new_rec.dis_information3;
6821 l_old_val2(l_tab_counter) := null;
6822 l_old_val3(l_tab_counter) := null;
6823 l_old_val4(l_tab_counter) := null;
6824 l_old_val5(l_tab_counter) := null;
6825 l_old_val6(l_tab_counter) := null;
6826 l_new_val2(l_tab_counter) := null;
6827 l_new_val3(l_tab_counter) := null;
6828 l_new_val4(l_tab_counter) := null;
6829 l_new_val5(l_tab_counter) := null;
6830 l_new_val6(l_tab_counter) := null;
6831 end if;
6832
6833 if nvl(p_old_rec.dis_information4,'$$$$$') <> nvl(p_new_rec.dis_information4,'$$$$$') then
6834 l_tab_counter := l_tab_counter + 1;
6835 l_chg_evt_tab(l_tab_counter) := 'CDISINF4';
6836 l_prmtr_01_tab(l_tab_counter) := null;
6837 l_prmtr_02_tab(l_tab_counter) := null;
6838 l_prmtr_03_tab(l_tab_counter) := null;
6839 l_prmtr_04_tab(l_tab_counter) := null;
6840 l_prmtr_05_tab(l_tab_counter) := null;
6841 l_prmtr_06_tab(l_tab_counter) := null;
6842 l_prmtr_07_tab(l_tab_counter) := null;
6843 l_old_val1(l_tab_counter) := p_old_rec.dis_information4;
6844 l_new_val1(l_tab_counter) := p_new_rec.dis_information4;
6845 l_old_val2(l_tab_counter) := null;
6846 l_old_val3(l_tab_counter) := null;
6847 l_old_val4(l_tab_counter) := null;
6848 l_old_val5(l_tab_counter) := null;
6849 l_old_val6(l_tab_counter) := null;
6850 l_new_val2(l_tab_counter) := null;
6851 l_new_val3(l_tab_counter) := null;
6852 l_new_val4(l_tab_counter) := null;
6853 l_new_val5(l_tab_counter) := null;
6854 l_new_val6(l_tab_counter) := null;
6855 end if;
6856
6857 if nvl(p_old_rec.dis_information5,'$$$$$') <> nvl(p_new_rec.dis_information5,'$$$$$') then
6858 l_tab_counter := l_tab_counter + 1;
6859 l_chg_evt_tab(l_tab_counter) := 'CDISINF5';
6860 l_prmtr_01_tab(l_tab_counter) := null;
6861 l_prmtr_02_tab(l_tab_counter) := null;
6862 l_prmtr_03_tab(l_tab_counter) := null;
6863 l_prmtr_04_tab(l_tab_counter) := null;
6864 l_prmtr_05_tab(l_tab_counter) := null;
6865 l_prmtr_06_tab(l_tab_counter) := null;
6866 l_prmtr_07_tab(l_tab_counter) := null;
6867 l_old_val1(l_tab_counter) := p_old_rec.dis_information5;
6868 l_new_val1(l_tab_counter) := p_new_rec.dis_information5;
6869 l_old_val2(l_tab_counter) := null;
6870 l_old_val3(l_tab_counter) := null;
6871 l_old_val4(l_tab_counter) := null;
6872 l_old_val5(l_tab_counter) := null;
6873 l_old_val6(l_tab_counter) := null;
6874 l_new_val2(l_tab_counter) := null;
6875 l_new_val3(l_tab_counter) := null;
6876 l_new_val4(l_tab_counter) := null;
6877 l_new_val5(l_tab_counter) := null;
6878 l_new_val6(l_tab_counter) := null;
6879 end if;
6880
6881 if nvl(p_old_rec.dis_information6,'$$$$$') <> nvl(p_new_rec.dis_information6,'$$$$$') then
6882 l_tab_counter := l_tab_counter + 1;
6883 l_chg_evt_tab(l_tab_counter) := 'CDISINF6';
6884 l_prmtr_01_tab(l_tab_counter) := null;
6885 l_prmtr_02_tab(l_tab_counter) := null;
6886 l_prmtr_03_tab(l_tab_counter) := null;
6887 l_prmtr_04_tab(l_tab_counter) := null;
6888 l_prmtr_05_tab(l_tab_counter) := null;
6889 l_prmtr_06_tab(l_tab_counter) := null;
6890 l_prmtr_07_tab(l_tab_counter) := null;
6891 l_old_val1(l_tab_counter) := p_old_rec.dis_information6;
6892 l_new_val1(l_tab_counter) := p_new_rec.dis_information6;
6893 l_old_val2(l_tab_counter) := null;
6894 l_old_val3(l_tab_counter) := null;
6895 l_old_val4(l_tab_counter) := null;
6896 l_old_val5(l_tab_counter) := null;
6897 l_old_val6(l_tab_counter) := null;
6898 l_new_val2(l_tab_counter) := null;
6899 l_new_val3(l_tab_counter) := null;
6900 l_new_val4(l_tab_counter) := null;
6901 l_new_val5(l_tab_counter) := null;
6902 l_new_val6(l_tab_counter) := null;
6903 end if;
6904
6905 if nvl(p_old_rec.dis_information7,'$$$$$') <> nvl(p_new_rec.dis_information7,'$$$$$') then
6906 l_tab_counter := l_tab_counter + 1;
6907 l_chg_evt_tab(l_tab_counter) := 'CDISINF7';
6908 l_prmtr_01_tab(l_tab_counter) := null;
6909 l_prmtr_02_tab(l_tab_counter) := null;
6910 l_prmtr_03_tab(l_tab_counter) := null;
6911 l_prmtr_04_tab(l_tab_counter) := null;
6912 l_prmtr_05_tab(l_tab_counter) := null;
6913 l_prmtr_06_tab(l_tab_counter) := null;
6914 l_prmtr_07_tab(l_tab_counter) := null;
6915 l_old_val1(l_tab_counter) := p_old_rec.dis_information7;
6916 l_new_val1(l_tab_counter) := p_new_rec.dis_information7;
6917 l_old_val2(l_tab_counter) := null;
6918 l_old_val3(l_tab_counter) := null;
6919 l_old_val4(l_tab_counter) := null;
6920 l_old_val5(l_tab_counter) := null;
6921 l_old_val6(l_tab_counter) := null;
6922 l_new_val2(l_tab_counter) := null;
6923 l_new_val3(l_tab_counter) := null;
6924 l_new_val4(l_tab_counter) := null;
6925 l_new_val5(l_tab_counter) := null;
6926 l_new_val6(l_tab_counter) := null;
6927 end if;
6928
6929 if nvl(p_old_rec.dis_information8,'$$$$$') <> nvl(p_new_rec.dis_information8,'$$$$$') then
6930 l_tab_counter := l_tab_counter + 1;
6931 l_chg_evt_tab(l_tab_counter) := 'CDISINF8';
6932 l_prmtr_01_tab(l_tab_counter) := null;
6933 l_prmtr_02_tab(l_tab_counter) := null;
6934 l_prmtr_03_tab(l_tab_counter) := null;
6935 l_prmtr_04_tab(l_tab_counter) := null;
6936 l_prmtr_05_tab(l_tab_counter) := null;
6937 l_prmtr_06_tab(l_tab_counter) := null;
6938 l_prmtr_07_tab(l_tab_counter) := null;
6939 l_old_val1(l_tab_counter) := p_old_rec.dis_information8;
6940 l_new_val1(l_tab_counter) := p_new_rec.dis_information8;
6941 l_old_val2(l_tab_counter) := null;
6942 l_old_val3(l_tab_counter) := null;
6943 l_old_val4(l_tab_counter) := null;
6944 l_old_val5(l_tab_counter) := null;
6945 l_old_val6(l_tab_counter) := null;
6946 l_new_val2(l_tab_counter) := null;
6947 l_new_val3(l_tab_counter) := null;
6948 l_new_val4(l_tab_counter) := null;
6949 l_new_val5(l_tab_counter) := null;
6950 l_new_val6(l_tab_counter) := null;
6951 end if;
6952
6953 if nvl(p_old_rec.dis_information9,'$$$$$') <> nvl(p_new_rec.dis_information9,'$$$$$') then
6954 l_tab_counter := l_tab_counter + 1;
6955 l_chg_evt_tab(l_tab_counter) := 'CDISINF9';
6956 l_prmtr_01_tab(l_tab_counter) := null;
6957 l_prmtr_02_tab(l_tab_counter) := null;
6958 l_prmtr_03_tab(l_tab_counter) := null;
6959 l_prmtr_04_tab(l_tab_counter) := null;
6960 l_prmtr_05_tab(l_tab_counter) := null;
6961 l_prmtr_06_tab(l_tab_counter) := null;
6962 l_prmtr_07_tab(l_tab_counter) := null;
6963 l_old_val1(l_tab_counter) := p_old_rec.dis_information9;
6964 l_new_val1(l_tab_counter) := p_new_rec.dis_information9;
6965 l_old_val2(l_tab_counter) := null;
6966 l_old_val3(l_tab_counter) := null;
6967 l_old_val4(l_tab_counter) := null;
6968 l_old_val5(l_tab_counter) := null;
6969 l_old_val6(l_tab_counter) := null;
6970 l_new_val2(l_tab_counter) := null;
6971 l_new_val3(l_tab_counter) := null;
6972 l_new_val4(l_tab_counter) := null;
6973 l_new_val5(l_tab_counter) := null;
6974 l_new_val6(l_tab_counter) := null;
6975 end if;
6976
6977 if nvl(p_old_rec.dis_information10,'$$$$$') <> nvl(p_new_rec.dis_information10,'$$$$$') then
6978 l_tab_counter := l_tab_counter + 1;
6979 l_chg_evt_tab(l_tab_counter) := 'CDISINF10';
6980 l_prmtr_01_tab(l_tab_counter) := null;
6981 l_prmtr_02_tab(l_tab_counter) := null;
6982 l_prmtr_03_tab(l_tab_counter) := null;
6983 l_prmtr_04_tab(l_tab_counter) := null;
6984 l_prmtr_05_tab(l_tab_counter) := null;
6985 l_prmtr_06_tab(l_tab_counter) := null;
6986 l_prmtr_07_tab(l_tab_counter) := null;
6987 l_old_val1(l_tab_counter) := p_old_rec.dis_information10;
6988 l_new_val1(l_tab_counter) := p_new_rec.dis_information10;
6989 l_old_val2(l_tab_counter) := null;
6990 l_old_val3(l_tab_counter) := null;
6991 l_old_val4(l_tab_counter) := null;
6992 l_old_val5(l_tab_counter) := null;
6993 l_old_val6(l_tab_counter) := null;
6994 l_new_val2(l_tab_counter) := null;
6995 l_new_val3(l_tab_counter) := null;
6996 l_new_val4(l_tab_counter) := null;
6997 l_new_val5(l_tab_counter) := null;
6998 l_new_val6(l_tab_counter) := null;
6999 end if;
7000
7001 for l_count in 1..l_chg_evt_tab.count loop
7002 if change_event_is_enabled(l_chg_evt_tab(l_count),p_new_rec.effective_start_date) then
7003 ben_ext_chg_evt_api.create_ext_chg_evt
7004 (p_validate => FALSE
7005 ,p_ext_chg_evt_log_id => l_ext_chg_evt_log_id
7006 ,p_chg_evt_cd => l_chg_evt_tab(l_count)
7007 ,p_chg_eff_dt => p_new_rec.effective_start_date
7008 ,p_prmtr_01 => l_prmtr_01_tab(l_count)
7009 ,p_prmtr_02 => l_prmtr_02_tab(l_count)
7010 ,p_prmtr_03 => l_prmtr_03_tab(l_count)
7011 ,p_prmtr_04 => l_prmtr_04_tab(l_count)
7012 ,p_prmtr_05 => l_prmtr_05_tab(l_count)
7013 ,p_prmtr_06 => l_prmtr_06_tab(l_count)
7014 ,p_prmtr_07 => l_prmtr_07_tab(l_count)
7015 ,p_prmtr_10 => p_new_rec.update_mode
7016 ,p_person_id => p_new_rec.person_id
7017 ,p_business_group_id => p_new_rec.business_group_id
7018 ,p_object_version_number => l_object_version_number
7019 ,p_effective_date => p_new_rec.effective_start_date
7020 ,p_old_val1 => l_old_val1(l_count)
7021 ,p_old_val2 => l_old_val2(l_count)
7022 ,p_old_val3 => l_old_val3(l_count)
7023 ,p_old_val4 => l_old_val4(l_count)
7024 ,p_old_val5 => l_old_val5(l_count)
7025 ,p_old_val6 => l_old_val6(l_count)
7026 ,p_new_val1 => l_new_val1(l_count)
7027 ,p_new_val2 => l_new_val2(l_count)
7028 ,p_new_val3 => l_new_val3(l_count)
7029 ,p_new_val4 => l_new_val4(l_count)
7030 ,p_new_val5 => l_new_val5(l_count)
7031 ,p_new_val6 => l_new_val6(l_count)
7032 );
7033 end if;
7034 end loop;
7035 --
7036
7037 ----
7038 end if;
7039 --
7040 hr_utility.set_location('Exiting:'|| l_proc, 99);
7041 --
7042 end log_per_dis_chg;
7043 --
7044 end ben_ext_chlg;