1: PACKAGE BODY hr_person AS
2: /* $Header: peperson.pkb 120.5.12010000.2 2008/08/06 09:27:37 ubhat ship $ */
3: --
4: g_debug boolean := hr_utility.debug_enabled;
5:
319: --
320: begin
321: --
322: --
323: hr_utility.set_location('hr_person.generate_number',1);
324: --
325: if p_current_applicant = 'Y' then
326: --
327: if g_debug then
392: exception
393: when others then p_applicant_number := NULL;
394: end;
395: if g_debug then
396: hr_utility.set_location('hr_person.generate_number',15);
397: end if;
398: apl_number_sv := p_applicant_number;
399: end if;
400: -- <<
429: -- WHERE rowid = l_rowid ;
430: -- ------------------------------------------------------------+
431:
432: if g_debug then
433: hr_utility.set_location('hr_person.generate_number',20);
434: end if;
435: apl_number_sv := p_applicant_number;
436:
437: end if;
462: end if;
463: if p_current_employee = 'Y' then
464: --
465: if g_debug then
466: hr_utility.set_location('hr_person.generate_number',4);
467: end if;
468: SELECT pbg.method_of_generation_emp_num
469: , pbg.legislation_code
470: INTO l_method_of_generation
473: WHERE pbg.business_group_id = p_business_group_id;
474: --
475: if l_method_of_generation = 'A' then
476: if g_debug then
477: hr_utility.set_location('hr_person.generate_number',5);
478: end if;
479: if p_employee_number is NOT NULL then
480: begin
481: select person_id
557: -- WHERE rowid = l_rowid ;
558: -- ------------------------------------------------------------+
559:
560: if g_debug then
561: hr_utility.set_location('hr_person.generate_number',6);
562: end if;
563: emp_number_sv := p_employee_number;
564:
565: end if;
590: end if;
591: if p_current_npw = 'Y' then
592: --
593: if g_debug then
594: hr_utility.set_location('hr_person.generate_number',10);
595: end if;
596: SELECT pbg.method_of_generation_cwk_num
597: , pbg.method_of_generation_emp_num
598: , pbg.legislation_code
605: if l_method_of_generation = 'A'
606: or (l_method_of_generation = 'E' and
607: l_method_of_gen_emp = 'A') then
608: if g_debug then
609: hr_utility.set_location('hr_person.generate_number',15);
610: end if;
611: if p_npw_number is NOT NULL then
612: begin
613: select person_id
634:
635: -- Second check
636: if p_npw_number is NOT NULL then
637: if g_debug then
638: hr_utility.set_location('hr_person.generate_number',20);
639: end if;
640: begin
641: select null
642: into p_npw_number
654: end if;
655:
656: if p_npw_number IS NULL then
657: if g_debug then
658: hr_utility.set_location('hr_person.generate_number',25);
659: end if;
660:
661: if l_method_of_generation = 'A' then
662: --
662: --
663: -- Automatic numbering so use the CWK number type.
664: --
665: if g_debug then
666: hr_utility.set_location('hr_person.generate_number',27);
667: end if;
668: -- -> #2660279: NEW code
669: Get_Person_Number(p_person_type => 'CWK'
670: ,p_person_number => p_npw_number
700: -- Use the next employee number sequence instead of the
701: -- CWK type.
702: --
703: if g_debug then
704: hr_utility.set_location('hr_person.generate_number',28);
705: end if;
706: -- -> #2660279: NEW code
707: Get_Person_Number(p_person_type => 'EMP'
708: ,p_person_number => p_npw_number
734:
735: end if;
736:
737: if g_debug then
738: hr_utility.set_location('hr_person.generate_number',29);
739: end if;
740: npw_number_sv := p_npw_number;
741:
742: end if;
750: and p_npw_number <> p_national_identifier)
751: )
752: then
753: if g_debug then
754: hr_utility.set_location('hr_person.generate_number',30);
755: end if;
756: if p_national_identifier is null then
757: if l_legislation_code = 'US' then
758: hr_utility.set_message(801,'HR_7580_ALL_MAN_SOL_FIELD');
767: or (l_method_of_generation = 'E' and
768: l_method_of_gen_emp = 'M'))
769: and p_npw_number IS NULL then
770: if g_debug then
771: hr_utility.set_location('hr_person.generate_number',35);
772: end if;
773: -- Changed the application id form 801 to 800 for fix of #3295346
774: hr_utility.set_message(800,'HR_289692_ALL_MAN_CWK');
775: hr_utility.raise_error;
917: p_duplicate_flag:='N';
918: --
919:
920: if g_debug then
921: hr_utility.set_location('hr_person.derive_full_name',1);
922: end if;
923:
924: if p_title IS NOT NULL and
925: fnd_profile.value('PER_USE_TITLE_IN_FULL_NAME') = 'Y' then
937: --
938: -- Note this is only a select because PL/SQL can't cope with DECODEs
939: --
940: if g_debug then
941: hr_utility.set_location('hr_person.derive_full_name',2);
942: end if;
943: SELECT rtrim(substrb(DECODE(p_pre_name_adjunct,'','',p_pre_name_adjunct||' ')||
944: p_last_name||','||DECODE(l_title_meaning,'','',
945: ' '||l_title_meaning)||DECODE(p_first_name,'','',
955: --
956: p_full_name := rtrim(l_full_name);
957: --
958: if g_debug then
959: hr_utility.set_location('hr_person.derive_full_name',4);
960: end if;
961: open csr_leg_cod;
962: fetch csr_leg_cod into l_leg_code;
963: if csr_leg_cod%found then
1127: if fnd_profile.value('HR_CROSS_BUSINESS_GROUP') = 'N' then
1128: begin
1129: --
1130: if g_debug then
1131: hr_utility.set_location('hr_person.derive_full_name',3);
1132: end if;
1133: SELECT 'Y'
1134: INTO l_status
1135: FROM sys.dual
1153: AND p_person_id <> pp.person_id)
1154: OR p_person_id IS NULL)
1155: AND pp.business_group_id +0 = p_business_group_id);
1156: --
1157: hr_utility.set_message(801,'HR_PERSON_DUPLICATE');
1158:
1159: raise local_warning;
1160:
1161: --
1223: p_per_information29 VARCHAR2 DEFAULT NULL,
1224: p_per_information30 VARCHAR2 DEFAULT NULL) is
1225: l_pre_name_adjunct VARCHAR2(30);
1226: begin
1227: hr_person.derive_full_name(
1228: p_first_name =>p_first_name
1229: ,p_middle_names =>p_middle_names
1230: ,p_last_name =>p_last_name
1231: ,p_known_as =>p_known_as
1312: p_per_information30 VARCHAR2 DEFAULT NULL) is
1313: l_suffix VARCHAR2(30);
1314: l_pre_name_adjunct VARCHAR2(30);
1315: begin
1316: hr_person.derive_full_name(
1317: p_first_name =>p_first_name
1318: ,p_middle_names =>p_middle_names
1319: ,p_last_name =>p_last_name
1320: ,p_known_as =>p_known_as
1373: local_warning exception;
1374: --
1375: begin
1376: if g_debug then
1377: hr_utility.set_location('hr_person.validate_national_identifier',1);
1378: end if;
1379: SELECT org_information9
1380: INTO l_legislation_code
1381: FROM hr_organization_information
1449: begin
1450: --
1451: --
1452: if g_debug then
1453: hr_utility.set_location('hr_person.validate_national_identifier',1);
1454: end if;
1455: SELECT org_information9
1456: INTO l_legislation_code
1457: FROM hr_organization_information
1535: begin
1536: --
1537: --
1538: if g_debug then
1539: hr_utility.set_location('hr_person.validate_dob',1);
1540: end if;
1541: if p_date_of_birth > p_start_date
1542: then
1543: hr_utility.set_message(801,'HR_6523_PERSON_DOB_GT_START');
1557: begin
1558: --
1559: --
1560: if g_debug then
1561: hr_utility.set_location('hr_person.validate_sex_and_title',1);
1562: end if;
1563: if p_current_employee = 'Y' then
1564: if p_sex IS NULL then
1565: hr_utility.set_message(801,'HR_6524_EMP_MANDATORY_SEX');
1567: end if;
1568: end if;
1569: --
1570: if g_debug then
1571: hr_utility.set_location('hr_person.validate_sex_and_title',2);
1572: end if;
1573: if p_sex IS NULL then
1574: hr_utility.set_message(801,'PAY_6361_USER_TABLE_UNIQUE');
1575: raise local_warning;
1612: begin
1613: --
1614: --
1615: if g_debug then
1616: hr_utility.set_location('hr_person.validate_unique_number',1);
1617: end if;
1618: if p_current_applicant = 'Y' then
1619: if p_applicant_number IS NULL then
1620: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1623: hr_utility.raise_error;
1624: end if;
1625: --
1626: if g_debug then
1627: hr_utility.set_location('hr_person.validate_unique_number',2);
1628: end if;
1629: -- #2660279:
1630: -- --> delete this code
1631: -- SELECT 'Y'
1653: --
1654: end if;
1655: --
1656: if g_debug then
1657: hr_utility.set_location('hr_person.validate_unique_number',3);
1658: end if;
1659: if p_current_employee = 'Y' then
1660: if p_employee_number IS NULL then
1661: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1664: hr_utility.raise_error;
1665: end if;
1666: --
1667: if g_debug then
1668: hr_utility.set_location('hr_person.validate_unique_number',4);
1669: end if;
1670: -- #2660279: >> New code
1671: if is_unique_person_number(p_person_id => p_person_id
1672: ,p_person_type => 'EMP'
1699: --
1700: -- << end 2660279
1701: end if;
1702: if g_debug then
1703: hr_utility.set_location('hr_person.validate_unique_number',5);
1704: end if;
1705: -- +---------------------------------------------------------------------+
1706: -- Processing contingent workers
1707: -- +---------------------------------------------------------------------+
1713: hr_utility.raise_error;
1714: end if;
1715: --
1716: if g_debug then
1717: hr_utility.set_location('hr_person.validate_unique_number',6);
1718: end if;
1719: -- #2660279:
1720: -- >> delete code
1721: -- SELECT 'Y'
1769: IS
1770: --
1771: BEGIN
1772: --
1773: -- Fix for bug 3908271. replace hr_person_delete with hr_person_internal.
1774: --
1775: hr_person_internal.product_installed(p_application_short_name,
1776: p_status,
1777: p_yes_no,
1771: BEGIN
1772: --
1773: -- Fix for bug 3908271. replace hr_person_delete with hr_person_internal.
1774: --
1775: hr_person_internal.product_installed(p_application_short_name,
1776: p_status,
1777: p_yes_no,
1778: p_oracle_username);
1779:
1796: IS
1797: --
1798: BEGIN
1799: --
1800: -- Fix for bug 3908271. replace hr_person_delete with hr_person_internal.
1801: --
1802: hr_person_internal.weak_predel_validation(p_person_id,
1803: p_session_date);
1804: END weak_predel_validation;
1798: BEGIN
1799: --
1800: -- Fix for bug 3908271. replace hr_person_delete with hr_person_internal.
1801: --
1802: hr_person_internal.weak_predel_validation(p_person_id,
1803: p_session_date);
1804: END weak_predel_validation;
1805: -------------------- END: weak_predel_validation --------------------------
1806: --
1833: --
1834: --
1835: BEGIN
1836: --
1837: -- Fix for bug 3908271. replace hr_person_delete with hr_person_internal.
1838: --
1839: hr_person_internal.strong_predel_validation(p_person_id,
1840: p_session_date);
1841: END strong_predel_validation;
1835: BEGIN
1836: --
1837: -- Fix for bug 3908271. replace hr_person_delete with hr_person_internal.
1838: --
1839: hr_person_internal.strong_predel_validation(p_person_id,
1840: p_session_date);
1841: END strong_predel_validation;
1842: -------------------- END: strong_predel_validation -----------------------
1843: --
1866: IS
1867: --
1868: BEGIN
1869: --
1870: -- Fix for bug 3908271. replace hr_person_delete with hr_person_internal.
1871: --
1872: hr_person_internal.check_contact(p_person_id,
1873: p_contact_person_id,
1874: p_contact_relationship_id,
1868: BEGIN
1869: --
1870: -- Fix for bug 3908271. replace hr_person_delete with hr_person_internal.
1871: --
1872: hr_person_internal.check_contact(p_person_id,
1873: p_contact_person_id,
1874: p_contact_relationship_id,
1875: p_session_date);
1876: END check_contact;
1899: IS
1900: --
1901: BEGIN
1902: --
1903: -- Fix for bug 3908271. replace hr_person_delete with hr_person_internal.
1904: --
1905: hr_person_internal.delete_person(p_person_id,
1906: -- p_form_call,
1907: p_session_date);
1901: BEGIN
1902: --
1903: -- Fix for bug 3908271. replace hr_person_delete with hr_person_internal.
1904: --
1905: hr_person_internal.delete_person(p_person_id,
1906: -- p_form_call,
1907: p_session_date);
1908: END delete_a_person;
1909: -------------------- END: delete_a_person ----------------------------------
1930: --
1931: --
1932: BEGIN
1933: --
1934: -- Fix for bug 3908271. replace hr_person_delete with hr_person_internal.
1935: --
1936: hr_person_internal.people_default_deletes(p_person_id);
1937: -- p_form_call);
1938: --
1932: BEGIN
1933: --
1934: -- Fix for bug 3908271. replace hr_person_delete with hr_person_internal.
1935: --
1936: hr_person_internal.people_default_deletes(p_person_id);
1937: -- p_form_call);
1938: --
1939: END people_default_deletes;
1940: -------------------- END: people_default_deletes --------------------------
1959: --
1960: --
1961: BEGIN
1962: --
1963: -- Fix for bug 3908271. replace hr_person_delete with hr_person_internal.
1964: --
1965: hr_person_internal.applicant_default_deletes(p_person_id);
1966: -- p_form_call);
1967: END applicant_default_deletes;
1961: BEGIN
1962: --
1963: -- Fix for bug 3908271. replace hr_person_delete with hr_person_internal.
1964: --
1965: hr_person_internal.applicant_default_deletes(p_person_id);
1966: -- p_form_call);
1967: END applicant_default_deletes;
1968: -------------------- END: applicant_default_deletes -----------------------
1969: --
2006: --
2007: BEGIN
2008: --
2009: if g_debug then
2010: hr_utility.set_location('hr_person.chk_future_person_type',1);
2011: end if;
2012: --
2013: --
2014: select 'Y'
2077: --
2078: BEGIN
2079: --
2080: if g_debug then
2081: hr_utility.set_location('hr_person.chk_prev_person_type',1);
2082: hr_utility.set_location('p_system_person_type= '||p_system_person_type,10);
2083: hr_utility.set_location('p_person_id= '||p_person_id,20);
2084: hr_utility.set_location('p_business_group_id= '||p_business_group_id,30);
2085: hr_utility.set_location('p_effective_start_date= '||p_effective_start_date,40);
2182: l_primary_flag VARCHAR2(1) :='Y';
2183: --
2184: begin
2185: if g_debug then
2186: hr_utility.set_location('hr_person.validate_address',1);
2187: end if;
2188: --
2189: --
2190: select 'Error : Primary address exists'
2223: end if;
2224: end validate_address;
2225: ------------------------- END: validate_address --------------------
2226:
2227: end hr_person;
2228: