[Home] [Help]
1: PACKAGE BODY PER_APPLICATIONS_PKG as
2: /* $Header: peapp01t.pkb 120.7.12020000.6 2013/05/27 06:13:48 srannama ship $ */
3: /* =========================================================================
4: Name
5: per_applications_pkg
1: PACKAGE BODY PER_APPLICATIONS_PKG as
2: /* $Header: peapp01t.pkb 120.7.12020000.6 2013/05/27 06:13:48 srannama ship $ */
3: /* =========================================================================
4: Name
5: per_applications_pkg
6: Purpose
7: Supports the Termination Details Block (APL) in the form
8: PERWSTAP - Terminate Applicant.
9: ==========================================================================
102: --
103: BEGIN
104: p_del_flag := 'N';
105:
106: hr_utility.set_location('PER_APPLICATIONS_PKG.term_update_ass_bud_val',5);
107: hr_utility.set_location(p_date_end,6);
108:
109: BEGIN
110:
127: END;
128: --
129: IF p_del_flag = 'Y' THEN
130: --
131: hr_utility.set_location('PER_APPLICATIONS_PKG.term_update_ass_bud_val',10);
132: --
133: delete from per_assignment_budget_values_f abv
134: where exists (
135: Select null
147: END IF;
148:
149: p_del_flag := 'N';
150: --
151: hr_utility.set_location('PER_APPLICATIONS_PKG.term_update_ass_bud_val',15);
152: --
153: -- Check for and update any assignment budget value row(s) where the termination end date occurs during the
154: -- life of the assignment budget value row(s).
155: --
175: END;
176:
177: IF p_del_flag = 'Y' THEN
178: --
179: hr_utility.set_location('PER_APPLICATIONS_PKG.term_update_ass_bud_val',20);
180: --
181: --
182: -- Start of fix for WWBUG 1408379
183: --
277: --
278: BEGIN
279: p_del_flag := 'N';
280:
281: hr_utility.set_location('PER_APPLICATIONS_PKG.cancel_update_ass_bud_val',5);
282:
283: --
284: BEGIN
285:
303: END;
304:
305: IF p_del_flag = 'Y' THEN
306: --
307: hr_utility.set_location('PER_APPLICATIONS_PKG.cancel_update_ass_bud_val',10);
308: --
309: --
310: -- Start of fix for WWBUG 1408379
311: --
888: FROM per_all_people_f pap
889: WHERE pap.person_id = p_person_id
890: AND pap.applicant_number IS NOT NULL
891: and EXISTS(SELECT 1 -- If hired app table has appl with end date and SUCCESSFUL_FLAG = 'Y'
892: from per_applications app
893: where app.person_id = p_person_id
894: AND app.business_group_id + 0 = p_business_group_id
895: and app.DATE_END = p_date_end
896: and nvl(app.SUCCESSFUL_FLAG,'N') = 'Y'
1705: --
1706:
1707: CURSOR c_chk_already_term IS
1708: SELECT 1
1709: FROM PER_APPLICATIONS PA
1710: WHERE PA.business_group_id + 0 = P_Business_group_id
1711: AND PA.PERSON_ID = P_person_id
1712: AND PA.APPLICATION_ID = P_application_id
1713: AND PA.DATE_END IS NOT NULL;
2060: p_Last_Update_Login NUMBER,
2061: p_Created_By NUMBER,
2062: p_Creation_Date DATE
2063: ) IS
2064: CURSOR C IS SELECT rowid FROM PER_APPLICATIONS
2065: WHERE application_id = p_Application_Id;
2066: CURSOR C2 IS SELECT per_applications_s.nextval FROM sys.dual;
2067: BEGIN
2068: if (p_Application_Id is NULL) then
2062: p_Creation_Date DATE
2063: ) IS
2064: CURSOR C IS SELECT rowid FROM PER_APPLICATIONS
2065: WHERE application_id = p_Application_Id;
2066: CURSOR C2 IS SELECT per_applications_s.nextval FROM sys.dual;
2067: BEGIN
2068: if (p_Application_Id is NULL) then
2069: OPEN C2;
2070: FETCH C2 INTO p_Application_Id;
2069: OPEN C2;
2070: FETCH C2 INTO p_Application_Id;
2071: CLOSE C2;
2072: end if;
2073: INSERT INTO PER_APPLICATIONS(
2074: application_id,
2075: business_group_id,
2076: person_id,
2077: date_received,
2188: p_Appl_Attribute20 VARCHAR2
2189: ) IS
2190: CURSOR C IS
2191: SELECT *
2192: FROM PER_APPLICATIONS
2193: WHERE rowid = p_Rowid
2194: FOR UPDATE of Application_Id NOWAIT;
2195: Recinfo C%ROWTYPE;
2196: BEGIN
2431: ORDER BY asg.effective_start_date;
2432:
2433: cursor chk_apl_exists(p_asg_start_date date) is
2434: select application_id, date_end
2435: from per_applications
2436: where person_id = p_person_id
2437: and application_id <> p_application_id
2438: and p_asg_start_date between date_received and nvl(date_end,hr_api.g_eot);
2439:
2454: and effective_start_date > p_date_received;
2455:
2456: cursor future_apln is
2457: select rowid,application_id
2458: from per_applications
2459: where person_id = p_person_id
2460: and date_received > p_date_received;
2461:
2462: BEGIN
2459: where person_id = p_person_id
2460: and date_received > p_date_received;
2461:
2462: BEGIN
2463: hr_utility.set_location('per_applications_pkg.update_row',10);
2464:
2465: -- ER FPT
2466: IF (nvl(fnd_profile.value('HR_ALLOW_FPT_UPDATES'),'N') = 'Y') then
2467: -- Reverse Terminating the End Application
2477: where application_id = apl.application_id
2478: and person_id = p_person_id
2479: and assignment_type = 'A';
2480: -- deleting the future APL
2481: per_applications_pkg.delete_row(apl.rowid);
2482:
2483: end loop;
2484:
2485: -- looping through the future PTU records of APL
2553: open chk_apl_exists(asg_rec.effective_start_date);
2554: fetch chk_apl_exists into l_current_apl_id,l_current_apl_end_date;
2555: if chk_apl_exists%notfound then
2556:
2557: SELECT per_applications_s.nextval into l_new_application_id FROM sys.dual;
2558: l_current_apl_id := l_new_application_id;
2559: hr_utility.set_location('Creating a new APL with ID : '||l_new_application_id,15);
2560: begin
2561: -- If there is no APL, creating the new APL
2558: l_current_apl_id := l_new_application_id;
2559: hr_utility.set_location('Creating a new APL with ID : '||l_new_application_id,15);
2560: begin
2561: -- If there is no APL, creating the new APL
2562: INSERT INTO PER_APPLICATIONS(
2563: application_id,
2564: business_group_id,
2565: person_id,
2566: date_received,
2574: else
2575:
2576: if nvl(l_current_apl_end_date,hr_api.g_eot) < nvl(l_apl_end_date,hr_api.g_eot) then
2577:
2578: update per_applications
2579: set date_end = l_apl_end_date
2580: where person_id = p_person_id
2581: and application_id = l_current_apl_id;
2582: end if;
2600: -- Bug 3053711 Start
2601: -- Added the check if flag = 'Y'
2602: --Commented out for the Bug 4202317
2603: -- if p_Cancellation_Flag = 'Y' then
2604: UPDATE PER_APPLICATIONS
2605: SET
2606: application_id = p_Application_Id,
2607: business_group_id = p_Business_Group_Id,
2608: person_id = p_Person_Id,
2636: appl_attribute20 = p_Appl_Attribute20
2637: WHERE rowid = p_rowid;
2638: --Commented out for the Bug 4202317
2639: /*else
2640: UPDATE PER_APPLICATIONS
2641: SET
2642: application_id = p_Application_Id,
2643: business_group_id = p_Business_Group_Id,
2644: person_id = p_Person_Id,
2672: appl_attribute20 = p_Appl_Attribute20
2673: WHERE rowid = p_rowid;
2674: end if;*/
2675: -- Bug 3053711 End
2676: -- hr_utility.set_location('per_applications_pkg.update_row',20); --Commented to resolve Bug#13934184
2677: if (SQL%NOTFOUND) then
2678: RAISE NO_DATA_FOUND;
2679: end if;
2680:
2677: if (SQL%NOTFOUND) then
2678: RAISE NO_DATA_FOUND;
2679: end if;
2680:
2681: hr_utility.set_location('per_applications_pkg.update_row',30);
2682: --
2683: -- Now maintain the PTU data...
2684: --
2685: -- 3652025: Another package will do the updates when performing a termination.
2692: -- terminated application.
2693: --
2694: -- PTU : Following code added for PTU
2695: --
2696: --hr_utility.set_location('per_applications_pkg.update_row',40);
2697:
2698: --Bug No 3891787 starts here
2699: --Open csr_ptu_row1;
2700: --fetch csr_ptu_row1 into l_person_type_id,l_start_date;
2717: -- );
2718: --end if;
2719: --close csr_ptu_row1;
2720: --Bug No 3891787 ends here
2721: --hr_utility.set_location('per_applications_pkg.update_row',50);
2722: -- End of PTU Changes
2723: --
2724: -- hr_per_type_usage_internal.maintain_ptu(
2725: -- p_action => 'TERM_APL',
2743: -- Bug 10286850
2744: open csr_chk_emp;
2745: fetch csr_chk_emp into l_person_id;
2746: if csr_chk_emp%found then
2747: hr_utility.set_location('per_applications_pkg.update_row',60);
2748: hr_utility.set_message(800,'PER_7594_APP_TERM_EMP_HIRE');
2749: hr_utility.raise_error;
2750: end if;
2751: close csr_chk_emp;
2749: hr_utility.raise_error;
2750: end if;
2751: close csr_chk_emp;
2752:
2753: hr_utility.set_location('per_applications_pkg.p_date_received = '||to_char(p_date_received,'DD/MM/YYYY'),60);
2754: hr_utility.set_location('per_applications_pkg.p_date_end = '||to_char(l_date_end,'DD/MM/YYYY'),60);
2755: hr_utility.set_location('per_applications_pkg.p_person_id = '||to_char(p_person_id),60);
2756:
2757: if l_date_end is not null then
2750: end if;
2751: close csr_chk_emp;
2752:
2753: hr_utility.set_location('per_applications_pkg.p_date_received = '||to_char(p_date_received,'DD/MM/YYYY'),60);
2754: hr_utility.set_location('per_applications_pkg.p_date_end = '||to_char(l_date_end,'DD/MM/YYYY'),60);
2755: hr_utility.set_location('per_applications_pkg.p_person_id = '||to_char(p_person_id),60);
2756:
2757: if l_date_end is not null then
2758: hr_per_type_usage_internal.cancel_person_type_usage
2751: close csr_chk_emp;
2752:
2753: hr_utility.set_location('per_applications_pkg.p_date_received = '||to_char(p_date_received,'DD/MM/YYYY'),60);
2754: hr_utility.set_location('per_applications_pkg.p_date_end = '||to_char(l_date_end,'DD/MM/YYYY'),60);
2755: hr_utility.set_location('per_applications_pkg.p_person_id = '||to_char(p_person_id),60);
2756:
2757: if l_date_end is not null then
2758: hr_per_type_usage_internal.cancel_person_type_usage
2759: (
2769: END Update_Row;
2770: --
2771: PROCEDURE Delete_Row(p_Rowid VARCHAR2) IS
2772: BEGIN
2773: DELETE FROM PER_APPLICATIONS
2774: WHERE rowid = p_Rowid;
2775:
2776: if (SQL%NOTFOUND) then
2777: RAISE NO_DATA_FOUND;
2838: and paa.effective_end_date = p_date_end;
2839: --
2840: begin
2841: --
2842: hr_utility.set_location('PER_APPLICATIONS_PKG.maintain_irc_ass_status', 10);
2843: --
2844: -- Termination of applicant
2845: if p_action = 'TERM' then
2846: --
2845: if p_action = 'TERM' then
2846: --
2847: l_ass_status := 'TERM_APL';
2848: --
2849: hr_utility.set_location('PER_APPLICATIONS_PKG.maintain_irc_ass_status', 20);
2850: --
2851: open csr_get_asg_status;
2852: fetch csr_get_asg_status into l_ass_status_type_id;
2853: close csr_get_asg_status;
2871: else
2872: --
2873: l_ass_status := 'ACTIVE_APL';
2874: --
2875: hr_utility.set_location('PER_APPLICATIONS_PKG.maintain_irc_ass_status', 30);
2876: --
2877: open csr_get_asg_status;
2878: fetch csr_get_asg_status into l_ass_status_type_id;
2879: close csr_get_asg_status;
2894: close csr_cancel_ass_id;
2895: --
2896: end if;
2897: --
2898: hr_utility.set_location('PER_APPLICATIONS_PKG.maintain_irc_ass_status', 40);
2899: --
2900: end maintain_irc_ass_status;
2901: --
2902: END PER_APPLICATIONS_PKG;
2898: hr_utility.set_location('PER_APPLICATIONS_PKG.maintain_irc_ass_status', 40);
2899: --
2900: end maintain_irc_ass_status;
2901: --
2902: END PER_APPLICATIONS_PKG;