1 package body PER_PL_CREATE_PERSON as
2 /* $Header: peplconp.pkb 120.6.12010000.1 2008/07/28 05:19:39 appldev ship $ */
3 g_package VARCHAR2(30);
4
5 /*** Flexfield Segments Used ****/
6 /* p_per_information1 : NIP
7 p_per_information2 : Insured by Employee
8 p_per_information3 : Inheritor
9 p_per_information4 : Oldage Pension Rights
10 p_per_information5 : National Fund of Health
11 p_per_information6 : Tax office
12 p_per_information7 : Legal Employer
13 p_per_information8 : Citizenship.
14
15 */
16
17 PROCEDURE create_pl_person(p_last_name VARCHAR2
18 ,p_first_name VARCHAR2
19 ,p_date_of_birth DATE
20 ,p_marital_status VARCHAR2
21 ,p_nationality VARCHAR2
22 ,p_national_identifier VARCHAR2
23 ,p_business_group_id NUMBER
24 ,p_sex VARCHAR2
25 ,p_person_type_id NUMBER
26 ,p_per_information1 VARCHAR2
27 ,p_per_information2 VARCHAR2
28 ,p_per_information3 VARCHAR2
29 ,p_per_information4 VARCHAR2
30 ,p_per_information5 VARCHAR2
31 ,p_per_information6 VARCHAR2
32 ,p_per_information7 VARCHAR2
33 ,p_per_information8 VARCHAR2) IS
34
35 l_proc VARCHAR2(72);
36 l_package VARCHAR2(30);
37 l_person_type_key per_person_types.seeded_person_type_key%TYPE;
38 l_system_type per_person_types.system_person_type%TYPE;
39 l_var varchar2(1);
40 cursor csr_contact_per is
41 select 'Y' from per_person_types ppt
42 where ppt.seeded_person_type_key = l_person_type_key and ppt.system_person_type = l_system_type
43 and ppt.business_group_id = p_business_group_id
44 and ppt.person_type_id = p_person_type_id;
45
46
47 BEGIN
48 g_package := 'PER_PL_CREATE_PERSON.';
49 l_proc := g_package||'CREATE_PL_PERSON';
50 /* Added for GSI Bug 5472781 */
51 IF NOT hr_utility.chk_product_install('Oracle Human Resources', 'PL') THEN
52 hr_utility.set_location('Leaving : '||l_proc,10);
53 return;
54 END IF;
55 l_person_type_key := 'CONTACT';
56 l_system_type := 'OTHER';
57 l_var := NULL;
58
59
60 hr_api.mandatory_arg_error
61 (p_api_name => l_proc,
62 p_argument => hr_general.decode_lookup('PL_FORM_LABELS','LAST'),
63 p_argument_value => p_last_name
64 );
65
66
67
68 open csr_contact_per;
69 fetch csr_contact_per into l_var;
70 close csr_contact_per;
71
72 if l_var = 'Y' then
73
74 /********************Person is of type contact **************************/
75
76 if p_per_information3 = 'Y' or p_per_information2 = 'Y' then
77
78 --Insured by is yes or Inheritor is yes.Citizenship and First Name are required.
79 -- Bug 4567534 : Replaced hr_api.mandatory_arg_error with an error message.
80 if p_first_name is NULL then
81 hr_utility.set_message(800,'HR_375873_FIRST_NAME_REQD');
82 hr_utility.raise_error;
83 end if;
84
85 hr_api.mandatory_arg_error
86 (p_api_name => l_proc,
87 p_argument => hr_general.decode_lookup('PL_FORM_LABELS','CITIZENSHIP'),
88 p_argument_value => p_per_information8
89 );
90
91
92 /* After NIP/PESEL enhancement ,If Inheritor is Yes ,
93 Nationality and Citizenship are both Polish then NIP is mandatory */
94 /* Commented by nprasath for Bug 6272487
95 If p_per_information3='Y' and p_per_information8='PL' and p_nationality='PQH_PL' then
96
97 -- Bug 4567534 : Replaced hr_api.mandatory_arg_error with an error message
98 if p_per_information1 is NULL then
99 hr_utility.set_message(800,'HR_375874_NIP_REQD');
100 hr_utility.raise_error;
101 end if;
102
103 End if; -- End if of Inherited by employee in 'Yes' and nationality and citizenship are Polish
104 */
105
106 IF p_per_information2 = 'Y' then
107 hr_api.mandatory_arg_error
108 (p_api_name => l_proc,
109 p_argument => hr_general.decode_lookup('PL_FORM_LABELS','BIRTH'),
110 p_argument_value => p_date_of_birth
111 );
112 --If Insured by is yes and nationality and citizenship are both polish ,
113 --either of NIP or PESEL needs to be entered.
114
115 IF p_nationality = 'PQH_PL' and p_per_information8='PL' and p_per_information1||p_national_identifier is null then
116 hr_utility.set_message(800,'HR_375878_NIP_OR_PESEL');
117 hr_utility.raise_error;
118 END IF; -- End if of Nationality in Polish,Insured by is Yes,nationality and citizenship are POLISH
119
120 END IF; -- End if of Insured by Employee in 'Yes'
121 END IF;--per_information2 or per_information3 is yes?
122 END IF; --l_var = 'Y'
123 /********************************** End if of Person Type in Contact***********************/
124
125 if p_national_identifier is not NULL then
126 hr_pl_utility.per_pl_validate(p_national_identifier);
127 if p_per_information7 is not null then
128 hr_pl_utility.per_pl_check_ni_unique(p_national_identifier,0,p_business_group_id,p_per_information7);
129 end if;
130 end if;
131
132 if p_per_information1 is not null then
133 hr_pl_utility.per_pl_nip_validate(p_per_information1,0,p_business_group_id,p_per_information7,p_nationality,p_per_information8
134 );
135 end if;
136
137
138 END create_pl_person;
139
140 END PER_PL_CREATE_PERSON;