147: ,status => l_status
148: ,industry => l_industry);
149:
150: begin
151: hr_utility.set_location(' Entering: ben_pbb_trigger', 10);
152: l_changed := FALSE;
153: --
154: if p_effective_date is not null then
155: --
172: fetch get_system_date into l_system_date;
173: close get_system_date;
174: l_effective_start_date := l_session_date;
175: -- l_lf_evt_ocrd_date := l_session_date;
176: hr_utility.set_location('sess '||l_session_date, 20);
177: hr_utility.set_location('PERSON '||p_new.person_id, 20);
178: hr_utility.set_location('BG '||p_new.business_group_id, 20);
179: --
180: open get_ler(l_status);
173: close get_system_date;
174: l_effective_start_date := l_session_date;
175: -- l_lf_evt_ocrd_date := l_session_date;
176: hr_utility.set_location('sess '||l_session_date, 20);
177: hr_utility.set_location('PERSON '||p_new.person_id, 20);
178: hr_utility.set_location('BG '||p_new.business_group_id, 20);
179: --
180: open get_ler(l_status);
181: loop
174: l_effective_start_date := l_session_date;
175: -- l_lf_evt_ocrd_date := l_session_date;
176: hr_utility.set_location('sess '||l_session_date, 20);
177: hr_utility.set_location('PERSON '||p_new.person_id, 20);
178: hr_utility.set_location('BG '||p_new.business_group_id, 20);
179: --
180: open get_ler(l_status);
181: loop
182: fetch get_ler into l_ler_id,l_typ_cd ,l_ocrd_dt_cd;
199: open get_ler_col(l_ler_id);
200: loop
201: 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;
202: exit when get_ler_col%NOTFOUND;
203: hr_utility.set_location('LER '||l_ler_id, 20);
204: hr_utility.set_location('COLUMN '||l_column, 20);
205: hr_utility.set_location('NEWVAL '||l_new_val, 20);
206: hr_utility.set_location('OLDVAL '||l_old_val, 20);
207: hr_utility.set_location('TYPE '||l_type, 20);
200: loop
201: 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;
202: exit when get_ler_col%NOTFOUND;
203: hr_utility.set_location('LER '||l_ler_id, 20);
204: hr_utility.set_location('COLUMN '||l_column, 20);
205: hr_utility.set_location('NEWVAL '||l_new_val, 20);
206: hr_utility.set_location('OLDVAL '||l_old_val, 20);
207: hr_utility.set_location('TYPE '||l_type, 20);
208: hr_utility.set_location('CD '||l_ocrd_dt_cd, 20);
201: 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;
202: exit when get_ler_col%NOTFOUND;
203: hr_utility.set_location('LER '||l_ler_id, 20);
204: hr_utility.set_location('COLUMN '||l_column, 20);
205: hr_utility.set_location('NEWVAL '||l_new_val, 20);
206: hr_utility.set_location('OLDVAL '||l_old_val, 20);
207: hr_utility.set_location('TYPE '||l_type, 20);
208: hr_utility.set_location('CD '||l_ocrd_dt_cd, 20);
209: hr_utility.set_location('esd'||p_new.effective_start_date, 20);
202: exit when get_ler_col%NOTFOUND;
203: hr_utility.set_location('LER '||l_ler_id, 20);
204: hr_utility.set_location('COLUMN '||l_column, 20);
205: hr_utility.set_location('NEWVAL '||l_new_val, 20);
206: hr_utility.set_location('OLDVAL '||l_old_val, 20);
207: hr_utility.set_location('TYPE '||l_type, 20);
208: hr_utility.set_location('CD '||l_ocrd_dt_cd, 20);
209: hr_utility.set_location('esd'||p_new.effective_start_date, 20);
210: l_changed := TRUE;
203: hr_utility.set_location('LER '||l_ler_id, 20);
204: hr_utility.set_location('COLUMN '||l_column, 20);
205: hr_utility.set_location('NEWVAL '||l_new_val, 20);
206: hr_utility.set_location('OLDVAL '||l_old_val, 20);
207: hr_utility.set_location('TYPE '||l_type, 20);
208: hr_utility.set_location('CD '||l_ocrd_dt_cd, 20);
209: hr_utility.set_location('esd'||p_new.effective_start_date, 20);
210: l_changed := TRUE;
211: if get_ler_col%ROWCOUNT = 1 then
204: hr_utility.set_location('COLUMN '||l_column, 20);
205: hr_utility.set_location('NEWVAL '||l_new_val, 20);
206: hr_utility.set_location('OLDVAL '||l_old_val, 20);
207: hr_utility.set_location('TYPE '||l_type, 20);
208: hr_utility.set_location('CD '||l_ocrd_dt_cd, 20);
209: hr_utility.set_location('esd'||p_new.effective_start_date, 20);
210: l_changed := TRUE;
211: if get_ler_col%ROWCOUNT = 1 then
212: l_changed := TRUE;
205: hr_utility.set_location('NEWVAL '||l_new_val, 20);
206: hr_utility.set_location('OLDVAL '||l_old_val, 20);
207: hr_utility.set_location('TYPE '||l_type, 20);
208: hr_utility.set_location('CD '||l_ocrd_dt_cd, 20);
209: hr_utility.set_location('esd'||p_new.effective_start_date, 20);
210: l_changed := TRUE;
211: if get_ler_col%ROWCOUNT = 1 then
212: l_changed := TRUE;
213: hr_utility.set_location('rowcount 1 ', 20);
209: hr_utility.set_location('esd'||p_new.effective_start_date, 20);
210: l_changed := TRUE;
211: if get_ler_col%ROWCOUNT = 1 then
212: l_changed := TRUE;
213: hr_utility.set_location('rowcount 1 ', 20);
214: end if;
215: hr_utility.set_location(' ben_pbb_trigger', 20);
216: -- hr_utility.set_location('New'||p_new.person_type_id, 20);
217: -- hr_utility.set_location('New'||p_old.person_type_id, 20);
211: if get_ler_col%ROWCOUNT = 1 then
212: l_changed := TRUE;
213: hr_utility.set_location('rowcount 1 ', 20);
214: end if;
215: hr_utility.set_location(' ben_pbb_trigger', 20);
216: -- hr_utility.set_location('New'||p_new.person_type_id, 20);
217: -- hr_utility.set_location('New'||p_old.person_type_id, 20);
218: --
219: -- Call the formula here to evaluate per_info_chg_cs_ler_rl.
212: l_changed := TRUE;
213: hr_utility.set_location('rowcount 1 ', 20);
214: end if;
215: hr_utility.set_location(' ben_pbb_trigger', 20);
216: -- hr_utility.set_location('New'||p_new.person_type_id, 20);
217: -- hr_utility.set_location('New'||p_old.person_type_id, 20);
218: --
219: -- Call the formula here to evaluate per_info_chg_cs_ler_rl.
220: -- If it returns Y, then see the applicability of the data
213: hr_utility.set_location('rowcount 1 ', 20);
214: end if;
215: hr_utility.set_location(' ben_pbb_trigger', 20);
216: -- hr_utility.set_location('New'||p_new.person_type_id, 20);
217: -- hr_utility.set_location('New'||p_old.person_type_id, 20);
218: --
219: -- Call the formula here to evaluate per_info_chg_cs_ler_rl.
220: -- If it returns Y, then see the applicability of the data
221: -- changes based on new and old values.
292: ,p_new.effective_start_date,l_new_val) AND
293: benutils.column_changed(p_new.effective_start_date
294: ,p_old.effective_start_date,l_old_val) AND
295: (l_changed));
296: hr_utility.set_location(' l_changed:',30);
297: end if;
298: --
299: if l_column = 'EFFECTIVE_END_DATE' then
300: hr_utility.set_location('New eed'||p_new.effective_end_date, 20);
296: hr_utility.set_location(' l_changed:',30);
297: end if;
298: --
299: if l_column = 'EFFECTIVE_END_DATE' then
300: hr_utility.set_location('New eed'||p_new.effective_end_date, 20);
301: hr_utility.set_location('Old eed'||p_old.effective_end_date, 20);
302: if p_new.effective_end_date = hr_api.g_eot then
303: l_changed := FALSE;
304: end if;
297: end if;
298: --
299: if l_column = 'EFFECTIVE_END_DATE' then
300: hr_utility.set_location('New eed'||p_new.effective_end_date, 20);
301: hr_utility.set_location('Old eed'||p_old.effective_end_date, 20);
302: if p_new.effective_end_date = hr_api.g_eot then
303: l_changed := FALSE;
304: end if;
305: l_changed := (benutils.column_changed(p_old.effective_end_date
306: ,p_new.effective_end_date,l_new_val) AND
307: benutils.column_changed(p_new.effective_end_date
308: ,p_old.effective_end_date,l_old_val) AND
309: (l_changed));
310: hr_utility.set_location(' l_changed:',40);
311: --
312: if l_ocrd_dt_cd is null then
313: l_lf_evt_ocrd_date := p_new.effective_end_date;
314: else
324: end if;
325: end if;
326: --
327: if l_column = 'VAL' then
328: hr_utility.set_location('Old val '||p_old.val, 20);
329: hr_utility.set_location('New val '||p_new.val, 20);
330: l_changed := (benutils.column_changed(p_old.val
331: ,p_new.val,l_new_val) AND
332: benutils.column_changed(p_new.val
325: end if;
326: --
327: if l_column = 'VAL' then
328: hr_utility.set_location('Old val '||p_old.val, 20);
329: hr_utility.set_location('New val '||p_new.val, 20);
330: l_changed := (benutils.column_changed(p_old.val
331: ,p_new.val,l_new_val) AND
332: benutils.column_changed(p_new.val
333: ,p_old.val,l_old_val) AND
332: benutils.column_changed(p_new.val
333: ,p_old.val,l_old_val) AND
334: (l_changed));
335: end if;
336: hr_utility.set_location(' ben_pbb_trigger', 50);
337: --
338: if l_column = 'BNFTS_BAL_ID' then
339: hr_utility.set_location('Old balid '||p_old.bnfts_bal_id, 20);
340: hr_utility.set_location('New balid '||p_new.bnfts_bal_id, 20);
335: end if;
336: hr_utility.set_location(' ben_pbb_trigger', 50);
337: --
338: if l_column = 'BNFTS_BAL_ID' then
339: hr_utility.set_location('Old balid '||p_old.bnfts_bal_id, 20);
340: hr_utility.set_location('New balid '||p_new.bnfts_bal_id, 20);
341: hr_utility.set_location('lodt '||l_lf_evt_ocrd_date, 20);
342: l_changed := (benutils.column_changed(p_old.bnfts_bal_id
343: ,p_new.bnfts_bal_id,l_new_val) AND
336: hr_utility.set_location(' ben_pbb_trigger', 50);
337: --
338: if l_column = 'BNFTS_BAL_ID' then
339: hr_utility.set_location('Old balid '||p_old.bnfts_bal_id, 20);
340: hr_utility.set_location('New balid '||p_new.bnfts_bal_id, 20);
341: hr_utility.set_location('lodt '||l_lf_evt_ocrd_date, 20);
342: l_changed := (benutils.column_changed(p_old.bnfts_bal_id
343: ,p_new.bnfts_bal_id,l_new_val) AND
344: benutils.column_changed(p_new.bnfts_bal_id
337: --
338: if l_column = 'BNFTS_BAL_ID' then
339: hr_utility.set_location('Old balid '||p_old.bnfts_bal_id, 20);
340: hr_utility.set_location('New balid '||p_new.bnfts_bal_id, 20);
341: hr_utility.set_location('lodt '||l_lf_evt_ocrd_date, 20);
342: l_changed := (benutils.column_changed(p_old.bnfts_bal_id
343: ,p_new.bnfts_bal_id,l_new_val) AND
344: benutils.column_changed(p_new.bnfts_bal_id
345: ,p_old.bnfts_bal_id,l_old_val) AND
344: benutils.column_changed(p_new.bnfts_bal_id
345: ,p_old.bnfts_bal_id,l_old_val) AND
346: (l_changed));
347: end if;
348: hr_utility.set_location(' ben_pbb_trigger', 60);
349: --
350:
351: --
352: -- Checking the rule output and the rule override flag.
357: l_changed := TRUE ;
358: elsif l_rule_output = 'Y' and l_rule_overrides_flag = 'N' then
359: l_changed := l_changed AND TRUE;
360: elsif l_rule_output = 'N' then
361: hr_utility.set_location(' Rule output is N, so we should not trigger LE', 20.01);
362: l_changed := FALSE;
363: end if;
364:
365: hr_utility.set_location('After the rule Check ',20.05);
361: hr_utility.set_location(' Rule output is N, so we should not trigger LE', 20.01);
362: l_changed := FALSE;
363: end if;
364:
365: hr_utility.set_location('After the rule Check ',20.05);
366: if l_changed then
367: hr_utility.set_location(' l_change TRUE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
368: else
369: hr_utility.set_location(' l_change FALSE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
363: end if;
364:
365: hr_utility.set_location('After the rule Check ',20.05);
366: if l_changed then
367: hr_utility.set_location(' l_change TRUE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
368: else
369: hr_utility.set_location(' l_change FALSE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
370: end if;
371: -- Check for Column Mandatory Change
365: hr_utility.set_location('After the rule Check ',20.05);
366: if l_changed then
367: hr_utility.set_location(' l_change TRUE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
368: else
369: hr_utility.set_location(' l_change FALSE l_rule_overrides_flag '||l_rule_overrides_flag, 20.1);
370: end if;
371: -- Check for Column Mandatory Change
372: -- If column change is mandatory and data change has failed then dont trigger
373: -- If column change is non-mandatory and the data change has passed, then trigger.
372: -- If column change is mandatory and data change has failed then dont trigger
373: -- If column change is non-mandatory and the data change has passed, then trigger.
374:
375: if l_chg_mandatory_cd = 'Y' and not l_changed then
376: hr_utility.set_location('Found Mandatory and its failed ', 20.1);
377: l_changed := FALSE;
378: l_trigger := FALSE;
379: exit;
380: elsif l_chg_mandatory_cd = 'Y' and l_changed then
377: l_changed := FALSE;
378: l_trigger := FALSE;
379: exit;
380: elsif l_chg_mandatory_cd = 'Y' and l_changed then
381: hr_utility.set_location('Found Mandatory and its passed ', 20.1);
382: l_changed := TRUE;
383: -- exit; */
384: elsif l_chg_mandatory_cd = 'N' and l_changed then
385: hr_utility.set_location('Found First Non-Mandatory and its passed ', 20.1);
381: hr_utility.set_location('Found Mandatory and its passed ', 20.1);
382: l_changed := TRUE;
383: -- exit; */
384: elsif l_chg_mandatory_cd = 'N' and l_changed then
385: hr_utility.set_location('Found First Non-Mandatory and its passed ', 20.1);
386: l_changed := TRUE;
387: l_trigger := TRUE;
388: exit;
389: end if;
387: l_trigger := TRUE;
388: exit;
389: end if;
390:
391: hr_utility.set_location('After the Mandatory code check ',20.05);
392: if l_changed then
393: hr_utility.set_location(' l_change TRUE ', 20.1);
394: else
395: hr_utility.set_location(' l_change FALSE ', 20.1);
389: end if;
390:
391: hr_utility.set_location('After the Mandatory code check ',20.05);
392: if l_changed then
393: hr_utility.set_location(' l_change TRUE ', 20.1);
394: else
395: hr_utility.set_location(' l_change FALSE ', 20.1);
396: end if;
397: --
391: hr_utility.set_location('After the Mandatory code check ',20.05);
392: if l_changed then
393: hr_utility.set_location(' l_change TRUE ', 20.1);
394: else
395: hr_utility.set_location(' l_change FALSE ', 20.1);
396: end if;
397: --
398: /* if not l_changed then
399: exit;
399: exit;
400: end if; */
401: --
402: end loop;
403: hr_utility.set_location(' ben_pbb_trigger', 30);
404: l_ptnl_id := 0;
405: l_ovn :=null;
406: if l_trigger then
407: if l_type = 'P' then
407: if l_type = 'P' then
408: open le_exists(p_new.person_id,l_ler_id,l_lf_evt_ocrd_date);
409: fetch le_exists into l_le_exists;
410: if le_exists%notfound then
411: hr_utility.set_location(' Entering: ben_pbb_trigger5', 60);
412:
413: ben_create_ptnl_ler_for_per.create_ptnl_ler_event
414: --ben_ptnl_ler_for_per_api.create_ptnl_ler_for_per
415: (p_validate => false
426: ,p_dtctd_dt => l_session_date);
427: end if;
428: close le_exists;
429: elsif l_type = 'R' then
430: hr_utility.set_location(' Entering: ben_pbb_trigger5-', 65);
431: open get_contacts(p_new.person_id);
432: loop
433: fetch get_contacts into l_hld_person_id;
434: exit when get_contacts%notfound;
434: exit when get_contacts%notfound;
435: open le_exists(l_hld_person_id,l_ler_id,l_lf_evt_ocrd_date);
436: fetch le_exists into l_le_exists;
437: if le_exists%notfound then
438: hr_utility.set_location(' Entering: ben_pbb_trigger5', 60);
439:
440: ben_create_ptnl_ler_for_per.create_ptnl_ler_event
441: --ben_ptnl_ler_for_per_api.create_ptnl_ler_for_per
442: (p_validate => false
460: end if;
461: --
462: -- reset the variables.
463: --
464: hr_utility.set_location(' ben_pbb_trigger', 40);
465: l_changed := FALSE;
466: l_trigger := TRUE;
467: l_ovn := NULL;
468: l_effective_start_date := l_session_date;
469: -- l_lf_evt_ocrd_date := l_session_date;
470: end if;
471: close get_ler_col;
472: end loop;
473: hr_utility.set_location(' ben_pbb_trigger', 50);
474: close get_ler;
475: hr_utility.set_location(' leaving ben_pbb_trigger', 70);
476: exception
477: when others then
471: close get_ler_col;
472: end loop;
473: hr_utility.set_location(' ben_pbb_trigger', 50);
474: close get_ler;
475: hr_utility.set_location(' leaving ben_pbb_trigger', 70);
476: exception
477: when others then
478: hr_utility.set_location(sqlerrm, 70);
479: raise;
474: close get_ler;
475: hr_utility.set_location(' leaving ben_pbb_trigger', 70);
476: exception
477: when others then
478: hr_utility.set_location(sqlerrm, 70);
479: raise;
480: end;
481:
482: end;