147: end if;
148: --
149: -- End of Bug 3320133
150:
151: hr_utility.set_location(' Entering: ben_crt_trigger1', 10);
152: l_bool :=fnd_installation.get(appl_id => 805
153: ,dep_appl_id =>805
154: ,status => l_status
155: ,industry => l_industry);
153: ,dep_appl_id =>805
154: ,status => l_status
155: ,industry => l_industry);
156:
157: hr_utility.set_location(' Entering: ben_crt_trigger1', 10);
158: l_changed := FALSE;
159: --open get_session_date;
160: --fetch get_session_date into l_session_date;
161: --close get_session_date;
158: l_changed := FALSE;
159: --open get_session_date;
160: --fetch get_session_date into l_session_date;
161: --close get_session_date;
162: hr_utility.set_location(' effective date ' || p_effective_date , 1408379);
163: l_session_date := p_effective_date ;
164: open get_system_date;
165: fetch get_system_date into l_system_date;
166: close get_system_date;
165: fetch get_system_date into l_system_date;
166: close get_system_date;
167: l_effective_start_date := l_session_date;
168: -- l_lf_evt_ocrd_date := l_session_date;
169: hr_utility.set_location(' ben_crt_trigger2', 20);
170: hr_utility.set_location('sess '||l_session_date, 20);
171: hr_utility.set_location('PERSON '||p_new.person_id, 20);
172: hr_utility.set_location('BG '||p_new.business_group_id, 20);
173:
166: close get_system_date;
167: l_effective_start_date := l_session_date;
168: -- l_lf_evt_ocrd_date := l_session_date;
169: hr_utility.set_location(' ben_crt_trigger2', 20);
170: hr_utility.set_location('sess '||l_session_date, 20);
171: hr_utility.set_location('PERSON '||p_new.person_id, 20);
172: hr_utility.set_location('BG '||p_new.business_group_id, 20);
173:
174: -- in some situations the date we use for occured on date is null,
167: l_effective_start_date := l_session_date;
168: -- l_lf_evt_ocrd_date := l_session_date;
169: hr_utility.set_location(' ben_crt_trigger2', 20);
170: hr_utility.set_location('sess '||l_session_date, 20);
171: hr_utility.set_location('PERSON '||p_new.person_id, 20);
172: hr_utility.set_location('BG '||p_new.business_group_id, 20);
173:
174: -- in some situations the date we use for occured on date is null,
175: -- use session date instead.
168: -- l_lf_evt_ocrd_date := l_session_date;
169: hr_utility.set_location(' ben_crt_trigger2', 20);
170: hr_utility.set_location('sess '||l_session_date, 20);
171: hr_utility.set_location('PERSON '||p_new.person_id, 20);
172: hr_utility.set_location('BG '||p_new.business_group_id, 20);
173:
174: -- in some situations the date we use for occured on date is null,
175: -- use session date instead.
176: if p_new.apls_perd_strtg_dt is null then
183: else
184: l_apls_perd_endg_dt := p_new.apls_perd_endg_dt;
185: end if;
186:
187: hr_utility.set_location(' l_system_date:'||to_char(l_system_date), 20);
188: hr_utility.set_location(' l_session_date:'||to_char(l_session_date), 20);
189:
190: open get_ler(l_status);
191: loop
184: l_apls_perd_endg_dt := p_new.apls_perd_endg_dt;
185: end if;
186:
187: hr_utility.set_location(' l_system_date:'||to_char(l_system_date), 20);
188: hr_utility.set_location(' l_session_date:'||to_char(l_session_date), 20);
189:
190: open get_ler(l_status);
191: loop
192: fetch get_ler into l_ler_id,l_typ_cd, l_ocrd_dt_cd;
209: open get_ler_col(l_ler_id);
210: loop
211: fetch get_ler_col into l_column,l_new_val, l_old_val, l_type, l_per_info_chg_cs_ler_rl, l_rule_overrides_flag, l_chg_mandatory_cd;
212: exit when get_ler_col%NOTFOUND;
213: hr_utility.set_location('LER '||l_ler_id, 20);
214: hr_utility.set_location('COLUMN '||l_column, 20);
215: hr_utility.set_location('NEWVAL '||l_new_val, 20);
216: hr_utility.set_location('OLDVAL '||l_old_val, 20);
217: hr_utility.set_location('TYPE '||l_type, 20);
210: loop
211: fetch get_ler_col into l_column,l_new_val, l_old_val, l_type, l_per_info_chg_cs_ler_rl, l_rule_overrides_flag, l_chg_mandatory_cd;
212: exit when get_ler_col%NOTFOUND;
213: hr_utility.set_location('LER '||l_ler_id, 20);
214: hr_utility.set_location('COLUMN '||l_column, 20);
215: hr_utility.set_location('NEWVAL '||l_new_val, 20);
216: hr_utility.set_location('OLDVAL '||l_old_val, 20);
217: hr_utility.set_location('TYPE '||l_type, 20);
218: hr_utility.set_location(' l_per_info_chg_cs_ler_rl '|| l_per_info_chg_cs_ler_rl, 20);
211: fetch get_ler_col into l_column,l_new_val, l_old_val, l_type, l_per_info_chg_cs_ler_rl, l_rule_overrides_flag, l_chg_mandatory_cd;
212: exit when get_ler_col%NOTFOUND;
213: hr_utility.set_location('LER '||l_ler_id, 20);
214: hr_utility.set_location('COLUMN '||l_column, 20);
215: hr_utility.set_location('NEWVAL '||l_new_val, 20);
216: hr_utility.set_location('OLDVAL '||l_old_val, 20);
217: hr_utility.set_location('TYPE '||l_type, 20);
218: hr_utility.set_location(' l_per_info_chg_cs_ler_rl '|| l_per_info_chg_cs_ler_rl, 20);
219: hr_utility.set_location('l_rule_overrides_flag '||l_rule_overrides_flag, 20);
212: exit when get_ler_col%NOTFOUND;
213: hr_utility.set_location('LER '||l_ler_id, 20);
214: hr_utility.set_location('COLUMN '||l_column, 20);
215: hr_utility.set_location('NEWVAL '||l_new_val, 20);
216: hr_utility.set_location('OLDVAL '||l_old_val, 20);
217: hr_utility.set_location('TYPE '||l_type, 20);
218: hr_utility.set_location(' l_per_info_chg_cs_ler_rl '|| l_per_info_chg_cs_ler_rl, 20);
219: hr_utility.set_location('l_rule_overrides_flag '||l_rule_overrides_flag, 20);
220: hr_utility.set_location('l_chg_mandatory_cd '||l_chg_mandatory_cd, 20);
213: hr_utility.set_location('LER '||l_ler_id, 20);
214: hr_utility.set_location('COLUMN '||l_column, 20);
215: hr_utility.set_location('NEWVAL '||l_new_val, 20);
216: hr_utility.set_location('OLDVAL '||l_old_val, 20);
217: hr_utility.set_location('TYPE '||l_type, 20);
218: hr_utility.set_location(' l_per_info_chg_cs_ler_rl '|| l_per_info_chg_cs_ler_rl, 20);
219: hr_utility.set_location('l_rule_overrides_flag '||l_rule_overrides_flag, 20);
220: hr_utility.set_location('l_chg_mandatory_cd '||l_chg_mandatory_cd, 20);
221: l_changed := TRUE;
214: hr_utility.set_location('COLUMN '||l_column, 20);
215: hr_utility.set_location('NEWVAL '||l_new_val, 20);
216: hr_utility.set_location('OLDVAL '||l_old_val, 20);
217: hr_utility.set_location('TYPE '||l_type, 20);
218: hr_utility.set_location(' l_per_info_chg_cs_ler_rl '|| l_per_info_chg_cs_ler_rl, 20);
219: hr_utility.set_location('l_rule_overrides_flag '||l_rule_overrides_flag, 20);
220: hr_utility.set_location('l_chg_mandatory_cd '||l_chg_mandatory_cd, 20);
221: l_changed := TRUE;
222: if get_ler_col%ROWCOUNT = 1 then
215: hr_utility.set_location('NEWVAL '||l_new_val, 20);
216: hr_utility.set_location('OLDVAL '||l_old_val, 20);
217: hr_utility.set_location('TYPE '||l_type, 20);
218: hr_utility.set_location(' l_per_info_chg_cs_ler_rl '|| l_per_info_chg_cs_ler_rl, 20);
219: hr_utility.set_location('l_rule_overrides_flag '||l_rule_overrides_flag, 20);
220: hr_utility.set_location('l_chg_mandatory_cd '||l_chg_mandatory_cd, 20);
221: l_changed := TRUE;
222: if get_ler_col%ROWCOUNT = 1 then
223: l_changed := TRUE;
216: hr_utility.set_location('OLDVAL '||l_old_val, 20);
217: hr_utility.set_location('TYPE '||l_type, 20);
218: hr_utility.set_location(' l_per_info_chg_cs_ler_rl '|| l_per_info_chg_cs_ler_rl, 20);
219: hr_utility.set_location('l_rule_overrides_flag '||l_rule_overrides_flag, 20);
220: hr_utility.set_location('l_chg_mandatory_cd '||l_chg_mandatory_cd, 20);
221: l_changed := TRUE;
222: if get_ler_col%ROWCOUNT = 1 then
223: l_changed := TRUE;
224: end if;
221: l_changed := TRUE;
222: if get_ler_col%ROWCOUNT = 1 then
223: l_changed := TRUE;
224: end if;
225: hr_utility.set_location(' ben_crt_trigger3', 50);
226: --
227: -- Call the formula here to evaluate per_info_chg_cs_ler_rl.
228: -- If it returns Y, then see the applicability of the data
229: -- changes based on new and old values.
301: (l_changed));
302: end if;
303: --
304: if l_column = 'APLS_PERD_ENDG_DT' then
305: hr_utility.set_location('NEW ENDG DT'||p_new.apls_perd_endg_dt, 20);
306: hr_utility.set_location('OLD ENDG DT'||p_old.apls_perd_endg_dt, 20);
307: l_changed := (benutils.column_changed(p_old.apls_perd_endg_dt
308: ,p_new.apls_perd_endg_dt,l_new_val) AND
309: benutils.column_changed(p_new.apls_perd_endg_dt
302: end if;
303: --
304: if l_column = 'APLS_PERD_ENDG_DT' then
305: hr_utility.set_location('NEW ENDG DT'||p_new.apls_perd_endg_dt, 20);
306: hr_utility.set_location('OLD ENDG DT'||p_old.apls_perd_endg_dt, 20);
307: l_changed := (benutils.column_changed(p_old.apls_perd_endg_dt
308: ,p_new.apls_perd_endg_dt,l_new_val) AND
309: benutils.column_changed(p_new.apls_perd_endg_dt
310: ,p_old.apls_perd_endg_dt,l_old_val) AND
334: (l_changed));
335: end if;
336: --
337: if l_changed then
338: hr_utility.set_location('l_change TRUE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
339: else
340: hr_utility.set_location('l_change FALSE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
341: end if;
342:
336: --
337: if l_changed then
338: hr_utility.set_location('l_change TRUE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
339: else
340: hr_utility.set_location('l_change FALSE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
341: end if;
342:
343: -- Checking the rule output and the rule override flag.
344: -- Whether the rule is mandatory or not, rule output should return 'Y'
349: l_changed := TRUE ;
350: elsif l_rule_output = 'Y' and l_rule_overrides_flag = 'N' then
351: l_changed := l_changed AND TRUE;
352: elsif l_rule_output = 'N' then
353: hr_utility.set_location(' Rule output is N, so we should not trigger LE', 20.01);
354: l_changed := FALSE;
355: end if;
356:
357: hr_utility.set_location('After the rule Check ',20.05);
353: hr_utility.set_location(' Rule output is N, so we should not trigger LE', 20.01);
354: l_changed := FALSE;
355: end if;
356:
357: hr_utility.set_location('After the rule Check ',20.05);
358: if l_changed then
359: hr_utility.set_location('l_change TRUE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
360: else
361: hr_utility.set_location('l_change FALSE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
355: end if;
356:
357: hr_utility.set_location('After the rule Check ',20.05);
358: if l_changed then
359: hr_utility.set_location('l_change TRUE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
360: else
361: hr_utility.set_location('l_change FALSE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
362: end if;
363:
357: hr_utility.set_location('After the rule Check ',20.05);
358: if l_changed then
359: hr_utility.set_location('l_change TRUE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
360: else
361: hr_utility.set_location('l_change FALSE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
362: end if;
363:
364: -- Check for Column Mandatory Change
365: -- If column change is mandatory and data change has failed then dont trigger
365: -- If column change is mandatory and data change has failed then dont trigger
366: -- If column change is non-mandatory and the data change has passed, then trigger.
367:
368: if l_chg_mandatory_cd = 'Y' and not l_changed then
369: hr_utility.set_location('Found Mandatory and its failed ', 20.1);
370: l_changed := FALSE;
371: l_trigger := FALSE;
372: exit;
373: elsif l_chg_mandatory_cd = 'Y' and l_changed then
370: l_changed := FALSE;
371: l_trigger := FALSE;
372: exit;
373: elsif l_chg_mandatory_cd = 'Y' and l_changed then
374: hr_utility.set_location('Found Mandatory and its passed ', 20.1);
375: l_changed := TRUE;
376: -- exit; */
377: elsif l_chg_mandatory_cd = 'N' and l_changed then
378: hr_utility.set_location('Found First Non-Mandatory and its passed ', 20.1);
374: hr_utility.set_location('Found Mandatory and its passed ', 20.1);
375: l_changed := TRUE;
376: -- exit; */
377: elsif l_chg_mandatory_cd = 'N' and l_changed then
378: hr_utility.set_location('Found First Non-Mandatory and its passed ', 20.1);
379: l_changed := TRUE;
380: l_trigger := TRUE;
381: exit;
382: end if;
381: exit;
382: end if;
383:
384:
385: hr_utility.set_location('After the Mandatory code check ',20.05);
386: if l_changed then
387: hr_utility.set_location('l_change TRUE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
388: else
389: hr_utility.set_location('l_change FALSE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
383:
384:
385: hr_utility.set_location('After the Mandatory code check ',20.05);
386: if l_changed then
387: hr_utility.set_location('l_change TRUE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
388: else
389: hr_utility.set_location('l_change FALSE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
390: end if;
391:
385: hr_utility.set_location('After the Mandatory code check ',20.05);
386: if l_changed then
387: hr_utility.set_location('l_change TRUE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
388: else
389: hr_utility.set_location('l_change FALSE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
390: end if;
391:
392: --
393: /* if not l_changed then
394: exit;
395: end if; */
396: --
397: end loop;
398: hr_utility.set_location(' ben_crt_trigger4', 50);
399: l_ptnl_id := 0;
400: l_ovn :=null;
401: if l_trigger then
402: if l_type = 'P' then
402: if l_type = 'P' then
403: open le_exists(p_new.person_id,l_ler_id,l_lf_evt_ocrd_date);
404: fetch le_exists into l_le_exists;
405: if le_exists%notfound then
406: hr_utility.set_location(' Entering: ben_crt_trigger5', 60);
407: ben_create_ptnl_ler_for_per.create_ptnl_ler_event
408: --ben_ptnl_ler_for_per_api.create_ptnl_ler_for_per
409: (p_validate => false
410: ,p_ptnl_ler_for_per_id => l_ptnl_id
420: ,p_dtctd_dt => l_lf_evt_ocrd_date);
421: end if;
422: close le_exists;
423: elsif l_type = 'R' then
424: hr_utility.set_location(' Entering: ben_crt_trigger5-', 65);
425: open get_contacts(p_new.person_id);
426: loop
427: fetch get_contacts into l_hld_person_id;
428: exit when get_contacts%notfound;
428: exit when get_contacts%notfound;
429: open le_exists(l_hld_person_id,l_ler_id,l_lf_evt_ocrd_date);
430: fetch le_exists into l_le_exists;
431: if le_exists%notfound then
432: hr_utility.set_location(' Entering: ben_crt_trigger5', 60);
433:
434: ben_create_ptnl_ler_for_per.create_ptnl_ler_event
435: --ben_ptnl_ler_for_per_api.create_ptnl_ler_for_per
436: (p_validate => false
454: end if;
455: --
456: -- reset the variables.
457: --
458: hr_utility.set_location(' ben_crt_trigger6', 40);
459: l_changed := FALSE;
460: l_trigger := TRUE;
461: l_ovn := NULL;
462: l_effective_start_date := l_session_date;
463: -- l_lf_evt_ocrd_date := l_session_date;
464: end if;
465: close get_ler_col;
466: end loop;
467: hr_utility.set_location(' ben_crt_trigger7', 50);
468: close get_ler;
469:
470: hr_utility.set_location(' leaving ben_crt_trigger8', 70);
471: end;
466: end loop;
467: hr_utility.set_location(' ben_crt_trigger7', 50);
468: close get_ler;
469:
470: hr_utility.set_location(' leaving ben_crt_trigger8', 70);
471: end;
472: end ben_crt_ler;