1 package body PER_ES_CREATE_APPLICANT as
2 /* $Header: peesappp.pkb 120.2 2006/09/14 09:43:00 mgettins noship $ */
3 g_package VARCHAR2(30) := 'PER_ES_CREATE_APPLICANT.';
4 -- p_first_last_name p_last_name
5 -- p_identifier_type p_per_information2
6 -- p_identifier_value p_per_information3
7
8 PROCEDURE create_es_applicant (p_last_name VARCHAR2
9 ,p_first_name VARCHAR2
10 ,p_national_identifier VARCHAR2
11 ,p_per_information1 VARCHAR2
12 ,p_per_information2 VARCHAR2
13 ,p_per_information3 VARCHAR2
14 ) is
15
16 CURSOR get_lookup_type(p_per_information2 varchar2) is
17 SELECT lookup_code
18 FROM hr_lookups
19 WHERE lookup_type='ES_IDENTIFIER_TYPE'
20 AND lookup_code=p_per_information2;
21
22
23 l_identifier_type hr_lookups.lookup_code%TYPE;
24 l_identifier_value VARCHAR2(10);
25 l_proc VARCHAR2(72) := g_package||'CREATE_ES_APPLICANT';
26 l_national_identifier per_all_people_f.national_identifier%TYPE;
27 BEGIN
28 --
29 -- Added for GSI Bug 5472781
30 --
31 IF hr_utility.chk_product_install('Oracle Human Resources', 'ES') THEN
32 --
33 hr_api.mandatory_arg_error
34 (p_api_name => l_proc,
35 p_argument => hr_general.decode_lookup('ES_FORM_LABELS','LAST_NAME_1'),
36 p_argument_value => p_last_name
37 );
38
39 IF p_per_information3 IS NOT NULL AND
40 p_per_information2 IS NULL THEN
41 hr_utility.set_message(800,'HR_ES_INVALID_VALUE');
42 hr_utility.set_message_token(800,'FIELD',hr_general.decode_lookup('ES_FORM_LABELS','IDENTIFIER_TYPE'));
43 hr_utility.raise_error;
44 ELSIF p_per_information2 IS NOT NULL AND
45 p_per_information3 IS NULL THEN
46 OPEN get_lookup_type(p_per_information2);
47 FETCH get_lookup_type into l_identifier_type;
48 IF get_lookup_type%NOTFOUND THEN
49 hr_utility.set_message(800,'HR_ES_INVALID_VALUE');
50 hr_utility.set_message_token(800,'FIELD',hr_general.decode_lookup('ES_FORM_LABELS','IDENTIFIER_TYPE'));
51 hr_utility.raise_error;
52 END IF;
53 CLOSE get_lookup_type;
54 hr_utility.set_message(800,'HR_ES_INVALID_VALUE');
55 hr_utility.set_message_token(800,'FIELD',hr_general.decode_lookup('ES_IDENTIFIER_TYPE',p_per_information2));
56 hr_utility.raise_error;
57 END IF;
58 --
59 /*IF p_national_identifier IS NULL THEN
60 IF p_per_information3 IS NULL THEN
61 hr_utility.set_message(800, 'HR_ES_REQ_NIF_IDT_MISSING');
62 hr_utility.raise_error;
63 END IF;
64 ELSE
65 l_national_identifier := hr_es_utility.check_NIF(p_national_identifier);
66 END IF;*/
67
68 IF p_per_information2 IS NOT NULL THEN
69 OPEN get_lookup_type(p_per_information2);
70 FETCH get_lookup_type into l_identifier_type;
71 IF get_lookup_type%NOTFOUND THEN
72 hr_utility.set_message(800,'HR_ES_INVALID_VALUE');
73 hr_utility.set_message_token(800,'FIELD',hr_general.decode_lookup('ES_FORM_LABELS','IDENTIFIER_TYPE'));
74 hr_utility.raise_error;
75 ELSIF FND_PROFILE.VALUE('PER_NATIONAL_IDENTIFIER_VALIDATION') <> 'NONE' THEN --Bug No 4718049
76 l_identifier_value := hr_es_utility.validate_identifier(p_per_information2,p_per_information3);
77 END IF;
78 CLOSE get_lookup_type;
79 END IF;
80
81 IF FND_PROFILE.VALUE('PER_NATIONAL_IDENTIFIER_VALIDATION') <> 'NONE' AND --Bug No 4718049
82 p_per_information2 IS NOT NULL and p_per_information3 IS NOT NULL THEN--and p_national_identifier is not null THEN
83 OPEN get_lookup_type(p_per_information2);
84 FETCH get_lookup_type into l_identifier_type;
85 if l_identifier_type='DNI' then
86 If substr(p_national_identifier,1,8) <> p_per_information3 then
87 hr_utility.set_message(800,'HR_ES_INVALID_DNI_NIF');
88 hr_utility.raise_error;
89 end if;
90 end if;
91 CLOSE get_lookup_type;
92 end if;
93
94 IF length(p_last_name)>40 THEN
95 hr_utility.set_message(800, 'HR_289712_UTF8_LENGTH_EXCEEDED');
96 hr_utility.set_message_token('COLUMN_NAME',hr_general.decode_lookup('ES_FORM_LABELS','LAST_NAME_1'));
97 hr_utility.set_message_token('COLUMN_VALUE',p_last_name);
98 hr_utility.set_message_token('MAX_LENGTH','40');
99 hr_utility.raise_error;
100 END IF;
101
102 IF length(p_first_name)>40 THEN
103 hr_utility.set_message(800, 'HR_289712_UTF8_LENGTH_EXCEEDED');
104 hr_utility.set_message_token('COLUMN_NAME',hr_general.decode_lookup('ES_FORM_LABELS','NAME'));
105 hr_utility.set_message_token('COLUMN_VALUE',p_first_name);
106 hr_utility.set_message_token('MAX_LENGTH','40');
107 hr_utility.raise_error;
108 END IF;
109
110 IF length(p_per_information1)>40 THEN
111 hr_utility.set_message(800, 'HR_289712_UTF8_LENGTH_EXCEEDED');
112 hr_utility.set_message_token('COLUMN_NAME',hr_general.decode_lookup('ES_FORM_LABELS','LAST_NAME_2'));
113 hr_utility.set_message_token('COLUMN_VALUE',p_per_information1);
114 hr_utility.set_message_token('MAX_LENGTH','40');
115 hr_utility.raise_error;
116 END IF;
117 --
118 END IF;
119 --
120 END create_es_applicant;
121
122 END PER_ES_CREATE_APPLICANT;