96: select pbg.legislation_code
97: from per_business_groups pbg
98: where pbg.business_group_id = p_business_group_id;
99: begin
100: hr_utility.set_location('Entering:'|| l_proc, 10);
101: --
102: -- Issue a savepoint
103: --
104: savepoint create_person_deployment;
347: p_person_deployment_id := l_person_deployment_id;
348: p_object_version_number := l_object_version_number;
349: p_policy_duration_warning := l_policy_duration_warning;
350: --
351: hr_utility.set_location(' Leaving:'||l_proc, 70);
352: exception
353: when hr_api.validate_enabled then
354: --
355: -- As the Validate_Enabled exception has been raised
363: --
364: p_person_deployment_id := null;
365: p_object_version_number := null;
366: p_policy_duration_warning := null;
367: hr_utility.set_location(' Leaving:'||l_proc, 80);
368: when others then
369: --
370: -- A validation or unexpected error has occured
371: --
376: --
377: p_person_deployment_id := null;
378: p_object_version_number := null;
379: p_policy_duration_warning := null;
380: hr_utility.set_location(' Leaving:'||l_proc, 90);
381: raise;
382: end create_person_deployment;
383: --
384: --
458: l_end_date date;
459: l_status_change_date date;
460: l_proc varchar2(72) := g_package||'update_person_deployment';
461: begin
462: hr_utility.set_location('Entering:'|| l_proc, 10);
463: --
464: -- Issue a savepoint
465: --
466: savepoint update_person_deployment;
701: -- Set all IN OUT and OUT parameters with out values
702: --
703: p_policy_duration_warning := l_policy_duration_warning;
704: --
705: hr_utility.set_location(' Leaving:'||l_proc, 70);
706: exception
707: when hr_api.validate_enabled then
708: --
709: -- As the Validate_Enabled exception has been raised
716: -- when validation only mode is being used.)
717: --
718: p_object_version_number := l_object_version_number;
719: p_policy_duration_warning := null;
720: hr_utility.set_location(' Leaving:'||l_proc, 80);
721: when others then
722: --
723: -- A validation or unexpected error has occured
724: --
728: -- OUT parameters, including warnings, to null
729: --
730: p_object_version_number := l_object_version_number;
731: p_policy_duration_warning := null;
732: hr_utility.set_location(' Leaving:'||l_proc, 90);
733: raise;
734: end update_person_deployment;
735: --
736: --
747: -- Declare cursors and local variables
748: --
749: l_proc varchar2(72) := g_package||'delete_person_deployment';
750: begin
751: hr_utility.set_location('Entering:'|| l_proc, 10);
752: --
753: -- Issue a savepoint
754: --
755: savepoint delete_person_deployment;
812: --
813: -- Set all IN OUT and OUT parameters with out values
814: --
815: --
816: hr_utility.set_location(' Leaving:'||l_proc, 70);
817: exception
818: when hr_api.validate_enabled then
819: --
820: -- As the Validate_Enabled exception has been raised
825: -- Reset IN OUT parameters and set OUT parameters
826: -- (Any key or derived arguments must be set to null
827: -- when validation only mode is being used.)
828: --
829: hr_utility.set_location(' Leaving:'||l_proc, 80);
830: when others then
831: --
832: -- A validation or unexpected error has occured
833: --
835: --
836: -- Reset IN OUT parameters and set all
837: -- OUT parameters, including warnings, to null
838: --
839: hr_utility.set_location(' Leaving:'||l_proc, 90);
840: raise;
841: end delete_person_deployment;
842: --
843: -- ----------------------------------------------------------------------------
1155: where people_group_id = cur_p_people_group_id;
1156: -- for people group fields population.
1157:
1158: begin
1159: hr_utility.set_location('Entering:'|| l_proc, 10);
1160: --
1161: -- Issue a savepoint
1162: --
1163: savepoint initiate_deployment;
1179: fnd_message.raise_error;
1180: else
1181: close csr_person_deployment;
1182: --
1183: hr_utility.set_location(l_proc,30);
1184: --
1185: end if;
1186: --
1187: if l_dpl_rec.status <> 'DRAFT' then
1216: l_varray_d(8):='PER_PEOPLE';
1217:
1218: hr_dflex_utility.create_ignore_df_validation(p_rec=>l_varray_d);
1219: --
1220: hr_utility.set_location(l_proc,20);
1221: --
1222: -- Process Logic
1223: --
1224: --
1230: fetch csr_home_per_values into l_home_last_name,l_home_sex,l_home_party_id,
1231: l_home_original_date_of_hire;
1232: close csr_home_per_values;
1233: --
1234: hr_utility.set_location(l_proc,40);
1235: --
1236: -- Set the global transfer in process variable used by person rowhandler validation
1237: --
1238: per_per_bus.g_global_transfer_in_process := true;
1240: -- Start of termination or update to the Home BG records
1241: --
1242: if nvl(l_dpl_rec.permanent,'N') = 'Y' then
1243: --
1244: hr_utility.set_location(l_proc,170);
1245: --
1246: -- termination of home employee record at (l_dpl_rec.start_date-1)
1247: --
1248:
1275: fnd_profile.put(name => 'HR_PROPAGATE_DATA_CHANGES'
1276: ,val => 'Y');
1277: else
1278: --
1279: hr_utility.set_location(l_proc,160);
1280: --
1281: -- suspend the active home assignments, leaving the others.
1282: --
1283: for l_home_asg_rec in csr_active_home_asgs(l_dpl_rec.from_person_id) loop
1317: -- Start of create or update person section
1318: --
1319: if l_dpl_rec.to_person_id is null then --creating new emp in host BG
1320: --
1321: hr_utility.set_location(l_proc,50);
1322: --
1323: hr_employee_api.create_employee
1324: (p_validate => p_validate
1325: ,p_hire_date => l_dpl_rec.start_date
1401: fnd_message.raise_error;
1402: --
1403: else --we should have the all clear to hire existing person
1404: --
1405: hr_utility.set_location(l_proc,70);
1406: --
1407: l_host_person_id := l_dpl_rec.to_person_id;
1408: --
1409: open csr_host_per_values(l_dpl_rec.to_person_id);
1432: close csr_host_asg_ovn;
1433: --
1434: end if;
1435: --
1436: hr_utility.set_location('host person id '||l_host_person_id,77);
1437: --
1438: --Code moved here
1439: if nvl(l_dpl_rec.retain_direct_reports,'N') = 'Y' then
1440:
1538: --
1539: l_soft_coding_keyflex_id := l_dpl_rec.soft_coding_keyflex_id;
1540: --
1541: --
1542: hr_utility.set_location(l_proc,80);
1543: --
1544: hr_assignment_api.update_emp_asg
1545: (p_validate => p_validate
1546: ,p_effective_date => l_dpl_rec.start_date
1679: ,p_hourly_salaried_warning => l_hourly_salaried_warning
1680: ,p_gsp_post_process_warning => l_gsp_post_process_warning
1681: );
1682: --
1683: hr_utility.set_location(l_proc,90);
1684: --
1685: -- sturlapa start
1686:
1687: if l_dpl_rec.people_group_id is not null then
1799: --
1800: if nvl(l_dpl_rec.permanent,'N') = 'Y'
1801: and l_dpl_rec.proposed_salary is not null then
1802: --
1803: hr_utility.set_location(l_proc,100);
1804: --
1805: hr_maintain_proposal_api.insert_salary_proposal
1806: (p_validate => p_validate
1807: ,p_pay_proposal_id => l_host_pyp_id
1852: for l_dpl_contact_rec in csr_dpl_contacts(p_person_deployment_id) loop
1853: <
1854: -- Fetch details from home BG
1855: --
1856: hr_utility.set_location(l_proc,110);
1857: --
1858: open csr_contact_rel_details(l_dpl_contact_rec.contact_relationship_id);
1859: fetch csr_contact_rel_details into l_contact_rel_details;
1860: close csr_contact_rel_details;
1871: --
1872: WHILE l_index_number is not null loop
1873: <
1874: --
1875: hr_utility.set_location(l_proc,120);
1876: --
1877: if l_contact_rel_details.contact_person_id =
1878: l_contacts_created(l_index_number).home_contact_person_id then
1879: l_contact_person_id :=
1878: l_contacts_created(l_index_number).home_contact_person_id then
1879: l_contact_person_id :=
1880: l_contacts_created(l_index_number).host_contact_person_id;
1881: --
1882: hr_utility.set_location(l_proc||' '||l_contact_person_id,123);
1883: --
1884: exit;
1885: else
1886: --
1883: --
1884: exit;
1885: else
1886: --
1887: hr_utility.set_location(l_proc,127);
1888: --
1889: l_contact_person_id := null;
1890: end if;
1891: l_index_number := l_contacts_created.NEXT(l_index_number);
1890: end if;
1891: l_index_number := l_contacts_created.NEXT(l_index_number);
1892: END LOOP created_contacts;
1893: --
1894: hr_utility.set_location(l_proc,130);
1895: hr_utility.set_location('host person id '||l_host_person_id,131);
1896: --
1897: hr_contact_rel_api.create_contact --use fetched details copying to host BG
1898: (p_validate => p_validate
1891: l_index_number := l_contacts_created.NEXT(l_index_number);
1892: END LOOP created_contacts;
1893: --
1894: hr_utility.set_location(l_proc,130);
1895: hr_utility.set_location('host person id '||l_host_person_id,131);
1896: --
1897: hr_contact_rel_api.create_contact --use fetched details copying to host BG
1898: (p_validate => p_validate
1899: ,p_start_date => l_dpl_rec.start_date
1937: --
1938: -- Now store the contact person_ids from home and host for checking in next loop
1939: --
1940: --
1941: hr_utility.set_location(l_proc,140);
1942: --
1943: l_contact_created.home_contact_person_id := l_contact_rel_details.contact_person_id;
1944: l_contact_created.host_contact_person_id := l_host_contact_person_id;
1945: l_contacts_created.EXTEND;
1950: -- Create EITs in host BG
1951: --
1952: for l_dpl_eit_rec in csr_dpl_eits(p_person_deployment_id) loop
1953: --
1954: hr_utility.set_location(l_proc,150);
1955: --
1956: -- Fetch details of EIT from home BG
1957: open csr_eit_details(l_dpl_eit_rec.person_extra_info_id);
1958: fetch csr_eit_details into l_eit_details;
1996: ,p_person_extra_info_id => l_host_person_extra_info_id
1997: ,p_object_version_number => l_host_pei_ovn
1998: );
1999: end loop;
2000: hr_utility.set_location(l_proc,180);
2001: --
2002: -- update the proposal with the new details to keep it up to date
2003: --
2004: if nvl(l_dpl_rec.permanent,'N') = 'Y' then
2002: -- update the proposal with the new details to keep it up to date
2003: --
2004: if nvl(l_dpl_rec.permanent,'N') = 'Y' then
2005: --
2006: hr_utility.set_location(l_proc,190);
2007: --
2008: hr_person_deployment_api.update_person_deployment
2009: (p_validate => p_validate
2010: ,p_person_deployment_id => p_person_deployment_id
2014: ,p_policy_duration_warning => l_policy_duration_warning
2015: );
2016: else
2017: --
2018: hr_utility.set_location(l_proc,200);
2019: --
2020: hr_person_deployment_api.update_person_deployment
2021: (p_validate => p_validate
2022: ,p_person_deployment_id => p_person_deployment_id
2053: open csr_get_attached_doc;
2054: fetch csr_get_attached_doc into l_attachments;
2055: if csr_get_attached_doc%found then
2056: close csr_get_attached_doc;
2057: hr_utility.set_location(l_host_person_id,200);
2058:
2059: update fnd_attached_documents
2060: set ENTITY_NAME='PER_PEOPLE_F' ,PK1_VALUE =l_host_person_id
2061: WHERE PK1_VALUE=p_person_deployment_id
2061: WHERE PK1_VALUE=p_person_deployment_id
2062: and ENTITY_NAME ='HR_PERSON_DEPLOYMENTS' ;
2063:
2064: else
2065: hr_utility.set_location(l_host_person_id,220);
2066: close csr_get_attached_doc;
2067: end if;
2068: --
2069: -- fix for bug 6593649
2069: -- fix for bug 6593649
2070: --
2071: per_per_bus.g_global_transfer_in_process := false;
2072: --
2073: hr_utility.set_location(' Leaving:'||l_proc, 700);
2074: exception
2075: when hr_api.validate_enabled then
2076: --
2077: -- As the Validate_Enabled exception has been raised
2094: p_already_applicant_warning := null;
2095: --
2096: per_per_bus.g_global_transfer_in_process := false;
2097: --
2098: hr_utility.set_location(' Leaving:'||l_proc, 800);
2099: when others then
2100: --
2101: -- A validation or unexpected error has occured
2102: --
2116: p_already_applicant_warning := null;
2117: --
2118: per_per_bus.g_global_transfer_in_process := false;
2119: --
2120: hr_utility.set_location(' Leaving:'||l_proc, 900);
2121: raise;
2122: end initiate_deployment;
2123: --
2124: --
2201: -- and asg.projected_assignment_end is not null;
2202: --
2203: begin
2204: --
2205: hr_utility.set_location('Entering:'|| l_proc, 10);
2206: --
2207: -- Issue a savepoint
2208: --
2209: savepoint change_deployment_dates;
2216: --
2217: l_start_date_in := trunc(p_start_date);
2218: l_end_date_in := trunc(p_end_date);
2219: --
2220: hr_utility.set_location(l_proc,20);
2221: --
2222: -- Validation in addition to Row Handlers
2223: --
2224: open csr_person_deployment(p_person_deployment_id);
2229: fnd_message.raise_error;
2230: else
2231: close csr_person_deployment;
2232: --
2233: hr_utility.set_location(l_proc,30);
2234: --
2235: end if;
2236: --
2237: if l_dpl_rec.status = 'DRAFT' then
2250: fnd_message.raise_error;
2251: end if;
2252:
2253:
2254: hr_utility.set_location(l_proc,40);
2255: --
2256: if nvl(l_start_date_in,l_dpl_rec.start_date) >=
2257: nvl(l_end_date_in,l_dpl_rec.end_date) then
2258: fnd_message.set_name('PER','HR_449621_PDT_CHG_DATES');
2274: --
2275:
2276: if nvl(l_start_date_in,hr_api.g_date) = hr_api.g_date then
2277: --
2278: hr_utility.set_location(l_proc,50);
2279: --
2280: --start date the same
2281: l_start_date_in := l_dpl_rec.start_date;
2282: else
2280: --start date the same
2281: l_start_date_in := l_dpl_rec.start_date;
2282: else
2283: --
2284: hr_utility.set_location(l_proc,60);
2285: --
2286: --start date changed
2287: hr_change_start_date_api.update_start_date
2288: (p_validate => p_validate
2295: );
2296: --
2297: for l_asg in csr_susp_home_asgs(p_person_deployment_id) loop
2298: --
2299: hr_utility.set_location(l_proc,70);
2300: hr_utility.set_location('assignment id '||l_asg.assignment_id,71);
2301: --
2302: open csr_overlap_asg_update
2303: (l_asg.assignment_id,l_dpl_rec.start_date,l_start_date_in);
2296: --
2297: for l_asg in csr_susp_home_asgs(p_person_deployment_id) loop
2298: --
2299: hr_utility.set_location(l_proc,70);
2300: hr_utility.set_location('assignment id '||l_asg.assignment_id,71);
2301: --
2302: open csr_overlap_asg_update
2303: (l_asg.assignment_id,l_dpl_rec.start_date,l_start_date_in);
2304: fetch csr_overlap_asg_update into l_dummy;
2327: -- Bug 5635350 modified the following if condition
2328: -- if l_end_date_in = hr_api.g_date then
2329: if l_end_date_in = hr_api.g_date or l_end_date_in = l_dpl_rec.end_date then
2330: --
2331: hr_utility.set_location(l_proc,80);
2332: --
2333: --end date the same
2334: l_end_date_in := l_dpl_rec.end_date;
2335: else
2333: --end date the same
2334: l_end_date_in := l_dpl_rec.end_date;
2335: else
2336: --
2337: hr_utility.set_location(l_proc,90);
2338: --
2339: -- The end date has changed, this is simply an update to projected asg end in host
2340: -- If start_date also moved later than sysdate we have to do correction instead
2341:
2398: hr_dflex_utility.remove_ignore_df_validation;
2399: --
2400: -- update the proposal with the new details to keep it up to date
2401: --
2402: hr_utility.set_location(l_proc,100);
2403: --
2404: hr_person_deployment_api.update_person_deployment
2405: (p_validate => p_validate
2406: ,p_person_deployment_id => p_person_deployment_id
2420: -- Set all IN OUT and OUT parameters with out values
2421: --
2422:
2423: --
2424: hr_utility.set_location(' Leaving:'||l_proc, 700);
2425: exception
2426: when hr_api.validate_enabled then
2427: --
2428: -- As the Validate_Enabled exception has been raised
2435: -- (Any key or derived arguments must be set to null
2436: -- when validation only mode is being used.)
2437: --
2438: p_object_version_number := l_object_version_number;
2439: hr_utility.set_location(' Leaving:'||l_proc, 800);
2440: when others then
2441: --
2442: -- A validation or unexpected error has occured
2443: --
2447: -- Reset IN OUT parameters and set all
2448: -- OUT parameters, including warnings, to null
2449: --
2450: p_object_version_number := l_object_version_number;
2451: hr_utility.set_location(' Leaving:'||l_proc, 900);
2452: raise;
2453: end change_deployment_dates;
2454: --
2455: --
2536: and paaf2.assignment_status_type_id = past2.assignment_status_type_id
2537: and past2.per_system_status = 'ACTIVE_ASSIGN');
2538: --
2539: begin
2540: hr_utility.set_location('Entering:'|| l_proc, 10);
2541: --
2542: -- Issue a savepoint
2543: --
2544: savepoint return_from_deployment;
2561: fnd_message.raise_error;
2562: else
2563: close csr_person_deployment;
2564: --
2565: hr_utility.set_location(l_proc,20);
2566: --
2567: end if;
2568: --
2569: if l_dpl_rec.status = 'DRAFT' then
2589: l_leaving_reason := p_leaving_reason;
2590: l_leaving_person_type_id := p_leaving_person_type_id;
2591: --
2592: if nvl(l_end_date_in,hr_api.g_date) = hr_api.g_date then
2593: hr_utility.set_location(l_proc,30);
2594: l_end_date_in := l_dpl_rec.end_date;
2595: end if;
2596: --
2597: if nvl(l_leaving_reason,hr_api.g_varchar2) = hr_api.g_varchar2 then
2594: l_end_date_in := l_dpl_rec.end_date;
2595: end if;
2596: --
2597: if nvl(l_leaving_reason,hr_api.g_varchar2) = hr_api.g_varchar2 then
2598: hr_utility.set_location(l_proc,40);
2599: l_leaving_reason := l_dpl_rec.leaving_reason;
2600: end if;
2601: --
2602: if nvl(l_leaving_person_type_id,hr_api.g_number) = hr_api.g_number then
2599: l_leaving_reason := l_dpl_rec.leaving_reason;
2600: end if;
2601: --
2602: if nvl(l_leaving_person_type_id,hr_api.g_number) = hr_api.g_number then
2603: hr_utility.set_location(l_proc,50);
2604: l_leaving_person_type_id := l_dpl_rec.leaving_person_type_id;
2605: end if;
2606:
2607: hr_person_deployment_api.update_person_deployment
2621: open csr_host_pds(l_dpl_rec.to_person_id);
2622: fetch csr_host_pds into l_host_pds_id,l_host_pds_ovn;
2623: close csr_host_pds;
2624: --
2625: hr_utility.set_location(l_proc,60);
2626: --
2627: hr_ex_employee_api.actual_termination_emp
2628: (p_validate => p_validate
2629: ,p_effective_date => l_end_date_in
2651: -- Reactivate the suspended home assignments
2652: --
2653: for l_asg_rec in csr_susp_home_asgs(l_dpl_rec.from_person_id) loop
2654: --
2655: hr_utility.set_location(l_proc,70);
2656: hr_utility.set_location('assignment_id '||l_asg_rec.assignment_id,71);
2657: --
2658: hr_assignment_api.activate_emp_asg
2659: (p_validate => p_validate
2652: --
2653: for l_asg_rec in csr_susp_home_asgs(l_dpl_rec.from_person_id) loop
2654: --
2655: hr_utility.set_location(l_proc,70);
2656: hr_utility.set_location('assignment_id '||l_asg_rec.assignment_id,71);
2657: --
2658: hr_assignment_api.activate_emp_asg
2659: (p_validate => p_validate
2660: ,p_effective_date => l_end_date_in+1
2669: end loop;
2670: --
2671: -- update the proposal with the new details to keep it up to date
2672: --
2673: hr_utility.set_location(l_proc,80);
2674: --
2675:
2676: --
2677: -- When in validation only mode raise the Validate_Enabled exception
2681: end if;
2682: --
2683: -- Set all IN OUT and OUT parameters with out values
2684: --
2685: hr_utility.set_location(' Leaving:'||l_proc, 700);
2686: exception
2687: when hr_api.validate_enabled then
2688: --
2689: -- As the Validate_Enabled exception has been raised
2695: -- (Any key or derived arguments must be set to null
2696: -- when validation only mode is being used.)
2697: --
2698: p_object_version_number := l_object_version_number;
2699: hr_utility.set_location(' Leaving:'||l_proc, 800);
2700: when others then
2701: --
2702: -- A validation or unexpected error has occured
2703: --
2706: -- Reset IN OUT parameters and set all
2707: -- OUT parameters, including warnings, to null
2708: --
2709: p_object_version_number := l_object_version_number;
2710: hr_utility.set_location(' Leaving:'||l_proc, 900);
2711: raise;
2712: end return_from_deployment;
2713: --
2714: end HR_PERSON_DEPLOYMENT_API;