66: * ==========================================================================+
67: */
68:
69: g_package varchar2(80) := 'ben_cwb_asg_update.';
70: g_debug boolean := hr_utility.debug_enabled;
71: g_validate varchar2(30) := fnd_profile.value('BEN_CWB_ASG_PERF_VALIDATE');
72:
73:
74: FUNCTION get_update_mode(
202: --
203: begin
204: --
205: if g_debug then
206: hr_utility.set_location('Entering:'|| l_proc,2);
207: hr_utility.set_location('p_txn_old.attribute1: ' || p_txn_old.attribute1 , 3);
208: hr_utility.set_location('p_txn_old.attribute2: ' || p_txn_old.attribute2, 5);
209: hr_utility.set_location('p_txn_old.transaction_id: ' || p_txn_old.transaction_id, 6);
210: end if;
203: begin
204: --
205: if g_debug then
206: hr_utility.set_location('Entering:'|| l_proc,2);
207: hr_utility.set_location('p_txn_old.attribute1: ' || p_txn_old.attribute1 , 3);
208: hr_utility.set_location('p_txn_old.attribute2: ' || p_txn_old.attribute2, 5);
209: hr_utility.set_location('p_txn_old.transaction_id: ' || p_txn_old.transaction_id, 6);
210: end if;
211:
204: --
205: if g_debug then
206: hr_utility.set_location('Entering:'|| l_proc,2);
207: hr_utility.set_location('p_txn_old.attribute1: ' || p_txn_old.attribute1 , 3);
208: hr_utility.set_location('p_txn_old.attribute2: ' || p_txn_old.attribute2, 5);
209: hr_utility.set_location('p_txn_old.transaction_id: ' || p_txn_old.transaction_id, 6);
210: end if;
211:
212:
205: if g_debug then
206: hr_utility.set_location('Entering:'|| l_proc,2);
207: hr_utility.set_location('p_txn_old.attribute1: ' || p_txn_old.attribute1 , 3);
208: hr_utility.set_location('p_txn_old.attribute2: ' || p_txn_old.attribute2, 5);
209: hr_utility.set_location('p_txn_old.transaction_id: ' || p_txn_old.transaction_id, 6);
210: end if;
211:
212:
213: l_txn_new := null;
219: fetch c_per_in_ler into l_per_in_ler_id, l_pl_id, l_lf_evt_ocrd_dt;
220: close c_per_in_ler;
221: --
222: if g_debug then
223: hr_utility.set_location('l_per_in_ler_id: ' || l_per_in_ler_id, 6);
224: hr_utility.set_location('l_pl_id: ' || l_pl_id, 7);
225: hr_utility.set_location('l_lf_evt_ocrd_dt: ' || l_lf_evt_ocrd_dt, 10);
226: end if;
227:
220: close c_per_in_ler;
221: --
222: if g_debug then
223: hr_utility.set_location('l_per_in_ler_id: ' || l_per_in_ler_id, 6);
224: hr_utility.set_location('l_pl_id: ' || l_pl_id, 7);
225: hr_utility.set_location('l_lf_evt_ocrd_dt: ' || l_lf_evt_ocrd_dt, 10);
226: end if;
227:
228: begin
221: --
222: if g_debug then
223: hr_utility.set_location('l_per_in_ler_id: ' || l_per_in_ler_id, 6);
224: hr_utility.set_location('l_pl_id: ' || l_pl_id, 7);
225: hr_utility.set_location('l_lf_evt_ocrd_dt: ' || l_lf_evt_ocrd_dt, 10);
226: end if;
227:
228: begin
229: select * into l_txn_new
384:
385: begin
386: --
387: if g_debug then
388: hr_utility.set_location('Entering:'|| l_proc,2);
389: hr_utility.set_location('p_txn_old.attribute1: ' || p_txn_old.attribute1 , 3);
390: hr_utility.set_location('p_txn_old.attribute2: ' || p_txn_old.attribute2, 5);
391: hr_utility.set_location('p_txn_old.transaction_id: ' || p_txn_old.transaction_id, 6);
392: end if;
385: begin
386: --
387: if g_debug then
388: hr_utility.set_location('Entering:'|| l_proc,2);
389: hr_utility.set_location('p_txn_old.attribute1: ' || p_txn_old.attribute1 , 3);
390: hr_utility.set_location('p_txn_old.attribute2: ' || p_txn_old.attribute2, 5);
391: hr_utility.set_location('p_txn_old.transaction_id: ' || p_txn_old.transaction_id, 6);
392: end if;
393:
386: --
387: if g_debug then
388: hr_utility.set_location('Entering:'|| l_proc,2);
389: hr_utility.set_location('p_txn_old.attribute1: ' || p_txn_old.attribute1 , 3);
390: hr_utility.set_location('p_txn_old.attribute2: ' || p_txn_old.attribute2, 5);
391: hr_utility.set_location('p_txn_old.transaction_id: ' || p_txn_old.transaction_id, 6);
392: end if;
393:
394: l_txn_new := null;
387: if g_debug then
388: hr_utility.set_location('Entering:'|| l_proc,2);
389: hr_utility.set_location('p_txn_old.attribute1: ' || p_txn_old.attribute1 , 3);
390: hr_utility.set_location('p_txn_old.attribute2: ' || p_txn_old.attribute2, 5);
391: hr_utility.set_location('p_txn_old.transaction_id: ' || p_txn_old.transaction_id, 6);
392: end if;
393:
394: l_txn_new := null;
395: --
404: fetch c_per_in_ler into l_per_in_ler_id, l_pl_id, l_lf_evt_ocrd_dt;
405: close c_per_in_ler;
406: --
407: if g_debug then
408: hr_utility.set_location('l_per_in_ler_id: ' || l_per_in_ler_id,6);
409: hr_utility.set_location('l_pl_id: ' || l_pl_id,7);
410: hr_utility.set_location('l_lf_evt_ocrd_dt: ' || l_lf_evt_ocrd_dt, 10);
411: end if;
412:
405: close c_per_in_ler;
406: --
407: if g_debug then
408: hr_utility.set_location('l_per_in_ler_id: ' || l_per_in_ler_id,6);
409: hr_utility.set_location('l_pl_id: ' || l_pl_id,7);
410: hr_utility.set_location('l_lf_evt_ocrd_dt: ' || l_lf_evt_ocrd_dt, 10);
411: end if;
412:
413: begin
406: --
407: if g_debug then
408: hr_utility.set_location('l_per_in_ler_id: ' || l_per_in_ler_id,6);
409: hr_utility.set_location('l_pl_id: ' || l_pl_id,7);
410: hr_utility.set_location('l_lf_evt_ocrd_dt: ' || l_lf_evt_ocrd_dt, 10);
411: end if;
412:
413: begin
414: select * into l_txn_new
2501: and evt.event_id = l_event_id;
2502: --
2503: begin
2504: --
2505: hr_utility.set_location('Entering ' || l_proc, 5);
2506: l_event_type := null;
2507: --
2508: if (p_txn_rec.attribute1 is null or
2509: p_txn_rec.attribute3 is null) then
2506: l_event_type := null;
2507: --
2508: if (p_txn_rec.attribute1 is null or
2509: p_txn_rec.attribute3 is null) then
2510: hr_utility.set_location('No Processing returning ' || l_proc, 5);
2511: return;
2512: else
2513: l_perf_date := to_date(p_txn_rec.attribute1, 'yyyy/mm/dd');
2514:
2513: l_perf_date := to_date(p_txn_rec.attribute1, 'yyyy/mm/dd');
2514:
2515: l_perf_date := p_effective_date;
2516:
2517: hr_utility.set_location('l_perf_date ' || l_perf_date, 10);
2518:
2519: open c_performance_id_in_db;
2520: fetch c_performance_id_in_db into l_performance_review_id, l_event_id, l_perf_ovn;
2521: close c_performance_id_in_db;
2525: fetch c_perf_id_attached_event_type into l_event_type;
2526: close c_perf_id_attached_event_type;
2527: end if;
2528:
2529: hr_utility.set_location(l_performance_review_id||','||l_event_id||','||l_perf_date,15);
2530: hr_utility.set_location(l_event_type,16);
2531: hr_utility.set_location(p_txn_rec.attribute2,17);
2532:
2533: if(l_event_type is not null) then
2526: close c_perf_id_attached_event_type;
2527: end if;
2528:
2529: hr_utility.set_location(l_performance_review_id||','||l_event_id||','||l_perf_date,15);
2530: hr_utility.set_location(l_event_type,16);
2531: hr_utility.set_location(p_txn_rec.attribute2,17);
2532:
2533: if(l_event_type is not null) then
2534: if (l_event_type <> nvl(p_txn_rec.attribute2,'-1')) then
2527: end if;
2528:
2529: hr_utility.set_location(l_performance_review_id||','||l_event_id||','||l_perf_date,15);
2530: hr_utility.set_location(l_event_type,16);
2531: hr_utility.set_location(p_txn_rec.attribute2,17);
2532:
2533: if(l_event_type is not null) then
2534: if (l_event_type <> nvl(p_txn_rec.attribute2,'-1')) then
2535: hr_utility.set_location('Rating type mismatch '||l_event_type||'&'||p_txn_rec.attribute2, 20);
2531: hr_utility.set_location(p_txn_rec.attribute2,17);
2532:
2533: if(l_event_type is not null) then
2534: if (l_event_type <> nvl(p_txn_rec.attribute2,'-1')) then
2535: hr_utility.set_location('Rating type mismatch '||l_event_type||'&'||p_txn_rec.attribute2, 20);
2536: fnd_message.set_name ('BEN', 'BEN_93371_RATING_EXST_FOR_DATE');
2537: fnd_message.raise_error;
2538: end if;
2539: end if;
2539: end if;
2540:
2541: if (p_txn_rec.attribute2 is not null and l_event_id is null) then
2542: if(l_performance_review_id is not null) then
2543: hr_utility.set_location('Not Creating Evt. Assign Id: ' ||p_txn_rec.assignment_id, 30);
2544: fnd_message.set_name ('BEN', 'BEN_93371_RATING_EXST_FOR_DATE');
2545: fnd_message.raise_error;
2546: else
2547: hr_utility.set_location('Creating Evt. Assign Id: ' ||p_txn_rec.assignment_id, 30);
2543: hr_utility.set_location('Not Creating Evt. Assign Id: ' ||p_txn_rec.assignment_id, 30);
2544: fnd_message.set_name ('BEN', 'BEN_93371_RATING_EXST_FOR_DATE');
2545: fnd_message.raise_error;
2546: else
2547: hr_utility.set_location('Creating Evt. Assign Id: ' ||p_txn_rec.assignment_id, 30);
2548: per_events_api.create_event(
2549: p_validate => false
2550: ,p_date_start => l_perf_date
2551: ,p_type => p_txn_rec.attribute2
2557: end if;
2558: end if;
2559:
2560: if(l_performance_review_id is not null) then
2561: hr_utility.set_location('Updating Review Record ', 40);
2562: hr_perf_review_api.update_perf_review(
2563: p_validate => false
2564: ,p_performance_review_id => l_performance_review_id
2565: ,p_performance_rating => p_txn_rec.attribute3
2566: ,p_object_version_number => l_perf_ovn
2567: ,p_next_review_date_warning => l_next_review_date_warning);
2568: else
2569: if(l_event_id is not null) then
2570: hr_utility.set_location('Creating Review Record ', 40);
2571: hr_perf_review_api.create_perf_review(
2572: p_validate => false
2573: ,p_performance_review_id => l_performance_review_id
2574: ,p_person_id => p_person_id
2577: ,p_performance_rating => p_txn_rec.attribute3
2578: ,p_object_version_number => l_perf_ovn
2579: ,p_next_review_date_warning => l_next_review_date_warning);
2580: else
2581: hr_utility.set_location('Creating Review Record with null event', 40);
2582: hr_perf_review_api.create_perf_review(
2583: p_validate => false
2584: ,p_performance_review_id => l_performance_review_id
2585: ,p_person_id => p_person_id
2602: end if;
2603: --
2604: p_process_status := 'CWB_PERF_SUS';
2605: --
2606: hr_utility.set_location('Leaving ' || l_proc, 5);
2607: --
2608: EXCEPTION
2609: WHEN OTHERS THEN
2610: p_process_status := null;
2647: l_asg_rec c_asg%rowtype;
2648: --
2649: begin
2650: --
2651: hr_utility.set_location('Entering ' || l_proc, 5);
2652: --
2653: if p_asg_txn_rec.attribute1 is not null then
2654: l_effective_date := to_date(p_asg_txn_rec.attribute1, 'yyyy/mm/dd');
2655: l_assignment_id := p_asg_txn_rec.assignment_id;
2685: p_asg_txn_rec.attribute37 is not null or p_asg_txn_rec.attribute38 is not null or
2686: p_asg_txn_rec.attribute39 is not null or p_asg_txn_rec.attribute40 is not null or
2687: p_asg_txn_rec.attribute9 is not null then
2688: --
2689: hr_utility.set_location('Updating Assign Flex' , 30);
2690: /*if l_asg_rec.effective_start_date = l_effective_date then
2691: l_datetrack_mode := hr_api.g_correction;
2692: else
2693: l_datetrack_mode := hr_api.g_update;
2786: p_asg_txn_rec.attribute6 is not null or
2787: p_asg_txn_rec.attribute7 is not null or
2788: p_asg_txn_rec.attribute8 is not null then
2789: --
2790: hr_utility.set_location('Updating Job/Grade/Position People Group ', 40);
2791: --
2792: /*if l_asg_rec.effective_start_date = l_effective_date then
2793: l_datetrack_mode := hr_api.g_correction;
2794: else
2853: where group_per_in_ler_id = p_group_per_in_ler_id;
2854: --
2855: end if;
2856: --
2857: hr_utility.set_location('Leaving ' || l_proc, 5);
2858: --
2859: EXCEPTION
2860: WHEN OTHERS THEN
2861: p_process_status := null;