1 PACKAGE BODY PER_MX_VALIDATE_ID AS
2 /* $Header: pemxvlid.pkb 120.1.12010000.1 2008/07/28 05:01:16 appldev ship $ */
3 /*
4 ******************************************************************
5 * *
6 * Copyright (C) 1993 Oracle Corporation. *
7 * All rights reserved. *
8 * *
9 * This material has been provided pursuant to an agreement *
10 * containing restrictions on its use. The material is also *
11 * protected by copyright law. No part of this material may *
12 * be copied or distributed, transmitted or transcribed, in *
13 * any form or by any means, electronic, mechanical, magnetic, *
14 * manual, or otherwise, or disclosed to third parties without *
15 * the express written permission of Oracle Corporation, *
16 * 500 Oracle Parkway, Redwood City, CA, 94065. *
17 * *
18 ******************************************************************
19
20 Name : PER_MX_VALIDATE_ID
21
22 Description : This package is a hook call for following APIs :-
23 1. create_applicant
24 2. hire_applicant
25
26 Change List
27 -----------
28 Date Name Vers Bug No Description
29 ----------- ---------- ------ ------- ------------------------------------
30 21-JUN-2004 sdahiya 115.0 Created.
31 21-JUL-2004 sdahiya 115.1 3777663 Added code to avoid validation of
32 various identifiers if they are
33 equal to hr_api.g_varchar2.
34 30-JUL-2004 ardsouza 115.2 3804076 Added procedure COMPARE_ID to
35 handle cases where IDs are entered
36 without format mask.
37 02-AUG-2004 sdahiya 115.3 3804076 Procedure COMPARE_ID should not
38 compare identifiers for
39 format validations if both are null.
40 16-MAR-2005 ardsouza 115.4 4147647 Commented out calls to
41 hr_general2.init_fndload(800).
42 10-MAY-2006 vpandya 115.5 5176823 Changed compare_id:
43 Removed appl id from mesg token.
44 *****************************************************************************/
45
46 /*******************************************************************************
47 Name : compare_id
48 Purpose : This procedure compares the 2 ID values and raises an error if
49 there's a mismatch
50 *******************************************************************************/
51
52 PROCEDURE compare_id(
53 p_value1 per_all_people_f.per_information1%TYPE,
54 p_value2 per_all_people_f.per_information1%TYPE,
55 p_message fnd_new_messages.message_name%TYPE) AS
56
57 BEGIN
58 --
59 IF fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION') <> 'NONE' AND
60 fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION') <> 'WARN' THEN
61
62 IF p_value1 = p_value2 OR NVL(p_value1, p_value2) IS NULL THEN
63 null;
64 ELSE
65 hr_utility.set_message(800, p_message);
66 hr_utility.set_message_token('ACTION',
67 hr_general.decode_lookup('MX_ACTION_TOKEN', 'ERROR'));
68 hr_utility.raise_error;
69 END IF;
70 END IF;
71 --
72 END compare_id;
73
74
75 /*******************************************************************************
76 Name : validate_rfc_id
77 Purpose : This procedure acts as wrapper for per_mx_validations.check_rfc.
78 *******************************************************************************/
79
80 PROCEDURE VALIDATE_RFC_ID(
81 p_per_information2 per_all_people_f.per_information2%type,
82 p_person_id per_all_people_f.person_id%type) AS
83
84 p_warning varchar2(1);
85 p_valid_rfc_id per_all_people_f.per_information2%type;
86 l_proc_name varchar2(100);
87
88 BEGIN
89 l_proc_name := glb_proc_name ||'VALIDATE_RFC_ID';
90 hr_utility.trace('Entering '||l_proc_name);
91 -- hr_general2.init_fndload(800); -- Bug 4147647
92 IF NOT hr_utility.chk_product_install('Oracle Human Resources', 'MX') THEN
93 hr_utility.trace('Mexico legislation not installed. Not performing validation checks.');
94 RETURN;
95 END IF;
96
97 IF p_per_information2 = hr_api.g_varchar2 THEN /* Bug 3777663 */
98 hr_utility.trace('RFC ID not available for validation.');
99 RETURN;
100 END IF;
101
102 per_mx_validations.check_rfc (p_per_information2,
103 p_person_id,
104 HR_MX_UTILITY.GET_BG_FROM_PERSON(p_person_id),
105 p_warning,
106 p_valid_rfc_id);
107
108 compare_id(p_per_information2, p_valid_rfc_id, 'HR_MX_INVALID_RFC');
109
110 hr_utility.trace('Leaving '||l_proc_name);
111 END VALIDATE_RFC_ID;
112
113 /*******************************************************************************
114 Name : validate_ss_id
115 Purpose : This procedure acts as wrapper for per_mx_validations.check_ss
116 *******************************************************************************/
117
118 PROCEDURE VALIDATE_SS_ID(
119 p_per_information3 per_all_people_f.per_information3%type,
120 p_person_id per_all_people_f.person_id%type) AS
121
122 p_warning varchar2(1);
123 p_valid_ss per_all_people_f.per_information3%type;
124 l_proc_name varchar2(100);
125
126 BEGIN
127 l_proc_name := glb_proc_name ||'VALIDATE_SS_ID';
128 hr_utility.trace('Entering '||l_proc_name);
129 IF NOT hr_utility.chk_product_install('Oracle Human Resources', 'MX') THEN
130 hr_utility.trace('Mexico legislation not installed. Not performing validation checks.');
131 RETURN;
132 END IF;
133
134 IF p_per_information3 = hr_api.g_varchar2 THEN /* Bug 3777663 */
135 hr_utility.trace('Social Security ID not available for validation.');
136 RETURN;
137 END IF;
138
139 -- hr_general2.init_fndload(800); -- Bug 4147647
140 per_mx_validations.check_ss (p_per_information3,
141 p_person_id,
142 HR_MX_UTILITY.GET_BG_FROM_PERSON(p_person_id),
143 p_warning,
144 p_valid_ss);
145
146 compare_id(p_per_information3, p_valid_ss, 'HR_MX_INVALID_SS');
147
148 hr_utility.trace('Leaving '||l_proc_name);
149 END VALIDATE_SS_ID;
150
151
152 /*******************************************************************************
153 Name : validate_fga_id
154 Purpose : This procedure acts as wrapper for per_mx_validations.check_fga
155 *******************************************************************************/
156
157 PROCEDURE VALIDATE_FGA_ID(
158 p_per_information5 per_all_people_f.per_information5%type,
159 p_person_id per_all_people_f.person_id%type) AS
160
161 p_warning varchar2(1);
162 l_proc_name varchar2(100);
163
164 BEGIN
165 l_proc_name := glb_proc_name ||'VALIDATE_FGA_ID';
166 hr_utility.trace('Entering '||l_proc_name);
167 -- hr_general2.init_fndload(800); -- Bug 4147647
168 IF NOT hr_utility.chk_product_install('Oracle Human Resources', 'MX') THEN
169 hr_utility.trace('Mexico legislation not installed. Not performing validation checks.');
170 RETURN;
171 END IF;
172
173 IF p_per_information5 = hr_api.g_varchar2 THEN /* Bug 3777663 */
174 hr_utility.trace('Federal Government Affiliation ID not available for validation.');
175 RETURN;
176 END IF;
177
178 per_mx_validations.check_fga (p_per_information5,
179 p_person_id,
180 HR_MX_UTILITY.GET_BG_FROM_PERSON(p_person_id),
181 p_warning);
182 hr_utility.trace('Leaving '||l_proc_name);
183 END VALIDATE_FGA_ID;
184
185
186 /*******************************************************************************
187 Name : validate_ms_id
188 Purpose : This procedure acts as wrapper for per_mx_validations.check_ms
189 *******************************************************************************/
190
191 PROCEDURE VALIDATE_MS_ID(
192 p_per_information6 per_all_people_f.per_information6%type,
193 p_person_id per_all_people_f.person_id%type) AS
194
195 p_warning varchar2(1);
196 l_proc_name varchar2(100);
197
198 BEGIN
199 l_proc_name := glb_proc_name ||'VALIDATE_MS_ID';
200 hr_utility.trace('Entering '||l_proc_name);
201 -- hr_general2.init_fndload(800); -- Bug 4147647
202 IF NOT hr_utility.chk_product_install('Oracle Human Resources', 'MX') THEN
203 hr_utility.trace('Mexico legislation not installed. Not performing validation checks.');
204 RETURN;
205 END IF;
206
207 IF p_per_information6 = hr_api.g_varchar2 THEN /* Bug 3777663 */
208 hr_utility.trace('Military Service ID not available for validation.');
209 RETURN;
210 END IF;
211
212 per_mx_validations.check_ms (p_per_information6,
213 p_person_id,
214 HR_MX_UTILITY.GET_BG_FROM_PERSON(p_person_id),
215 p_warning);
216 hr_utility.trace('Leaving '||l_proc_name);
217 END VALIDATE_MS_ID;
218
219
220 /*******************************************************************************
221 Name : validate_imc_id
222 Purpose : This procedure acts as wrapper for per_mx_validations.check_imc
223 *******************************************************************************/
224
225 PROCEDURE VALIDATE_IMC_ID(
226 p_per_information4 per_all_people_f.per_information4%type) AS
227
228 l_proc_name varchar2(100);
229 BEGIN
230 l_proc_name := glb_proc_name ||'VALIDATE_IMC_ID';
231 hr_utility.trace('Entering '||l_proc_name);
232 IF NOT hr_utility.chk_product_install('Oracle Human Resources', 'MX') THEN
233 hr_utility.trace('Mexico legislation not installed. Not performing validation checks.');
234 RETURN;
235 END IF;
236
237 IF p_per_information4 = hr_api.g_varchar2 THEN /* Bug 3777663 */
238 hr_utility.trace('Social Security Medical Center ID not available for validation.');
239 RETURN;
240 END IF;
241
242 -- hr_general2.init_fndload(800); -- Bug 4147647
243 per_mx_validations.check_imc(p_per_information4);
244 hr_utility.trace('Leaving '||l_proc_name);
245 END VALIDATE_IMC_ID;
246
247
248 /*******************************************************************************
249 Name : validate_regn_id
250 Purpose : This procedure acts as wrapper for per_mx_validations.check_regstrn_id
251 *******************************************************************************/
252
253 PROCEDURE VALIDATE_REGN_ID(
254 p_disability_id number,
255 p_registration_id varchar2) AS
256
257 l_proc_name varchar2(100);
258 BEGIN
259 l_proc_name := glb_proc_name ||'VALIDATE_REGN_ID';
260 hr_utility.trace('Entering '||l_proc_name);
261 IF NOT hr_utility.chk_product_install('Oracle Human Resources', 'MX') THEN
262 hr_utility.trace('Mexico legislation not installed. Not performing validation checks.');
263 RETURN;
264 END IF;
265
266 IF p_registration_id = hr_api.g_varchar2 THEN /* Bug 3777663 */
267 hr_utility.trace('Registration ID not available for validation.');
268 RETURN;
269 END IF;
270
271 per_mx_validations.check_regstrn_id(p_registration_id,
272 p_disability_id);
273 hr_utility.trace('Leaving '||l_proc_name);
274 END VALIDATE_REGN_ID;
275
276 BEGIN
277 glb_proc_name := 'PER_MX_VALIDATE_ID.';
278 END PER_MX_VALIDATE_ID;
279