[Home] [Help]
PACKAGE BODY: APPS.IRC_PARTY_API
Source
1 package body IRC_PARTY_API as
2 /* $Header: irhzpapi.pkb 120.30.12010000.4 2008/10/07 06:52:05 amikukum ship $ */
3 --Package Variables
4 --
5 g_package varchar2(33) := 'irc_party_api.';
6 --
7 -- -------------------------------------------------------------------------
8 -- |------------------------< create_candidate_internal >------------------|
9 -- -------------------------------------------------------------------------
10 --
11 procedure create_candidate_internal
12 (p_validate IN boolean default false
13 ,p_business_group_id IN number
14 ,p_last_name IN varchar2
15 ,p_first_name IN varchar2 default null
16 ,p_date_of_birth IN date default null
17 ,p_email_address IN varchar2 default null
18 ,p_title IN varchar2 default null
19 ,p_gender IN varchar2 default null
20 ,p_marital_status IN varchar2 default null
21 ,p_previous_last_name IN varchar2 default null
22 ,p_middle_name IN varchar2 default null
23 ,p_name_suffix IN varchar2 default null
24 ,p_known_as IN varchar2 default null
25 ,p_first_name_phonetic IN varchar2 default null
26 ,p_last_name_phonetic IN varchar2 default null
27 ,p_attribute_category IN varchar2 default null
28 ,p_attribute1 IN varchar2 default null
29 ,p_attribute2 IN varchar2 default null
30 ,p_attribute3 IN varchar2 default null
31 ,p_attribute4 IN varchar2 default null
32 ,p_attribute5 IN varchar2 default null
33 ,p_attribute6 IN varchar2 default null
34 ,p_attribute7 IN varchar2 default null
35 ,p_attribute8 IN varchar2 default null
36 ,p_attribute9 IN varchar2 default null
37 ,p_attribute10 IN varchar2 default null
38 ,p_attribute11 IN varchar2 default null
39 ,p_attribute12 IN varchar2 default null
40 ,p_attribute13 IN varchar2 default null
41 ,p_attribute14 IN varchar2 default null
42 ,p_attribute15 IN varchar2 default null
43 ,p_attribute16 IN varchar2 default null
44 ,p_attribute17 IN varchar2 default null
45 ,p_attribute18 IN varchar2 default null
46 ,p_attribute19 IN varchar2 default null
47 ,p_attribute20 IN varchar2 default null
48 ,p_attribute21 IN varchar2 default null
49 ,p_attribute22 IN varchar2 default null
50 ,p_attribute23 IN varchar2 default null
51 ,p_attribute24 IN varchar2 default null
52 ,p_attribute25 IN varchar2 default null
53 ,p_attribute26 IN varchar2 default null
54 ,p_attribute27 IN varchar2 default null
55 ,p_attribute28 IN varchar2 default null
56 ,p_attribute29 IN varchar2 default null
57 ,p_attribute30 IN varchar2 default null
58 ,p_per_information_category IN varchar2 default null
59 ,p_per_information1 IN varchar2 default null
60 ,p_per_information2 IN varchar2 default null
61 ,p_per_information3 IN varchar2 default null
62 ,p_per_information4 IN varchar2 default null
63 ,p_per_information5 IN varchar2 default null
64 ,p_per_information6 IN varchar2 default null
65 ,p_per_information7 IN varchar2 default null
66 ,p_per_information8 IN varchar2 default null
67 ,p_per_information9 IN varchar2 default null
68 ,p_per_information10 IN varchar2 default null
69 ,p_per_information11 IN varchar2 default null
70 ,p_per_information12 IN varchar2 default null
71 ,p_per_information13 IN varchar2 default null
72 ,p_per_information14 IN varchar2 default null
73 ,p_per_information15 IN varchar2 default null
74 ,p_per_information16 IN varchar2 default null
75 ,p_per_information17 IN varchar2 default null
76 ,p_per_information18 IN varchar2 default null
77 ,p_per_information19 IN varchar2 default null
78 ,p_per_information20 IN varchar2 default null
79 ,p_per_information21 IN varchar2 default null
80 ,p_per_information22 IN varchar2 default null
81 ,p_per_information23 IN varchar2 default null
82 ,p_per_information24 IN varchar2 default null
83 ,p_per_information25 IN varchar2 default null
84 ,p_per_information26 IN varchar2 default null
85 ,p_per_information27 IN varchar2 default null
86 ,p_per_information28 IN varchar2 default null
87 ,p_per_information29 IN varchar2 default null
88 ,p_per_information30 IN varchar2 default null
89 ,p_allow_access IN varchar2 default null
90 ,p_party_id IN number default null
91 ,p_start_date IN date default null
92 ,p_effective_start_date OUT NOCOPY date
93 ,p_effective_end_date OUT NOCOPY date
94 ,p_person_id OUT NOCOPY number) IS
95 --
96 l_proc varchar2(72) := g_package||'create_candidate_internal';
97 l_person_id PER_ALL_PEOPLE_F.PERSON_ID%TYPE;
98 l_date_of_birth per_all_people_f.date_of_birth%type;
99 l_business_group_id per_all_people_f.business_group_id%type;
100 l_person_type_id per_all_people_f.person_type_id%type;
101 l_last_name_phonetic hz_person_profiles.person_last_name_phonetic%type
102 := p_last_name_phonetic;
103 --
104 -- dummy variables
105 --
106 l_object_version_number per_all_people_f.object_version_number%type;
107 l_effective_start_date per_all_people_f.effective_start_date%type;
108 l_effective_end_date per_all_people_f.effective_end_date%type;
109 l_full_name per_all_people_f.full_name%type;
110 l_comment_id per_all_people_f.comment_id%type;
111 l_name_combination_warning boolean;
112 l_orig_hire_warning boolean;
113 l_assign_payroll_warning boolean;
114 l_legislation_code per_business_groups_perf.legislation_code%type;
115 l_ptu_person_type_id number(15);
116 l_employee_number per_all_people_f.employee_number%type := hr_api.g_varchar2;
117 --
118 -- for disabling the descriptive flex field
119 l_add_struct_d hr_dflex_utility.l_ignore_dfcode_varray :=
120 hr_dflex_utility.l_ignore_dfcode_varray();
121 --
122 -- cursor to select the legislation from per_business_groups_perf
123 -- corresponding to the business group
124 --
125 cursor csr_legislation_code(p_business_group_id number) is
126 select legislation_code
127 from per_business_groups_perf
128 where business_group_id = p_business_group_id;
129 --
130 -- cursor to select the person_type_id from hr_organization_inforamtion
131 -- corresponding to the recruiting flexfield on the business group
132 --
133 cursor csr_get_person_type_id(p_business_group_id number) is
134 select org_information8
135 from hr_organization_information
136 where organization_id=p_business_group_id
137 and ORG_INFORMATION_CONTEXT='BG Recruitment';
138 --
139 l_notification_preference_id number;
140 l_search_criteria_id number;
141 --
142 l_start_date date;
143 begin
144 hr_utility.set_location(' Entering: '||l_proc, 10);
145 --
146 -- Issue a savepoint
147 --
148 savepoint CREATE_CANDIDATE_INTERNAL;
149 --
150 -- Truncate the time portion from all IN date parameters
151 --
152 l_date_of_birth := trunc(p_date_of_birth);
153 --
154 -- if the input p_start_date is NULL then
155 -- set the start date of the person record to two days in the past to allow the person to
156 -- made an applicant today, and for them to be hired today, pushing the apply date one
157 -- day in to the past if neccesary
158 --
159 if (p_start_date is NULL) then
160 l_start_date:=trunc(sysdate-2);
161 else
162 l_start_date:=trunc(p_start_date-2);
163 end if;
164 --
165 -- Call Before Process User Hook
166 --
167 begin
168 IRC_PARTY_BK5.CREATE_CANDIDATE_INTERNAL_B
169 (p_business_group_id => p_business_group_id
170 ,p_last_name => p_last_name
171 ,p_first_name => p_first_name
172 ,p_email_address => p_email_address
173 ,p_date_of_birth => l_date_of_birth
174 ,p_title => p_title
175 ,p_gender => p_gender
176 ,p_marital_status => p_marital_status
177 ,p_previous_last_name => p_previous_last_name
178 ,p_middle_name => p_middle_name
179 ,p_name_suffix => p_name_suffix
180 ,p_known_as => p_known_as
181 ,p_first_name_phonetic => p_first_name_phonetic
182 ,p_last_name_phonetic => p_last_name_phonetic
183 ,p_attribute_category => p_attribute_category
184 ,p_attribute1 => p_attribute1
185 ,p_attribute2 => p_attribute2
186 ,p_attribute3 => p_attribute3
187 ,p_attribute4 => p_attribute4
188 ,p_attribute5 => p_attribute5
189 ,p_attribute6 => p_attribute6
190 ,p_attribute7 => p_attribute7
191 ,p_attribute8 => p_attribute8
192 ,p_attribute9 => p_attribute9
193 ,p_attribute10 => p_attribute10
194 ,p_attribute11 => p_attribute11
195 ,p_attribute12 => p_attribute12
196 ,p_attribute13 => p_attribute13
197 ,p_attribute14 => p_attribute14
198 ,p_attribute15 => p_attribute15
199 ,p_attribute16 => p_attribute16
200 ,p_attribute17 => p_attribute17
201 ,p_attribute18 => p_attribute18
202 ,p_attribute19 => p_attribute19
203 ,p_attribute20 => p_attribute20
204 ,p_attribute21 => p_attribute21
205 ,p_attribute22 => p_attribute22
206 ,p_attribute23 => p_attribute23
207 ,p_attribute24 => p_attribute24
208 ,p_attribute25 => p_attribute25
209 ,p_attribute26 => p_attribute26
210 ,p_attribute27 => p_attribute27
211 ,p_attribute28 => p_attribute28
212 ,p_attribute29 => p_attribute29
213 ,p_attribute30 => p_attribute30
214 ,p_per_information_category => p_per_information_category
215 ,p_per_information1 => p_per_information1
216 ,p_per_information2 => p_per_information2
217 ,p_per_information3 => p_per_information3
218 ,p_per_information4 => p_per_information4
219 ,p_per_information5 => p_per_information5
220 ,p_per_information6 => p_per_information6
221 ,p_per_information7 => p_per_information7
222 ,p_per_information8 => p_per_information8
223 ,p_per_information9 => p_per_information9
224 ,p_per_information10 => p_per_information10
225 ,p_per_information11 => p_per_information11
226 ,p_per_information12 => p_per_information12
227 ,p_per_information13 => p_per_information13
228 ,p_per_information14 => p_per_information14
229 ,p_per_information15 => p_per_information15
230 ,p_per_information16 => p_per_information16
231 ,p_per_information17 => p_per_information17
232 ,p_per_information18 => p_per_information18
233 ,p_per_information19 => p_per_information19
234 ,p_per_information20 => p_per_information20
235 ,p_per_information21 => p_per_information21
236 ,p_per_information22 => p_per_information22
237 ,p_per_information23 => p_per_information23
238 ,p_per_information24 => p_per_information24
239 ,p_per_information25 => p_per_information25
240 ,p_per_information26 => p_per_information26
241 ,p_per_information27 => p_per_information27
242 ,p_per_information28 => p_per_information28
243 ,p_per_information29 => p_per_information29
244 ,p_per_information30 => p_per_information30
245 ,p_allow_access => p_allow_access
246 ,p_start_date => l_start_date
247 ,p_party_id => p_party_id
248 );
249 exception
250 when hr_api.cannot_find_prog_unit then
251 hr_api.cannot_find_prog_unit_error
252 (p_module_name => 'CREATE_CANDIDATE_INTERNAL'
253 ,p_hook_type => 'BP'
254 );
255 end;
256 --
257 -- Process Logic
258 -- code for disabling the descriptive flex field
259 --
260 l_add_struct_d.extend(1);
261 l_add_struct_d(l_add_struct_d.count) := 'IRC_SEARCH_CRITERIA';
262 l_add_struct_d.extend(1);
263 l_add_struct_d(l_add_struct_d.count) := 'IRC_SEARCH_CRITERIA_DDF';
264 l_add_struct_d.extend(1);
265 l_add_struct_d(l_add_struct_d.count) := 'IRC_NOTIFICATION_PREFERENCES';
266 l_add_struct_d.extend(1);
267 l_add_struct_d(l_add_struct_d.count) := 'PER_PEOPLE';
268 l_add_struct_d.extend(1);
269 l_add_struct_d(l_add_struct_d.count) := 'Person Developer DF';
270 --
271 hr_dflex_utility.create_ignore_df_validation(p_rec => l_add_struct_d);
272 --
273 --
274 --
275 -- Get the legislation code corrsponding to the business group id
276 --
277 open csr_legislation_code(p_business_group_id);
278 fetch csr_legislation_code into l_legislation_code;
279 close csr_legislation_code;
280 --
281 -- Get the person type id
282 --
283 open csr_get_person_type_id(p_business_group_id);
284 fetch csr_get_person_type_id into l_person_type_id;
285 close csr_get_person_type_id;
286 --
287 if l_person_type_id is null then
288 fnd_message.set_name('PER','IRC_412156_PERS_TYPE_NOT_SET');
289 fnd_message.raise_error;
290 end if;
291 --
292 -- get the PTU person type for iRecruitment Candidate
293 --
294 l_ptu_person_type_id:=hr_person_type_usage_info.get_default_person_type_id
295 (p_business_group_id,
296 'IRC_REG_USER');
297 --
298 -- Handle phonetic names for Japanese legislation
299 --
300 if (l_legislation_code = 'JP') then
301 if (l_last_name_phonetic is null) then
302 l_last_name_phonetic :=
303 fnd_message.get_string('PER','IRC_412108_UNKNOWN_NAME');
304 end if;
305 hr_contact_api.create_person
306 (p_validate => p_validate
307 ,p_start_date => l_start_date
308 ,p_business_group_id => p_business_group_id
309 ,p_last_name => l_last_name_phonetic
310 ,p_sex => p_gender
311 ,p_person_type_id => l_person_type_id
312 ,p_date_of_birth => l_date_of_birth
313 ,p_email_address => p_email_address
314 ,p_first_name => p_first_name_phonetic
315 ,p_known_as => p_known_as
316 ,p_marital_status => p_marital_status
317 ,p_previous_last_name => p_previous_last_name
318 ,p_title => p_title
319 ,p_middle_names => p_middle_name
320 ,p_attribute_category => p_attribute_category
321 ,p_attribute1 => p_attribute1
322 ,p_attribute2 => p_attribute2
323 ,p_attribute3 => p_attribute3
324 ,p_attribute4 => p_attribute4
325 ,p_attribute5 => p_attribute5
326 ,p_attribute6 => p_attribute6
327 ,p_attribute7 => p_attribute7
328 ,p_attribute8 => p_attribute8
329 ,p_attribute9 => p_attribute9
330 ,p_attribute10 => p_attribute10
331 ,p_attribute11 => p_attribute11
332 ,p_attribute12 => p_attribute12
333 ,p_attribute13 => p_attribute13
334 ,p_attribute14 => p_attribute14
335 ,p_attribute15 => p_attribute15
336 ,p_attribute16 => p_attribute16
337 ,p_attribute17 => p_attribute17
338 ,p_attribute18 => p_attribute18
339 ,p_attribute19 => p_attribute19
340 ,p_attribute20 => p_attribute20
341 ,p_attribute21 => p_attribute21
342 ,p_attribute22 => p_attribute22
343 ,p_attribute23 => p_attribute23
344 ,p_attribute24 => p_attribute24
345 ,p_attribute25 => p_attribute25
346 ,p_attribute26 => p_attribute26
347 ,p_attribute27 => p_attribute27
348 ,p_attribute28 => p_attribute28
349 ,p_attribute29 => p_attribute29
350 ,p_attribute30 => p_attribute30
351 ,p_per_information_category => l_legislation_code
352 ,p_per_information1 => p_per_information1
353 ,p_per_information2 => p_per_information2
354 ,p_per_information3 => p_per_information3
355 ,p_per_information4 => p_per_information4
356 ,p_per_information5 => p_per_information5
357 ,p_per_information6 => p_per_information6
358 ,p_per_information7 => p_per_information7
359 ,p_per_information8 => p_per_information8
360 ,p_per_information9 => p_per_information9
361 ,p_per_information10 => p_per_information10
362 ,p_per_information11 => p_per_information11
363 ,p_per_information12 => p_per_information12
364 ,p_per_information13 => p_per_information13
365 ,p_per_information14 => p_per_information14
366 ,p_per_information15 => p_per_information15
367 ,p_per_information16 => p_per_information16
368 ,p_per_information17 => p_per_information17
369 ,p_per_information18 => p_last_name
370 ,p_per_information19 => p_first_name
371 ,p_per_information20 => p_per_information20
372 ,p_per_information21 => p_per_information21
373 ,p_per_information22 => p_per_information22
374 ,p_per_information23 => p_per_information23
375 ,p_per_information24 => p_per_information24
376 ,p_per_information25 => p_per_information25
377 ,p_per_information26 => p_per_information26
378 ,p_per_information27 => p_per_information27
379 ,p_per_information28 => p_per_information28
380 ,p_per_information29 => p_per_information29
381 ,p_per_information30 => p_per_information30
382 ,p_suffix => p_name_suffix
383 ,p_person_id => l_person_id
384 ,p_object_version_number => l_object_version_number
385 ,p_effective_start_date => l_effective_start_date
386 ,p_effective_end_date => l_effective_end_date
387 ,p_full_name => l_full_name
388 ,p_comment_id => l_comment_id
389 ,p_name_combination_warning => l_name_combination_warning
390 ,p_orig_hire_warning => l_orig_hire_warning
391 );
392 --
393 -- Handle phonetic names for Korean legislation
394 --
395 elsif (l_legislation_code = 'KR') then
396 hr_contact_api.create_person
397 (p_validate => p_validate
398 ,p_start_date => l_start_date
399 ,p_business_group_id => p_business_group_id
400 ,p_last_name => p_last_name
401 ,p_sex => p_gender
402 ,p_person_type_id => l_person_type_id
403 ,p_email_address => p_email_address
404 ,p_date_of_birth => l_date_of_birth
405 ,p_first_name => p_first_name
406 ,p_known_as => p_known_as
407 ,p_marital_status => p_marital_status
408 ,p_previous_last_name => p_previous_last_name
409 ,p_title => p_title
410 ,p_middle_names => p_middle_name
411 ,p_attribute_category => p_attribute_category
412 ,p_attribute1 => p_attribute1
413 ,p_attribute2 => p_attribute2
414 ,p_attribute3 => p_attribute3
415 ,p_attribute4 => p_attribute4
416 ,p_attribute5 => p_attribute5
417 ,p_attribute6 => p_attribute6
418 ,p_attribute7 => p_attribute7
419 ,p_attribute8 => p_attribute8
420 ,p_attribute9 => p_attribute9
421 ,p_attribute10 => p_attribute10
422 ,p_attribute11 => p_attribute11
423 ,p_attribute12 => p_attribute12
424 ,p_attribute13 => p_attribute13
425 ,p_attribute14 => p_attribute14
426 ,p_attribute15 => p_attribute15
427 ,p_attribute16 => p_attribute16
428 ,p_attribute17 => p_attribute17
429 ,p_attribute18 => p_attribute18
430 ,p_attribute19 => p_attribute19
431 ,p_attribute20 => p_attribute20
432 ,p_attribute21 => p_attribute21
433 ,p_attribute22 => p_attribute22
434 ,p_attribute23 => p_attribute23
435 ,p_attribute24 => p_attribute24
436 ,p_attribute25 => p_attribute25
437 ,p_attribute26 => p_attribute26
438 ,p_attribute27 => p_attribute27
439 ,p_attribute28 => p_attribute28
440 ,p_attribute29 => p_attribute29
441 ,p_attribute30 => p_attribute30
442 ,p_per_information_category => l_legislation_code
443 ,p_per_information1 => l_last_name_phonetic
444 ,p_per_information2 => p_first_name_phonetic
445 ,p_per_information3 => p_per_information3
446 ,p_per_information4 => p_per_information4
447 ,p_per_information5 => p_per_information5
448 ,p_per_information6 => p_per_information6
449 ,p_per_information7 => p_per_information7
450 ,p_per_information8 => p_per_information8
451 ,p_per_information9 => p_per_information9
452 ,p_per_information10 => p_per_information10
453 ,p_per_information11 => p_per_information11
454 ,p_per_information12 => p_per_information12
455 ,p_per_information13 => p_per_information13
456 ,p_per_information14 => p_per_information14
457 ,p_per_information15 => p_per_information15
458 ,p_per_information16 => p_per_information16
459 ,p_per_information17 => p_per_information17
460 ,p_per_information18 => p_per_information18
461 ,p_per_information19 => p_per_information19
462 ,p_per_information20 => p_per_information20
463 ,p_per_information21 => p_per_information21
464 ,p_per_information22 => p_per_information22
465 ,p_per_information23 => p_per_information23
466 ,p_per_information24 => p_per_information24
467 ,p_per_information25 => p_per_information25
468 ,p_per_information26 => p_per_information26
469 ,p_per_information27 => p_per_information27
470 ,p_per_information28 => p_per_information28
471 ,p_per_information29 => p_per_information29
472 ,p_per_information30 => p_per_information30
473 ,p_suffix => p_name_suffix
474 ,p_person_id => l_person_id
475 ,p_object_version_number => l_object_version_number
476 ,p_effective_start_date => l_effective_start_date
477 ,p_effective_end_date => l_effective_end_date
478 ,p_full_name => l_full_name
479 ,p_comment_id => l_comment_id
480 ,p_name_combination_warning => l_name_combination_warning
481 ,p_orig_hire_warning => l_orig_hire_warning
482 );
483 else
484 hr_contact_api.create_person
485 (p_validate => p_validate
486 ,p_start_date => l_start_date
487 ,p_business_group_id => p_business_group_id
488 ,p_last_name => p_last_name
489 ,p_sex => p_gender
490 ,p_person_type_id => l_person_type_id
491 ,p_email_address => p_email_address
492 ,p_date_of_birth => l_date_of_birth
493 ,p_first_name => p_first_name
494 ,p_known_as => p_known_as
495 ,p_marital_status => p_marital_status
496 ,p_previous_last_name => p_previous_last_name
497 ,p_title => p_title
498 ,p_middle_names => p_middle_name
499 ,p_attribute_category => p_attribute_category
500 ,p_attribute1 => p_attribute1
501 ,p_attribute2 => p_attribute2
502 ,p_attribute3 => p_attribute3
503 ,p_attribute4 => p_attribute4
504 ,p_attribute5 => p_attribute5
505 ,p_attribute6 => p_attribute6
506 ,p_attribute7 => p_attribute7
507 ,p_attribute8 => p_attribute8
508 ,p_attribute9 => p_attribute9
509 ,p_attribute10 => p_attribute10
510 ,p_attribute11 => p_attribute11
511 ,p_attribute12 => p_attribute12
512 ,p_attribute13 => p_attribute13
513 ,p_attribute14 => p_attribute14
514 ,p_attribute15 => p_attribute15
515 ,p_attribute16 => p_attribute16
516 ,p_attribute17 => p_attribute17
517 ,p_attribute18 => p_attribute18
518 ,p_attribute19 => p_attribute19
519 ,p_attribute20 => p_attribute20
520 ,p_attribute21 => p_attribute21
521 ,p_attribute22 => p_attribute22
522 ,p_attribute23 => p_attribute23
523 ,p_attribute24 => p_attribute24
524 ,p_attribute25 => p_attribute25
525 ,p_attribute26 => p_attribute26
526 ,p_attribute27 => p_attribute27
527 ,p_attribute28 => p_attribute28
528 ,p_attribute29 => p_attribute29
529 ,p_attribute30 => p_attribute30
530 ,p_per_information_category => l_legislation_code
531 ,p_per_information1 => p_per_information1
532 ,p_per_information2 => p_per_information2
533 ,p_per_information3 => p_per_information3
534 ,p_per_information4 => p_per_information4
535 ,p_per_information5 => p_per_information5
536 ,p_per_information6 => p_per_information6
537 ,p_per_information7 => p_per_information7
538 ,p_per_information8 => p_per_information8
539 ,p_per_information9 => p_per_information9
540 ,p_per_information10 => p_per_information10
541 ,p_per_information11 => p_per_information11
542 ,p_per_information12 => p_per_information12
543 ,p_per_information13 => p_per_information13
544 ,p_per_information14 => p_per_information14
545 ,p_per_information15 => p_per_information15
546 ,p_per_information16 => p_per_information16
547 ,p_per_information17 => p_per_information17
548 ,p_per_information18 => p_per_information18
549 ,p_per_information19 => p_per_information19
550 ,p_per_information20 => p_per_information20
551 ,p_per_information21 => p_per_information21
552 ,p_per_information22 => p_per_information22
553 ,p_per_information23 => p_per_information23
554 ,p_per_information24 => p_per_information24
555 ,p_per_information25 => p_per_information25
556 ,p_per_information26 => p_per_information26
557 ,p_per_information27 => p_per_information27
558 ,p_per_information28 => p_per_information28
559 ,p_per_information29 => p_per_information29
560 ,p_per_information30 => p_per_information30
561 ,p_suffix => p_name_suffix
562 ,p_person_id => l_person_id
563 ,p_object_version_number => l_object_version_number
564 ,p_effective_start_date => l_effective_start_date
565 ,p_effective_end_date => l_effective_end_date
566 ,p_full_name => l_full_name
567 ,p_comment_id => l_comment_id
568 ,p_name_combination_warning => l_name_combination_warning
569 ,p_orig_hire_warning => l_orig_hire_warning
570 );
571 end if;
572 hr_utility.set_location(l_proc, 40);
573
574 -- calling this will associate the TCA party with the newly created Candidate and prevent PTU code from
575 -- creating a new TCA record
576 if p_party_id is not NULL then
577 hr_person_api.update_person(p_effective_date => l_start_date
578 ,p_datetrack_update_mode => 'CORRECTION'
579 ,p_person_id => l_person_id
580 ,p_party_id => p_party_id
581 ,p_employee_number => l_employee_number /* CHECK THIS*/
582 ,p_object_version_number => l_object_version_number
583 ,p_effective_start_date => l_effective_start_date
584 ,p_effective_end_date => l_effective_end_date
585 ,p_full_name => l_full_name
586 ,p_comment_id => l_comment_id
587 ,p_name_combination_warning => l_name_combination_warning
588 ,p_assign_payroll_warning => l_assign_payroll_warning
589 ,p_orig_hire_warning => l_orig_hire_warning
590 );
591 end if;
592
593 --
594 -- create the extra PTU entry for iRecruitment Candidate
595 --
596 hr_per_type_usage_internal.maintain_person_type_usage
597 (p_effective_date => l_start_date
598 ,p_person_id => l_person_id
599 ,p_person_type_id => l_ptu_person_type_id
600 );
601 hr_utility.set_location(l_proc, 45);
602 --
603 -- Call After Process User Hook
604 --
605 begin
606 IRC_PARTY_BK5.CREATE_CANDIDATE_INTERNAL_A
607 (p_business_group_id => p_business_group_id
608 ,p_last_name => p_last_name
609 ,p_first_name => p_first_name
610 ,p_email_address => p_email_address
611 ,p_date_of_birth => l_date_of_birth
612 ,p_title => p_title
613 ,p_gender => p_gender
614 ,p_marital_status => p_marital_status
615 ,p_previous_last_name => p_previous_last_name
616 ,p_middle_name => p_middle_name
617 ,p_name_suffix => p_name_suffix
618 ,p_known_as => p_known_as
619 ,p_first_name_phonetic => p_first_name_phonetic
620 ,p_last_name_phonetic => p_last_name_phonetic
621 ,p_attribute_category => p_attribute_category
622 ,p_attribute1 => p_attribute1
623 ,p_attribute2 => p_attribute2
624 ,p_attribute3 => p_attribute3
625 ,p_attribute4 => p_attribute4
626 ,p_attribute5 => p_attribute5
627 ,p_attribute6 => p_attribute6
628 ,p_attribute7 => p_attribute7
629 ,p_attribute8 => p_attribute8
630 ,p_attribute9 => p_attribute9
631 ,p_attribute10 => p_attribute10
632 ,p_attribute11 => p_attribute11
633 ,p_attribute12 => p_attribute12
634 ,p_attribute13 => p_attribute13
635 ,p_attribute14 => p_attribute14
636 ,p_attribute15 => p_attribute15
637 ,p_attribute16 => p_attribute16
638 ,p_attribute17 => p_attribute17
639 ,p_attribute18 => p_attribute18
640 ,p_attribute19 => p_attribute19
641 ,p_attribute20 => p_attribute20
642 ,p_attribute21 => p_attribute21
643 ,p_attribute22 => p_attribute22
644 ,p_attribute23 => p_attribute23
645 ,p_attribute24 => p_attribute24
646 ,p_attribute25 => p_attribute25
647 ,p_attribute26 => p_attribute26
648 ,p_attribute27 => p_attribute27
649 ,p_attribute28 => p_attribute28
650 ,p_attribute29 => p_attribute29
651 ,p_attribute30 => p_attribute30
652 ,p_per_information_category => p_per_information_category
653 ,p_per_information1 => p_per_information1
654 ,p_per_information2 => p_per_information2
655 ,p_per_information3 => p_per_information3
656 ,p_per_information4 => p_per_information4
657 ,p_per_information5 => p_per_information5
658 ,p_per_information6 => p_per_information6
659 ,p_per_information7 => p_per_information7
660 ,p_per_information8 => p_per_information8
661 ,p_per_information9 => p_per_information9
662 ,p_per_information10 => p_per_information10
663 ,p_per_information11 => p_per_information11
664 ,p_per_information12 => p_per_information12
665 ,p_per_information13 => p_per_information13
666 ,p_per_information14 => p_per_information14
667 ,p_per_information15 => p_per_information15
668 ,p_per_information16 => p_per_information16
669 ,p_per_information17 => p_per_information17
670 ,p_per_information18 => p_per_information18
671 ,p_per_information19 => p_per_information19
672 ,p_per_information20 => p_per_information20
673 ,p_per_information21 => p_per_information21
674 ,p_per_information22 => p_per_information22
675 ,p_per_information23 => p_per_information23
676 ,p_per_information24 => p_per_information24
677 ,p_per_information25 => p_per_information25
678 ,p_per_information26 => p_per_information26
679 ,p_per_information27 => p_per_information27
680 ,p_per_information28 => p_per_information28
681 ,p_per_information29 => p_per_information29
682 ,p_per_information30 => p_per_information30
683 ,p_person_id => l_person_id
684 ,p_effective_start_date => l_effective_start_date
685 ,p_effective_end_date => l_effective_end_date
686 ,p_allow_access => p_allow_access
687 ,p_start_date => l_start_date
688 ,p_party_id => p_party_id
689 );
690 exception
691 when hr_api.cannot_find_prog_unit then
692 hr_api.cannot_find_prog_unit_error
693 (p_module_name => 'CREATE_CANDIDATE_INTERNAL'
694 ,p_hook_type => 'AP'
695 );
696 end;
697 --
698 -- When IN validation only mode raise the Validate_Enabled exception
699 --
700 if p_validate then
701 raise hr_api.validate_enabled;
702 end if;
703 --
704 -- Set all output arguments
705 --
706 p_person_id := l_person_id;
707 p_effective_start_date := l_effective_start_date;
708 p_effective_end_date := l_effective_end_date;
709 --
710 hr_utility.set_location(' Leaving:'||l_proc, 70);
711
712 exception
713 when hr_Api.validate_enabled then
714 --
715 -- As the Validate_Enabled exception has been raised
716 -- we must rollback to the savepoint
717 --
718 rollback to CREATE_CANDIDATE_INTERNAL;
719 --
720 -- Only set output warning arguments
721 -- (Any key or derived arguments must be set to null
722 -- when validation only mode is beINg used.)
723 --
724 p_person_id := null;
725 p_effective_start_date := null;
726 p_effective_start_date := null;
727 hr_utility.set_location(' Leaving:'||l_proc, 80);
728 when others then
729 --
730 -- A validation or unexpected error has occured
731 --
732 rollback to CREATE_CANDIDATE_INTERNAL;
733 --
734 p_person_id := null;
735 p_effective_start_date := null;
736 p_effective_start_date := null;
737 --
738 hr_utility.set_location(' Leaving:'||l_proc, 90);
739 raise;
740 end create_candidate_internal;
741 --
742 -- -------------------------------------------------------------------------
743 -- |------------------------< create_registered_user >----------------------|
744 -- -------------------------------------------------------------------------
745 --
746 procedure create_registered_user
747 (p_validate IN boolean default false
748 ,p_last_name IN varchar2
749 ,p_first_name IN varchar2 default null
750 ,p_date_of_birth IN date default null
751 ,p_email_address IN varchar2 default null
752 ,p_title IN varchar2 default null
753 ,p_gender IN varchar2 default null
754 ,p_marital_status IN varchar2 default null
755 ,p_previous_last_name IN varchar2 default null
756 ,p_middle_name IN varchar2 default null
757 ,p_name_suffix IN varchar2 default null
758 ,p_known_as IN varchar2 default null
759 ,p_first_name_phonetic IN varchar2 default null
760 ,p_last_name_phonetic IN varchar2 default null
761 ,p_attribute_category IN varchar2 default null
762 ,p_attribute1 IN varchar2 default null
763 ,p_attribute2 IN varchar2 default null
764 ,p_attribute3 IN varchar2 default null
765 ,p_attribute4 IN varchar2 default null
766 ,p_attribute5 IN varchar2 default null
767 ,p_attribute6 IN varchar2 default null
768 ,p_attribute7 IN varchar2 default null
769 ,p_attribute8 IN varchar2 default null
770 ,p_attribute9 IN varchar2 default null
771 ,p_attribute10 IN varchar2 default null
772 ,p_attribute11 IN varchar2 default null
773 ,p_attribute12 IN varchar2 default null
774 ,p_attribute13 IN varchar2 default null
775 ,p_attribute14 IN varchar2 default null
776 ,p_attribute15 IN varchar2 default null
777 ,p_attribute16 IN varchar2 default null
778 ,p_attribute17 IN varchar2 default null
779 ,p_attribute18 IN varchar2 default null
780 ,p_attribute19 IN varchar2 default null
781 ,p_attribute20 IN varchar2 default null
782 ,p_attribute21 IN varchar2 default null
783 ,p_attribute22 IN varchar2 default null
784 ,p_attribute23 IN varchar2 default null
785 ,p_attribute24 IN varchar2 default null
786 ,p_attribute25 IN varchar2 default null
787 ,p_attribute26 IN varchar2 default null
788 ,p_attribute27 IN varchar2 default null
789 ,p_attribute28 IN varchar2 default null
790 ,p_attribute29 IN varchar2 default null
791 ,p_attribute30 IN varchar2 default null
792 ,p_per_information_category IN varchar2 default null
793 ,p_per_information1 IN varchar2 default null
794 ,p_per_information2 IN varchar2 default null
795 ,p_per_information3 IN varchar2 default null
796 ,p_per_information4 IN varchar2 default null
797 ,p_per_information5 IN varchar2 default null
798 ,p_per_information6 IN varchar2 default null
799 ,p_per_information7 IN varchar2 default null
800 ,p_per_information8 IN varchar2 default null
801 ,p_per_information9 IN varchar2 default null
802 ,p_per_information10 IN varchar2 default null
803 ,p_per_information11 IN varchar2 default null
804 ,p_per_information12 IN varchar2 default null
805 ,p_per_information13 IN varchar2 default null
806 ,p_per_information14 IN varchar2 default null
807 ,p_per_information15 IN varchar2 default null
808 ,p_per_information16 IN varchar2 default null
809 ,p_per_information17 IN varchar2 default null
810 ,p_per_information18 IN varchar2 default null
811 ,p_per_information19 IN varchar2 default null
812 ,p_per_information20 IN varchar2 default null
813 ,p_per_information21 IN varchar2 default null
814 ,p_per_information22 IN varchar2 default null
815 ,p_per_information23 IN varchar2 default null
816 ,p_per_information24 IN varchar2 default null
817 ,p_per_information25 IN varchar2 default null
818 ,p_per_information26 IN varchar2 default null
819 ,p_per_information27 IN varchar2 default null
820 ,p_per_information28 IN varchar2 default null
821 ,p_per_information29 IN varchar2 default null
822 ,p_per_information30 IN varchar2 default null
823 ,p_allow_access IN varchar2 default null
824 ,p_start_date IN date default null
825 ,p_effective_start_date OUT NOCOPY date
826 ,p_effective_end_date OUT NOCOPY date
827 ,p_person_id OUT NOCOPY number) IS
828 --
829 l_proc varchar2(72) := g_package||'create_registered_user';
830 l_person_id PER_ALL_PEOPLE_F.PERSON_ID%TYPE;
831 l_date_of_birth per_all_people_f.date_of_birth%type;
832 l_business_group_id per_all_people_f.business_group_id%type;
833 l_person_type_id per_all_people_f.person_type_id%type;
834 l_last_name_phonetic hz_person_profiles.person_last_name_phonetic%type
835 := p_last_name_phonetic;
836 --
837 -- dummy variables
838 --
839 l_object_version_number per_all_people_f.object_version_number%type;
840 l_effective_start_date per_all_people_f.effective_start_date%type;
841 l_effective_end_date per_all_people_f.effective_end_date%type;
842 l_full_name per_all_people_f.full_name%type;
843 l_comment_id per_all_people_f.comment_id%type;
844 l_name_combination_warning boolean;
845 l_orig_hire_warning boolean;
846 l_legislation_code per_business_groups_perf.legislation_code%type;
847 l_ptu_person_type_id number(15);
848 --
849 -- for disabling the descriptive flex field
850 l_add_struct_d hr_dflex_utility.l_ignore_dfcode_varray :=
851 hr_dflex_utility.l_ignore_dfcode_varray();
852 --
853 -- cursor to select the legislation from per_business_groups_perf
854 -- corresponding to the business group
855 --
856 cursor csr_legislation_code(p_business_group_id number) is
857 select legislation_code
858 from per_business_groups_perf
859 where business_group_id = p_business_group_id;
860 --
861 -- cursor to select the person_type_id from hr_organization_inforamtion
862 -- corresponding to the recruiting flexfield on the business group
863 --
864 cursor csr_get_person_type_id(p_business_group_id number) is
865 select org_information8
866 from hr_organization_information
867 where organization_id=p_business_group_id
868 and ORG_INFORMATION_CONTEXT='BG Recruitment';
869 --
870 l_notification_preference_id number;
871 l_search_criteria_id number;
872 --
873 l_start_date date;
874 begin
875 hr_utility.set_location(' Entering: '||l_proc, 10);
876 --
877 -- Issue a savepoint
878 --
879 savepoint CREATE_REGISTERED_USER;
880 --
881 -- Truncate the time portion from all IN date parameters
882 --
883 l_date_of_birth := trunc(p_date_of_birth);
884 --
885 -- set the start date of the person record to two days in the past to allow the person to
886 -- made an applicant today, and for them to be hired today, pushing the apply date one
887 -- day in to the past if neccesary
888 --
889 l_start_date:=trunc(sysdate-2);
890 --
891 -- Call Before Process User Hook
892 --
893 begin
894 IRC_PARTY_BK1.CREATE_REGISTERED_USER_B
895 (p_last_name => p_last_name
896 ,p_first_name => p_first_name
897 ,p_email_address => p_email_address
898 ,p_date_of_birth => l_date_of_birth
899 ,p_title => p_title
900 ,p_gender => p_gender
901 ,p_marital_status => p_marital_status
902 ,p_previous_last_name => p_previous_last_name
903 ,p_middle_name => p_middle_name
904 ,p_name_suffix => p_name_suffix
905 ,p_known_as => p_known_as
906 ,p_first_name_phonetic => p_first_name_phonetic
907 ,p_last_name_phonetic => p_last_name_phonetic
908 ,p_attribute_category => p_attribute_category
909 ,p_attribute1 => p_attribute1
910 ,p_attribute2 => p_attribute2
911 ,p_attribute3 => p_attribute3
912 ,p_attribute4 => p_attribute4
913 ,p_attribute5 => p_attribute5
914 ,p_attribute6 => p_attribute6
915 ,p_attribute7 => p_attribute7
916 ,p_attribute8 => p_attribute8
917 ,p_attribute9 => p_attribute9
918 ,p_attribute10 => p_attribute10
919 ,p_attribute11 => p_attribute11
920 ,p_attribute12 => p_attribute12
921 ,p_attribute13 => p_attribute13
922 ,p_attribute14 => p_attribute14
923 ,p_attribute15 => p_attribute15
924 ,p_attribute16 => p_attribute16
925 ,p_attribute17 => p_attribute17
926 ,p_attribute18 => p_attribute18
927 ,p_attribute19 => p_attribute19
928 ,p_attribute20 => p_attribute20
929 ,p_attribute21 => p_attribute21
930 ,p_attribute22 => p_attribute22
931 ,p_attribute23 => p_attribute23
932 ,p_attribute24 => p_attribute24
933 ,p_attribute25 => p_attribute25
934 ,p_attribute26 => p_attribute26
935 ,p_attribute27 => p_attribute27
936 ,p_attribute28 => p_attribute28
937 ,p_attribute29 => p_attribute29
938 ,p_attribute30 => p_attribute30
939 ,p_per_information_category => p_per_information_category
940 ,p_per_information1 => p_per_information1
941 ,p_per_information2 => p_per_information2
942 ,p_per_information3 => p_per_information3
943 ,p_per_information4 => p_per_information4
944 ,p_per_information5 => p_per_information5
945 ,p_per_information6 => p_per_information6
946 ,p_per_information7 => p_per_information7
947 ,p_per_information8 => p_per_information8
948 ,p_per_information9 => p_per_information9
949 ,p_per_information10 => p_per_information10
950 ,p_per_information11 => p_per_information11
951 ,p_per_information12 => p_per_information12
952 ,p_per_information13 => p_per_information13
953 ,p_per_information14 => p_per_information14
954 ,p_per_information15 => p_per_information15
955 ,p_per_information16 => p_per_information16
956 ,p_per_information17 => p_per_information17
957 ,p_per_information18 => p_per_information18
958 ,p_per_information19 => p_per_information19
959 ,p_per_information20 => p_per_information20
960 ,p_per_information21 => p_per_information21
961 ,p_per_information22 => p_per_information22
962 ,p_per_information23 => p_per_information23
963 ,p_per_information24 => p_per_information24
964 ,p_per_information25 => p_per_information25
965 ,p_per_information26 => p_per_information26
966 ,p_per_information27 => p_per_information27
967 ,p_per_information28 => p_per_information28
968 ,p_per_information29 => p_per_information29
969 ,p_per_information30 => p_per_information30
970 ,p_allow_access => p_allow_access
971 ,p_start_date => p_start_date
972 );
973 exception
974 when hr_api.cannot_find_prog_unit then
975 hr_api.cannot_find_prog_unit_error
976 (p_module_name => 'CREATE_REGISTERED_USER'
977 ,p_hook_type => 'BP'
978 );
979 end;
980 --
981 hr_utility.set_location(l_proc, 10);
982 --
983 -- Process Logic
984 -- code for disabling the descriptive flex field
985 --
986 l_add_struct_d.extend(1);
987 l_add_struct_d(l_add_struct_d.count) := 'IRC_SEARCH_CRITERIA';
988 l_add_struct_d.extend(1);
989 l_add_struct_d(l_add_struct_d.count) := 'IRC_SEARCH_CRITERIA_DDF';
990 l_add_struct_d.extend(1);
991 l_add_struct_d(l_add_struct_d.count) := 'IRC_NOTIFICATION_PREFERENCES';
992 l_add_struct_d.extend(1);
993 l_add_struct_d(l_add_struct_d.count) := 'PER_PEOPLE';
994 l_add_struct_d.extend(1);
995 l_add_struct_d(l_add_struct_d.count) := 'Person Developer DF';
996 --
997 hr_dflex_utility.create_ignore_df_validation(p_rec => l_add_struct_d);
998 --
999 hr_utility.set_location(l_proc, 20);
1000 --
1001 --
1002 -- Get the business group id from profile
1003 --
1004 l_business_group_id := fnd_profile.value('IRC_REGISTRATION_BG_ID');
1005 --
1006 if l_business_group_id is null then
1007 fnd_message.set_name('PER','IRC_412155_REG_BG_NOT_SET');
1008 fnd_message.raise_error;
1009 end if;
1010 --
1011 hr_utility.set_location(l_proc, 30);
1012 --
1013 IRC_PARTY_API.CREATE_CANDIDATE_INTERNAL
1014 (p_business_group_id => l_business_group_id
1015 ,p_last_name => p_last_name
1016 ,p_first_name => p_first_name
1017 ,p_email_address => p_email_address
1018 ,p_date_of_birth => p_date_of_birth
1019 ,p_title => p_title
1020 ,p_gender => p_gender
1021 ,p_marital_status => p_marital_status
1022 ,p_previous_last_name => p_previous_last_name
1023 ,p_middle_name => p_middle_name
1024 ,p_name_suffix => p_name_suffix
1025 ,p_known_as => p_known_as
1026 ,p_first_name_phonetic => p_first_name_phonetic
1027 ,p_last_name_phonetic => p_last_name_phonetic
1028 ,p_attribute_category => p_attribute_category
1029 ,p_attribute1 => p_attribute1
1030 ,p_attribute2 => p_attribute2
1031 ,p_attribute3 => p_attribute3
1032 ,p_attribute4 => p_attribute4
1033 ,p_attribute5 => p_attribute5
1034 ,p_attribute6 => p_attribute6
1035 ,p_attribute7 => p_attribute7
1036 ,p_attribute8 => p_attribute8
1037 ,p_attribute9 => p_attribute9
1038 ,p_attribute10 => p_attribute10
1039 ,p_attribute11 => p_attribute11
1040 ,p_attribute12 => p_attribute12
1041 ,p_attribute13 => p_attribute13
1042 ,p_attribute14 => p_attribute14
1043 ,p_attribute15 => p_attribute15
1044 ,p_attribute16 => p_attribute16
1045 ,p_attribute17 => p_attribute17
1046 ,p_attribute18 => p_attribute18
1047 ,p_attribute19 => p_attribute19
1048 ,p_attribute20 => p_attribute20
1049 ,p_attribute21 => p_attribute21
1050 ,p_attribute22 => p_attribute22
1051 ,p_attribute23 => p_attribute23
1052 ,p_attribute24 => p_attribute24
1053 ,p_attribute25 => p_attribute25
1054 ,p_attribute26 => p_attribute26
1055 ,p_attribute27 => p_attribute27
1056 ,p_attribute28 => p_attribute28
1057 ,p_attribute29 => p_attribute29
1058 ,p_attribute30 => p_attribute30
1059 ,p_per_information_category => p_per_information_category
1060 ,p_per_information1 => p_per_information1
1061 ,p_per_information2 => p_per_information2
1062 ,p_per_information3 => p_per_information3
1063 ,p_per_information4 => p_per_information4
1064 ,p_per_information5 => p_per_information5
1065 ,p_per_information6 => p_per_information6
1066 ,p_per_information7 => p_per_information7
1067 ,p_per_information8 => p_per_information8
1068 ,p_per_information9 => p_per_information9
1069 ,p_per_information10 => p_per_information10
1070 ,p_per_information11 => p_per_information11
1071 ,p_per_information12 => p_per_information12
1072 ,p_per_information13 => p_per_information13
1073 ,p_per_information14 => p_per_information14
1074 ,p_per_information15 => p_per_information15
1075 ,p_per_information16 => p_per_information16
1076 ,p_per_information17 => p_per_information17
1077 ,p_per_information18 => p_per_information18
1078 ,p_per_information19 => p_per_information19
1079 ,p_per_information20 => p_per_information20
1080 ,p_per_information21 => p_per_information21
1081 ,p_per_information22 => p_per_information22
1082 ,p_per_information23 => p_per_information23
1083 ,p_per_information24 => p_per_information24
1084 ,p_per_information25 => p_per_information25
1085 ,p_per_information26 => p_per_information26
1086 ,p_per_information27 => p_per_information27
1087 ,p_per_information28 => p_per_information28
1088 ,p_per_information29 => p_per_information29
1089 ,p_per_information30 => p_per_information30
1090 ,p_allow_access => p_allow_access
1091 ,p_start_date => p_start_date
1092 ,p_effective_start_date => l_effective_start_date
1093 ,p_effective_end_date => l_effective_end_date
1094 ,p_person_id => l_person_id
1095 );
1096 --
1097 hr_utility.set_location(l_proc, 40);
1098 --
1099 -- create notification preferences
1100 --
1101 irc_notification_prefs_api.create_notification_prefs
1102 (p_validate=>p_validate
1103 ,p_person_id =>l_person_id
1104 ,p_effective_date=>trunc(sysdate)
1105 ,p_notification_preference_id=>l_notification_preference_id
1106 ,p_object_version_number =>l_object_version_number
1107 ,p_allow_access => p_allow_access);
1108 --
1109 --
1110 -- create a work preference row
1111 --
1112 irc_search_criteria_api.create_work_choices
1113 (p_validate=>p_validate
1114 ,p_effective_date=>trunc(sysdate)
1115 ,p_person_id =>l_person_id
1116 ,p_employee=>'Y'
1117 ,p_contractor=>'Y'
1118 ,p_object_version_number=>l_object_version_number
1119 ,p_search_criteria_id=>l_search_criteria_id);
1120 --
1121 -- Call After Process User Hook
1122 --
1123 begin
1124 IRC_PARTY_BK1.CREATE_REGISTERED_USER_A
1125 (
1126 p_last_name => p_last_name
1127 ,p_first_name => p_first_name
1128 ,p_email_address => p_email_address
1129 ,p_date_of_birth => l_date_of_birth
1130 ,p_title => p_title
1131 ,p_gender => p_gender
1132 ,p_marital_status => p_marital_status
1133 ,p_previous_last_name => p_previous_last_name
1134 ,p_middle_name => p_middle_name
1135 ,p_name_suffix => p_name_suffix
1136 ,p_known_as => p_known_as
1137 ,p_first_name_phonetic => p_first_name_phonetic
1138 ,p_last_name_phonetic => p_last_name_phonetic
1139 ,p_attribute_category => p_attribute_category
1140 ,p_attribute1 => p_attribute1
1141 ,p_attribute2 => p_attribute2
1142 ,p_attribute3 => p_attribute3
1143 ,p_attribute4 => p_attribute4
1144 ,p_attribute5 => p_attribute5
1145 ,p_attribute6 => p_attribute6
1146 ,p_attribute7 => p_attribute7
1147 ,p_attribute8 => p_attribute8
1148 ,p_attribute9 => p_attribute9
1149 ,p_attribute10 => p_attribute10
1150 ,p_attribute11 => p_attribute11
1151 ,p_attribute12 => p_attribute12
1152 ,p_attribute13 => p_attribute13
1153 ,p_attribute14 => p_attribute14
1154 ,p_attribute15 => p_attribute15
1155 ,p_attribute16 => p_attribute16
1156 ,p_attribute17 => p_attribute17
1157 ,p_attribute18 => p_attribute18
1158 ,p_attribute19 => p_attribute19
1159 ,p_attribute20 => p_attribute20
1160 ,p_attribute21 => p_attribute21
1161 ,p_attribute22 => p_attribute22
1162 ,p_attribute23 => p_attribute23
1163 ,p_attribute24 => p_attribute24
1164 ,p_attribute25 => p_attribute25
1165 ,p_attribute26 => p_attribute26
1166 ,p_attribute27 => p_attribute27
1167 ,p_attribute28 => p_attribute28
1168 ,p_attribute29 => p_attribute29
1169 ,p_attribute30 => p_attribute30
1170 ,p_per_information_category => p_per_information_category
1171 ,p_per_information1 => p_per_information1
1172 ,p_per_information2 => p_per_information2
1173 ,p_per_information3 => p_per_information3
1174 ,p_per_information4 => p_per_information4
1175 ,p_per_information5 => p_per_information5
1176 ,p_per_information6 => p_per_information6
1177 ,p_per_information7 => p_per_information7
1178 ,p_per_information8 => p_per_information8
1179 ,p_per_information9 => p_per_information9
1180 ,p_per_information10 => p_per_information10
1181 ,p_per_information11 => p_per_information11
1182 ,p_per_information12 => p_per_information12
1183 ,p_per_information13 => p_per_information13
1184 ,p_per_information14 => p_per_information14
1185 ,p_per_information15 => p_per_information15
1186 ,p_per_information16 => p_per_information16
1187 ,p_per_information17 => p_per_information17
1188 ,p_per_information18 => p_per_information18
1189 ,p_per_information19 => p_per_information19
1190 ,p_per_information20 => p_per_information20
1191 ,p_per_information21 => p_per_information21
1192 ,p_per_information22 => p_per_information22
1193 ,p_per_information23 => p_per_information23
1194 ,p_per_information24 => p_per_information24
1195 ,p_per_information25 => p_per_information25
1196 ,p_per_information26 => p_per_information26
1197 ,p_per_information27 => p_per_information27
1198 ,p_per_information28 => p_per_information28
1199 ,p_per_information29 => p_per_information29
1200 ,p_per_information30 => p_per_information30
1201 ,p_person_id => l_person_id
1202 ,p_effective_start_date => l_effective_start_date
1203 ,p_effective_end_date => l_effective_end_date
1204 ,p_allow_access => p_allow_access
1205 ,p_start_date => p_start_date
1206 );
1207 exception
1208 when hr_api.cannot_find_prog_unit then
1209 hr_api.cannot_find_prog_unit_error
1210 (p_module_name => 'CREATE_REGISTERED_USER'
1211 ,p_hook_type => 'AP'
1212 );
1213 end;
1214 --
1215 -- When IN validation only mode raise the Validate_Enabled exception
1216 --
1217 if p_validate then
1218 raise hr_api.validate_enabled;
1219 end if;
1220 --
1221 -- Set all output arguments
1222 --
1223 p_person_id := l_person_id;
1224 p_effective_start_date := l_effective_start_date;
1225 p_effective_end_date := l_effective_end_date;
1226 --
1227 hr_utility.set_location(' Leaving:'||l_proc, 70);
1228 --
1229 exception
1230 when hr_Api.validate_enabled then
1231 --
1232 -- As the Validate_Enabled exception has been raised
1233 -- we must rollback to the savepoint
1234 --
1235 rollback to CREATE_REGISTERED_USER;
1236 --
1237 -- Only set output warning arguments
1238 -- (Any key or derived arguments must be set to null
1239 -- when validation only mode is beINg used.)
1240 --
1241 p_person_id := null;
1242 p_effective_start_date := null;
1243 p_effective_start_date := null;
1244 hr_utility.set_location(' Leaving:'||l_proc, 80);
1245 when others then
1246 --
1247 -- A validation or unexpected error has occured
1248 --
1249 rollback to CREATE_REGISTERED_USER;
1250 --
1251 p_person_id := null;
1252 p_effective_start_date := null;
1253 p_effective_start_date := null;
1254 --
1255 hr_utility.set_location(' Leaving:'||l_proc, 90);
1256 raise;
1257 end create_registered_user;
1258 --
1259 -- -------------------------------------------------------------------------
1260 -- |-----------------------< update_registered_user >----------------------|
1261 -- -------------------------------------------------------------------------
1262 --
1263 procedure update_registered_user
1264 (p_validate IN boolean default false
1265 ,p_effective_date IN date
1266 ,p_person_id IN number
1267 ,p_first_name IN varchar2 default hr_api.g_varchar2
1268 ,p_last_name IN varchar2 default hr_api.g_varchar2
1269 ,p_date_of_birth IN date default hr_api.g_date
1270 ,p_title IN varchar2 default hr_api.g_varchar2
1271 ,p_gender IN varchar2 default hr_api.g_varchar2
1272 ,p_marital_status IN varchar2 default hr_api.g_varchar2
1273 ,p_previous_last_name IN varchar2 default hr_api.g_varchar2
1274 ,p_middle_name IN varchar2 default hr_api.g_varchar2
1275 ,p_name_suffix IN varchar2 default hr_api.g_varchar2
1276 ,p_known_as IN varchar2 default hr_api.g_varchar2
1277 ,p_first_name_phonetic IN varchar2 default hr_api.g_varchar2
1278 ,p_last_name_phonetic IN varchar2 default hr_api.g_varchar2
1279 ,p_attribute_category IN varchar2 default hr_api.g_varchar2
1280 ,p_attribute1 IN varchar2 default hr_api.g_varchar2
1281 ,p_attribute2 IN varchar2 default hr_api.g_varchar2
1282 ,p_attribute3 IN varchar2 default hr_api.g_varchar2
1283 ,p_attribute4 IN varchar2 default hr_api.g_varchar2
1284 ,p_attribute5 IN varchar2 default hr_api.g_varchar2
1285 ,p_attribute6 IN varchar2 default hr_api.g_varchar2
1286 ,p_attribute7 IN varchar2 default hr_api.g_varchar2
1287 ,p_attribute8 IN varchar2 default hr_api.g_varchar2
1288 ,p_attribute9 IN varchar2 default hr_api.g_varchar2
1289 ,p_attribute10 IN varchar2 default hr_api.g_varchar2
1290 ,p_attribute11 IN varchar2 default hr_api.g_varchar2
1291 ,p_attribute12 IN varchar2 default hr_api.g_varchar2
1292 ,p_attribute13 IN varchar2 default hr_api.g_varchar2
1293 ,p_attribute14 IN varchar2 default hr_api.g_varchar2
1294 ,p_attribute15 IN varchar2 default hr_api.g_varchar2
1295 ,p_attribute16 IN varchar2 default hr_api.g_varchar2
1296 ,p_attribute17 IN varchar2 default hr_api.g_varchar2
1297 ,p_attribute18 IN varchar2 default hr_api.g_varchar2
1298 ,p_attribute19 IN varchar2 default hr_api.g_varchar2
1299 ,p_attribute20 IN varchar2 default hr_api.g_varchar2
1300 ,p_attribute21 IN varchar2 default hr_api.g_varchar2
1301 ,p_attribute22 IN varchar2 default hr_api.g_varchar2
1302 ,p_attribute23 IN varchar2 default hr_api.g_varchar2
1303 ,p_attribute24 IN varchar2 default hr_api.g_varchar2
1304 ,p_attribute25 IN varchar2 default hr_api.g_varchar2
1305 ,p_attribute26 IN varchar2 default hr_api.g_varchar2
1306 ,p_attribute27 IN varchar2 default hr_api.g_varchar2
1307 ,p_attribute28 IN varchar2 default hr_api.g_varchar2
1308 ,p_attribute29 IN varchar2 default hr_api.g_varchar2
1309 ,p_attribute30 IN varchar2 default hr_api.g_varchar2
1310 ,p_per_information_category IN varchar2 default hr_api.g_varchar2
1311 ,p_per_information1 IN varchar2 default hr_api.g_varchar2
1312 ,p_per_information2 IN varchar2 default hr_api.g_varchar2
1313 ,p_per_information3 IN varchar2 default hr_api.g_varchar2
1314 ,p_per_information4 IN varchar2 default hr_api.g_varchar2
1315 ,p_per_information5 IN varchar2 default hr_api.g_varchar2
1316 ,p_per_information6 IN varchar2 default hr_api.g_varchar2
1317 ,p_per_information7 IN varchar2 default hr_api.g_varchar2
1318 ,p_per_information8 IN varchar2 default hr_api.g_varchar2
1319 ,p_per_information9 IN varchar2 default hr_api.g_varchar2
1320 ,p_per_information10 IN varchar2 default hr_api.g_varchar2
1321 ,p_per_information11 IN varchar2 default hr_api.g_varchar2
1322 ,p_per_information12 IN varchar2 default hr_api.g_varchar2
1323 ,p_per_information13 IN varchar2 default hr_api.g_varchar2
1324 ,p_per_information14 IN varchar2 default hr_api.g_varchar2
1325 ,p_per_information15 IN varchar2 default hr_api.g_varchar2
1326 ,p_per_information16 IN varchar2 default hr_api.g_varchar2
1327 ,p_per_information17 IN varchar2 default hr_api.g_varchar2
1328 ,p_per_information18 IN varchar2 default hr_api.g_varchar2
1329 ,p_per_information19 IN varchar2 default hr_api.g_varchar2
1330 ,p_per_information20 IN varchar2 default hr_api.g_varchar2
1331 ,p_per_information21 IN varchar2 default hr_api.g_varchar2
1332 ,p_per_information22 IN varchar2 default hr_api.g_varchar2
1333 ,p_per_information23 IN varchar2 default hr_api.g_varchar2
1334 ,p_per_information24 IN varchar2 default hr_api.g_varchar2
1335 ,p_per_information25 IN varchar2 default hr_api.g_varchar2
1336 ,p_per_information26 IN varchar2 default hr_api.g_varchar2
1337 ,p_per_information27 IN varchar2 default hr_api.g_varchar2
1338 ,p_per_information28 IN varchar2 default hr_api.g_varchar2
1339 ,p_per_information29 IN varchar2 default hr_api.g_varchar2
1340 ,p_per_information30 IN varchar2 default hr_api.g_varchar2
1341 ) IS
1342 --
1343 l_proc varchar2(72) := g_package||'update_registered_user';
1344 l_object_version_number per_all_people_f.object_version_number%TYPE;
1345 l_employee_number per_all_people_f.employee_number%TYPE;
1346 l_effective_date date;
1347 l_legislation_code per_business_groups.legislation_code%type;
1348 -- sex is defaulted to null - it is set to the value of sex
1349 -- on per_all_people_f if p_gender exists in hr_lookups
1350 l_sex per_all_people_f.sex%TYPE := hr_api.g_varchar2;
1351 l_last_name_phonetic hz_person_profiles.person_last_name_phonetic%type
1352 := p_last_name_phonetic;
1353 --
1354 -- dummy variables
1355 --
1356 l_profile_id number;
1357 l_effective_start_date date;
1358 l_effective_end_date date;
1359 l_full_name per_all_people_f.full_name%type;
1360 l_comment_id number;
1361 l_name_combination_warning boolean;
1362 l_assign_payroll_warning boolean;
1363 l_orig_hire_warning boolean;
1364 l_date_of_birth date;
1365 l_marital_status hz_person_profiles.marital_status%type;
1366 --
1367 -- for disabling the descriptive flex field
1368 l_add_struct_d hr_dflex_utility.l_ignore_dfcode_varray :=
1369 hr_dflex_utility.l_ignore_dfcode_varray();
1370 -- for disabling the key flex field
1371 l_add_struct_k hr_kflex_utility.l_ignore_kfcode_varray :=
1372 hr_kflex_utility.l_ignore_kfcode_varray();
1373 --
1374 --
1375 -- cursor to select entries IN per_all_people_f
1376 -- relating to registered user
1377 --
1378 cursor csr_person_id(p_person_id number,p_effective_date date) is
1379 select effective_start_date,object_version_number,employee_number
1380 from per_all_people_f
1381 where person_id = p_person_id
1382 and l_effective_date between effective_start_date and effective_end_date;
1383 --
1384 begin
1385 hr_utility.set_location(' Entering: ' || l_proc, 10);
1386 --
1387 -- Issue a savepoint
1388 --
1389 savepoint UPDATE_REGISTERED_USER;
1390 --
1391 l_date_of_birth := trunc(p_date_of_birth);
1392 l_effective_date := trunc(p_effective_date);
1393 --
1394 --
1395 -- Call Before Process User Hook
1396 --
1397 begin
1398 irc_party_bk2.update_registered_user_b
1399 (
1400 p_effective_date => l_effective_date
1401 ,p_person_id => p_person_id
1402 ,p_first_name => p_first_name
1403 ,p_last_name => p_last_name
1404 ,p_date_of_birth => l_date_of_birth
1405 ,p_title => p_title
1406 ,p_gender => p_gender
1407 ,p_marital_status => p_marital_status
1408 ,p_previous_last_name => p_previous_last_name
1409 ,p_middle_name => p_middle_name
1410 ,p_name_suffix => p_name_suffix
1411 ,p_known_as => p_known_as
1412 ,p_first_name_phonetic => p_first_name_phonetic
1413 ,p_last_name_phonetic => p_last_name_phonetic
1414 ,p_attribute_category => p_attribute_category
1415 ,p_attribute1 => p_attribute1
1416 ,p_attribute2 => p_attribute2
1417 ,p_attribute3 => p_attribute3
1418 ,p_attribute4 => p_attribute4
1419 ,p_attribute5 => p_attribute5
1420 ,p_attribute6 => p_attribute6
1421 ,p_attribute7 => p_attribute7
1422 ,p_attribute8 => p_attribute8
1423 ,p_attribute9 => p_attribute9
1424 ,p_attribute10 => p_attribute10
1425 ,p_attribute11 => p_attribute11
1426 ,p_attribute12 => p_attribute12
1427 ,p_attribute13 => p_attribute13
1428 ,p_attribute14 => p_attribute14
1429 ,p_attribute15 => p_attribute15
1430 ,p_attribute16 => p_attribute16
1431 ,p_attribute17 => p_attribute17
1432 ,p_attribute18 => p_attribute18
1433 ,p_attribute19 => p_attribute19
1434 ,p_attribute20 => p_attribute20
1435 ,p_attribute21 => p_attribute21
1436 ,p_attribute22 => p_attribute22
1437 ,p_attribute23 => p_attribute23
1438 ,p_attribute24 => p_attribute24
1439 ,p_attribute25 => p_attribute25
1440 ,p_attribute26 => p_attribute26
1441 ,p_attribute27 => p_attribute27
1442 ,p_attribute28 => p_attribute28
1443 ,p_attribute29 => p_attribute29
1444 ,p_attribute30 => p_attribute30
1445 ,p_per_information_category => p_per_information_category
1446 ,p_per_information1 => p_per_information1
1447 ,p_per_information2 => p_per_information2
1448 ,p_per_information3 => p_per_information3
1449 ,p_per_information4 => p_per_information4
1450 ,p_per_information5 => p_per_information5
1451 ,p_per_information6 => p_per_information6
1452 ,p_per_information7 => p_per_information7
1453 ,p_per_information8 => p_per_information8
1454 ,p_per_information9 => p_per_information9
1455 ,p_per_information10 => p_per_information10
1456 ,p_per_information11 => p_per_information11
1457 ,p_per_information12 => p_per_information12
1458 ,p_per_information13 => p_per_information13
1459 ,p_per_information14 => p_per_information14
1460 ,p_per_information15 => p_per_information15
1461 ,p_per_information16 => p_per_information16
1462 ,p_per_information17 => p_per_information17
1463 ,p_per_information18 => p_per_information18
1464 ,p_per_information19 => p_per_information19
1465 ,p_per_information20 => p_per_information20
1466 ,p_per_information21 => p_per_information21
1467 ,p_per_information22 => p_per_information22
1468 ,p_per_information23 => p_per_information23
1469 ,p_per_information24 => p_per_information24
1470 ,p_per_information25 => p_per_information25
1471 ,p_per_information26 => p_per_information26
1472 ,p_per_information27 => p_per_information27
1473 ,p_per_information28 => p_per_information28
1474 ,p_per_information29 => p_per_information29
1475 ,p_per_information30 => p_per_information30
1476 );
1477 exception
1478 when hr_api.cannot_find_prog_unit then
1479 hr_api.cannot_find_prog_unit_error
1480 (p_module_name => 'UPDATE_REGISTERED_USER'
1481 ,p_hook_type => 'BP'
1482 );
1483 end;
1484 --
1485 -- Process Logic
1486 --
1487 --
1488 -- Set profile option
1489 fnd_profile.put('HZ_CREATED_BY_MODULE','HR API');
1490 hr_utility.set_location(l_proc, 40);
1491 --
1492 -- Added for turn off key flex field validation
1493 --
1494 l_add_struct_k.extend(1);
1495 l_add_struct_k(l_add_struct_k.count) := 'GRP';
1496 l_add_struct_k.extend(1);
1497 l_add_struct_k(l_add_struct_k.count) := 'CAGR';
1498 l_add_struct_k.extend(1);
1499 l_add_struct_k(l_add_struct_k.count) := 'SCL';
1500 --
1501 hr_kflex_utility.create_ignore_kf_validation(p_rec => l_add_struct_k);
1502 --
1503 -- code for disabling the descriptive flex field
1504 --
1505 l_add_struct_d.extend(1);
1506 l_add_struct_d(l_add_struct_d.count) := 'PER_ASSIGNMENTS';
1507 l_add_struct_d.extend(1);
1508 l_add_struct_d(l_add_struct_d.count) := 'Person Developer DF';
1509 l_add_struct_d.extend(1);
1510 l_add_struct_d(l_add_struct_d.count) := 'PER_PEOPLE';
1511 --
1512 hr_dflex_utility.create_ignore_df_validation(p_rec => l_add_struct_d);
1513
1514 open csr_person_id(p_person_id,p_effective_date);
1515 fetch csr_person_id into l_effective_start_date,l_object_version_number,l_employee_number;
1516 close csr_person_id;
1517 --
1518 l_legislation_code := per_per_bus.return_legislation_code(p_person_id);
1519 --
1520 if (l_legislation_code = 'JP') then
1521 if (l_last_name_phonetic is null) then
1522 l_last_name_phonetic :=
1523 fnd_message.get_string('PER','IRC_412108_UNKNOWN_NAME');
1524 end if;
1525 hr_person_api.update_person
1526 (p_validate => false
1527 ,p_effective_date => l_effective_date
1528 ,p_datetrack_update_mode => 'CORRECTION'
1529 ,p_person_id => p_person_id
1530 ,p_employee_number => l_employee_number
1531 ,p_object_version_number => l_object_version_number
1532 ,p_last_name => l_last_name_phonetic
1533 ,p_previous_last_name => p_previous_last_name
1534 ,p_date_of_birth => l_date_of_birth
1535 ,p_first_name => p_first_name_phonetic
1536 ,p_known_as => p_known_as
1537 ,p_sex => p_gender
1538 ,p_marital_status => l_marital_status
1539 ,p_middle_names => p_middle_name
1540 ,p_suffix => p_name_suffix
1541 ,p_attribute_category => p_attribute_category
1542 ,p_attribute1 => p_attribute1
1543 ,p_attribute2 => p_attribute2
1544 ,p_attribute3 => p_attribute3
1545 ,p_attribute4 => p_attribute4
1546 ,p_attribute5 => p_attribute5
1547 ,p_attribute6 => p_attribute6
1548 ,p_attribute7 => p_attribute7
1549 ,p_attribute8 => p_attribute8
1550 ,p_attribute9 => p_attribute9
1551 ,p_attribute10 => p_attribute10
1552 ,p_attribute11 => p_attribute11
1553 ,p_attribute12 => p_attribute12
1554 ,p_attribute13 => p_attribute13
1555 ,p_attribute14 => p_attribute14
1556 ,p_attribute15 => p_attribute15
1557 ,p_attribute16 => p_attribute16
1558 ,p_attribute17 => p_attribute17
1559 ,p_attribute18 => p_attribute18
1560 ,p_attribute19 => p_attribute19
1561 ,p_attribute20 => p_attribute20
1562 ,p_attribute21 => p_attribute21
1563 ,p_attribute22 => p_attribute22
1564 ,p_attribute23 => p_attribute23
1565 ,p_attribute24 => p_attribute24
1566 ,p_attribute25 => p_attribute25
1567 ,p_attribute26 => p_attribute26
1568 ,p_attribute27 => p_attribute27
1569 ,p_attribute28 => p_attribute28
1570 ,p_attribute29 => p_attribute29
1571 ,p_attribute30 => p_attribute30
1572 ,p_per_information_category => p_per_information_category
1573 ,p_per_information1 => p_per_information1
1574 ,p_per_information2 => p_per_information2
1575 ,p_per_information3 => p_per_information3
1576 ,p_per_information4 => p_per_information4
1577 ,p_per_information5 => p_per_information5
1578 ,p_per_information6 => p_per_information6
1579 ,p_per_information7 => p_per_information7
1580 ,p_per_information8 => p_per_information8
1581 ,p_per_information9 => p_per_information9
1582 ,p_per_information10 => p_per_information10
1583 ,p_per_information11 => p_per_information11
1584 ,p_per_information12 => p_per_information12
1585 ,p_per_information13 => p_per_information13
1586 ,p_per_information14 => p_per_information14
1587 ,p_per_information15 => p_per_information15
1588 ,p_per_information16 => p_per_information16
1589 ,p_per_information17 => p_per_information17
1590 ,p_per_information18 => p_last_name
1591 ,p_per_information19 => p_first_name
1592 ,p_per_information20 => p_per_information20
1593 ,p_per_information21 => p_per_information21
1594 ,p_per_information22 => p_per_information22
1595 ,p_per_information23 => p_per_information23
1596 ,p_per_information24 => p_per_information24
1597 ,p_per_information25 => p_per_information25
1598 ,p_per_information26 => p_per_information26
1599 ,p_per_information27 => p_per_information27
1600 ,p_per_information28 => p_per_information28
1601 ,p_per_information29 => p_per_information29
1602 ,p_per_information30 => p_per_information30
1603 ,p_effective_start_date => l_effective_start_date
1604 ,p_effective_end_date => l_effective_end_date
1605 ,p_full_name => l_full_name
1606 ,p_comment_id => l_comment_id
1607 ,p_name_combination_warning => l_name_combination_warning
1608 ,p_assign_payroll_warning => l_assign_payroll_warning
1609 ,p_orig_hire_warning => l_orig_hire_warning
1610 );
1611 elsif (l_legislation_code = 'KR') then
1612 hr_person_api.update_person
1613 (p_validate => false
1614 ,p_effective_date => l_effective_date
1615 ,p_datetrack_update_mode => 'CORRECTION'
1616 ,p_person_id => p_person_id
1617 ,p_employee_number => l_employee_number
1618 ,p_object_version_number => l_object_version_number
1619 ,p_last_name => p_last_name
1620 ,p_previous_last_name => p_previous_last_name
1621 ,p_date_of_birth => l_date_of_birth
1622 ,p_first_name => p_first_name
1623 ,p_known_as => p_known_as
1624 ,p_sex => p_gender
1625 ,p_marital_status => l_marital_status
1626 ,p_middle_names => p_middle_name
1627 ,p_suffix => p_name_suffix
1628 ,p_attribute_category => p_attribute_category
1629 ,p_attribute1 => p_attribute1
1630 ,p_attribute2 => p_attribute2
1631 ,p_attribute3 => p_attribute3
1632 ,p_attribute4 => p_attribute4
1633 ,p_attribute5 => p_attribute5
1634 ,p_attribute6 => p_attribute6
1635 ,p_attribute7 => p_attribute7
1636 ,p_attribute8 => p_attribute8
1637 ,p_attribute9 => p_attribute9
1638 ,p_attribute10 => p_attribute10
1639 ,p_attribute11 => p_attribute11
1640 ,p_attribute12 => p_attribute12
1641 ,p_attribute13 => p_attribute13
1642 ,p_attribute14 => p_attribute14
1643 ,p_attribute15 => p_attribute15
1644 ,p_attribute16 => p_attribute16
1645 ,p_attribute17 => p_attribute17
1646 ,p_attribute18 => p_attribute18
1647 ,p_attribute19 => p_attribute19
1648 ,p_attribute20 => p_attribute20
1649 ,p_attribute21 => p_attribute21
1650 ,p_attribute22 => p_attribute22
1651 ,p_attribute23 => p_attribute23
1652 ,p_attribute24 => p_attribute24
1653 ,p_attribute25 => p_attribute25
1654 ,p_attribute26 => p_attribute26
1655 ,p_attribute27 => p_attribute27
1656 ,p_attribute28 => p_attribute28
1657 ,p_attribute29 => p_attribute29
1658 ,p_attribute30 => p_attribute30
1659 ,p_per_information_category => p_per_information_category
1660 ,p_per_information1 => l_last_name_phonetic
1661 ,p_per_information2 => p_first_name_phonetic
1662 ,p_per_information3 => p_per_information3
1663 ,p_per_information4 => p_per_information4
1664 ,p_per_information5 => p_per_information5
1665 ,p_per_information6 => p_per_information6
1666 ,p_per_information7 => p_per_information7
1667 ,p_per_information8 => p_per_information8
1668 ,p_per_information9 => p_per_information9
1669 ,p_per_information10 => p_per_information10
1670 ,p_per_information11 => p_per_information11
1671 ,p_per_information12 => p_per_information12
1672 ,p_per_information13 => p_per_information13
1673 ,p_per_information14 => p_per_information14
1674 ,p_per_information15 => p_per_information15
1675 ,p_per_information16 => p_per_information16
1676 ,p_per_information17 => p_per_information17
1677 ,p_per_information18 => p_per_information18
1678 ,p_per_information19 => p_per_information19
1679 ,p_per_information20 => p_per_information20
1680 ,p_per_information21 => p_per_information21
1681 ,p_per_information22 => p_per_information22
1682 ,p_per_information23 => p_per_information23
1683 ,p_per_information24 => p_per_information24
1684 ,p_per_information25 => p_per_information25
1685 ,p_per_information26 => p_per_information26
1686 ,p_per_information27 => p_per_information27
1687 ,p_per_information28 => p_per_information28
1688 ,p_per_information29 => p_per_information29
1689 ,p_per_information30 => p_per_information30
1690 ,p_effective_start_date => l_effective_start_date
1691 ,p_effective_end_date => l_effective_end_date
1692 ,p_full_name => l_full_name
1693 ,p_comment_id => l_comment_id
1694 ,p_name_combination_warning => l_name_combination_warning
1695 ,p_assign_payroll_warning => l_assign_payroll_warning
1696 ,p_orig_hire_warning => l_orig_hire_warning
1697 );
1698 else
1699 hr_person_api.update_person
1700 (p_validate => false
1701 ,p_effective_date => l_effective_date
1702 ,p_datetrack_update_mode => 'CORRECTION'
1703 ,p_person_id => p_person_id
1704 ,p_employee_number => l_employee_number
1705 ,p_object_version_number => l_object_version_number
1706 ,p_last_name => p_last_name
1707 ,p_previous_last_name => p_previous_last_name
1708 ,p_date_of_birth => l_date_of_birth
1709 ,p_first_name => p_first_name
1710 ,p_known_as => p_known_as
1711 ,p_sex => p_gender
1712 ,p_marital_status => l_marital_status
1713 ,p_middle_names => p_middle_name
1714 ,p_suffix => p_name_suffix
1715 ,p_attribute_category => p_attribute_category
1716 ,p_attribute1 => p_attribute1
1717 ,p_attribute2 => p_attribute2
1718 ,p_attribute3 => p_attribute3
1719 ,p_attribute4 => p_attribute4
1720 ,p_attribute5 => p_attribute5
1721 ,p_attribute6 => p_attribute6
1722 ,p_attribute7 => p_attribute7
1723 ,p_attribute8 => p_attribute8
1724 ,p_attribute9 => p_attribute9
1725 ,p_attribute10 => p_attribute10
1726 ,p_attribute11 => p_attribute11
1727 ,p_attribute12 => p_attribute12
1728 ,p_attribute13 => p_attribute13
1729 ,p_attribute14 => p_attribute14
1730 ,p_attribute15 => p_attribute15
1731 ,p_attribute16 => p_attribute16
1732 ,p_attribute17 => p_attribute17
1733 ,p_attribute18 => p_attribute18
1734 ,p_attribute19 => p_attribute19
1735 ,p_attribute20 => p_attribute20
1736 ,p_attribute21 => p_attribute21
1737 ,p_attribute22 => p_attribute22
1738 ,p_attribute23 => p_attribute23
1739 ,p_attribute24 => p_attribute24
1740 ,p_attribute25 => p_attribute25
1741 ,p_attribute26 => p_attribute26
1742 ,p_attribute27 => p_attribute27
1743 ,p_attribute28 => p_attribute28
1744 ,p_attribute29 => p_attribute29
1745 ,p_attribute30 => p_attribute30
1746 ,p_per_information_category => p_per_information_category
1747 ,p_per_information1 => p_per_information1
1748 ,p_per_information2 => p_per_information2
1749 ,p_per_information3 => p_per_information3
1750 ,p_per_information4 => p_per_information4
1751 ,p_per_information5 => p_per_information5
1752 ,p_per_information6 => p_per_information6
1753 ,p_per_information7 => p_per_information7
1754 ,p_per_information8 => p_per_information8
1755 ,p_per_information9 => p_per_information9
1756 ,p_per_information10 => p_per_information10
1757 ,p_per_information11 => p_per_information11
1758 ,p_per_information12 => p_per_information12
1759 ,p_per_information13 => p_per_information13
1760 ,p_per_information14 => p_per_information14
1761 ,p_per_information15 => p_per_information15
1762 ,p_per_information16 => p_per_information16
1763 ,p_per_information17 => p_per_information17
1764 ,p_per_information18 => p_per_information18
1765 ,p_per_information19 => p_per_information19
1766 ,p_per_information20 => p_per_information20
1767 ,p_per_information21 => p_per_information21
1768 ,p_per_information22 => p_per_information22
1769 ,p_per_information23 => p_per_information23
1770 ,p_per_information24 => p_per_information24
1771 ,p_per_information25 => p_per_information25
1772 ,p_per_information26 => p_per_information26
1773 ,p_per_information27 => p_per_information27
1774 ,p_per_information28 => p_per_information28
1775 ,p_per_information29 => p_per_information29
1776 ,p_per_information30 => p_per_information30
1777 ,p_effective_start_date => l_effective_start_date
1778 ,p_effective_end_date => l_effective_end_date
1779 ,p_full_name => l_full_name
1780 ,p_comment_id => l_comment_id
1781 ,p_name_combination_warning => l_name_combination_warning
1782 ,p_assign_payroll_warning => l_assign_payroll_warning
1783 ,p_orig_hire_warning => l_orig_hire_warning
1784 );
1785 end if;
1786 hr_utility.set_Location(l_proc, 60);
1787 -- Save person ovn to global
1788 if ( p_person_id = g_person_id ) then
1789 g_ovn_for_person := l_object_version_number;
1790 end if;
1791 --
1792 -- Call After Process User Hook
1793 --
1794 begin
1795 irc_party_bk2.update_registered_user_a
1796 (
1797 p_effective_date => l_effective_date
1798 ,p_person_id => p_person_id
1799 ,p_first_name => p_first_name
1800 ,p_last_name => p_last_name
1801 ,p_date_of_birth => l_date_of_birth
1802 ,p_title => p_title
1803 ,p_gender => p_gender
1804 ,p_marital_status => l_marital_status
1805 ,p_previous_last_name => p_previous_last_name
1806 ,p_middle_name => p_middle_name
1807 ,p_name_suffix => p_name_suffix
1808 ,p_known_as => p_known_as
1809 ,p_first_name_phonetic => p_first_name_phonetic
1810 ,p_last_name_phonetic => p_last_name_phonetic
1811 ,p_attribute_category => p_attribute_category
1812 ,p_attribute1 => p_attribute1
1813 ,p_attribute2 => p_attribute2
1814 ,p_attribute3 => p_attribute3
1815 ,p_attribute4 => p_attribute4
1816 ,p_attribute5 => p_attribute5
1817 ,p_attribute6 => p_attribute6
1818 ,p_attribute7 => p_attribute7
1819 ,p_attribute8 => p_attribute8
1820 ,p_attribute9 => p_attribute9
1821 ,p_attribute10 => p_attribute10
1822 ,p_attribute11 => p_attribute11
1823 ,p_attribute12 => p_attribute12
1824 ,p_attribute13 => p_attribute13
1825 ,p_attribute14 => p_attribute14
1826 ,p_attribute15 => p_attribute15
1827 ,p_attribute16 => p_attribute16
1828 ,p_attribute17 => p_attribute17
1829 ,p_attribute18 => p_attribute18
1830 ,p_attribute19 => p_attribute19
1831 ,p_attribute20 => p_attribute20
1832 ,p_attribute21 => p_attribute21
1833 ,p_attribute22 => p_attribute22
1834 ,p_attribute23 => p_attribute23
1835 ,p_attribute24 => p_attribute24
1836 ,p_attribute25 => p_attribute25
1837 ,p_attribute26 => p_attribute26
1838 ,p_attribute27 => p_attribute27
1839 ,p_attribute28 => p_attribute28
1840 ,p_attribute29 => p_attribute29
1841 ,p_attribute30 => p_attribute30
1842 ,p_per_information_category => p_per_information_category
1843 ,p_per_information1 => p_per_information1
1844 ,p_per_information2 => p_per_information2
1845 ,p_per_information3 => p_per_information3
1846 ,p_per_information4 => p_per_information4
1847 ,p_per_information5 => p_per_information5
1848 ,p_per_information6 => p_per_information6
1849 ,p_per_information7 => p_per_information7
1850 ,p_per_information8 => p_per_information8
1851 ,p_per_information9 => p_per_information9
1852 ,p_per_information10 => p_per_information10
1853 ,p_per_information11 => p_per_information11
1854 ,p_per_information12 => p_per_information12
1855 ,p_per_information13 => p_per_information13
1856 ,p_per_information14 => p_per_information14
1857 ,p_per_information15 => p_per_information15
1858 ,p_per_information16 => p_per_information16
1859 ,p_per_information17 => p_per_information17
1860 ,p_per_information18 => p_per_information18
1861 ,p_per_information19 => p_per_information19
1862 ,p_per_information20 => p_per_information20
1863 ,p_per_information21 => p_per_information21
1864 ,p_per_information22 => p_per_information22
1865 ,p_per_information23 => p_per_information23
1866 ,p_per_information24 => p_per_information24
1867 ,p_per_information25 => p_per_information25
1868 ,p_per_information26 => p_per_information26
1869 ,p_per_information27 => p_per_information27
1870 ,p_per_information28 => p_per_information28
1871 ,p_per_information29 => p_per_information29
1872 ,p_per_information30 => p_per_information30
1873 );
1874 exception
1875 when hr_api.cannot_find_prog_unit then
1876 hr_api.cannot_find_prog_unit_error
1877 (p_module_name => 'UPDATE_REGISTERED_USER'
1878 ,p_hook_type => 'AP'
1879 );
1880 end;
1881 --
1882 -- When IN validation only mode raise the Validate_Enabled exception
1883 --
1884 if p_validate then
1885 raise hr_api.validate_enabled;
1886 end if;
1887 --
1888 -- Set all output arguments
1889 --
1890 --
1891 hr_utility.set_location(' Leaving:'||l_proc, 70);
1892
1893 exception
1894 when hr_api.validate_enabled then
1895 --
1896 -- As the Validate_Enabled exception has been raised
1897 -- we must rollback to the savepoint
1898 --
1899 rollback to UPDATE_REGISTERED_USER;
1900 --
1901 -- Only set output warning arguments
1902 -- (Any key or derived arguments must be set to null
1903 -- when validation only mode is beINg used.)
1904 --
1905 hr_utility.set_location(' Leaving:'||l_proc, 80);
1906 when others then
1907 --
1908 -- A validation or unexpected error has occured
1909 --
1910 rollback to UPDATE_REGISTERED_USER;
1911 hr_utility.set_location(' Leaving:'||l_proc, 90);
1912 raise;
1913
1914 end update_registered_user;
1915 --
1916 -- -------------------------------------------------------------------------
1917 -- |---------------------< chk_agency_application_limit >-------------------|
1918 -- -------------------------------------------------------------------------
1919 --
1920 procedure chk_agency_application_limit
1921 (p_vacancy_id IN number default null
1922 ,p_effective_date IN date) IS
1923 --
1924 cursor csr_application_count(p_vacancy_id number, p_effective_date date) is
1925 select count(*)
1926 from per_all_assignments_f paaf
1927 , IRC_AGENCY_VACANCIES AGV1
1928 ,per_all_people_f per1
1929 ,irc_notification_preferences prefs
1930 where paaf.vacancy_id = p_vacancy_id and paaf.assignment_type = 'A'
1931 and p_effective_date between PAAF.EFFECTIVE_START_DATE
1932 AND PAAF.EFFECTIVE_END_DATE
1933 and paaf.VACANCY_ID = AGV1.VACANCY_ID
1934 and AGV1.AGENCY_ID = FND_PROFILE.VALUE('IRC_AGENCY_NAME')
1935 and per1.person_id=paaf.person_id
1936 and p_effective_date between per1.effective_start_date and per1.effective_end_date
1937 and per1.party_id=prefs.party_id
1938 and prefs.agency_id=agv1.agency_id
1939 and p_effective_date between nvl(agv1.start_date,p_effective_date)
1940 and nvl(agv1.end_date,p_effective_date);
1941 --
1942 cursor csr_application_count_limit(p_vacancy_id number) is
1943 select AGV.MAX_ALLOWED_APPLICANTS
1944 from IRC_AGENCY_VACANCIES AGV
1945 where agv.vacancy_id = p_vacancy_id
1946 and AGV.AGENCY_ID = FND_PROFILE.VALUE('IRC_AGENCY_NAME');
1947 --
1948 l_application_count_limit IRC_AGENCY_VACANCIES.MAX_ALLOWED_APPLICANTS%TYPE;
1949 l_application_count Number;
1950 l_agency_id IRC_AGENCY_VACANCIES.AGENCY_ID%TYPE;
1951 begin
1952 --
1953 -- only check if Agency profile is set
1954 --
1955 if ( FND_PROFILE.VALUE('IRC_AGENCY_NAME') is not null ) then
1956 --
1957 -- get the applicant count limit for the vacancy
1958 --
1959 open csr_application_count_limit(p_vacancy_id);
1960 fetch csr_application_count_limit into l_application_count_limit;
1961 --
1962 if ( csr_application_count_limit%found ) then
1963 if ( l_application_count_limit is null ) then
1964 l_application_count_limit := FND_PROFILE.VALUE('IRC_MAX_APPLICANTS_DFT');
1965 end if;
1966 end if;
1967 close csr_application_count_limit;
1968 --
1969 -- only do check if applicant count limit has been set
1970 --
1971 if ( l_application_count_limit is not null ) then
1972 open csr_application_count(p_vacancy_id, p_effective_date);
1973 fetch csr_application_count into l_application_count;
1974 if ( l_application_count >= l_application_count_limit ) then
1975 fnd_message.set_name('PER','IRC_MAX_APPLICATIONS_LIMIT');
1976 hr_multi_message.add();
1977 hr_multi_message.end_validation_set();
1978 end if;
1979 close csr_application_count;
1980 end if;
1981 end if;
1982 end chk_agency_application_limit;
1983
1984 --
1985 -- -------------------------------------------------------------------------
1986 -- |---------------------< registered_user_application >-------------------|
1987 -- -------------------------------------------------------------------------
1988 --
1989 procedure registered_user_application
1990 (p_validate IN boolean default false
1991 ,p_effective_date IN date
1992 ,p_recruitment_person_id IN number
1993 ,p_person_id IN number
1994 ,p_assignment_id IN number
1995 ,p_application_received_date IN date default null
1996 ,p_vacancy_id IN number default null
1997 ,p_posting_content_id IN number default null
1998 ,p_per_object_version_number OUT NOCOPY number
1999 ,p_asg_object_version_number OUT NOCOPY number
2000 ,p_applicant_number OUT NOCOPY varchar2) IS
2001 --
2002 l_proc varchar2(72) := g_package||'registered_user_application';
2003 l_per_object_version_number per_all_people_f.object_version_number%TYPE;
2004 l_asg_object_version_number per_all_assignments_f.object_version_number%TYPE;
2005 l_person_id per_all_people_f.person_id%TYPE;
2006 l_party_id per_all_people_f.party_id%TYPE;
2007 l_rec_person_id per_all_people_f.person_id%TYPE;
2008 l_assignment_id per_all_assignments_f.assignment_id%TYPE;
2009 l_effective_date date;
2010 l_application_received_date date;
2011 l_party_last_update_date date;
2012 l_return_status varchar2(10);
2013 l_applicant_number per_all_people_f.applicant_number%type;
2014 l_person_type_id per_person_types.person_type_id%type;
2015 l_current_employee_flag per_all_people_f.current_employee_flag%type;
2016 l_current_applicant_flag per_all_people_f.current_applicant_flag%type;
2017 l_current_npw_flag per_all_people_f.current_npw_flag%type;
2018
2019 l_last_name per_all_people_f.last_name%type;
2020 l_first_name per_all_people_f.first_name%type;
2021 l_per_information1 per_all_people_f.per_information1%type;
2022 l_per_information2 per_all_people_f.per_information2%type;
2023 l_per_information18 per_all_people_f.per_information18%type;
2024 l_per_information19 per_all_people_f.per_information19%type;
2025 l_date_of_birth per_all_people_f.date_of_birth%type;
2026 l_title per_all_people_f.title%type;
2027 l_gender per_all_people_f.sex%type;
2028 l_marital_status per_all_people_f.marital_status%type;
2029 l_previous_last_name per_all_people_f.last_name%type;
2030 l_middle_name per_all_people_f.middle_names%type;
2031 l_name_suffix per_all_people_f.suffix%type;
2032 l_known_as per_all_people_f.known_as%type;
2033 l_business_group_id per_all_vacancies.business_group_id%type;
2034 l_organization_id per_all_vacancies.organization_id%type;
2035 l_job_id per_all_vacancies.job_id%type;
2036 l_position_id per_all_vacancies.position_id%type;
2037 l_manager_id per_all_vacancies.manager_id%type;
2038 l_grade_id per_all_vacancies.grade_id%type;
2039 l_location_id per_all_vacancies.location_id%type;
2040 l_recruiter_id per_all_vacancies.recruiter_id%type;
2041 l_people_group_id per_all_vacancies.people_group_id%type;
2042 l_legislation_code per_business_groups.legislation_code%type;
2043 --
2044 -- variables for hr_person_api.update_person
2045 --
2046 l_object_version_number per_all_people_f.object_version_number%TYPE;
2047 l_employee_number per_all_people_f.employee_number%TYPE;
2048 --
2049 -- dummy variables
2050 --
2051 l_msg_count number;
2052 l_msg_data varchar2(2000);
2053 l_var varchar2(1);
2054 l_party_number hz_parties.party_number%type;
2055 l_profile_id number;
2056 l_effective_start_date date;
2057 l_effective_end_date date;
2058 l_comment_id number;
2059 l_name_combination_warning boolean;
2060 l_assign_payroll_warning boolean;
2061 l_orig_hire_warning boolean;
2062 l_object_version_number_d per_all_people_f.object_version_number%TYPE;
2063 -- those required for hr_assignment_api.create_secondary_apl_asg
2064 l_concatenated_segments varchar2(2000);
2065 l_cagr_grade_def_id number;
2066 l_cagr_concatenated_segments varchar2(2000);
2067 l_group_name pay_people_groups.group_name%type;
2068 l_soft_coding_keyflex_id number;
2069 l_assignment_sequence per_all_assignments_f.assignment_sequence%type;
2070 -- those required for hr_applicant_api.create_applicant
2071 l_application_id number;
2072 l_full_name per_all_people_f.full_name%type;
2073 l_person_type per_person_types.system_person_type%type;
2074 l_ptu_person_type_id number;
2075 -- for disabling the descriptive flex field
2076 l_add_struct_d hr_dflex_utility.l_ignore_dfcode_varray :=
2077 hr_dflex_utility.l_ignore_dfcode_varray();
2078 -- for disabling the key flex field
2079 l_add_struct_k hr_kflex_utility.l_ignore_kfcode_varray :=
2080 hr_kflex_utility.l_ignore_kfcode_varray();
2081 --
2082 -- cursor to select entries IN per_all_people_f
2083 -- relating to registered user
2084 --
2085 cursor csr_person_id(p_party_id number
2086 ,p_effective_date date
2087 ,p_business_group_id number) is
2088 select per.person_id
2089 ,per.object_version_number
2090 ,per.current_employee_flag
2091 ,per.current_applicant_flag
2092 ,per.current_npw_flag
2093 ,per.applicant_number
2094 from per_all_people_f per
2095 where per.party_id = p_party_id
2096 and p_effective_date between per.effective_start_date and per.effective_end_date
2097 and business_group_id=p_business_group_id;
2098 --
2099 -- cursor to select entries IN per_all_people_f
2100 -- for a given person over all dates
2101 --
2102 cursor csr_person_all_dates(p_party_id number
2103 ,p_business_group_id number) is
2104 select null
2105 from per_all_people_f per
2106 where per.party_id = p_party_id
2107 and business_group_id=p_business_group_id;
2108 --
2109 -- cursor to select person details for the registered user
2110 --
2111 cursor csr_party_details(p_person_id number,p_effective_date date) is
2112 select last_update_date
2113 ,party_id
2114 ,last_name
2115 ,first_name
2116 ,date_of_birth
2117 ,title
2118 ,sex
2119 ,marital_status
2120 ,previous_last_name
2121 ,middle_names
2122 ,suffix
2123 ,known_as
2124 ,per_information1
2125 ,per_information2
2126 ,per_information18
2127 ,per_information19
2128 from per_all_people_f
2129 where person_id = p_person_id
2130 and p_effective_date between effective_start_date and effective_end_date;
2131 -- cursor to select business_group relating to a vacancy
2132 cursor csr_get_vac(p_vacancy_id number) is
2133 select business_group_id
2134 ,organization_id
2135 ,job_id
2136 ,position_id
2137 ,grade_id
2138 ,people_group_id
2139 ,location_id
2140 ,recruiter_id
2141 ,manager_id
2142 from per_all_vacancies
2143 where vacancy_id = p_vacancy_id;
2144 --
2145 cursor get_new_asg(p_person_id number, p_effective_date date) is
2146 select assignment_id,object_version_number
2147 from per_all_assignments_f
2148 where person_id=p_person_id
2149 and effective_start_date = p_effective_date
2150 and assignment_type='A';
2151 --
2152 begin
2153 hr_utility.set_location(' Entering: ' || l_proc, 10);
2154 --
2155 -- Issue a savepoint
2156 --
2157 savepoint REGISTERED_USER_APPLICATION;
2158 --
2159 -- Truncate time portion from date
2160 --
2161 l_effective_date := trunc(p_effective_date);
2162 --
2163 -- check if an agency is applying and if the application count is exceeded
2164 --
2165 irc_party_api.chk_agency_application_limit(p_vacancy_id => p_vacancy_id
2166 ,p_effective_date => l_effective_date);
2167 --
2168 -- If no application received date passed, then assume application received
2169 -- on effective_date
2170 --
2171 l_application_received_date:=trunc(nvl(p_application_received_date
2172 ,l_effective_date));
2173 --
2174 -- Added for turn off key flex field validation
2175 l_add_struct_k.extend(1);
2176 l_add_struct_k(l_add_struct_k.count) := 'GRP';
2177 l_add_struct_k.extend(1);
2178 l_add_struct_k(l_add_struct_k.count) := 'CAGR';
2179 l_add_struct_k.extend(1);
2180 l_add_struct_k(l_add_struct_k.count) := 'SCL';
2181 --
2182 hr_kflex_utility.create_ignore_kf_validation(p_rec => l_add_struct_k);
2183 --
2184 -- code for disabling the descriptive flex field
2185 l_add_struct_d.extend(1);
2186 l_add_struct_d(l_add_struct_d.count) := 'PER_ASSIGNMENTS';
2187 l_add_struct_d.extend(1);
2188 l_add_struct_d(l_add_struct_d.count) := 'Person Developer DF';
2189 l_add_struct_d.extend(1);
2190 l_add_struct_d(l_add_struct_d.count) := 'PER_PEOPLE';
2191 --
2192 hr_dflex_utility.create_ignore_df_validation(p_rec => l_add_struct_d);
2193 --
2194 -- Call Before Process User Hook
2195 --
2196 begin
2197 irc_party_bk3.registered_user_application_b
2198 (
2199 p_effective_date => l_effective_date
2200 ,p_person_id => p_person_id
2201 ,p_applicant_number => l_applicant_number
2202 ,p_application_received_date => l_application_received_date
2203 ,p_vacancy_id => p_vacancy_id
2204 ,p_posting_content_id => p_posting_content_id
2205 );
2206 exception
2207 when hr_api.cannot_find_prog_unit then
2208 hr_api.cannot_find_prog_unit_error
2209 (p_module_name => 'REGISTERED_USER_APPLICATION'
2210 ,p_hook_type => 'BP'
2211 );
2212 end;
2213 --
2214 -- Process Logic
2215 --
2216 -- get person info for recruitment person
2217 --
2218 open csr_party_details(p_recruitment_person_id,l_effective_date);
2219 fetch csr_party_details into l_party_last_update_date
2220 ,l_party_id
2221 ,l_last_name
2222 ,l_first_name
2223 ,l_date_of_birth
2224 ,l_title
2225 ,l_gender
2226 ,l_marital_status
2227 ,l_previous_last_name
2228 ,l_middle_name
2229 ,l_name_suffix
2230 ,l_known_as
2231 ,l_per_information1
2232 ,l_per_information2
2233 ,l_per_information18
2234 ,l_per_information19;
2235 close csr_party_details;
2236 --
2237 open csr_get_vac(p_vacancy_id);
2238 fetch csr_get_vac into l_business_group_id
2239 ,l_organization_id
2240 ,l_job_id
2241 ,l_position_id
2242 ,l_grade_id
2243 ,l_people_group_id
2244 ,l_location_id
2245 ,l_recruiter_id
2246 ,l_manager_id;
2247 close csr_get_vac;
2248 --
2249 open csr_person_id(l_party_id, l_effective_date,l_business_group_id);
2250 fetch csr_person_id into l_person_id
2251 ,l_per_object_version_number
2252 ,l_current_employee_flag
2253 ,l_current_applicant_flag
2254 ,l_current_npw_flag
2255 ,l_applicant_number;
2256 --
2257 -- check if there is an out of date person
2258 --
2259 open csr_person_all_dates(l_party_id, l_business_group_id);
2260 fetch csr_person_all_dates into l_var;
2261 --
2262 if ( csr_person_id%notfound and csr_person_all_dates%found ) then
2263 --
2264 close csr_person_id;
2265 close csr_person_all_dates;
2266 fnd_message.set_name('PER','IRC_412099_CANNOT_APPLY');
2267 hr_multi_message.add();
2268 end if;
2269 close csr_person_all_dates;
2270 --
2271 -- Register Assignment ID
2272 --
2273 per_asg_ins.set_base_key_value
2274 (p_assignment_id => p_assignment_id
2275 );
2276 --
2277 if csr_person_id%found then
2278 --
2279 if (l_current_applicant_flag = 'Y') then
2280 hr_assignment_api.create_secondary_apl_asg
2281 (p_validate => false
2282 ,p_effective_date => l_effective_date
2283 ,p_person_id => l_person_id
2284 ,p_organization_id => nvl(l_organization_id,l_business_group_id)
2285 ,p_job_id => l_job_id
2286 ,p_position_id => l_position_id
2287 ,p_grade_id => l_grade_id
2288 ,p_people_group_id => l_people_group_id
2289 ,p_location_id => l_location_id
2290 ,p_recruiter_id => l_recruiter_id
2291 ,p_supervisor_id => l_manager_id
2292 ,p_vacancy_id => p_vacancy_id
2293 ,p_posting_content_id => p_posting_content_id
2294 ,p_concatenated_segments => l_concatenated_segments
2295 ,p_cagr_grade_def_id => l_cagr_grade_def_id
2296 ,p_cagr_concatenated_segments=> l_cagr_concatenated_segments
2297 ,p_group_name => l_group_name
2298 ,p_assignment_id => l_assignment_id
2299 ,p_soft_coding_keyflex_id => l_soft_coding_keyflex_id
2300 ,p_comment_id => l_comment_id
2301 ,p_object_version_number => l_asg_object_version_number
2302 ,p_effective_start_date => l_effective_start_date
2303 ,p_effective_end_date => l_effective_end_date
2304 ,p_assignment_sequence => l_assignment_sequence
2305 );
2306 elsif (l_current_employee_flag = 'Y') then
2307 hr_utility.set_location(l_proc,20);
2308 hr_employee_api.apply_for_internal_vacancy
2309 (p_validate => false
2310 ,p_effective_date => l_effective_date
2311 ,p_person_id => l_person_id
2312 ,p_applicant_number => l_applicant_number
2313 ,p_per_object_version_number => l_per_object_version_number
2314 ,p_vacancy_id => p_vacancy_id
2315 ,p_application_id => l_application_id
2316 ,p_assignment_id => l_assignment_id
2317 ,p_apl_object_version_number => l_object_version_number_d
2318 ,p_asg_object_version_number => l_asg_object_version_number
2319 ,p_assignment_sequence => l_assignment_sequence
2320 ,p_per_effective_start_date => l_effective_start_date
2321 ,p_per_effective_end_date => l_effective_end_date);
2322 hr_assignment_api.update_apl_asg
2323 (p_effective_date => l_effective_date
2324 ,p_datetrack_update_mode => 'CORRECTION'
2325 ,p_assignment_id => l_assignment_id
2326 ,p_object_version_number => l_asg_object_version_number
2327 ,p_posting_content_id => p_posting_content_id
2328 ,p_supervisor_id => l_manager_id
2329 ,p_concatenated_segments => l_concatenated_segments
2330 ,p_cagr_grade_def_id => l_cagr_grade_def_id
2331 ,p_cagr_concatenated_segments=> l_cagr_concatenated_segments
2332 ,p_group_name => l_group_name
2333 ,p_comment_id => l_comment_id
2334 ,p_soft_coding_keyflex_id => l_soft_coding_keyflex_id
2335 ,p_people_group_id => l_people_group_id
2336 ,p_effective_start_date => l_effective_start_date
2337 ,p_effective_end_date => l_effective_end_date
2338 );
2339 elsif (l_current_npw_flag = 'Y') then
2340 hr_utility.set_location(l_proc,25);
2341 hr_contingent_worker_api.apply_for_job
2342 (p_validate => false
2343 ,p_effective_date => l_effective_date
2344 ,p_person_id => l_person_id
2345 ,p_object_version_number => l_per_object_version_number
2346 ,p_applicant_number => l_applicant_number
2347 ,p_vacancy_id => p_vacancy_id
2348 ,p_per_effective_start_date => l_effective_start_date
2349 ,p_per_effective_end_date => l_effective_end_date
2350 ,p_application_id => l_application_id
2351 ,p_apl_object_version_number => l_object_version_number_d
2352 ,p_assignment_id => l_assignment_id
2353 ,p_asg_object_version_number => l_asg_object_version_number
2354 ,p_assignment_sequence => l_assignment_sequence
2355 );
2356 hr_assignment_api.update_apl_asg
2357 (p_effective_date => l_effective_date
2358 ,p_datetrack_update_mode => 'CORRECTION'
2359 ,p_assignment_id => l_assignment_id
2360 ,p_object_version_number => l_asg_object_version_number
2361 ,p_posting_content_id => p_posting_content_id
2362 ,p_supervisor_id => l_manager_id
2363 ,p_concatenated_segments => l_concatenated_segments
2364 ,p_cagr_grade_def_id => l_cagr_grade_def_id
2365 ,p_cagr_concatenated_segments=> l_cagr_concatenated_segments
2366 ,p_group_name => l_group_name
2367 ,p_comment_id => l_comment_id
2368 ,p_soft_coding_keyflex_id => l_soft_coding_keyflex_id
2369 ,p_people_group_id => l_people_group_id
2370 ,p_effective_start_date => l_effective_start_date
2371 ,p_effective_end_date => l_effective_end_date
2372 );
2373 else
2374 hr_utility.set_location(l_proc,30);
2375 hr_applicant_api.convert_to_applicant
2376 (p_validate => false
2377 ,p_effective_date => l_effective_date
2378 ,p_person_id => l_person_id
2379 ,p_object_version_number => l_per_object_version_number
2380 ,p_applicant_number => l_applicant_number
2381 ,p_person_type_id => l_person_type_id
2382 ,p_effective_start_date => l_effective_start_date
2383 ,p_effective_end_date => l_effective_end_date);
2384 open get_new_asg(l_person_id,l_effective_date);
2385 fetch get_new_asg into l_assignment_id,l_asg_object_version_number;
2386 close get_new_asg;
2387 hr_assignment_api.update_apl_asg
2388 (p_effective_date => l_effective_date
2389 ,p_datetrack_update_mode => 'CORRECTION'
2390 ,p_assignment_id => l_assignment_id
2391 ,p_object_version_number => l_asg_object_version_number
2392 ,p_vacancy_id => p_vacancy_id
2393 ,p_posting_content_id => p_posting_content_id
2394 ,p_organization_id => nvl(l_organization_id,l_business_group_id)
2395 ,p_job_id => l_job_id
2396 ,p_position_id => l_position_id
2397 ,p_grade_id => l_grade_id
2398 ,p_people_group_id => l_people_group_id
2399 ,p_location_id => l_location_id
2400 ,p_recruiter_id => l_recruiter_id
2401 ,p_supervisor_id => l_manager_id
2402 ,p_concatenated_segments => l_concatenated_segments
2403 ,p_cagr_grade_def_id => l_cagr_grade_def_id
2404 ,p_cagr_concatenated_segments=> l_cagr_concatenated_segments
2405 ,p_group_name => l_group_name
2406 ,p_comment_id => l_comment_id
2407 ,p_soft_coding_keyflex_id => l_soft_coding_keyflex_id
2408 ,p_effective_start_date => l_effective_start_date
2409 ,p_effective_end_date => l_effective_end_date
2410 );
2411 end if;
2412 else
2413 hr_utility.set_location(l_proc, 40);
2414 --
2415 -- Register Person ID
2416 --
2417 per_per_ins.set_base_key_value
2418 (p_person_id => p_person_id);
2419 --
2420 l_legislation_code := per_vac_bus.return_legislation_code(p_vacancy_id);
2421 l_applicant_number:=null;
2422 if (l_legislation_code = 'JP') then
2423 hr_applicant_api.create_applicant
2424 (p_validate => false
2425 ,p_date_received => l_application_received_date
2426 ,p_business_group_id => l_business_group_id
2427 ,p_last_name => l_last_name
2428 ,p_first_name => l_first_name
2429 ,p_per_information18 => l_per_information18
2430 ,p_per_information19 => l_per_information19
2431 ,p_date_of_birth => l_date_of_birth
2432 ,p_applicant_number => l_applicant_number
2433 ,p_previous_last_name => l_previous_last_name
2434 ,p_known_as => l_known_as
2435 ,p_marital_status => l_marital_status
2436 ,p_middle_names => l_middle_name
2437 ,p_suffix => l_name_suffix
2438 ,p_person_id => l_person_id
2439 ,p_assignment_id => l_assignment_id
2440 ,p_application_id => l_application_id
2441 ,p_per_object_version_number => l_per_object_version_number
2442 ,p_asg_object_version_number => l_asg_object_version_number
2443 ,p_apl_object_version_number => l_object_version_number_d
2444 ,p_per_effective_start_date => l_effective_start_date
2445 ,p_per_effective_end_date => l_effective_end_date
2446 ,p_full_name => l_full_name
2447 ,p_per_comment_id => l_comment_id
2448 ,p_assignment_sequence => l_assignment_sequence
2449 ,p_name_combination_warning => l_name_combination_warning
2450 ,p_orig_hire_warning => l_orig_hire_warning
2451 ,p_party_id => l_party_id
2452 );
2453 elsif (l_legislation_code = 'KR') then
2454 hr_applicant_api.create_applicant
2455 (p_validate => false
2456 ,p_date_received => l_application_received_date
2457 ,p_business_group_id => l_business_group_id
2458 ,p_last_name => l_last_name
2459 ,p_first_name => l_first_name
2460 ,p_per_information1 => l_per_information1
2461 ,p_per_information2 => l_per_information2
2462 ,p_date_of_birth => l_date_of_birth
2463 ,p_applicant_number => l_applicant_number
2464 ,p_previous_last_name => l_previous_last_name
2465 ,p_known_as => l_known_as
2466 ,p_marital_status => l_marital_status
2467 ,p_middle_names => l_middle_name
2468 ,p_suffix => l_name_suffix
2469 ,p_person_id => l_person_id
2470 ,p_assignment_id => l_assignment_id
2471 ,p_application_id => l_application_id
2472 ,p_per_object_version_number => l_per_object_version_number
2473 ,p_asg_object_version_number => l_asg_object_version_number
2474 ,p_apl_object_version_number => l_object_version_number_d
2475 ,p_per_effective_start_date => l_effective_start_date
2476 ,p_per_effective_end_date => l_effective_end_date
2477 ,p_full_name => l_full_name
2478 ,p_per_comment_id => l_comment_id
2479 ,p_assignment_sequence => l_assignment_sequence
2480 ,p_name_combination_warning => l_name_combination_warning
2481 ,p_orig_hire_warning => l_orig_hire_warning
2482 ,p_party_id => l_party_id
2483 );
2484 else
2485 hr_applicant_api.create_applicant
2486 (p_validate => false
2487 ,p_date_received => l_application_received_date
2488 ,p_business_group_id => l_business_group_id
2489 ,p_last_name => l_last_name
2490 ,p_first_name => l_first_name
2491 ,p_date_of_birth => l_date_of_birth
2492 ,p_applicant_number => l_applicant_number
2493 ,p_previous_last_name => l_previous_last_name
2494 ,p_known_as => l_known_as
2495 ,p_marital_status => l_marital_status
2496 ,p_middle_names => l_middle_name
2497 ,p_suffix => l_name_suffix
2498 ,p_person_id => l_person_id
2499 ,p_assignment_id => l_assignment_id
2500 ,p_application_id => l_application_id
2501 ,p_per_object_version_number => l_per_object_version_number
2502 ,p_asg_object_version_number => l_asg_object_version_number
2503 ,p_apl_object_version_number => l_object_version_number_d
2504 ,p_per_effective_start_date => l_effective_start_date
2505 ,p_per_effective_end_date => l_effective_end_date
2506 ,p_full_name => l_full_name
2507 ,p_per_comment_id => l_comment_id
2508 ,p_assignment_sequence => l_assignment_sequence
2509 ,p_name_combination_warning => l_name_combination_warning
2510 ,p_orig_hire_warning => l_orig_hire_warning
2511 ,p_party_id => l_party_id
2512 );
2513 end if;
2514 --
2515 -- get the PTU person type for iRecruitment Candidate
2516 --
2517 l_ptu_person_type_id:=hr_person_type_usage_info.get_default_person_type_id
2518 (l_business_group_id,
2519 'IRC_REG_USER');
2520 --
2521 -- create the extra PTU entry for iRecruitment Candidate
2522 --
2523 hr_per_type_usage_internal.maintain_person_type_usage
2524 (p_effective_date => l_effective_start_date
2525 ,p_person_id => l_person_id
2526 ,p_person_type_id => l_ptu_person_type_id
2527 );
2528 hr_utility.set_location(l_proc, 45);
2529 --
2530 hr_assignment_api.update_apl_asg
2531 (p_effective_date => l_application_received_date
2532 ,p_datetrack_update_mode => 'CORRECTION'
2533 ,p_assignment_id => l_assignment_id
2534 ,p_object_version_number => l_asg_object_version_number
2535 ,p_vacancy_id => p_vacancy_id
2536 ,p_posting_content_id => p_posting_content_id
2537 ,p_organization_id => nvl(l_organization_id,l_business_group_id)
2538 ,p_job_id => l_job_id
2539 ,p_position_id => l_position_id
2540 ,p_grade_id => l_grade_id
2541 ,p_people_group_id => l_people_group_id
2542 ,p_location_id => l_location_id
2543 ,p_recruiter_id => l_recruiter_id
2544 ,p_supervisor_id => l_manager_id
2545 ,p_concatenated_segments => l_concatenated_segments
2546 ,p_cagr_grade_def_id => l_cagr_grade_def_id
2547 ,p_cagr_concatenated_segments=> l_cagr_concatenated_segments
2548 ,p_group_name => l_group_name
2549 ,p_comment_id => l_comment_id
2550 ,p_soft_coding_keyflex_id => l_soft_coding_keyflex_id
2551 ,p_effective_start_date => l_effective_start_date
2552 ,p_effective_end_date => l_effective_end_date
2553 );
2554 end if;
2555 close csr_person_id;
2556 --
2557 -- Call After Process User Hook
2558 --
2559 begin
2560 irc_party_bk3.registered_user_application_a
2561 (
2562 p_effective_date => l_effective_date
2563 ,p_person_id => p_person_id
2564 ,p_applicant_number => l_applicant_number
2565 ,p_application_received_date => l_application_received_date
2566 ,p_vacancy_id => p_vacancy_id
2567 ,p_posting_content_id => p_posting_content_id
2568 ,p_assignment_id => l_assignment_id
2569 ,p_asg_object_version_number => l_asg_object_version_number
2570 );
2571 exception
2572 when hr_api.cannot_find_prog_unit then
2573 hr_api.cannot_find_prog_unit_error
2574 (p_module_name => 'REGISTERED_USER_APPLICATION'
2575 ,p_hook_type => 'AP'
2576 );
2577 end;
2578 --
2579 -- When IN validation only mode raise the Validate_Enabled exception
2580 --
2581 if p_validate then
2582 raise hr_api.validate_enabled;
2583 end if;
2584 --
2585 -- Set all output arguments
2586 --
2587 p_asg_object_version_number := l_asg_object_version_number;
2588 p_per_object_version_number := l_per_object_version_number;
2589 p_applicant_number := l_applicant_number;
2590 --
2591 hr_utility.set_location(' Leaving:'||l_proc, 70);
2592
2593 exception
2594 when hr_api.validate_enabled then
2595 --
2596 -- As the Validate_Enabled exception has been raised
2597 -- we must rollback to the savepoint
2598 --
2599 rollback to REGISTERED_USER_APPLICATION;
2600 --
2601 -- Only set output warning arguments
2602 -- (Any key or derived arguments must be set to null
2603 -- when validation only mode is beINg used.)
2604 --
2605 p_asg_object_version_number := null;
2606 p_per_object_version_number := null;
2607 hr_utility.set_location(' Leaving:'||l_proc, 80);
2608 when others then
2609 --
2610 -- A validation or unexpected error has occured
2611 --
2612
2613 -- Check whether csr_person_id is open or not. If open, close it.
2614
2615 if csr_person_id%isopen then
2616 close csr_person_id;
2617 end if;
2618
2619 rollback to REGISTERED_USER_APPLICATION;
2620 --
2621 p_asg_object_version_number := null;
2622 p_per_object_version_number := null;
2623 --
2624 hr_utility.set_location(' Leaving:'||l_proc, 90);
2625 raise;
2626 end registered_user_application;
2627 -- -------------------------------------------------------------------------
2628 -- |------------------------< grant_access >-------------------------------|
2629 -- -------------------------------------------------------------------------
2630 procedure grant_access
2631 (p_user_name IN varchar2
2632 ,p_user_id IN number
2633 ,p_menu_id IN number
2634 ,p_resp_id IN number
2635 ,p_resp_appl_id IN number
2636 ,p_sec_group_id IN number
2637 ,p_grant_name IN varchar2
2638 ,p_description IN varchar2 default null
2639 ) is
2640 srowId VARCHAR2(100);
2641 l_guid raw(16);
2642 begin
2643 select sys_guid() into l_guid from dual;
2644 fnd_grants_pkg.insert_row
2645 (
2646 X_ROWID => srowId,
2647 X_GRANT_GUID => l_guid,
2648 X_GRANTEE_TYPE => 'USER',
2649 X_GRANTEE_KEY => upper(p_user_name),
2650 X_MENU_ID => p_menu_id,
2651 X_START_DATE => trunc(sysdate),
2652 X_END_DATE => null,
2653 X_OBJECT_ID => '-1',
2654 X_INSTANCE_TYPE => 'GLOBAL',
2655 X_INSTANCE_SET_ID => null,
2656 X_INSTANCE_PK1_VALUE => '*NULL*',
2657 X_INSTANCE_PK2_VALUE => '*NULL*',
2658 X_INSTANCE_PK3_VALUE => '*NULL*',
2659 X_INSTANCE_PK4_VALUE => '*NULL*',
2660 X_INSTANCE_PK5_VALUE => '*NULL*',
2661 X_PROGRAM_NAME => 'IRC_API',
2662 X_PROGRAM_TAG => null,
2663 X_CREATION_DATE => sysdate,
2664 X_CREATED_BY => p_user_id,
2665 X_LAST_UPDATE_DATE => sysdate,
2666 X_LAST_UPDATED_BY => p_user_id,
2667 X_LAST_UPDATE_LOGIN => p_user_id,
2668 X_CTX_SECGRP_ID => p_sec_group_id,
2669 X_CTX_RESP_ID => p_resp_id,
2670 X_CTX_RESP_APPL_ID => p_resp_appl_id,
2671 X_NAME => p_grant_name,
2672 X_DESCRIPTION => p_description
2673 );
2674 end grant_access;
2675 --
2676 -- -------------------------------------------------------------------------
2677 -- |------------------------< create_user_internal >-----------------------|
2678 -- -------------------------------------------------------------------------
2679 --
2680 procedure create_user_internal
2681 (p_user_name IN varchar2
2682 ,p_password IN varchar2
2683 ,p_start_date IN date
2684 ,p_responsibility_id IN number
2685 ,p_resp_appl_id IN number
2686 ,p_security_group_id IN number
2687 ,p_email IN varchar2 default null
2688 ,p_language IN varchar2 default null
2689 ,p_last_name IN varchar2 default null
2690 ,p_first_name IN varchar2 default null
2691 ,p_allow_access IN varchar2 default null
2692 ,p_per_information_category IN varchar2 default null
2693 ,p_per_information1 IN varchar2 default null
2694 ,p_per_information2 IN varchar2 default null
2695 ,p_per_information3 IN varchar2 default null
2696 ,p_per_information4 IN varchar2 default null
2697 ,p_per_information5 IN varchar2 default null
2698 ,p_per_information6 IN varchar2 default null
2699 ,p_per_information7 IN varchar2 default null
2700 ,p_per_information8 IN varchar2 default null
2701 ,p_per_information9 IN varchar2 default null
2702 ,p_per_information10 IN varchar2 default null
2703 ,p_per_information11 IN varchar2 default null
2704 ,p_per_information12 IN varchar2 default null
2705 ,p_per_information13 IN varchar2 default null
2706 ,p_per_information14 IN varchar2 default null
2707 ,p_per_information15 IN varchar2 default null
2708 ,p_per_information16 IN varchar2 default null
2709 ,p_per_information17 IN varchar2 default null
2710 ,p_per_information18 IN varchar2 default null
2711 ,p_per_information19 IN varchar2 default null
2712 ,p_per_information20 IN varchar2 default null
2713 ,p_per_information21 IN varchar2 default null
2714 ,p_per_information22 IN varchar2 default null
2715 ,p_per_information23 IN varchar2 default null
2716 ,p_per_information24 IN varchar2 default null
2717 ,p_per_information25 IN varchar2 default null
2718 ,p_per_information26 IN varchar2 default null
2719 ,p_per_information27 IN varchar2 default null
2720 ,p_per_information28 IN varchar2 default null
2721 ,p_per_information29 IN varchar2 default null
2722 ,p_per_information30 IN varchar2 default null
2723 ) IS
2724 --
2725 PRAGMA autonomous_transaction;
2726 l_proc varchar2(72) := g_package||'create_user';
2727 l_person_id per_all_people_f.person_id%type;
2728 l_user_id number;
2729 l_profile_check boolean;
2730 l_user_name fnd_user.user_name%type;
2731 l_default_last_name per_all_people_f.last_name%type;
2732 l_effective_start_date date;
2733 l_effective_end_date date;
2734 l_sec_profile_assignment_id number;
2735 l_business_group_id number;
2736 l_sec_profile_id number;
2737 l_ovn number;
2738 l_menu_name varchar2(30);
2739 l_menu_id number;
2740 l_grant_name varchar2(80);
2741 --
2742 cursor get_menu_id (p_menu_name varchar2) is
2743 select menu_id from fnd_menus where menu_name=upper(p_menu_name);
2744 --
2745 begin
2746 hr_utility.set_location(' Entering: '||l_proc, 10);
2747 --
2748 -- Create Person
2749 l_default_last_name := nvl(p_last_name,fnd_message.get_string('PER','IRC_412108_UNKNOWN_NAME'));
2750
2751 irc_party_api.create_registered_user
2752 (p_last_name => l_default_last_name
2753 ,p_first_name => p_first_name
2754 ,p_email_address => p_email
2755 ,p_effective_start_date => l_effective_start_date
2756 ,p_effective_end_date => l_effective_end_date
2757 ,p_person_id => l_person_id
2758 ,p_allow_access => p_allow_access
2759 ,p_start_date => p_start_date
2760 ,p_per_information_category => p_per_information_category
2761 ,p_per_information1 => p_per_information1
2762 ,p_per_information2 => p_per_information2
2763 ,p_per_information3 => p_per_information3
2764 ,p_per_information4 => p_per_information4
2765 ,p_per_information5 => p_per_information5
2766 ,p_per_information6 => p_per_information6
2767 ,p_per_information7 => p_per_information7
2768 ,p_per_information8 => p_per_information8
2769 ,p_per_information9 => p_per_information9
2770 ,p_per_information10 => p_per_information10
2771 ,p_per_information11 => p_per_information11
2772 ,p_per_information12 => p_per_information12
2773 ,p_per_information13 => p_per_information13
2774 ,p_per_information14 => p_per_information14
2775 ,p_per_information15 => p_per_information15
2776 ,p_per_information16 => p_per_information16
2777 ,p_per_information17 => p_per_information17
2778 ,p_per_information18 => p_per_information18
2779 ,p_per_information19 => p_per_information19
2780 ,p_per_information20 => p_per_information20
2781 ,p_per_information21 => p_per_information21
2782 ,p_per_information22 => p_per_information22
2783 ,p_per_information23 => p_per_information23
2784 ,p_per_information24 => p_per_information24
2785 ,p_per_information25 => p_per_information25
2786 ,p_per_information26 => p_per_information26
2787 ,p_per_information27 => p_per_information27
2788 ,p_per_information28 => p_per_information28
2789 ,p_per_information29 => p_per_information29
2790 ,p_per_information30 => p_per_information30
2791 );
2792
2793 --
2794 hr_utility.set_location(l_proc,20);
2795 --
2796 -- Create User and set person_id to employee_id
2797 --
2798 l_user_id := fnd_user_pkg.CreateUserId (
2799 x_user_name => p_user_name,
2800 x_owner => 'CUST',
2801 x_unencrypted_password => p_password,
2802 x_email_address => p_email,
2803 x_employee_id => l_person_id,
2804 x_password_date => trunc(sysdate));
2805 --
2806 hr_utility.set_location(l_proc,30);
2807 --
2808 -- set the language profile option
2809 --
2810 l_profile_check := fnd_profile.save (
2811 x_name => 'ICX_LANGUAGE',
2812 x_value => p_language,
2813 x_level_name => 'USER',
2814 x_level_value => l_user_id );
2815 --
2816 hr_utility.set_location(l_proc,40);
2817 --
2818 --
2819 -- add the appropriate responsibility
2820 --
2821 fnd_user_resp_groups_api.Insert_Assignment
2822 (user_id => l_user_id
2823 ,responsibility_id => p_responsibility_id
2824 ,responsibility_application_id => p_resp_appl_id
2825 ,security_group_id => p_security_group_id
2826 ,start_date => trunc(sysdate)
2827 ,end_date => null
2828 ,description => ' ' -- ### description was supposed to default
2829 -- to null... but does not look like it has
2830 );
2831 hr_utility.set_location(l_proc,50);
2832 --
2833 -- look to see if we are using multiple security groups
2834 --
2835 if (fnd_profile.value('ENABLE_SECURITY_GROUPS')='Y') then
2836 hr_utility.set_location(l_proc,60);
2837 l_sec_profile_id:=fnd_profile.value_specific
2838 (name=>'PER_SECURITY_PROFILE_ID'
2839 ,user_id=>l_user_id
2840 ,responsibility_id=>p_responsibility_id
2841 ,application_id=>p_resp_appl_id);
2842 l_business_group_id:=fnd_profile.value_specific
2843 (name=>'PER_BUSINESS_GROUP_ID'
2844 ,user_id=>l_user_id
2845 ,responsibility_id=>p_responsibility_id
2846 ,application_id=>p_resp_appl_id);
2847 --
2848 hr_utility.set_location(l_proc,70);
2849 per_sec_profile_asg_api.create_security_profile_asg
2850 (p_sec_profile_assignment_id => l_sec_profile_assignment_id
2851 ,p_user_id => l_user_id
2852 ,p_security_group_id => p_security_group_id
2853 ,p_business_group_id => l_business_group_id
2854 ,p_security_profile_id => l_sec_profile_id
2855 ,p_responsibility_id => p_responsibility_id
2856 ,p_responsibility_application_i => p_resp_appl_id
2857 ,p_start_date => trunc(sysdate)
2858 ,p_object_version_number => l_ovn
2859 );
2860 end if;
2861 hr_utility.set_location(l_proc,90);
2862 --
2863 -- Assign the grant to the User
2864 --
2865 l_menu_name:=fnd_profile.value_specific
2866 (name=>'IRC_CANDIDATE_PSET'
2867 ,user_id=>l_user_id
2868 ,responsibility_id=>p_responsibility_id
2869 ,application_id=>p_resp_appl_id);
2870
2871 open get_menu_id(l_menu_name);
2872 fetch get_menu_id into l_menu_id;
2873 close get_menu_id;
2874
2875 if l_menu_id is not null then
2876 if length(p_user_name) > 65 then
2877 l_grant_name := 'IRC_'||substr(p_user_name,1,65)||'_CAND_GRANT';
2878 else
2879 l_grant_name := 'IRC_'||upper(p_user_name)||'_CAND_GRANT';
2880 end if;
2881 irc_party_api.grant_access(p_user_name=> p_user_name,
2882 p_user_id=> l_user_id,
2883 p_menu_id=> l_menu_id,
2884 p_resp_id=> p_responsibility_id,
2885 p_resp_appl_id=> p_resp_appl_id,
2886 p_sec_group_id=> p_security_group_id,
2887 p_grant_name=> l_grant_name,
2888 p_description=>' ');
2889 end if;
2890 hr_utility.set_location(l_proc,100);
2891 --
2892 -- commit autonomous transaction
2893 --
2894 commit;
2895 --
2896 hr_utility.set_location(' Leaving:'||l_proc, 110);
2897 end create_user_internal;
2898 --
2899 -- -------------------------------------------------------------------------
2900 -- |------------------------< create_user >--------------------------------|
2901 -- -------------------------------------------------------------------------
2902 --
2903 procedure create_user
2904 (p_user_name IN varchar2
2905 ,p_password IN varchar2
2906 ,p_start_date IN date
2907 ,p_responsibility_id IN number
2908 ,p_resp_appl_id IN number
2909 ,p_security_group_id IN number
2910 ,p_email IN varchar2 default null
2911 ,p_language IN varchar2 default null
2912 ,p_last_name IN varchar2 default null
2913 ,p_first_name IN varchar2 default null
2914 ,p_allow_access IN varchar2 default null
2915 ,p_per_information_category IN varchar2 default null
2916 ,p_per_information1 IN varchar2 default null
2917 ,p_per_information2 IN varchar2 default null
2918 ,p_per_information3 IN varchar2 default null
2919 ,p_per_information4 IN varchar2 default null
2920 ,p_per_information5 IN varchar2 default null
2921 ,p_per_information6 IN varchar2 default null
2922 ,p_per_information7 IN varchar2 default null
2923 ,p_per_information8 IN varchar2 default null
2924 ,p_per_information9 IN varchar2 default null
2925 ,p_per_information10 IN varchar2 default null
2926 ,p_per_information11 IN varchar2 default null
2927 ,p_per_information12 IN varchar2 default null
2928 ,p_per_information13 IN varchar2 default null
2929 ,p_per_information14 IN varchar2 default null
2930 ,p_per_information15 IN varchar2 default null
2931 ,p_per_information16 IN varchar2 default null
2932 ,p_per_information17 IN varchar2 default null
2933 ,p_per_information18 IN varchar2 default null
2934 ,p_per_information19 IN varchar2 default null
2935 ,p_per_information20 IN varchar2 default null
2936 ,p_per_information21 IN varchar2 default null
2937 ,p_per_information22 IN varchar2 default null
2938 ,p_per_information23 IN varchar2 default null
2939 ,p_per_information24 IN varchar2 default null
2940 ,p_per_information25 IN varchar2 default null
2941 ,p_per_information26 IN varchar2 default null
2942 ,p_per_information27 IN varchar2 default null
2943 ,p_per_information28 IN varchar2 default null
2944 ,p_per_information29 IN varchar2 default null
2945 ,p_per_information30 IN varchar2 default null
2946 ) IS
2947 --
2948 l_password_check varchar2(1);
2949 l_password_change_check varchar2(1);
2950 l_allow_access irc_notification_preferences.allow_access%type;
2951 l_start_date date;
2952 cursor get_nls_language is
2953 select nls_language
2954 from fnd_languages
2955 where language_code=p_language;
2956 --
2957 l_nls_language fnd_languages.nls_language%type;
2958 --
2959 begin
2960 --
2961 -- Truncate time portion from date
2962 --
2963 l_start_date := trunc(p_start_date);
2964 --
2965 -- default Allow Access if input value is NULL
2966 --
2967 l_allow_access := nvl(p_allow_access,nvl(fnd_profile.value('IRC_VISIBLE_PREF_DEFAULT'),'N'));
2968 --
2969 -- Call Before Process User Hook
2970 --
2971 begin
2972 irc_party_bk4.create_user_b
2973 (
2974 p_user_name => p_user_name
2975 ,p_password => p_password
2976 ,p_start_date => l_start_date
2977 ,p_email => p_email
2978 ,p_language => p_language
2979 ,p_last_name => p_last_name
2980 ,p_first_name => p_first_name
2981 ,p_allow_access => l_allow_access
2982 ,p_per_information_category => p_per_information_category
2983 ,p_per_information1 => p_per_information1
2984 ,p_per_information2 => p_per_information2
2985 ,p_per_information3 => p_per_information3
2986 ,p_per_information4 => p_per_information4
2987 ,p_per_information5 => p_per_information5
2988 ,p_per_information6 => p_per_information6
2989 ,p_per_information7 => p_per_information7
2990 ,p_per_information8 => p_per_information8
2991 ,p_per_information9 => p_per_information9
2992 ,p_per_information10 => p_per_information10
2993 ,p_per_information11 => p_per_information11
2994 ,p_per_information12 => p_per_information12
2995 ,p_per_information13 => p_per_information13
2996 ,p_per_information14 => p_per_information14
2997 ,p_per_information15 => p_per_information15
2998 ,p_per_information16 => p_per_information16
2999 ,p_per_information17 => p_per_information17
3000 ,p_per_information18 => p_per_information18
3001 ,p_per_information19 => p_per_information19
3002 ,p_per_information20 => p_per_information20
3003 ,p_per_information21 => p_per_information21
3004 ,p_per_information22 => p_per_information22
3005 ,p_per_information23 => p_per_information23
3006 ,p_per_information24 => p_per_information24
3007 ,p_per_information25 => p_per_information25
3008 ,p_per_information26 => p_per_information26
3009 ,p_per_information27 => p_per_information27
3010 ,p_per_information28 => p_per_information28
3011 ,p_per_information29 => p_per_information29
3012 ,p_per_information30 => p_per_information30
3013 );
3014 exception
3015 when hr_api.cannot_find_prog_unit then
3016 hr_api.cannot_find_prog_unit_error
3017 (p_module_name => 'CREATE_USER'
3018 ,p_hook_type => 'BP'
3019 );
3020 end;
3021 --
3022 -- get NLS_LANGUAGE
3023 --
3024 open get_nls_language;
3025 fetch get_nls_language into l_nls_language;
3026 if get_nls_language%notfound then
3027 close get_nls_language;
3028 l_nls_language:=p_language;
3029 else
3030 close get_nls_language;
3031 end if;
3032 --
3033 -- Validate the password
3034 --
3035 l_password_check := fnd_web_sec.validate_password(username => p_user_name
3036 ,password => p_password);
3037
3038 if (l_password_check = 'N') then
3039 fnd_message.raise_error;
3040 end if;
3041 --
3042 -- create party and user
3043 --
3044 irc_party_api.create_user_internal(p_user_name => p_user_name
3045 ,p_password => p_password
3046 ,p_start_date => l_start_date
3047 ,p_email => p_email
3048 ,p_responsibility_id => p_responsibility_id
3049 ,p_resp_appl_id => p_resp_appl_id
3050 ,p_security_group_id => p_security_group_id
3051 ,p_language => l_nls_language
3052 ,p_last_name => p_last_name
3053 ,p_first_name => p_first_name
3054 ,p_allow_access => l_allow_access
3055 ,p_per_information_category => p_per_information_category
3056 ,p_per_information1 => p_per_information1
3057 ,p_per_information2 => p_per_information2
3058 ,p_per_information3 => p_per_information3
3059 ,p_per_information4 => p_per_information4
3060 ,p_per_information5 => p_per_information5
3061 ,p_per_information6 => p_per_information6
3062 ,p_per_information7 => p_per_information7
3063 ,p_per_information8 => p_per_information8
3064 ,p_per_information9 => p_per_information9
3065 ,p_per_information10 => p_per_information10
3066 ,p_per_information11 => p_per_information11
3067 ,p_per_information12 => p_per_information12
3068 ,p_per_information13 => p_per_information13
3069 ,p_per_information14 => p_per_information14
3070 ,p_per_information15 => p_per_information15
3071 ,p_per_information16 => p_per_information16
3072 ,p_per_information17 => p_per_information17
3073 ,p_per_information18 => p_per_information18
3074 ,p_per_information19 => p_per_information19
3075 ,p_per_information20 => p_per_information20
3076 ,p_per_information21 => p_per_information21
3077 ,p_per_information22 => p_per_information22
3078 ,p_per_information23 => p_per_information23
3079 ,p_per_information24 => p_per_information24
3080 ,p_per_information25 => p_per_information25
3081 ,p_per_information26 => p_per_information26
3082 ,p_per_information27 => p_per_information27
3083 ,p_per_information28 => p_per_information28
3084 ,p_per_information29 => p_per_information29
3085 ,p_per_information30 => p_per_information30
3086 );
3087 --
3088 -- Call After Process User Hook
3089 --
3090 begin
3091 irc_party_bk4.create_user_a
3092 (
3093 p_user_name => p_user_name
3094 ,p_password => p_password
3095 ,p_start_date => l_start_date
3096 ,p_email => p_email
3097 ,p_language => p_language
3098 ,p_last_name => p_last_name
3099 ,p_first_name => p_first_name
3100 ,p_allow_access => l_allow_access
3101 ,p_per_information_category => p_per_information_category
3102 ,p_per_information1 => p_per_information1
3103 ,p_per_information2 => p_per_information2
3104 ,p_per_information3 => p_per_information3
3105 ,p_per_information4 => p_per_information4
3106 ,p_per_information5 => p_per_information5
3107 ,p_per_information6 => p_per_information6
3108 ,p_per_information7 => p_per_information7
3109 ,p_per_information8 => p_per_information8
3110 ,p_per_information9 => p_per_information9
3111 ,p_per_information10 => p_per_information10
3112 ,p_per_information11 => p_per_information11
3113 ,p_per_information12 => p_per_information12
3114 ,p_per_information13 => p_per_information13
3115 ,p_per_information14 => p_per_information14
3116 ,p_per_information15 => p_per_information15
3117 ,p_per_information16 => p_per_information16
3118 ,p_per_information17 => p_per_information17
3119 ,p_per_information18 => p_per_information18
3120 ,p_per_information19 => p_per_information19
3121 ,p_per_information20 => p_per_information20
3122 ,p_per_information21 => p_per_information21
3123 ,p_per_information22 => p_per_information22
3124 ,p_per_information23 => p_per_information23
3125 ,p_per_information24 => p_per_information24
3126 ,p_per_information25 => p_per_information25
3127 ,p_per_information26 => p_per_information26
3128 ,p_per_information27 => p_per_information27
3129 ,p_per_information28 => p_per_information28
3130 ,p_per_information29 => p_per_information29
3131 ,p_per_information30 => p_per_information30
3132 );
3133 exception
3134 when hr_api.cannot_find_prog_unit then
3135 hr_api.cannot_find_prog_unit_error
3136 (p_module_name => 'CREATE_USER'
3137 ,p_hook_type => 'AP'
3138 );
3139 end;
3140 --
3141 end create_user;
3142 --
3143 -- Function to encrypt a string using a specified key.
3144 --
3145 function encrypt
3146 (p_key in varchar2,
3147 p_value in varchar2)
3148 return varchar2
3149 as language java name 'oracle.apps.fnd.security.WebSessionManagerProc.encrypt(java.lang.String,java.lang.String) return
3150 java.lang.String';
3151 --
3152 -- Function to decrypt an encrypted string using a specified key.
3153 --
3154 function decrypt
3155 (p_key in varchar2,
3156 p_value in varchar2)
3157 return varchar2
3158 as language java name 'oracle.apps.fnd.security.WebSessionManagerProc.decrypt(java.lang.String,java.lang.String) return
3159 java.lang.String';
3160 --
3161 -- Returns the foundation password.
3162 --
3163 function get_foundation_password
3164 return varchar2
3165 is
3166 guestUserPwd varchar2(200);
3167 guestUserName varchar2(100);
3168 guestUserPwdOnly varchar2(100);
3169 guestFndPwd varchar2(100);
3170 delim number;
3171 bad_guest_user exception;
3172
3173 cursor get_pwd(p_guestUserName varchar2) is
3174 select encrypted_foundation_password
3175 from fnd_user
3176 where user_name = p_guestUserName
3177 and trunc(sysdate) between start_date and
3178 nvl(end_date,trunc(sysdate));
3179 --
3180 guestEncFndPwd fnd_user.encrypted_foundation_password%type;
3181 --
3182 begin
3183 --
3184 guestUserPwd := upper(FND_WEB_SEC.GET_GUEST_USERNAME_PWD());
3185 --
3186 delim := instr(guestUserPwd,'/');
3187 --
3188 if(delim = 0) then
3189 raise bad_guest_user;
3190 else
3191 guestUserName := upper(substr(guestUserPwd,1,delim-1));
3192 guestUserPwdOnly := upper(substr(guestUserPwd,delim+1));
3193 end if;
3194 --
3195 if(fnd_web_sec.validate_login(guestUserName,guestUserPwdOnly) = 'N') then
3196 raise bad_guest_user;
3197 end if;
3198 --
3199 open get_pwd(guestUserName);
3200 fetch get_pwd into guestEncFndPwd;
3201 close get_pwd;
3202 --
3203 guestFndPwd := decrypt(guestUserPwd,guestEncFndPwd);
3204 --
3205 if(guestFndPwd is null) then
3206 raise bad_guest_user;
3207 end if;
3208 --
3209 return guestFndPwd;
3210 --
3211 exception
3212 when others then
3213 fnd_message.set_encoded('MRP'||fnd_global.local_chr(0)||
3214 'GEN-INVALID PROFILE'||fnd_global.local_chr(0)||
3215 'N'||fnd_global.local_chr(0)||
3216 'PROFILE'||fnd_global.local_chr(0)||
3217 'GUEST_USER_PWD'||fnd_global.local_chr(0)||
3218 'N'||fnd_global.local_chr(0)||
3219 'VALUE'||fnd_global.local_chr(0)||
3220 guestUserPwd||fnd_global.local_chr(0));
3221 return null;
3222 end;
3223 --
3224 -- -------------------------------------------------------------------------
3225 -- |------------------------< update_user >--------------------------------|
3226 -- -------------------------------------------------------------------------
3227 --
3228 procedure update_user (
3229 p_user_name in varchar2,
3230 p_owner in varchar2,
3231 p_unencrypted_password in varchar2 default null,
3232 p_encrypted_user_password in varchar2 default null,
3233 p_session_number in number default null,
3234 p_start_date in date default null,
3235 p_end_date in date default null,
3236 p_last_logon_date in date default null,
3237 p_description in varchar2 default null,
3238 p_password_date in date default null,
3239 p_password_accesses_left in number default null,
3240 p_password_lifespan_accesses in number default null,
3241 p_password_lifespan_days in number default null,
3242 p_employee_id in number default null,
3243 p_email_address in varchar2 default null,
3244 p_fax in varchar2 default null,
3245 p_customer_id in number default null,
3246 p_supplier_id in number default null,
3247 p_old_password in varchar2 default null) is
3248 l_new_user_name fnd_user.user_name%type;
3249 l_current_email_address fnd_user.email_address%type;
3250 cursor csr_get_email(p_user_name varchar2) is
3251 select upper(email_address)
3252 from fnd_user
3253 where user_name = p_user_name;
3254 --
3255 begin
3256 -- get existing email address
3257 --
3258 open csr_get_email(p_user_name);
3259 fetch csr_get_email into l_current_email_address;
3260 close csr_get_email;
3261 --
3262 fnd_user_pkg.UpdateUser (
3263 x_user_name => p_user_name,
3264 x_owner => p_owner,
3265 x_unencrypted_password => p_unencrypted_password,
3266 x_session_number => p_session_number,
3267 x_start_date => p_start_date,
3268 x_end_date => p_end_date,
3269 x_last_logon_date => p_last_logon_date,
3270 x_description => p_description,
3271 x_password_date => p_password_date,
3272 x_password_accesses_left => p_password_accesses_left,
3273 x_password_lifespan_accesses => p_password_lifespan_accesses,
3274 x_password_lifespan_days => p_password_lifespan_days,
3275 x_employee_id => p_employee_id,
3276 x_email_address => p_email_address,
3277 x_fax => p_fax,
3278 x_customer_id => p_customer_id,
3279 x_supplier_id => p_supplier_id);
3280 --
3281 -- if email address is updated then update user_name
3282 -- if the existing user_name and email_address match
3283 --
3284 l_new_user_name := upper(p_email_address);
3285 if p_user_name <> l_new_user_name
3286 and l_current_email_address = p_user_name then
3287 fnd_user_pkg.change_user_name(p_user_name,l_new_user_name);
3288 end if;
3289 end update_user;
3290 -- -------------------------------------------------------------------------
3291 -- |------------------------< self_register_user >-------------------------|
3292 -- -------------------------------------------------------------------------
3293 --
3294 procedure self_register_user
3295 (p_validate IN boolean default false
3296 ,p_current_email_address IN varchar2
3297 ,p_responsibility_id IN number
3298 ,p_resp_appl_id IN number
3299 ,p_security_group_id IN number
3300 ,p_first_name IN varchar2 default null
3301 ,p_last_name IN varchar2 default null
3302 ,p_middle_names IN varchar2 default null
3303 ,p_previous_last_name IN varchar2 default null
3304 ,p_employee_number IN varchar2 default null
3305 ,p_national_identifier IN varchar2 default null
3306 ,p_date_of_birth IN date default null
3307 ,p_email_address IN varchar2 default null
3308 ,p_home_phone_number IN varchar2 default null
3309 ,p_work_phone_number IN varchar2 default null
3310 ,p_address_line_1 IN varchar2 default null
3311 ,p_manager_last_name IN varchar2 default null
3312 ,p_allow_access IN varchar2 default null
3313 ,p_language IN varchar2 default null
3314 ,p_user_name IN varchar2 default null
3315 ) is
3316
3317 cursor email_exists is
3318 select 1 from fnd_user
3319 where user_name=upper(p_current_email_address);
3320
3321 l_date_of_birth date;
3322
3323 cursor get_prev_emp is
3324 select per1.party_id,count(*)
3325 from per_all_people_f per1
3326 where per1.last_name=decode(p_last_name,NULL,per1.last_name,p_last_name)
3327 and (per1.first_name=nvl(p_first_name,per1.first_name)
3328 or (per1.first_name is null and p_first_name is null))
3329 and (per1.middle_names=nvl(p_middle_names,per1.middle_names)
3330 or (per1.middle_names is null and p_middle_names is null))
3331 and (per1.previous_last_name=nvl(p_previous_last_name,per1.previous_last_name)
3332 or (per1.previous_last_name is null and p_previous_last_name is null))
3333 and (per1.employee_number=nvl(p_employee_number,per1.employee_number)
3334 or (per1.employee_number is null and p_employee_number is null))
3335 and (per1.national_identifier=nvl(p_national_identifier,per1.national_identifier)
3336 or (per1.national_identifier is null and p_national_identifier is null))
3337 and (per1.date_of_birth=nvl(l_date_of_birth,per1.date_of_birth)
3338 or (per1.date_of_birth is null and p_date_of_birth is null))
3339 and (nvl(per1.email_address,p_email_address)=nvl(p_email_address,per1.email_address)
3340 or (per1.email_address is null and p_email_address is null))
3341 and (p_home_phone_number is null
3342 or exists (select 1 from per_phones phns
3343 where phns.parent_id=per1.person_id
3344 and phns.parent_table='PER_ALL_PEOPLE_F'
3345 and phns.phone_type in ('H1','H2','H3')
3346 and phns.phone_number = p_home_phone_number))
3347 and (p_work_phone_number is null
3348 or exists (select 1 from per_phones phns
3349 where phns.parent_id=per1.person_id
3350 and phns.parent_table='PER_ALL_PEOPLE_F'
3351 and phns.phone_type in ('W1','W2','W3')
3352 and phns.phone_number = p_work_phone_number))
3353 and (p_address_line_1 is null
3354 or exists (select 1 from per_addresses addr
3355 where addr.person_id=per1.person_id
3356 and addr.address_type in ('H','REC','HOME')))
3357 and (p_manager_last_name is null
3358 or exists (select 1 from per_all_people_f per2
3359 ,per_all_assignments_f asg2
3360 where asg2.person_id=per1.person_id
3361 and asg2.assignment_type in ('E','C')
3362 and asg2.supervisor_id=per2.person_id
3363 and asg2.effective_start_date between per2.effective_start_date and per2.effective_end_date
3364 and per2.last_name=p_manager_last_name))
3365 and exists(SELECT 1
3366 FROM per_person_types typ
3367 ,per_person_type_usages_f ptu
3368 WHERE typ.system_person_type = 'EX_EMP'
3369 AND typ.person_type_id = ptu.person_type_id
3370 AND sysdate BETWEEN ptu.effective_start_date
3371 AND ptu.effective_end_date
3372 AND ptu.person_id = per1.person_id)
3373 group by per1.party_id;
3374
3375 l_party_id number;
3376 l_count number;
3377 l_party_id2 number;
3378 l_count2 number;
3379
3380 cursor current_emp(p_party_id number) is
3381 select 1
3382 from per_all_people_f per1
3383 where per1.party_id=p_party_id
3384 and trunc(sysdate) between per1.effective_start_date and per1.effective_end_date
3385 and current_employee_flag='Y';
3386
3387 l_dummy number;
3388
3389 cursor in_reg_bg(p_party_id number) is
3390 select per1.person_id
3391 from per_all_people_f per1
3392 where per1.party_id=p_party_id
3393 and trunc(sysdate) between per1.effective_start_date and per1.effective_end_date
3394 and per1.business_group_id = fnd_profile.value('IRC_REGISTRATION_BG_ID');
3395
3396 l_person_id number;
3397
3398 cursor has_notification_prefs(p_party_id number) is
3399 select notif.person_id
3400 from irc_notification_preferences notif
3401 where notif.party_id=p_party_id;
3402
3403 l_notif_person_id number;
3404 l_object_version_number number;
3405 l_notification_preference_id number;
3406 l_search_criteria_id number;
3407
3408 cursor has_work_prefs(p_person_id number) is
3409 select prefs.object_id
3410 from irc_search_criteria prefs
3411 where prefs.object_id=p_person_id
3412 and prefs.object_type='WPREF';
3413
3414 cursor get_last_emp_rec(p_party_id number) is
3415 select per1.person_id
3416 from per_all_people_f per1
3417 where per1.party_id=p_party_id
3418 and per1.current_employee_flag='Y'
3419 and per1.effective_start_date<sysdate
3420 order by per1.effective_end_date desc;
3421
3422 cursor get_last_per_rec(p_party_id number) is
3423 select per1.person_id
3424 from per_all_people_f per1
3425 where per1.party_id=p_party_id
3426 and per1.effective_start_date<sysdate
3427 order by per1.effective_end_date desc;
3428
3429 cursor get_bg(p_person_id number) is
3430 select per1.business_group_id
3431 ,per1.object_version_number
3432 ,per1.employee_number
3433 ,per1.effective_start_date
3434 from per_all_people_f per1
3435 where per1.person_id=p_person_id
3436 and trunc(sysdate) between per1.effective_start_date and per1.effective_end_date;
3437
3438 l_person_ovn number;
3439 l_employee_number varchar2(255);
3440 l_business_group_id number;
3441 l_ptu_person_type_id number;
3442 l_person_start_date date;
3443 l_dt_mode varchar2(30);
3444
3445 cursor ptu_exists(p_person_id number,p_person_type_id number) is
3446 select 1 from per_person_type_usages_f ptuf
3447 where ptuf.person_id=p_person_id
3448 and ptuf.person_type_id=p_person_type_id
3449 and trunc(sysdate) between ptuf.effective_start_date and ptuf.effective_end_date;
3450
3451 cursor existing_emails(p_person_id number,p_party_id number) is
3452 select fusr.user_name
3453 from fnd_user fusr
3454 where fusr.employee_id=p_person_id
3455 union
3456 select fusr.user_name
3457 from fnd_user fusr
3458 where fusr.customer_id=p_party_id;
3459
3460 cursor user_association_exists(p_user_name varchar2) is
3461 select 1
3462 from fnd_user fusr
3463 where fusr.user_name=p_user_name
3464 and fusr.employee_id is not null;
3465
3466 cursor get_user_id(p_user_name varchar2) is
3467 select fusr.user_id
3468 from fnd_user fusr
3469 where fusr.user_name=p_user_name;
3470 --
3471 cursor get_menu_id (p_menu_name varchar2)is
3472 select menu_id from fnd_menus where menu_name=upper(p_menu_name);
3473 --
3474 l_user_id number;
3475 l_profile_check boolean;
3476 l_sec_profile_assignment_id number;
3477 l_business_group_id2 number;
3478 l_sec_profile_id number;
3479 l_password varchar2(30);
3480 l_effective_start_date date;
3481 l_effective_end_date date;
3482 l_full_name per_all_people_f.full_name%type;
3483 l_comment_id number;
3484 l_name_combination_warning boolean;
3485 l_assign_payroll_warning boolean;
3486 l_orig_hire_warning boolean;
3487 l_nid number;
3488 l_subject varchar2(32000);
3489 l_html_body varchar2(32000);
3490 l_text_body varchar2(32000);
3491 l_passchar varchar2(1);
3492 l_oldpasschar varchar2(1);
3493 l_num number;
3494 l_function_name varchar2(30);
3495 l_func_check varchar2(1);
3496 l_menu_name varchar2(30);
3497 l_menu_id number;
3498 l_grant_name varchar2(80);
3499 l_resp_exists boolean;
3500 l_allow_access irc_notification_preferences.allow_access%type;
3501 --
3502 cursor get_nls_language is
3503 select nls_language
3504 from fnd_languages
3505 where language_code=p_language;
3506 --
3507 l_nls_language fnd_languages.nls_language%type;
3508 --
3509 l_proc varchar2(72) := g_package||'self_register_user';
3510 --
3511 l_password_length number;
3512 l_min_password_length number := 8;
3513
3514 begin
3515
3516 hr_utility.set_location(' Entering: '||l_proc, 10);
3517 --
3518 -- Issue a savepoint
3519 --
3520 savepoint SELF_REGISTER_USER;
3521 --
3522 -- Truncate the time portion from all IN date parameters
3523 --
3524 l_date_of_birth := trunc(p_date_of_birth);
3525 --
3526 -- default Allow Access if input value is NULL
3527 --
3528 if p_allow_access is NULL then
3529 l_allow_access := nvl(fnd_profile.value_specific
3530 (name=>'IRC_VISIBLE_PREF_DEFAULT'
3531 ,responsibility_id=>p_responsibility_id
3532 ,application_id=>p_resp_appl_id), 'N');
3533 else
3534 l_allow_access := p_allow_access;
3535 end if;
3536 --
3537 -- Call Before Process User Hook
3538 --
3539 begin
3540 IRC_PARTY_BK6.SELF_REGISTER_USER_B
3541 (p_current_email_address => p_current_email_address
3542 ,p_responsibility_id => p_responsibility_id
3543 ,p_resp_appl_id => p_resp_appl_id
3544 ,p_security_group_id => p_security_group_id
3545 ,p_first_name => p_first_name
3546 ,p_last_name => p_last_name
3547 ,p_middle_names => p_middle_names
3548 ,p_previous_last_name => p_previous_last_name
3549 ,p_employee_number => p_employee_number
3550 ,p_national_identifier => p_national_identifier
3551 ,p_date_of_birth => l_date_of_birth
3552 ,p_email_address => p_email_address
3553 ,p_home_phone_number => p_home_phone_number
3554 ,p_work_phone_number => p_work_phone_number
3555 ,p_address_line_1 => p_address_line_1
3556 ,p_manager_last_name => p_manager_last_name
3557 ,p_allow_access => l_allow_access
3558 ,p_language => p_language
3559 ,p_user_name => p_user_name
3560 );
3561 exception
3562 when hr_api.cannot_find_prog_unit then
3563 hr_api.cannot_find_prog_unit_error
3564 (p_module_name => 'SELF_REGISTER_USER'
3565 ,p_hook_type => 'BP'
3566 );
3567 end;
3568 hr_utility.set_location(l_proc,20);
3569
3570 --
3571 -- Process Logic
3572 --
3573 if p_user_name is null then
3574 -- use the FND API to determine if a user exists with the same user name
3575 hr_utility.set_location(l_proc,23);
3576 l_num := TestUserName(p_user_name=>upper(p_current_email_address));
3577 if l_num <> 0 then
3578 -- the e-mail address is already in use. Raise an error
3579 fnd_message.set_name('PER','IRC_EXEMP_EMAIL_IN_USE');
3580 fnd_message.raise_error;
3581 end if;
3582 else
3583 hr_utility.set_location(l_proc,26);
3584 -- check if the user account is already associated to a person
3585 open user_association_exists(p_user_name);
3586 fetch user_association_exists into l_dummy;
3587 if user_association_exists%found then
3588 close user_association_exists;
3589 fnd_message.set_name('PER','IRC_EXEMP_PERSON_LINK_EXISTS');
3590 fnd_message.raise_error;
3591 else
3592 close user_association_exists;
3593 end if;
3594 end if;
3595 hr_utility.set_location(l_proc,30);
3596
3597 open get_prev_emp;
3598 fetch get_prev_emp into l_party_id,l_count;
3599 if get_prev_emp%notfound then
3600 -- we have not found a match at all, so error out
3601 close get_prev_emp;
3602 fnd_message.set_name('PER','IRC_EXEMP_NO_RECORD_FOUND');
3603 fnd_message.raise_error;
3604 end if;
3605 hr_utility.set_location(l_proc,40);
3606
3607 fetch get_prev_emp into l_party_id2,l_count2;
3608 if get_prev_emp%found then
3609 -- we have found more than one match, so error out
3610 close get_prev_emp;
3611 fnd_message.set_name('PER','IRC_EXEMP_MANY_RECORDS_FOUND');
3612 fnd_message.raise_error;
3613 end if;
3614 close get_prev_emp;
3615 hr_utility.set_location(l_proc,50);
3616
3617 -- we have only one match, so check their credentials.
3618 open current_emp(l_party_id);
3619 fetch current_emp into l_dummy;
3620 if current_emp%found then
3621 close current_emp;
3622 -- the person is a current employee, so error
3623 fnd_message.set_name('PER','IRC_EXEMP_CURRENT_EMP');
3624 fnd_message.raise_error;
3625 end if;
3626 close current_emp;
3627 hr_utility.set_location(l_proc,60);
3628
3629 -- the person is not a current employee, so good to go.
3630 -- look to see if they have any notification preferences already
3631 open has_notification_prefs(l_party_id);
3632 fetch has_notification_prefs into l_person_id;
3633 if has_notification_prefs%found then
3634 close has_notification_prefs;
3635 -- we have notification preferences already for this person, so use that as
3636 -- the primary person
3637 else
3638 close has_notification_prefs;
3639 hr_utility.set_location(l_proc,70);
3640 open in_reg_bg(l_party_id);
3641 fetch in_reg_bg into l_person_id;
3642 if in_reg_bg%found then
3643 close in_reg_bg;
3644 -- the person exists in the registration business group, so use that
3645 -- as the primary person record
3646 else
3647 close in_reg_bg;
3648 hr_utility.set_location(l_proc,80);
3649
3650 -- the person is not in the registration business group, look to
3651 -- find their last employee record
3652 open get_last_emp_rec(l_party_id);
3653 fetch get_last_emp_rec into l_person_id;
3654 if get_last_emp_rec%notfound then
3655 --could not find an old employee record, so find the last record
3656 close get_last_emp_rec;
3657 hr_utility.set_location(l_proc,90);
3658
3659 open get_last_per_rec(l_party_id);
3660 fetch get_last_per_rec into l_person_id;
3661 close get_last_per_rec;
3662 else
3663 close get_last_emp_rec;
3664 end if;
3665 end if;
3666 -- we have gone through all of the options, and found the best person_id
3667 -- for this person, so now create their notification preferences
3668 hr_utility.set_location(l_proc,100);
3669
3670 irc_notification_prefs_api.create_notification_prefs
3671 (p_validate=>false
3672 ,p_person_id =>l_person_id
3673 ,p_effective_date=>trunc(sysdate)
3674 ,p_notification_preference_id=>l_notification_preference_id
3675 ,p_object_version_number =>l_object_version_number
3676 ,p_allow_access => l_allow_access);
3677
3678 end if;
3679 hr_utility.set_location(l_proc,110);
3680
3681 -- look for work preferences for the person
3682 open has_work_prefs(l_person_id);
3683 fetch has_work_prefs into l_dummy;
3684 if has_work_prefs%notfound then
3685 -- no work preferences, so create some
3686 close has_work_prefs;
3687 --
3688 hr_utility.set_location(l_proc,120);
3689
3690 irc_search_criteria_api.create_work_choices
3691 (p_validate=>false
3692 ,p_effective_date=>trunc(sysdate)
3693 ,p_person_id =>l_person_id
3694 ,p_employee=>'Y'
3695 ,p_contractor=>'Y'
3696 ,p_object_version_number=>l_object_version_number
3697 ,p_search_criteria_id=>l_search_criteria_id);
3698 else
3699 close has_work_prefs;
3700 end if;
3701
3702 -- get the PTU person type for iRecruitment Candidate
3703 --
3704 hr_utility.set_location(l_proc,130);
3705 --
3706 open get_bg(l_person_id);
3707 fetch get_bg into l_business_group_id
3708 ,l_person_ovn
3709 ,l_employee_number
3710 ,l_person_start_date;
3711 close get_bg;
3712
3713 l_ptu_person_type_id:=hr_person_type_usage_info.get_default_person_type_id
3714 (l_business_group_id,
3715 'IRC_REG_USER');
3716 open ptu_exists(l_person_id,l_ptu_person_type_id);
3717 fetch ptu_exists into l_dummy;
3718 if ptu_exists%notfound then
3719 close ptu_exists;
3720 hr_utility.set_location(l_proc,140);
3721
3722 hr_per_type_usage_internal.maintain_person_type_usage
3723 (p_effective_date => trunc(sysdate)
3724 ,p_person_id => l_person_id
3725 ,p_person_type_id => l_ptu_person_type_id
3726 );
3727 else
3728 close ptu_exists;
3729 end if;
3730 --
3731 -- close off the old user accounts for this person
3732 --
3733 hr_utility.set_location(l_proc,150);
3734
3735 for user_rec in existing_emails(l_person_id,l_party_id) loop
3736 fnd_user_pkg.disableUser(user_rec.user_name);
3737 end loop;
3738 --
3739 -- Get the Password Length from the profile
3740 --
3741 begin
3742 if fnd_profile.value('SIGNON_PASSWORD_LENGTH') is not null then
3743 l_password_length := fnd_profile.value('SIGNON_PASSWORD_LENGTH');
3744 else
3745 l_password_length := l_min_password_length;
3746 end if;
3747 exception
3748 when others then
3749 l_password_length := l_min_password_length;
3750 end;
3751 --
3752 -- Ensure password length is minumum of 8
3753 --
3754 if ( l_password_length < l_min_password_length ) then
3755 l_password_length := l_min_password_length;
3756 end if;
3757 --
3758 --
3759 -- create the new user account
3760 --
3761 if p_user_name is null then
3762 l_oldpasschar:='A';
3763 loop
3764 --l_passchar:=dbms_random.string('U',1);
3765 -- the following line has an ATG CU3 dependency. If you need to update and
3766 -- release the patch before that, comment it out and replace with the line above
3767 --
3768 l_passchar:=fnd_crypto.RandomString(len=>1);
3769 if (l_passchar<>l_oldpasschar) then
3770 l_password:=l_password||l_passchar;
3771 l_oldpasschar:=l_passchar;
3772 end if;
3773 if length(l_password)=l_password_length then
3774 exit;
3775 end if;
3776 end loop;
3777 --l_password:=l_password||floor(dbms_random.value(0,9));
3778 -- the following line has an ATG CU3 dependency. If you need to update and
3779 -- release the patch before that, comment it out and replace with the line above
3780 --
3781 l_password:=l_password||mod(fnd_crypto.randomnumber,10);
3782
3783 hr_utility.set_location(l_proc,160);
3784
3785 l_user_id := fnd_user_pkg.CreateUserId (
3786 x_user_name => upper(p_current_email_address),
3787 x_owner => 'CUST',
3788 x_unencrypted_password => l_password,
3789 x_employee_id => l_person_id);
3790
3791 else
3792 -- associate the previous employee record to the fnd user
3793 hr_utility.set_location(l_proc,165);
3794 fnd_user_pkg.UpdateUser(
3795 x_user_name => p_user_name,
3796 x_owner => 'CUST',
3797 x_employee_id => l_person_id);
3798 -- get the user ID for the given user name
3799 open get_user_id(p_user_name);
3800 fetch get_user_id into l_user_id;
3801 close get_user_id;
3802 end if;
3803 --
3804 -- get NLS_LANGUAGE
3805 --
3806 open get_nls_language;
3807 fetch get_nls_language into l_nls_language;
3808 if get_nls_language%notfound then
3809 close get_nls_language;
3810 l_nls_language:=p_language;
3811 else
3812 close get_nls_language;
3813 end if;
3814
3815 -- set the language prefs if required
3816 if (p_language is not null) then
3817 l_profile_check := fnd_profile.save (
3818 x_name => 'ICX_LANGUAGE',
3819 x_value => l_nls_language,
3820 x_level_name => 'USER',
3821 x_level_value => l_user_id );
3822 end if;
3823 hr_utility.set_location(l_proc,170);
3824 -- If this is an existing user, check if he has the required responsibility
3825 if p_user_name is null then
3826 l_resp_exists := false;
3827 else
3828 hr_utility.set_location(l_proc,175);
3829 l_resp_exists := fnd_user_resp_groups_api.Assignment_Exists(l_user_id,
3830 p_responsibility_id, p_resp_appl_id, p_security_group_id);
3831 end if;
3832 -- if the User doesn't have the responsibility, assign it.
3833 if NOT l_resp_exists then
3834 --
3835 -- add the appropriate responsibility
3836 --
3837 fnd_user_resp_groups_api.Insert_Assignment
3838 (user_id => l_user_id
3839 ,responsibility_id => p_responsibility_id
3840 ,responsibility_application_id => p_resp_appl_id
3841 ,security_group_id => p_security_group_id
3842 ,start_date => trunc(sysdate)
3843 ,end_date => null
3844 ,description => ' ' -- ### description was supposed to default
3845 -- to null... but does not look like it has
3846 );
3847 hr_utility.set_location(l_proc,180);
3848 --
3849 -- look to see if we are using multiple security groups
3850 --
3851 if (fnd_profile.value('ENABLE_SECURITY_GROUPS')='Y') then
3852 hr_utility.set_location(l_proc,190);
3853 l_sec_profile_id:=fnd_profile.value_specific
3854 (name=>'PER_SECURITY_PROFILE_ID'
3855 ,user_id=>l_user_id
3856 ,responsibility_id=>p_responsibility_id
3857 ,application_id=>p_resp_appl_id);
3858 l_business_group_id2:=fnd_profile.value_specific
3859 (name=>'PER_BUSINESS_GROUP_ID'
3860 ,user_id=>l_user_id
3861 ,responsibility_id=>p_responsibility_id
3862 ,application_id=>p_resp_appl_id);
3863 --
3864 hr_utility.set_location(l_proc,200);
3865 per_sec_profile_asg_api.create_security_profile_asg
3866 (p_sec_profile_assignment_id => l_sec_profile_assignment_id
3867 ,p_user_id => l_user_id
3868 ,p_security_group_id => p_security_group_id
3869 ,p_business_group_id => l_business_group_id2
3870 ,p_security_profile_id => l_sec_profile_id
3871 ,p_responsibility_id => p_responsibility_id
3872 ,p_responsibility_application_i => p_resp_appl_id
3873 ,p_start_date => trunc(sysdate)
3874 ,p_object_version_number => l_object_version_number
3875 );
3876 end if;
3877 else
3878 hr_utility.set_location(l_proc, 205);
3879 --
3880 -- reopen the candidate responsibility
3881 --
3882 fnd_user_resp_groups_api.Update_Assignment
3883 (user_id => l_user_id
3884 ,responsibility_id => p_responsibility_id
3885 ,responsibility_application_id => p_resp_appl_id
3886 ,security_group_id => p_security_group_id
3887 ,start_date => trunc(sysdate)
3888 ,end_date => null
3889 ,description => ' ' -- ### description was supposed to default
3890 -- to null... but does not look like it has
3891 );
3892 -- REVISIT, what about Security Profile Assignment
3893 end if;
3894 --
3895 hr_utility.set_location(l_proc,210);
3896
3897 if trunc(sysdate)=l_person_start_date then
3898 l_dt_mode:='CORRECTION';
3899 else
3900 l_dt_mode:='UPDATE';
3901 end if;
3902 -- now update the person record to set the e-mail address
3903 hr_person_api.update_person
3904 (p_validate => false
3905 ,p_effective_date => trunc(sysdate)
3906 ,p_datetrack_update_mode => l_dt_mode
3907 ,p_person_id => l_person_id
3908 ,p_employee_number => l_employee_number
3909 ,p_email_address => p_current_email_address
3910 ,p_object_version_number => l_person_ovn
3911 ,p_effective_start_date => l_effective_start_date
3912 ,p_effective_end_date => l_effective_end_date
3913 ,p_full_name => l_full_name
3914 ,p_comment_id => l_comment_id
3915 ,p_name_combination_warning => l_name_combination_warning
3916 ,p_assign_payroll_warning => l_assign_payroll_warning
3917 ,p_orig_hire_warning => l_orig_hire_warning
3918 );
3919 --
3920 -- now send an e-mail to the user confirming that this has been done
3921 --
3922 hr_utility.set_location(l_proc,220);
3923
3924 l_nid:=wf_notification.send( upper(p_current_email_address)
3925 , fnd_profile.value('IRC_WORKFLOW_ITEM_TYPE')
3926 , 'IRC_TEXT_HTML_MSG'
3927 );
3928 --
3929 fnd_message.set_name('PER','IRC_EXEMP_SUBJECT');
3930 l_subject:=fnd_message.get;
3931 wf_notification.setAttrText ( l_nid , 'SUBJECT' , l_subject);
3932
3933 if p_user_name is null then
3934 fnd_message.set_name('PER','IRC_EXEMP_HTML');
3935 else
3936 fnd_message.set_name('PER','IRC_EXEMP_REGISTERED_HTML');
3937 end if;
3938 l_html_body:=fnd_message.get;
3939 if p_user_name is null then
3940 fnd_message.set_name('PER','IRC_EXEMP_HTML');
3941 else
3942 fnd_message.set_name('PER','IRC_EXEMP_REGISTERED_HTML');
3943 end if;
3944 if (instrb(l_html_body,'&'||'PASSWORD')>0) then
3945 fnd_message.set_token('PASSWORD', l_password);
3946 end if;
3947 if (instrb(l_html_body,'&'||'FIRST_NAME')>0) then
3948 fnd_message.set_token('FIRST_NAME', p_first_name);
3949 end if;
3950 if (instrb(l_html_body,'&'||'LAST_NAME')>0) then
3951 fnd_message.set_token('LAST_NAME', p_last_name);
3952 end if;
3953 if (instrb(l_html_body,'&'||'EMAIL')>0) then
3954 fnd_message.set_token('EMAIL', p_current_email_address);
3955 end if;
3956 if (instrb(l_html_body,'&'||'USER_NAME')>0) then
3957 fnd_message.set_token('USER_NAME', p_user_name);
3958 end if;
3959 l_html_body:=fnd_message.get;
3960 irc_notification_helper_pkg.set_v2_attributes
3961 (p_wf_attribute_value => l_html_body
3962 ,p_wf_attribute_name => 'HTML_BODY'
3963 ,p_nid => l_nid);
3964
3965 if p_user_name is null then
3966 fnd_message.set_name('PER','IRC_EXEMP_TEXT');
3967 else
3968 fnd_message.set_name('PER','IRC_EXEMP_REGISTERED_TEXT');
3969 end if;
3970 l_text_body:=fnd_message.get;
3971 if p_user_name is null then
3972 fnd_message.set_name('PER','IRC_EXEMP_TEXT');
3973 else
3974 fnd_message.set_name('PER','IRC_EXEMP_REGISTERED_TEXT');
3975 end if;
3976 if (instrb(l_text_body,'&'||'PASSWORD')>0) then
3977 fnd_message.set_token('PASSWORD', l_password);
3978 end if;
3979 if (instrb(l_text_body,'&'||'FIRST_NAME')>0) then
3980 fnd_message.set_token('FIRST_NAME', p_first_name);
3981 end if;
3982 if (instrb(l_text_body,'&'||'LAST_NAME')>0) then
3983 fnd_message.set_token('LAST_NAME', p_last_name);
3984 end if;
3985 if (instrb(l_text_body,'&'||'EMAIL')>0) then
3986 fnd_message.set_token('EMAIL', p_current_email_address);
3987 end if;
3988 if (instrb(l_text_body,'&'||'USER_NAME')>0) then
3989 fnd_message.set_token('USER_NAME', p_user_name);
3990 end if;
3991 l_text_body:=fnd_message.get;
3992 irc_notification_helper_pkg.set_v2_attributes
3993 (p_wf_attribute_value => l_text_body
3994 ,p_wf_attribute_name => 'TEXT_BODY'
3995 ,p_nid => l_nid);
3996 wf_notification.denormalize_notification(l_nid);
3997 hr_utility.set_location(l_proc,230);
3998 --
3999 -- Call After Process User Hook
4000 --
4001 begin
4002 IRC_PARTY_BK6.SELF_REGISTER_USER_A
4003 (p_current_email_address => p_current_email_address
4004 ,p_responsibility_id => p_responsibility_id
4005 ,p_resp_appl_id => p_resp_appl_id
4006 ,p_security_group_id => p_security_group_id
4007 ,p_first_name => p_first_name
4008 ,p_last_name => p_last_name
4009 ,p_middle_names => p_middle_names
4010 ,p_previous_last_name => p_previous_last_name
4011 ,p_employee_number => p_employee_number
4012 ,p_national_identifier => p_national_identifier
4013 ,p_date_of_birth => l_date_of_birth
4014 ,p_email_address => p_email_address
4015 ,p_home_phone_number => p_home_phone_number
4016 ,p_work_phone_number => p_work_phone_number
4017 ,p_address_line_1 => p_address_line_1
4018 ,p_manager_last_name => p_manager_last_name
4019 ,p_allow_access => l_allow_access
4020 ,p_language => p_language
4021 ,p_user_name => p_user_name
4022 );
4023 exception
4024 when hr_api.cannot_find_prog_unit then
4025 hr_api.cannot_find_prog_unit_error
4026 (p_module_name => 'SELF_REGISTER_USER'
4027 ,p_hook_type => 'AP'
4028 );
4029 end;
4030 --
4031 -- When IN validation only mode raise the Validate_Enabled exception
4032 --
4033 if p_validate then
4034 raise hr_api.validate_enabled;
4035 end if;
4036 hr_utility.set_location(' Leaving:'||l_proc, 240);
4037
4038 exception
4039 when hr_api.validate_enabled then
4040 --
4041 -- As the Validate_Enabled exception has been raised
4042 -- we must rollback to the savepoint
4043 --
4044 rollback to SELF_REGISTER_USER;
4045 --
4046 hr_utility.set_location(' Leaving:'||l_proc, 250);
4047 when others then
4048 --
4049 -- A validation or unexpected error has occured
4050 --
4051 rollback to SELF_REGISTER_USER;
4052 --
4053 --
4054 hr_utility.set_location(' Leaving:'||l_proc, 260);
4055 raise;
4056
4057 end self_register_user;
4058
4059 -- -------------------------------------------------------------------------
4060 -- |------------------------< create_partial_user >-------------------------|
4061 -- -------------------------------------------------------------------------
4062 --
4063 PROCEDURE create_partial_user
4064 (p_user_name IN varchar2
4065 ,p_start_date IN date default null
4066 ,p_email IN varchar2 default null
4067 ,p_language IN varchar2 default null
4068 ,p_last_name IN varchar2 default null
4069 ,p_first_name IN varchar2 default null
4070 ,p_reg_bg_id IN number
4071 ,p_responsibility_id IN number
4072 ,p_resp_appl_id IN number
4073 ,p_security_group_id IN number
4074 ,p_allow_access IN varchar2 default null
4075 )is
4076 --
4077 l_allow_access irc_notification_preferences.allow_access%type;
4078 l_start_date date;
4079 --
4080 cursor get_nls_language is
4081 select nls_language
4082 from fnd_languages
4083 where language_code=p_language;
4084 --
4085 l_user_id number;
4086 l_person_id number;
4087 l_person_party_id number;
4088 l_first_name per_all_people_f.first_name%type;
4089 l_last_name per_all_people_f.last_name%type;
4090 l_email_address per_all_people_f.email_address%type;
4091 l_default_last_name per_all_people_f.last_name%type;
4092 --
4093 cursor get_person_party_info is
4094 select user_id, employee_id, person_party_id
4095 from fnd_user
4096 where user_name=upper(p_user_name);
4097 --
4098 cursor get_email_address is
4099 select nvl(fu.email_address, hzp.email_address)
4100 from fnd_user fu, hz_parties hzp
4101 where user_name=upper(p_user_name)
4102 and fu.person_party_id=hzp.party_id(+);
4103 --
4104 cursor get_notif_prefs(p_party_id number) is
4105 select notification_preference_id
4106 from irc_notification_preferences
4107 where party_id=p_party_id;
4108 --
4109 cursor get_bg(p_person_id number) is
4110 select per1.business_group_id,per1.object_version_number,per1.employee_number
4111 ,per1.effective_start_date
4112 from per_all_people_f per1
4113 where per1.person_id=p_person_id
4114 and trunc(sysdate) between per1.effective_start_date and per1.effective_end_date;
4115 --
4116 cursor ptu_exists(p_person_id number,p_person_type_id number) is
4117 select 1 from per_person_type_usages_f ptuf
4118 where ptuf.person_id=p_person_id
4119 and ptuf.person_type_id=p_person_type_id
4120 and trunc(sysdate) between ptuf.effective_start_date and ptuf.effective_end_date;
4121 --
4122 cursor get_menu_id (p_menu_name varchar2)is
4123 select menu_id from fnd_menus where menu_name=upper(p_menu_name);
4124 --
4125 l_nls_language fnd_languages.nls_language%type;
4126 --
4127 --
4128 -- dummy variables
4129 --
4130 l_tmp_resp_id number;
4131 l_object_version_number per_all_people_f.object_version_number%type;
4132 l_effective_start_date per_all_people_f.effective_start_date%type;
4133 l_effective_end_date per_all_people_f.effective_end_date%type;
4134 l_new_person_id PER_ALL_PEOPLE_F.PERSON_ID%TYPE;
4135 l_profile_check boolean;
4136 l_search_criteria_id number;
4137 l_sc_ovn number;
4138 l_notif_preference_id number;
4139 l_notif_ovn number;
4140 l_per_type varchar2(100);
4141 l_sec_profile_assignment_id number;
4142 l_business_group_id number;
4143 l_sec_profile_id number;
4144 l_ovn number;
4145 l_ptu_person_type_id number;
4146 l_pers_business_group_id number;
4147 l_person_ovn number;
4148 l_employee_number varchar2(255);
4149 l_person_start_date date;
4150 l_dt_mode varchar2(30);
4151 l_full_name per_all_people_f.full_name%type;
4152 l_comment_id number;
4153 l_name_combination_warning boolean;
4154 l_assign_payroll_warning boolean;
4155 l_orig_hire_warning boolean;
4156 l_resp_exists boolean;
4157 l_dummy number;
4158 l_function_name varchar2(30);
4159 l_func_check varchar2(1);
4160 l_menu_name varchar2(30);
4161 l_menu_id number;
4162 l_grant_name varchar2(80);
4163 --
4164 l_proc varchar2(72) := g_package||'create_partial_user';
4165 --
4166 begin
4167 hr_utility.set_location(' Entering: '||l_proc, 10);
4168 --
4169 -- Truncate time portion from date
4170 --
4171 l_start_date := trunc(p_start_date);
4172 --
4173 -- get NLS_LANGUAGE
4174 --
4175 open get_nls_language;
4176 fetch get_nls_language into l_nls_language;
4177 if get_nls_language%notfound then
4178 close get_nls_language;
4179 l_nls_language:=p_language;
4180 else
4181 close get_nls_language;
4182 end if;
4183 --
4184 hr_utility.set_location(l_proc, 20);
4185 --
4186 -- default Allow Access if input value is NULL
4187 --
4188 l_allow_access := nvl(p_allow_access,nvl(fnd_profile.value('IRC_VISIBLE_PREF_DEFAULT'),'N'));
4189 --
4190 open get_person_party_info;
4191 fetch get_person_party_info into l_user_id, l_person_id, l_person_party_id;
4192 close get_person_party_info;
4193 --
4194 -- if input email address is not null, use it rather than one from fnd_user
4195 --
4196 if p_email is not null then
4197 l_email_address := p_email;
4198 else
4199 -- if input email is NULL, try getting it from FND_USER
4200 -- and if it is NULL try getting it from HZ_PARTIES
4201 -- and if that is NULL, use the UserName
4202 open get_email_address;
4203 fetch get_email_address into l_email_address;
4204 close get_email_address;
4205
4206 if l_email_address is null then
4207 l_email_address := p_user_name;
4208 end if;
4209 end if;
4210 --
4211 hr_utility.set_location(l_proc, 30);
4212 -- Disable Partial Registration for Employees
4213 -- we have to REVISIT after using UMX support for Registration
4214 if l_person_id is not null then
4215 l_per_type := irc_utilities_pkg.get_emp_spt_for_person(l_person_id, trunc(p_start_date));
4216 if (l_per_type = 'EMP') then
4217 fnd_message.set_name('PER','IRC_412224_EMP_PARTIAL_REG');
4218 fnd_message.raise_error;
4219 end if;
4220 end if;
4221 --
4222 hr_utility.set_location(l_proc, 40);
4223 -- there is no person attached to this FND_USER. We need to create a new
4224 -- iRecruitment Candidate, update FND user with the person_id,
4225 -- set Language profile and Create Work Preferences
4226 if l_person_id is NULL then
4227 l_default_last_name := nvl(p_last_name,fnd_message.get_string('PER','IRC_412108_UNKNOWN_NAME'));
4228
4229 IRC_PARTY_API.CREATE_CANDIDATE_INTERNAL
4230 (p_business_group_id => p_reg_bg_id
4231 ,p_last_name => l_default_last_name
4232 ,p_first_name => l_first_name
4233 ,p_email_address => l_email_address
4234 ,p_allow_access => l_allow_access
4235 ,p_effective_start_date => l_effective_start_date
4236 ,p_effective_end_date => l_effective_end_date
4237 ,p_person_id => l_person_id
4238 ,p_party_id => l_person_party_id
4239 ,p_start_date => l_start_date
4240 );
4241 --
4242 hr_utility.set_location(l_proc, 50);
4243 --
4244 fnd_user_pkg.UpdateUser
4245 (x_user_name => p_user_name
4246 ,x_owner => 'CUST'
4247 ,x_employee_id => l_person_id);
4248 --
4249 hr_utility.set_location(l_proc, 60);
4250 --
4251 l_profile_check := fnd_profile.save (
4252 x_name => 'ICX_LANGUAGE',
4253 x_value => l_nls_language,
4254 x_level_name => 'USER',
4255 x_level_value => l_user_id );
4256 --
4257 hr_utility.set_location(l_proc, 70);
4258 --
4259 -- create work preferences
4260 irc_search_criteria_api.create_work_choices
4261 (p_effective_date=>trunc(sysdate)
4262 ,p_person_id =>l_person_id
4263 ,p_employee=>'Y'
4264 ,p_contractor=>'Y'
4265 ,p_object_version_number=>l_sc_ovn
4266 ,p_search_criteria_id=>l_search_criteria_id);
4267 --
4268 hr_utility.set_location(l_proc, 80);
4269 else
4270 hr_utility.set_location(l_proc, 45);
4271 open get_bg(l_person_id);
4272 fetch get_bg into l_pers_business_group_id, l_person_ovn,
4273 l_employee_number,l_person_start_date;
4274 close get_bg;
4275 if trunc(sysdate)=l_person_start_date then
4276 l_dt_mode:='CORRECTION';
4277 else
4278 l_dt_mode:='UPDATE';
4279 end if;
4280 -- update the person record with the email address
4281 hr_person_api.update_person
4282 (p_validate => false
4283 ,p_effective_date => trunc(sysdate)
4284 ,p_datetrack_update_mode => l_dt_mode
4285 ,p_person_id => l_person_id
4286 ,p_object_version_number => l_person_ovn
4287 ,p_employee_number => l_employee_number
4288 ,p_email_address => l_email_address
4289 ,p_effective_start_date => l_effective_start_date
4290 ,p_effective_end_date => l_effective_end_date
4291 ,p_full_name => l_full_name
4292 ,p_comment_id => l_comment_id
4293 ,p_name_combination_warning => l_name_combination_warning
4294 ,p_assign_payroll_warning => l_assign_payroll_warning
4295 ,p_orig_hire_warning => l_orig_hire_warning
4296 );
4297 --
4298 l_ptu_person_type_id:=hr_person_type_usage_info.get_default_person_type_id
4299 (l_pers_business_group_id, 'IRC_REG_USER');
4300 if l_ptu_person_type_id is not null then
4301 open ptu_exists(l_person_id,l_ptu_person_type_id);
4302 fetch ptu_exists into l_dummy;
4303 if ptu_exists%notfound then
4304 close ptu_exists;
4305 hr_utility.set_location(l_proc,140);
4306 hr_per_type_usage_internal.maintain_person_type_usage
4307 (p_effective_date => trunc(sysdate)
4308 ,p_person_id => l_person_id
4309 ,p_person_type_id => l_ptu_person_type_id
4310 );
4311 else
4312 close ptu_exists;
4313 end if;
4314 end if;
4315 hr_utility.set_location(l_proc, 55);
4316 end if;
4317
4318 -- check if the Party has Notification preferences
4319 open get_notif_prefs(l_person_party_id);
4320 fetch get_notif_prefs into l_notif_preference_id;
4321 close get_notif_prefs;
4322
4323 -- create Notification Preferences if the Party doesn't have one
4324 if l_notif_preference_id is NULL then
4325 -- create doesn't take a party_id ?
4326 irc_notification_prefs_api.create_notification_prefs
4327 (p_person_id =>l_person_id
4328 ,p_effective_date=>trunc(sysdate)
4329 ,p_notification_preference_id=>l_notif_preference_id
4330 ,p_object_version_number =>l_notif_ovn
4331 ,p_allow_access => l_allow_access);
4332 end if;
4333 hr_utility.set_location(l_proc, 90);
4334 -- check if the User has the required responsibility
4335 l_resp_exists := fnd_user_resp_groups_api.Assignment_Exists(l_user_id,
4336 p_responsibility_id, p_resp_appl_id, p_security_group_id);
4337 -- if the User doesn't have the responsibility, assign it.
4338 if NOT l_resp_exists then
4339 --
4340 -- add the appropriate responsibility
4341 --
4342 fnd_user_resp_groups_api.Insert_Assignment
4343 (user_id => l_user_id
4344 ,responsibility_id => p_responsibility_id
4345 ,responsibility_application_id => p_resp_appl_id
4346 ,security_group_id => p_security_group_id
4347 ,start_date => trunc(sysdate)
4348 ,end_date => null
4349 ,description => ' ' -- ### description was supposed to default
4350 -- to null... but does not look like it has
4351 );
4352 hr_utility.set_location(l_proc, 100);
4353 --
4354 -- look to see if we are using multiple security groups
4355 --
4356 if (fnd_profile.value('ENABLE_SECURITY_GROUPS')='Y') then
4357 l_sec_profile_id:=fnd_profile.value_specific
4358 (name=>'PER_SECURITY_PROFILE_ID'
4359 ,user_id=>l_user_id
4360 ,responsibility_id=>p_responsibility_id
4361 ,application_id=>p_resp_appl_id);
4362 l_business_group_id:=fnd_profile.value_specific
4363 (name=>'PER_BUSINESS_GROUP_ID'
4364 ,user_id=>l_user_id
4365 ,responsibility_id=>p_responsibility_id
4366 ,application_id=>p_resp_appl_id);
4367 --
4368 per_sec_profile_asg_api.create_security_profile_asg
4369 (p_sec_profile_assignment_id => l_sec_profile_assignment_id
4370 ,p_user_id => l_user_id
4371 ,p_security_group_id => p_security_group_id
4372 ,p_business_group_id => l_business_group_id
4373 ,p_security_profile_id => l_sec_profile_id
4374 ,p_responsibility_id => p_responsibility_id
4375 ,p_responsibility_application_i => p_resp_appl_id
4376 ,p_start_date => trunc(sysdate)
4377 ,p_object_version_number => l_ovn
4378 );
4379 hr_utility.set_location(l_proc, 110);
4380 end if;
4381 else
4382 hr_utility.set_location(l_proc, 95);
4383 --
4384 -- reopen the candidate responsibility
4385 --
4386 fnd_user_resp_groups_api.Update_Assignment
4387 (user_id => l_user_id
4388 ,responsibility_id => p_responsibility_id
4389 ,responsibility_application_id => p_resp_appl_id
4390 ,security_group_id => p_security_group_id
4391 ,start_date => trunc(sysdate)
4392 ,end_date => null
4393 ,description => ' ' -- ### description was supposed to default
4394 -- to null... but does not look like it has
4395 );
4396 -- REVISIT, what about Security Profile Assignment
4397 end if;
4398 --
4399 -- check if User has access to Candidate Homepage function
4400 l_function_name:=fnd_profile.value_specific
4401 (name=>'IRC_HOME_PAGE_FUNCTION'
4402 ,user_id=>l_user_id
4403 ,responsibility_id=>p_responsibility_id
4404 ,application_id=>p_resp_appl_id);
4405 l_func_check := fnd_data_security.check_function(1.0,l_function_name,
4406 'GLOBAL',null,null,null,null,null,upper(p_user_name));
4407 -- if user doesn't have the access, create the Grant
4408 if l_func_check <> 'T' then
4409 l_menu_name:=fnd_profile.value_specific
4410 (name=>'IRC_CANDIDATE_PSET'
4411 ,user_id=>l_user_id
4412 ,responsibility_id=>p_responsibility_id
4413 ,application_id=>p_resp_appl_id);
4414 open get_menu_id(l_menu_name);
4415 fetch get_menu_id into l_menu_id;
4416 close get_menu_id;
4417
4418 if l_menu_id is not null then
4419 if length(p_user_name) > 65 then
4420 l_grant_name := 'IRC_'||substr(p_user_name,1,65)||'_CAND_GRANT';
4421 else
4422 l_grant_name := 'IRC_'||upper(p_user_name)||'_CAND_GRANT';
4423 end if;
4424 irc_party_api.grant_access(p_user_name=> p_user_name,
4425 p_user_id=> l_user_id,
4426 p_menu_id=> l_menu_id,
4427 p_resp_id=> p_responsibility_id,
4428 p_resp_appl_id=> p_resp_appl_id,
4429 p_sec_group_id=> p_security_group_id,
4430 p_grant_name=> l_grant_name,
4431 p_description=>' ');
4432 end if;
4433 end if;
4434 --
4435 hr_utility.set_location('Leaving'||l_proc, 120);
4436 --
4437 end create_partial_user;
4438 -- -------------------------------------------------------------------------
4439 -- |------------------------< irec_profile_exists >-------------------------|
4440 -- -------------------------------------------------------------------------
4441 FUNCTION irec_profile_exists
4442 (p_user_name IN varchar2
4443 ,p_reg_bg_id IN number
4444 ,p_responsibility_id IN number
4445 ,p_resp_appl_id IN number
4446 ,p_security_group_id IN number
4447 ) return VARCHAR2
4448 --
4449 is
4450 --
4451 l_user_id number;
4452 l_person_id number;
4453 l_person_party_id number;
4454 l_notif_preference_id number;
4455 l_tmp_resp_id number;
4456 l_ptu_person_type_id number;
4457 l_pers_business_group_id number;
4458 l_dummy number;
4459 l_function_name varchar2(30);
4460 l_func_check varchar2(1);
4461 --
4462 cursor get_person_party_info is
4463 select user_id, employee_id, person_party_id
4464 from fnd_user
4465 where user_name=upper(p_user_name);
4466 --
4467 cursor get_bg(p_person_id number) is
4468 select per1.business_group_id
4469 from per_all_people_f per1
4470 where per1.person_id=p_person_id
4471 and trunc(sysdate) between per1.effective_start_date and per1.effective_end_date;
4472 --
4473 cursor ptu_exists(p_person_id number,p_person_type_id number) is
4474 select 1 from per_person_type_usages_f ptuf
4475 where ptuf.person_id=p_person_id
4476 and ptuf.person_type_id=p_person_type_id
4477 and trunc(sysdate) between ptuf.effective_start_date and ptuf.effective_end_date;
4478 --
4479 cursor get_user_responsibility(p_user_id number, p_responsibility_id number,
4480 p_resp_appl_id number, p_security_group_id number) is
4481 select responsibility_id
4482 from fnd_user_resp_groups
4483 where user_id=p_user_id and responsibility_id=p_responsibility_id
4484 and responsibility_application_id = p_resp_appl_id
4485 and security_group_id = p_security_group_id;
4486 --
4487 cursor get_notif_prefs(p_party_id number) is
4488 select notification_preference_id
4489 from irc_notification_preferences
4490 where party_id=p_party_id;
4491 --
4492 l_proc varchar2(72) := g_package||'irec_profile_exists';
4493 --
4494 begin
4495 --
4496 hr_utility.set_location(' Entering: '||l_proc, 10);
4497 --
4498 open get_person_party_info;
4499 fetch get_person_party_info into l_user_id, l_person_id, l_person_party_id;
4500 close get_person_party_info;
4501
4502 if l_person_id is NULL then
4503 return 'NO_PROFILE';
4504 else
4505 if irc_utilities_pkg.is_internal_person(p_user_name,trunc(sysdate)) <> 'TRUE' then
4506 open get_bg(l_person_id);
4507 fetch get_bg into l_pers_business_group_id;
4508 close get_bg;
4509 l_ptu_person_type_id:=hr_person_type_usage_info.get_default_person_type_id
4510 (l_pers_business_group_id, 'IRC_REG_USER');
4511 hr_utility.set_location(l_proc, 15);
4512 -- if the person's BG doesn't have the iRecruitment Candidate defined
4513 -- ignore??
4514 if l_ptu_person_type_id is not null then
4515 open ptu_exists(l_person_id,l_ptu_person_type_id);
4516 fetch ptu_exists into l_dummy;
4517 if ptu_exists%notfound then
4518 close ptu_exists;
4519 return 'NO_PROFILE';
4520 else
4521 close ptu_exists;
4522 end if;
4523 end if;
4524 --
4525 hr_utility.set_location(l_proc, 20);
4526 --
4527 if l_person_party_id IS NOT NULL then
4528 -- check if the Party has Notification preferences
4529 open get_notif_prefs(l_person_party_id);
4530 fetch get_notif_prefs into l_notif_preference_id;
4531 close get_notif_prefs;
4532 -- check if ID is NULL
4533 if l_notif_preference_id is NULL then
4534 return 'NO_PROFILE';
4535 end if;
4536 else
4537 return 'NO_PROFILE';
4538 end if;
4539 end if;
4540 end if;
4541 hr_utility.set_location(l_proc, 30);
4542
4543 -- check if user has the Candidate Responsibility
4544 open get_user_responsibility(l_user_id, p_responsibility_id, p_resp_appl_id, p_security_group_id);
4545 fetch get_user_responsibility into l_tmp_resp_id;
4546 -- if the User doesn't have the responsibility, assign it.
4547 if get_user_responsibility%notfound then
4548 return 'NO_PROFILE';
4549 end if;
4550 close get_user_responsibility;
4551 -- check if User has access to Candidate Homepage function
4552 l_function_name:=fnd_profile.value_specific
4553 (name=>'IRC_HOME_PAGE_FUNCTION'
4554 ,user_id=>l_user_id
4555 ,responsibility_id=>p_responsibility_id
4556 ,application_id=>p_resp_appl_id);
4557 l_func_check := fnd_data_security.check_function(1.0,l_function_name,
4558 'GLOBAL',null,null,null,null,null,upper(p_user_name));
4559 -- if user doesn't have the access, create the Grant
4560 if l_func_check <> 'T' then
4561 return 'NO_PROFILE';
4562 end if;
4563 --
4564 hr_utility.set_location('Leaving: '||l_proc, 40);
4565
4566 return 'PROFILE_EXISTS';
4567 end irec_profile_exists;
4568 -- -------------------------------------------------------------------------
4569 -- |------------------------< create_ha_processed_user >--------------------|
4570 -- -------------------------------------------------------------------------
4571 PROCEDURE create_ha_processed_user
4572 (p_user_name IN varchar2
4573 ,p_password IN varchar2
4574 ,p_email IN varchar2
4575 ,p_start_date IN date
4576 ,p_last_name IN varchar2
4577 ,p_first_name IN varchar2
4578 ,p_user_guid IN RAW
4579 ,p_reg_bg_id IN number
4580 ,p_responsibility_id IN number
4581 ,p_resp_appl_id IN number
4582 ,p_security_group_id IN number
4583 ,p_language IN varchar2 default null
4584 ,p_allow_access IN varchar2 default null
4585 ,p_server_id IN varchar2 default null
4586 ) is
4587 l_user_id number;
4588 l_decrypted_password varchar2(100) := null;
4589 l_password_change_check varchar2(1);
4590 l_num number;
4591 l_bool boolean;
4592 l_found boolean;
4593 l_resp_exists boolean;
4594 l_business_group_id number;
4595 l_sec_profile_id number;
4596 l_ovn number;
4597 l_sec_profile_assignment_id number;
4598 password_update_failed exception;
4599 --
4600 l_proc varchar2(72) := g_package||'create_ha_processed_user';
4601
4602 begin
4603 --
4604 hr_utility.set_location(' Entering: '||l_proc, 10);
4605
4606 l_num := TestUserName(p_user_name=>p_user_name);
4607 -- creating a brand new user. This happens when SSO is not enabled and user
4608 -- registered on HA instance
4609 if l_num = 0 then
4610 hr_utility.set_location(' Entering: '||l_proc, 20);
4611 -- create the iRecruitment user with standard password
4612 irc_party_api.create_user(p_user_name => p_user_name,
4613 p_password => 'j3ke678to',
4614 p_start_date => p_start_date,
4615 p_responsibility_id => p_responsibility_id,
4616 p_resp_appl_id => p_resp_appl_id,
4617 p_security_group_id => p_security_group_id,
4618 p_last_name => p_last_name,
4619 p_first_name => p_first_name,
4620 p_email => p_email,
4621 p_allow_access => p_allow_access);
4622 hr_utility.set_location(' Entering: '||l_proc, 30);
4623 -- update the user password
4624 l_bool := fnd_user_pkg.setreencryptedpassword(username => p_user_name,
4625 reencpwd => p_password,
4626 newkey => 'LOADER');
4627 if NOT l_bool then
4628 raise PASSWORD_UPDATE_FAILED;
4629 end if;
4630 --
4631 hr_utility.set_location(l_proc, 40);
4632 --
4633 fnd_sso_manager.synch_user_from_LDAP(p_user_name);
4634 --
4635 hr_utility.set_location(l_proc, 50);
4636 --
4637 -- this case happens when user is present in SSO and applied for a job through
4638 -- HA and for this we have to create a local user who points to SSO user
4639 -- note that we are passing in FND_WEB_SEC.EXTERNAL_PWD which is checked by
4640 -- ATG routine and treats this as an SSO user
4641 elsif l_num = 3 then
4642 hr_utility.set_location(l_proc, 15);
4643 l_user_id := fnd_user_pkg.CreateUserId(
4644 x_user_name => p_user_name
4645 ,x_owner => 'CUST'
4646 ,x_unencrypted_password => FND_WEB_SEC.EXTERNAL_PWD
4647 ,x_email_address => p_email
4648 ,x_user_guid => p_user_guid
4649 );
4650 hr_utility.set_location(l_proc, 25);
4651 -- fix for bug 4765406
4652 -- set the profile to SSO
4653 l_found := fnd_profile.save(x_name => 'APPS_SSO_LOCAL_LOGIN'
4654 , x_value => 'SSO'
4655 , x_level_name => 'USER'
4656 , x_level_value => l_user_id);
4657
4658 hr_utility.set_location(l_proc, 30);
4659 --
4660 fnd_sso_manager.synch_user_from_LDAP(p_user_name);
4661 hr_utility.set_location(l_proc, 35);
4662 --
4663 -- check if User has Resp
4664 irc_party_api.process_ha_resp_check(p_user_id => l_user_id,
4665 p_responsibility_id => p_responsibility_id,
4666 p_resp_appl_id => p_resp_appl_id,
4667 p_security_group_id => p_security_group_id,
4668 p_start_date => p_start_date,
4669 p_server_id => p_server_id);
4670 -- complete the partial registration
4671 create_partial_user(p_user_name => p_user_name
4672 ,p_last_name => p_last_name
4673 ,p_first_name => p_first_name
4674 ,p_email => p_email
4675 ,p_start_date => p_start_date
4676 ,p_reg_bg_id => p_reg_bg_id
4677 ,p_responsibility_id => p_responsibility_id
4678 ,p_resp_appl_id => p_resp_appl_id
4679 ,p_security_group_id => p_security_group_id
4680 ,p_language => p_language
4681 ,p_allow_access => p_allow_access
4682 );
4683 end if;
4684 hr_utility.set_location('Leaving: '||l_proc, 60);
4685 end create_ha_processed_user;
4686 --
4687 -- -------------------------------------------------------------------------
4688 -- |------------------------< process_ha_resp_check >----------------------|
4689 -- -------------------------------------------------------------------------
4690 --
4691 procedure process_ha_resp_check
4692 (
4693 p_user_id IN number,
4694 p_responsibility_id IN number,
4695 p_resp_appl_id IN number,
4696 p_security_group_id IN number,
4697 p_start_date IN date,
4698 p_server_id IN number default null
4699 )is
4700 --
4701 cursor get_person_party_info is
4702 select employee_id, person_party_id
4703 from fnd_user
4704 where user_id=p_user_id;
4705
4706 l_person_id number;
4707 l_person_party_id number;
4708 l_per_type varchar2(100);
4709 l_num number;
4710 l_bool boolean;
4711 l_found boolean;
4712 l_resp_exists boolean;
4713 l_business_group_id number;
4714 l_sec_profile_id number;
4715 l_ovn number;
4716 l_sec_profile_assignment_id number;
4717 --
4718 l_proc varchar2(72) := g_package||'process_ha_resp_check';
4719 begin
4720 --
4721 open get_person_party_info;
4722 fetch get_person_party_info into l_person_id, l_person_party_id;
4723 close get_person_party_info;
4724 -- Disable Partial Registration for Employees
4725 if l_person_id is not null then
4726 l_per_type := irc_utilities_pkg.get_emp_spt_for_person(l_person_id, trunc(p_start_date));
4727 end if;
4728 -- check if the User has the required responsibility
4729 l_resp_exists := fnd_user_resp_groups_api.Assignment_Exists(p_user_id,
4730 p_responsibility_id, p_resp_appl_id, p_security_group_id);
4731 -- if the User doesn't have the responsibility, assign it.
4732 if NOT l_resp_exists then
4733 if (l_per_type = 'EMP') then
4734 fnd_message.set_name('PER','IRC_412224_EMP_PARTIAL_REG');
4735 fnd_message.raise_error;
4736 end if;
4737 --
4738 -- add the appropriate responsibility
4739 --
4740 fnd_user_resp_groups_api.Insert_Assignment
4741 (user_id => p_user_id
4742 ,responsibility_id => p_responsibility_id
4743 ,responsibility_application_id => p_resp_appl_id
4744 ,security_group_id => p_security_group_id
4745 ,start_date => trunc(sysdate)
4746 ,end_date => null
4747 ,description => ' ' -- ### description was supposed to default
4748 -- to null... but does not look like it has
4749 );
4750 hr_utility.set_location(l_proc, 100);
4751 --
4752 -- look to see if we are using multiple security groups
4753 --
4754 if (fnd_profile.value('ENABLE_SECURITY_GROUPS')='Y') then
4755 l_sec_profile_id:=fnd_profile.value_specific
4756 (name=>'PER_SECURITY_PROFILE_ID'
4757 ,user_id=>p_user_id
4758 ,responsibility_id=>p_responsibility_id
4759 ,application_id=>p_resp_appl_id);
4760 l_business_group_id:=fnd_profile.value_specific
4761 (name=>'PER_BUSINESS_GROUP_ID'
4762 ,user_id=>p_user_id
4763 ,responsibility_id=>p_responsibility_id
4764 ,application_id=>p_resp_appl_id);
4765 --
4766 per_sec_profile_asg_api.create_security_profile_asg
4767 (p_sec_profile_assignment_id => l_sec_profile_assignment_id
4768 ,p_user_id => p_user_id
4769 ,p_security_group_id => p_security_group_id
4770 ,p_business_group_id => l_business_group_id
4771 ,p_security_profile_id => l_sec_profile_id
4772 ,p_responsibility_id => p_responsibility_id
4773 ,p_responsibility_application_i => p_resp_appl_id
4774 ,p_start_date => trunc(sysdate)
4775 ,p_object_version_number => l_ovn
4776 );
4777 hr_utility.set_location(l_proc, 110);
4778 end if;
4779 else
4780 hr_utility.set_location(l_proc, 95);
4781 if (l_per_type <> 'EMP') then
4782 --
4783 -- reopen the candidate responsibility
4784 --
4785 fnd_user_resp_groups_api.Update_Assignment
4786 (user_id => p_user_id
4787 ,responsibility_id => p_responsibility_id
4788 ,responsibility_application_id => p_resp_appl_id
4789 ,security_group_id => p_security_group_id
4790 ,start_date => trunc(sysdate)
4791 ,end_date => null
4792 ,description => ' ' -- ### description was supposed to default
4793 -- to null... but does not look like it has
4794 );
4795 -- REVISIT, what about Security Profile Assignment
4796 end if;
4797 end if;
4798 --
4799 if p_server_id is null then
4800 fnd_global.apps_initialize
4801 (user_id => p_user_id
4802 ,resp_id => p_responsibility_id
4803 ,resp_appl_id => p_resp_appl_id
4804 ,security_group_id=> p_security_group_id);
4805 else
4806 fnd_global.apps_initialize
4807 (user_id => p_user_id
4808 ,resp_id => p_responsibility_id
4809 ,resp_appl_id => p_resp_appl_id
4810 ,security_group_id=> p_security_group_id
4811 ,server_id => p_server_id);
4812 end if;
4813 end;
4814 --
4815 -- -------------------------------------------------------------------------
4816 -- |------------------------< TestUserName >-------------------------------|
4817 -- -------------------------------------------------------------------------
4818 function TestUserName
4819 (
4820 p_user_name IN varchar2
4821 ) return NUMBER
4822 is
4823 begin
4824 return fnd_user_pkg.testusername(x_user_name=>p_user_name);
4825 end TestUserName;
4826 --
4827 -- -------------------------------------------------------------------------
4828 -- |------------------------< assign_responsibility >----------------------|
4829 -- -------------------------------------------------------------------------
4830 procedure assign_responsibility
4831 (p_user_id IN number
4832 ,p_resp_id IN number
4833 ,p_resp_appl_id IN number
4834 ,p_sec_group_id IN number
4835 ) is
4836 --
4837 PRAGMA autonomous_transaction;
4838
4839 l_resp_exists boolean;
4840 l_sec_profile_assignment_id number;
4841 l_business_group_id number;
4842 l_sec_profile_id number;
4843 l_ovn number;
4844 --
4845 l_proc varchar2(72) := g_package||'assign_responsibility';
4846
4847 begin
4848 -- check if the User has the required responsibility
4849 l_resp_exists := fnd_user_resp_groups_api.Assignment_Exists(p_user_id,
4850 p_resp_id, p_resp_appl_id, p_sec_group_id);
4851 -- if the User doesn't have the responsibility, assign it.
4852 if NOT l_resp_exists then
4853 --
4854 -- add the appropriate responsibility
4855 --
4856 fnd_user_resp_groups_api.Insert_Assignment
4857 (user_id => p_user_id
4858 ,responsibility_id => p_resp_id
4859 ,responsibility_application_id => p_resp_appl_id
4860 ,security_group_id => p_sec_group_id
4861 ,start_date => trunc(sysdate)
4862 ,end_date => null
4863 ,description => ' ' -- ### description was supposed to default
4864 -- to null... but does not look like it has
4865 );
4866 hr_utility.set_location(l_proc, 100);
4867 --
4868 -- look to see if we are using multiple security groups
4869 --
4870 if(fnd_profile.value('ENABLE_SECURITY_GROUPS')='Y') then
4871 l_sec_profile_id:=fnd_profile.value_specific
4872 (name=>'PER_SECURITY_PROFILE_ID'
4873 ,user_id=>p_user_id
4874 ,responsibility_id=>p_resp_id
4875 ,application_id=>p_resp_appl_id);
4876 l_business_group_id:=fnd_profile.value_specific
4877 (name=>'PER_BUSINESS_GROUP_ID'
4878 ,user_id=>p_user_id
4879 ,responsibility_id=>p_resp_id
4880 ,application_id=>p_resp_appl_id);
4881 --
4882 per_sec_profile_asg_api.create_security_profile_asg
4883 (p_sec_profile_assignment_id => l_sec_profile_assignment_id
4884 ,p_user_id => p_user_id
4885 ,p_security_group_id => p_sec_group_id
4886 ,p_business_group_id => l_business_group_id
4887 ,p_security_profile_id => l_sec_profile_id
4888 ,p_responsibility_id => p_resp_id
4889 ,p_responsibility_application_i => p_resp_appl_id
4890 ,p_start_date => trunc(sysdate)
4891 ,p_object_version_number => l_ovn
4892 );
4893 hr_utility.set_location(l_proc, 110);
4894 end if;
4895 else
4896 hr_utility.set_location(l_proc, 95);
4897 --
4898 -- reopen the candidate responsibility
4899 --
4900 fnd_user_resp_groups_api.Update_Assignment
4901 (user_id => p_user_id
4902 ,responsibility_id => p_resp_id
4903 ,responsibility_application_id => p_resp_appl_id
4904 ,security_group_id => p_sec_group_id
4905 ,start_date => trunc(sysdate)
4906 ,end_date => null
4907 ,description => ' ' -- ### description was supposed to default
4908 -- to null... but does not look like it has
4909 );
4910 -- REVISIT, what about Security Profile Assignment
4911 end if;
4912 commit;
4913 hr_utility.set_location('Leaving:'||l_proc, 110);
4914 end assign_responsibility;
4915 --
4916 --
4917 --
4918 -- -------------------------------------------------------------------------
4919 -- |------------------------< create_user_internal_byRef >------------------|
4920 -- -------------------------------------------------------------------------
4921 --
4922 procedure create_user_internal_byRef
4923 (p_user_name IN varchar2
4924 ,p_password IN varchar2
4925 ,p_start_date IN date
4926 ,p_responsibility_id IN number
4927 ,p_resp_appl_id IN number
4928 ,p_security_group_id IN number
4929 ,p_email IN varchar2 default null
4930 ,p_language IN varchar2 default null
4931 ,p_last_name IN varchar2 default null
4932 ,p_first_name IN varchar2 default null
4933 ,p_allow_access IN varchar2 default null
4934 ,p_per_information_category IN varchar2 default null
4935 ,p_per_information1 IN varchar2 default null
4936 ,p_per_information2 IN varchar2 default null
4937 ,p_per_information3 IN varchar2 default null
4938 ,p_per_information4 IN varchar2 default null
4939 ,p_per_information5 IN varchar2 default null
4940 ,p_per_information6 IN varchar2 default null
4941 ,p_per_information7 IN varchar2 default null
4942 ,p_per_information8 IN varchar2 default null
4943 ,p_per_information9 IN varchar2 default null
4944 ,p_per_information10 IN varchar2 default null
4945 ,p_per_information11 IN varchar2 default null
4946 ,p_per_information12 IN varchar2 default null
4947 ,p_per_information13 IN varchar2 default null
4948 ,p_per_information14 IN varchar2 default null
4949 ,p_per_information15 IN varchar2 default null
4950 ,p_per_information16 IN varchar2 default null
4951 ,p_per_information17 IN varchar2 default null
4952 ,p_per_information18 IN varchar2 default null
4953 ,p_per_information19 IN varchar2 default null
4954 ,p_per_information20 IN varchar2 default null
4955 ,p_per_information21 IN varchar2 default null
4956 ,p_per_information22 IN varchar2 default null
4957 ,p_per_information23 IN varchar2 default null
4958 ,p_per_information24 IN varchar2 default null
4959 ,p_per_information25 IN varchar2 default null
4960 ,p_per_information26 IN varchar2 default null
4961 ,p_per_information27 IN varchar2 default null
4962 ,p_per_information28 IN varchar2 default null
4963 ,p_per_information29 IN varchar2 default null
4964 ,p_per_information30 IN varchar2 default null
4965 ,p_person_id IN per_all_people_f.person_id%type default null
4966 ) IS
4967 --
4968 PRAGMA autonomous_transaction;
4969 l_proc varchar2(72) := g_package||'create_user_internal_byReferral';
4970 l_person_id per_all_people_f.person_id%type;
4971 l_user_id number;
4972 l_profile_check boolean;
4973 l_user_name fnd_user.user_name%type;
4974 l_default_last_name per_all_people_f.last_name%type;
4975 l_effective_start_date date;
4976 l_effective_end_date date;
4977 l_sec_profile_assignment_id number;
4978 l_business_group_id number;
4979 l_sec_profile_id number;
4980 l_ovn number;
4981 l_menu_name varchar2(30);
4982 l_menu_id number;
4983 l_grant_name varchar2(80);
4984 --
4985 cursor get_menu_id (p_menu_name varchar2) is
4986 select menu_id from fnd_menus where menu_name=upper(p_menu_name);
4987 --
4988 begin
4989 hr_utility.set_location(' Entering: '||l_proc, 10);
4990 --
4991 -- Create Person
4992 l_default_last_name := nvl(p_last_name,fnd_message.get_string('PER','IRC_412108_UNKNOWN_NAME'));
4993
4994 l_person_id := p_person_id;
4995 --
4996 hr_utility.set_location(l_proc,20);
4997 --
4998 -- Create User and set person_id to employee_id
4999 --
5000 l_user_id := fnd_user_pkg.CreateUserId (
5001 x_user_name => p_user_name,
5002 x_owner => 'CUST',
5003 x_unencrypted_password => p_password,
5004 x_email_address => p_email,
5005 x_employee_id => l_person_id,
5006 x_password_date => trunc(sysdate));
5007 --
5008 hr_utility.set_location(l_proc,30);
5009 --
5010 -- set the language profile option
5011 --
5012 l_profile_check := fnd_profile.save (
5013 x_name => 'ICX_LANGUAGE',
5014 x_value => p_language,
5015 x_level_name => 'USER',
5016 x_level_value => l_user_id );
5017 --
5018 hr_utility.set_location(l_proc,40);
5019 --
5020 -- Set the password date Column to Null for the created user
5021 -- As the password is system generated, it should be changed
5022 -- by candidate when he first logs in
5023 UPDATE fnd_user
5024 SET password_date=NULL
5025 WHERE user_name=upper(p_user_name);
5026 --
5027 -- commit autonomous transaction
5028 --
5029 --
5030 commit;
5031 --
5032 hr_utility.set_location(' Leaving:'||l_proc, 50);
5033 end create_user_internal_byRef;
5034 --
5035 --
5036 -- -------------------------------------------------------------------------
5037 -- |------------------------< create_user_byReferral >--------------------------------|
5038 -- -------------------------------------------------------------------------
5039 --
5040 procedure create_user_byReferral
5041 (p_user_name IN varchar2
5042 ,p_password IN varchar2
5043 ,p_start_date IN date
5044 ,p_responsibility_id IN number
5045 ,p_resp_appl_id IN number
5046 ,p_security_group_id IN number
5047 ,p_email IN varchar2 default null
5048 ,p_language IN varchar2 default null
5049 ,p_last_name IN varchar2 default null
5050 ,p_first_name IN varchar2 default null
5051 ,p_allow_access IN varchar2 default null
5052 ,p_per_information_category IN varchar2 default null
5053 ,p_per_information1 IN varchar2 default null
5054 ,p_per_information2 IN varchar2 default null
5055 ,p_per_information3 IN varchar2 default null
5056 ,p_per_information4 IN varchar2 default null
5057 ,p_per_information5 IN varchar2 default null
5058 ,p_per_information6 IN varchar2 default null
5059 ,p_per_information7 IN varchar2 default null
5060 ,p_per_information8 IN varchar2 default null
5061 ,p_per_information9 IN varchar2 default null
5062 ,p_per_information10 IN varchar2 default null
5063 ,p_per_information11 IN varchar2 default null
5064 ,p_per_information12 IN varchar2 default null
5065 ,p_per_information13 IN varchar2 default null
5066 ,p_per_information14 IN varchar2 default null
5067 ,p_per_information15 IN varchar2 default null
5068 ,p_per_information16 IN varchar2 default null
5069 ,p_per_information17 IN varchar2 default null
5070 ,p_per_information18 IN varchar2 default null
5071 ,p_per_information19 IN varchar2 default null
5072 ,p_per_information20 IN varchar2 default null
5073 ,p_per_information21 IN varchar2 default null
5074 ,p_per_information22 IN varchar2 default null
5075 ,p_per_information23 IN varchar2 default null
5076 ,p_per_information24 IN varchar2 default null
5077 ,p_per_information25 IN varchar2 default null
5078 ,p_per_information26 IN varchar2 default null
5079 ,p_per_information27 IN varchar2 default null
5080 ,p_per_information28 IN varchar2 default null
5081 ,p_per_information29 IN varchar2 default null
5082 ,p_per_information30 IN varchar2 default null
5083 ,p_person_id IN number default null
5084 ) IS
5085 --
5086 l_password_check varchar2(1);
5087 l_password_change_check varchar2(1);
5088 l_allow_access irc_notification_preferences.allow_access%type;
5089 l_start_date date;
5090 cursor get_nls_language is
5091 select nls_language
5092 from fnd_languages
5093 where language_code=p_language;
5094 --
5095 l_nls_language fnd_languages.nls_language%type;
5096 --
5097 begin
5098 --
5099 -- Truncate time portion from date
5100 --
5101 l_start_date := trunc(p_start_date);
5102 --
5103 -- default Allow Access if input value is NULL
5104 --
5105 l_allow_access := nvl(p_allow_access,nvl(fnd_profile.value('IRC_VISIBLE_PREF_DEFAULT'),'N'));
5106 --
5107 -- Call Before Process User Hook
5108 --
5109 begin
5110 irc_party_bk4.create_user_b
5111 (
5112 p_user_name => p_user_name
5113 ,p_password => p_password
5114 ,p_start_date => l_start_date
5115 ,p_email => p_email
5116 ,p_language => p_language
5117 ,p_last_name => p_last_name
5118 ,p_first_name => p_first_name
5119 ,p_allow_access => l_allow_access
5120 ,p_per_information_category => p_per_information_category
5121 ,p_per_information1 => p_per_information1
5122 ,p_per_information2 => p_per_information2
5123 ,p_per_information3 => p_per_information3
5124 ,p_per_information4 => p_per_information4
5125 ,p_per_information5 => p_per_information5
5126 ,p_per_information6 => p_per_information6
5127 ,p_per_information7 => p_per_information7
5128 ,p_per_information8 => p_per_information8
5129 ,p_per_information9 => p_per_information9
5130 ,p_per_information10 => p_per_information10
5131 ,p_per_information11 => p_per_information11
5132 ,p_per_information12 => p_per_information12
5133 ,p_per_information13 => p_per_information13
5134 ,p_per_information14 => p_per_information14
5135 ,p_per_information15 => p_per_information15
5136 ,p_per_information16 => p_per_information16
5137 ,p_per_information17 => p_per_information17
5138 ,p_per_information18 => p_per_information18
5139 ,p_per_information19 => p_per_information19
5140 ,p_per_information20 => p_per_information20
5141 ,p_per_information21 => p_per_information21
5142 ,p_per_information22 => p_per_information22
5143 ,p_per_information23 => p_per_information23
5144 ,p_per_information24 => p_per_information24
5145 ,p_per_information25 => p_per_information25
5146 ,p_per_information26 => p_per_information26
5147 ,p_per_information27 => p_per_information27
5148 ,p_per_information28 => p_per_information28
5149 ,p_per_information29 => p_per_information29
5150 ,p_per_information30 => p_per_information30
5151 );
5152 exception
5153 when hr_api.cannot_find_prog_unit then
5154 hr_api.cannot_find_prog_unit_error
5155 (p_module_name => 'CREATE_USER'
5156 ,p_hook_type => 'BP'
5157 );
5158 end;
5159 --
5160 -- get NLS_LANGUAGE
5161 --
5162 open get_nls_language;
5163 fetch get_nls_language into l_nls_language;
5164 if get_nls_language%notfound then
5165 close get_nls_language;
5166 l_nls_language:=p_language;
5167 else
5168 close get_nls_language;
5169 end if;
5170 --
5171 -- Validate the password
5172 --
5173 l_password_check := fnd_web_sec.validate_password(username => p_user_name
5174 ,password => p_password);
5175
5176 if (l_password_check = 'N') then
5177 fnd_message.raise_error;
5178 end if;
5179 --
5180 -- create party and user
5181 --
5182 irc_party_api.create_user_internal_byRef(p_user_name => p_user_name
5183 ,p_password => p_password
5184 ,p_start_date => l_start_date
5185 ,p_email => p_email
5186 ,p_responsibility_id => p_responsibility_id
5187 ,p_resp_appl_id => p_resp_appl_id
5188 ,p_security_group_id => p_security_group_id
5189 ,p_language => l_nls_language
5190 ,p_last_name => p_last_name
5191 ,p_first_name => p_first_name
5192 ,p_allow_access => l_allow_access
5193 ,p_per_information_category => p_per_information_category
5194 ,p_per_information1 => p_per_information1
5195 ,p_per_information2 => p_per_information2
5196 ,p_per_information3 => p_per_information3
5197 ,p_per_information4 => p_per_information4
5198 ,p_per_information5 => p_per_information5
5199 ,p_per_information6 => p_per_information6
5200 ,p_per_information7 => p_per_information7
5201 ,p_per_information8 => p_per_information8
5202 ,p_per_information9 => p_per_information9
5203 ,p_per_information10 => p_per_information10
5204 ,p_per_information11 => p_per_information11
5205 ,p_per_information12 => p_per_information12
5206 ,p_per_information13 => p_per_information13
5207 ,p_per_information14 => p_per_information14
5208 ,p_per_information15 => p_per_information15
5209 ,p_per_information16 => p_per_information16
5210 ,p_per_information17 => p_per_information17
5211 ,p_per_information18 => p_per_information18
5212 ,p_per_information19 => p_per_information19
5213 ,p_per_information20 => p_per_information20
5214 ,p_per_information21 => p_per_information21
5215 ,p_per_information22 => p_per_information22
5216 ,p_per_information23 => p_per_information23
5217 ,p_per_information24 => p_per_information24
5218 ,p_per_information25 => p_per_information25
5219 ,p_per_information26 => p_per_information26
5220 ,p_per_information27 => p_per_information27
5221 ,p_per_information28 => p_per_information28
5222 ,p_per_information29 => p_per_information29
5223 ,p_per_information30 => p_per_information30
5224 ,p_person_id => p_person_id
5225 );
5226 --
5227 -- Call After Process User Hook
5228 --
5229 begin
5230 irc_party_bk4.create_user_a
5231 (
5232 p_user_name => p_user_name
5233 ,p_password => p_password
5234 ,p_start_date => l_start_date
5235 ,p_email => p_email
5236 ,p_language => p_language
5237 ,p_last_name => p_last_name
5238 ,p_first_name => p_first_name
5239 ,p_allow_access => l_allow_access
5240 ,p_per_information_category => p_per_information_category
5241 ,p_per_information1 => p_per_information1
5242 ,p_per_information2 => p_per_information2
5243 ,p_per_information3 => p_per_information3
5244 ,p_per_information4 => p_per_information4
5245 ,p_per_information5 => p_per_information5
5246 ,p_per_information6 => p_per_information6
5247 ,p_per_information7 => p_per_information7
5248 ,p_per_information8 => p_per_information8
5249 ,p_per_information9 => p_per_information9
5250 ,p_per_information10 => p_per_information10
5251 ,p_per_information11 => p_per_information11
5252 ,p_per_information12 => p_per_information12
5253 ,p_per_information13 => p_per_information13
5254 ,p_per_information14 => p_per_information14
5255 ,p_per_information15 => p_per_information15
5256 ,p_per_information16 => p_per_information16
5257 ,p_per_information17 => p_per_information17
5258 ,p_per_information18 => p_per_information18
5259 ,p_per_information19 => p_per_information19
5260 ,p_per_information20 => p_per_information20
5261 ,p_per_information21 => p_per_information21
5262 ,p_per_information22 => p_per_information22
5263 ,p_per_information23 => p_per_information23
5264 ,p_per_information24 => p_per_information24
5265 ,p_per_information25 => p_per_information25
5266 ,p_per_information26 => p_per_information26
5267 ,p_per_information27 => p_per_information27
5268 ,p_per_information28 => p_per_information28
5269 ,p_per_information29 => p_per_information29
5270 ,p_per_information30 => p_per_information30
5271 );
5272 exception
5273 when hr_api.cannot_find_prog_unit then
5274 hr_api.cannot_find_prog_unit_error
5275 (p_module_name => 'CREATE_USER'
5276 ,p_hook_type => 'AP'
5277 );
5278 end;
5279 --
5280 end create_user_byReferral;
5281 --
5282 end irc_party_api;