1 Package Body per_per_bus as
2 /* $Header: peperrhi.pkb 120.14.12010000.3 2008/10/01 06:47:05 pvelugul ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 --
9 g_package varchar2(33) := ' per_per_bus.'; -- Global package name
10 g_debug boolean := hr_utility.debug_enabled;
11 --
12 -- The following two global variables are only to be used by the
13 -- return_legislation_code function.
14 --
15 g_person_id number default null;
16 g_legislation_code varchar2(150) default null;
17 --
18 -- ---------------------------------------------------------------------------
19 -- |----------------------< set_security_group_id >------------------------|
20 -- ---------------------------------------------------------------------------
21 --
22 procedure set_security_group_id
23 (
24 p_person_id in per_all_people_f.person_id%TYPE
25 ,p_associated_column1 in varchar2 default null
26 ) as
27 --
28 -- Declare cursor
29 --
30 -- Bug Number : 3009266.
31 -- Description : To let Phones row handler access person row hanlder for all persons
32 -- replaced per_people_f with per_all_people_f in this cursor.
33 --
34 cursor csr_sec_grp is
35 select hoi.org_information14, hoi.org_information9
36 from hr_organization_information hoi
37 , per_all_people_f per
38 where per.person_id = p_person_id
39 and hoi.organization_id = per.business_group_id
40 and hoi.org_information_context||'' = 'Business Group Information';
41 --
42 -- Local variables
43 --
44 l_security_group_id number;
45 l_legislation_code varchar2(150);
46 l_proc varchar2(72) := g_package||'set_security_group_id';
47 --
48 begin
49 if g_debug then
50 hr_utility.set_location('Entering:'|| l_proc, 10);
51 end if;
52 --
53 -- Ensure that all the mandatory parameter are not null
54 --
55 hr_api.mandatory_arg_error(p_api_name => l_proc,
56 p_argument => 'person_id',
57 p_argument_value => p_person_id);
58 --
59 open csr_sec_grp;
60 fetch csr_sec_grp into l_security_group_id, l_legislation_code;
61 if csr_sec_grp%notfound then
62 close csr_sec_grp;
63 --
64 -- The primary key is invalid therefore we must error
65 --
66 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
67 hr_multi_message.add(p_associated_column1 =>
68 nvl(p_associated_column1,'PERSON_ID'));
69 else
70 close csr_sec_grp;
71 --
72 -- Set the security_group_id in CLIENT_INFO
73 --
74 hr_api.set_security_group_id
75 (p_security_group_id => l_security_group_id
76 );
77 --
78 -- Set the sessions legislation context in HR_SESSION_DATA
79 --
80 hr_api.set_legislation_context(l_legislation_code);
81 --
82 end if;
83 if g_debug then
84 hr_utility.set_location(' Leaving:'|| l_proc, 20);
85 end if;
86 --
87 end set_security_group_id;
88 -- ---------------------------------------------------------------------------
89 -- |----------------------< return_system_person_type >--------------------|
90 -- ---------------------------------------------------------------------------
91 --
92 -- Description:
93 -- Checks that the person_type_id exists in per_person_types for the
94 -- business group and returns the value of system_person_type
95 --
96 -- Pre-conditions:
97 -- None
98 --
99 -- In Arguments:
100 -- p_person_type_id
101 -- p_business_group_id
102 --
103 -- Post Success:
104 -- If the person_type exists in PER_PERSON_TYPES for the business
105 -- group then
106 -- the value of system person type is returned and processing continues
107 --
108 -- Post Failure:
109 -- If the person_type does not exist in PER_PERSON_TYPES for the business
110 -- group then
111 -- an application error will be raised and processing is terminated
112 --
113 -- Access Status:
114 -- Internal Table Handler Use Only.
115 --
116 function return_system_person_type
117 (p_person_type_id in per_all_people_f.person_type_id%TYPE
118 ,p_business_group_id in per_all_people_f.business_group_id%TYPE)
119 return varchar2 is
120 --
121 l_person_type varchar2(30);
122 l_proc varchar2(72) := g_package||'return_system_person_type';
123 --
124 cursor csr_chk_person_type is
125 select pet.system_person_type
126 from per_person_types pet
127 where p_person_type_id = pet.person_type_id
128 and p_business_group_id = pet.business_group_id + 0;
129 --
130 begin
131 if g_debug then
132 hr_utility.set_location('Entering:'|| l_proc, 1);
133 end if;
134 --
135 -- Check mandatory parameters have been set
136 --
137 hr_api.mandatory_arg_error
138 (p_api_name => l_proc
139 ,p_argument => 'person type id'
140 ,p_argument_value => p_person_type_id
141 );
142 --
143 hr_api.mandatory_arg_error
144 (p_api_name => l_proc
145 ,p_argument => 'business group id'
146 ,p_argument_value => p_business_group_id
147 );
148 --
149 -- Check if the previous system_person_type variable(g_previous_sys_per_type)
150 -- is null, if not then we already have the required value so just return it,
151 -- if so select it from the database before returning it.
152 --
153 if g_previous_sys_per_type is null then
154 --
155 -- Check that the person_type exists in PER_PERSON_TYPES for the business
156 -- group and return the system person type
157 --
158 open csr_chk_person_type;
159 fetch csr_chk_person_type into g_previous_sys_per_type;
160 If csr_chk_person_type%found then
161 close csr_chk_person_type;
162 if g_debug then
163 hr_utility.set_location(l_proc, 3);
164 end if;
165 else
166 --
167 if g_debug then
168 hr_utility.set_location(l_proc, 4);
169 end if;
170 --
171 close csr_chk_person_type;
172 -- Error: Invalid person type
173 hr_utility.set_message(801,'HR_7513_PER_TYPE_INVALID');
174 hr_utility.raise_error;
175 end if;
176 end if;
177 if g_debug then
178 hr_utility.set_location(' Leaving '||l_proc, 5);
179 end if;
180 return g_previous_sys_per_type;
181 exception
182 when app_exception.application_exception then
183 if hr_multi_message.exception_add
184 (p_associated_column1 => 'PER_ALL_PEOPLE_F.PERSON_TYPE_ID'
185 ) then
186 if g_debug then
187 hr_utility.set_location(' Leaving:'||l_proc, 6);
188 end if;
189 raise;
190 end if;
191 if g_debug then
192 hr_utility.set_location(' Leaving:'||l_proc,7);
193 end if;
194 -- call to stop proceeding further if there is an error in
195 -- system person type
196 --
197 hr_multi_message.end_validation_set;
198 --
199 end return_system_person_type;
200 --
201 -- ---------------------------------------------------------------------------
202 -- |--------------------------< set_current_flags >------------------------|
203 -- ---------------------------------------------------------------------------
204 --
205 -- Description:
206 -- Sets the value of p_current_employee_flag, p_current_applicant_flag and
207 -- p_current_emp_or_apl_flag according to the value of system person type.
208 -- This procedure is called directly on insert and from chk_person_type_id
209 -- on update, if a valid change in system person type occurs.
210 --
211 -- Pre-conditions:
212 -- None
213 --
214 -- In Arguments:
215 -- p_person_id
216 -- p_business_group_id
217 -- p_person_type_id
218 -- p_effective_date
219 -- p_object_version_number
220 --
221 -- Out Arguments:
222 -- p_current_employee_flag
223 -- p_current_applicant_flag
224 -- p_current_emp_or_apl_flag
225 --
226 -- Post Success:
227 -- If the system_person_type corresponding to the value of p_person_type_id
228 -- is 'EMP' or 'EMP_APL' then
229 -- p_current_employee_flag is set to 'Y' and processing continues
230 -- else
231 -- p_current_employee_flag is set to null and processing continues
232 --
233 -- If the system_person_type corresponding to the value of p_person_type_id
234 -- is 'APL','APL_EX_APL', 'EMP_APL' or 'EX_EMP_APL' then
235 -- p_current_applicant_flag is set to 'Y' and processing continues
236 -- else
237 -- p_current_applicant_flag is set to null and processing continues
238 --
239 -- If the system_person_type corresponding to the value of p_person_type_id
240 -- is 'EMP','APL','EMP_APL', EX_EMP_APL' or 'APL_EX_APL' then
241 -- p_current_emp_or_apl_flag is set to 'Y' and processing continues
242 -- else
243 -- p_current_emp_or_apl_flag is set to null and processing continues
244 --
245 -- Post Failure:
246 -- None
247 --
248 -- Access Status:
249 -- Internal Table Handler Use Only.
250 --
251 procedure set_current_flags
252 (p_person_id in per_all_people_f.person_id%TYPE
253 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
254 ,p_person_type_id in per_all_people_f.person_type_id%TYPE
255 ,p_current_employee_flag out nocopy per_all_people_f.current_employee_flag%TYPE
256 ,p_current_applicant_flag out nocopy per_all_people_f.current_applicant_flag%TYPE
257 ,p_current_emp_or_apl_flag out nocopy per_all_people_f.current_emp_or_apl_flag%TYPE
258 ,p_effective_date in date
259 ,p_object_version_number in per_all_people_f.object_version_number%TYPE) is
260 --
261 l_proc varchar2(72) := g_package||'set_current_flags';
262 l_api_updating boolean;
263 l_system_person_type varchar2(30);
264 --
265 begin
266 if g_debug then
267 hr_utility.set_location('Entering:'|| l_proc, 1);
268 end if;
269 --
270 -- Check mandatory parameters have been set
271 --
272 hr_api.mandatory_arg_error
273 (p_api_name => l_proc
274 ,p_argument => 'business group id'
275 ,p_argument_value => p_business_group_id
276 );
277 --
278 hr_api.mandatory_arg_error
279 (p_api_name => l_proc
280 ,p_argument => 'person type id'
281 ,p_argument_value => p_person_type_id
282 );
283 --
284 hr_api.mandatory_arg_error
285 (p_api_name => l_proc
286 ,p_argument => 'effective date'
287 ,p_argument_value => p_effective_date
288 );
289 --
290 -- Only proceed with validation if:
291 -- a) The current g_old_rec is current and
292 -- b) The person type id value has changed
293 -- c) A record is being inserted
294 --
295 l_api_updating := per_per_shd.api_updating
296 (p_person_id => p_person_id
297 ,p_effective_date => p_effective_date
298 ,p_object_version_number => p_object_version_number);
299 --
300 if ((l_api_updating and per_per_shd.g_old_rec.person_type_id
301 <> p_person_type_id) or
302 (NOT l_api_updating)) then
303 --
304 if g_debug then
305 hr_utility.set_location(l_proc, 2);
306 end if;
307 --
308 -- Populate l_system_person_type with the value of system person type
309 --
310 l_system_person_type := return_system_person_type(p_person_type_id
311 ,p_business_group_id);
312 --
313 if g_debug then
314 hr_utility.set_location(l_proc, 3);
315 end if;
316 --
317 -- Check if the person is an employee
318 --
319 if l_system_person_type in ('EMP','EMP_APL') then
320 --
321 if g_debug then
322 hr_utility.set_location(l_proc, 4);
323 end if;
324 --
325 -- Person is an employee so set current employee flag to 'Y'
326 --
327 p_current_employee_flag := 'Y';
328 else
329 --
330 if g_debug then
331 hr_utility.set_location(l_proc, 5);
332 end if;
333 --
334 -- Person is not an employee so set to null
335 --
336 p_current_employee_flag := null;
337 end if;
338 --
339 -- Check if the person is an applicant
340 --
341 if l_system_person_type in ('APL','APL_EX_APL','EMP_APL','EX_EMP_APL') then
342 --
343 if g_debug then
344 hr_utility.set_location(l_proc, 6);
345 end if;
346 --
347 -- Person is an applicant so set current applicant flag to 'Y'
348 --
349 p_current_applicant_flag := 'Y';
350 else
351 --
352 if g_debug then
353 hr_utility.set_location(l_proc, 7);
354 end if;
355 --
356 -- Person is not an applicant so set to null
357 --
358 p_current_applicant_flag := null;
359 end if;
360 --
361 -- Check if the person is an employee or applicant
362 --
363 if l_system_person_type in ('EMP','APL','EMP_APL','EX_EMP_APL','APL_EX_APL')
364 then
365 --
366 if g_debug then
367 hr_utility.set_location(l_proc, 8);
368 end if;
369 --
370 -- Person is an employee or applicant so set current emp or apl flag
371 -- to 'Y'
372 --
373 p_current_emp_or_apl_flag := 'Y';
374 else
375 --
376 -- Person is not an employee or applicant so set to null
377 --
378 if g_debug then
379 hr_utility.set_location(l_proc, 9);
380 end if;
381 --
382 p_current_emp_or_apl_flag := null;
383 --
384 end if;
385 if g_debug then
386 hr_utility.set_location(l_proc, 10);
387 end if;
388 else
389 if g_debug then
390 hr_utility.set_location(l_proc, 11);
391 end if;
392 --
393 p_current_employee_flag := per_per_shd.g_old_rec.current_employee_flag;
394 p_current_applicant_flag := per_per_shd.g_old_rec.current_applicant_flag;
395 p_current_emp_or_apl_flag := per_per_shd.g_old_rec.current_emp_or_apl_flag;
396 end if;
397 if g_debug then
398 hr_utility.set_location(' Leaving:'|| l_proc, 12);
399 end if;
400 end set_current_flags;
401 --
402 -- ---------------------------------------------------------------------------
403 -- |------------------------< chk_person_type_id >--------------------------|
404 -- ---------------------------------------------------------------------------
405 --
406 -- Description:
407 -- Checks that a person type id is valid
408 --
409 -- Pre-conditions:
410 -- 1) p_current_employee_flag and p_current_emp_or_apl_flag must have been
411 -- set
412 --
413 -- In Arguments:
414 -- p_person_id
415 -- p_business_group_id
416 -- p_person_type_id
417 -- p_old_person_type_id
418 -- p_current_employee_flag
419 -- p_current_emp_or_apl_flag
420 -- p_effective_date
421 -- p_object_version_number
422 -- p_datetrack_mode
423 --
424 -- Post Success:
425 -- If the following cases are true then processing continues
426 --
427 -- a) person_type_id exists in per_person_types for the business group
428 --
429 -- b) system_person_type is one of:
430 -- APL, APL_EX_APL, EMP, EMP_APL, EX_APL, EX_EMP, EX_EMP_APL, OTHER
431 --
432 -- On insert only EMP, APL, and OTHER are permitted.
433 --
434 -- c) system_person_type undergoes one of the following transitions:
435 -- OTHER to APL, EMP or OTHER
436 -- APL to EMP, EMP_APL, EX_APL or APL
437 -- EX_APL to APL_EX_APL or EX_APL, EMP
438 -- APL_EX_APL to EMP or APL_EX_APL, EMP_APL, EX_APL
439 -- EMP to EMP_APL, EX_EMP or EMP
440 -- EMP_APL to EMP or EMP_APL, EX_EMP_APL
441 -- EX_EMP to EMP, EX_EMP_APL or EX_EMP
442 -- EX_EMP_APL to EMP_APL, EMP or EX_EMP_APL, EX_EMP
443 --
444 -- d) The value of system_person_type has changed and the
445 -- datetrack mode is UPDATE, CORRECTION or UPDATE_OVERRIDE (the
446 -- latter two under specific conditions).
447 --
448 -- e) The value of system_person_type has not changed and the
449 -- datetrack mode is UPDATE or CORRECTION.
450 --
451 -- Post Failure:
452 -- If any of the following cases are true then
453 -- an application error will be raised and processing is terminated
454 --
455 -- a) person_type_id does not exist in per_person_types for the business
456 -- group, or is not active
457 --
458 -- b) system_person_type is not as specified in (b) above.
459 --
460 -- c) The system_person_type transition is not as specified in (c)
461 -- above.
462 --
463 -- d) The value of system_person_type has changed and the
464 -- datetrack mode is UPDATE_CHANGE_INSERT, CORRECTION or
465 -- UPDATE_OVERRIDE (the latter two under specific conditions).
466 --
467 -- e) The value of system_person_type has not changed and the
468 -- datetrack mode is UPDATE_CHANGE_INSERT.
469 --
470 -- Access Status:
471 -- Internal Table Handler Use Only.
472 --
473 procedure chk_person_type_id
474 (p_person_id in per_all_people_f.person_id%TYPE
475 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
476 ,p_person_type_id in per_all_people_f.person_type_id%TYPE
477 ,p_old_person_type_id in per_all_people_f.person_type_id%TYPE
478 ,p_current_employee_flag in out nocopy per_all_people_f.current_employee_flag%TYPE
479 ,p_current_applicant_flag in out nocopy per_all_people_f.current_employee_flag%TYPE
480 ,p_current_emp_or_apl_flag in out nocopy per_all_people_f.current_emp_or_apl_flag%TYPE
481 ,p_effective_date in date
482 ,p_validation_start_date in date
483 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
484 ,p_datetrack_mode in varchar2) is
485 --
486 l_exists varchar2(1);
487 l_new_system_person_type varchar2(30);
488 l_old_system_person_type varchar2(30);
489 l_proc varchar2(72) := g_package||'chk_person_type_id';
490 l_api_updating boolean;
491 l_current_employee_flag varchar2(1);
492 l_current_applicant_flag varchar2(1);
493 l_current_emp_or_apl_flag varchar2(1);
494 l_business_group_id per_person_types.business_group_id%type;
495 l_active_flag per_person_types.active_flag%type;
496 l_discard_varchar2 varchar2(100);
497 l_discard_number number;
498 l_original_sys_type per_person_types.system_person_type%type;
499 --
500 cursor
501 csr_person_type(l_person_type_id in per_all_people_f.person_type_id%type) is
502 select pet.system_person_type,
503 pet.business_group_id,
504 pet.active_flag
505 from per_person_types pet
506 where l_person_type_id = pet.person_type_id;
507 --
508 /*
509 cursor csr_system_type(l_start_date in date) is
510 select pet.system_person_type
511 from per_all_people_f per,
512 per_person_types pet
513 where per.person_id = p_person_id
514 and l_start_date between per.effective_start_date
515 and per.effective_end_date
516 and pet.person_type_id = per.person_type_id;
517 */
518 --
519 begin
520 if g_debug then
521 hr_utility.set_location('Entering:'|| l_proc, 1);
522 end if;
523 --
524 -- Check mandatory parameters have been set
525 --
526 hr_api.mandatory_arg_error
527 (p_api_name => l_proc
528 ,p_argument => 'business group id'
529 ,p_argument_value => p_business_group_id
530 );
531 --
532 hr_api.mandatory_arg_error
533 (p_api_name => l_proc
534 ,p_argument => 'person type id'
535 ,p_argument_value => p_person_type_id
536 );
537 --
538 hr_api.mandatory_arg_error
539 (p_api_name => l_proc
540 ,p_argument => 'effective date'
541 ,p_argument_value => p_effective_date
542 );
543 --
544 -- The DateTrack mode UPDATE_OVERRIDE mode cannot be used if there is
545 -- a change of system person type after the effective date.
546 -- Note that this rule applies even if the person type is not being
547 -- changed in this transaction.
548 --
549 if p_datetrack_mode = 'UPDATE_OVERRIDE' then
550 --
551 if g_debug then
552 hr_utility.set_location(l_proc, 5);
553 end if;
554 --
555 per_per_bus.chk_system_pers_type
556 (p_person_id => p_person_id
557 ,p_validation_start_date => p_validation_start_date
558 ,p_validation_end_date => hr_api.g_eot
559 ,p_datetrack_mode => p_datetrack_mode
560 ,p_effective_date => p_effective_date
561 );
562 end if;
563 --
564 -- Only proceed with validation if:
565 -- a) The current g_old_rec is current and
566 -- b) The person type id value has changed
567 -- c) or a record is being inserted
568 --
569 l_api_updating := per_per_shd.api_updating
570 (p_person_id => p_person_id
571 ,p_effective_date => p_effective_date
572 ,p_object_version_number => p_object_version_number);
573 --
574 if ((l_api_updating and per_per_shd.g_old_rec.person_type_id <>
575 p_person_type_id) or
576 (NOT l_api_updating)) then
577 --
578 -- Perform Insert/Update Checks
579 --
580 -- Check if the person type id exists in per_person_types for the business
581 -- group
582 --
583 open csr_person_type(p_person_type_id);
584 fetch csr_person_type
585 into l_new_system_person_type,
586 l_business_group_id,
587 l_active_flag;
588 if csr_person_type%notfound then
589 close csr_person_type;
590 -- Error: Invalid person type
591 hr_utility.set_message(801, 'HR_7513_PER_TYPE_INVALID');
592 hr_utility.raise_error;
593 end if;
594 close csr_person_type;
595 if l_business_group_id <> p_business_group_id then
596 hr_utility.set_message(801, 'HR_7974_PER_TYPE_INV_BUS_GROUP');
597 hr_utility.raise_error;
598 elsif l_active_flag <> 'Y' then
599 hr_utility.set_message(801, 'HR_7973_PER_TYPE_NOT_ACTIVE');
600 hr_utility.raise_error;
601 end if;
602 --
603 if g_debug then
604 hr_utility.set_location(l_proc, 7);
605 end if;
606 --
607 -- If a new person is being inserted, then check that the system person
608 -- type is of a permitted value.
609 --
610 if p_datetrack_mode = 'INSERT' then
611 if l_new_system_person_type not in ('EMP', 'APL', 'OTHER') then
612 hr_utility.set_message(801, 'HR_7977_PER_INV_TYPE_FOR_INS');
613 hr_utility.raise_error;
614 end if;
615 end if;
616 --
617 -- Only proceed with validation if:
618 -- a) The current g_old_rec is current and
619 -- b) The person type id value has changed
620 --
621 if ((l_api_updating and per_per_shd.g_old_rec.person_type_id <>
622 p_person_type_id)) then
623 --
624 -- Perform Update Checks
625 --
626 -- Check the values of system person type in the old record for the
627 -- business group
628 --
629 open csr_person_type(p_old_person_type_id);
630 fetch csr_person_type
631 into l_old_system_person_type,
632 l_discard_number,
633 l_discard_varchar2;
634 close csr_person_type;
635 if g_debug then
636 hr_utility.set_location(l_proc, 9);
637 end if;
638 --
639 -- Check if DateTrack mode is valid
640 --
641 If l_new_system_person_type <> l_old_system_person_type then
642 --
643 -- system person type has changed so
644 -- update is allowed
645 -- update_change_insert is not allowed
646 --
647 if p_datetrack_mode = 'UPDATE_CHANGE_INSERT'
648 then
649 hr_utility.set_message(801, 'HR_7724_PER_DT_MODE_SPT_CHANGE');
650 hr_utility.raise_error;
651 end if;
652 --
653 -- DateTrack mode CORRECTION is allowed, provided the system person
654 -- type hasn't already been changed on the effective start date of
655 -- the current row.
656 --
657 /*if p_datetrack_mode = 'CORRECTION' then
658 --
659 open CSR_System_type(p_validation_start_date-1);
660 fetch csr_system_type
661 into l_original_sys_type;
662 if csr_system_type%notfound then
663 close csr_system_type;
664 hr_utility.set_message(801, 'HR_7984_PER_NO_PREVIOUS_ROW');
665 hr_utility.raise_error;
666 end if;
667 close csr_system_type;
668 if l_original_sys_type <> l_old_system_person_type then
669 hr_utility.set_message(801, 'HR_7978_PER_TYPE_CHANGE');
670 hr_utility.raise_error;
671 end if;
672 end if;
673 */
674 end if;
675 if g_debug then
676 hr_utility.set_location(l_proc, 11);
677 end if;
678 --
679 -- Check that the system person type conversion is valid.
680 --
681 if (l_old_system_person_type = 'OTHER' and
682 l_new_system_person_type not in ('APL', 'EMP', 'OTHER'))
683 or (l_old_system_person_type = 'APL' and
684 l_new_system_person_type not in ('EMP', 'EMP_APL', 'EX_APL', 'APL'))
685 or (l_old_system_person_type = 'EX_APL' and
686 l_new_system_person_type not in ('EMP','APL_EX_APL', 'EX_APL'))
687 or (l_old_system_person_type = 'APL_EX_APL' and
688 l_new_system_person_type not in ('EMP','APL_EX_APL','EMP_APL','EX_APL'))
689 or (l_old_system_person_type = 'EMP' and
690 l_new_system_person_type not in ('EMP_APL', 'EX_EMP', 'EMP'))
691 or (l_old_system_person_type = 'EMP_APL' and
692 l_new_system_person_type not in ('EMP', 'EMP_APL','EX_EMP_APL'))
693 or (l_old_system_person_type = 'EX_EMP' and
694 l_new_system_person_type not in ('EMP', 'EX_EMP_APL', 'EX_EMP'))
695 or (l_old_system_person_type = 'EX_EMP_APL' and
696 l_new_system_person_type not in ('EMP_APL', 'EMP', 'EX_EMP_APL','EX_EMP'))
697 then
698 hr_utility.set_message(801, 'HR_7987_PER_INV_TYPE_CHANGE');
699 hr_utility.raise_error;
700 else
701 if g_debug then
702 hr_utility.set_location(l_proc, 12);
703 end if;
704 --
705 set_current_flags(p_person_id
706 ,p_business_group_id
707 ,p_person_type_id
708 ,l_current_employee_flag
709 ,l_current_applicant_flag
710 ,l_current_emp_or_apl_flag
711 ,p_effective_date
712 ,p_object_version_number);
713 --
714 p_current_employee_flag := l_current_employee_flag;
715 p_current_applicant_flag := l_current_applicant_flag;
716 p_current_emp_or_apl_flag := l_current_emp_or_apl_flag;
717 end if;
718 end if;
719 end if;
720 if g_debug then
721 hr_utility.set_location(' Leaving:'|| l_proc, 13);
722 end if;
723 exception
724 when app_exception.application_exception then
725 if hr_multi_message.exception_add
726 (p_associated_column1 => 'PER_ALL_PEOPLE_F.PERSON_TYPE_ID'
727 ) then
728 if g_debug then
729 hr_utility.set_location(' Leaving:'||l_proc, 14);
730 end if;
731 raise;
732 end if;
733 if g_debug then
734 hr_utility.set_location(' Leaving:'||l_proc,15);
735 end if;
736 hr_multi_message.end_validation_set;
737 end chk_person_type_id;
738 --
739 -- ---------------------------------------------------------------------------
740 -- |------------------------< chk_date_of_birth >--------------------------|
741 -- ---------------------------------------------------------------------------
742 --
743 -- Description:
744 -- Checks that a date of birth value is valid
745 --
746 -- Pre-conditions:
747 -- None
748 --
749 -- In Arguments:
750 -- p_person_id
751 -- p_person_type_id
752 -- p_business_group_id
753 -- p_start_date
754 -- p_date_of_birth
755 -- p_effective_date
756 -- p_object_version_number
757 --
758 -- Out Arguments
759 -- p_dob_null_warning
760 --
761 -- Post Success:
762 -- If a date of birth <= the start date then
763 -- processing continues
764 --
765 -- If date of birth is null on insert when system person type is 'EMP' then
766 -- a warning is flagged and processing continues
767 --
768 -- If the persons age is between the minimum and maximum ages defined
769 -- for the business group then
770 -- processing continues
771 --
772 -- Post Failure:
773 -- If a date of birth > the start date then
774 -- an application error will be raised and processing is terminated
775 --
776 -- If the persons age is not between the minimum and maximum ages defined
777 -- for the business group then
778 -- an application error will be raised and processing is terminated
779 --
780 -- If the person type is EMP, and any assignment has its payroll component
781 -- set, then an application error will be raised and processing terminated
782 -- if the date of birth is updated to null.
783 --
784 -- Access Status:
785 -- Internal Table Handler Use Only.
786 --
787 procedure chk_date_of_birth
788 (p_person_id in per_all_people_f.person_id%TYPE
789 ,p_person_type_id in per_all_people_f.person_type_id%TYPE
790 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
791 ,p_start_date in date
792 ,p_date_of_birth in date
793 ,p_dob_null_warning out nocopy boolean
794 ,p_effective_date in date
795 ,p_validation_start_date in date
796 ,p_validation_end_date in date
797 ,p_object_version_number in per_all_people_f.object_version_number%TYPE) is
798 --
799 l_exists varchar2(1);
800 l_proc varchar2(72) := g_package||'chk_date_of_birth';
801 l_api_updating boolean;
802 /* Change for the bug 7001206 starts here */
803 -- l_age number(3); --852863
804 -- l_minimum_age number(3); --852863
805 -- l_maximum_age number(3); --852863
806
807 l_age number(4);
808 l_minimum_age number(4);
809 l_maximum_age number(4);
810 /* Change for the bug 7001206 ends here */
811 l_dob_st boolean := false;
812 l_system_person_type varchar2(20); --2273304
813 --
814 cursor csr_asg is
815 select null
816 from per_assignments_f asg
817 where asg.person_id = p_person_id
818 and asg.effective_start_date <= p_validation_end_date
819 and asg.effective_end_date >= p_validation_start_date
820 and asg.payroll_id is not null;
821 --
822 begin
823 if g_debug then
824 hr_utility.set_location('Entering:'|| l_proc, 1);
825 end if;
826 --
827 -- Check mandatory parameters have been set
828 --
829 if hr_multi_message.no_exclusive_error
830 (p_check_column1 => 'PER_ALL_PEOPLE_F.START_DATE'
831 )
832 then
833 hr_api.mandatory_arg_error
834 (p_api_name => l_proc
835 ,p_argument => 'person type id'
836 ,p_argument_value => p_person_type_id
837 );
838 --
839 hr_api.mandatory_arg_error
840 (p_api_name => l_proc
841 ,p_argument => 'business group id'
842 ,p_argument_value => p_business_group_id
843 );
844 --
845 hr_api.mandatory_arg_error
846 (p_api_name => l_proc
847 ,p_argument => 'effective date'
848 ,p_argument_value => p_effective_date
849 );
850 --
851 hr_api.mandatory_arg_error
852 (p_api_name => l_proc
853 ,p_argument => 'validation start date'
854 ,p_argument_value => p_validation_start_date
855 );
856 --
857 hr_api.mandatory_arg_error
858 (p_api_name => l_proc
859 ,p_argument => 'validation end date'
860 ,p_argument_value => p_validation_end_date
861 );
862 --
863 p_dob_null_warning := false;
864 --
865 -- Only proceed with validation if:
866 -- a) The current g_old_rec is current and
867 -- b) The start date value has changed
868 -- c) a record is being inserted
869 --
870 l_api_updating := per_per_shd.api_updating
871 (p_person_id => p_person_id
872 ,p_effective_date => p_effective_date
873 ,p_object_version_number => p_object_version_number);
874 --
875 if ((l_api_updating and nvl(per_per_shd.g_old_rec.date_of_birth,
876 hr_api.g_date)
877 <> nvl(p_date_of_birth,hr_api.g_date)) or
878 (NOT l_api_updating)) then
879 if g_debug then
880 hr_utility.set_location(l_proc, 2);
881 end if;
882 --
883 -- Perform Insert/Update checks
884 --
885 -- Check if date of birth is greater than start date
886 --
887 if p_date_of_birth is not null then
888 if p_date_of_birth > p_start_date then
889 -- Error: The Date of Birth is greater than the start date
890 hr_utility.set_message(801, 'HR_6523_PERSON_DOB_GT_START');
891 l_dob_st := true;
892 hr_utility.raise_error;
893 end if;
894 end if;
895 if g_debug then
896 hr_utility.set_location(l_proc, 3);
897 end if;
898 --
899 -- Calculate persons age
900 --
901 if g_debug then
902 hr_utility.set_location(p_effective_date,10);
903 end if;
904 if g_debug then
905 hr_utility.set_location(p_date_of_birth,10);
906 end if;
907 l_age := trunc(months_between(p_effective_date,p_date_of_birth)/12);
908 --
909 -- Find the minimum and maximum ages allowed for the business group
910 --
911 per_people3_pkg.get_legislative_ages(p_business_group_id
912 ,l_minimum_age
913 ,l_maximum_age);
914 --
915 if g_debug then
916 hr_utility.set_location(l_proc, 4);
917 end if;
918 --
919 -- Check that the persons age is between the minimum and maximum allowed
920 -- for the business group.
921 -- This check should not be done if person is of type OTHER. <IJH 483393>
922 --
923 -- Bug# 2273304 Start Here
924 --
925 l_system_person_type := return_system_person_type
926 (p_person_type_id, p_business_group_id);
927 if l_age not between nvl(l_minimum_age,l_age) and
928 nvl(l_maximum_age,l_age) and
929 ( l_system_person_type <> 'OTHER' and l_system_person_type <>'%APL') then
930 -- Error: Employees age must be between 'min' and 'max'
931 hr_utility.set_message(801, 'HR_7426_EMP_AGE_ILLEGAL');
932 hr_utility.set_message_token('MIN',to_char(l_minimum_age));
933 hr_utility.set_message_token('MAX',to_char(l_maximum_age));
934 hr_utility.raise_error;
935 end if;
936 --
937 --Bug# 2273304 End Here
938 --
939 --
940 -- Only proceed with validation if:
941 -- a) a record is being inserted
942 --
943 if NOT l_api_updating then
944 --
945 -- Perform Insert check
946 --
947 if g_debug then
948 hr_utility.set_location(l_proc, 5);
949 end if;
950 --
951 end if;
952 --
953 -- Disallow updating of date of birth to null if person type is EMP and
954 -- any assignment has its payroll component set.
955 --
956 if l_api_updating
957 and return_system_person_type(p_person_type_id, p_business_group_id) in
958 ('EMP','EX_EMP','EMP_APL','EX_EMP_APL')
959 and p_date_of_birth is null then
960 if g_debug then
961 hr_utility.set_location(l_proc, 6);
962 end if;
963 open csr_asg;
964 fetch csr_asg into l_exists;
965 if csr_asg%notfound then
966 close csr_asg;
967 p_dob_null_warning := TRUE;
968 if g_debug then
969 hr_utility.set_location(l_proc, 7);
970 end if;
971 else
972 close csr_asg;
973 hr_utility.set_message(801, 'HR_7950_PPM_NULL_DOB');
974 hr_utility.raise_error;
975 end if;
976 end if;
977 End if;
978 -- Raise warning if date of birth is null and system person type is 'EMP'
979 --
980 If return_system_person_type
981 (p_person_type_id, p_business_group_id) = 'EMP' and
982 p_date_of_birth is null then
983 p_dob_null_warning := TRUE;
984 end if;
985 end if;
986 if g_debug then
987 hr_utility.set_location(' Leaving:'|| l_proc, 8);
988 end if;
989 exception
990 when app_exception.application_exception then
991 If not l_dob_st then
992 if hr_multi_message.exception_add
993 (p_associated_column1 => 'PER_ALL_PEOPLE_F.DATE_OF_BIRTH'
994 ) then
995 if g_debug then
996 hr_utility.set_location(' Leaving:'||l_proc, 9);
997 end if;
998 raise;
999 end if;
1000 Else
1001 if hr_multi_message.exception_add
1002 (p_associated_column1 => 'PER_ALL_PEOPLE_F.DATE_OF_BIRTH'
1003 ,p_associated_column2 => 'PER_ALL_PEOPLE_F.START_DATE'
1004 ) then
1005 if g_debug then
1006 hr_utility.set_location(' Leaving:'||l_proc, 10);
1007 end if;
1008 raise;
1009 end if;
1010 End if;
1011 if g_debug then
1012 hr_utility.set_location(' Leaving:'||l_proc,11);
1013 end if;
1014 end chk_date_of_birth;
1015 --
1016 -- ---------------------------------------------------------------------------
1017 -- |-----------------------< chk_marital_status >--------------------------|
1018 -- ---------------------------------------------------------------------------
1019 --
1020 -- Description:
1021 -- - Validates that the marital status exists as a lookup code on
1022 -- HR_LOOKUPS for the lookup type 'MAR_STATUS' with an enabled
1023 -- flag set to 'Y' and the effective start date of the person between
1024 -- start date active and end date active on HR_LOOKUPS.
1025 --
1026 -- Pre-conditions:
1027 -- None
1028 --
1029 -- In Arguments:
1030 -- p_person_id
1031 -- p_marital_status
1032 -- p_effective_date
1033 -- p_validation_start_date
1034 -- p_validation_end_date
1035 -- p_object_version_number
1036 --
1037 -- Post Success:
1038 -- Processing continues if:
1039 -- - marital status exists as a lookup code in HR_LOOKUPS
1040 -- for the lookup type 'MAR_STATUS' where the enabled
1041 -- flag is 'Y' and the effective start date of the person
1042 -- is between start date active and end date active on HR_LOOKUPS.
1043 --
1044 -- Post Failure:
1045 -- An application error is raised and processing is terminated if:
1046 -- - marital status does'nt exist as a lookup code in HR_LOOKUPS
1047 -- for the lookup type 'MAR_STATUS' where the enabled
1048 -- flag is 'Y' and the effective start date of the person
1049 -- is between start date active and end date active on HR_LOOKUPS.
1050 --
1051 -- Access Status:
1052 -- Internal Table Handler Use Only.
1053 --
1054 procedure chk_marital_status
1055 (p_person_id in per_all_people_f.person_id%TYPE
1056 ,p_marital_status in per_all_people_f.marital_status%TYPE
1057 ,p_effective_date in date
1058 ,p_validation_start_date in date
1059 ,p_validation_end_date in date
1060 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
1061 )
1062 is
1063 --
1064 l_exists varchar2(1);
1065 l_proc varchar2(72) := g_package||'chk_marital_status';
1066 l_api_updating boolean;
1067 --
1068 begin
1069 if g_debug then
1070 hr_utility.set_location('Entering:'|| l_proc, 10);
1071 end if;
1072 --
1073 -- Check mandatory parameters have been set
1074 --
1075 hr_api.mandatory_arg_error
1076 (p_api_name => l_proc
1077 ,p_argument => 'effective date'
1078 ,p_argument_value => p_effective_date
1079 );
1080 --
1081 hr_api.mandatory_arg_error
1082 (p_api_name => l_proc
1083 ,p_argument => 'validation_start_date'
1084 ,p_argument_value => p_validation_start_date
1085 );
1086 --
1087 hr_api.mandatory_arg_error
1088 (p_api_name => l_proc
1089 ,p_argument => 'validation_end_date'
1090 ,p_argument_value => p_validation_end_date
1091 );
1092 if g_debug then
1093 hr_utility.set_location(l_proc, 20);
1094 end if;
1095 --
1096 -- Only proceed with validation if:
1097 -- a) The current g_old_rec is current and
1098 -- b) The marital status value has changed
1099 -- c) a record is being inserted
1100 --
1101 l_api_updating := per_per_shd.api_updating
1102 (p_person_id => p_person_id
1103 ,p_effective_date => p_effective_date
1104 ,p_object_version_number => p_object_version_number
1105 );
1106 if ((l_api_updating
1107 and nvl(per_per_shd.g_old_rec.marital_status, hr_api.g_varchar2)
1108 <> nvl(p_marital_status,hr_api.g_varchar2))
1109 or
1110 (NOT l_api_updating))
1111 then
1112 if g_debug then
1113 hr_utility.set_location(l_proc, 40);
1114 end if;
1115 --
1116 -- Check if marital status is set
1117 --
1118 If p_marital_status is not null then
1119 --
1120 -- Check that the marital status exists in hr_lookups for the
1121 -- lookup type 'MAR_STATUS' with an enabled flag set to 'Y' and that
1122 -- the effective start date of the person is between start date
1123 -- active and end date active in hr_lookups.
1124 --
1125 if hr_api.not_exists_in_dt_hr_lookups
1126 (p_effective_date => p_effective_date
1127 ,p_validation_start_date => p_validation_start_date
1128 ,p_validation_end_date => p_validation_end_date
1129 ,p_lookup_type => 'MAR_STATUS'
1130 ,p_lookup_code => p_marital_status
1131 )
1132 then
1133 --
1134 hr_utility.set_message(801, 'HR_7518_PER_M_STATUS_INVALID');
1135 hr_utility.raise_error;
1136 --
1137 end if;
1138 end if;
1139 if g_debug then
1140 hr_utility.set_location(l_proc, 60);
1141 end if;
1142 --
1143 end if;
1144 if g_debug then
1145 hr_utility.set_location(' Leaving:'|| l_proc, 70);
1146 end if;
1147 exception
1148 when app_exception.application_exception then
1149 if hr_multi_message.exception_add
1150 (p_associated_column1 => 'PER_ALL_PEOPLE_F.MARITAL_STATUS'
1151 ) then
1152 if g_debug then
1153 hr_utility.set_location(' Leaving:'||l_proc, 80);
1154 end if;
1155 raise;
1156 end if;
1157 if g_debug then
1158 hr_utility.set_location(' Leaving:'||l_proc,90);
1159 end if;
1160 end chk_marital_status;
1161 --
1162 -- ---------------------------------------------------------------------------
1163 -- |-----------------------< chk_party_id >----------------------------------|
1164 -- ---------------------------------------------------------------------------
1165 --
1166 -- Description:
1167 -- - Validates that the party exists as a party in HZ_PARTIES.
1168 --
1169 -- Pre-conditions:
1170 -- None
1171 --
1172 -- In Arguments:
1173 -- p_person_id
1174 -- p_party_id
1175 -- p_effective_date
1176 -- p_object_version_number
1177 --
1178 -- Post Success:
1179 -- Processing continues if:
1180 -- - party_id is null or party exists in hz_parties.
1181 --
1182 -- Post Failure:
1183 -- An application error is raised and processing is terminated if:
1184 -- - party_id does not exist in HZ_PARTIES.
1185 --
1186 -- Access Status:
1187 -- Internal Table Handler Use Only.
1188 --
1189 procedure chk_party_id
1190 (p_person_id in per_all_people_f.person_id%TYPE
1191 ,p_party_id in number
1192 ,p_effective_date in date
1193 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
1194 )
1195 is
1196 --
1197 l_exists varchar2(1);
1198 l_proc varchar2(72) := g_package||'chk_party_id';
1199 l_api_updating boolean;
1200 --
1201 cursor c1 is
1202 select null
1203 from hz_parties
1204 where party_id = p_party_id;
1205 --
1206 begin
1207 if g_debug then
1208 hr_utility.set_location('Entering:'|| l_proc, 10);
1209 end if;
1210 --
1211 -- Check mandatory parameters have been set
1212 --
1213 hr_api.mandatory_arg_error
1214 (p_api_name => l_proc
1215 ,p_argument => 'effective date'
1216 ,p_argument_value => p_effective_date
1217 );
1218 --
1219 if g_debug then
1220 hr_utility.set_location(l_proc, 20);
1221 end if;
1222 --
1223 -- Only proceed with validation if:
1224 -- a) The current g_old_rec is current and
1225 -- b) The party value has changed
1226 -- c) a record is being inserted
1227 --
1228 l_api_updating := per_per_shd.api_updating
1229 (p_person_id => p_person_id
1230 ,p_effective_date => p_effective_date
1231 ,p_object_version_number => p_object_version_number
1232 );
1233 if ((l_api_updating
1234 and nvl(per_per_shd.g_old_rec.party_id, hr_api.g_number)
1235 <> nvl(p_party_id,hr_api.g_number))
1236 or
1237 (NOT l_api_updating))
1238 then
1239 if g_debug then
1240 hr_utility.set_location(l_proc, 40);
1241 end if;
1242 --
1243 -- Check if party is set
1244 --
1245 If p_party_id is not null then
1246 --
1247 -- Check that the party_id exists in HZ_PARTIES.
1248 --
1249 open c1;
1250 fetch c1 into l_exists;
1251 if c1%notfound then
1252 --
1253 close c1;
1254 hr_utility.set_message(800, 'PER_289342_PARTY_ID_INVALID');
1255 hr_utility.raise_error;
1256 --
1257 end if;
1258 --
1259 close c1;
1260 --
1261 end if;
1262 --
1263 if g_debug then
1264 hr_utility.set_location(l_proc, 60);
1265 end if;
1266 --
1267 end if;
1268 if g_debug then
1269 hr_utility.set_location(' Leaving:'|| l_proc, 70);
1270 end if;
1271 exception
1272 when app_exception.application_exception then
1273 if hr_multi_message.exception_add
1274 (p_associated_column1 => 'PER_ALL_PEOPLE_F.PARTY_ID'
1275 ) then
1276 if g_debug then
1277 hr_utility.set_location(' Leaving:'||l_proc, 80);
1278 end if;
1279 raise;
1280 end if;
1281 if g_debug then
1282 hr_utility.set_location(' Leaving:'||l_proc,90);
1283 end if;
1284 end chk_party_id;
1285 --
1286 -- ---------------------------------------------------------------------------
1287 -- |-----------------------< chk_nationality >-----------------------------|
1288 -- ---------------------------------------------------------------------------
1289 --
1290 -- Description:
1291 -- Checks that a nationality value is valid
1292 -- - Validates that the nationality exists as a lookup code on
1293 -- HR_LOOKUPS for the lookup type 'NATIONALITY' with an enabled
1294 -- flag set to 'Y' and the effective start date of the person between
1295 -- start date active and end date active on HR_LOOKUPS.
1296 --
1297 -- Pre-conditions:
1298 -- None
1299 --
1300 -- In Arguments:
1301 -- p_person_id
1302 -- p_nationality
1303 -- p_effective_date
1304 -- p_validation_start_date
1305 -- p_validation_end_date
1306 -- p_object_version_number
1307 --
1308 -- Post Success:
1309 -- Processing continues if:
1310 -- - nationality exists as a lookup code in HR_LOOKUPS
1311 -- for the lookup type 'NATIONALITY' where the enabled
1312 -- flag is 'Y' and the effective start date of the person
1313 -- is between start date active and end date active on HR_LOOKUPS.
1314 --
1315 -- Post Failure:
1316 -- An application error is raised and processing is terminated if:
1317 -- - nationality does'nt exist as a lookup code in HR_LOOKUPS
1318 -- for the lookup type 'NATIONALITY' where the enabled
1319 -- flag is 'Y' and the effective start date of the person
1320 -- is between start date active and end date active on HR_LOOKUPS.
1321 --
1322 -- Access Status:
1323 -- Internal Table Handler Use Only.
1324 --
1325 procedure chk_nationality
1326 (p_person_id in per_all_people_f.person_id%TYPE
1327 ,p_nationality in per_all_people_f.nationality%TYPE
1328 ,p_effective_date in date
1329 ,p_validation_start_date in date
1330 ,p_validation_end_date in date
1331 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
1332 )
1333 is
1334 --
1335 l_exists varchar2(1);
1336 l_proc varchar2(72) := g_package||'chk_nationality';
1337 l_api_updating boolean;
1338 --
1339 begin
1340 if g_debug then
1341 hr_utility.set_location('Entering:'|| l_proc, 10);
1342 end if;
1343 --
1344 -- Check mandatory parameters have been set
1345 --
1346 hr_api.mandatory_arg_error
1347 (p_api_name => l_proc
1348 ,p_argument => 'effective date'
1349 ,p_argument_value => p_effective_date
1350 );
1351 --
1352 hr_api.mandatory_arg_error
1353 (p_api_name => l_proc
1354 ,p_argument => 'validation_start_date'
1355 ,p_argument_value => p_validation_start_date
1356 );
1357 --
1358 hr_api.mandatory_arg_error
1359 (p_api_name => l_proc
1360 ,p_argument => 'validation_end_date'
1361 ,p_argument_value => p_validation_end_date
1362 );
1363 -- Only proceed with validation if:
1364 -- a) The current g_old_rec is current and
1365 -- b) The nationality value has changed
1366 -- c) A record is being inserted
1367 --
1368 l_api_updating := per_per_shd.api_updating
1369 (p_person_id => p_person_id
1370 ,p_effective_date => p_effective_date
1371 ,p_object_version_number => p_object_version_number
1372 );
1373 if ((l_api_updating
1374 and nvl(per_per_shd.g_old_rec.nationality, hr_api.g_varchar2)
1375 <> nvl(p_nationality,hr_api.g_varchar2))
1376 or
1377 (NOT l_api_updating))
1378 then
1379 if g_debug then
1380 hr_utility.set_location(l_proc, 40);
1381 end if;
1382 --
1383 -- Check if nationality is set
1384 --
1385 if p_nationality is not null then
1386 --
1387 -- Check that the nationality exists in hr_lookups for the
1388 -- lookup type 'NATIONALITY' with an enabled flag set to 'Y' and that
1389 -- the effective start date of the person is between start date
1390 -- active and end date active in hr_lookups.
1391 --
1392 if hr_api.not_exists_in_dt_hr_lookups
1393 (p_effective_date => p_effective_date
1394 ,p_validation_start_date => p_validation_start_date
1395 ,p_validation_end_date => p_validation_end_date
1396 ,p_lookup_type => 'NATIONALITY'
1397 ,p_lookup_code => p_nationality
1398 )
1399 then
1400 --
1401 hr_utility.set_message(801, 'HR_7522_PER_NATION_INVALID');
1402 hr_utility.raise_error;
1403 --
1404 end if;
1405 if g_debug then
1406 hr_utility.set_location(l_proc, 50);
1407 end if;
1408 --
1409 end if;
1410 end if;
1411 if g_debug then
1412 hr_utility.set_location(' Leaving:'|| l_proc, 60);
1413 end if;
1414 exception
1415 when app_exception.application_exception then
1416 if hr_multi_message.exception_add
1417 (p_associated_column1 => 'PER_ALL_PEOPLE_F.NATIONALITY'
1418 ) then
1419 if g_debug then
1420 hr_utility.set_location(' Leaving:'||l_proc, 70);
1421 end if;
1422 raise;
1423 end if;
1424 if g_debug then
1425 hr_utility.set_location(' Leaving:'||l_proc,80);
1426 end if;
1427 end chk_nationality;
1428
1429 -- start for bug 6241572, a new overloaded procedure is created with
1430 -- p_region_of_birth, p_country_of_birth and p_nationality parameters.
1431
1432 procedure chk_national_identifier
1433 (p_person_id in per_all_people_f.person_id%TYPE
1434 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
1435 ,p_national_identifier in per_all_people_f.national_identifier%TYPE
1436 ,p_date_of_birth in date
1437 ,p_sex in per_all_people_f.sex%TYPE
1438 ,p_effective_date in date
1439 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
1440 ,p_legislation_code in per_business_groups.legislation_code%TYPE
1441 ,p_person_type_id in per_all_people_f.person_type_id%TYPE) is
1442
1443 -- declaring those variable which are not present in the previous
1444 -- chk_national_identifier
1445
1446 l_region_of_birth per_all_people_f.region_of_birth%TYPE;
1447 l_country_of_birth per_all_people_f.country_of_birth%TYPE;
1448 l_nationality per_all_people_f.nationality%TYPE;
1449
1450 begin
1451 --calling chk_nation_identifier
1452
1453 per_per_bus.chk_national_identifier
1454 (p_person_id => p_person_id,
1455 p_business_group_id => p_business_group_id,
1456 p_national_identifier => p_national_identifier,
1457 p_date_of_birth => p_date_of_birth,
1458 p_sex => p_sex,
1459 p_effective_date => p_effective_date,
1460 p_object_version_number => p_object_version_number,
1461 p_legislation_code => p_legislation_code,
1462 p_person_type_id => p_person_type_id,
1463 p_region_of_birth => l_region_of_birth,
1464 p_country_of_birth => l_country_of_birth,
1465 p_nationality => l_nationality);
1466
1467 end;
1468
1469 --end for bug 6241572
1470 --
1471 -- ---------------------------------------------------------------------------
1472 -- |-------------------< chk_national_identifier >-------------------------|
1473 -- ---------------------------------------------------------------------------
1474 --
1475 -- Description:
1476 -- Calls process hr_person.validate_national_identifier
1477 --
1478 -- Pre-conditions:
1479 -- Business Group id must be valid
1480 --
1481 -- In Arguments:
1482 -- p_person_id
1483 -- p_business_group_id
1484 -- p_national_identifier
1485 -- p_date_of_birth
1486 -- p_sex
1487 -- p_effective_date
1488 -- p_object_version_number
1489 -- p_legislation_code
1490 -- p_person_type_id - Bug 1642707.
1491 --
1492 -- Post Success:
1493 -- If the national identifier is valid then
1494 -- processing continues
1495 --
1496 -- Post Failure:
1497 -- If the national identifier is not valid then
1498 -- an application error is raised and processing is terminated
1499 --
1500 -- Access Status:
1501 -- Internal Table Handler Use Only.
1502 --
1503 procedure chk_national_identifier
1504 (p_person_id in per_all_people_f.person_id%TYPE
1505 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
1506 ,p_national_identifier in per_all_people_f.national_identifier%TYPE
1507 ,p_date_of_birth in date
1508 ,p_sex in per_all_people_f.sex%TYPE
1509 ,p_effective_date in date
1510 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
1511 ,p_legislation_code in per_business_groups.legislation_code%TYPE
1512 ,p_person_type_id in per_all_people_f.person_type_id%TYPE
1513
1514 --added new parameter for bug 6241572
1515 ,p_region_of_birth in per_all_people_f.region_of_birth%TYPE default NULL
1516 ,p_country_of_birth in per_all_people_f.country_of_birth%TYPE default NULL
1517 ,p_nationality in per_all_people_f.nationality%TYPE) is
1518
1519 --
1520 l_exists varchar2(1);
1521 l_proc varchar2(72) := g_package||'chk_national_identifier';
1522 l_api_updating boolean;
1523 l_valid_ni varchar2(240);
1524 l_warning varchar2(1) := 'N';
1525 l_prof_val varchar2(50) ; -- #4069243
1526 --
1527 begin
1528 if g_debug then
1529 hr_utility.set_location('Entering:'|| l_proc, 1);
1530 end if;
1531 --
1532 -- Check mandatory parameters have been set
1533 --
1534 hr_api.mandatory_arg_error
1535 (p_api_name => l_proc
1536 ,p_argument => 'business group id'
1537 ,p_argument_value => p_business_group_id
1538 );
1539 --
1540 hr_api.mandatory_arg_error
1541 (p_api_name => l_proc
1542 ,p_argument => 'effective date'
1543 ,p_argument_value => p_effective_date
1544 );
1545 --
1546 -- Only proceed with validation if:
1547 -- a) The current g_old_rec is current and
1548 -- b) national identifier has changed
1549 -- c) A record is being inserted
1550 --
1551 l_api_updating := per_per_shd.api_updating
1552 (p_person_id => p_person_id
1553 ,p_effective_date => p_effective_date
1554 ,p_object_version_number => p_object_version_number);
1555 --
1556 if ((l_api_updating and nvl(per_per_shd.g_old_rec.national_identifier,
1557 hr_api.g_varchar2)
1558 <> nvl(p_national_identifier,hr_api.g_varchar2)) or
1559 (NOT l_api_updating)) then
1560 --
1561 if g_debug then
1562 hr_utility.set_location(l_proc, 2);
1563 end if;
1564 --
1565 -- If national identifier is not null then
1566 -- Call process to validate national identifier
1567 -- (If validation is successful, but returns different format
1568 -- raise error)
1569 --
1570 if p_national_identifier is not null then
1571 l_valid_ni := hr_ni_chk_pkg.validate_national_identifier(
1572 p_national_identifier => p_national_identifier,
1573 p_birth_date => p_date_of_birth,
1574 p_gender => p_sex,
1575 p_person_id => p_person_id,
1576 p_business_group_id => p_business_group_id,
1577 p_legislation_code => p_legislation_code,
1578 p_session_date => p_effective_date,
1579 p_warning => l_warning,
1580 p_person_type_id => p_person_type_id,
1581 --change for bug 6241572
1582 p_region_of_birth => p_region_of_birth,
1583 p_country_of_birth => p_country_of_birth,
1584 p_nationality => p_nationality );
1585 --
1586 --
1587 --
1588 -- 3807899 - Modified the 'or' condition to 'and'
1589 -- Also modified the value used to set the token 'RETURNED_VALUE' to l_valid_ni
1590 -- instead of '123-45-789'
1591 --
1592 if fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION') <> 'NONE' and fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION') <> 'WARN' then
1593 -- #932657
1594 if l_valid_ni <> p_national_identifier then
1595 hr_utility.set_message(800, 'HR_52765_PER_INV_NI_FORMAT');
1596 hr_utility.set_message_token('P_N_I', p_national_identifier);
1597 hr_utility.set_message_token('RETURNED_VALUE', l_valid_ni); --3807899
1598 hr_utility.raise_error;
1599 end if;
1600 end if;
1601 -- 4069243 start
1602 l_prof_val := fnd_profile.value ('PER_NI_UNIQUE_ERROR_WARNING');
1603
1604 hr_ni_chk_pkg.check_ni_unique
1605 (p_national_identifier => p_national_identifier
1606 ,p_person_id => p_person_id
1607 ,p_business_group_id =>p_business_group_id
1608 ,p_raise_error_or_warning => nvl(l_prof_val,'WARNING'));
1609 -- 4069243 end
1610 end if;
1611 --
1612 end if;
1613 if g_debug then
1614 hr_utility.set_location(' Leaving:'|| l_proc, 3);
1615 end if;
1616 exception
1617 when app_exception.application_exception then
1618 if hr_multi_message.exception_add
1619 (p_associated_column1 => 'PER_ALL_PEOPLE_F.NATIONAL_IDENTIFIER'
1620 ) then
1621 if g_debug then
1622 hr_utility.set_location(' Leaving:'||l_proc, 4);
1623 end if;
1624 raise;
1625 end if;
1626 if g_debug then
1627 hr_utility.set_location(' Leaving:'||l_proc,5);
1628 end if;
1629 end chk_national_identifier;
1630 --
1631 -- ---------------------------------------------------------------------------
1632 -- |-----------------------< chk_employee_number >-------------------------|
1633 -- ---------------------------------------------------------------------------
1634 --
1635 -- Description:
1636 -- Checks that an employee value is valid
1637 --
1638 -- Pre-conditions:
1639 -- p_person_type_id must be valid
1640 -- p_business_group_id must be valid for p_person_id
1641 -- p_national_identifier must be valid
1642 --
1643 -- In Arguments:
1644 -- p_person_id
1645 -- p_business_group_id
1646 -- p_person_type_id
1647 -- p_employee_number
1648 -- p_national_identifier
1649 -- p_effective_date
1650 -- p_object_version_number
1651 --
1652 -- Post Success:
1653 -- If system person type is 'EMP', 'EX_EMP', 'EMP_APL' or 'EX_EMP_APL' then
1654 -- employee number is defined based on employee number generation method as
1655 -- follows :
1656 --
1657 -- If employee number is not null and employee number generation method
1658 -- is 'Manual' then processing continues.
1659 -- If employee number is null and employee number generation method is
1660 -- 'Automatic' then employee number is generated and processing
1661 -- continues.
1662 -- If employee number is null and national identifier is not null and
1663 -- the employee number generation method is 'National identifier' then
1664 -- employee number is set to national identifier and processing
1665 -- continues.
1666 --
1667 -- If the employee number is unique within the business group then
1668 -- processing continues
1669 --
1670 -- Post Failure:
1671 -- If system person type is 'EMP', 'EX_EMP', 'EMP_APL' or 'EX_EMP_APL' then
1672 -- If employee number is null then
1673 -- an application error will be raised and processing is terminated
1674 --
1675 -- If system person type is anything other than 'EMP', 'EX_EMP', 'EMP_APL'
1676 -- or 'EX_EMP_APL' then
1677 -- If employee number is not null then
1678 -- an application error will be raised and processing is terminated
1679 --
1680 -- If the employee number is not unique within the business group then
1681 -- an application error will be raised and processing is terminated
1682 --
1683 -- Access Status:
1684 -- Internal Table Handler Use Only.
1685 --
1686 procedure chk_employee_number
1687 (p_person_id in per_all_people_f.person_id%TYPE
1688 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
1689 ,p_person_type_id in per_all_people_f.person_type_id%TYPE
1690 ,p_employee_number in out nocopy per_all_people_f.employee_number%TYPE
1691 ,p_national_identifier in per_all_people_f.national_identifier%TYPE
1692 ,p_effective_date in date
1693 ,p_object_version_number in per_all_people_f.object_version_number%TYPE)
1694 is
1695 begin
1696 chk_employee_number
1697 (p_person_id => p_person_id
1698 ,p_business_group_id => p_business_group_id
1699 ,p_person_type_id => p_person_type_id
1700 ,p_employee_number => p_employee_number
1701 ,p_national_identifier => p_national_identifier
1702 ,p_effective_date => p_effective_date
1703 ,p_object_version_number => p_object_version_number
1704 ,p_party_id => null
1705 ,p_date_of_birth => null
1706 ,p_start_date => null
1707 );
1708 end chk_employee_number;
1709 --
1710 -- Overloaded
1711 --
1712 procedure chk_employee_number
1713 (p_person_id in per_all_people_f.person_id%TYPE
1714 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
1715 ,p_person_type_id in per_all_people_f.person_type_id%TYPE
1716 ,p_employee_number in out nocopy per_all_people_f.employee_number%TYPE
1717 ,p_national_identifier in per_all_people_f.national_identifier%TYPE
1718 ,p_effective_date in date
1719 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
1720 ,p_party_id in per_all_people_f.party_id%TYPE
1721 ,p_date_of_birth in per_all_people_f.date_of_birth%TYPE
1722 ,p_start_date in per_periods_of_service.date_start%TYPE)
1723 is
1724 --
1725 l_exists varchar2(1);
1726 l_proc varchar2(72) := g_package||'chk_employee_number';
1727 l_api_updating boolean;
1728 l_applicant_number per_all_people_f.applicant_number%TYPE;
1729 l_npw_number per_all_people_f.npw_number%TYPE;
1730 l_gen_method varchar2(1);
1731 l_emp_ni boolean := false;
1732 --
1733 cursor csr_gen_method is
1734 select pbg.method_of_generation_emp_num
1735 from per_business_groups pbg
1736 where pbg.business_group_id = p_business_group_id;
1737 --
1738 -- Declare the function emp_sys_per_type_change
1739 --
1740 function emp_sys_per_type_change
1741 (p_new_person_type_id numeric
1742 ,p_old_person_type_id numeric
1743 ,p_business_group_id numeric)
1744 return boolean is
1745 --
1746 l_new_system_person_type per_person_types.system_person_type%TYPE;
1747 l_old_system_person_type per_person_types.system_person_type%TYPE;
1748 l_return_status boolean;
1749 l_proc varchar2(25) := 'emp_sys_per_type_change';
1750 --
1751 -- Cursor to get the system_person_type for the 'old' person_type_id
1752 --
1753 cursor get_old_sys_per_type is
1754 select system_person_type
1755 from per_person_types
1756 where person_type_id = p_old_person_type_id
1757 and business_group_id = p_business_group_id;
1758 --
1759 begin
1760 --
1761 if g_debug then
1762 hr_utility.set_location('Entering '||l_proc,10);
1763 end if;
1764 --
1765 -- Assume we have not changed the system_person_type, so set return
1766 -- variable to FALSE.
1767 --
1768 l_return_status := false;
1769 --
1770 -- Check the person_type_id has actually changed
1771 --
1772 if p_new_person_type_id <> p_old_person_type_id then
1773 --
1774 if g_debug then
1775 hr_utility.set_location(l_proc, 20);
1776 end if;
1777 --
1778 -- Get the system_person_type for the 'new' person_type_id
1779 --
1780 l_new_system_person_type := return_system_person_type
1781 (p_person_type_Id =>p_new_person_type_id
1782 ,p_business_group_id =>p_business_group_id
1783 );
1784 if g_debug then
1785 hr_utility.set_location(l_proc, 30);
1786 end if;
1787 --
1788 -- Get the system_person_type for the 'old' person_type_id
1789 --
1790 open get_old_sys_per_type;
1791 fetch get_old_sys_per_type into l_old_system_person_type;
1792 close get_old_sys_per_type;
1793 --
1794 -- If the system_person_type's have changed then check the transition
1795 -- to see if the employee number needs to be validated/generated
1796 --
1797 if ((l_old_system_person_type = 'OTHER' and
1798 l_new_system_person_type = 'EMP')
1799 or
1800 (l_old_system_person_type = 'APL' and
1801 l_new_system_person_type in ('EMP','EMP_APL'))
1802 or
1803 (l_old_system_person_type = 'APL_EX_APL' and
1804 l_new_system_person_type = 'EMP')
1805 or
1806 (l_old_system_person_type = 'EX_APL' and -- 4100548
1807 l_new_system_person_type = 'EMP')
1808 ) then
1809 --
1810 if g_debug then
1811 hr_utility.set_location(l_proc, 40);
1812 end if;
1813 --
1814 l_return_status := true;
1815 end if;
1816 if g_debug then
1817 hr_utility.set_location(l_proc, 50);
1818 end if;
1819 end if;
1820 if g_debug then
1821 hr_utility.set_location(' Leaving '||l_proc, 60);
1822 end if;
1823 return l_return_status;
1824 end emp_sys_per_type_change;
1825 --
1826 -- Declare the function emp_ni_change
1827 --
1828 function emp_ni_change
1829 (p_new_ni varchar2
1830 ,p_old_ni varchar2
1831 ,p_gen_method varchar2)
1832 return boolean is
1833 --
1834 l_return_status boolean := FALSE;
1835 l_proc varchar2(30) := 'emp_ni_change';
1836 --
1837 begin
1838 if g_debug then
1839 hr_utility.set_location('Entering '||l_proc,10);
1840 end if;
1841 --
1842 if p_gen_method = 'N' and
1843 p_new_ni <> p_old_ni then
1844 if g_debug then
1845 hr_utility.set_location(l_proc,20);
1846 end if;
1847 l_return_status := TRUE;
1848 end if;
1849 if g_debug then
1850 hr_utility.set_location(' Leaving '||l_proc,30);
1851 end if;
1852 return l_return_status;
1853 end emp_ni_change;
1854 --
1855 begin
1856 if g_debug then
1857 hr_utility.set_location('Entering:'|| l_proc, 10);
1858 end if;
1859 if hr_multi_message.no_exclusive_error
1860 (p_check_column1 => 'PER_ALL_PEOPLE_F.NATIONAL_IDENTIFIER'
1861 )
1862 then
1863 --
1864 -- Check mandatory parameters have been set
1865 --
1866 hr_api.mandatory_arg_error
1867 (p_api_name => l_proc
1868 ,p_argument => 'business group id'
1869 ,p_argument_value => p_business_group_id
1870 );
1871 --
1872 hr_api.mandatory_arg_error
1873 (p_api_name => l_proc
1874 ,p_argument => 'person type id'
1875 ,p_argument_value => p_person_type_id
1876 );
1877 --
1878 hr_api.mandatory_arg_error
1879 (p_api_name => l_proc
1880 ,p_argument => 'effective date'
1881 ,p_argument_value => p_effective_date
1882 );
1883 --
1884 -- Only proceed with validation if:
1885 -- a) The current g_old_rec is current and
1886 -- b) The employee number value has changed
1887 -- c) The system_person_type has changed in such a way that emp number is
1888 -- now required.
1889 -- d) The NI has changed and the generation method for emp num is 'N'
1890 -- e) a record is being inserted
1891 --
1892 l_api_updating := per_per_shd.api_updating
1893 (p_person_id => p_person_id
1894 ,p_effective_date => p_effective_date
1895 ,p_object_version_number => p_object_version_number);
1896 --
1897 -- Get the generation method
1898 --
1899 open csr_gen_method;
1900 fetch csr_gen_method into l_gen_method;
1901 close csr_gen_method;
1902 if g_debug then
1903 hr_utility.set_location(l_proc, 20);
1904 end if;
1905 --
1906 -- Need to validate/generate the employee number if the employee number
1907 -- has changed or if the system person type has changed in such a way
1908 -- that an employee number is now required or if the NI number has changed
1909 -- and the generation method is 'N'.
1910 --
1911 if ((l_api_updating and (nvl(per_per_shd.g_old_rec.employee_number,
1912 hr_api.g_varchar2) <>
1913 nvl(p_employee_number, hr_api.g_varchar2)
1914 or emp_sys_per_type_change
1915 (p_person_type_id
1916 ,per_per_shd.g_old_rec.person_type_id
1917 ,p_business_group_id)
1918 or emp_ni_change
1919 (p_national_identifier
1920 ,per_per_shd.g_old_rec.national_identifier
1921 ,l_gen_method)))
1922 or
1923 (NOT l_api_updating)) then
1924 --
1925 if g_debug then
1926 hr_utility.set_location(l_proc, 30);
1927 end if;
1928 --
1929 -- If we are updating and the employee number has actually changed then
1930 -- ensure the number generation method is not automatic.
1931 --
1932 if l_api_updating and
1933 nvl(per_per_shd.g_old_rec.employee_number, hr_api.g_varchar2) <>
1934 nvl(p_employee_number, hr_api.g_varchar2) and
1935 l_gen_method = 'A'
1936 and (not g_global_transfer_in_process
1937 OR
1938 (g_global_transfer_in_process
1939 and (PER_BG_NUMBERING_METHOD_PKG.Get_PersonNumber_Formula
1940 ('EMP',p_effective_date) is not null))
1941 and per_per_shd.g_old_rec.employee_number is not null)
1942 then
1943 hr_utility.set_message(801, 'HR_51239_PER_INV_EMP_UPD');
1944 hr_utility.raise_error;
1945 end if;
1946 if g_debug then
1947 hr_utility.set_location(l_proc, 50);
1948 end if;
1949 --
1950 -- Perform employee number validation as required by number generation
1951 -- method for the business group, and ensure that it is
1952 -- unique within the business group.
1953 --
1954 if return_system_person_type(p_person_type_id, p_business_group_id) in
1955 ('EMP','EX_EMP', 'EMP_APL','EX_EMP_APL') then
1956 --
1957 if g_debug then
1958 hr_utility.set_location(l_proc, 60);
1959 end if;
1960 --
1961 -- If generation method is 'A' ensure employee number IN is set null
1962 --
1963 if l_gen_method = 'A' and
1964 p_employee_number is not null
1965 and (not g_global_transfer_in_process
1966 OR
1967 (g_global_transfer_in_process
1968 and (PER_BG_NUMBERING_METHOD_PKG.Get_PersonNumber_Formula
1969 ('EMP',p_effective_date) is not null)))
1970 then
1971 --
1972 hr_utility.set_message(801,'HR_51240_PER_EMP_NUM_NOT_NULL');
1973 hr_utility.raise_error;
1974 end if;
1975 if g_debug then
1976 hr_utility.set_location(l_proc, 70);
1977 end if;
1978 --
1979 -- If generation method is 'N' ensure employee number IN is set null
1980 -- on insert.
1981 --
1982 if l_gen_method = 'N' and
1983 NOT l_api_updating and
1984 p_employee_number <> p_national_identifier then
1985 --
1986 hr_utility.set_message(801,'HR_51241_PER_EMP_NUM_NOT_NULL');
1987 l_emp_ni := true;
1988 hr_utility.raise_error;
1989 end if;
1990 if g_debug then
1991 hr_utility.set_location(l_proc, 80);
1992 end if;
1993 --
1994 -- If generation method is 'N' ensure national identifier IN is not null
1995 --
1996 if l_gen_method = 'N' and
1997 p_national_identifier is null then
1998 --
1999 hr_utility.set_message(801,'HR_51242_PER_NAT_ID_NULL');
2000 l_emp_ni := true;
2001 hr_utility.raise_error;
2002 end if;
2003 if g_debug then
2004 hr_utility.set_location(l_proc, 90);
2005 end if;
2006 --
2007 -- Call number generation routine.
2008 --
2009 if l_gen_method = 'A'
2010 and nvl(fnd_profile.value('PER_GLOBAL_EMP_NUM'),'N') = 'Y'
2011 and ( PER_BG_NUMBERING_METHOD_PKG.Get_PersonNumber_Formula
2012 ('EMP',p_effective_date)) is null
2013 and p_employee_number is not null
2014 and g_global_transfer_in_process then
2015 --
2016 -- For global transfers we allow passing employee number if numbering
2017 -- is by global sequence ONLY
2018 -- The expectation is that the number will be same as original BG record
2019 -- If it is not set then we assume normal rules should apply
2020 --
2021 null;
2022 --
2023 else
2024 hr_person.generate_number(p_current_employee => 'Y'
2025 ,p_current_applicant => 'N'
2026 ,p_current_npw => 'N'
2027 ,p_national_identifier => p_national_identifier
2028 ,p_business_group_id => p_business_group_id
2029 ,p_person_id => p_person_id
2030 ,p_employee_number => p_employee_number
2031 ,p_applicant_number => l_applicant_number
2032 ,p_npw_number => l_npw_number
2033 ,p_effective_date => p_effective_date
2034 ,p_party_id => p_party_id
2035 ,p_date_of_birth => p_date_of_birth
2036 ,p_start_date => p_effective_date);
2037 end if;
2038 --
2039 if g_debug then
2040 hr_utility.set_location(l_proc, 100);
2041 end if;
2042 --
2043 -- Check uniqueness of generated number if not generated automatically
2044 --
2045 if l_gen_method <> 'A' then
2046 --
2047 if g_debug then
2048 hr_utility.set_location(l_proc, 104);
2049 end if;
2050 --
2051 hr_person.validate_unique_number
2052 (p_person_id => p_person_id
2053 ,p_business_group_id => p_business_group_id
2054 ,p_employee_number => p_employee_number
2055 ,p_applicant_number => null
2056 ,p_npw_number => null
2057 ,p_current_employee => 'Y'
2058 ,p_current_applicant => 'N'
2059 ,p_current_npw => 'N');
2060 --
2061 if g_debug then
2062 hr_utility.set_location(l_proc, 108);
2063 end if;
2064 --
2065 end if;
2066 --
2067 if g_debug then
2068 hr_utility.set_location(l_proc, 110);
2069 end if;
2070 --
2071 else
2072 --
2073 -- System person type is not 'EMP','EX_EMP','EMP_APL' or 'EX_EMP_APL'
2074 -- so employee number must be null
2075 --
2076 if g_debug then
2077 hr_utility.set_location(l_proc, 120);
2078 end if;
2079 --
2080 if p_employee_number is not null then
2081 -- Error: You cannot enter an employee number for this person type
2082 hr_utility.set_message(801, 'HR_7523_PER_EMP_NO_NOT_NULL');
2083 hr_utility.raise_error;
2084 end if;
2085 --
2086 if g_debug then
2087 hr_utility.set_location(l_proc, 130);
2088 end if;
2089 --
2090 end if;
2091 end if;
2092 end if;
2093 if g_debug then
2094 hr_utility.set_location(' Leaving:'|| l_proc, 140);
2095 end if;
2096 exception
2097 when app_exception.application_exception then
2098 -- if error is not because of national identifier
2099 if not l_emp_ni
2100 then
2101 if hr_multi_message.exception_add
2102 (p_associated_column1 => 'PER_ALL_PEOPLE_F.EMPLOYEE_NUMBER'
2103 ) then
2104 if g_debug then
2105 hr_utility.set_location(' Leaving:'||l_proc, 150);
2106 end if;
2107 raise;
2108 end if;
2109 else
2110 if hr_multi_message.exception_add
2111 (p_associated_column1 => 'PER_ALL_PEOPLE_F.EMPLOYEE_NUMBER'
2112 ,p_associated_column2 => 'PER_ALL_PEOPLE_F.NATIONAL_IDENTIFIER'
2113 ) then
2114 if g_debug then
2115 hr_utility.set_location(' Leaving:'||l_proc, 160);
2116 end if;
2117 raise;
2118 end if;
2119 end if;
2120 if g_debug then
2121 hr_utility.set_location(' Leaving:'||l_proc,170);
2122 end if;
2123 end chk_employee_number;
2124 --
2125 -- ---------------------------------------------------------------------------
2126 -- |-----------------------< chk_npw_number >------------------------------|
2127 -- ---------------------------------------------------------------------------
2128 --
2129 -- Description:
2130 -- Checks that cwk number value is valid
2131 --
2132 -- Pre-conditions:
2133 -- p_person_type_id must be valid
2134 -- p_business_group_id must be valid for p_person_id
2135 -- p_national_identifier must be valid
2136 --
2137 -- In Arguments:
2138 -- p_person_id
2139 -- p_business_group_id
2140 -- p_current_npw_flag
2141 -- p_npw_number
2142 -- p_national_identifier
2143 -- p_effective_date
2144 -- p_object_version_number
2145 --
2146 -- Post Success:
2147 -- If current_npw_flag = Y or there exists a previous CWK record on PTU,
2148 -- npw number is defined based on cwk number generation method as
2149 -- follows :
2150 --
2151 -- If npw number is not null and cwk number generation method
2152 -- is 'Manual' then processing continues.
2153 -- If npw number is null and cwk number generation method is
2154 -- 'Automatic' then npw number is generated and processing
2155 -- continues.
2156 -- If npw number is null and national identifier is not null and
2157 -- the cwk number generation method is 'National identifier' then
2158 -- npw number is set to national identifier and processing
2159 -- continues.
2160 --
2161 -- If the npw number is unique within the business group then
2162 -- processing continues
2163 --
2164 -- Post Failure:
2165 -- If current_npw_flag = 'Y' or there exists a previous CWK record on PTU
2166 -- If npw number is null then
2167 -- an application error will be raised and processing is terminated
2168 --
2169 -- If current_npw_flag = N or (is null and no previous CWK record exists on PTU)
2170 -- If npw number is not null then
2171 -- an application error will be raised and processing is terminated
2172 --
2173 -- If the npw number is not unique within the business group then
2174 -- an application error will be raised and processing is terminated
2175 --
2176 -- Access Status:
2177 -- Internal Development Use Only.
2178 --
2179 procedure chk_npw_number
2180 (p_person_id in per_all_people_f.person_id%TYPE
2181 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
2182 ,p_current_npw_flag in per_all_people_f.current_npw_flag%TYPE
2183 ,p_npw_number in out nocopy per_all_people_f.npw_number%TYPE
2184 ,p_national_identifier in per_all_people_f.national_identifier%TYPE
2185 ,p_effective_date in date
2186 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
2187 )
2188 is
2189 begin
2190 chk_npw_number
2191 (p_person_id => p_person_id
2192 ,p_business_group_id => p_business_group_id
2193 ,p_current_npw_flag => p_current_npw_flag
2194 ,p_npw_number => p_npw_number
2195 ,p_national_identifier => p_national_identifier
2196 ,p_effective_date => p_effective_date
2197 ,p_object_version_number => p_object_version_number
2198 ,p_party_id => null
2199 ,p_date_of_birth => null
2200 ,p_start_date => null
2201 );
2202 end chk_npw_number;
2203 --
2204 procedure chk_npw_number
2205 (p_person_id in per_all_people_f.person_id%TYPE
2206 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
2207 ,p_current_npw_flag in per_all_people_f.current_npw_flag%TYPE
2208 ,p_npw_number in out nocopy per_all_people_f.npw_number%TYPE
2209 ,p_national_identifier in per_all_people_f.national_identifier%TYPE
2210 ,p_effective_date in date
2211 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
2212 ,p_party_id in per_all_people_f.party_id%TYPE
2213 ,p_date_of_birth in per_all_people_f.date_of_birth%TYPE
2214 ,p_start_date in date
2215 )
2216 is
2217 --
2218 l_proc varchar2(72) := g_package||'chk_npw_number';
2219 l_exists varchar2(1);
2220 l_api_updating boolean;
2221 l_applicant_number per_all_people_f.applicant_number%TYPE;
2222 l_employee_number per_all_people_f.employee_number%TYPE;
2223 l_gen_method varchar2(1);
2224 l_npw_ni boolean := false;
2225 --
2226 cursor csr_gen_method is
2227 select pbg.method_of_generation_cwk_num
2228 from per_business_groups pbg
2229 where pbg.business_group_id = p_business_group_id;
2230 --
2231 -- Declare the function emp_ni_change
2232 --
2233 function npw_ni_change
2234 (p_new_ni varchar2
2235 ,p_old_ni varchar2
2236 ,p_gen_method varchar2)
2237 return boolean is
2238 --
2239 l_return_status boolean := FALSE;
2240 l_proc varchar2(30) := 'npw_ni_change';
2241 --
2242 begin
2243 if g_debug then
2244 hr_utility.set_location('Entering '||l_proc,10);
2245 end if;
2246 --
2247 if p_gen_method = 'N' and
2248 p_new_ni <> p_old_ni then
2249 if g_debug then
2250 hr_utility.set_location(l_proc,20);
2251 end if;
2252 l_return_status := TRUE;
2253 end if;
2254 if g_debug then
2255 hr_utility.set_location(' Leaving '||l_proc,30);
2256 end if;
2257 return l_return_status;
2258 end npw_ni_change;
2259 --
2260 begin
2261 if g_debug then
2262 hr_utility.set_location('Entering:'|| l_proc, 10);
2263 end if;
2264 if hr_multi_message.no_exclusive_error
2265 (p_check_column1 => 'PER_ALL_PEOPLE_F.NATIONAL_IDENTIFIER'
2266 )
2267 then
2268 --
2269 -- Check mandatory parameters have been set
2270 --
2271 hr_api.mandatory_arg_error
2272 (p_api_name => l_proc
2273 ,p_argument => 'business group id'
2274 ,p_argument_value => p_business_group_id
2275 );
2276 --
2277 hr_api.mandatory_arg_error
2278 (p_api_name => l_proc
2279 ,p_argument => 'effective date'
2280 ,p_argument_value => p_effective_date
2281 );
2282 --
2283 -- Only proceed with validation if:
2284 -- a) The current g_old_rec is current and
2285 -- b) The npw number value has changed
2286 -- c) The current_npw_flag has changed in such a way that npw_number is
2287 -- now required.
2288 -- d) The NI has changed and the generation method for npw num is 'N'
2289 -- e) a record is being inserted
2290 --
2291 l_api_updating := per_per_shd.api_updating
2292 (p_person_id => p_person_id
2293 ,p_effective_date => p_effective_date
2294 ,p_object_version_number => p_object_version_number);
2295 --
2296 -- Get the generation method
2297 --
2298 open csr_gen_method;
2299 fetch csr_gen_method into l_gen_method;
2300 close csr_gen_method;
2301 if g_debug then
2302 hr_utility.set_location(l_proc, 20);
2303 end if;
2304 --
2305 --
2306 -- Need to validate/generate the npw number if the npw number
2307 -- has changed or if the current_npw_flag has changed in such a way
2308 -- that an npw number is now required or if the NI number has changed
2309 -- and the generation method is 'N'.
2310 --
2311 if ((l_api_updating and (nvl(per_per_shd.g_old_rec.npw_number,
2312 hr_api.g_varchar2) <>
2313 nvl(p_npw_number, hr_api.g_varchar2)
2314 or (p_current_npw_flag = 'Y'
2315 and per_per_shd.g_old_rec.current_npw_flag is null)
2316 or npw_ni_change
2317 (p_national_identifier
2318 ,per_per_shd.g_old_rec.national_identifier
2319 ,l_gen_method)))
2320 or
2321 (NOT l_api_updating)) then
2322 --
2323 if g_debug then
2324 hr_utility.set_location(l_proc, 30);
2325 end if;
2326 --
2327 -- If we are updating and the npw number has actually changed then
2328 -- ensure the number generation method is not automatic.
2329 --
2330 if l_api_updating and
2331 nvl(per_per_shd.g_old_rec.npw_number, hr_api.g_varchar2) <>
2332 nvl(p_npw_number, hr_api.g_varchar2) and
2333 l_gen_method = 'A' then
2334 hr_utility.set_message(800, 'HR_289657_PER_INV_CWK_UPD');
2335 hr_utility.raise_error;
2336 end if;
2337 if g_debug then
2338 hr_utility.set_location(l_proc, 50);
2339 end if;
2340 --
2341 -- Perform npw number validation as required by number generation
2342 -- method for the business group, and ensure that it is
2343 -- unique within the business group.
2344 --
2345 if p_current_npw_flag = 'Y' then
2346 --
2347 if g_debug then
2348 hr_utility.set_location(l_proc, 60);
2349 end if;
2350 --
2351 -- If generation method is not specified then error: ct. may not have upgraded
2352 -- BG info
2353 if l_gen_method is null then
2354 --
2355 hr_utility.set_message(800,'PER_289634_CWK_GEN_NOT_NULL');
2356 hr_utility.raise_error;
2357 end if;
2358 if g_debug then
2359 hr_utility.set_location(l_proc, 60);
2360 end if;
2361 --
2362 -- If generation method is 'A' ensure npw number IN is set null
2363 -- or has not changed from its previous value (fixes 2876274)
2364 --
2365 if l_gen_method = 'A' and
2366 p_npw_number is not null and
2367 p_npw_number <> nvl(per_per_shd.g_old_rec.npw_number,hr_api.g_varchar2) then
2368 --
2369 hr_utility.set_message(800,'PER_289635_CWK_NUM_NOT_NULL');
2370 hr_utility.raise_error;
2371 end if;
2372 if g_debug then
2373 hr_utility.set_location(l_proc, 70);
2374 end if;
2375 --
2376 -- If generation method is 'N' ensure npw number IN is set null
2377 -- on insert.
2378 --
2379 if l_gen_method = 'N' and
2380 NOT l_api_updating and
2381 p_npw_number <> p_national_identifier then
2382 --
2383 hr_utility.set_message(800,'PER_289636_CWK_NUM_NOT_NULL');
2384 l_npw_ni := true;
2385 hr_utility.raise_error;
2386 end if;
2387 if g_debug then
2388 hr_utility.set_location(l_proc, 80);
2389 end if;
2390 --
2391 -- If generation method is 'N' ensure national identifier IN is not null
2392 --
2393 if l_gen_method = 'N' and
2394 p_national_identifier is null then
2395 --
2396 hr_utility.set_message(800,'PER_289637_CWK_NAT_ID_NULL');
2397 l_npw_ni := true;
2398 hr_utility.raise_error;
2399 end if;
2400 if g_debug then
2401 hr_utility.set_location(l_proc, 90);
2402 end if;
2403 --
2404 -- Call number generation routine.
2405 --
2406 hr_person.generate_number(p_current_employee => 'N'
2407 ,p_current_applicant => 'N'
2408 ,p_current_npw => 'Y'
2409 ,p_national_identifier => p_national_identifier
2410 ,p_business_group_id => p_business_group_id
2411 ,p_person_id => p_person_id
2412 ,p_employee_number => l_employee_number
2413 ,p_applicant_number => l_applicant_number
2414 ,p_npw_number => p_npw_number
2415 ,p_effective_date => p_effective_date
2416 ,p_party_id => p_party_id
2417 ,p_date_of_birth => p_date_of_birth
2418 ,p_start_date => p_effective_date);
2419
2420 --
2421 if g_debug then
2422 hr_utility.set_location(l_proc, 100);
2423 end if;
2424 --
2425 -- Check uniqueness of generated number if not generated automatically
2426 --
2427 if l_gen_method <> 'A' then
2428 --
2429 if g_debug then
2430 hr_utility.set_location(l_proc, 104);
2431 end if;
2432 --
2433 hr_person.validate_unique_number
2434 (p_person_id => p_person_id
2435 ,p_business_group_id => p_business_group_id
2436 ,p_employee_number => null
2437 ,p_applicant_number => null
2438 ,p_npw_number => p_npw_number
2439 ,p_current_employee => 'N'
2440 ,p_current_applicant => 'N'
2441 ,p_current_npw => 'Y');
2442 --
2443 if g_debug then
2444 hr_utility.set_location(l_proc, 108);
2445 end if;
2446 --
2447 end if;
2448 --
2449 if g_debug then
2450 hr_utility.set_location(l_proc, 110);
2451 end if;
2452 --
2453 else
2454 --
2455 -- current_npw_flag is null, so npw number must be null
2456 --
2457 if g_debug then
2458 hr_utility.set_location(l_proc, 120);
2459 end if;
2460 --
2461 if p_npw_number is not null then
2462 -- Error: You cannot enter an npw number for this person type
2463 hr_utility.set_message(800, 'PER_289638_CWK_NUM_NOT_NULL');
2464 hr_utility.raise_error;
2465 end if;
2466 --
2467 if g_debug then
2468 hr_utility.set_location(l_proc, 130);
2469 end if;
2470 --
2471 end if;
2472 end if;
2473 end if;
2474 if g_debug then
2475 hr_utility.set_location(' Leaving:'|| l_proc, 140);
2476 end if;
2477 exception
2478 when app_exception.application_exception then
2479 -- if error is not because of national identifier
2480 if not l_npw_ni
2481 then
2482 if hr_multi_message.exception_add
2483 (p_associated_column1 => 'PER_ALL_PEOPLE_F.NPW_NUMBER'
2484 ) then
2485 if g_debug then
2486 hr_utility.set_location(' Leaving:'||l_proc, 150);
2487 end if;
2488 raise;
2489 end if;
2490 else
2491 if hr_multi_message.exception_add
2492 (p_associated_column1 => 'PER_ALL_PEOPLE_F.NPW_NUMBER'
2493 ,p_associated_column2 => 'PER_ALL_PEOPLE_F.NATIONAL_IDENTIFIER'
2494 ) then
2495 if g_debug then
2496 hr_utility.set_location(' Leaving:'||l_proc, 160);
2497 end if;
2498 raise;
2499 end if;
2500 end if;
2501 if g_debug then
2502 hr_utility.set_location(' Leaving:'||l_proc,170);
2503 end if;
2504 end chk_npw_number;
2505 --
2506 -- ---------------------------------------------------------------------------
2507 -- |-------------------< chk_expense_check_send_to_addr >-------------------|
2508 -- ---------------------------------------------------------------------------
2509 --
2510 -- Description:
2511 -- - Validates that the expense check send to address exists as a lookup
2512 -- code on HR_LOOKUPS for the lookup type 'HOME_OFFICE' with an enabled
2513 -- flag set to 'Y' and the effective start date of the person between
2514 -- start date active and end date active on HR_LOOKUPS.
2515 --
2516 -- Pre-conditions:
2517 -- None
2518 --
2519 -- In Arguments:
2520 -- p_person_id
2521 -- p_expense_check_send_to_addres
2522 -- p_validation_start_date
2523 -- p_validation_end_date
2524 -- p_object_version_number
2525 --
2526 -- Post Success:
2527 -- Processing continues if:
2528 -- - expense check send to address exists as a lookup code in HR_LOOKUPS
2529 -- for the lookup type 'HOME_OFFICE' where the enabled flag is 'Y' and
2530 -- the effective start date of the person is between start date active
2531 -- and end date active on HR_LOOKUPS.
2532 --
2533 -- Post Failure:
2534 -- An application error is raised and processing is terminated if:
2535 -- - expense check send to address does'nt exist as a lookup code in
2536 -- HR_LOOKUPS for the lookup type 'HOME_OFFICE' where the enabled
2537 -- flag is 'Y' and the effective start date of the person
2538 -- is between start date active and end date active on HR_LOOKUPS.
2539 --
2540 -- Access Status:
2541 -- Internal Table Handler Use Only.
2542 --
2543 procedure chk_expense_check_send_to_addr
2544 (p_person_id in per_all_people_f.person_id%TYPE
2545 ,p_expense_check_send_to_addres in per_all_people_f.expense_check_send_to_address%TYPE
2546 ,p_effective_date in date
2547 ,p_validation_start_date in date
2548 ,p_validation_end_date in date
2549 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
2550 )
2551 is
2552 --
2553 l_exists varchar2(1);
2554 l_proc varchar2(72) := g_package||'chk_expense_check_send_to_addr';
2555 l_api_updating boolean;
2556 --
2557 begin
2558 if g_debug then
2559 hr_utility.set_location('Entering:'|| l_proc, 10);
2560 end if;
2561 --
2562 -- Check mandatory parameters have been set
2563 --
2564 hr_api.mandatory_arg_error
2565 (p_api_name => l_proc
2566 ,p_argument => 'effective date'
2567 ,p_argument_value => p_effective_date
2568 );
2569 --
2570 hr_api.mandatory_arg_error
2571 (p_api_name => l_proc
2572 ,p_argument => 'validation_start_date'
2573 ,p_argument_value => p_validation_start_date
2574 );
2575 --
2576 hr_api.mandatory_arg_error
2577 (p_api_name => l_proc
2578 ,p_argument => 'validation_end_date'
2579 ,p_argument_value => p_validation_end_date
2580 );
2581 if g_debug then
2582 hr_utility.set_location(l_proc, 20);
2583 end if;
2584 --
2585 -- Only proceed with validation if:
2586 -- a) The current g_old_rec is current and
2587 -- b) The expense check send to address value has changed
2588 -- c) a record is being inserted
2589 --
2590 l_api_updating := per_per_shd.api_updating
2591 (p_person_id => p_person_id
2592 ,p_effective_date => p_effective_date
2593 ,p_object_version_number => p_object_version_number
2594 );
2595 if g_debug then
2596 hr_utility.set_location(l_proc, 30);
2597 end if;
2598 --
2599 if ((l_api_updating
2600 and nvl(per_per_shd.g_old_rec.expense_check_send_to_address,
2601 hr_api.g_varchar2)
2602 <> nvl(p_expense_check_send_to_addres,hr_api.g_varchar2))
2603 or
2604 (NOT l_api_updating))
2605 then
2606 if g_debug then
2607 hr_utility.set_location(l_proc, 40);
2608 end if;
2609 --
2610 -- Check if expense check send to address is set
2611 --
2612 If p_expense_check_send_to_addres is not null then
2613 --
2614 -- Check that the expense check send to address exists in hr_lookups for the
2615 -- lookup type 'HOME_OFFICE' with an enabled flag set to 'Y' and that
2616 -- the effective start date of the person is between start date
2617 -- active and end date active in hr_lookups.
2618 --
2619 if hr_api.not_exists_in_dt_hr_lookups
2620 (p_effective_date => p_effective_date
2621 ,p_validation_start_date => p_validation_start_date
2622 ,p_validation_end_date => p_validation_end_date
2623 ,p_lookup_type => 'HOME_OFFICE'
2624 ,p_lookup_code => p_expense_check_send_to_addres
2625 )
2626 then
2627 --
2628 hr_utility.set_message(801, 'HR_51251_PER_CHECK_SEND_ADR');
2629 hr_utility.raise_error;
2630 --
2631 end if;
2632 if g_debug then
2633 hr_utility.set_location(l_proc, 50);
2634 end if;
2635 --
2636 end if;
2637 if g_debug then
2638 hr_utility.set_location(l_proc, 60);
2639 end if;
2640 --
2641 end if;
2642 if g_debug then
2643 hr_utility.set_location(' Leaving:'|| l_proc, 70);
2644 end if;
2645 exception
2646 when app_exception.application_exception then
2647 if hr_multi_message.exception_add
2648 (p_associated_column1 => 'PER_ALL_PEOPLE_F.EXPENSE_CHECK_SEND_TO_ADDRESS'
2649 ) then
2650 if g_debug then
2651 hr_utility.set_location(' Leaving:'||l_proc, 80);
2652 end if;
2653 raise;
2654 end if;
2655 if g_debug then
2656 hr_utility.set_location(' Leaving:'||l_proc,90);
2657 end if;
2658
2659 end chk_expense_check_send_to_addr;
2660 --
2661 -- ---------------------------------------------------------------------------
2662 -- |-----------------------< chk_sex_title >-------------------------------|
2663 -- ---------------------------------------------------------------------------
2664 --
2665 -- Description:
2666 -- - Validates that the sex exists as a lookup code on
2667 -- HR_LOOKUPS for the lookup type 'SEX' with an enabled
2668 -- flag set to 'Y' and the effective start date of the person between
2669 -- start date active and end date active on HR_LOOKUPS.
2670 -- - Validates that the title exists as a lookup code on
2671 -- HR_LOOKUPS for the lookup type 'TITLE' with an enabled
2672 -- flag set to 'Y' and the effective start date of the person between
2673 -- start date active and end date active on HR_LOOKUPS.
2674 --
2675 -- Pre-conditions:
2676 -- A valid person type
2677 --
2678 -- In Arguments:
2679 -- p_person_id
2680 -- p_business_group_id
2681 -- p_person_type_id
2682 -- p_title
2683 -- p_sex
2684 -- p_effective_date
2685 -- p_validation_start_date
2686 -- p_validation_end_date
2687 -- p_object_version_number
2688 --
2689 -- Post Success:
2690 -- Processing continues if:
2691 -- - a sex exists as a lookup code in HR_LOOKUPS for the lookup type
2692 -- 'SEX' where the enabled flag is 'Y' and the effective start
2693 -- date of the person is between start date active and end date
2694 -- active on HR_LOOKUPS.
2695 -- - a title exists as a lookup code in HR_LOOKUPS for the lookup type
2696 -- 'TITLE' where the enabled flag is 'Y' and the effective start
2697 -- date of the person is between start date active and end date
2698 -- active on HR_LOOKUPS.
2699 -- - a sex value is 'M' and the title value is not 'MISS','MRS.',
2700 -- 'MS.'
2701 -- - a sex value is 'F' and the title value is 'MR'.
2702 -- - the related system person type is 'EMP' and a sex value is
2703 -- set.
2704 --
2705 -- Post Failure:
2706 -- An application error is raised and processing is terminated if:
2707 -- - a sex does'nt exist as a lookup code in HR_LOOKUPS for the lookup
2708 -- type 'SEX' where the enabled flag is 'Y' and the effective start
2709 -- date of the person is between start date active and end date
2710 -- active on HR_LOOKUPS.
2711 -- - a title does'nt exist as a lookup code in HR_LOOKUPS for the lookup
2712 -- type 'TITLE' where the enabled flag is 'Y' and the effective start
2713 -- date of the person is between start date active and end date
2714 -- active on HR_LOOKUPS.
2715 -- - a sex value is 'M' and the title value is 'MISS','MRS.', 'MS.'
2716 -- - a sex value is 'F' and the title value is 'MR.'
2717 -- - the related system person type is 'EMP' and a sex value is not
2718 -- set.
2719 --
2720 -- Access Status:
2721 -- Internal Table Handler Use Only.
2722 --
2723 procedure chk_sex_title
2724 (p_person_id in per_all_people_f.person_id%TYPE
2725 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
2726 ,p_person_type_id in per_all_people_f.person_type_id%TYPe
2727 ,p_title in per_all_people_f.title%TYPE
2728 ,p_sex in per_all_people_f.sex%TYPE
2729 ,p_effective_date in date
2730 ,p_validation_start_date in date
2731 ,p_validation_end_date in date
2732 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
2733 )
2734 is
2735 --
2736 l_exists varchar2(1);
2737 l_proc varchar2(72) := g_package||'chk_sex_title';
2738 l_api_updating boolean;
2739 l_lookup_type varchar2(30);
2740 --
2741 begin
2742 if g_debug then
2743 hr_utility.set_location('Entering:'|| l_proc, 10);
2744 end if;
2745 --
2746 -- Check mandatory parameters have been set
2747 --
2748 hr_api.mandatory_arg_error
2749 (p_api_name => l_proc
2750 ,p_argument => 'effective date'
2751 ,p_argument_value => p_effective_date
2752 );
2753 --
2754 hr_api.mandatory_arg_error
2755 (p_api_name => l_proc
2756 ,p_argument => 'validation_start_date'
2757 ,p_argument_value => p_validation_start_date
2758 );
2759 --
2760 hr_api.mandatory_arg_error
2761 (p_api_name => l_proc
2762 ,p_argument => 'validation_end_date'
2763 ,p_argument_value => p_validation_end_date
2764 );
2765 if g_debug then
2766 hr_utility.set_location(l_proc, 20);
2767 end if;
2768 --
2769 -- Only proceed with validation if:
2770 -- a) The current g_old_rec is current and
2771 -- b) The sex value has changed
2772 -- c) The title value has changed
2773 -- d)A record is being inserted
2774 --
2775 l_api_updating := per_per_shd.api_updating
2776 (p_person_id => p_person_id
2777 ,p_effective_date => p_effective_date
2778 ,p_object_version_number => p_object_version_number
2779 );
2780 if g_debug then
2781 hr_utility.set_location(l_proc, 30);
2782 end if;
2783 --
2784 if ((l_api_updating
2785 and nvl(per_per_shd.g_old_rec.sex, hr_api.g_varchar2)
2786 <> nvl(p_sex,hr_api.g_varchar2))
2787 or
2788 (l_api_updating and nvl(per_per_shd.g_old_rec.title,hr_api.g_varchar2)
2789 <> nvl(p_title,hr_api.g_varchar2))
2790 or
2791 (NOT l_api_updating))
2792 then
2793 if g_debug then
2794 hr_utility.set_location(l_proc, 40);
2795 end if;
2796 --
2797 -- Check if title is set
2798 --
2799 If p_title is not null then
2800 --
2801 -- Check that the title exists in hr_lookups for the lookup type
2802 -- 'TITLE' with an enabled flag set to 'Y' and that the effective
2803 -- start date of the person is between start date active and end
2804 -- date active in hr_lookups.
2805 --
2806 if hr_api.not_exists_in_dt_hr_lookups
2807 (p_effective_date => p_effective_date
2808 ,p_validation_start_date => p_validation_start_date
2809 ,p_validation_end_date => p_validation_end_date
2810 ,p_lookup_type => 'TITLE'
2811 ,p_lookup_code => p_title
2812 )
2813 then
2814 --
2815 hr_utility.set_message(801, 'HR_7512_PER_TITLE_INVALID');
2816 hr_multi_message.add
2817 (p_associated_column1 => 'PER_ALL_PEOPLE_F.TITLE'
2818 );
2819 --
2820 end if;
2821 if g_debug then
2822 hr_utility.set_location(l_proc, 50);
2823 end if;
2824 --
2825 end if;
2826 --
2827 -- Check if sex is set
2828 --
2829 If p_sex is not null then
2830 --
2831 -- Check that the sex exists in hr_lookups for the lookup type
2832 -- 'SEX' with an enabled flag set to 'Y' and that the effective
2833 -- start date of the person is between start date active and end
2834 -- date active in hr_lookups.
2835 --
2836 if hr_api.not_exists_in_dt_hr_lookups
2837 (p_effective_date => p_effective_date
2838 ,p_validation_start_date => p_validation_start_date
2839 ,p_validation_end_date => p_validation_end_date
2840 ,p_lookup_type => 'SEX'
2841 ,p_lookup_code => p_sex
2842 )
2843 then
2844 --
2845 hr_utility.set_message(801, 'HR_7511_PER_SEX_INVALID');
2846 hr_multi_message.add
2847 (p_associated_column1 => 'PER_ALL_PEOPLE_F.SEX'
2848 );
2849 --
2850 end if;
2851 if g_debug then
2852 hr_utility.set_location(l_proc, 40);
2853 end if;
2854 --
2855 -- Check if title is set
2856 --
2857 If p_title is not null then
2858 --
2859 -- Check that title is consistent with sex
2860 --
2861 If p_sex = 'M' and
2862 p_title in ('MISS','MRS.','MS.') then
2863 -- Error: Values for Sex and Title are inconsistent.
2864 hr_utility.set_message(801, 'HR_6527_PERSON_SEX_AND_TITLE');
2865 hr_multi_message.add
2866 (p_associated_column1 => 'PER_ALL_PEOPLE_F.TITLE'
2867 ,p_associated_column2 => 'PER_ALL_PEOPLE_F.SEX'
2868 );
2869 end if;
2870 if g_debug then
2871 hr_utility.set_location(l_proc, 70);
2872 end if;
2873 --
2874 If p_sex = 'F' and
2875 p_title = 'MR.' then
2876 -- Error: Values for Sex and Title are inconsistent.
2877 hr_utility.set_message(801, 'HR_6527_PERSON_SEX_AND_TITLE');
2878 hr_multi_message.add
2879 (p_associated_column1 => 'PER_ALL_PEOPLE_F.TITLE'
2880 ,p_associated_column2 => 'PER_ALL_PEOPLE_F.SEX'
2881 );
2882 end if;
2883 if g_debug then
2884 hr_utility.set_location(l_proc, 80);
2885 end if;
2886 --
2887 end if;
2888 else
2889 --
2890 -- If sex is null check if system person type contains 'EMP'
2891 --
2892 if instr(return_system_person_type(p_person_type_id,
2893 p_business_group_id),'EMP') <> 0 then
2894 -- Error: You must enter sex for an employee.
2895 hr_utility.set_message(801, 'HR_6524_EMP_MANDATORY_SEX');
2896 hr_multi_message.add
2897 (p_associated_column1 => 'PER_ALL_PEOPLE_F.SEX'
2898 );
2899 end if;
2900 if g_debug then
2901 hr_utility.set_location(l_proc, 90);
2902 end if;
2903 --
2904 end if;
2905 if g_debug then
2906 hr_utility.set_location(' Leaving:'|| l_proc, 130);
2907 end if;
2908 end if;
2909 end chk_sex_title;
2910 --
2911 -- ---------------------------------------------------------------------------
2912 -- |-------------------------< chk_town_of_birth >--------------------------|
2913 -- ---------------------------------------------------------------------------
2914 --
2915 -- Description:
2916 -- Checks that the town of birth parameter corresponds to a valid lookup value if
2917 -- there a row in pay_legislative_field_info for the current legislation code
2918 -- and the field_name of 'TOWN_OF_BIRTH'. (If no row exists in PLFI table then
2919 -- assume this field is free text and under the current legislation is not validated).
2920 --
2921 -- Pre-conditions:
2922 --
2923 -- In Arguments:
2924 -- p_person_id
2925 -- p_town_of_birth
2926 -- p_effective_date
2927 -- p_validation_start_date in date
2928 -- p_validation_end_date in date
2929 -- p_legislation_code
2930 --
2931 -- Post Success:
2932 -- On insert/update if a town of birth value exists then
2933 -- processing continues
2934 --
2935 -- Post Failure:
2936 -- On insert/update if a town of birth value does not exist
2937 -- then an application error will be raised and processing is
2938 -- terminated
2939 --
2940 -- Access Status:
2941 -- Internal Row Handler Use Only.
2942 --
2943 procedure chk_town_of_birth
2944 (p_person_id in per_all_people_f.person_id%TYPE,
2945 p_town_of_birth in per_all_people_f.town_of_birth%TYPE,
2946 p_effective_date in date,
2947 p_validation_start_date in date,
2948 p_validation_end_date in date,
2949 p_legislation_code in per_business_groups.legislation_code%TYPE) is
2950 --
2951 --
2952 CURSOR csr_plfi is
2953 SELECT rule_type
2954 FROM pay_legislative_field_info plfi
2955 WHERE upper(plfi.field_name) = 'TOWN_OF_BIRTH'
2956 AND plfi.legislation_code = p_legislation_code;
2957 --
2958 l_exists varchar2(1);
2959 l_lookup_type hr_lookups.lookup_type%TYPE;
2960 l_proc varchar2(72);
2961 --
2962 begin
2963 if g_debug then
2964 l_proc := g_package||'chk_town_of_birth';
2965 hr_utility.set_location('Entering:'|| l_proc, 1);
2966 end if;
2967 if p_town_of_birth IS NOT NULL then
2968 --
2969 -- Only proceed with validation if:
2970 -- a) rec is being inserted or
2971 -- b) rec is updating and the g_old_rec is not current value
2972 --
2973 if ((p_person_id is null)
2974 OR
2975 ((p_person_id is not null) and
2976 nvl(p_town_of_birth,hr_api.g_varchar2) <> nvl(per_per_shd.g_old_rec.town_of_birth,hr_api.g_varchar2))) then
2977 --
2978 if g_debug then
2979 hr_utility.set_location(l_proc, 2);
2980 end if;
2981 --
2982 open csr_plfi;
2983 fetch csr_plfi into l_lookup_type;
2984 if csr_plfi%found then
2985 close csr_plfi;
2986 -- attempt to decode the lookup type returned from plfi record
2987 -- with the p_town_of_birth lookup_value supplied to the api.
2988 if hr_api.not_exists_in_dt_hr_lookups
2989 (p_effective_date => p_effective_date
2990 ,p_validation_start_date => p_validation_start_date
2991 ,p_validation_end_date => p_validation_end_date
2992 ,p_lookup_type => l_lookup_type
2993 ,p_lookup_code => p_town_of_birth
2994 )
2995 then
2996 -- Error: Invalid town lookup_value has been passed.
2997 hr_utility.set_message_token('TOWN_CODE', p_town_of_birth);
2998 hr_utility.set_message(800, 'PER_52619_TOWN_NOT_FOUND)');
2999 hr_utility.raise_error;
3000 end if;
3001 else
3002 close csr_plfi;
3003 end if;
3004 end if;
3005 end if;
3006 --
3007 if g_debug then
3008 hr_utility.set_location(' Leaving:'|| l_proc, 3);
3009 end if;
3010 exception
3011 when app_exception.application_exception then
3012 if hr_multi_message.exception_add
3013 (p_associated_column1 => 'PER_ALL_PEOPLE_F.TOWN_OF_BIRTH'
3014 ) then
3015 if g_debug then
3016 hr_utility.set_location(' Leaving:'||l_proc, 4);
3017 end if;
3018 raise;
3019 end if;
3020 if g_debug then
3021 hr_utility.set_location(' Leaving:'||l_proc,5);
3022 end if;
3023 end chk_town_of_birth;
3024 --
3025 -- ---------------------------------------------------------------------------
3026 -- |-------------------------< chk_region_of_birth >-------------------------|
3027 -- ---------------------------------------------------------------------------
3028 --
3029 -- Description:
3030 -- Checks that the region of birth parameter corresponds to a valid lookup value if
3031 -- there a row in pay_legislative_field_info for the current legislation code
3032 -- and the field_name of 'REGION_OF_BIRTH'. (If no row exists in PLFI table then
3033 -- assume this field is free text and under the current legislation is not validated).
3034 --
3035 -- Pre-conditions:
3036 --
3037 -- In Arguments:
3038 -- p_person_id
3039 -- p_region_of_birth
3040 -- p_effective_date
3041 -- p_validation_start_date
3042 -- p_validation_end_date
3043 -- p_legislation_code
3044 --
3045 -- Post Success:
3046 -- On insert/update if a region of birth value exists then
3047 -- processing continues
3048 --
3049 -- Post Failure:
3050 -- On insert/update if a region of birth value does not exist
3051 -- then an application error will be raised and processing is
3052 -- terminated
3053 --
3054 -- Access Status:
3055 -- Internal Row Handler Use Only.
3056 --
3057 procedure chk_region_of_birth
3058 (p_person_id in per_all_people_f.person_id%TYPE,
3059 p_region_of_birth in per_all_people_f.region_of_birth%TYPE,
3060 p_effective_date in date,
3061 p_validation_start_date in date,
3062 p_validation_end_date in date,
3063 p_legislation_code in per_business_groups.legislation_code%TYPE) is
3064 --
3065 --
3066 CURSOR csr_plfi is
3067 SELECT rule_type
3068 FROM pay_legislative_field_info plfi
3069 WHERE upper(plfi.field_name) = 'REGION_OF_BIRTH'
3070 AND plfi.legislation_code = p_legislation_code;
3071 --
3072 l_exists varchar2(1);
3073 l_lookup_type hr_lookups.lookup_type%TYPE;
3074 l_proc varchar2(72);
3075 --
3076 begin
3077 if g_debug then
3078 l_proc := g_package||'chk_region_of_birth';
3079 hr_utility.set_location('Entering:'|| l_proc, 1);
3080 end if;
3081 if p_region_of_birth IS NOT NULL then
3082 --
3083 -- Only proceed with validation if:
3084 -- a) rec is being inserted or
3085 -- b) rec is updating and the g_old_rec is not current value
3086 --
3087 if ((p_person_id is null)
3088 OR
3089 ((p_person_id is not null) and
3090 nvl(p_region_of_birth,hr_api.g_varchar2) <> nvl(per_per_shd.g_old_rec.region_of_birth,hr_api.g_varchar2))) then
3091 --
3092 if g_debug then
3093 hr_utility.set_location(l_proc, 2);
3094 end if;
3095 --
3096 open csr_plfi;
3097 fetch csr_plfi into l_lookup_type;
3098 if csr_plfi%found then
3099 close csr_plfi;
3100 -- attempt to decode the lookup type returned from plfi record
3101 -- with the p_region_of_birth lookup_value supplied to the api.
3102 if hr_api.not_exists_in_dt_hr_lookups
3103 (p_effective_date => p_effective_date
3104 ,p_validation_start_date => p_validation_start_date
3105 ,p_validation_end_date => p_validation_end_date
3106 ,p_lookup_type => l_lookup_type
3107 ,p_lookup_code => p_region_of_birth
3108 )
3109 then
3110 -- Error: Invalid region lookup_value has been passed.
3111 hr_utility.set_message_token('REGION_CODE', p_region_of_birth);
3112 hr_utility.set_message(800, 'PER_52620_REGION_NOT_FOUND)');
3113 hr_utility.raise_error;
3114 end if;
3115 else
3116 close csr_plfi;
3117 end if;
3118 end if;
3119 end if;
3120 --
3121 if g_debug then
3122 hr_utility.set_location(' Leaving:'|| l_proc, 3);
3123 end if;
3124 exception
3125 when app_exception.application_exception then
3126 if hr_multi_message.exception_add
3127 (p_associated_column1 => 'PER_ALL_PEOPLE_F.REGION_OF_BIRTH'
3128 ) then
3129 if g_debug then
3130 hr_utility.set_location(' Leaving:'||l_proc, 4);
3131 end if;
3132 raise;
3133 end if;
3134 if g_debug then
3135 hr_utility.set_location(' Leaving:'||l_proc,5);
3136 end if;
3137 end chk_region_of_birth;
3138 --
3139 -- ---------------------------------------------------------------------------
3140 -- |----------------------< chk_country_of_birth >--------------------------|
3141 -- ---------------------------------------------------------------------------
3142 --
3143 -- Description:
3144 -- Checks that a country of birth value (country short code) is valid
3145 --
3146 -- Pre-conditions:
3147 --
3148 -- In Arguments:
3149 -- p_person_id
3150 -- p_country_of_birth
3151 --
3152 -- Post Success:
3153 -- On insert/update if a country of birth value exists then
3154 -- processing continues
3155 --
3156 -- Post Failure:
3157 -- On insert/update if a country of birth value does not exist
3158 -- then an application error will be raised and processing is
3159 -- terminated
3160 --
3161 -- Access Status:
3162 -- Internal Row Handler Use Only.
3163 --
3164 procedure chk_country_of_birth
3165 (p_person_id in per_all_people_f.person_id%TYPE,
3166 p_country_of_birth in per_all_people_f.country_of_birth%TYPE) is
3167 --
3168 l_exists varchar2(1);
3169 l_proc varchar2(72);
3170 --
3171 -- cursor to attempt to match the country short code.
3172 --
3173 cursor csr_country is
3174 Select null
3175 from fnd_territories_vl ftv
3176 where ftv.territory_code = p_country_of_birth;
3177 --
3178 begin
3179 if g_debug then
3180 l_proc := g_package||'chk_country_of_birth';
3181 hr_utility.set_location('Entering:'|| l_proc, 1);
3182 end if;
3183 if p_country_of_birth IS NOT NULL then
3184 --
3185 -- Only proceed with validation if:
3186 -- a) rec is being inserted or
3187 -- b) rec is updating and the g_old_rec is not current value
3188 --
3189 if ((p_person_id is null)
3190 OR
3191 ((p_person_id is not null) and
3192 nvl(p_country_of_birth,hr_api.g_varchar2) <> nvl(per_per_shd.g_old_rec.country_of_birth,hr_api.g_varchar2))) then
3193 --
3194 if g_debug then
3195 hr_utility.set_location(l_proc, 2);
3196 end if;
3197 --
3198 open csr_country;
3199 fetch csr_country into l_exists;
3200 if csr_country%notfound then
3201 close csr_country;
3202 -- Error: Invalid country short code
3203 hr_utility.set_message_token('COUNTRY_CODE', p_country_of_birth);
3204 hr_utility.set_message(800, 'PER_52618_COUNTRY_NOT_FOUND');
3205 hr_utility.raise_error;
3206 end if;
3207 close csr_country;
3208 end if;
3209 end if;
3210 --
3211 if g_debug then
3212 hr_utility.set_location(' Leaving:'|| l_proc, 3);
3213 end if;
3214 exception
3215 when app_exception.application_exception then
3216 if hr_multi_message.exception_add
3217 (p_associated_column1 => 'PER_ALL_PEOPLE_F.COUNTRY_OF_BIRTH'
3218 ) then
3219 if g_debug then
3220 hr_utility.set_location(' Leaving:'||l_proc, 4);
3221 end if;
3222 raise;
3223 end if;
3224 if g_debug then
3225 hr_utility.set_location(' Leaving:'||l_proc,5);
3226 end if;
3227 end chk_country_of_birth;
3228 --
3229 -- ---------------------------------------------------------------------------
3230 -- |------------------------< chk_start_date >------------------------------|
3231 -- ---------------------------------------------------------------------------
3232 --
3233 -- Description:
3234 -- Checks that a start date value is valid
3235 --
3236 -- Pre-conditions:
3237 --
3238 -- In Arguments:
3239 -- p_person_id
3240 -- p_start_date
3241 -- p_effective_date
3242 -- p_object_version_number
3243 --
3244 -- Post Success:
3245 -- On insert if a start date is the same as effective date then
3246 -- processing continues
3247 --
3248 -- On update if a start date is the same as the minimum effective start date
3249 -- then processing continues
3250 --
3251 -- Post Failure:
3252 -- On insert if a start date is not the same as the effective
3253 -- date then an application error will be raised and processing is
3254 -- terminated
3255 --
3256 -- On update if a start date is not the same as the minimum effective start
3257 -- date then an application error will be raised and processing is
3258 -- terminated
3259 --
3260 -- Access Status:
3261 -- Internal Table Handler Use Only.
3262 --
3263 procedure chk_start_date
3264 (p_person_id in per_all_people_f.person_id%TYPE
3265 ,p_start_date in date
3266 ,p_effective_date in date
3267 ,p_object_version_number in per_all_people_f.object_version_number%TYPE) is
3268 --
3269 l_exists varchar2(1);
3270 l_proc varchar2(72) := g_package||'chk_start_date';
3271 l_api_updating boolean;
3272 l_min_date date;
3273 --
3274 -- Find the earliest effective start date for the person
3275 --
3276 cursor csr_chk_min_date is
3277 Select min(effective_start_date)
3278 from per_all_people_f
3279 where p_person_id = person_id;
3280 --
3281 begin
3282 if g_debug then
3283 hr_utility.set_location('Entering:'|| l_proc, 1);
3284 end if;
3285 --
3286 -- Check mandatory parameters have been set
3287 --
3288 hr_api.mandatory_arg_error
3289 (p_api_name => l_proc
3290 ,p_argument => 'start date'
3291 ,p_argument_value => p_start_date
3292 );
3293 --
3294 hr_api.mandatory_arg_error
3295 (p_api_name => l_proc
3296 ,p_argument => 'effective date'
3297 ,p_argument_value => p_effective_date
3298 );
3299 --
3300 -- Only proceed with validation if:
3301 -- a) The current g_old_rec is current and
3302 -- b) The start date value has changed
3303 -- c) A record is being inserted
3304 --
3305 l_api_updating := per_per_shd.api_updating
3306 (p_person_id => p_person_id
3307 ,p_effective_date => p_effective_date
3308 ,p_object_version_number => p_object_version_number);
3309 --
3310 if NOT l_api_updating then
3311 --
3312 -- On insert check that start date equals effective date
3313 --
3314 if g_debug then
3315 hr_utility.set_location(l_proc, 2);
3316 end if;
3317 --
3318 if p_start_date <> p_effective_date then
3319 -- Error: Invalid Start Date
3320 hr_utility.set_message(801, 'HR_7514_PER_START_DATE_INVALID');
3321 hr_utility.raise_error;
3322 end if;
3323 elsif(l_api_updating and per_per_shd.g_old_rec.start_date <>
3324 p_start_date) then
3325 --
3326 -- On update check if start date is the same as the earliest effective
3327 -- start date
3328 --
3329 if g_debug then
3330 hr_utility.set_location(l_proc, 3);
3331 end if;
3332 --
3333 open csr_chk_min_date;
3334 fetch csr_chk_min_date into l_min_date;
3335 if p_start_date <> l_min_date then
3336 close csr_chk_min_date;
3337 -- Error: Invalid start date
3338
3339 hr_utility.set_message(801, 'HR_7514_PER_START_DATE_INVALID');
3340 hr_utility.raise_error;
3341 end if;
3342 close csr_chk_min_date;
3343 end if;
3344 if g_debug then
3345 hr_utility.set_location(' Leaving:'|| l_proc, 4);
3346 end if;
3347 exception
3348 when app_exception.application_exception then
3349 if hr_multi_message.exception_add
3350 (p_associated_column1 => 'PER_ALL_PEOPLE_F.START_DATE'
3351 ) then
3352 if g_debug then
3353 hr_utility.set_location(' Leaving:'||l_proc, 5);
3354 end if;
3355 raise;
3356 end if;
3357 if g_debug then
3358 hr_utility.set_location(' Leaving:'||l_proc,6);
3359 end if;
3360
3361 end chk_start_date;
3362 --
3363 -- ---------------------------------------------------------------------------
3364 -- |--------------------< chk_orig_and_start_dates >------------------------|
3365 -- ---------------------------------------------------------------------------
3366 --
3367 -- Description:
3368 -- - Validates that for person type of 'EMP','EMP_APL','EX_EMP' or
3369 -- 'EX_EMP_APL' the original date of hire is the same of earlier
3370 -- than the earliest per_periods_of_service start date.
3371 -- For any other person type a warning is raised if an original
3372 -- date of hire is entered.
3373 --
3374 -- Pre-conditions:
3375 -- Valid p_person_id.
3376 --
3377 -- In Arguments:
3378 -- p_person_id
3379 -- p_person_type_id
3380 -- p_business_group_id
3381 -- p_original_date_of_hire
3382 -- p_effective_date
3383 -- p_start_date
3384 -- p_object_version_number
3385 --
3386 -- Out Arguments:
3387 -- p_orig_hire_warning
3388 --
3389 -- Post Success:
3390 -- Processing continues if:
3391 -- - person_type is 'EMP','EMP_APL','EX_EMP' or 'EX_EMP_APL'
3392 -- and original_date_of_hire is on or before the start date
3393 -- - person_type is not 'EMP','EMP_APL','EX_EMP','EX_EMP_APL'
3394 -- and original_date_of_hire is not entered
3395 -- - person_type is not 'EMP','EMP_APL','EX_EMP','EX_EMP_APL'
3396 -- and original_date_of_hire is enter and the warning
3397 -- message is acknowledged.
3398 --
3399 -- Post Failure:
3400 -- An application error is raised and processing is terminated if:
3401 -- - person_type is 'EMP','EMP_APL','EX_EMP' or 'EX_EMP_APL' and
3402 -- the original_date_of_hire is later than the start_date.
3403 --
3404 -- Access Status:
3405 -- Internal Table Handler Use Only.
3406 --
3407 procedure chk_orig_and_start_dates
3408 (p_person_id in per_all_people_f.person_id%TYPE
3409 ,p_person_type_id in per_all_people_f.person_type_id%TYPE
3410 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
3411 ,p_original_date_of_hire in per_all_people_f.original_date_of_hire%TYPE
3412 ,p_start_date in per_all_people_f.start_date%TYPE
3413 ,p_effective_date in date
3414 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
3415 ,p_orig_hire_warning out nocopy boolean
3416 ) is
3417 --
3418 l_proc varchar2(72) ;
3419 l_system_person_type varchar2(72) := return_system_person_type
3420 (p_person_type_id
3421 ,p_business_group_id);
3422 l_earliest_date date;
3423 --
3424 cursor csr_earliest_date is
3425 select min(date_start)
3426 from per_periods_of_service
3427 where p_person_id = person_id;
3428
3429 -- added for the bug 5402099
3430 l_earliest_date1 date;
3431 cursor original_date_of_hire_ppf is
3432 select original_date_of_hire from per_all_people_f where
3433 person_id=p_person_id and
3434 p_original_date_of_hire between effective_start_date and effective_end_date ;
3435 -- end of bug 5402099
3436 --
3437 begin
3438 --
3439 p_orig_hire_warning := FALSE;
3440 --
3441 if g_debug then
3442 l_proc := g_package||'chk_orig_and_start_dates';
3443 hr_utility.set_location('Entering:'|| l_proc,5);
3444 end if;
3445 --
3446 if p_original_date_of_hire is NOT NULL then
3447 if (nvl(per_per_shd.g_old_rec.original_date_of_hire,hr_api.g_date)
3448 <> nvl(p_original_date_of_hire, hr_api.g_date)) or
3449 (per_per_shd.g_old_rec.start_date <> p_start_date) then
3450 --
3451 if l_system_person_type in ('EMP','EMP_APL','EX_EMP','EX_EMP_APL') then
3452 --
3453 if (p_person_id is null and
3454 (nvl(p_original_date_of_hire,hr_api.g_date) > p_start_date)) then
3455 hr_utility.set_message(800,'PER_52474_PER_ORIG_ST_DATE');
3456 hr_multi_message.add
3457 (p_associated_column1 => 'PER_ALL_PEOPLE_F.ORIGINAL_DATE_OF_HIRE'
3458 ,p_associated_column2 => 'PER_ALL_PEOPLE_F.START_DATE'
3459 );
3460 --
3461 elsif p_person_id is not null then
3462 open csr_earliest_date;
3463 fetch csr_earliest_date into l_earliest_date;
3464 -- added for the bug 5402099
3465 open original_date_of_hire_ppf ;
3466 fetch original_date_of_hire_ppf into l_earliest_date1;
3467 hr_utility.set_location('l_earliest_date1:'|| l_earliest_date1,10);
3468 if l_earliest_date1 is null then
3469 l_earliest_date:=p_original_date_of_hire;
3470 hr_utility.set_location('l_earliest_date:'|| l_earliest_date,15);
3471 close original_date_of_hire_ppf;
3472 else
3473 close original_date_of_hire_ppf;
3474 end if;
3475 -- end of bug 5402099
3476 if (nvl(p_original_date_of_hire,hr_api.g_date) > l_earliest_date) then
3477 /* 1352469 Replaced with above IF statement
3478 if ((l_earliest_date <= p_start_date) and
3479 (nvl(p_original_date_of_hire,hr_api.g_date) > l_earliest_date))
3480 or ((l_earliest_date > p_start_date) and
3481 (nvl(p_original_date_of_hire,hr_api.g_date) > p_start_date)) then
3482 */
3483 hr_utility.set_message(800,'PER_52474_PER_ORIG_ST_DATE');
3484 close csr_earliest_date;
3485 hr_multi_message.add
3486 (p_associated_column1 => 'PER_ALL_PEOPLE_F.ORIGINAL_DATE_OF_HIRE'
3487 );
3488 else
3489 close csr_earliest_date;
3490 end if;
3491 end if;
3492 --
3493 elsif l_system_person_type not in ('EMP','EMP_APL','EX_EMP','EX_EMP_APL')
3494 then p_orig_hire_warning := TRUE;
3495 end if;
3496 end if;
3497 end if;
3498 --
3499 if g_debug then
3500 hr_utility.set_location(' Leaving:'||l_proc, 10);
3501 end if;
3502 --
3503 end chk_orig_and_start_dates;
3504 --
3505 -- ---------------------------------------------------------------------------
3506 -- |---------------------< chk_GB_per_information >-------------------------|
3507 -- ---------------------------------------------------------------------------
3508 --
3509 -- Description:
3510 -- - Checks that the values held in developer descriptive flexfields
3511 -- are valid for a category of 'GB'
3512 -- - Validates that per information3 and per information11 to 20 are null.
3513 -- - Validates that per information2, 4 ,9 and 10 exists as a lookup code on
3514 -- HR_LOOKUPS for the lookup type 'YES_NO' with an enabled flag set to 'Y'
3515 -- and the effective start date of the person between start date active
3516 -- and end date active on HR_LOOKUPS.
3517 -- - Validates that per information1 exists as a lookup code on HR_LOOKUPS
3518 -- for the lookup type 'ETH_TYPE' with an enabled flag set to 'Y' and the
3519 -- effective start date of the person between start date active and end
3520 -- date active on HR_LOOKUPS.
3521 -- - Validates that per information5 is less than or equal to 30 characters
3522 -- and in uppercase.
3523 --
3524 -- Pre-conditions:
3525 -- A GB per information category
3526 --
3527 -- In Arguments:
3528 -- p_person_id
3529 -- p_per_information_category
3530 -- p_per_information1
3531 -- p_per_information2
3532 -- p_per_information3
3533 -- p_per_information4
3534 -- p_per_information5
3535 -- p_per_information6
3536 -- p_per_information7
3537 -- p_per_information8
3538 -- p_per_information9
3539 -- p_per_information10
3540 -- p_per_information11
3541 -- p_per_information12
3542 -- p_per_information13
3543 -- p_per_information14
3544 -- p_per_information15
3545 -- p_per_information16
3546 -- p_per_information17
3547 -- p_per_information18
3548 -- p_per_information19
3549 -- p_per_information20
3550 -- p_effective_date
3551 -- p_validation_start_date
3552 -- p_validation_end_date
3553 -- p_object_version_number
3554 --
3555 -- Post Success:
3556 -- Processing continues if:
3557 -- - per_information3 and per_information11 to 20 values are null
3558 -- - per information2, 4 , 9 and 10 exists as a lookup code in HR_LOOKUPS
3559 -- for the lookup type 'YES_NO' where the enabled flag is 'Y'
3560 -- and the effective start date of the person is between start
3561 -- date active and end date active on HR_LOOKUPS.
3562 -- - per information1 exists as a lookup code in HR_LOOKUPS
3563 -- for the lookup type 'ETH_TYPE' where the enabled flag is 'Y'
3564 -- and the effective start date of the person is between start
3565 -- date active and end date active on HR_LOOKUPS.
3566 -- - per_information5 is less than or equal to 30 characters long
3567 -- and upper case.
3568 --
3569 -- Post Failure:
3570 -- An application error is raised and processing is terminated if:
3571 -- - any of per_information3 and per_information10 to 20 values are
3572 -- not null.
3573 -- - any of per information2, 4,9 and 10 does'nt exist as a lookup code
3574 -- in HR_LOOKUPS for the lookup type 'YES_NO' where the enabled flag
3575 -- is 'Y' and the effective start date of the person is between start
3576 -- date active and end date active on HR_LOOKUPS.
3577 -- - per information1 does'nt exist as a lookup code in HR_LOOKUPS
3578 -- for the lookup type 'ETH_TYPE' where the enabled flag is 'Y'
3579 -- and the effective start date of the person is between start
3580 -- date active and end date active on HR_LOOKUPS.
3581 -- - per_information5 is not less than or equal to 30 characters long
3582 -- or not upper case.
3583 --
3584 -- Access Status:
3585 -- Internal Table Handler Use Only.
3586 --
3587 procedure chk_GB_per_information
3588 (p_person_id in per_all_people_f.person_id%TYPE
3589 ,p_per_information_category in per_all_people_f.per_information_category%TYPE
3590 ,p_per_information1 in per_all_people_f.per_information1%TYPE
3591 ,p_per_information2 in per_all_people_f.per_information2%TYPE
3592 ,p_per_information3 in per_all_people_f.per_information3%TYPE
3593 ,p_per_information4 in per_all_people_f.per_information4%TYPE
3594 ,p_per_information5 in per_all_people_f.per_information5%TYPE
3595 ,p_per_information6 in per_all_people_f.per_information6%TYPE
3596 ,p_per_information7 in per_all_people_f.per_information7%TYPE
3597 ,p_per_information8 in per_all_people_f.per_information8%TYPE
3598 ,p_per_information9 in per_all_people_f.per_information9%TYPE
3599 ,p_per_information10 in per_all_people_f.per_information10%TYPE
3600 ,p_per_information11 in per_all_people_f.per_information11%TYPE
3601 ,p_per_information12 in per_all_people_f.per_information12%TYPE
3602 ,p_per_information13 in per_all_people_f.per_information13%TYPE
3603 ,p_per_information14 in per_all_people_f.per_information14%TYPE
3604 ,p_per_information15 in per_all_people_f.per_information15%TYPE
3605 ,p_per_information16 in per_all_people_f.per_information16%TYPE
3606 ,p_per_information17 in per_all_people_f.per_information17%TYPE
3607 ,p_per_information18 in per_all_people_f.per_information18%TYPE
3608 ,p_per_information19 in per_all_people_f.per_information19%TYPE
3609 ,p_per_information20 in per_all_people_f.per_information20%TYPE
3610 ,p_per_information21 in per_all_people_f.per_information21%TYPE
3611 ,p_per_information22 in per_all_people_f.per_information22%TYPE
3612 ,p_per_information23 in per_all_people_f.per_information23%TYPE
3613 ,p_per_information24 in per_all_people_f.per_information24%TYPE
3614 ,p_per_information25 in per_all_people_f.per_information25%TYPE
3615 ,p_per_information26 in per_all_people_f.per_information26%TYPE
3616 ,p_per_information27 in per_all_people_f.per_information27%TYPE
3617 ,p_per_information28 in per_all_people_f.per_information28%TYPE
3618 ,p_per_information29 in per_all_people_f.per_information29%TYPE
3619 ,p_per_information30 in per_all_people_f.per_information30%TYPE
3620 ,p_effective_date in date
3621 ,p_validation_start_date in date
3622 ,p_validation_end_date in date
3623 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
3624 )
3625 is
3626 --
3627 l_exists varchar2(1);
3628 l_error exception;
3629 l_proc varchar2(72) := g_package||'chk_GB_per_information';
3630 l_api_updating boolean;
3631 l_lookup_type varchar2(30);
3632 l_info_attribute number(2);
3633 l_per_information6 per_all_people_f.per_information6%TYPE;
3634 l_per_information7 per_all_people_f.per_information7%TYPE;
3635 l_per_information8 per_all_people_f.per_information8%TYPE;
3636 l_output varchar2(150);
3637 l_rgeflg varchar2(10);
3638 --
3639 begin
3640 if g_debug then
3641 hr_utility.set_location('Entering:'|| l_proc, 10);
3642 end if;
3643 --
3644 -- Check the mandatory parameters
3645 --
3646 hr_api.mandatory_arg_error
3647 (p_api_name => l_proc
3648 ,p_argument => 'effective_date'
3649 ,p_argument_value => p_effective_date
3650 );
3651 --
3652 hr_api.mandatory_arg_error
3653 (p_api_name => l_proc
3654 ,p_argument => 'validation_start_date'
3655 ,p_argument_value => p_validation_start_date
3656 );
3657 --
3658 hr_api.mandatory_arg_error
3659 (p_api_name => l_proc
3660 ,p_argument => 'validation_end_date'
3661 ,p_argument_value => p_validation_end_date
3662 );
3663 if g_debug then
3664 hr_utility.set_location(l_proc,20);
3665 end if;
3666 --
3667 -- We know the per_information_category is GB, so check the rest of
3668 -- the per_information fields within this context.
3669 --
3670 -- Check if the per_information1 value exists in hr_lookups
3671 -- where the lookup_type is 'ETH_TYPE'
3672 --
3673 if p_per_information1 is not null then
3674 --
3675 -- Check that per information1 exists in hr_lookups for the
3676 -- lookup type 'ETH_TYPE' with an enabled flag set to 'Y' and that
3677 -- the effective start date of the person is between start date
3678 -- active and end date active in hr_lookups.
3679 --
3680 if hr_api.not_exists_in_dt_hr_lookups
3681 (p_effective_date => p_effective_date
3682 ,p_validation_start_date => p_validation_start_date
3683 ,p_validation_end_date => p_validation_end_date
3684 ,p_lookup_type => 'ETH_TYPE'
3685 ,p_lookup_code => p_per_information1
3686 )
3687 then
3688 --
3689 hr_utility.set_message(801, 'HR_7524_PER_INFO1_INVALID');
3690 hr_utility.raise_error;
3691 --
3692 end if;
3693 if g_debug then
3694 hr_utility.set_location(l_proc,30);
3695 end if;
3696 --
3697 end if;
3698 if g_debug then
3699 hr_utility.set_location(l_proc,40);
3700 end if;
3701 --
3702 -- Check if the per_information2 value exists in hr_lookups
3703 -- where the lookup_type is 'YES_NO'
3704 --
3705 if p_per_information2 is not null then
3706 --
3707 -- Check that per information2 exists in hr_lookups for the
3708 -- lookup type 'YES_NO' with an enabled flag set to 'Y' and that
3709 -- the effective start date of the person is between start date
3710 -- active and end date active in hr_lookups.
3711 --
3712 if hr_api.not_exists_in_dt_hr_lookups
3713 (p_effective_date => p_effective_date
3714 ,p_validation_start_date => p_validation_start_date
3715 ,p_validation_end_date => p_validation_end_date
3716 ,p_lookup_type => 'YES_NO'
3717 ,p_lookup_code => p_per_information2
3718 )
3719 then
3720 --
3721 hr_utility.set_message(801, 'HR_7525_PER_INFO2_INVALID');
3722 hr_utility.raise_error;
3723 --
3724 end if;
3725 if g_debug then
3726 hr_utility.set_location(l_proc,50);
3727 end if;
3728 --
3729 end if;
3730 if g_debug then
3731 hr_utility.set_location(l_proc,60);
3732 end if;
3733 --
3734 -- Check if the per_information4 value exists in hr_lookups
3735 -- where the lookup_type is 'YES_NO'
3736 --
3737 if p_per_information4 is not null then
3738 --
3739 -- Check that per information4 exists in hr_lookups for the
3740 -- lookup type 'YES_NO' with an enabled flag set to 'Y' and that
3741 -- the effective start date of the person is between start date
3742 -- active and end date active in hr_lookups.
3743 --
3744 if hr_api.not_exists_in_dt_hr_lookups
3745 (p_effective_date => p_effective_date
3746 ,p_validation_start_date => p_validation_start_date
3747 ,p_validation_end_date => p_validation_end_date
3748 ,p_lookup_type => 'YES_NO'
3749 ,p_lookup_code => p_per_information4
3750 )
3751 then
3752 --
3753 hr_utility.set_message(801, 'HR_7526_PER_INFO4_INVALID');
3754 hr_utility.raise_error;
3755 --
3756 end if;
3757 if g_debug then
3758 hr_utility.set_location(l_proc,70);
3759 end if;
3760 --
3761 end if;
3762 if g_debug then
3763 hr_utility.set_location(l_proc,80);
3764 end if;
3765 --
3766 -- Check if p_per_information5 is greater than 30 characters long
3767 --
3768 if p_per_information5 is not null then
3769 if length(p_per_information5) > 30 then
3770 -- Error: Work Permit (PER_INFORMATION5) cannot be longer than
3771 -- 30 characters
3772 hr_utility.set_message(801, 'HR_7527_PER_INFO5_LENGTH');
3773 hr_utility.raise_error;
3774 end if;
3775 if g_debug then
3776 hr_utility.set_location(l_proc,90);
3777 end if;
3778 --
3779 -- Check if p_per_information5 is not upper case
3780 --
3781 --if p_per_information5 <> upper(p_per_information5) then
3782 -- Error: Enter the Work Permit value (PER_INFORMATION5) in
3783 -- upper case
3784 --hr_utility.set_message(801, 'HR_7528_PER_INFO5_CASE');
3785 --hr_utility.raise_error;
3786 --end if;
3787 --if g_debug then
3788 --hr_utility.set_location(l_proc,100);
3789 --end if;
3790 end if;
3791 if g_debug then
3792 hr_utility.set_location(l_proc,110);
3793 end if;
3794 --
3795 -- Check if p_per_information6 is in the range 0 - 99.
3796 --
3797 if p_per_information6 is not null then
3798 --
3799 l_per_information6 := p_per_information6;
3800 hr_chkfmt.checkformat(value => l_per_information6
3801 ,format => 'I'
3802 ,output => l_output
3803 ,minimum => NULL
3804 ,maximum => NULL
3805 ,nullok => 'Y'
3806 ,rgeflg => l_rgeflg
3807 ,curcode => NULL);
3808 if g_debug then
3809 hr_utility.set_location(l_proc,120);
3810 end if;
3811 --
3812 if to_number(l_per_information6) < 0 or
3813 to_number(l_per_information6) > 99 then
3814 -- Error: Additional pension years (PER_INFORMATION6) not in the
3815 -- range 0 - 99.
3816 hr_utility.set_message(801, 'HR_51272_PER_INFO6_INVALID');
3817 hr_utility.raise_error;
3818 end if;
3819 if g_debug then
3820 hr_utility.set_location(l_proc,130);
3821 end if;
3822 end if;
3823 if g_debug then
3824 hr_utility.set_location(l_proc, 140);
3825 end if;
3826 --
3827 -- Check if p_per_information7 is in the range 1 - 11.
3828 --
3829 if p_per_information7 is not null then
3830 --
3831 l_per_information7 := p_per_information7;
3832 hr_chkfmt.checkformat(value => l_per_information7
3833 ,format => 'I'
3834 ,output => l_output
3835 ,minimum => NULL
3836 ,maximum => NULL
3837 ,nullok => 'Y'
3838 ,rgeflg => l_rgeflg
3839 ,curcode => NULL);
3840 if g_debug then
3841 hr_utility.set_location(l_proc, 150);
3842 end if;
3843 --
3844 if to_number(l_per_information7) < 1 or
3845 to_number(l_per_information7) > 11 then
3846 -- Error: Additional pension months (PER_INFORMATION7) not in the
3847 -- range 1 - 11.
3848 hr_utility.set_message(801, 'HR_51273_PER_INFO7_INVALID');
3849 hr_utility.raise_error;
3850 end if;
3851 if g_debug then
3852 hr_utility.set_location(l_proc,160);
3853 end if;
3854 end if;
3855 if g_debug then
3856 hr_utility.set_location(l_proc, 170);
3857 end if;
3858 --
3859 -- Check if p_per_information8 is number.
3860 --
3861 if p_per_information8 is not null then
3862 --
3863 l_per_information8 := p_per_information8;
3864 hr_chkfmt.checkformat(value => l_per_information8
3865 ,format => 'I'
3866 ,output => l_output
3867 ,minimum => NULL
3868 ,maximum => NULL
3869 ,nullok => 'Y'
3870 ,rgeflg => l_rgeflg
3871 ,curcode => NULL);
3872 if g_debug then
3873 hr_utility.set_location(l_proc,180);
3874 end if;
3875 end if;
3876 if g_debug then
3877 hr_utility.set_location(l_proc, 190);
3878 end if;
3879 --
3880 -- Check if the per_information9 value exists in hr_lookups
3881 -- where the lookup_type is 'YES_NO'
3882 --
3883 if p_per_information9 is not null then
3884 --
3885 -- Check that per information9 exists in hr_lookups for the
3886 -- lookup type 'YES_NO' with an enabled flag set to 'Y' and that
3887 -- the effective start date of the person is between start date
3888 -- active and end date active in hr_lookups.
3889 --
3890 if hr_api.not_exists_in_dt_hr_lookups
3891 (p_effective_date => p_effective_date
3892 ,p_validation_start_date => p_validation_start_date
3893 ,p_validation_end_date => p_validation_end_date
3894 ,p_lookup_type => 'YES_NO'
3895 ,p_lookup_code => p_per_information9
3896 )
3897 then
3898 --
3899 hr_utility.set_message(801, 'HR_51274_PER_INFO9_INVALID');
3900 hr_utility.raise_error;
3901 --
3902 end if;
3903 if g_debug then
3904 hr_utility.set_location(l_proc,200);
3905 end if;
3906 --
3907 end if;
3908 if g_debug then
3909 hr_utility.set_location(l_proc,210);
3910 end if;
3911
3912 -- ***** Start new code for bug 2236999 **************
3913
3914 if p_per_information10 is not null then
3915 --
3916 -- Check that per information10 exists in hr_lookups for the
3917 -- lookup type 'YES_NO' with an enabled flag set to 'Y' and that
3918 -- the effective start date of the person is between start date
3919 -- active and end date active in hr_lookups.
3920 --
3921 if hr_api.not_exists_in_dt_hr_lookups
3922 (p_effective_date => p_effective_date
3923 ,p_validation_start_date => p_validation_start_date
3924 ,p_validation_end_date => p_validation_end_date
3925 ,p_lookup_type => 'YES_NO'
3926 ,p_lookup_code => p_per_information10
3927 )
3928 then
3929 --
3930 hr_utility.set_message(801, 'HR_78105_PER_INFO10_INVALID');
3931 hr_utility.raise_error;
3932 --
3933 end if;
3934
3935 --
3936 end if;
3937
3938 --***** End new code for bug 2236999 **************
3939 --
3940 -- Check if any of the remaining per_information parameters are not
3941 -- null
3942 -- (developer descriptive flexfields not used for GB)
3943 --
3944 if p_per_information3 is not null then
3945 l_info_attribute := 3;
3946 raise l_error;
3947
3948 -- ***** Start commented code for bug 2236999 **************
3949 /* elsif p_per_information10 is not null then
3950 l_info_attribute := 10;
3951 raise l_error;*/
3952 -- ***** End commented code for bug 2236999 **************
3953
3954 -- ***** Start commented code for bug 5606753 **************
3955 /*elsif p_per_information11 is not null then
3956 l_info_attribute := 11;
3957 raise l_error; */
3958 -- ***** End commented code for bug 5606753 **************
3959 -- ***** Start commented code for bug 5917391 *************
3960 /*elsif p_per_information12 is not null then
3961 l_info_attribute := 12;
3962 raise l_error;
3963 elsif p_per_information13 is not null then
3964 l_info_attribute := 13;
3965 raise l_error;
3966 elsif p_per_information14 is not null then
3967 l_info_attribute := 14;
3968 raise l_error;*/
3969 -- ***** End commented code for bug 5917391 ************
3970 elsif p_per_information15 is not null then
3971 l_info_attribute := 15;
3972 raise l_error;
3973 elsif p_per_information16 is not null then
3974 l_info_attribute := 16;
3975 raise l_error;
3976 elsif p_per_information17 is not null then
3977 l_info_attribute := 17;
3978 raise l_error;
3979 elsif p_per_information18 is not null then
3980 l_info_attribute := 18;
3981 raise l_error;
3982 elsif p_per_information19 is not null then
3983 l_info_attribute := 19;
3984 raise l_error;
3985 elsif p_per_information20 is not null then
3986 l_info_attribute := 20;
3987 raise l_error;
3988 elsif p_per_information21 is not null then
3989 l_info_attribute := 21;
3990 raise l_error;
3991 elsif p_per_information22 is not null then
3992 l_info_attribute := 22;
3993 raise l_error;
3994 elsif p_per_information23 is not null then
3995 l_info_attribute := 23;
3996 raise l_error;
3997 elsif p_per_information24 is not null then
3998 l_info_attribute := 24;
3999 raise l_error;
4000 -- Commenting null check for p_per_information25, p_per_information26 as
4001 -- these are used for Employee Referral Functionality
4002 /*elsif p_per_information25 is not null then
4003 l_info_attribute := 25;
4004 raise l_error;
4005 elsif p_per_information26 is not null then
4006 l_info_attribute := 26;
4007 raise l_error;*/
4008 -- End of Commenting for Employee Referral
4009 elsif p_per_information27 is not null then
4010 l_info_attribute := 27;
4011 raise l_error;
4012 elsif p_per_information28 is not null then
4013 l_info_attribute := 28;
4014 raise l_error;
4015 elsif p_per_information29 is not null then
4016 l_info_attribute := 29;
4017 raise l_error;
4018 elsif p_per_information30 is not null then
4019 l_info_attribute := 30;
4020 raise l_error;
4021 end if;
4022 if g_debug then
4023 hr_utility.set_location(' Leaving:'|| l_proc, 220);
4024 end if;
4025 exception
4026 when l_error then
4027 -- Error: Do not enter PER_INFORMATION99 for this legislation
4028 hr_utility.set_message(801, 'HR_7529_PER_INFO_NOT_NULL');
4029 hr_utility.set_message_token('NUM',to_char(l_info_attribute));
4030 hr_utility.raise_error;
4031 end chk_GB_per_information;
4032 --
4033 -- ---------------------------------------------------------------------------
4034 -- |---------------------< chk_US_per_information >-------------------------|
4035 -- ---------------------------------------------------------------------------
4036 --
4037 -- Description:
4038 -- - Checks that the values held in developer descriptive flexfields
4039 -- are valid for a category of 'US'.
4040 -- - Validates that per information6 and 9 exist as a lookup code on
4041 -- HR_LOOKUPS for the lookup type 'YES_NO' with an enabled flag
4042 -- set to 'Y' and the effective start date of the person between start
4043 -- date active and end date active on HR_LOOKUPS.
4044 -- - Validates that per information1 exists as a lookup code on HR_LOOKUPS
4045 -- for the lookup type 'US_ETHNIC_GROUP' with an enabled flag set to 'Y'
4046 -- and the effective start date of the person between start date active
4047 -- and end date active on HR_LOOKUPS.
4048 -- - Validates that per information2 exists as a lookup code on HR_LOOKUPS
4049 -- for the lookup type 'PER_US_I9_STATE' with an enabled flag set to 'Y'
4050 -- and the effective start date of the person between start date active
4051 -- and end date active on HR_LOOKUPS.
4052 -- - Validates that per information4 exists as a lookup code on HR_LOOKUPS
4053 -- for the lookup type 'US_VISA_TYPE' with an enabled flag set to 'Y'
4054 -- and the effective start date of the person between start date active
4055 -- and end date active on HR_LOOKUPS.
4056 -- - Validates that per information5 exists as a lookup code on HR_LOOKUPS
4057 -- for the lookup type 'US_VETERAN_STATUS' with an enabled flag set to 'Y'
4058 -- and the effective start date of the person between start date active
4059 -- and end date active on HR_LOOKUPS.
4060 -- - Validates that per information7 exists as a lookup code on HR_LOOKUPS
4061 -- for the lookup type 'US_NEW_HIRE_STATUS' with an enabled flag set to 'Y'
4062 -- and the effective start date of the person between start date active
4063 -- and end date active on HR_LOOKUPS.
4064 -- - Validates that when per information7 is set to 'EXCL' that per
4065 -- information8 exists as a lookup code on HR_LOOKUPS for the lookup type
4066 -- 'US_NEW_HIRE_EXCEPTIONS' with an enabled flag set to 'Y' and the
4067 -- effective start date of the person between start date active and end
4068 -- date active on HR_LOOKUPS.
4069 -- - Validates that per information10 exists as a lookup code on
4070 -- HR_LOOKUPS for the lookup type 'YES_NO' with an enabled flag
4071 -- set to 'Y' and the effective start date of the person between start
4072 -- date active and end date active on HR_LOOKUPS.
4073 --
4074 -- Pre-conditions:
4075 -- None
4076 --
4077 -- In Arguments:
4078 -- p_person_id
4079 -- p_per_information_category
4080 -- p_per_information1
4081 -- p_per_information2
4082 -- p_per_information3
4083 -- p_per_information4
4084 -- p_per_information5
4085 -- p_per_information6
4086 -- p_per_information7
4087 -- p_per_information8
4088 -- p_per_information9
4089 -- p_per_information10
4090 -- p_per_information11
4091 -- p_per_information12
4092 -- p_per_information13
4093 -- p_per_information14
4094 -- p_per_information15
4095 -- p_per_information16
4096 -- p_per_information17
4097 -- p_per_information18
4098 -- p_per_information19
4099 -- p_per_information20
4100 -- p_per_information21
4101 -- p_per_information22
4102 -- p_per_information23
4103 -- p_per_information24
4104 -- p_per_information25
4105 -- p_per_information26
4106 -- p_per_information27
4107 -- p_per_information28
4108 -- p_per_information29
4109 -- p_per_information30
4110 -- p_effective_date
4111 -- p_validation_start_date
4112 -- p_validation_end_date
4113 -- p_object_version_number
4114 -- p_api_updating
4115 --
4116 -- Post Success:
4117 -- Processing continues if:
4118 -- - per information6 and 9 exist as a lookup code in HR_LOOKUPS
4119 -- for the lookup type 'YES_NO' where the enabled flag is 'Y' and
4120 -- the effective start date of the person is between start date
4121 -- active and end date active on HR_LOOKUPS.
4122 -- - per information1 exists as a lookup code in HR_LOOKUPS
4123 -- for the lookup type 'US_ETHNIC_GROUP' where the enabled flag is
4124 -- 'Y' and the effective start date of the person is between start
4125 -- date active and end date active on HR_LOOKUPS.
4126 -- - per information2 exists as a lookup code in HR_LOOKUPS
4127 -- for the lookup type 'PER_US_I9_STATE' where the enabled flag is
4128 -- 'Y' and the effective start date of the person is between start
4129 -- date active and end date active on HR_LOOKUPS.
4130 -- - per information3 is a valid date and 11 characters long.
4131 -- - per information4 exists as a lookup code in HR_LOOKUPS
4132 -- for the lookup type 'US_VISA_TYPE' where the enabled flag is
4133 -- 'Y' and the effective start date of the person is between start
4134 -- date active and end date active on HR_LOOKUPS.
4135 -- - per information5 exists as a lookup code in HR_LOOKUPS
4136 -- for the lookup type 'US_VETERAN_STATUS' where the enabled flag is
4137 -- 'Y' and the effective start date of the person is between start
4138 -- date active and end date active on HR_LOOKUPS.
4139 -- - per information7 exists as a lookup code in HR_LOOKUPS
4140 -- for the lookup type 'US_NEW_HIRE_STATUS' where the enabled flag is
4141 -- 'Y' and the effective start date of the person is between start
4142 -- date active and end date active on HR_LOOKUPS.
4143 -- - when per information7 is set to 'EXCL' and per information8 exists
4144 -- as a lookup code in HR_LOOKUPS for the lookup type
4145 -- 'US_NEW_HIRE_EXCEPTIONS' where the enabled flag is 'Y' and the
4146 -- effective start date of the person is between start date active
4147 -- and end date active on HR_LOOKUPS.
4148 --
4149 -- 9) per_information9 value exists in hr_lookups
4150 -- where lookup_type = 'YES_NO'
4151 --
4152 -- 10) per information10 exists as a lookup code in HR_LOOKUPS
4153 -- for the lookup type 'YES_NO' where the enabled flag is 'Y' and
4154 -- the effective start date of the person is between start date
4155 -- active and end date active on HR_LOOKUPS.
4156 --
4157 -- 11) per_information11 to 20 values are null
4158 --
4159 -- Post Failure:
4160 -- An application error is raised and processing is terminated if:
4161 -- - per information6 and 9 does not exist as a lookup code in
4162 -- HR_LOOKUPS for the lookup type 'YES_NO' where the
4163 -- enabled flag is 'Y' and the effective start date of the person
4164 -- is between start date active and end date active on HR_LOOKUPS.
4165 -- - per information1 doesn't exist as a lookup code in HR_LOOKUPS
4166 -- for the lookup type 'US_ETHNIC_GROUP' where the enabled flag is
4167 -- 'Y' and the effective start date of the person is between start
4168 -- date active and end date active on HR_LOOKUPS.
4169 -- - per information2 doesn't exist as a lookup code in HR_LOOKUPS
4170 -- for the lookup type 'PER_US_I9_STATE' where the enabled flag is
4171 -- 'Y' and the effective start date of the person is between start
4172 -- date active and end date active on HR_LOOKUPS.
4173 -- - per information3 value is an invalid date or less than 11
4174 -- characters long.
4175 -- - per information4 doesn't exist as a lookup code in HR_LOOKUPS
4176 -- for the lookup type 'US_VISA_TYPE' where the enabled flag is
4177 -- 'Y' and the effective start date of the person is between start
4178 -- date active and end date active on HR_LOOKUPS.
4179 -- - per information5 doesn't exist as a lookup code in HR_LOOKUPS
4180 -- for the lookup type 'US_VETERAN_STATUS' where the enabled flag is
4181 -- 'Y' and the effective start date of the person is between start
4182 -- date active and end date active on HR_LOOKUPS.
4183 -- - per information7 doesn't exist as a lookup code in HR_LOOKUPS
4184 -- for the lookup type 'US_NEW_HIRE_STATUS' where the enabled flag is
4185 -- 'Y' and the effective start date of the person is between start
4186 -- date active and end date active on HR_LOOKUPS.
4187 -- - per information8 doesn't exist as a lookup code in HR_LOOKUPS
4188 -- for the lookup type 'US_NEW_HIRE_EXCEPTION' where the enabled flag is
4189 -- 'Y' and the effective start date of the person is between start
4190 -- date active and end date active on HR_LOOKUPS.
4191 -- - when per information7 is set to 'EXCL' and per information8 doesn't
4192 -- exist as a lookup code in HR_LOOKUPS for the lookup type
4193 -- 'US_NEW_HIRE_EXCEPTIONS' where the enabled flag is 'Y' and the
4194 -- effective start date of the person is between start date active
4195 -- and end date active on HR_LOOKUPS.
4196 --
4197 -- 9) per_information9 value does not exists in hr_lookups
4198 -- where lookup_type = 'YES_NO'
4199 --
4200 -- 10) per information10 does not exist as a lookup code in HR_LOOKUPS
4201 -- for the lookup type 'YES_NO' where the enabled flag is 'Y' and
4202 -- the effective start date of the person is between start date
4203 -- active and end date active on HR_LOOKUPS.
4204 --
4205 -- 11) per_information11 to 20 values are not null
4206 --
4207 -- Access Status:
4208 -- Internal Table Handler Use Only.
4209 --
4210 procedure chk_US_per_information
4211 (p_person_id in per_all_people_f.person_id%TYPE
4212 ,p_per_information_category in per_all_people_f.per_information_category%TYPE
4213 ,p_per_information1 in per_all_people_f.per_information1%TYPE
4214 ,p_per_information2 in per_all_people_f.per_information2%TYPE
4215 ,p_per_information3 in per_all_people_f.per_information3%TYPE
4216 ,p_per_information4 in per_all_people_f.per_information4%TYPE
4217 ,p_per_information5 in per_all_people_f.per_information5%TYPE
4218 ,p_per_information6 in per_all_people_f.per_information6%TYPE
4219 ,p_per_information7 in per_all_people_f.per_information7%TYPE
4220 ,p_per_information8 in per_all_people_f.per_information8%TYPE
4221 ,p_per_information9 in per_all_people_f.per_information9%TYPE
4222 ,p_per_information10 in per_all_people_f.per_information10%TYPE
4223 ,p_per_information11 in per_all_people_f.per_information11%TYPE
4224 ,p_per_information12 in per_all_people_f.per_information12%TYPE
4225 ,p_per_information13 in per_all_people_f.per_information13%TYPE
4226 ,p_per_information14 in per_all_people_f.per_information14%TYPE
4227 ,p_per_information15 in per_all_people_f.per_information15%TYPE
4228 ,p_per_information16 in per_all_people_f.per_information16%TYPE
4229 ,p_per_information17 in per_all_people_f.per_information17%TYPE
4230 ,p_per_information18 in per_all_people_f.per_information18%TYPE
4231 ,p_per_information19 in per_all_people_f.per_information19%TYPE
4232 ,p_per_information20 in per_all_people_f.per_information20%TYPE
4233 ,p_per_information21 in per_all_people_f.per_information21%TYPE
4234 ,p_per_information22 in per_all_people_f.per_information22%TYPE
4235 ,p_per_information23 in per_all_people_f.per_information23%TYPE
4236 ,p_per_information24 in per_all_people_f.per_information24%TYPE
4237 ,p_per_information25 in per_all_people_f.per_information25%TYPE
4238 ,p_per_information26 in per_all_people_f.per_information26%TYPE
4239 ,p_per_information27 in per_all_people_f.per_information27%TYPE
4240 ,p_per_information28 in per_all_people_f.per_information28%TYPE
4241 ,p_per_information29 in per_all_people_f.per_information29%TYPE
4242 ,p_per_information30 in per_all_people_f.per_information30%TYPE
4243 ,p_effective_date in date
4244 ,p_validation_start_date in date
4245 ,p_validation_end_date in date
4246 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
4247 ,p_api_updating in boolean
4248 )
4249 is
4250 --
4251 l_exists varchar2(1);
4252 l_error exception;
4253 l_temp_error exception;
4254 l_proc varchar2(72) := g_package||'chk_US_per_information';
4255 l_lookup_type varchar2(30);
4256 l_info_attribute number(2);
4257 l_per_information3 per_all_people_f.per_information3%TYPE;
4258 l_output varchar2(150);
4259 l_rgeflg varchar2(10);
4260 --
4261 begin
4262 if g_debug then
4263 hr_utility.set_location('Entering:'|| l_proc, 10);
4264 end if;
4265 --
4266 -- Check the mandatory parameters
4267 --
4268 hr_api.mandatory_arg_error
4269 (p_api_name => l_proc
4270 ,p_argument => 'effective_date'
4271 ,p_argument_value => p_effective_date
4272 );
4273 --
4274 hr_api.mandatory_arg_error
4275 (p_api_name => l_proc
4276 ,p_argument => 'validation_start_date'
4277 ,p_argument_value => p_validation_start_date
4278 );
4279 --
4280 hr_api.mandatory_arg_error
4281 (p_api_name => l_proc
4282 ,p_argument => 'validation_end_date'
4283 ,p_argument_value => p_validation_end_date
4284 );
4285 if g_debug then
4286 hr_utility.set_location(l_proc,20);
4287 end if;
4288 --
4289 -- We know the per_information_category is US, so check the rest of
4290 -- the per_information fields within this context.
4291 --
4292 -- Check if the value for per information1 is set on insert or has
4293 -- changed on update.
4294 --
4295 if (((nvl(p_per_information1,hr_api.g_varchar2)
4296 <> nvl(per_per_shd.g_old_rec.per_information1,hr_api.g_varchar2)
4297 and p_api_updating)
4298 or (NOT p_api_updating))
4299 and p_per_information1 is not null)
4300 then
4301 --
4302 -- Check that per information1 exists in hr_lookups for the
4303 -- lookup type 'US_ETHNIC_GROUP' with an enabled flag set to 'Y'
4304 -- and that the effective start date of the person is between start
4305 -- date active and end date active in hr_lookups.
4306 --
4307 if hr_api.not_exists_in_dt_hr_lookups
4308 (p_effective_date => p_effective_date
4309 ,p_validation_start_date => p_validation_start_date
4310 ,p_validation_end_date => p_validation_end_date
4311 ,p_lookup_type => 'US_ETHNIC_GROUP'
4312 ,p_lookup_code => p_per_information1
4313 )
4314 then
4315 --
4316 hr_utility.set_message(801, 'HR_7524_PER_INFO1_INVALID');
4317 hr_utility.raise_error;
4318 --
4319 end if;
4320 if g_debug then
4321 hr_utility.set_location(l_proc,30);
4322 end if;
4323 --
4324 end if;
4325 if g_debug then
4326 hr_utility.set_location( l_proc, 40);
4327 end if;
4328 --
4329 -- Check if the value for per information2 is set on insert or has
4330 -- changed on update.
4331 --
4332 if (((nvl(p_per_information2,hr_api.g_varchar2) <>
4333 nvl(per_per_shd.g_old_rec.per_information2,hr_api.g_varchar2)
4334 and p_api_updating) or
4335 (NOT p_api_updating)) and
4336 p_per_information2 is not null)
4337 then
4338 --
4339 -- Check that per information2 exists in hr_lookups for the
4340 -- lookup type 'PER_US_I9_STATE' with an enabled flag set to 'Y' and that
4341 -- the effective start date of the person is between start date
4342 -- active and end date active in hr_lookups.
4343 --
4344 if hr_api.not_exists_in_dt_hr_lookups
4345 (p_effective_date => p_effective_date
4346 ,p_validation_start_date => p_validation_start_date
4347 ,p_validation_end_date => p_validation_end_date
4348 ,p_lookup_type => 'PER_US_I9_STATE'
4349 ,p_lookup_code => p_per_information2
4350 )
4351 then
4352 --
4353 hr_utility.set_message(801, 'HR_51243_PER_INFO2_INVALID');
4354 hr_utility.raise_error;
4355 --
4356 end if;
4357 if g_debug then
4358 hr_utility.set_location(l_proc,50);
4359 end if;
4360 --
4361 end if;
4362 if g_debug then
4363 hr_utility.set_location(l_proc, 60);
4364 end if;
4365 --
4366 -- Check if the value for per information3 is set on insert or has
4367 -- changed on update.
4368 --
4369 if (((nvl(p_per_information3,hr_api.g_varchar2) <>
4370 nvl(per_per_shd.g_old_rec.per_information3,hr_api.g_varchar2)
4371 and p_api_updating) or
4372 (NOT p_api_updating)) and
4373 p_per_information3 is not null)
4374 then
4375 --
4376 -- Check if the per_information3 value is an 11 character date
4377 -- field.
4378 --
4379 l_per_information3 := p_per_information3;
4380 hr_chkfmt.changeformat(input => l_per_information3
4381 ,output => l_output
4382 ,format => 'D'
4383 ,curcode => NULL);
4384 if g_debug then
4385 hr_utility.set_location(l_proc, 70);
4386 end if;
4387 end if;
4388 if g_debug then
4389 hr_utility.set_location(l_proc, 80);
4390 end if;
4391 --
4392 -- Check if the value for per information4 is set on insert or has
4393 -- changed on update.
4394 --
4395 if (((nvl(p_per_information4,hr_api.g_varchar2) <>
4396 nvl(per_per_shd.g_old_rec.per_information4,hr_api.g_varchar2)
4397 and p_api_updating) or
4398 (NOT p_api_updating)) and
4399 p_per_information4 is not null)
4400 then
4401 --
4402 -- Check that per information4 exists in hr_lookups for the
4403 -- lookup type 'US_VISA_TYPE' with an enabled flag set to 'Y'
4404 -- and that the effective start date of the person is between start
4405 -- date active and end date active in hr_lookups.
4406 --
4407 if hr_api.not_exists_in_dt_hr_lookups
4408 (p_effective_date => p_effective_date
4409 ,p_validation_start_date => p_validation_start_date
4410 ,p_validation_end_date => p_validation_end_date
4411 ,p_lookup_type => 'US_VISA_TYPE'
4412 ,p_lookup_code => p_per_information4
4413 )
4414 then
4415 --
4416 hr_utility.set_message(801, 'HR_51245_PER_INFO4_INVALID');
4417 hr_utility.raise_error;
4418 --
4419 end if;
4420 if g_debug then
4421 hr_utility.set_location(l_proc,90);
4422 end if;
4423 --
4424 end if;
4425 if g_debug then
4426 hr_utility.set_location(l_proc, 100);
4427 end if;
4428 --
4429 -- Check if the value for per information5 is set on insert or has
4430 -- changed on update.
4431 --
4432 if (((nvl(p_per_information5,hr_api.g_varchar2) <>
4433 nvl(per_per_shd.g_old_rec.per_information5,hr_api.g_varchar2)
4434 and p_api_updating) or
4435 (NOT p_api_updating)) and
4436 p_per_information5 is not null)
4437 then
4438 --
4439 -- Check that per information5 exists in hr_lookups for the
4440 -- lookup type 'US_VISA_TYPE' with an enabled flag set to 'Y'
4441 -- and that the effective start date of the person is between start
4442 -- date active and end date active in hr_lookups.
4443 --
4444 if hr_api.not_exists_in_dt_hr_lookups
4445 (p_effective_date => p_effective_date
4446 ,p_validation_start_date => p_validation_start_date
4447 ,p_validation_end_date => p_validation_end_date
4448 ,p_lookup_type => 'US_VETERAN_STATUS'
4449 ,p_lookup_code => p_per_information5
4450 )
4451 then
4452 --
4453 hr_utility.set_message(801, 'HR_51246_PER_INFO5_INVALID');
4454 hr_utility.raise_error;
4455 --
4456 end if;
4457 if g_debug then
4458 hr_utility.set_location(l_proc,110);
4459 end if;
4460 --
4461 end if;
4462 if g_debug then
4463 hr_utility.set_location( l_proc, 120);
4464 end if;
4465 --
4466 -- Check if the value for per information6 is set on insert or has
4467 -- changed on update.
4468 --
4469 if (((nvl(p_per_information6,hr_api.g_varchar2) <>
4470 nvl(per_per_shd.g_old_rec.per_information6,hr_api.g_varchar2)
4471 and p_api_updating) or
4472 (NOT p_api_updating)) and
4473 p_per_information6 is not null)
4474 then
4475 --
4476 -- Check that per information6 exists in hr_lookups for the
4477 -- lookup type 'YES_NO' with an enabled flag set to 'Y' and that
4478 -- the effective start date of the person is between start date
4479 -- active and end date active in hr_lookups.
4480 --
4481 if hr_api.not_exists_in_dt_hr_lookups
4482 (p_effective_date => p_effective_date
4483 ,p_validation_start_date => p_validation_start_date
4484 ,p_validation_end_date => p_validation_end_date
4485 ,p_lookup_type => 'YES_NO'
4486 ,p_lookup_code => p_per_information6
4487 )
4488 then
4489 --
4490 hr_utility.set_message(801, 'HR_51247_PER_INFO6_INVALID');
4491 hr_utility.raise_error;
4492 --
4493 end if;
4494 if g_debug then
4495 hr_utility.set_location(l_proc, 130);
4496 end if;
4497 --
4498 end if;
4499 if g_debug then
4500 hr_utility.set_location( l_proc, 140);
4501 end if;
4502 --
4503 -- Check if the value for per information7 is set on insert or has
4504 -- changed on update.
4505 --
4506 if (((nvl(p_per_information7,hr_api.g_varchar2) <>
4507 nvl(per_per_shd.g_old_rec.per_information7,hr_api.g_varchar2)
4508 and p_api_updating) or
4509 (NOT p_api_updating)) and
4510 p_per_information7 is not null)
4511 then
4512 --
4513 -- Check that per information7 exists in hr_lookups for the
4514 -- lookup type 'US_NEW_HIRE_STATUS' with an enabled flag set to 'Y'
4515 -- and that the effective start date of the person is between start
4516 -- date active and end date active in hr_lookups.
4517 --
4518 if hr_api.not_exists_in_dt_hr_lookups
4519 (p_effective_date => p_effective_date
4520 ,p_validation_start_date => p_validation_start_date
4521 ,p_validation_end_date => p_validation_end_date
4522 ,p_lookup_type => 'US_NEW_HIRE_STATUS'
4523 ,p_lookup_code => p_per_information7
4524 )
4525 then
4526 --
4527 hr_utility.set_message(801, 'HR_51285_PER_INFO7_INVALID');
4528 hr_utility.raise_error;
4529 --
4530 end if;
4531 if g_debug then
4532 hr_utility.set_location(l_proc,150);
4533 end if;
4534 --
4535 end if;
4536 if g_debug then
4537 hr_utility.set_location( l_proc, 160);
4538 end if;
4539 --
4540 -- Check if the value for per information8 is set on insert or has
4541 -- changed on update.
4542 --
4543 if (((nvl(p_per_information8,hr_api.g_varchar2) <>
4544 nvl(per_per_shd.g_old_rec.per_information8,hr_api.g_varchar2)
4545 and p_api_updating) or
4546 (NOT p_api_updating)) and
4547 p_per_information8 is not null)
4548 then
4549 --
4550 -- Check if per information7 is 'EXCL'
4551 --
4552 if nvl(p_per_information7,hr_api.g_varchar2) <> 'EXCL'
4553 then
4554 --
4555 -- Error: Field must be null because per_info7 is not 'EXCL'
4556 --
4557 hr_utility.set_message(801, 'HR_51286_PER_INFO8_NOT_NULL');
4558 hr_utility.raise_error;
4559 else
4560 --
4561 -- Check that per information7 exists in hr_lookups for the
4562 -- lookup type 'US_NEW_HIRE_EXCEPTIONS' with an enabled flag set to 'Y'
4563 -- and that the effective start date of the person is between start
4564 -- date active and end date active in hr_lookups.
4565 --
4566 if hr_api.not_exists_in_dt_hr_lookups
4567 (p_effective_date => p_effective_date
4568 ,p_validation_start_date => p_validation_start_date
4569 ,p_validation_end_date => p_validation_end_date
4570 ,p_lookup_type => 'US_NEW_HIRE_EXCEPTIONS'
4571 ,p_lookup_code => p_per_information8
4572 )
4573 then
4574 --
4575 hr_utility.set_message(801, 'HR_51287_PER_INFO8_INVALID');
4576 hr_utility.raise_error;
4577 --
4578 end if;
4579 if g_debug then
4580 hr_utility.set_location( l_proc, 170);
4581 end if;
4582 --
4583 end if;
4584 end if;
4585 if g_debug then
4586 hr_utility.set_location( l_proc, 180);
4587 end if;
4588 --
4589 -- Check if the value for per information9 is set on insert or has
4590 -- changed on update.
4591 --
4592 if (((nvl(p_per_information9,hr_api.g_varchar2) <>
4593 nvl(per_per_shd.g_old_rec.per_information9,hr_api.g_varchar2)
4594 and p_api_updating) or
4595 (NOT p_api_updating)) and
4596 p_per_information9 is not null)
4597 then
4598 --
4599 -- Check that per information9 exists in hr_lookups for the
4600 -- lookup type 'YES_NO' with an enabled flag set to 'Y' and that
4601 -- the effective start date of the person is between start date
4602 -- active and end date active in hr_lookups.
4603 --
4604 if hr_api.not_exists_in_dt_hr_lookups
4605 (p_effective_date => p_effective_date
4606 ,p_validation_start_date => p_validation_start_date
4607 ,p_validation_end_date => p_validation_end_date
4608 ,p_lookup_type => 'YES_NO'
4609 ,p_lookup_code => p_per_information9
4610 )
4611 then
4612 --
4613 hr_utility.set_message(801, 'HR_51288_PER_INFO9_INVALID');
4614 hr_utility.raise_error;
4615 --
4616 end if;
4617 if g_debug then
4618 hr_utility.set_location(l_proc, 190);
4619 end if;
4620 --
4621 end if;
4622 if g_debug then
4623 hr_utility.set_location( l_proc, 200);
4624 end if;
4625 --
4626 if (((nvl(p_per_information10,hr_api.g_varchar2) <>
4627 nvl(per_per_shd.g_old_rec.per_information10,hr_api.g_varchar2)
4628 and p_api_updating) or
4629 (NOT p_api_updating)) and
4630 p_per_information10 is not null)
4631 then
4632 --
4633 -- Check that per information10 exists in hr_lookups for the
4634 -- lookup type 'YES_NO' with an enabled flag set to 'Y' and that
4635 -- the effective start date of the person is between start date
4636 -- active and end date active in hr_lookups.
4637 --
4638 if hr_api.not_exists_in_dt_hr_lookups
4639 (p_effective_date => p_effective_date
4640 ,p_validation_start_date => p_validation_start_date
4641 ,p_validation_end_date => p_validation_end_date
4642 ,p_lookup_type => 'YES_NO'
4643 ,p_lookup_code => p_per_information10
4644 )
4645 then
4646 --
4647 hr_utility.set_message(801, 'PER_52390_PER_INFO10_INVALID');
4648 hr_utility.raise_error;
4649 --
4650 end if;
4651 if g_debug then
4652 hr_utility.set_location(l_proc,210);
4653 end if;
4654 --
4655 end if;
4656 if g_debug then
4657 hr_utility.set_location(l_proc,220);
4658 end if;
4659
4660
4661 -- Check if any of the remaining per_information parameters are not
4662 -- null
4663 -- (developer descriptive flexfields not used for US)
4664 --
4665
4666 -- TM removed check for p_per_information10 now that it is being used.
4667 -- Removed check for p_per_infomation11 for the bug#
4668
4669 /* if p_per_information11 is not null then
4670 l_info_attribute := 11;
4671 raise l_error;*/
4672 -- ***** Start commented code for bug 5917391 *************
4673 /*if p_per_information12 is not null then
4674 l_info_attribute := 12;
4675 raise l_error;
4676 elsif p_per_information13 is not null then
4677 l_info_attribute := 13;
4678 raise l_error;
4679 elsif p_per_information14 is not null then
4680 l_info_attribute := 14;
4681 raise l_error;*/
4682 -- ***** End commented code for bug 5917391 *************
4683 if p_per_information15 is not null then
4684 l_info_attribute := 15;
4685 raise l_error;
4686 elsif p_per_information16 is not null then
4687 l_info_attribute := 16;
4688 raise l_error;
4689 elsif p_per_information17 is not null then
4690 l_info_attribute := 17;
4691 raise l_error;
4692 elsif p_per_information18 is not null then
4693 l_info_attribute := 18;
4694 raise l_error;
4695 elsif p_per_information19 is not null then
4696 l_info_attribute := 19;
4697 raise l_error;
4698 elsif p_per_information20 is not null then
4699 l_info_attribute := 20;
4700 raise l_error;
4701 -- end if;
4702 elsif p_per_information21 is not null then
4703 l_info_attribute := 21;
4704 raise l_error;
4705 elsif p_per_information22 is not null then
4706 l_info_attribute := 22;
4707 raise l_error;
4708 elsif p_per_information23 is not null then
4709 l_info_attribute := 23;
4710 raise l_error;
4711 elsif p_per_information24 is not null then
4712 l_info_attribute := 24;
4713 raise l_error;
4714 -- Commenting null check for p_per_information25, p_per_information26 as
4715 -- these are used for Employee Referral Functionality
4716 /*elsif p_per_information25 is not null then
4717 l_info_attribute := 25;
4718 raise l_error;
4719 elsif p_per_information26 is not null then
4720 l_info_attribute := 26;
4721 raise l_error;*/
4722 -- End of Commenting for Employee Referral
4723 elsif p_per_information27 is not null then
4724 l_info_attribute := 27;
4725 raise l_error;
4726 elsif p_per_information28 is not null then
4727 l_info_attribute := 28;
4728 raise l_error;
4729 elsif p_per_information29 is not null then
4730 l_info_attribute := 29;
4731 raise l_error;
4732 elsif p_per_information30 is not null then
4733 l_info_attribute := 30;
4734 raise l_error;
4735 end if;
4736 if g_debug then
4737 hr_utility.set_location('Leaving:'|| l_proc, 230);
4738 end if;
4739 exception
4740 when l_error then
4741 -- Error: Do not enter PER_INFORMATION99 for this legislation
4742 hr_utility.set_message(801, 'HR_7529_PER_INFO_NOT_NULL');
4743 hr_utility.set_message_token('NUM',to_char(l_info_attribute));
4744 hr_utility.raise_error;
4745 end chk_US_per_information;
4746 --
4747 -- ----------------------------------------------------------------------------
4748 -- |------------------------<chk_JP_per_information >------------------------|
4749 -- ----------------------------------------------------------------------------
4750
4751 procedure chk_JP_per_information
4752 (p_person_id in per_all_people_f.person_id%TYPE
4753 ,p_per_information_category in per_all_people_f.per_information_category%TYPE
4754 ,p_per_information1 in per_all_people_f.per_information1%TYPE
4755 ,p_per_information2 in per_all_people_f.per_information2%TYPE
4756 ,p_per_information3 in per_all_people_f.per_information3%TYPE
4757 ,p_per_information4 in per_all_people_f.per_information4%TYPE
4758 ,p_per_information5 in per_all_people_f.per_information5%TYPE
4759 ,p_per_information6 in per_all_people_f.per_information6%TYPE
4760 ,p_per_information7 in per_all_people_f.per_information7%TYPE
4761 ,p_per_information8 in per_all_people_f.per_information8%TYPE
4762 ,p_per_information9 in per_all_people_f.per_information9%TYPE
4763 ,p_per_information10 in per_all_people_f.per_information10%TYPE
4764 ,p_per_information11 in per_all_people_f.per_information11%TYPE
4765 ,p_per_information12 in per_all_people_f.per_information12%TYPE
4766 ,p_per_information13 in per_all_people_f.per_information13%TYPE
4767 ,p_per_information14 in per_all_people_f.per_information14%TYPE
4768 ,p_per_information15 in per_all_people_f.per_information15%TYPE
4769 ,p_per_information16 in per_all_people_f.per_information16%TYPE
4770 ,p_per_information17 in per_all_people_f.per_information17%TYPE
4771 ,p_per_information18 in per_all_people_f.per_information18%TYPE
4772 ,p_per_information19 in per_all_people_f.per_information19%TYPE
4773 ,p_per_information20 in per_all_people_f.per_information20%TYPE
4774 ,p_per_information21 in per_all_people_f.per_information21%TYPE
4775 ,p_per_information22 in per_all_people_f.per_information22%TYPE
4776 ,p_per_information23 in per_all_people_f.per_information23%TYPE
4777 ,p_per_information24 in per_all_people_f.per_information24%TYPE
4778 ,p_per_information25 in per_all_people_f.per_information25%TYPE
4779 ,p_per_information26 in per_all_people_f.per_information26%TYPE
4780 ,p_per_information27 in per_all_people_f.per_information27%TYPE
4781 ,p_per_information28 in per_all_people_f.per_information28%TYPE
4782 ,p_per_information29 in per_all_people_f.per_information29%TYPE
4783 ,p_per_information30 in per_all_people_f.per_information30%TYPE
4784 ,p_effective_date in date
4785 ,p_validation_start_date in date
4786 ,p_validation_end_date in date
4787 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
4788 ) is
4789
4790 l_error exception;
4791 l_proc varchar2(72) := g_package||'chk_JP_per_information';
4792 l_info_attribute number(2);
4793 --
4794 begin
4795 if g_debug then
4796 hr_utility.set_location('Entering:'|| l_proc, 10);
4797 end if;
4798 --
4799 -- Check the mandatory parameters
4800 --
4801 hr_api.mandatory_arg_error
4802 (p_api_name => l_proc
4803 ,p_argument => 'effective_date'
4804 ,p_argument_value => p_effective_date
4805 );
4806 --
4807 hr_api.mandatory_arg_error
4808 (p_api_name => l_proc
4809 ,p_argument => 'validation_start_date'
4810 ,p_argument_value => p_validation_start_date
4811 );
4812 --
4813 hr_api.mandatory_arg_error
4814 (p_api_name => l_proc
4815 ,p_argument => 'validation_end_date'
4816 ,p_argument_value => p_validation_end_date
4817 );
4818 if g_debug then
4819 hr_utility.set_location(l_proc,20);
4820 end if;
4821 --
4822 -- We know the per_information_category is JP, so check the rest of
4823 -- the per_information fields within this context.
4824 --
4825 -- Check if the per_information1 value exists in hr_lookups
4826 -- where the lookup_type is 'YES_NO'
4827 --
4828 if p_per_information1 is not null then
4829 --
4830 -- Check that per information1 exists in hr_lookups for the
4831 -- lookup type 'YES_NO' with an enabled flag set to 'Y' and that
4832 -- the effective start date of the person is between start date
4833 -- active and end date active in hr_lookups.
4834 --
4835 if hr_api.not_exists_in_dt_hr_lookups
4836 (p_effective_date => p_effective_date
4837 ,p_validation_start_date => p_validation_start_date
4838 ,p_validation_end_date => p_validation_end_date
4839 ,p_lookup_type => 'YES_NO'
4840 ,p_lookup_code => p_per_information1
4841 )
4842 then
4843 --
4844 hr_utility.set_message(801, 'HR_72022_PER_INFO1_INVALID');
4845 hr_utility.raise_error;
4846 --
4847 end if;
4848 if g_debug then
4849 hr_utility.set_location(l_proc,30);
4850 end if;
4851 --
4852 end if;
4853 if g_debug then
4854 hr_utility.set_location(l_proc,40);
4855 end if;
4856 --
4857 -- Check if the per_information2 value exists in hr_lookups
4858 -- where the lookup_type is 'JP_TERM_LOCAL_TAX_PAYMENT_TYPE'
4859 --
4860 if p_per_information2 is not null then
4861 --
4862 -- Check that per information2 exists in hr_lookups for the
4863 -- lookup type 'JP_TERM_LOCAL_TAX_PAYMENT_TYPE' with an enabled
4864 -- flag set to 'Y' and that
4865 -- the effective start date of the person is between start date
4866 -- active and end date active in hr_lookups.
4867 --
4868 if hr_api.not_exists_in_dt_hr_lookups
4869 (p_effective_date => p_effective_date
4870 ,p_validation_start_date => p_validation_start_date
4871 ,p_validation_end_date => p_validation_end_date
4872 ,p_lookup_type => 'JP_TERM_LOCAL_TAX_PAYMENT_TYPE'
4873 ,p_lookup_code => p_per_information2
4874 )
4875 then
4876 --
4877 hr_utility.set_message(801, 'HR_72023_PER_INFO2_INVALID');
4878 hr_utility.raise_error;
4879 --
4880 end if;
4881 if g_debug then
4882 hr_utility.set_location(l_proc,50);
4883 end if;
4884 --
4885 end if;
4886 if g_debug then
4887 hr_utility.set_location(l_proc,60);
4888 end if;
4889 --
4890 --
4891 -- Check if any of the remaining per_information parameters are not
4892 -- null
4893 -- (developer descriptive flexfields not used for JP)
4894 --
4895
4896 if p_per_information3 is not null then
4897 l_info_attribute := 3;
4898 raise l_error;
4899 elsif p_per_information4 is not null then
4900 l_info_attribute := 4;
4901 raise l_error;
4902 elsif p_per_information5 is not null then
4903 l_info_attribute := 5;
4904 raise l_error;
4905 elsif p_per_information6 is not null then
4906 l_info_attribute := 6;
4907 raise l_error;
4908 elsif p_per_information7 is not null then
4909 l_info_attribute := 7;
4910 raise l_error;
4911 elsif p_per_information8 is not null then
4912 l_info_attribute := 8;
4913 raise l_error;
4914 elsif p_per_information9 is not null then
4915 l_info_attribute := 9;
4916 raise l_error;
4917 elsif p_per_information10 is not null then
4918 l_info_attribute := 10;
4919 raise l_error;
4920 elsif p_per_information11 is not null then
4921 l_info_attribute := 11;
4922 raise l_error;
4923 elsif p_per_information12 is not null then
4924 l_info_attribute := 12;
4925 raise l_error;
4926 elsif p_per_information13 is not null then
4927 l_info_attribute := 13;
4928 raise l_error;
4929 elsif p_per_information14 is not null then
4930 l_info_attribute := 14;
4931 raise l_error;
4932 elsif p_per_information15 is not null then
4933 l_info_attribute := 15;
4934 raise l_error;
4935 elsif p_per_information16 is not null then
4936 l_info_attribute := 16;
4937 raise l_error;
4938 elsif p_per_information17 is not null then
4939 l_info_attribute := 17;
4940 raise l_error;
4941 end if;
4942 if g_debug then
4943 hr_utility.set_location(' Leaving:'|| l_proc, 210);
4944 end if;
4945 exception
4946 when l_error then
4947 hr_utility.set_message(801, 'HR_7529_PER_INFO_NOT_NULL');
4948 hr_utility.set_message_token('NUM',to_char(l_info_attribute));
4949 hr_utility.raise_error;
4950 end chk_JP_per_information;
4951 --
4952 --
4953 -- -----------------------------------------------------------------------------
4954 -- |-------------------------------< chk_ddf >---------------------------------|
4955 -- -----------------------------------------------------------------------------
4956 --
4957 procedure chk_ddf
4958 (p_rec in per_per_shd.g_rec_type) is
4959 --
4960 l_proc varchar2(72);
4961 l_error exception;
4962 --
4963 Begin
4964 if g_debug then
4965 l_proc := g_package||'chk_ddf';
4966 hr_utility.set_location('Entering:'||l_proc, 5);
4967 end if;
4968 --
4969 -- Check if the row is being inserted or updated and a
4970 -- value has changed
4971 --
4972 if (p_rec.person_id is null)
4973 or ((p_rec.person_id is not null)
4974 and
4975 nvl(per_per_shd.g_old_rec.per_information_category, hr_api.g_varchar2) <>
4976 nvl(p_rec.per_information_category, hr_api.g_varchar2) or
4977 nvl(per_per_shd.g_old_rec.per_information1, hr_api.g_varchar2) <>
4978 nvl(p_rec.per_information1, hr_api.g_varchar2) or
4979 nvl(per_per_shd.g_old_rec.per_information2, hr_api.g_varchar2) <>
4980 nvl(p_rec.per_information2, hr_api.g_varchar2) or
4981 nvl(per_per_shd.g_old_rec.per_information3, hr_api.g_varchar2) <>
4982 nvl(p_rec.per_information3, hr_api.g_varchar2) or
4983 nvl(per_per_shd.g_old_rec.per_information4, hr_api.g_varchar2) <>
4984 nvl(p_rec.per_information4, hr_api.g_varchar2) or
4985 nvl(per_per_shd.g_old_rec.per_information5, hr_api.g_varchar2) <>
4986 nvl(p_rec.per_information5, hr_api.g_varchar2) or
4987 nvl(per_per_shd.g_old_rec.per_information6, hr_api.g_varchar2) <>
4988 nvl(p_rec.per_information6, hr_api.g_varchar2) or
4989 nvl(per_per_shd.g_old_rec.per_information7, hr_api.g_varchar2) <>
4990 nvl(p_rec.per_information7, hr_api.g_varchar2) or
4991 nvl(per_per_shd.g_old_rec.per_information8, hr_api.g_varchar2) <>
4992 nvl(p_rec.per_information8, hr_api.g_varchar2) or
4993 nvl(per_per_shd.g_old_rec.per_information9, hr_api.g_varchar2) <>
4994 nvl(p_rec.per_information9, hr_api.g_varchar2) or
4995 nvl(per_per_shd.g_old_rec.per_information10, hr_api.g_varchar2) <>
4996 nvl(p_rec.per_information10, hr_api.g_varchar2) or
4997 nvl(per_per_shd.g_old_rec.per_information11, hr_api.g_varchar2) <>
4998 nvl(p_rec.per_information11, hr_api.g_varchar2) or
4999 nvl(per_per_shd.g_old_rec.per_information12, hr_api.g_varchar2) <>
5000 nvl(p_rec.per_information12, hr_api.g_varchar2) or
5001 nvl(per_per_shd.g_old_rec.per_information13, hr_api.g_varchar2) <>
5002 nvl(p_rec.per_information13, hr_api.g_varchar2) or
5003 nvl(per_per_shd.g_old_rec.per_information14, hr_api.g_varchar2) <>
5004 nvl(p_rec.per_information14, hr_api.g_varchar2) or
5005 nvl(per_per_shd.g_old_rec.per_information15, hr_api.g_varchar2) <>
5006 nvl(p_rec.per_information15, hr_api.g_varchar2) or
5007 nvl(per_per_shd.g_old_rec.per_information16, hr_api.g_varchar2) <>
5008 nvl(p_rec.per_information16, hr_api.g_varchar2) or
5009 nvl(per_per_shd.g_old_rec.per_information17, hr_api.g_varchar2) <>
5010 nvl(p_rec.per_information17, hr_api.g_varchar2) or
5011 nvl(per_per_shd.g_old_rec.per_information18, hr_api.g_varchar2) <>
5012 nvl(p_rec.per_information18, hr_api.g_varchar2) or
5013 nvl(per_per_shd.g_old_rec.per_information19, hr_api.g_varchar2) <>
5014 nvl(p_rec.per_information19, hr_api.g_varchar2) or
5015 nvl(per_per_shd.g_old_rec.per_information20, hr_api.g_varchar2) <>
5016 nvl(p_rec.per_information20, hr_api.g_varchar2) or
5017 nvl(per_per_shd.g_old_rec.per_information21, hr_api.g_varchar2) <>
5018 nvl(p_rec.per_information21, hr_api.g_varchar2) or
5019 nvl(per_per_shd.g_old_rec.per_information22, hr_api.g_varchar2) <>
5020 nvl(p_rec.per_information22, hr_api.g_varchar2) or
5021 nvl(per_per_shd.g_old_rec.per_information23, hr_api.g_varchar2) <>
5022 nvl(p_rec.per_information23, hr_api.g_varchar2) or
5023 nvl(per_per_shd.g_old_rec.per_information24, hr_api.g_varchar2) <>
5024 nvl(p_rec.per_information24, hr_api.g_varchar2) or
5025 nvl(per_per_shd.g_old_rec.per_information25, hr_api.g_varchar2) <>
5026 nvl(p_rec.per_information25, hr_api.g_varchar2) or
5027 nvl(per_per_shd.g_old_rec.per_information26, hr_api.g_varchar2) <>
5028 nvl(p_rec.per_information26, hr_api.g_varchar2) or
5029 nvl(per_per_shd.g_old_rec.per_information27, hr_api.g_varchar2) <>
5030 nvl(p_rec.per_information27, hr_api.g_varchar2) or
5031 nvl(per_per_shd.g_old_rec.per_information28, hr_api.g_varchar2) <>
5032 nvl(p_rec.per_information28, hr_api.g_varchar2) or
5033 nvl(per_per_shd.g_old_rec.per_information29, hr_api.g_varchar2) <>
5034 nvl(p_rec.per_information29, hr_api.g_varchar2) or
5035 nvl(per_per_shd.g_old_rec.per_information30, hr_api.g_varchar2) <>
5036 nvl(p_rec.per_information30, hr_api.g_varchar2))
5037 then
5038 --
5039 hr_dflex_utility.ins_or_upd_descflex_attribs
5040 (p_appl_short_name => 'PER'
5041 ,p_descflex_name => 'Person Developer DF'
5042 ,p_attribute_category => p_rec.per_information_category
5043 ,p_attribute1_name => 'PER_INFORMATION1'
5044 ,p_attribute1_value => p_rec.per_information1
5045 ,p_attribute2_name => 'PER_INFORMATION2'
5046 ,p_attribute2_value => p_rec.per_information2
5047 ,p_attribute3_name => 'PER_INFORMATION3'
5048 ,p_attribute3_value => p_rec.per_information3
5049 ,p_attribute4_name => 'PER_INFORMATION4'
5050 ,p_attribute4_value => p_rec.per_information4
5051 ,p_attribute5_name => 'PER_INFORMATION5'
5052 ,p_attribute5_value => p_rec.per_information5
5053 ,p_attribute6_name => 'PER_INFORMATION6'
5054 ,p_attribute6_value => p_rec.per_information6
5055 ,p_attribute7_name => 'PER_INFORMATION7'
5056 ,p_attribute7_value => p_rec.per_information7
5057 ,p_attribute8_name => 'PER_INFORMATION8'
5058 ,p_attribute8_value => p_rec.per_information8
5059 ,p_attribute9_name => 'PER_INFORMATION9'
5060 ,p_attribute9_value => p_rec.per_information9
5061 ,p_attribute10_name => 'PER_INFORMATION10'
5062 ,p_attribute10_value => p_rec.per_information10
5063 ,p_attribute11_name => 'PER_INFORMATION11'
5064 ,p_attribute11_value => p_rec.per_information11
5065 ,p_attribute12_name => 'PER_INFORMATION12'
5066 ,p_attribute12_value => p_rec.per_information12
5067 ,p_attribute13_name => 'PER_INFORMATION13'
5068 ,p_attribute13_value => p_rec.per_information13
5069 ,p_attribute14_name => 'PER_INFORMATION14'
5070 ,p_attribute14_value => p_rec.per_information14
5071 ,p_attribute15_name => 'PER_INFORMATION15'
5072 ,p_attribute15_value => p_rec.per_information15
5073 ,p_attribute16_name => 'PER_INFORMATION16'
5074 ,p_attribute16_value => p_rec.per_information16
5075 ,p_attribute17_name => 'PER_INFORMATION17'
5076 ,p_attribute17_value => p_rec.per_information17
5077 ,p_attribute18_name => 'PER_INFORMATION18'
5078 ,p_attribute18_value => p_rec.per_information18
5079 ,p_attribute19_name => 'PER_INFORMATION19'
5080 ,p_attribute19_value => p_rec.per_information19
5081 ,p_attribute20_name => 'PER_INFORMATION20'
5082 ,p_attribute20_value => p_rec.per_information20
5083 ,p_attribute21_name => 'PER_INFORMATION21'
5084 ,p_attribute21_value => p_rec.per_information21
5085 ,p_attribute22_name => 'PER_INFORMATION22'
5086 ,p_attribute22_value => p_rec.per_information22
5087 ,p_attribute23_name => 'PER_INFORMATION23'
5088 ,p_attribute23_value => p_rec.per_information23
5089 ,p_attribute24_name => 'PER_INFORMATION24'
5090 ,p_attribute24_value => p_rec.per_information24
5091 ,p_attribute25_name => 'PER_INFORMATION25'
5092 ,p_attribute25_value => p_rec.per_information25
5093 ,p_attribute26_name => 'PER_INFORMATION26'
5094 ,p_attribute26_value => p_rec.per_information26
5095 ,p_attribute27_name => 'PER_INFORMATION27'
5096 ,p_attribute27_value => p_rec.per_information27
5097 ,p_attribute28_name => 'PER_INFORMATION28'
5098 ,p_attribute28_value => p_rec.per_information28
5099 ,p_attribute29_name => 'PER_INFORMATION29'
5100 ,p_attribute29_value => p_rec.per_information29
5101 ,p_attribute30_name => 'PER_INFORMATION30'
5102 ,p_attribute30_value => p_rec.per_information30
5103 );
5104 --
5105 end if;
5106 --
5107 if g_debug then
5108 hr_utility.set_location(' Leaving:'||l_proc, 10);
5109 end if;
5110 end chk_ddf;
5111 -- ---------------------------------------------------------------------------
5112 -- |-----------------------< chk_per_information >--------------------------|
5113 -- ---------------------------------------------------------------------------
5114 --
5115 -- Description:
5116 -- Checks that the values held in developer descriptive flexfields
5117 -- are valid
5118 --
5119 -- This routine calls separate local validation procedures to perform
5120 -- validation for each specific category. At present the suppported
5121 -- categories are 'GB', 'US' and 'JP'
5122
5123 -- Pre-conditions:
5124 -- None
5125 --
5126 -- In Arguments:
5127 -- p_person_id
5128 -- p_per_information_category
5129 -- p_per_information1
5130 -- p_per_information2
5131 -- p_per_information3
5132 -- p_per_information4
5133 -- p_per_information5
5134 -- p_per_information6
5135 -- p_per_information7
5136 -- p_per_information8
5137 -- p_per_information9
5138 -- p_per_information10
5139 -- p_per_information11
5140 -- p_per_information12
5141 -- p_per_information13
5142 -- p_per_information14
5143 -- p_per_information15
5144 -- p_per_information16
5145 -- p_per_information17
5146 -- p_per_information18
5147 -- p_per_information19
5148 -- p_per_information20
5149 -- p_per_information21
5150 -- p_per_information22
5151 -- p_per_information23
5152 -- p_per_information24
5153 -- p_per_information25
5154 -- p_per_information26
5155 -- p_per_information27
5156 -- p_per_information28
5157 -- p_per_information29
5158 -- p_per_information30
5159 -- p_effective_date
5160 -- p_object_version_number
5161 --
5162 -- Post Success:
5163 -- If the value in per_information_category value is 'GB' or 'US' then
5164 -- processing continues
5165 --
5166 -- Post Failure:
5167 -- If the value in per_information_category value is not 'GB' or 'US' then
5168 -- an application error will be raised and processing is terminated
5169 --
5170 -- Access Status:
5171 -- Internal Table Handler Use Only.
5172 --
5173 procedure chk_per_information
5174 (p_rec in out nocopy per_per_shd.g_rec_type
5175 ,p_effective_date in date
5176 ,p_validation_start_date in date
5177 ,p_validation_end_date in date) is
5178 --
5179 l_exists varchar2(1);
5180 l_error exception;
5181 l_proc varchar2(72) := g_package||'chk_per_information';
5182 l_api_updating boolean;
5183 l_lookup_type varchar2(30);
5184 l_info_attribute number(2);
5185 --
5186 begin
5187 if g_debug then
5188 hr_utility.set_location('Entering:'|| l_proc, 10);
5189 end if;
5190 --
5191 -- Check mandatory parameters have been set
5192 --
5193 hr_api.mandatory_arg_error
5194 (p_api_name => l_proc
5195 ,p_argument => 'effective date'
5196 ,p_argument_value => p_effective_date
5197 );
5198 --
5199 hr_api.mandatory_arg_error
5200 (p_api_name => l_proc
5201 ,p_argument => 'validation_start_date'
5202 ,p_argument_value => p_validation_start_date
5203 );
5204 --
5205 hr_api.mandatory_arg_error
5206 (p_api_name => l_proc
5207 ,p_argument => 'validation_end_date'
5208 ,p_argument_value => p_validation_end_date
5209 );
5210 if g_debug then
5211 hr_utility.set_location(l_proc, 20);
5212 end if;
5213 --
5214 -- Only proceed with validation if:
5215 -- a) The current g_old_rec is current and
5216 -- b) Any of the per_information (developer descriptive flex) values have
5217 -- changed
5218 -- c) A record is being inserted
5219 --
5220 l_api_updating := per_per_shd.api_updating
5221 (p_person_id => p_rec.person_id
5222 ,p_effective_date => p_effective_date
5223 ,p_object_version_number => p_rec.object_version_number
5224 );
5225 if g_debug then
5226 hr_utility.set_location(l_proc, 30);
5227 end if;
5228 --
5229 if ((l_api_updating and nvl(per_per_shd.g_old_rec.per_information_category,
5230 hr_api.g_varchar2)
5231 <> nvl(p_rec.per_information_category,hr_api.g_varchar2)) or
5232 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information1,
5233 hr_api.g_varchar2)
5234 <> nvl(p_rec.per_information1,hr_api.g_varchar2)) or
5235 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information2,
5236 hr_api.g_varchar2)
5237 <> nvl(p_rec.per_information2,hr_api.g_varchar2)) or
5238 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information3,
5239 hr_api.g_varchar2)
5240 <> nvl(p_rec.per_information3,hr_api.g_varchar2)) or
5241 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information4,
5242 hr_api.g_varchar2)
5243 <> nvl(p_rec.per_information4,hr_api.g_varchar2)) or
5244 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information5,
5245 hr_api.g_varchar2)
5246 <> nvl(p_rec.per_information5,hr_api.g_varchar2)) or
5247 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information6,
5248 hr_api.g_varchar2)
5249 <> nvl(p_rec.per_information6,hr_api.g_varchar2)) or
5250 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information7,
5251 hr_api.g_varchar2)
5252 <> nvl(p_rec.per_information7,hr_api.g_varchar2)) or
5253 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information8,
5254 hr_api.g_varchar2)
5255 <> nvl(p_rec.per_information8,hr_api.g_varchar2)) or
5256 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information9,
5257 hr_api.g_varchar2)
5258 <> nvl(p_rec.per_information9,hr_api.g_varchar2)) or
5259 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information10,
5260 hr_api.g_varchar2)
5261 <> nvl(p_rec.per_information10,hr_api.g_varchar2)) or
5262 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information11,
5263 hr_api.g_varchar2)
5264 <> nvl(p_rec.per_information11,hr_api.g_varchar2)) or
5265 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information12,
5266 hr_api.g_varchar2)
5267 <> nvl(p_rec.per_information12,hr_api.g_varchar2)) or
5268 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information13,
5269 hr_api.g_varchar2)
5270 <> nvl(p_rec.per_information13,hr_api.g_varchar2)) or
5271 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information14,
5272 hr_api.g_varchar2)
5273 <> nvl(p_rec.per_information14,hr_api.g_varchar2)) or
5274 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information15,
5275 hr_api.g_varchar2)
5276 <> nvl(p_rec.per_information15,hr_api.g_varchar2)) or
5277 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information16,
5278 hr_api.g_varchar2)
5279 <> nvl(p_rec.per_information16,hr_api.g_varchar2)) or
5280 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information17,
5281 hr_api.g_varchar2)
5282 <> nvl(p_rec.per_information17,hr_api.g_varchar2)) or
5283 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information18,
5284 hr_api.g_varchar2)
5285 <> nvl(p_rec.per_information18,hr_api.g_varchar2)) or
5286 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information19,
5287 hr_api.g_varchar2)
5288 <> nvl(p_rec.per_information19,hr_api.g_varchar2)) or
5289 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information20,
5290 hr_api.g_varchar2)
5291 <> nvl(p_rec.per_information20,hr_api.g_varchar2)) or
5292 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information21,
5293 hr_api.g_varchar2)
5294 <> nvl(p_rec.per_information21,hr_api.g_varchar2)) or
5295 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information22,
5296 hr_api.g_varchar2)
5297 <> nvl(p_rec.per_information22,hr_api.g_varchar2)) or
5298 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information23,
5299 hr_api.g_varchar2)
5300 <> nvl(p_rec.per_information23,hr_api.g_varchar2)) or
5301 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information24,
5302 hr_api.g_varchar2)
5303 <> nvl(p_rec.per_information24,hr_api.g_varchar2)) or
5304 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information25,
5305 hr_api.g_varchar2)
5306 <> nvl(p_rec.per_information25,hr_api.g_varchar2)) or
5307 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information26,
5308 hr_api.g_varchar2)
5309 <> nvl(p_rec.per_information26,hr_api.g_varchar2)) or
5310 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information27,
5311 hr_api.g_varchar2)
5312 <> nvl(p_rec.per_information27,hr_api.g_varchar2)) or
5313 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information28,
5314 hr_api.g_varchar2)
5315 <> nvl(p_rec.per_information28,hr_api.g_varchar2)) or
5316 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information29,
5317 hr_api.g_varchar2)
5318 <> nvl(p_rec.per_information29,hr_api.g_varchar2)) or
5319 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information30,
5320 hr_api.g_varchar2)
5321 <> nvl(p_rec.per_information30,hr_api.g_varchar2)) or
5322 (NOT l_api_updating))
5323 then
5324 if g_debug then
5325 hr_utility.set_location(l_proc, 40);
5326 end if;
5327 --
5328 -- Check if the per_information_category is 'GB' or 'US' calling
5329 -- the appropriate validation routine or generating an error
5330 --
5331 -- If p_rec.per_information_category is not null then
5332 If p_rec.per_information_category = 'GB' then
5333 --
5334 -- GB specific validation.
5335 --
5336 per_per_bus.chk_GB_per_information
5337 (p_person_id => p_rec.person_id
5338 ,p_per_information_category => p_rec.per_information_category
5339 ,p_per_information1 => p_rec.per_information1
5340 ,p_per_information2 => p_rec.per_information2
5341 ,p_per_information3 => p_rec.per_information3
5342 ,p_per_information4 => p_rec.per_information4
5343 ,p_per_information5 => p_rec.per_information5
5344 ,p_per_information6 => p_rec.per_information6
5345 ,p_per_information7 => p_rec.per_information7
5346 ,p_per_information8 => p_rec.per_information8
5347 ,p_per_information9 => p_rec.per_information9
5348 ,p_per_information10 => p_rec.per_information10
5349 ,p_per_information11 => p_rec.per_information11
5350 ,p_per_information12 => p_rec.per_information12
5351 ,p_per_information13 => p_rec.per_information13
5352 ,p_per_information14 => p_rec.per_information14
5353 ,p_per_information15 => p_rec.per_information15
5354 ,p_per_information16 => p_rec.per_information16
5355 ,p_per_information17 => p_rec.per_information17
5356 ,p_per_information18 => p_rec.per_information18
5357 ,p_per_information19 => p_rec.per_information19
5358 ,p_per_information20 => p_rec.per_information20
5359 ,p_per_information21 => p_rec.per_information21
5360 ,p_per_information22 => p_rec.per_information22
5361 ,p_per_information23 => p_rec.per_information23
5362 ,p_per_information24 => p_rec.per_information24
5363 ,p_per_information25 => p_rec.per_information25
5364 ,p_per_information26 => p_rec.per_information26
5365 ,p_per_information27 => p_rec.per_information27
5366 ,p_per_information28 => p_rec.per_information28
5367 ,p_per_information29 => p_rec.per_information29
5368 ,p_per_information30 => p_rec.per_information30
5369 ,p_validation_start_date => p_validation_start_date
5370 ,p_validation_end_date => p_validation_end_date
5371 ,p_effective_date => p_effective_date
5372 ,p_object_version_number => p_rec.object_version_number
5373 );
5374 if g_debug then
5375 hr_utility.set_location(l_proc, 50);
5376 end if;
5377 --
5378 elsif p_rec.per_information_category = 'US' then
5379 --
5380 -- US specific validation.
5381 --
5382 per_per_bus.chk_US_per_information
5383 (p_person_id => p_rec.person_id
5384 ,p_per_information_category => p_rec.per_information_category
5385 ,p_per_information1 => p_rec.per_information1
5386 ,p_per_information2 => p_rec.per_information2
5387 ,p_per_information3 => p_rec.per_information3
5388 ,p_per_information4 => p_rec.per_information4
5389 ,p_per_information5 => p_rec.per_information5
5390 ,p_per_information6 => p_rec.per_information6
5391 ,p_per_information7 => p_rec.per_information7
5392 ,p_per_information8 => p_rec.per_information8
5393 ,p_per_information9 => p_rec.per_information9
5394 ,p_per_information10 => p_rec.per_information10
5395 ,p_per_information11 => p_rec.per_information11
5396 ,p_per_information12 => p_rec.per_information12
5397 ,p_per_information13 => p_rec.per_information13
5398 ,p_per_information14 => p_rec.per_information14
5399 ,p_per_information15 => p_rec.per_information15
5400 ,p_per_information16 => p_rec.per_information16
5401 ,p_per_information17 => p_rec.per_information17
5402 ,p_per_information18 => p_rec.per_information18
5403 ,p_per_information19 => p_rec.per_information19
5404 ,p_per_information20 => p_rec.per_information20
5405 ,p_per_information21 => p_rec.per_information21
5406 ,p_per_information22 => p_rec.per_information22
5407 ,p_per_information23 => p_rec.per_information23
5408 ,p_per_information24 => p_rec.per_information24
5409 ,p_per_information25 => p_rec.per_information25
5410 ,p_per_information26 => p_rec.per_information26
5411 ,p_per_information27 => p_rec.per_information27
5412 ,p_per_information28 => p_rec.per_information28
5413 ,p_per_information29 => p_rec.per_information29
5414 ,p_per_information30 => p_rec.per_information30
5415 ,p_effective_date => p_effective_date
5416 ,p_validation_start_date => p_validation_start_date
5417 ,p_validation_end_date => p_validation_end_date
5418 ,p_object_version_number => p_rec.object_version_number
5419 ,p_api_updating => l_api_updating
5420 );
5421 if g_debug then
5422 hr_utility.set_location(l_proc, 60);
5423 end if;
5424 --
5425 /* elsif p_rec.per_information_category = 'JP' then
5426 --
5427 -- JP specific validation
5428 --
5429 per_per_bus.chk_JP_per_information
5430 (p_person_id => p_rec.person_id
5431 ,p_per_information_category => p_rec.per_information_category
5432 ,p_per_information1 => p_rec.per_information1
5433 ,p_per_information2 => p_rec.per_information2
5434 ,p_per_information3 => p_rec.per_information3
5435 ,p_per_information4 => p_rec.per_information4
5436 ,p_per_information5 => p_rec.per_information5
5437 ,p_per_information6 => p_rec.per_information6
5438 ,p_per_information7 => p_rec.per_information7
5439 ,p_per_information8 => p_rec.per_information8
5440 ,p_per_information9 => p_rec.per_information9
5441 ,p_per_information10 => p_rec.per_information10
5442 ,p_per_information11 => p_rec.per_information11
5443 ,p_per_information12 => p_rec.per_information12
5444 ,p_per_information13 => p_rec.per_information13
5445 ,p_per_information14 => p_rec.per_information14
5446 ,p_per_information15 => p_rec.per_information15
5447 ,p_per_information16 => p_rec.per_information16
5448 ,p_per_information17 => p_rec.per_information17
5449 ,p_per_information18 => p_rec.per_information18
5450 ,p_per_information19 => p_rec.per_information19
5451 ,p_per_information20 => p_rec.per_information20
5452 ,p_per_information21 => p_rec.per_information21
5453 ,p_per_information22 => p_rec.per_information22
5454 ,p_per_information23 => p_rec.per_information23
5455 ,p_per_information24 => p_rec.per_information24
5456 ,p_per_information25 => p_rec.per_information25
5457 ,p_per_information26 => p_rec.per_information26
5458 ,p_per_information27 => p_rec.per_information27
5459 ,p_per_information28 => p_rec.per_information28
5460 ,p_per_information29 => p_rec.per_information29
5461 ,p_per_information30 => p_rec.per_information30
5462 ,p_validation_start_date => p_validation_start_date
5463 ,p_validation_end_date => p_validation_end_date
5464 ,p_effective_date => p_effective_date
5465 ,p_object_version_number => p_rec.object_version_number
5466 );
5467 if g_debug then
5468 hr_utility.set_location(l_proc, 70);
5469 end if;
5470 -- */
5471 else
5472 per_per_bus.chk_ddf(p_rec => p_rec);
5473 end if;
5474 -- end if;
5475 end if;
5476 if g_debug then
5477 hr_utility.set_location(' Leaving:'|| l_proc, 100);
5478 end if;
5479 exception
5480 when l_error then
5481 -- Error: Do not enter PER_INFORMATION99 for this legislation
5482 hr_utility.set_message(801, 'HR_7529_PER_INFO_NOT_NULL');
5483 hr_utility.set_message_token('NUM',to_char(l_info_attribute));
5484 hr_multi_message.add;
5485 -- hr_utility.raise_error;
5486 end chk_per_information;
5487 --
5488 /* Bug#3613987 - Removed chk_JP_names procedure
5489 -- ---------------------------------------------------------------------------
5490 -- |------------------------< chk_JP_names >--------------------------|
5491 -- ---------------------------------------------------------------------------
5492 --
5493 -- Description:
5494 -- Checks that a name values are kana
5495 --
5496 -- Pre-conditions:
5497 -- None
5498 --
5499 -- In Arguments:
5500 -- p_person_id
5501 -- p_effective_date
5502 -- p_object_version_number
5503 -- p_first_name
5504 -- p_last_name
5505 -- p_per_information18
5506 -- p_per_information19
5507 --
5508 -- Out Arguments
5509 -- p_full_name
5510 --
5511 -- Post Success:
5512 -- If a name contains only single byte characters then process continues.
5513 -- It returns value to p_full_name calling return_JP_fullname
5514 --
5515 -- Post Failure:
5516 -- If a name contains any double byte characters then process is terminated.
5517 --
5518 -- Access Status:
5519 -- Internal Table Handler Use Only.
5520 --
5521 procedure chk_JP_names
5522 (p_person_id in per_all_people_f.person_id%TYPE
5523 ,p_effective_date in date
5524 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
5525 ,p_first_name in per_all_people_f.first_name%TYPE
5526 ,p_last_name in per_all_people_f.last_name%TYPE
5527 ,p_per_information18 in per_all_people_f.per_information18%TYPE
5528 ,p_per_information19 in per_all_people_f.per_information19%TYPE) is
5529 --,p_full_name out nocopy per_all_people_f.full_name%TYPE) is -- bug# 2689366
5530 --
5531 l_last_name per_all_people_f.last_name%TYPE;
5532 l_first_name per_all_people_f.first_name%TYPE;
5533 l_proc varchar2(72) ;
5534 l_api_updating boolean;
5535 l_output varchar2(150);
5536 l_rgeflg varchar2(10);
5537 --
5538 begin
5539 if g_debug then
5540 l_proc := g_package||'chk_JP_names';
5541 hr_utility.set_location('Entering:'|| l_proc, 1);
5542 end if;
5543 --
5544 if hr_multi_message.no_exclusive_error
5545 (p_check_column1 => 'PER_ALL_PEOPLE_F.LAST_NAME'
5546 )
5547 then
5548 l_api_updating := per_per_shd.api_updating
5549 (p_person_id => p_person_id
5550 ,p_effective_date => p_effective_date
5551 ,p_object_version_number => p_object_version_number);
5552 --
5553 -- Only proceed with validation if:
5554 -- a) The current g_old_rec is current and
5555 -- b) The start date value has changed
5556 -- c) a record is being inserted
5557 --
5558 --
5559 if g_debug then
5560 hr_utility.set_location(l_proc, 2);
5561 end if;
5562 --
5563 if ((l_api_updating
5564 and nvl(per_per_shd.g_old_rec.last_name, hr_api.g_varchar2)
5565 <> nvl(p_last_name,hr_api.g_varchar2))
5566 or
5567 (NOT l_api_updating)) then
5568 --
5569 -- Perform Insert/Update checks
5570 --
5571 l_last_name := p_last_name;
5572 hr_chkfmt.checkformat(value => l_last_name
5573 ,format => 'KANA'
5574 ,output => l_output
5575 ,minimum => NULL
5576 ,maximum => NULL
5577 ,nullok => 'N'
5578 ,rgeflg => l_rgeflg
5579 ,curcode => NULL);
5580 end if;
5581 --
5582 if g_debug then
5583 hr_utility.set_location(l_proc, 3);
5584 end if;
5585 --
5586 if ((l_api_updating
5587 and nvl(per_per_shd.g_old_rec.first_name, hr_api.g_varchar2)
5588 <> nvl(p_first_name,hr_api.g_varchar2))
5589 or
5590 (NOT l_api_updating)) then
5591 --
5592 -- Perform Insert/Update checks
5593 --
5594 l_first_name := p_first_name;
5595 hr_chkfmt.checkformat(value => l_first_name
5596 ,format => 'KANA'
5597 ,output => l_output
5598 ,minimum => NULL
5599 ,maximum => NULL
5600 ,nullok => 'Y'
5601 ,rgeflg => l_rgeflg
5602 ,curcode => NULL);
5603 end if;
5604 end if;
5605 --
5606 if g_debug then
5607 hr_utility.set_location(' Leaving:'|| l_proc, 5);
5608 end if;
5609 exception
5610 when app_exception.application_exception then
5611 if hr_multi_message.exception_add
5612 (p_associated_column1 => 'PER_ALL_PEOPLE_F.LAST_NAME'
5613 ,p_associated_column2 => 'PER_ALL_PEOPLE_F.FIRST_NAME'
5614 ) then
5615 if g_debug then
5616 hr_utility.set_location(' Leaving:'||l_proc, 6);
5617 end if;
5618 raise;
5619 end if;
5620 if g_debug then
5621 hr_utility.set_location(' Leaving:'||l_proc,7);
5622 end if;
5623 end chk_JP_names;
5624 */
5625 --
5626 -- ---------------------------------------------------------------------------
5627 -- |-----------------------< return_full_name >----------------------------|
5628 -- ---------------------------------------------------------------------------
5629 --
5630 -- Description:
5631 -- Calls process hr_person.derive_full_name which constructs the full name
5632 --
5633 -- Pre-conditions:
5634 -- The value of p_title and p_date_of_birth must be valid
5635 --
5636 -- In Arguments:
5637 -- p_person_id
5638 -- p_business_group_id
5639 -- p_first_name
5640 -- p_middle_names
5641 -- p_last_name
5642 -- p_known_as
5643 -- p_title
5644 -- p_date_of_birth
5645 -- p_full_name
5646 -- p_suffix
5647 -- p_effective_date
5648 -- p_object_version_number
5649 -- p_pre_name_adjunct
5650 --
5651 -- Out Arguments
5652 -- p_full_name
5653 -- p_name_combination_warning
5654 --
5655 -- Post Success:
5656 -- The full name is set to the concatenated string and processing continues
5657 --
5658 -- If the combination of full name and date of birth already exists then
5659 -- a warning is flagged and processing continues
5660 --
5661 -- Post Failure:
5662 -- None
5663 --
5664 -- Access Status:
5665 -- Internal Table Handler Use Only.
5666 --
5667 -- For bug # 486308, added p_suffix.
5668 --
5669 -- For bug # 2689366, added p_per_information18 and p_per_information19
5670 --
5671 procedure return_full_name
5672 (p_person_id in per_all_people_f.person_id%TYPE
5673 ,p_business_group_id in per_all_people_f.business_group_id%type
5674 ,p_first_name in per_all_people_f.first_name%TYPE
5675 ,p_middle_names in per_all_people_f.middle_names%TYPE
5676 ,p_last_name in per_all_people_f.last_name%TYPE
5677 ,p_known_as in per_all_people_f.known_as%TYPE
5678 ,p_title in per_all_people_f.title%TYPE
5679 ,p_date_of_birth in per_all_people_f.date_of_birth%TYPE
5680 ,p_suffix in per_all_people_f.suffix%TYPE
5681 ,p_pre_name_adjunct in per_all_people_f.pre_name_adjunct%TYPE
5682 ,p_effective_date in date
5683 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
5684 ,p_previous_last_name per_all_people_f.previous_last_name%TYPE DEFAULT NULL
5685 ,p_email_address per_all_people_f.email_address%TYPE DEFAULT NULL
5686 ,p_employee_number per_all_people_f.employee_number%TYPE DEFAULT NULL
5687 ,p_applicant_number per_all_people_f.applicant_number%TYPE DEFAULT NULL
5688 ,p_npw_number per_all_people_f.npw_number%TYPE DEFAULT NULL
5689 ,p_per_information1 per_all_people_f.per_information1%TYPE DEFAULT NULL
5690 ,p_per_information2 per_all_people_f.per_information2%TYPE DEFAULT NULL
5691 ,p_per_information3 per_all_people_f.per_information3%TYPE DEFAULT NULL
5692 ,p_per_information4 per_all_people_f.per_information4%TYPE DEFAULT NULL
5693 ,p_per_information5 per_all_people_f.per_information5%TYPE DEFAULT NULL
5694 ,p_per_information6 per_all_people_f.per_information6%TYPE DEFAULT NULL
5695 ,p_per_information7 per_all_people_f.per_information7%TYPE DEFAULT NULL
5696 ,p_per_information8 per_all_people_f.per_information8%TYPE DEFAULT NULL
5697 ,p_per_information9 per_all_people_f.per_information9%TYPE DEFAULT NULL
5698 ,p_per_information10 per_all_people_f.per_information10%TYPE DEFAULT NULL
5699 ,p_per_information11 per_all_people_f.per_information11%TYPE DEFAULT NULL
5700 ,p_per_information12 per_all_people_f.per_information12%TYPE DEFAULT NULL
5701 ,p_per_information13 per_all_people_f.per_information13%TYPE DEFAULT NULL
5702 ,p_per_information14 per_all_people_f.per_information14%TYPE DEFAULT NULL
5703 ,p_per_information15 per_all_people_f.per_information15%TYPE DEFAULT NULL
5704 ,p_per_information16 per_all_people_f.per_information16%TYPE DEFAULT NULL
5705 ,p_per_information17 per_all_people_f.per_information17%TYPE DEFAULT NULL
5706 ,p_per_information18 per_all_people_f.per_information18%TYPE DEFAULT NULL
5707 ,p_per_information19 per_all_people_f.per_information19%TYPE DEFAULT NULL
5708 ,p_per_information20 per_all_people_f.per_information20%TYPE DEFAULT NULL
5709 ,p_per_information21 per_all_people_f.per_information21%TYPE DEFAULT NULL
5710 ,p_per_information22 per_all_people_f.per_information22%TYPE DEFAULT NULL
5711 ,p_per_information23 per_all_people_f.per_information23%TYPE DEFAULT NULL
5712 ,p_per_information24 per_all_people_f.per_information24%TYPE DEFAULT NULL
5713 ,p_per_information25 per_all_people_f.per_information25%TYPE DEFAULT NULL
5714 ,p_per_information26 per_all_people_f.per_information26%TYPE DEFAULT NULL
5715 ,p_per_information27 per_all_people_f.per_information27%TYPE DEFAULT NULL
5716 ,p_per_information28 per_all_people_f.per_information28%TYPE DEFAULT NULL
5717 ,p_per_information29 per_all_people_f.per_information29%TYPE DEFAULT NULL
5718 ,p_per_information30 per_all_people_f.per_information30%TYPE DEFAULT NULL
5719 ,p_attribute1 per_all_people_f.attribute1%TYPE DEFAULT NULL
5720 ,p_attribute2 per_all_people_f.attribute2%TYPE DEFAULT NULL
5721 ,p_attribute3 per_all_people_f.attribute3%TYPE DEFAULT NULL
5722 ,p_attribute4 per_all_people_f.attribute4%TYPE DEFAULT NULL
5723 ,p_attribute5 per_all_people_f.attribute5%TYPE DEFAULT NULL
5724 ,p_attribute6 per_all_people_f.attribute6%TYPE DEFAULT NULL
5725 ,p_attribute7 per_all_people_f.attribute7%TYPE DEFAULT NULL
5726 ,p_attribute8 per_all_people_f.attribute8%TYPE DEFAULT NULL
5727 ,p_attribute9 per_all_people_f.attribute9%TYPE DEFAULT NULL
5728 ,p_attribute10 per_all_people_f.attribute10%TYPE DEFAULT NULL
5729 ,p_attribute11 per_all_people_f.attribute11%TYPE DEFAULT NULL
5730 ,p_attribute12 per_all_people_f.attribute12%TYPE DEFAULT NULL
5731 ,p_attribute13 per_all_people_f.attribute13%TYPE DEFAULT NULL
5732 ,p_attribute14 per_all_people_f.attribute14%TYPE DEFAULT NULL
5733 ,p_attribute15 per_all_people_f.attribute15%TYPE DEFAULT NULL
5734 ,p_attribute16 per_all_people_f.attribute16%TYPE DEFAULT NULL
5735 ,p_attribute17 per_all_people_f.attribute17%TYPE DEFAULT NULL
5736 ,p_attribute18 per_all_people_f.attribute18%TYPE DEFAULT NULL
5737 ,p_attribute19 per_all_people_f.attribute19%TYPE DEFAULT NULL
5738 ,p_attribute20 per_all_people_f.attribute20%TYPE DEFAULT NULL
5739 ,p_attribute21 per_all_people_f.attribute21%TYPE DEFAULT NULL
5740 ,p_attribute22 per_all_people_f.attribute22%TYPE DEFAULT NULL
5741 ,p_attribute23 per_all_people_f.attribute23%TYPE DEFAULT NULL
5742 ,p_attribute24 per_all_people_f.attribute24%TYPE DEFAULT NULL
5743 ,p_attribute25 per_all_people_f.attribute25%TYPE DEFAULT NULL
5744 ,p_attribute26 per_all_people_f.attribute26%TYPE DEFAULT NULL
5745 ,p_attribute27 per_all_people_f.attribute27%TYPE DEFAULT NULL
5746 ,p_attribute28 per_all_people_f.attribute28%TYPE DEFAULT NULL
5747 ,p_attribute29 per_all_people_f.attribute29%TYPE DEFAULT NULL
5748 ,p_attribute30 per_all_people_f.attribute30%TYPE DEFAULT NULL
5749 ,p_full_name OUT NOCOPY per_all_people_f.full_name%TYPE
5750 ,p_order_name OUT NOCOPY per_all_people_f.order_name%TYPE
5751 ,p_global_name OUT NOCOPY per_all_people_f.global_name%TYPE
5752 ,p_local_name OUT NOCOPY per_all_people_f.local_name%TYPE
5753 ,p_duplicate_flag OUT NOCOPY VARCHAR2
5754 ,p_name_combination_warning out nocopy boolean) is
5755 --
5756 l_exists varchar2(1);
5757 l_proc varchar2(72) := g_package||'return_full_name';
5758 l_api_updating boolean;
5759 l_duplicate_flag varchar2(1);
5760 l_full_name varchar2(240);
5761 l_order_name varchar2(240);
5762 l_global_name varchar2(240);
5763 l_local_name varchar2(240);
5764 --
5765 begin
5766 if g_debug then
5767 hr_utility.set_location('Entering:'|| l_proc, 10);
5768 end if;
5769 --
5770 -- Check mandatory parameters have been set
5771 --
5772 hr_api.mandatory_arg_error
5773 (p_api_name => l_proc
5774 ,p_argument => 'business group id'
5775 ,p_argument_value => p_business_group_id
5776 );
5777 --
5778 hr_api.mandatory_arg_error
5779 (p_api_name => l_proc
5780 ,p_argument => 'effective date'
5781 ,p_argument_value => p_effective_date
5782 );
5783 --
5784 -- Check if the last name is set.
5785 --
5786 if p_last_name is null then
5787 --
5788 hr_utility.set_message(801, 'PER_52076_PER_NULL_LAST_NAME');
5789 hr_utility.raise_error;
5790 --
5791 end if;
5792 --
5793 if hr_multi_message.no_all_inclusive_error
5794 (p_check_column1 => 'PER_ALL_PEOPLE_F.TITLE'
5795 ,p_check_column2 => 'PER_ALL_PEOPLE_F.DATE_OF_BIRTH'
5796 )
5797 then
5798 p_name_combination_warning := false;
5799 --
5800 -- Only proceed with validation if:
5801 -- a) The current g_old_rec is current and
5802 -- b) last name has changed
5803 -- c) title has changed
5804 -- d) first name has changed
5805 -- d) middle names have changed
5806 -- e) known as values has changed
5807 -- f) date of birth has changed
5808 -- g) A record is being inserted
5809 --
5810 l_api_updating := per_per_shd.api_updating
5811 (p_person_id => p_person_id
5812 ,p_effective_date => p_effective_date
5813 ,p_object_version_number => p_object_version_number);
5814 --
5815 if ((l_api_updating and nvl(per_per_shd.g_old_rec.last_name,
5816 hr_api.g_varchar2)
5817 <> nvl(p_last_name,hr_api.g_varchar2)) or
5818 (l_api_updating and nvl(per_per_shd.g_old_rec.title,
5819 hr_api.g_varchar2)
5820 <> nvl(p_title,hr_api.g_varchar2)) or
5821 (l_api_updating and nvl(per_per_shd.g_old_rec.first_name,
5822 hr_api.g_varchar2)
5823 <> nvl(p_first_name,hr_api.g_varchar2)) or
5824 (l_api_updating and nvl(per_per_shd.g_old_rec.middle_names,
5825 hr_api.g_varchar2)
5826 <> nvl(p_middle_names,hr_api.g_varchar2)) or
5827 (l_api_updating and nvl(per_per_shd.g_old_rec.suffix,
5828 hr_api.g_varchar2)
5829 <> nvl(p_suffix,hr_api.g_varchar2)) or
5830 (l_api_updating and nvl(per_per_shd.g_old_rec.known_as,
5831 hr_api.g_varchar2)
5832 <> nvl(p_known_as,hr_api.g_varchar2)) or
5833 (l_api_updating and nvl(per_per_shd.g_old_rec.date_of_birth,
5834 hr_api.g_date)
5835 <> nvl(p_date_of_birth,hr_api.g_date)) or
5836 (l_api_updating and nvl(per_per_shd.g_old_rec.pre_name_adjunct,
5837 hr_api.g_varchar2)
5838 <> nvl(p_pre_name_adjunct,hr_api.g_varchar2)) or
5839 (l_api_updating and nvl(per_per_shd.g_old_rec.employee_number,
5840 hr_api.g_varchar2)
5841 <> nvl(p_employee_number,hr_api.g_varchar2)) or
5842 (l_api_updating and nvl(per_per_shd.g_old_rec.applicant_number,
5843 hr_api.g_varchar2)
5844 <> nvl(p_applicant_number,hr_api.g_varchar2)) or
5845 (l_api_updating and nvl(per_per_shd.g_old_rec.npw_number,
5846 hr_api.g_varchar2)
5847 <> nvl(p_npw_number,hr_api.g_varchar2)) or
5848 (l_api_updating and nvl(per_per_shd.g_old_rec.email_address,
5849 hr_api.g_varchar2)
5850 <> nvl(p_email_address,hr_api.g_varchar2)) or
5851 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information1,
5852 hr_api.g_varchar2)
5853 <> nvl(p_per_information1,hr_api.g_varchar2)) or
5854 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information2,
5855 hr_api.g_varchar2)
5856 <> nvl(p_per_information2,hr_api.g_varchar2)) or
5857 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information3,
5858 hr_api.g_varchar2)
5859 <> nvl(p_per_information3,hr_api.g_varchar2)) or
5860 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information4,
5861 hr_api.g_varchar2)
5862 <> nvl(p_per_information4,hr_api.g_varchar2)) or
5863 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information5,
5864 hr_api.g_varchar2)
5865 <> nvl(p_per_information5,hr_api.g_varchar2)) or
5866 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information6,
5867 hr_api.g_varchar2)
5868 <> nvl(p_per_information6,hr_api.g_varchar2)) or
5869 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information7,
5870 hr_api.g_varchar2)
5871 <> nvl(p_per_information7,hr_api.g_varchar2)) or
5872 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information8,
5873 hr_api.g_varchar2)
5874 <> nvl(p_per_information8,hr_api.g_varchar2)) or
5875 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information9,
5876 hr_api.g_varchar2)
5877 <> nvl(p_per_information9,hr_api.g_varchar2)) or
5878 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information10,
5879 hr_api.g_varchar2)
5880 <> nvl(p_per_information10,hr_api.g_varchar2)) or
5881 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information11,
5882 hr_api.g_varchar2)
5883 <> nvl(p_per_information11,hr_api.g_varchar2)) or
5884 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information12,
5885 hr_api.g_varchar2)
5886 <> nvl(p_per_information12,hr_api.g_varchar2)) or
5887 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information13,
5888 hr_api.g_varchar2)
5889 <> nvl(p_per_information13,hr_api.g_varchar2)) or
5890 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information14,
5891 hr_api.g_varchar2)
5892 <> nvl(p_per_information14,hr_api.g_varchar2)) or
5893 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information15,
5894 hr_api.g_varchar2)
5895 <> nvl(p_per_information15,hr_api.g_varchar2)) or
5896 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information16,
5897 hr_api.g_varchar2)
5898 <> nvl(p_per_information16,hr_api.g_varchar2)) or
5899 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information17,
5900 hr_api.g_varchar2)
5901 <> nvl(p_per_information17,hr_api.g_varchar2)) or
5902 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information18,
5903 hr_api.g_varchar2)
5904 <> nvl(p_per_information18,hr_api.g_varchar2)) or
5905 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information19,
5906 hr_api.g_varchar2)
5907 <> nvl(p_per_information19,hr_api.g_varchar2)) or
5908 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information20,
5909 hr_api.g_varchar2)
5910 <> nvl(p_per_information20,hr_api.g_varchar2)) or
5911 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information21,
5912 hr_api.g_varchar2)
5913 <> nvl(p_per_information21,hr_api.g_varchar2)) or
5914 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information22,
5915 hr_api.g_varchar2)
5916 <> nvl(p_per_information22,hr_api.g_varchar2)) or
5917 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information23,
5918 hr_api.g_varchar2)
5919 <> nvl(p_per_information23,hr_api.g_varchar2)) or
5920 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information24,
5921 hr_api.g_varchar2)
5922 <> nvl(p_per_information24,hr_api.g_varchar2)) or
5923 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information25,
5924 hr_api.g_varchar2)
5925 <> nvl(p_per_information25,hr_api.g_varchar2)) or
5926 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information26,
5927 hr_api.g_varchar2)
5928 <> nvl(p_per_information26,hr_api.g_varchar2)) or
5929 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information27,
5930 hr_api.g_varchar2)
5931 <> nvl(p_per_information27,hr_api.g_varchar2)) or
5932 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information28,
5933 hr_api.g_varchar2)
5934 <> nvl(p_per_information28,hr_api.g_varchar2)) or
5935 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information29,
5936 hr_api.g_varchar2)
5937 <> nvl(p_per_information29,hr_api.g_varchar2)) or
5938 (l_api_updating and nvl(per_per_shd.g_old_rec.per_information30,
5939 hr_api.g_varchar2)
5940 <> nvl(p_per_information30,hr_api.g_varchar2)) or
5941 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute1,
5942 hr_api.g_varchar2)
5943 <> nvl(p_attribute1,hr_api.g_varchar2)) or
5944 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute2,
5945 hr_api.g_varchar2)
5946 <> nvl(p_attribute2,hr_api.g_varchar2)) or
5947 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute3,
5948 hr_api.g_varchar2)
5949 <> nvl(p_attribute3,hr_api.g_varchar2)) or
5950 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute4,
5951 hr_api.g_varchar2)
5952 <> nvl(p_attribute4,hr_api.g_varchar2)) or
5953 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute5,
5954 hr_api.g_varchar2)
5955 <> nvl(p_attribute5,hr_api.g_varchar2)) or
5956 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute6,
5957 hr_api.g_varchar2)
5958 <> nvl(p_attribute6,hr_api.g_varchar2)) or
5959 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute7,
5960 hr_api.g_varchar2)
5961 <> nvl(p_attribute7,hr_api.g_varchar2)) or
5962 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute8,
5963 hr_api.g_varchar2)
5964 <> nvl(p_attribute8,hr_api.g_varchar2)) or
5965 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute9,
5966 hr_api.g_varchar2)
5967 <> nvl(p_attribute9,hr_api.g_varchar2)) or
5968 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute10,
5969 hr_api.g_varchar2)
5970 <> nvl(p_attribute10,hr_api.g_varchar2)) or
5971 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute11,
5972 hr_api.g_varchar2)
5973 <> nvl(p_attribute11,hr_api.g_varchar2)) or
5974 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute12,
5975 hr_api.g_varchar2)
5976 <> nvl(p_attribute12,hr_api.g_varchar2)) or
5977 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute13,
5978 hr_api.g_varchar2)
5979 <> nvl(p_attribute13,hr_api.g_varchar2)) or
5980 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute14,
5981 hr_api.g_varchar2)
5982 <> nvl(p_attribute14,hr_api.g_varchar2)) or
5983 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute15,
5984 hr_api.g_varchar2)
5985 <> nvl(p_attribute15,hr_api.g_varchar2)) or
5986 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute16,
5987 hr_api.g_varchar2)
5988 <> nvl(p_attribute16,hr_api.g_varchar2)) or
5989 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute17,
5990 hr_api.g_varchar2)
5991 <> nvl(p_attribute17,hr_api.g_varchar2)) or
5992 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute18,
5993 hr_api.g_varchar2)
5994 <> nvl(p_attribute18,hr_api.g_varchar2)) or
5995 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute19,
5996 hr_api.g_varchar2)
5997 <> nvl(p_attribute19,hr_api.g_varchar2)) or
5998 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute20,
5999 hr_api.g_varchar2)
6000 <> nvl(p_attribute20,hr_api.g_varchar2)) or
6001 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute21,
6002 hr_api.g_varchar2)
6003 <> nvl(p_attribute21,hr_api.g_varchar2)) or
6004 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute22,
6005 hr_api.g_varchar2)
6006 <> nvl(p_attribute22,hr_api.g_varchar2)) or
6007 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute23,
6008 hr_api.g_varchar2)
6009 <> nvl(p_attribute23,hr_api.g_varchar2)) or
6010 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute24,
6011 hr_api.g_varchar2)
6012 <> nvl(p_attribute24,hr_api.g_varchar2)) or
6013 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute25,
6014 hr_api.g_varchar2)
6015 <> nvl(p_attribute25,hr_api.g_varchar2)) or
6016 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute26,
6017 hr_api.g_varchar2)
6018 <> nvl(p_attribute26,hr_api.g_varchar2)) or
6019 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute27,
6020 hr_api.g_varchar2)
6021 <> nvl(p_attribute27,hr_api.g_varchar2)) or
6022 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute28,
6023 hr_api.g_varchar2)
6024 <> nvl(p_attribute28,hr_api.g_varchar2)) or
6025 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute29,
6026 hr_api.g_varchar2)
6027 <> nvl(p_attribute29,hr_api.g_varchar2)) or
6028 (l_api_updating and nvl(per_per_shd.g_old_rec.attribute30,
6029 hr_api.g_varchar2)
6030 <> nvl(p_attribute30,hr_api.g_varchar2)) or
6031 (NOT l_api_updating)) then
6032 --
6033 if g_debug then
6034 hr_utility.set_location(l_proc, 20);
6035 end if;
6036 --
6037 l_duplicate_flag := 'N';
6038 --
6039 -- Call process to contruct full name
6040 --
6041 hr_person_name.derive_person_names
6042 (p_format_name => NULL, -- derice all names
6043 p_business_group_id => p_business_group_id,
6044 p_person_id => p_person_id,
6045 p_first_name => p_first_name,
6046 p_middle_names => p_middle_names,
6047 p_last_name => p_last_name,
6048 p_known_as => p_known_as,
6049 p_title => p_title,
6050 p_suffix => p_suffix,
6051 p_pre_name_adjunct => p_pre_name_adjunct,
6052 p_date_of_birth => p_date_of_birth,
6053 p_previous_last_name => p_previous_last_name ,
6054 p_email_address => p_email_address ,
6055 p_employee_number => p_employee_number ,
6056 p_applicant_number => p_applicant_number ,
6057 p_npw_number => p_npw_number ,
6058 p_per_information1 => p_per_information1 ,
6059 p_per_information2 => p_per_information2 ,
6060 p_per_information3 => p_per_information3 ,
6061 p_per_information4 => p_per_information4 ,
6062 p_per_information5 => p_per_information5 ,
6063 p_per_information6 => p_per_information6 ,
6064 p_per_information7 => p_per_information7 ,
6065 p_per_information8 => p_per_information8 ,
6066 p_per_information9 => p_per_information9 ,
6067 p_per_information10 => p_per_information10 ,
6068 p_per_information11 => p_per_information11 ,
6069 p_per_information12 => p_per_information12 ,
6070 p_per_information13 => p_per_information13 ,
6071 p_per_information14 => p_per_information14 ,
6072 p_per_information15 => p_per_information15 ,
6073 p_per_information16 => p_per_information16 ,
6074 p_per_information17 => p_per_information17 ,
6075 p_per_information18 => p_per_information18 ,
6076 p_per_information19 => p_per_information19 ,
6077 p_per_information20 => p_per_information20 ,
6078 p_per_information21 => p_per_information21 ,
6079 p_per_information22 => p_per_information22 ,
6080 p_per_information23 => p_per_information23 ,
6081 p_per_information24 => p_per_information24 ,
6082 p_per_information25 => p_per_information25 ,
6083 p_per_information26 => p_per_information26 ,
6084 p_per_information27 => p_per_information27 ,
6085 p_per_information28 => p_per_information28 ,
6086 p_per_information29 => p_per_information29 ,
6087 p_per_information30 => p_per_information30 ,
6088 p_attribute1 => p_attribute1 ,
6089 p_attribute2 => p_attribute2 ,
6090 p_attribute3 => p_attribute3 ,
6091 p_attribute4 => p_attribute4 ,
6092 p_attribute5 => p_attribute5 ,
6093 p_attribute6 => p_attribute6 ,
6094 p_attribute7 => p_attribute7 ,
6095 p_attribute8 => p_attribute8 ,
6096 p_attribute9 => p_attribute9 ,
6097 p_attribute10 => p_attribute10 ,
6098 p_attribute11 => p_attribute11 ,
6099 p_attribute12 => p_attribute12 ,
6100 p_attribute13 => p_attribute13 ,
6101 p_attribute14 => p_attribute14 ,
6102 p_attribute15 => p_attribute15 ,
6103 p_attribute16 => p_attribute16 ,
6104 p_attribute17 => p_attribute17 ,
6105 p_attribute18 => p_attribute18 ,
6106 p_attribute19 => p_attribute19 ,
6107 p_attribute20 => p_attribute20 ,
6108 p_attribute21 => p_attribute21 ,
6109 p_attribute22 => p_attribute22 ,
6110 p_attribute23 => p_attribute23,
6111 p_attribute24 => p_attribute24,
6112 p_attribute25 => p_attribute25,
6113 p_attribute26 => p_attribute26,
6114 p_attribute27 => p_attribute27,
6115 p_attribute28 => p_attribute28,
6116 p_attribute29 => p_attribute29,
6117 p_attribute30 => p_attribute30,
6118 p_full_name => l_full_name,
6119 p_order_name => l_order_name,
6120 p_global_name => l_global_name,
6121 p_local_name => l_local_name,
6122 p_duplicate_flag => l_duplicate_flag
6123 );
6124
6125 --hr_person.derive_full_name(p_first_name => p_first_name
6126 -- ,p_middle_names => p_middle_names
6127 -- ,p_last_name => p_last_name
6128 -- ,p_known_as => p_known_as
6129 -- ,p_title => p_title
6130 -- ,p_suffix => p_suffix
6131 -- ,p_pre_name_adjunct => p_pre_name_adjunct
6132 -- ,p_date_of_birth => p_date_of_birth
6133 -- ,p_person_id => p_person_id
6134 -- ,p_business_group_id => p_business_group_id
6135 -- ,p_full_name => l_full_name
6136 -- ,p_duplicate_flag => l_duplicate_flag
6137 -- ,p_per_information18 => p_per_information18
6138 -- ,p_per_information19 => p_per_information19
6139 -- );
6140 --
6141 p_full_name := l_full_name;
6142 p_order_name := l_order_name;
6143 p_global_name := l_global_name;
6144 p_local_name := l_local_name;
6145 --
6146 if l_duplicate_flag = 'Y' then
6147 p_name_combination_warning := TRUE;
6148 if g_debug then
6149 hr_utility.set_location(l_proc,25);
6150 end if;
6151 end if;
6152 --
6153 if g_debug then
6154 hr_utility.set_location(l_proc, 30);
6155 end if;
6156 else
6157 --
6158 -- We are not updating the name so we must return the current full_name
6159 --
6160 p_full_name := per_per_shd.g_old_rec.full_name;
6161 p_order_name := per_per_shd.g_old_rec.order_name;
6162 p_global_name := per_per_shd.g_old_rec.global_name;
6163 p_local_name := per_per_shd.g_old_rec.local_name;
6164 end if;
6165 end if;
6166 if g_debug then
6167 hr_utility.set_location(' Leaving:'|| l_proc, 40);
6168 end if;
6169 exception
6170 when app_exception.application_exception then
6171 if hr_multi_message.exception_add
6172 (p_associated_column1 => 'PER_ALL_PEOPLE_F.LAST_NAME'
6173 ) then
6174 if g_debug then
6175 hr_utility.set_location(' Leaving:'||l_proc, 50);
6176 end if;
6177 raise;
6178 end if;
6179 if g_debug then
6180 hr_utility.set_location(' Leaving:'||l_proc,60);
6181 end if;
6182 end return_full_name;
6183 -- ---------------------------------------------------------------------------
6184 -- |-----------------------< chk_applicant_number >------------------------|
6185 -- ---------------------------------------------------------------------------
6186 --
6187 -- Description:
6188 -- Checks that applicant number is valid on insert and delete based on
6189 -- applicant number generation method.
6190 --
6191 -- Some specific tests are performed in this procedure and then if all
6192 -- is still okay the hr_person.generate_number routine is called to
6193 -- finish of the validation/generation process.
6194 --
6195 -- Pre-conditions:
6196 -- Valid person_id
6197 -- Valid current_applicant_flag
6198 -- Valid current_employee_flag
6199 -- Valid business_group_id
6200 -- Valid person_type_id
6201 --
6202 -- In Arguments:
6203 -- p_person_id
6204 -- p_applicant_number
6205 -- p_business_group_id
6206 -- p_current_applicant
6207 -- p_effective_date
6208 -- p_object_version_number
6209 --
6210 -- Post Success:
6211 --
6212 -- If the following conditions apply then an applicant_number is generated
6213 -- and processing continues :
6214 --
6215 -- a) Applicant number must be not null if system person type is 'APL',
6216 -- 'APL_EX_APL','EMP_APL','EX_EMP_APL'.
6217 --
6218 -- b) Applicant number must not be modified to null if the system person
6219 -- type is 'EMP' or 'EX_EMP' and the applicant number is not null
6220 --
6221 -- c) Applicant number must be null if the system person type is 'EMP' and
6222 -- no previous changes to system person type exist
6223 --
6224 -- d) Applicant number must be null if the system person type is 'OTHER'
6225 --
6226 -- e) Applicant number is mandatory in Manual generation mode
6227 --
6228 -- f) Number generation mode of associated business group id can only
6229 -- be 'A' or 'M'
6230 --
6231 -- g) Applicant number can only be updated in generation mode 'M'
6232 --
6233 -- h) Applicant number must be unique within the business group
6234 --
6235 -- Post Failure:
6236 --
6237 -- If the following conditions apply then processing fails :
6238 --
6239 -- a) Applicant number is not null, system person type is 'OTHER'
6240 --
6241 -- b) Applicant number has changed from not null to null and the system
6242 -- person type is 'EMP' or 'EX_EMP'
6243 --
6244 -- c) Applicant number updated when generation mode is 'A'
6245 --
6246 -- d) Applicant number is not null, system person type is 'EMP' and
6247 -- no historic changes in system person type exist for this person.
6248 -- i.e they are 'EMP' now and have always been an 'EMP'.
6249 --
6250 -- e) Applicant number is null when generation mode is 'M'
6251 --
6252 -- Access Status:
6253 -- Internal Table Handler Use Only.
6254 --
6255 procedure chk_applicant_number
6256 (p_person_id in per_all_people_f.person_id%TYPE
6257 ,p_applicant_number in out nocopy per_all_people_f.applicant_number%TYPE
6258 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
6259 ,p_current_applicant in per_all_people_f.current_applicant_flag%TYPE
6260 ,p_person_type_id in per_all_people_f.person_type_id%TYPE
6261 ,p_effective_date in date
6262 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
6263 )
6264 is
6265 begin
6266 chk_applicant_number
6267 (p_person_id => p_person_id
6268 ,p_applicant_number => p_applicant_number
6269 ,p_business_group_id => p_business_group_id
6270 ,p_current_applicant => p_current_applicant
6271 ,p_person_type_id => p_person_type_id
6272 ,p_effective_date => p_effective_date
6273 ,p_object_version_number => p_object_version_number
6274 ,p_party_id => null
6275 ,p_date_of_birth => null
6276 ,p_start_date => null
6277 );
6278 end chk_applicant_number;
6279 --
6280 --
6281 procedure chk_applicant_number
6282 (p_person_id in per_all_people_f.person_id%TYPE
6283 ,p_applicant_number in out nocopy per_all_people_f.applicant_number%TYPE
6284 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
6285 ,p_current_applicant in per_all_people_f.current_applicant_flag%TYPE
6286 ,p_person_type_id in per_all_people_f.person_type_id%TYPE
6287 ,p_effective_date in date
6288 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
6289 ,p_party_id in per_all_people_f.party_id%TYPE
6290 ,p_date_of_birth in per_all_people_f.date_of_birth%TYPE
6291 ,p_start_date in date
6292 )
6293 is
6294 --
6295 l_proc varchar2(72) := g_package||'chk_applicant_number';
6296 l_api_updating boolean;
6297 l_gen_method per_business_groups.method_of_generation_emp_num%TYPE;
6298 l_system_person_type per_person_types.system_person_type%TYPE;
6299 l_employee_number per_all_people_f.employee_number%TYPE;
6300 l_npw_number per_all_people_f.npw_number%TYPE;
6301 l_apl_sys boolean := false;
6302 --
6303 -- Cursor to get number generation method for Bus Group
6304 --
6305 cursor csr_gen_meth is
6306 select pbg.method_of_generation_apl_num
6307 from per_business_groups pbg
6308 where pbg.business_group_id = p_business_group_id;
6309 --
6310 --
6311 -- Declare the function apl_sys_per_type_change
6312 --
6313 function apl_sys_per_type_change
6314 (p_new_person_type_id numeric
6315 ,p_old_person_type_id numeric
6316 ,p_business_group_id numeric)
6317 return boolean is
6318 --
6319 l_new_system_person_type per_person_types.system_person_type%TYPE;
6320 l_old_system_person_type per_person_types.system_person_type%TYPE;
6321 l_return_status boolean;
6322 l_proc varchar2(25) := 'apl_sys_per_type_change';
6323 --
6324 -- Cursor to get the system_person_type for the 'old' person_type_id
6325 --
6326 cursor get_old_sys_per_type is
6327 select system_person_type
6328 from per_person_types
6329 where person_type_id = p_old_person_type_id
6330 and business_group_id = p_business_group_id;
6331 --
6332 begin
6333 --
6334 if g_debug then
6335 hr_utility.set_location('Entering '||l_proc,10);
6336 end if;
6337 --
6338 -- Assume we have not changed the system_person_type, so set return
6339 -- variable to FALSE.
6340 --
6341 l_return_status := false;
6342 --
6343 -- Check the person_type_id has actually changed
6344 --
6345 if p_new_person_type_id <> p_old_person_type_id then
6346 --
6347 if g_debug then
6348 hr_utility.set_location(l_proc, 20);
6349 end if;
6350 --
6351 -- Get the system_person_type for the 'new' person_type_id
6352 --
6353 l_new_system_person_type := return_system_person_type
6354 (p_person_type_Id =>p_new_person_type_id
6355 ,p_business_group_id =>p_business_group_id
6356 );
6357 if g_debug then
6358 hr_utility.set_location(l_proc, 30);
6359 end if;
6360 --
6361 -- Get the system_person_type for the 'old' person_type_id
6362 --
6363 open get_old_sys_per_type;
6364 fetch get_old_sys_per_type into l_old_system_person_type;
6365 close get_old_sys_per_type;
6366 --
6367 -- If the system_person_type's have changed then check the transition
6368 -- to see if the applicant number needs to be validated/generated
6369 --
6370 if ((l_old_system_person_type = 'OTHER' and
6371 l_new_system_person_type = 'APL')
6372 or
6373 (l_old_system_person_type = 'EMP' and
6374 l_new_system_person_type = 'EMP_APL')
6375 or
6376 (l_old_system_person_type = 'EX_EMP' and
6377 l_new_system_person_type = 'EX_EMP_APL')) then
6378 --
6379 if g_debug then
6380 hr_utility.set_location(l_proc, 40);
6381 end if;
6382 --
6383 l_return_status := true;
6384 end if;
6385 if g_debug then
6386 hr_utility.set_location(l_proc, 50);
6387 end if;
6388 end if;
6389 if g_debug then
6390 hr_utility.set_location(' Leaving '||l_proc, 60);
6391 end if;
6392 return l_return_status;
6393 end apl_sys_per_type_change;
6394 --
6395 begin
6396 if g_debug then
6397 hr_utility.set_location('Entering:'|| l_proc, 1);
6398 end if;
6399 --
6400 -- Check mandatory parameters have been set
6401 --
6402 hr_api.mandatory_arg_error
6403 (p_api_name => l_proc
6404 ,p_argument => 'business group id'
6405 ,p_argument_value => p_business_group_id
6406 );
6407 --
6408 hr_api.mandatory_arg_error
6409 (p_api_name => l_proc
6410 ,p_argument => 'effective date'
6411 ,p_argument_value => p_effective_date
6412 );
6413 --
6414 -- Check if the person is being updated
6415 --
6416 -- Only proceed with validation if:
6417 -- a) The current g_old_rec is current and
6418 -- b) The applicant number value has changed
6419 -- c) a record is being inserted
6420 --
6421 l_api_updating := per_per_shd.api_updating
6422 (p_person_id => p_person_id
6423 ,p_effective_date => p_effective_date
6424 ,p_object_version_number => p_object_version_number);
6425 if g_debug then
6426 hr_utility.set_location(l_proc, 2);
6427 end if;
6428 --
6429 -- Need to validate/generate the applicant number if the applicant number
6430 -- has changed or if the system person type has changed in such a way
6431 -- that an applicant number is now required.
6432 --
6433 if ((l_api_updating and
6434 (nvl(per_per_shd.g_old_rec.applicant_number,
6435 hr_api.g_varchar2) <>
6436 nvl(p_applicant_number, hr_api.g_varchar2)
6437 or apl_sys_per_type_change
6438 (p_person_type_id
6439 ,per_per_shd.g_old_rec.person_type_id
6440 ,p_business_group_id)))
6441 or
6442 (NOT l_api_updating)) then
6443 --
6444 if g_debug then
6445 hr_utility.set_location(l_proc, 3);
6446 end if;
6447 --
6448 -- Get the generation method for applicant numbers for the
6449 -- business group
6450 --
6451 open csr_gen_meth;
6452 fetch csr_gen_meth into l_gen_method;
6453 close csr_gen_meth;
6454 if g_debug then
6455 hr_utility.set_location(l_proc, 4);
6456 end if;
6457 --
6458 -- Get the system person type for the type id
6459 --
6460 l_system_person_type := return_system_person_type
6461 (p_person_type_id => p_person_type_id
6462 ,p_business_group_id => p_business_group_id
6463 );
6464 if g_debug then
6465 hr_utility.set_location(l_proc, 5);
6466 end if;
6467 --
6468 -- If system_person_type is OTHER, applicant number must be NULL
6469 --
6470 if (l_system_person_type = 'OTHER' and
6471 p_applicant_number is not null) then
6472 hr_utility.set_message(801, 'HR_51199_PER_APP_NOT_NULL');
6473 l_apl_sys := true;
6474 hr_utility.raise_error;
6475 end if;
6476 if g_debug then
6477 hr_utility.set_location(l_proc, 6);
6478 end if;
6479 --
6480 -- If system person type is EMP, applicant number must be NULL
6481 -- on insert
6482 --
6483 if (NOT l_api_updating and
6484 l_system_person_type = 'EMP' and
6485 p_applicant_number is not null) then
6486 hr_utility.set_message(801, 'HR_51202_PER_APL_NOT_NULL');
6487 l_apl_sys := true;
6488 hr_utility.raise_error;
6489 end if;
6490 if g_debug then
6491 hr_utility.set_location(l_proc, 7);
6492 end if;
6493 --
6494 -- If system person type is EMP or EX_EMP and we are updating then
6495 -- applicant number cannot change to null
6496 --
6497 if (l_api_updating) then
6498 if (l_system_person_type in ('EMP','EX_EMP') and
6499 per_per_shd.g_old_rec.applicant_number is not null and
6500 p_applicant_number is null) then
6501 hr_utility.set_message(801, 'HR_51200_PER_APL_NOT_NULL_UPD');
6502 l_apl_sys := true;
6503 hr_utility.raise_error;
6504 end if;
6505 if g_debug then
6506 hr_utility.set_location(l_proc, 8);
6507 end if;
6508 end if;
6509 if g_debug then
6510 hr_utility.set_location(l_proc, 9);
6511 end if;
6512 --
6513 -- Check that on update with Automatic number generation
6514 -- the applicant number is not changed.
6515 --
6516 if (l_api_updating and
6517 nvl(per_per_shd.g_old_rec.applicant_number,hr_api.g_varchar2) <>
6518 nvl(p_applicant_number, hr_api.g_varchar2) and
6519 l_gen_method = 'A') then
6520 hr_utility.set_message(801, 'HR_51201_PER_INV_APL_UPD');
6521 hr_utility.raise_error;
6522 end if;
6523 if g_debug then
6524 hr_utility.set_location(l_proc,11);
6525 end if;
6526 --
6527 -- On update, If system person type is EMP and no previous sys per
6528 -- type change then applicant number must be null
6529 --
6530 if (l_api_updating and
6531 l_system_person_type = 'EMP' and
6532 NOT hr_person.chk_prev_person_type
6533 (p_system_person_type => l_system_person_type
6534 ,p_person_id => p_person_id
6535 ,p_business_group_id => p_business_group_id
6536 ,p_effective_start_date => p_effective_date) and
6537 p_applicant_number is not null) then
6538 hr_utility.set_message(801, 'HR_51202_PER_APP_NOT_NULL_SPT');
6539 l_apl_sys := true;
6540 hr_utility.raise_error;
6541 end if;
6542 if g_debug then
6543 hr_utility.set_location(l_proc,12);
6544 end if;
6545 --
6546 -- Now call the generate routine. We are either in insert mode
6547 -- or updating a manually generated applicant number
6548 --
6549 hr_person.generate_number(p_current_employee => 'N'
6550 ,p_current_applicant => p_current_applicant
6551 ,p_current_npw => 'N'
6552 ,p_national_identifier => NULL
6553 ,p_business_group_id => p_business_group_id
6554 ,p_person_id => p_person_id
6555 ,p_employee_number => l_employee_number
6556 ,p_applicant_number => p_applicant_number
6557 ,p_npw_number => l_npw_number
6558 ,p_effective_date => p_effective_date
6559 ,p_party_id => p_party_id
6560 ,p_date_of_birth => p_date_of_birth
6561 ,p_start_date => p_effective_date);
6562
6563 if g_debug then
6564 hr_utility.set_location(l_proc,13);
6565 end if;
6566 --
6567 -- Check uniqueness of generated number
6568 --
6569 if l_gen_method <> 'A' then
6570 --
6571 if g_debug then
6572 hr_utility.set_location(l_proc,14);
6573 end if;
6574 --
6575 hr_person.validate_unique_number
6576 (p_person_id => p_person_id
6577 ,p_business_group_id => p_business_group_id
6578 ,p_employee_number => null
6579 ,p_applicant_number => p_applicant_number
6580 ,p_npw_number => null
6581 ,p_current_employee => 'N'
6582 ,p_current_applicant => p_current_applicant
6583 ,p_current_npw => 'N');
6584 --
6585 if g_debug then
6586 hr_utility.set_location(l_proc,15);
6587 end if;
6588 --
6589 end if;
6590 --
6591 end if;
6592 if g_debug then
6593 hr_utility.set_location(' Leaving:'|| l_proc,16);
6594 end if;
6595 exception
6596 when app_exception.application_exception then
6597 if not l_apl_sys
6598 then
6599 if hr_multi_message.exception_add
6600 (p_associated_column1 => 'PER_ALL_PEOPLE_F.APPLICANT_NUMBER'
6601 ) then
6602 if g_debug then
6603 hr_utility.set_location(' Leaving:'||l_proc, 17);
6604 end if;
6605 raise;
6606 end if;
6607 else
6608 if hr_multi_message.exception_add
6609 (p_associated_column1 => 'PER_ALL_PEOPLE_F.APPLICANT_NUMBER'
6610 ,p_associated_column2 => 'PER_ALL_PEOPLE_F.PERSON_TYPE_ID'
6611 ) then
6612 if g_debug then
6613 hr_utility.set_location(' Leaving:'||l_proc, 17);
6614 end if;
6615 raise;
6616 end if;
6617 end if;
6618 if g_debug then
6619 hr_utility.set_location(' Leaving:'||l_proc,18);
6620 end if;
6621 end chk_applicant_number;
6622 --
6623 -- ---------------------------------------------------------------------------
6624 -- |--------------------< chk_date_emp_data_verified >---------------------|
6625 -- ---------------------------------------------------------------------------
6626 --
6627 -- Description:
6628 -- Checks that date employee data verified is always null on insert. On
6629 -- update date employee data verified cannot be set to a not null value.
6630 -- However, a not null value for date employee data verified is permissable
6631 -- when other attributes apart from date employee data verified are being
6632 -- set.
6633 --
6634 -- Pre-conditions:
6635 -- Valid person_id
6636 --
6637 -- In Arguments:
6638 -- p_person_id
6639 -- p_date_employee_data_verified
6640 -- p_effective_start_date
6641 -- p_object_version_number
6642 --
6643 -- Post Success:
6644 -- If date_employee_data_verified is after the effective_start_date
6645 -- of the person record then process succeeds
6646 --
6647 -- Post Failure:
6648 -- If date_employee_data_verified is before the effective_start_date of
6649 -- the person record an application error will be raised and processing
6650 -- is terminated
6651 --
6652 -- Access Status:
6653 -- Internal Table Handler Use Only.
6654 --
6655 procedure chk_date_emp_data_verified
6656 (p_person_id in per_all_people_f.person_id%TYPE
6657 ,p_date_employee_data_verified in
6658 per_all_people_f.date_employee_data_verified%TYPE
6659 ,p_effective_start_date in date
6660 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
6661 )
6662 is
6663 --
6664 l_proc varchar2(72);
6665 l_api_updating boolean;
6666 --
6667 begin
6668 if g_debug then
6669 l_proc := g_package||'chk_date_employee_data_verified';
6670 hr_utility.set_location('Entering:'|| l_proc, 1);
6671 end if;
6672 --
6673 -- Check if the person is being updated
6674 --
6675 l_api_updating := per_per_shd.api_updating
6676 (p_person_id => p_person_id
6677 ,p_effective_date => p_effective_start_date
6678 ,p_object_version_number => p_object_version_number);
6679 if g_debug then
6680 hr_utility.set_location(l_proc, 2);
6681 end if;
6682 --
6683 if ((l_api_updating and
6684 nvl(per_per_shd.g_old_rec.date_employee_data_verified,
6685 hr_api.g_date) <> nvl(p_date_employee_data_verified,
6686 hr_api.g_date)) or (NOT l_api_updating)) then
6687 --
6688 if g_debug then
6689 hr_utility.set_location(l_proc, 3);
6690 end if;
6691 --
6692 -- Check that date employee data verified is valid
6693 --
6694 -- The date_employee_data_verified can be earlier than the
6695 -- effective_starte_date. Bug# 2775438.
6696
6697 --if p_date_employee_data_verified is not null and
6698 -- p_date_employee_data_verified < p_effective_start_date then
6699 -- Error: Invalid value
6700 -- hr_utility.set_message(801, 'HR_51256_PER_DTE_EMP_DTE_START');
6701 -- hr_utility.raise_error;
6702 --end if;
6703
6704 --
6705 if g_debug then
6706 hr_utility.set_location(l_proc, 4);
6707 end if;
6708 end if;
6709 if g_debug then
6710 hr_utility.set_location(' Leaving:'|| l_proc, 5);
6711 end if;
6712 exception
6713 when app_exception.application_exception then
6714 if hr_multi_message.exception_add
6715 (p_associated_column1 => 'PER_ALL_PEOPLE_F.DATE_EMPLOYEE_DATA_VERIFIED'
6716 ,p_associated_column2 => 'PER_ALL_PEOPLE_F.EFFECTIVE_START_DATE'
6717 ) then
6718 if g_debug then
6719 hr_utility.set_location(' Leaving:'||l_proc, 6);
6720 end if;
6721 raise;
6722 end if;
6723 if g_debug then
6724 hr_utility.set_location(' Leaving:'||l_proc,7);
6725 end if;
6726 end chk_date_emp_data_verified;
6727 --
6728 -- ---------------------------------------------------------------------------
6729 -- |-----------------------< chk_vendor_id >-------------------------------|
6730 -- ---------------------------------------------------------------------------
6731 --
6732 -- Description:
6733 -- Checks that vendor id is valid.
6734 --
6735 -- Pre-conditions:
6736 -- Valid person_id
6737 --
6738 -- In Arguments:
6739 -- p_person_id
6740 -- p_vendor_id
6741 -- p_effective_date
6742 -- p_object_version_number
6743 --
6744 -- Post Success:
6745 -- If vendor id is null and system person type is not one of 'EMP',
6746 -- 'EMP_APL','EX_EMP',EX_EMP_APL then process succeeds.
6747 -- If vendor id is not null, system person type is one of 'EMP','EMP_APL',
6748 -- 'EX_EMP','EX_EMP_APL' and vendor id exists in lookup table then process
6749 -- succeeds.
6750 --
6751 -- Post Failure:
6752 -- If vendor id is not null and system person type is not one of 'EMP',
6753 -- 'EMP_APL','EX_EMP',EX_EMP_APL then process is terminated.
6754 -- If vendor id is not null, system person type is one of 'EMP','EMP_APL',
6755 -- 'EX_EMP','EX_EMP_APL' and vendor id does not exists in lookup table then
6756 -- process is terminated.
6757 --
6758 -- Access Status:
6759 -- Internal Table Handler Use Only.
6760 --
6761 procedure chk_vendor_id
6762 (p_person_id in per_all_people_f.person_id%TYPE
6763 ,p_vendor_id in per_all_people_f.vendor_id%TYPE
6764 ,p_person_type_id in per_all_people_f.person_type_id%TYPE
6765 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
6766 ,p_effective_date in date
6767 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
6768 ) is
6769 --
6770 l_proc varchar2(72);
6771 l_api_updating boolean;
6772 l_exists varchar2(1);
6773 --
6774 -- Cursor to validate vendor_id in PO_VENDORS table.
6775 --
6776 cursor csr_chk_vendor is
6777 select null
6778 from po_vendors
6779 where vendor_id = p_vendor_id;
6780 --
6781 begin
6782 if g_debug then
6783 l_proc := g_package||'chk_vendor_id';
6784 hr_utility.set_location('Entering:'|| l_proc, 10);
6785 end if;
6786 --
6787 -- Check if the person is being updated
6788 --
6789 l_api_updating := per_per_shd.api_updating
6790 (p_person_id => p_person_id
6791 ,p_effective_date => p_effective_date
6792 ,p_object_version_number => p_object_version_number);
6793 if g_debug then
6794 hr_utility.set_location(l_proc, 20);
6795 end if;
6796 --
6797 if ((l_api_updating and
6798 nvl(per_per_shd.g_old_rec.vendor_id, hr_api.g_number) <>
6799 nvl(p_vendor_id, hr_api.g_number)) or
6800 (NOT l_api_updating)) then
6801 --
6802 if g_debug then
6803 hr_utility.set_location(l_proc, 30);
6804 end if;
6805 --
6806 -- Check the system person type and validate as appropriate.
6807 --
6808 if return_system_person_type(p_person_type_id,p_business_group_id)
6809 in ('EMP','EMP_APL','EX_EMP','EX_EMP_APL') then
6810 --
6811 -- Vendor id can be null, but if it is not null then it must exist
6812 -- in the PO_VENDORS table.
6813 --
6814 if p_vendor_id is not null then
6815 if g_debug then
6816 hr_utility.set_location(l_proc, 40);
6817 end if;
6818 open csr_chk_vendor;
6819 fetch csr_chk_vendor into l_exists;
6820 if csr_chk_vendor%notfound then
6821 close csr_chk_vendor;
6822 --
6823 -- Error : Invalid vendor id
6824 --
6825 hr_utility.set_message(801,'HR_51249_PER_INVALID_VENDOR');
6826 hr_utility.raise_error;
6827 end if;
6828 close csr_chk_vendor;
6829 if g_debug then
6830 hr_utility.set_location(l_proc, 50);
6831 end if;
6832 end if;
6833 else
6834 --
6835 if g_debug then
6836 hr_utility.set_location(l_proc, 60);
6837 end if;
6838 --
6839 -- Vendor id must be null.
6840 --
6841 if p_vendor_id is not null then
6842 --
6843 -- Error : Vendor must be null
6844 --
6845 hr_utility.set_message(801, 'HR_51250_PER_VENDOR_NOT_NULL');
6846 hr_utility.raise_error;
6847 end if;
6848 if g_debug then
6849 hr_utility.set_location(l_proc, 70);
6850 end if;
6851 end if;
6852 end if;
6853 --
6854 if g_debug then
6855 hr_utility.set_location(' Leaving:'|| l_proc, 80);
6856 end if;
6857 exception
6858 when app_exception.application_exception then
6859 if hr_multi_message.exception_add
6860 (p_associated_column1 => 'PER_ALL_PEOPLE_F.VENDOR_ID'
6861 ) then
6862 if g_debug then
6863 hr_utility.set_location(' Leaving:'||l_proc, 90);
6864 end if;
6865 raise;
6866 end if;
6867 if g_debug then
6868 hr_utility.set_location(' Leaving:'||l_proc,100);
6869 end if;
6870 end chk_vendor_id;
6871 --
6872 -- ---------------------------------------------------------------------------
6873 -- |------------------------------< chk_suffix >-----------------------------|
6874 -- ---------------------------------------------------------------------------
6875 --
6876 -- Description:
6877 -- - No validation
6878 --
6879 -- Pre-conditions:
6880 -- None
6881 --
6882 -- In Arguments:
6883 -- p_person_id
6884 -- p_marital_status
6885 -- p_effective_date
6886 -- p_object_version_number
6887 --
6888 -- Post Success:
6889 -- Processing continues if:
6890 --
6891 -- Post Failure:
6892 -- An application error is raised and processing is terminated if:
6893 --
6894 -- Access Status:
6895 -- Internal Table Handler Use Only.
6896 --
6897 procedure chk_suffix
6898 (p_person_id in per_all_people_f.person_id%TYPE
6899 ,p_suffix in per_all_people_f.suffix%TYPE
6900 ,p_effective_date in date
6901 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
6902 )
6903 is
6904 --
6905 l_exists varchar2(1);
6906 l_proc varchar2(72) := g_package||'chk_marital_status';
6907 l_api_updating boolean;
6908 --
6909 begin
6910 if g_debug then
6911 hr_utility.set_location('Entering:'|| l_proc, 10);
6912 end if;
6913 --
6914 -- Check mandatory parameters have been set
6915 --
6916 hr_api.mandatory_arg_error
6917 (p_api_name => l_proc
6918 ,p_argument => 'effective date'
6919 ,p_argument_value => p_effective_date
6920 );
6921 --
6922 if g_debug then
6923 hr_utility.set_location(l_proc, 20);
6924 end if;
6925 --
6926 -- Only proceed with validation if:
6927 -- a) The current g_old_rec is current and
6928 -- b) The suffix value has changed
6929 -- c) a record is being inserted
6930 --
6931 l_api_updating := per_per_shd.api_updating
6932 (p_person_id => p_person_id
6933 ,p_effective_date => p_effective_date
6934 ,p_object_version_number => p_object_version_number
6935 );
6936 if g_debug then
6937 hr_utility.set_location(l_proc, 30);
6938 end if;
6939 --
6940 if ((l_api_updating
6941 and nvl(per_per_shd.g_old_rec.suffix, hr_api.g_varchar2)
6942 <> nvl(p_suffix,hr_api.g_varchar2))
6943 or
6944 (NOT l_api_updating))
6945 then
6946 if g_debug then
6947 hr_utility.set_location(l_proc, 40);
6948 end if;
6949 --
6950 end if;
6951 if g_debug then
6952 hr_utility.set_location(' Leaving:'|| l_proc, 70);
6953 end if;
6954 end chk_suffix;
6955 --
6956 -- ---------------------------------------------------------------------------
6957 -- |---------------------------< chk_work_telephone >------------------------|
6958 -- ---------------------------------------------------------------------------
6959 --
6960 -- Description:
6961 -- Checks that work_telephone is null. Work Telephone is now stored on the
6962 -- per_phones table.
6963 --
6964 -- Pre-conditions:
6965 -- None
6966 --
6967 -- In Arguments:
6968 -- p_work_telephone
6969 --
6970 -- Post Success:
6971 -- Processing continues
6972 --
6973 -- Post Failure:
6974 -- An application error is raised and processing is terminated
6975 --
6976 -- Access Status:
6977 -- Internal Table Handler Use Only.
6978 --
6979 procedure chk_work_telephone
6980 (p_person_id in per_all_people_f.person_id%TYPE
6981 ,p_work_telephone in per_all_people_f.work_telephone%TYPE
6982 ,p_effective_date in date
6983 ,p_object_version_number in per_all_people_f.object_version_number%TYPE
6984 )
6985 is
6986 --
6987 l_proc varchar2(72);
6988 l_api_updating boolean;
6989 --
6990 begin
6991 if g_debug then
6992 l_proc := g_package||'chk_work_telephone';
6993 hr_utility.set_location('Entering:'|| l_proc, 10);
6994 end if;
6995
6996 l_api_updating := per_per_shd.api_updating
6997 (p_person_id => p_person_id
6998 ,p_effective_date => p_effective_date
6999 ,p_object_version_number => p_object_version_number
7000 );
7001 if g_debug then
7002 hr_utility.set_location(l_proc, 30);
7003 end if;
7004 --
7005 if ((l_api_updating
7006 and nvl(per_per_shd.g_old_rec.work_telephone, hr_api.g_varchar2)
7007 <> nvl(p_work_telephone,hr_api.g_varchar2))
7008 or
7009 (NOT l_api_updating))
7010 then
7011 --
7012 -- Check parameter is null
7013 --
7014 if g_debug then
7015 hr_utility.set_location('Work Number is:'|| p_work_telephone, 15);
7016 end if;
7017 if p_work_telephone is not null then
7018 hr_utility.set_message(801, 'HR_52217_PER_INVALID_PHONE');
7019 hr_utility.raise_error;
7020 end if;
7021 end if;
7022 if g_debug then
7023 hr_utility.set_location(' Leaving:'|| l_proc, 70);
7024 end if;
7025 exception
7026 when app_exception.application_exception then
7027 if hr_multi_message.exception_add
7028 (p_associated_column1 => 'PER_ALL_PEOPLE_F.WORK_TELEPHONE'
7029 ) then
7030 if g_debug then
7031 hr_utility.set_location(' Leaving:'||l_proc, 80);
7032 end if;
7033 raise;
7034 end if;
7035 if g_debug then
7036 hr_utility.set_location(' Leaving:'||l_proc,90);
7037 end if;
7038 end chk_work_telephone;
7039 --
7040 -- Fix 3573040
7041 -- Added new procedure chk_per_information_category
7042 --
7043 -- ---------------------------------------------------------------------------
7044 -- |-------------------< chk_per_information_category >--------------------|
7045 -- ---------------------------------------------------------------------------
7046 --
7047 -- Description:
7048 -- Checks if the information category has the valid legislation
7049 --
7050 -- In Arguments:
7051 -- p_per_information_category
7052 -- p_legislation_code
7053 --
7054 -- Post Success:
7055 -- If p_per_information_category is not null and it matches the legislation
7056 -- corresponding to the business group then the process succeeds.
7057 -- If p_per_information_category is null and a valid DDF context exists for
7058 -- the legislation of the business group, then the corresponding legislation
7059 -- is set for p_per_information_category
7060 --
7061 -- Post Failure:
7062 -- If p_per_information_category is not null and it does not match the
7063 -- legislation corresponding to the business group then the process fails.
7064 --
7065 -- Access Status:
7066 -- Internal Table Handler Use Only.
7067 --
7068 procedure chk_per_information_category
7069 (p_per_information_category in out nocopy per_all_people_f.per_information_category%TYPE
7070 ,p_legislation_code in per_business_groups.legislation_code%TYPE
7071 ) is
7072 --
7073 l_ddf_exists varchar2(1);
7074 --
7075 begin
7076 -- Bug fix 38383715. Modified if condition.
7077 if p_per_information_category is not null
7078 and p_per_information_category <> p_legislation_code then
7079 hr_utility.set_message( 800, 'PER_449162_INFO_CATEGORY' );
7080 hr_utility.raise_error;
7081 else
7082 PER_PEOPLE3_PKG.get_ddf_exists
7083 ( p_legislation_code => p_legislation_code
7084 , p_ddf_exists => l_ddf_exists );
7085 if l_ddf_exists = 'Y' then
7086 p_per_information_category := p_legislation_code;
7087 else
7088 p_per_information_category := null;
7089 end if;
7090 end if;
7091 end chk_per_information_category;
7092 --
7093 -- ---------------------------------------------------------------------------
7094 -- |------------------------< chk_delete >----------------------------|
7095 -- ---------------------------------------------------------------------------
7096 --
7097 -- Description:
7098 -- Validates that rows may be deleted from per_all_people_f
7099 --
7100 -- Pre-conditions:
7101 -- None
7102 --
7103 -- In Arguments:
7104 -- p_person_id
7105 -- p_business_group_id
7106 -- p_person_type_id
7107 -- p_effective_date
7108 -- p_datetrack_mode
7109 --
7110 -- Post Success:
7111 -- If a row may be deleted then
7112 -- processing continues
7113 --
7114 -- Post Failure:
7115 -- If future changes to person type exist and datetrack mode is delete next
7116 -- change or delete future change
7117 -- an application error will be raised and processing is terminated
7118 --
7119 -- See perper.bru for full list of failure conditions handled by
7120 -- hr_person_delete.weak_predel_validation
7121 -- hr_person_delete.moderate_predel_validation and
7122 --
7123 -- Access Status:
7124 -- Internal Table Handler Use Only.
7125 --
7126 procedure chk_delete
7127 (p_person_id in per_all_people_f.person_id%TYPE
7128 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
7129 ,p_person_type_id in per_all_people_f.person_type_id%TYPE
7130 ,p_effective_date in date
7131 ,p_datetrack_mode in varchar2) is
7132 --
7133 l_exists varchar2(1);
7134 l_proc varchar2(72) := g_package||'chk_delete';
7135 l_system_person_type varchar2(30);
7136 --
7137 -- check if future changes to system person type exist
7138 --
7139 cursor csr_chk_future_changes
7140 (c_system_person_type per_person_types.system_person_type%TYPE
7141 )
7142 is
7143 select null
7144 from sys.dual
7145 where exists
7146 (select null
7147 from per_all_people_f ppf,
7148 per_person_types ppt
7149 where ppf.effective_start_date > p_effective_date
7150 and ppf.person_id = p_person_id
7151 and ppt.person_type_id = ppf.person_type_id
7152 and ppt.system_person_type <> c_system_person_type
7153 );
7154 --
7155 begin
7156 if g_debug then
7157 hr_utility.set_location('Entering:'|| l_proc, 10);
7158 end if;
7159 --
7160 -- Check mandatory parameters have been set
7161 --
7162 hr_api.mandatory_arg_error
7163 (p_api_name => l_proc
7164 ,p_argument => 'business group id'
7165 ,p_argument_value => p_business_group_id
7166 );
7167 --
7168 hr_api.mandatory_arg_error
7169 (p_api_name => l_proc
7170 ,p_argument => 'person type id'
7171 ,p_argument_value => p_person_type_id
7172 );
7173 --
7174 hr_api.mandatory_arg_error
7175 (p_api_name => l_proc
7176 ,p_argument => 'effective date'
7177 ,p_argument_value => p_effective_date
7178 );
7179 --
7180 hr_api.mandatory_arg_error
7181 (p_api_name => l_proc
7182 ,p_argument => 'datetrack mode'
7183 ,p_argument_value => p_datetrack_mode
7184 );
7185 if g_debug then
7186 hr_utility.set_location(l_proc, 20);
7187 end if;
7188 --
7189 -- If delete mode is DELETE_NEXT_CHANGE or FUTURE_CHANGE
7190 -- check if rows exist in PER_PEOPLE_F where the system person type has
7191 -- changed
7192 --
7193 if p_datetrack_mode in ('DELETE_NEXT_CHANGE','FUTURE_CHANGE')
7194 then
7195 --
7196 l_system_person_type := return_system_person_type
7197 (p_person_type_id,
7198 p_business_group_id
7199 );
7200 open csr_chk_future_changes(l_system_person_type);
7201 fetch csr_chk_future_changes into l_exists;
7202 if csr_chk_future_changes%found then
7203 close csr_chk_future_changes;
7204 -- Error: Delete not allowed
7205 hr_utility.set_message(801, 'HR_7726_PER_DEL_NOT_ALLOWED');
7206 hr_utility.raise_error;
7207 end if;
7208 close csr_chk_future_changes;
7209 if g_debug then
7210 hr_utility.set_location(l_proc, 20);
7211 end if;
7212 end if;
7213 --
7214 if g_debug then
7215 hr_utility.set_location(l_proc, 3);
7216 end if;
7217 --
7218 -- If delete mode in ('ZAP','DELETE','DELETE_NEXT_CHANGE',
7219 -- 'FUTURE_CHANGE') then
7220 -- carry out weak and moderate delete checks
7221 --
7222 -- if p_datetrack_mode in ('ZAP','DELETE','DELETE_NEXT_CHANGE',
7223 -- 'FUTURE_CHANGE') then
7224 --
7225 if p_datetrack_mode in ('ZAP','DELETE') then
7226 --
7227 -- Fix for 3908271 starts here.
7228 -- Comment out the following calls.
7229 --
7230 /*
7231 hr_person_delete.weak_predel_validation(p_person_id => p_person_id
7232 ,p_session_date => p_effective_date);
7233 hr_person_delete.moderate_predel_validation(p_person_id => p_person_id
7234 ,p_session_date => p_effective_date);
7235 */
7236 --
7237 -- Call hr_person_internal procedures.
7238 --
7239 hr_person_internal.weak_predel_validation(p_person_id => p_person_id
7240 ,p_effective_date => p_effective_date);
7241 hr_person_internal.strong_predel_validation(p_person_id => p_person_id
7242 ,p_effective_date => p_effective_date);
7243 --
7244 -- Fix for 3908271 ends here.
7245 --
7246 end if;
7247 --
7248 if g_debug then
7249 hr_utility.set_location(' Leaving:'|| l_proc, 4);
7250 end if;
7251 end chk_delete;
7252 --
7253 -- ----------------------------------------------------------------------------
7254 -- |----------------------< check_non_updateable_args >-----------------------|
7255 -- ----------------------------------------------------------------------------
7256 -- {Start Of Comments}
7257 --
7258 -- Description:
7259 -- This procedure is used to ensure that non updatetable attributes have
7260 -- not been updated. If an attribute has been updated an error is generated.
7261 --
7262 -- Pre Conditions:
7263 -- g_old_rec has been populated with details of the values currently in
7264 -- the database.
7265 --
7266 -- In Arguments:
7267 -- p_rec has been populated with the updated values the user would like the
7268 -- record set to.
7269 --
7270 -- Post Success:
7271 -- Processing continues if all the non updateable attributes have not
7272 -- changed.
7273 --
7274 -- Post Failure:
7275 -- An application error is raised if any of the non updatable attributes
7276 -- (business_group_id)
7277 -- have been altered.
7278 --
7279 -- Access Status:
7280 -- Internal Development Use Only.
7281 -- {End Of Comments}
7282 -- ----------------------------------------------------------------------------
7283 Procedure check_non_updateable_args(p_rec in per_per_shd.g_rec_type
7284 ,p_effective_date in date) is
7285 --
7286 l_proc varchar2(72) := g_package||'check_non_updateable_args';
7287 --
7288 Begin
7289 if g_debug then
7290 hr_utility.set_location('Entering:'||l_proc, 5);
7291 end if;
7292 --
7293 -- Only proceed with validation if a row exists for
7294 -- the current record in the HR Schema
7295 --
7296 if not per_per_shd.api_updating
7297 (p_person_id => p_rec.person_id
7298 ,p_effective_date => p_effective_date
7299 ,p_object_version_number => p_rec.object_version_number) then
7300 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
7301 hr_utility.set_message_token('PROCEDURE', l_proc);
7302 hr_utility.set_message_token('STEP', '5');
7303 end if;
7304 --
7305 if g_debug then
7306 hr_utility.set_location(l_proc, 6);
7307 end if;
7308 --
7309 if nvl(p_rec.business_group_id, hr_api.g_number) <>
7310 nvl(per_per_shd.g_old_rec.business_group_id, hr_api.g_number) then
7311 hr_api.argument_changed_error
7312 (
7313 p_api_name => l_proc
7314 ,p_argument => 'BUSINESS_GROUP_ID'
7315 ,p_base_table => per_per_shd.g_tab_nam
7316 );
7317 end if;
7318 if g_debug then
7319 hr_utility.set_location(' Leaving '||l_proc, 7);
7320 end if;
7321 --
7322 end check_non_updateable_args;
7323 --
7324 -- ----------------------------------------------------------------------------
7325 -- |--------------------------< dt_update_validate >--------------------------|
7326 -- ----------------------------------------------------------------------------
7327 -- {Start Of Comments}
7328 --
7329 -- Description:
7330 -- This procedure is used for referential integrity of datetracked
7331 -- parent entities when a datetrack update operation is taking place
7332 -- and where there is no cascading of update defined for this entity.
7333 --
7334 -- Pre Conditions:
7335 -- This procedure is called from the update_validate.
7336 --
7337 -- In Arguments:
7338 --
7339 -- Post Success:
7340 -- Processing continues.
7341 --
7342 -- Post Failure:
7343 --
7344 -- Developer Implementation Notes:
7345 -- This procedure should not need maintenance unless the HR Schema model
7346 -- changes.
7347 --
7348 -- Access Status:
7349 -- Internal Table Handler Use Only.
7350 --
7351 -- {End Of Comments}
7352 -- ----------------------------------------------------------------------------
7353 Procedure dt_update_validate
7354 (
7355 p_datetrack_mode in varchar2,
7356 p_validation_start_date in date,
7357 p_validation_end_date in date) Is
7358 --
7359 l_proc varchar2(72) := g_package||'dt_update_validate';
7360 --l_integrity_error Exception;
7361 l_table_name all_tables.table_name%TYPE;
7362 --
7363 Begin
7364 if g_debug then
7365 hr_utility.set_location('Entering:'||l_proc, 5);
7366 end if;
7367 --
7368 -- Ensure that the p_datetrack_mode argument is not null
7369 --
7370 hr_api.mandatory_arg_error
7371 (p_api_name => l_proc,
7372 p_argument => 'datetrack_mode',
7373 p_argument_value => p_datetrack_mode);
7374 --
7375 -- Only perform the validation if the datetrack update mode is valid
7376 --
7377 If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
7378 --
7379 --
7380 -- Ensure the arguments are not null
7381 --
7382 hr_api.mandatory_arg_error
7383 (p_api_name => l_proc,
7384 p_argument => 'validation_start_date',
7385 p_argument_value => p_validation_start_date);
7386 --
7387 hr_api.mandatory_arg_error
7388 (p_api_name => l_proc,
7389 p_argument => 'validation_end_date',
7390 p_argument_value => p_validation_end_date);
7391 --
7392 --
7393 --
7394 End If;
7395 --
7396 if g_debug then
7397 hr_utility.set_location(' Leaving:'||l_proc, 10);
7398 end if;
7399 Exception
7400 /*When l_integrity_error Then
7401 --
7402 -- A referential integrity check was violated therefore
7403 -- we must error
7404 --
7405 hr_utility.set_message(801, 'HR_7216_DT_UPD_INTEGRITY_ERR');
7406 hr_utility.set_message_token('TABLE_NAME', l_table_name);
7407 hr_utility.raise_error;*/
7408 When Others Then
7409 --
7410 -- An unhandled or unexpected error has occurred which
7411 -- we must report
7412 --
7413 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
7414 hr_utility.set_message_token('PROCEDURE', l_proc);
7415 hr_utility.set_message_token('STEP','15');
7416 hr_utility.raise_error;
7417 End dt_update_validate;
7418 --
7419 -- ----------------------------------------------------------------------------
7420 -- |--------------------------< dt_delete_validate >--------------------------|
7421 -- ----------------------------------------------------------------------------
7422 -- {Start Of Comments}
7423 --
7424 -- Description:
7425 -- This procedure is used for referential integrity of datetracked
7426 -- child entities when either a datetrack DELETE or ZAP is in operation
7427 -- and where there is no cascading of delete defined for this entity.
7428 -- For the datetrack mode of DELETE or ZAP we must ensure that no
7429 -- datetracked child rows exist between the validation start and end
7430 -- dates.
7431 --
7432 -- Pre Conditions:
7433 -- This procedure is called from the delete_validate.
7434 --
7435 -- In Arguments:
7436 --
7437 -- Post Success:
7438 -- Processing continues.
7439 --
7440 -- Post Failure:
7441 -- If a row exists by determining the returning Boolean value from the
7442 -- generic dt_api.rows_exist function then we must supply an error via
7443 -- the use of the local exception handler l_rows_exist.
7444 --
7445 -- Developer Implementation Notes:
7446 -- This procedure should not need maintenance unless the HR Schema model
7447 -- changes.
7448 --
7449 -- Access Status:
7450 -- Internal Table Handler Use Only.
7451 --
7452 -- {End Of Comments}
7453 -- ----------------------------------------------------------------------------
7454 Procedure dt_delete_validate
7455 (p_person_id in number,
7456 p_datetrack_mode in varchar2,
7457 p_validation_start_date in date,
7458 p_validation_end_date in date) Is
7459 --
7460 l_proc varchar2(72) := g_package||'dt_delete_validate';
7461 --l_rows_exist Exception;
7462 l_table_name all_tables.table_name%TYPE;
7463 --
7464 Begin
7465 if g_debug then
7466 hr_utility.set_location('Entering:'||l_proc, 5);
7467 end if;
7468 --
7469 -- Ensure that the p_datetrack_mode argument is not null
7470 --
7471 hr_api.mandatory_arg_error
7472 (p_api_name => l_proc,
7473 p_argument => 'datetrack_mode',
7474 p_argument_value => p_datetrack_mode);
7475 --
7476 -- Only perform the validation if the datetrack mode is either
7477 -- DELETE or ZAP
7478 --
7479 If (p_datetrack_mode = 'DELETE' or
7480 p_datetrack_mode = 'ZAP') then
7481 --
7482 --
7483 -- Ensure the arguments are not null
7484 --
7485 hr_api.mandatory_arg_error
7486 (p_api_name => l_proc,
7487 p_argument => 'validation_start_date',
7488 p_argument_value => p_validation_start_date);
7489 --
7490 hr_api.mandatory_arg_error
7491 (p_api_name => l_proc,
7492 p_argument => 'validation_end_date',
7493 p_argument_value => p_validation_end_date);
7494 --
7495 hr_api.mandatory_arg_error
7496 (p_api_name => l_proc,
7497 p_argument => 'person_id',
7498 p_argument_value => p_person_id);
7499 --
7500 --
7501 if (dt_api.rows_exist
7502 (p_base_table_name => 'per_contracts_f',
7503 p_base_key_column => 'person_id',
7504 p_base_key_value => p_person_id,
7505 p_from_date => p_validation_start_date,
7506 p_to_date => p_validation_end_date)) then
7507 l_table_name := 'contracts';
7508 hr_utility.set_message(801, 'HR_7215_DT_CHILD_EXISTS');
7509 hr_utility.set_message_token('TABLE_NAME', l_table_name);
7510 hr_multi_message.add;
7511 -- raise l_rows_exist;
7512 end if;
7513 --
7514 --
7515 End If;
7516 --
7517 if g_debug then
7518 hr_utility.set_location(' Leaving:'||l_proc, 10);
7519 end if;
7520 Exception
7521 /*When l_rows_exist Then
7522 --
7523 -- A referential integrity check was violated therefore
7524 -- we must error
7525 --
7526 hr_utility.set_message(801, 'HR_7215_DT_CHILD_EXISTS');
7527 hr_utility.set_message_token('TABLE_NAME', l_table_name);
7528 hr_utility.raise_error;*/
7529 When Others Then
7530 --
7531 -- An unhandled or unexpected error has occurred which
7532 -- we must report
7533 --
7534 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
7535 hr_utility.set_message_token('PROCEDURE', l_proc);
7536 hr_utility.set_message_token('STEP','15');
7537 hr_utility.raise_error;
7538 End dt_delete_validate;
7539 --
7540 -- -----------------------------------------------------------------------
7541 -- |------------------------------< chk_df >-----------------------------|
7542 -- -----------------------------------------------------------------------
7543 --
7544 -- Description:
7545 -- Validates the all Descriptive Flexfield values.
7546 --
7547 -- Pre-conditions:
7548 -- All other columns have been validated. Must be called as the
7549 -- last step from insert_validate and update_validate.
7550 --
7551 -- In Arguments:
7552 -- p_rec
7553 --
7554 -- Post Success:
7555 -- If the Descriptive Flexfield structure column and data values are
7556 -- all valid this procedure will end normally and processing will
7557 -- continue.
7558 --
7559 -- Post Failure:
7560 -- If the Descriptive Flexfield structure column value or any of
7561 -- the data values are invalid then an application error is raised as
7562 -- a PL/SQL exception.
7563 --
7564 -- Access Status:
7565 -- Internal Row Handler Use Only.
7566 --
7567 procedure chk_df
7568 (p_rec in per_per_shd.g_rec_type) is
7569 --
7570 l_proc varchar2(72);
7571 --
7572 begin
7573 if g_debug then
7574 l_proc := g_package||'chk_df';
7575 hr_utility.set_location('Entering:'||l_proc, 10);
7576 end if;
7577 --
7578 if ((p_rec.person_id is not null) and (
7579 nvl(per_per_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
7580 nvl(p_rec.attribute_category, hr_api.g_varchar2) or
7581 nvl(per_per_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
7582 nvl(p_rec.attribute1, hr_api.g_varchar2) or
7583 nvl(per_per_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
7584 nvl(p_rec.attribute2, hr_api.g_varchar2) or
7585 nvl(per_per_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
7586 nvl(p_rec.attribute3, hr_api.g_varchar2) or
7587 nvl(per_per_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
7588 nvl(p_rec.attribute4, hr_api.g_varchar2) or
7589 nvl(per_per_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
7590 nvl(p_rec.attribute5, hr_api.g_varchar2) or
7591 nvl(per_per_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
7592 nvl(p_rec.attribute6, hr_api.g_varchar2) or
7593 nvl(per_per_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
7594 nvl(p_rec.attribute7, hr_api.g_varchar2) or
7595 nvl(per_per_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
7596 nvl(p_rec.attribute8, hr_api.g_varchar2) or
7597 nvl(per_per_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
7598 nvl(p_rec.attribute9, hr_api.g_varchar2) or
7599 nvl(per_per_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
7600 nvl(p_rec.attribute10, hr_api.g_varchar2) or
7601 nvl(per_per_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
7602 nvl(p_rec.attribute11, hr_api.g_varchar2) or
7603 nvl(per_per_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
7604 nvl(p_rec.attribute12, hr_api.g_varchar2) or
7605 nvl(per_per_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
7606 nvl(p_rec.attribute13, hr_api.g_varchar2) or
7607 nvl(per_per_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
7608 nvl(p_rec.attribute14, hr_api.g_varchar2) or
7609 nvl(per_per_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
7610 nvl(p_rec.attribute15, hr_api.g_varchar2) or
7611 nvl(per_per_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
7612 nvl(p_rec.attribute16, hr_api.g_varchar2) or
7613 nvl(per_per_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
7614 nvl(p_rec.attribute17, hr_api.g_varchar2) or
7615 nvl(per_per_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
7616 nvl(p_rec.attribute18, hr_api.g_varchar2) or
7617 nvl(per_per_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
7618 nvl(p_rec.attribute19, hr_api.g_varchar2) or
7619 nvl(per_per_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
7620 nvl(p_rec.attribute20, hr_api.g_varchar2) or
7621 nvl(per_per_shd.g_old_rec.attribute21, hr_api.g_varchar2) <>
7622 nvl(p_rec.attribute21, hr_api.g_varchar2) or
7623 nvl(per_per_shd.g_old_rec.attribute22, hr_api.g_varchar2) <>
7624 nvl(p_rec.attribute22, hr_api.g_varchar2) or
7625 nvl(per_per_shd.g_old_rec.attribute23, hr_api.g_varchar2) <>
7626 nvl(p_rec.attribute23, hr_api.g_varchar2) or
7627 nvl(per_per_shd.g_old_rec.attribute24, hr_api.g_varchar2) <>
7628 nvl(p_rec.attribute24, hr_api.g_varchar2) or
7629 nvl(per_per_shd.g_old_rec.attribute25, hr_api.g_varchar2) <>
7630 nvl(p_rec.attribute25, hr_api.g_varchar2) or
7631 nvl(per_per_shd.g_old_rec.attribute26, hr_api.g_varchar2) <>
7632 nvl(p_rec.attribute26, hr_api.g_varchar2) or
7633 nvl(per_per_shd.g_old_rec.attribute27, hr_api.g_varchar2) <>
7634 nvl(p_rec.attribute27, hr_api.g_varchar2) or
7635 nvl(per_per_shd.g_old_rec.attribute28, hr_api.g_varchar2) <>
7636 nvl(p_rec.attribute28, hr_api.g_varchar2) or
7637 nvl(per_per_shd.g_old_rec.attribute29, hr_api.g_varchar2) <>
7638 nvl(p_rec.attribute29, hr_api.g_varchar2) or
7639 nvl(per_per_shd.g_old_rec.attribute30, hr_api.g_varchar2) <>
7640 nvl(p_rec.attribute30, hr_api.g_varchar2)))
7641 or (p_rec.person_id is null) then
7642 --
7643 -- Only execute the validation if absolutely necessary:
7644 -- a) During update, the structure column value or any
7645 -- of the attribute values have actually changed.
7646 -- b) During insert.
7647 --
7648 hr_dflex_utility.ins_or_upd_descflex_attribs
7649 (p_appl_short_name => 'PER'
7650 ,p_descflex_name => 'PER_PEOPLE'
7651 ,p_attribute_category => p_rec.attribute_category
7652 ,p_attribute1_name => 'ATTRIBUTE1'
7653 ,p_attribute1_value => p_rec.attribute1
7654 ,p_attribute2_name => 'ATTRIBUTE2'
7655 ,p_attribute2_value => p_rec.attribute2
7656 ,p_attribute3_name => 'ATTRIBUTE3'
7657 ,p_attribute3_value => p_rec.attribute3
7658 ,p_attribute4_name => 'ATTRIBUTE4'
7659 ,p_attribute4_value => p_rec.attribute4
7660 ,p_attribute5_name => 'ATTRIBUTE5'
7661 ,p_attribute5_value => p_rec.attribute5
7662 ,p_attribute6_name => 'ATTRIBUTE6'
7663 ,p_attribute6_value => p_rec.attribute6
7664 ,p_attribute7_name => 'ATTRIBUTE7'
7665 ,p_attribute7_value => p_rec.attribute7
7666 ,p_attribute8_name => 'ATTRIBUTE8'
7667 ,p_attribute8_value => p_rec.attribute8
7668 ,p_attribute9_name => 'ATTRIBUTE9'
7669 ,p_attribute9_value => p_rec.attribute9
7670 ,p_attribute10_name => 'ATTRIBUTE10'
7671 ,p_attribute10_value => p_rec.attribute10
7672 ,p_attribute11_name => 'ATTRIBUTE11'
7673 ,p_attribute11_value => p_rec.attribute11
7674 ,p_attribute12_name => 'ATTRIBUTE12'
7675 ,p_attribute12_value => p_rec.attribute12
7676 ,p_attribute13_name => 'ATTRIBUTE13'
7677 ,p_attribute13_value => p_rec.attribute13
7678 ,p_attribute14_name => 'ATTRIBUTE14'
7679 ,p_attribute14_value => p_rec.attribute14
7680 ,p_attribute15_name => 'ATTRIBUTE15'
7681 ,p_attribute15_value => p_rec.attribute15
7682 ,p_attribute16_name => 'ATTRIBUTE16'
7683 ,p_attribute16_value => p_rec.attribute16
7684 ,p_attribute17_name => 'ATTRIBUTE17'
7685 ,p_attribute17_value => p_rec.attribute17
7686 ,p_attribute18_name => 'ATTRIBUTE18'
7687 ,p_attribute18_value => p_rec.attribute18
7688 ,p_attribute19_name => 'ATTRIBUTE19'
7689 ,p_attribute19_value => p_rec.attribute19
7690 ,p_attribute20_name => 'ATTRIBUTE20'
7691 ,p_attribute20_value => p_rec.attribute20
7692 ,p_attribute21_name => 'ATTRIBUTE21'
7693 ,p_attribute21_value => p_rec.attribute21
7694 ,p_attribute22_name => 'ATTRIBUTE22'
7695 ,p_attribute22_value => p_rec.attribute22
7696 ,p_attribute23_name => 'ATTRIBUTE23'
7697 ,p_attribute23_value => p_rec.attribute23
7698 ,p_attribute24_name => 'ATTRIBUTE24'
7699 ,p_attribute24_value => p_rec.attribute24
7700 ,p_attribute25_name => 'ATTRIBUTE25'
7701 ,p_attribute25_value => p_rec.attribute25
7702 ,p_attribute26_name => 'ATTRIBUTE26'
7703 ,p_attribute26_value => p_rec.attribute26
7704 ,p_attribute27_name => 'ATTRIBUTE27'
7705 ,p_attribute27_value => p_rec.attribute27
7706 ,p_attribute28_name => 'ATTRIBUTE28'
7707 ,p_attribute28_value => p_rec.attribute28
7708 ,p_attribute29_name => 'ATTRIBUTE29'
7709 ,p_attribute29_value => p_rec.attribute29
7710 ,p_attribute30_name => 'ATTRIBUTE30'
7711 ,p_attribute30_value => p_rec.attribute30
7712 );
7713 end if;
7714 --
7715 if g_debug then
7716 hr_utility.set_location(' Leaving:'||l_proc, 20);
7717 end if;
7718
7719 end chk_df;
7720 --
7721 -- ----------------------------------------------------------------------------
7722 -- |---------------------------< insert_validate >----------------------------|
7723 -- ----------------------------------------------------------------------------
7724 Procedure insert_validate
7725 (p_rec in out nocopy per_per_shd.g_rec_type,
7726 p_effective_date in date,
7727 p_datetrack_mode in varchar2,
7728 p_validation_start_date in date,
7729 p_validation_end_date in date,
7730 p_name_combination_warning out nocopy boolean,
7731 p_dob_null_warning out nocopy boolean,
7732 p_orig_hire_warning out nocopy boolean) is
7733 --
7734 l_proc varchar2(72);
7735 l_legislation_code per_business_groups.legislation_code%TYPE;
7736 --
7737 l_first_name per_all_people_f.first_name%TYPE;
7738 l_last_name per_all_people_f.last_name%TYPE;
7739 l_output varchar2(150);
7740 l_rgeflg varchar2(10);
7741 l_duplicate_flag varchar2(1);
7742 --
7743 cursor csr_bg is
7744 select legislation_code
7745 from per_business_groups pbg
7746 where pbg.business_group_id = p_rec.business_group_id;
7747 --
7748 -- Added for 3104595 starts here
7749 cursor csr_bg_start_date is
7750 select date_from
7751 from per_business_groups pbg
7752 where pbg.business_group_id = p_rec.business_group_id;
7753 --
7754 l_bg_start_date date;
7755 -- Added for 3104595 ends here
7756 --
7757 --
7758 Begin
7759 if g_debug then
7760 l_proc := g_package||'insert_validate';
7761 hr_utility.set_location('Entering:'||l_proc, 10);
7762 end if;
7763 --
7764 -- Set global variable used to improve calling of return_system_status_type
7765 -- when called multiple times on same pass through the validation process.
7766 -- A null value indicates that the function has not been called on this pass
7767 -- through the validation process.
7768 --
7769 g_previous_sys_per_type := NULL;
7770 --
7771 -- Check that no unsupported attributes have been set.
7772 --
7773 per_per_bus1.chk_unsupported_attributes
7774 (p_person_id => p_rec.person_id
7775 ,p_fast_path_employee => p_rec.fast_path_employee
7776 ,p_order_name => p_rec.order_name
7777 ,p_projected_start_date => p_rec.projected_start_date
7778 ,p_rehire_authorizor => p_rec.rehire_authorizor
7779 ,p_effective_date => p_effective_date
7780 ,p_object_version_number => p_rec.object_version_number
7781 );
7782 --
7783 -- Call all supporting business operations
7784 -- Mapping to the appropriate Business Rules in perper.bru is provided.
7785 --
7786 -- Validate Business Group Id
7787 --
7788 hr_api.validate_bus_grp_id
7789 (p_business_group_id => p_rec.business_group_id
7790 ,p_associated_column1 => per_per_shd.g_tab_nam || '.BUSINESS_GROUP_ID'
7791 );
7792 hr_multi_message.end_validation_set;
7793 if g_debug then
7794 hr_utility.set_location(l_proc, 20);
7795 end if;
7796 --
7797 -- Validate Correspondence Language
7798 --
7799 per_per_bus1.chk_correspondence_language
7800 (p_person_id => p_rec.person_id
7801 ,p_effective_date => p_effective_date
7802 ,p_correspondence_language => p_rec.correspondence_language
7803 ,p_object_version_number => p_rec.object_version_number);
7804 --
7805 -- Added for 3104595 starts here
7806 open csr_bg_start_date;
7807 fetch csr_bg_start_date into l_bg_start_date;
7808 -- Modified the check condition as part of fix 5407679
7809 if csr_bg_start_date%found then
7810 if l_bg_start_date > p_rec.effective_start_date then
7811 fnd_message.set_name('PER','HR_52383_EFF_DATE_RANGE');
7812 fnd_message.raise_error;
7813 end if;
7814 end if;
7815 close csr_bg_start_date;
7816 --
7817 -- Added for 3104595 ends here
7818 --
7819 --
7820 -- Validate FTE capacity
7821 --
7822 per_per_bus1.chk_fte_capacity
7823 (p_person_id => p_rec.person_id
7824 ,p_effective_date => p_effective_date
7825 ,p_fte_capacity => p_rec.fte_capacity
7826 ,p_object_version_number => p_rec.object_version_number);
7827 --
7828 -- Validate Background Check Status
7829 --
7830 per_per_bus1.chk_BACKGROUND_CHECK_STATUS
7831 (p_person_id => p_rec.person_id
7832 ,p_BACKGROUND_CHECK_STATUS => p_rec.BACKGROUND_CHECK_STATUS
7833 ,p_effective_date => p_effective_date
7834 ,p_validation_start_date => p_validation_start_date
7835 ,p_validation_end_date => p_validation_end_date
7836 ,p_object_version_number => p_rec.object_version_number
7837 );
7838 if g_debug then
7839 hr_utility.set_location(l_proc, 30);
7840 end if;
7841 --
7842 -- Validate Blood Type
7843 --
7844 per_per_bus1.chk_blood_type
7845 (p_person_id => p_rec.person_id
7846 ,p_blood_type => p_rec.blood_type
7847 ,p_effective_date => p_effective_date
7848 ,p_validation_start_date => p_validation_start_date
7849 ,p_validation_end_date => p_validation_end_date
7850 ,p_object_version_number => p_rec.object_version_number
7851 );
7852 if g_debug then
7853 hr_utility.set_location(l_proc, 40);
7854 end if;
7855 --
7856 -- Validate Student Status
7857 --
7858 per_per_bus1.chk_student_status
7859 (p_person_id => p_rec.person_id
7860 ,p_student_status => p_rec.student_status
7861 ,p_effective_date => p_effective_date
7862 ,p_validation_start_date => p_validation_start_date
7863 ,p_validation_end_date => p_validation_end_date
7864 ,p_object_version_number => p_rec.object_version_number
7865 );
7866 if g_debug then
7867 hr_utility.set_location(l_proc, 50);
7868 end if;
7869 --
7870 -- Validate Work Schedule
7871 --
7872 per_per_bus1.chk_work_schedule
7873 (p_person_id => p_rec.person_id
7874 ,p_work_schedule => p_rec.work_schedule
7875 ,p_effective_date => p_effective_date
7876 ,p_validation_start_date => p_validation_start_date
7877 ,p_validation_end_date => p_validation_end_date
7878 ,p_object_version_number => p_rec.object_version_number
7879 );
7880 if g_debug then
7881 hr_utility.set_location(l_proc, 60);
7882 end if;
7883 --
7884 -- Validate Rehire Recommendation
7885 --
7886 per_per_bus1.chk_rehire_recommendation
7887 (p_person_id => p_rec.person_id
7888 ,p_rehire_recommendation => p_rec.rehire_recommendation
7889 ,p_effective_date => p_effective_date
7890 ,p_validation_start_date => p_validation_start_date
7891 ,p_validation_end_date => p_validation_end_date
7892 ,p_object_version_number => p_rec.object_version_number
7893 );
7894 if g_debug then
7895 hr_utility.set_location(l_proc, 70);
7896 end if;
7897 --
7898 -- Validate Benefit Group Id
7899 --
7900 per_per_bus1.chk_benefit_group_id
7901 (p_person_id => p_rec.person_id
7902 ,p_benefit_group_id => p_rec.benefit_group_id
7903 ,p_effective_date => p_effective_date
7904 ,p_object_version_number => p_rec.object_version_number
7905 );
7906 if g_debug then
7907 hr_utility.set_location(l_proc, 80);
7908 end if;
7909 --
7910 -- Validate Receipt of Death Certificate date.
7911 --
7912 per_per_bus1.chk_date_death_and_rcpt_cert
7913 (p_person_id => p_rec.person_id
7914 ,p_receipt_of_death_cert_date => p_rec.receipt_of_death_cert_date
7915 ,p_effective_date => p_effective_date
7916 ,p_object_version_number => p_rec.object_version_number
7917 ,p_date_of_death => p_rec.date_of_death
7918 );
7919 if g_debug then
7920 hr_utility.set_location(l_proc, 90);
7921 end if;
7922 --
7923 -- Validate the dependent's adoption date.
7924 --
7925 per_per_bus1.chk_birth_adoption_date
7926 (p_person_id => p_rec.person_id
7927 ,p_dpdnt_adoption_date => p_rec.dpdnt_adoption_date
7928 ,p_date_of_birth => p_rec.date_of_birth
7929 ,p_effective_date => p_effective_date
7930 ,p_object_version_number => p_rec.object_version_number
7931 );
7932 if g_debug then
7933 hr_utility.set_location(l_proc, 100);
7934 end if;
7935 --
7936 -- Validate registered disabled flag.
7937 --
7938 per_per_bus1.chk_rd_flag
7939 (p_person_id => p_rec.person_id
7940 ,p_registered_disabled_flag => p_rec.registered_disabled_flag
7941 ,p_effective_date => p_effective_date
7942 ,p_validation_start_date => p_validation_start_date
7943 ,p_validation_end_date => p_validation_end_date
7944 ,p_object_version_number => p_rec.object_version_number
7945 );
7946 if g_debug then
7947 hr_utility.set_location(l_proc, 110);
7948 end if;
7949 --
7950 -- Validate Date of Death.
7951 --
7952 per_per_bus1.chk_date_of_death
7953 (p_person_id => p_rec.person_id
7954 ,p_date_of_death => p_rec.date_of_death
7955 ,p_date_of_birth => p_rec.date_of_birth
7956 ,p_effective_date => p_effective_date
7957 ,p_object_version_number => p_rec.object_version_number
7958 );
7959 if g_debug then
7960 hr_utility.set_location(l_proc, 120);
7961 end if;
7962 --
7963 -- Validate uses tobacco flag.
7964 --
7965 per_per_bus1.chk_uses_tobacco
7966 (p_person_id => p_rec.person_id
7967 ,p_uses_tobacco_flag => p_rec.uses_tobacco_flag
7968 ,p_effective_date => p_effective_date
7969 ,p_validation_start_date => p_validation_start_date
7970 ,p_validation_end_date => p_validation_end_date
7971 ,p_object_version_number => p_rec.object_version_number
7972 );
7973 if g_debug then
7974 hr_utility.set_location(l_proc, 125);
7975 end if;
7976
7977 --
7978 chk_orig_and_start_dates
7979 (p_person_id => p_rec.person_id
7980 ,p_person_type_id => p_rec.person_type_id
7981 ,p_business_group_id => p_rec.business_group_id
7982 ,p_original_date_of_hire => p_rec.original_date_of_hire
7983 ,p_start_date => p_rec.start_date
7984 ,p_effective_date => p_effective_date
7985 ,p_object_version_number => p_rec.object_version_number
7986 ,p_orig_hire_warning => p_orig_hire_warning
7987 );
7988 if g_debug then
7989 hr_utility.set_location(l_proc, 130);
7990 end if;
7991 --
7992 -- Validate Person Type ID
7993 --
7994 chk_person_type_id
7995 (p_person_id => p_rec.person_id
7996 ,p_business_group_id => p_rec.business_group_id
7997 ,p_person_type_id => p_rec.person_type_id
7998 ,p_old_person_type_id => p_rec.person_type_id
7999 ,p_current_employee_flag => p_rec.current_employee_flag
8000 ,p_current_applicant_flag => p_rec.current_applicant_flag
8001 ,p_current_emp_or_apl_flag => p_rec.current_emp_or_apl_flag
8002 ,p_effective_date => p_effective_date
8003 ,p_validation_start_date => p_validation_start_date
8004 ,p_object_version_number => p_rec.object_version_number
8005 ,p_datetrack_mode => p_datetrack_mode
8006 );
8007 if g_debug then
8008 hr_utility.set_location(l_proc, 30);
8009 end if;
8010 --
8011 -- Set current flags
8012 --
8013 set_current_flags
8014 (p_person_id => p_rec.person_id
8015 ,p_business_group_id => p_rec.business_group_id
8016 ,p_person_type_id => p_rec.person_type_id
8017 ,p_current_employee_flag => p_rec.current_employee_flag
8018 ,p_current_applicant_flag => p_rec.current_applicant_flag
8019 ,p_current_emp_or_apl_flag => p_rec.current_emp_or_apl_flag
8020 ,p_effective_date => p_effective_date
8021 ,p_object_version_number => p_rec.object_version_number
8022 );
8023 if g_debug then
8024 hr_utility.set_location(l_proc, 40);
8025 end if;
8026 --
8027 -- Validate National Identifier
8028 --
8029 open csr_bg;
8030 fetch csr_bg into l_legislation_code;
8031 close csr_bg;
8032 chk_national_identifier
8033 (p_person_id => p_rec.person_id
8034 ,p_business_group_id => p_rec.business_group_id
8035 ,p_national_identifier => p_rec.national_identifier
8036 ,p_date_of_birth => p_rec.date_of_birth
8037 ,p_sex => p_rec.sex
8038 ,p_effective_date => p_effective_date
8039 ,p_object_version_number => p_rec.object_version_number
8040 ,p_legislation_code => l_legislation_code
8041 ,p_person_type_id => p_rec.person_type_id
8042
8043 --changed for bug 6241572
8044 ,p_region_of_birth => p_rec.region_of_birth
8045 ,p_country_of_birth => p_rec.country_of_birth
8046 ,p_nationality => p_rec.nationality
8047
8048 );
8049 --
8050 if g_debug then
8051 hr_utility.set_location(l_proc, 50);
8052 end if;
8053 --
8054 -- Validate Employee Number
8055 --
8056 chk_employee_number
8057 (p_person_id => p_rec.person_id
8058 ,p_business_group_id => p_rec.business_group_id
8059 ,p_person_type_id => p_rec.person_type_id
8060 ,p_employee_number => p_rec.employee_number
8061 ,p_national_identifier => p_rec.national_identifier
8062 ,p_effective_date => p_effective_date
8063 ,p_object_version_number => p_rec.object_version_number
8064 ,p_party_id => p_rec.party_id
8065 ,p_date_of_birth => p_rec.date_of_birth
8066 ,p_start_date => p_rec.effective_start_date
8067 );
8068 if g_debug then
8069 hr_utility.set_location(l_proc, 60);
8070 end if;
8071 --
8072 chk_npw_number
8073 (p_person_id => p_rec.person_id
8074 ,p_business_group_id => p_rec.business_group_id
8075 ,p_current_npw_flag => p_rec.current_npw_flag
8076 ,p_npw_number => p_rec.npw_number
8077 ,p_national_identifier => p_rec.national_identifier
8078 ,p_effective_date => p_effective_date
8079 ,p_object_version_number => p_rec.object_version_number
8080 ,p_party_id => p_rec.party_id
8081 ,p_date_of_birth => p_rec.date_of_birth
8082 ,p_start_date => p_rec.effective_start_date
8083 );
8084 if g_debug then
8085 hr_utility.set_location(l_proc, 65);
8086 end if;
8087 --
8088 chk_expense_check_send_to_addr
8089 (p_person_id => p_rec.person_id
8090 ,p_expense_check_send_to_addres => p_rec.expense_check_send_to_address
8091 ,p_effective_date => p_effective_date
8092 ,p_validation_start_date => p_validation_start_date
8093 ,p_validation_end_date => p_validation_end_date
8094 ,p_object_version_number => p_rec.object_version_number
8095 );
8096 if g_debug then
8097 hr_utility.set_location(l_proc, 70);
8098 end if;
8099 --
8100 -- Validate Start Date
8101 --
8102 chk_start_date
8103 (p_person_id => p_rec.person_id
8104 ,p_start_date => p_rec.start_date
8105 ,p_effective_date => p_effective_date
8106 ,p_object_version_number => p_rec.object_version_number
8107 );
8108 if g_debug then
8109 hr_utility.set_location(l_proc, 80);
8110 end if;
8111 --
8112 -- Validate Nationality
8113 --
8114 chk_nationality
8115 (p_person_id => p_rec.person_id
8116 ,p_nationality => p_rec.nationality
8117 ,p_effective_date => p_effective_date
8118 ,p_validation_start_date => p_validation_start_date
8119 ,p_validation_end_date => p_validation_end_date
8120 ,p_object_version_number => p_rec.object_version_number
8121 );
8122 if g_debug then
8123 hr_utility.set_location(l_proc, 90);
8124 end if;
8125 --
8126 -- Validate Marital Status
8127 --
8128 chk_marital_status
8129 (p_person_id => p_rec.person_id
8130 ,p_marital_status => p_rec.marital_status
8131 ,p_effective_date => p_effective_date
8132 ,p_validation_start_date => p_validation_start_date
8133 ,p_validation_end_date => p_validation_end_date
8134 ,p_object_version_number => p_rec.object_version_number
8135 );
8136 if g_debug then
8137 hr_utility.set_location(l_proc, 100);
8138 end if;
8139 --
8140 chk_party_id
8141 (p_person_id => p_rec.person_id
8142 ,p_party_id => p_rec.party_id
8143 ,p_effective_date => p_effective_date
8144 ,p_object_version_number => p_rec.object_version_number);
8145 --
8146 -- Validate Sex and Title
8147 --
8148 chk_sex_title
8149 (p_person_id => p_rec.person_id
8150 ,p_business_group_id => p_rec.business_group_id
8151 ,p_person_type_id => p_rec.person_type_id
8152 ,p_title => p_rec.title
8153 ,p_sex => p_rec.sex
8154 ,p_effective_date => p_effective_date
8155 ,p_validation_start_date => p_validation_start_date
8156 ,p_validation_end_date => p_validation_end_date
8157 ,p_object_version_number => p_rec.object_version_number
8158 );
8159 if g_debug then
8160 hr_utility.set_location(l_proc, 110);
8161 end if;
8162 --
8163 -- Validate Date of Birth
8164 --
8165 chk_date_of_birth
8166 (p_person_id => p_rec.person_id
8167 ,p_person_type_id => p_rec.person_type_id
8168 ,p_business_group_id => p_rec.business_group_id
8169 ,p_start_date => p_rec.start_date
8170 ,p_date_of_birth => p_rec.date_of_birth
8171 ,p_dob_null_warning => p_dob_null_warning
8172 ,p_effective_date => p_effective_date
8173 ,p_validation_start_date => p_validation_start_date
8174 ,p_validation_end_date => p_validation_end_date
8175 ,p_object_version_number => p_rec.object_version_number
8176 );
8177 --
8178 -- Validate Town of Birth
8179 --
8180 chk_town_of_birth
8181 (p_person_id => p_rec.person_id
8182 ,p_town_of_birth => p_rec.town_of_birth
8183 ,p_effective_date => p_effective_date
8184 ,p_validation_start_date => p_validation_start_date
8185 ,p_validation_end_date => p_validation_end_date
8186 ,p_legislation_code => l_legislation_code
8187 );
8188 --
8189 -- Validate Region of Birth
8190 --
8191 chk_region_of_birth
8192 (p_person_id => p_rec.person_id
8193 ,p_region_of_birth => p_rec.region_of_birth
8194 ,p_effective_date => p_effective_date
8195 ,p_validation_start_date => p_validation_start_date
8196 ,p_validation_end_date => p_validation_end_date
8197 ,p_legislation_code => l_legislation_code
8198 );
8199 --
8200 -- Validate Country of Birth
8201 --
8202 chk_country_of_birth
8203 (p_person_id => p_rec.person_id
8204 ,p_country_of_birth => p_rec.country_of_birth
8205 );
8206
8207 -- Fix 3573040
8208 -- Derive per_information_category parameter internally
8209 --
8210 chk_per_information_category
8211 (p_per_information_category => p_rec.per_information_category
8212 ,p_legislation_code => l_legislation_code
8213 );
8214 --
8215 -- Set Full Name, Order Name, List Names (Global and Local)
8216 --
8217 return_full_name
8218 (p_person_id => p_rec.person_id
8219 ,p_business_group_id => p_rec.business_group_id
8220 ,p_first_name => p_rec.first_name
8221 ,p_middle_names => p_rec.middle_names
8222 ,p_last_name => p_rec.last_name
8223 ,p_known_as => p_rec.known_as
8224 ,p_title => p_rec.title
8225 ,p_date_of_birth => p_rec.date_of_birth
8226 ,p_suffix => p_rec.suffix
8227 ,p_pre_name_adjunct => p_rec.pre_name_adjunct
8228 ,p_effective_date => p_effective_date
8229 ,p_object_version_number => p_rec.object_version_number,
8230 p_previous_last_name => p_rec.previous_last_name,
8231 p_email_address => p_rec.email_address ,
8232 p_employee_number => p_rec.employee_number ,
8233 p_applicant_number => p_rec.applicant_number ,
8234 p_npw_number => p_rec.npw_number ,
8235 p_per_information1 => p_rec.per_information1 ,
8236 p_per_information2 => p_rec.per_information2 ,
8237 p_per_information3 => p_rec.per_information3 ,
8238 p_per_information4 => p_rec.per_information4 ,
8239 p_per_information5 => p_rec.per_information5 ,
8240 p_per_information6 => p_rec.per_information6 ,
8241 p_per_information7 => p_rec.per_information7 ,
8242 p_per_information8 => p_rec.per_information8 ,
8243 p_per_information9 => p_rec.per_information9 ,
8244 p_per_information10 => p_rec.per_information10 ,
8245 p_per_information11 => p_rec.per_information11 ,
8246 p_per_information12 => p_rec.per_information12 ,
8247 p_per_information13 => p_rec.per_information13 ,
8248 p_per_information14 => p_rec.per_information14 ,
8249 p_per_information15 => p_rec.per_information15 ,
8250 p_per_information16 => p_rec.per_information16 ,
8251 p_per_information17 => p_rec.per_information17 ,
8252 p_per_information18 => p_rec.per_information18 ,
8253 p_per_information19 => p_rec.per_information19 ,
8254 p_per_information20 => p_rec.per_information20 ,
8255 p_per_information21 => p_rec.per_information21 ,
8256 p_per_information22 => p_rec.per_information22 ,
8257 p_per_information23 => p_rec.per_information23 ,
8258 p_per_information24 => p_rec.per_information24 ,
8259 p_per_information25 => p_rec.per_information25 ,
8260 p_per_information26 => p_rec.per_information26 ,
8261 p_per_information27 => p_rec.per_information27 ,
8262 p_per_information28 => p_rec.per_information28 ,
8263 p_per_information29 => p_rec.per_information29 ,
8264 p_per_information30 => p_rec.per_information30 ,
8265 p_attribute1 => p_rec.attribute1 ,
8266 p_attribute2 => p_rec.attribute2 ,
8267 p_attribute3 => p_rec.attribute3 ,
8268 p_attribute4 => p_rec.attribute4 ,
8269 p_attribute5 => p_rec.attribute5 ,
8270 p_attribute6 => p_rec.attribute6 ,
8271 p_attribute7 => p_rec.attribute7 ,
8272 p_attribute8 => p_rec.attribute8 ,
8273 p_attribute9 => p_rec.attribute9 ,
8274 p_attribute10 => p_rec.attribute10 ,
8275 p_attribute11 => p_rec.attribute11 ,
8276 p_attribute12 => p_rec.attribute12 ,
8277 p_attribute13 => p_rec.attribute13 ,
8278 p_attribute14 => p_rec.attribute14 ,
8279 p_attribute15 => p_rec.attribute15 ,
8280 p_attribute16 => p_rec.attribute16 ,
8281 p_attribute17 => p_rec.attribute17 ,
8282 p_attribute18 => p_rec.attribute18 ,
8283 p_attribute19 => p_rec.attribute19 ,
8284 p_attribute20 => p_rec.attribute20 ,
8285 p_attribute21 => p_rec.attribute21 ,
8286 p_attribute22 => p_rec.attribute22 ,
8287 p_attribute23 => p_rec.attribute23,
8288 p_attribute24 => p_rec.attribute24,
8289 p_attribute25 => p_rec.attribute25,
8290 p_attribute26 => p_rec.attribute26,
8291 p_attribute27 => p_rec.attribute27,
8292 p_attribute28 => p_rec.attribute28,
8293 p_attribute29 => p_rec.attribute29,
8294 p_attribute30 => p_rec.attribute30,
8295 p_full_name => p_rec.full_name,
8296 p_order_name => p_rec.order_name,
8297 p_global_name => p_rec.global_name,
8298 p_local_name => p_rec.local_name
8299 ,p_duplicate_flag => l_duplicate_flag
8300 ,p_name_combination_warning => p_name_combination_warning
8301 );
8302
8303 if g_debug then
8304 hr_utility.set_location(l_proc, 130);
8305 end if;
8306 /* Bug#3613987 - Removed chk_JP_names procedure
8307 --
8308 -- Create full_name for JP legislation
8309 --
8310 if l_legislation_code = 'JP' then
8311 --
8312 chk_JP_names
8313 (p_person_id => p_rec.person_id
8314 ,p_effective_date => p_effective_date
8315 ,p_object_version_number => p_rec.object_version_number
8316 ,p_first_name => p_rec.first_name
8317 ,p_last_name => p_rec.last_name
8318 ,p_per_information18 => p_rec.per_information18
8319 ,p_per_information19 => p_rec.per_information19);
8320 --,p_full_name => p_rec.full_name ); -- bug# 2689366
8321 --
8322 end if;
8323 */
8324 if g_debug then
8325 hr_utility.set_location(l_proc, 145);
8326 end if;
8327 --
8328 -- Validate Applicant Number
8329 --
8330 chk_applicant_number
8331 (p_person_id => p_rec.person_id
8332 ,p_applicant_number => p_rec.applicant_number
8333 ,p_business_group_id => p_rec.business_group_id
8334 ,p_current_applicant => p_rec.current_applicant_flag
8335 ,p_person_type_id => p_rec.person_type_id
8336 ,p_effective_date => p_effective_date
8337 ,p_object_version_number => p_rec.object_version_number
8338 ,p_party_id => p_rec.party_id
8339 ,p_date_of_birth => p_rec.date_of_birth
8340 ,p_start_date => null
8341 );
8342 if g_debug then
8343 hr_utility.set_location(l_proc, 150);
8344 end if;
8345 --
8346 -- Validate Date Employee Data Verified
8347 --
8348 chk_date_emp_data_verified
8349 (p_person_id => p_rec.person_id
8350 ,p_date_employee_data_verified => p_rec.date_employee_data_verified
8351 ,p_effective_start_date => p_validation_start_date
8352 ,p_object_version_number => p_rec.object_version_number
8353 );
8354 if g_debug then
8355 hr_utility.set_location(l_proc, 160);
8356 end if;
8357 --
8358 --
8359 -- Validate Vendor Id
8360 --
8361 chk_vendor_id
8362 (p_person_id => p_rec.person_id
8363 ,p_vendor_id => p_rec.vendor_id
8364 ,p_person_type_id => p_rec.person_type_id
8365 ,p_business_group_id => p_rec.business_group_id
8366 ,p_effective_date => p_effective_date
8367 ,p_object_version_number => p_rec.object_version_number
8368 );
8369 if g_debug then
8370 hr_utility.set_location(l_proc, 180);
8371 end if;
8372 --
8373 chk_suffix
8374 (p_person_id => p_rec.person_id
8375 ,p_suffix => p_rec.suffix
8376 ,p_effective_date => p_effective_date
8377 ,p_object_version_number => p_rec.object_version_number
8378 );
8379 if g_debug then
8380 hr_utility.set_location(l_proc, 190);
8381 end if;
8382 --
8383 -- Validate work telephone
8384 --
8385 chk_work_telephone
8386 (p_person_id => p_rec.person_id
8387 ,p_work_telephone => p_rec.work_telephone
8388 ,p_effective_date => p_effective_date
8389 ,p_object_version_number => p_rec.object_version_number
8390 );
8391 --
8392 -- Validate benefit medical coverage dates
8393 --
8394 per_per_bus1.chk_coord_ben_med_cvg_dates
8395 (p_coord_ben_med_cvg_strt_dt => p_rec.coord_ben_med_cvg_strt_dt
8396 ,p_coord_ben_med_cvg_end_dt => p_rec.coord_ben_med_cvg_end_dt
8397 );
8398 --
8399 -- Validate benefit medical details
8400 --
8401 per_per_bus1.chk_coord_ben_med_details
8402 (p_coord_ben_med_cvg_strt_dt => p_rec.coord_ben_med_cvg_strt_dt
8403 ,p_coord_ben_med_cvg_end_dt => p_rec.coord_ben_med_cvg_end_dt
8404 ,p_coord_ben_med_ext_er => p_rec.coord_ben_med_ext_er
8405 ,p_coord_ben_med_pl_name => p_rec.coord_ben_med_pl_name
8406 ,p_coord_ben_med_insr_crr_name => p_rec.coord_ben_med_insr_crr_name
8407 ,p_coord_ben_med_insr_crr_ident => p_rec.coord_ben_med_insr_crr_ident
8408 );
8409 --
8410 -- Check other benefit coverage rules
8411 --
8412 per_per_bus1.chk_other_coverages
8413 (p_attribute10 => p_rec.attribute10
8414 ,p_coord_ben_med_insr_crr_name => p_rec.coord_ben_med_insr_crr_name
8415 ,p_coord_ben_med_cvg_end_dt => p_rec.coord_ben_med_cvg_end_dt
8416 ,p_coord_ben_no_cvg_flag => p_rec.coord_ben_no_cvg_flag
8417 ,p_effective_date => p_effective_date
8418 );
8419 --
8420 -- Validate Developer Descriptive Flexfields
8421 --
8422 chk_per_information
8423 (p_rec => p_rec
8424 ,p_effective_date => p_effective_date
8425 ,p_validation_start_date => p_validation_start_date
8426 ,p_validation_end_date => p_validation_end_date
8427 );
8428 if g_debug then
8429 hr_utility.set_location(l_proc, 200);
8430 end if;
8431 --
8432 -- Validate flex fields.
8433 --
8434 per_per_bus.chk_df(p_rec => p_rec);
8435 if g_debug then
8436 hr_utility.set_location(l_proc, 210);
8437 end if;
8438 --
8439 if g_debug then
8440 hr_utility.set_location(' Leaving:'||l_proc, 10000);
8441 end if;
8442 End insert_validate;
8443 --
8444 -- ----------------------------------------------------------------------------
8445 -- |---------------------------< update_validate >----------------------------|
8446 -- ----------------------------------------------------------------------------
8447 Procedure update_validate
8448 (p_rec in out nocopy per_per_shd.g_rec_type,
8449 p_effective_date in date,
8450 p_datetrack_mode in varchar2,
8451 p_validation_start_date in date,
8452 p_validation_end_date in date,
8453 p_name_combination_warning out nocopy boolean,
8454 p_dob_null_warning out nocopy boolean,
8455 p_orig_hire_warning out nocopy boolean) is
8456 --
8457 l_proc varchar2(72);
8458 l_legislation_code per_business_groups.legislation_code%TYPE;
8459 --
8460 l_first_name per_all_people_f.first_name%TYPE;
8461 l_last_name per_all_people_f.last_name%TYPE;
8462 l_output varchar2(150);
8463 l_rgeflg varchar2(10);
8464 l_duplicate_flag varchar2(1);
8465 --
8466 cursor csr_bg is
8467 select legislation_code
8468 from per_business_groups pbg
8469 where pbg.business_group_id = p_rec.business_group_id;
8470 --
8471 Begin
8472 if g_debug then
8473 l_proc := g_package||'update_validate';
8474 hr_utility.set_location('Entering:'||l_proc, 10);
8475 end if;
8476 --
8477 -- Set global variable used to improve calling of return_system_status_type
8478 -- when called multiple times on same pass through the validation process.
8479 -- A null value indicates that the function has not been called on this pass
8480 -- through the validation process.
8481 --
8482 g_previous_sys_per_type := NULL;
8483 --
8484 -- Validate Business Group Id
8485 --
8486 hr_api.validate_bus_grp_id
8487 (p_business_group_id => p_rec.business_group_id
8488 ,p_associated_column1 => per_per_shd.g_tab_nam || '.BUSINESS_GROUP_ID'
8489 );
8490 hr_multi_message.end_validation_set;
8491 --
8492 --
8493 -- Check that no unsupported attributes have been set.
8494 --
8495 per_per_bus1.chk_unsupported_attributes
8496 (p_person_id => p_rec.person_id
8497 ,p_fast_path_employee => p_rec.fast_path_employee
8498 ,p_order_name => p_rec.order_name
8499 ,p_projected_start_date => p_rec.projected_start_date
8500 ,p_rehire_authorizor => p_rec.rehire_authorizor
8501 ,p_effective_date => p_effective_date
8502 ,p_object_version_number => p_rec.object_version_number
8503 );
8504 --
8505 -- Validate Correspondence Language
8506 --
8507 per_per_bus1.chk_correspondence_language
8508 (p_person_id => p_rec.person_id
8509 ,p_effective_date => p_effective_date
8510 ,p_correspondence_language => p_rec.correspondence_language
8511 ,p_object_version_number => p_rec.object_version_number);
8512 --
8513 -- Validate FTE capacity
8514 --
8515 per_per_bus1.chk_fte_capacity
8516 (p_person_id => p_rec.person_id
8517 ,p_effective_date => p_effective_date
8518 ,p_fte_capacity => p_rec.fte_capacity
8519 ,p_object_version_number => p_rec.object_version_number);
8520 --
8521 -- Validate Background Check Status
8522 --
8523 per_per_bus1.chk_BACKGROUND_CHECK_STATUS
8524 (p_person_id => p_rec.person_id
8525 ,p_BACKGROUND_CHECK_STATUS => p_rec.BACKGROUND_CHECK_STATUS
8526 ,p_effective_date => p_effective_date
8527 ,p_validation_start_date => p_validation_start_date
8528 ,p_validation_end_date => p_validation_end_date
8529 ,p_object_version_number => p_rec.object_version_number
8530 );
8531 if g_debug then
8532 hr_utility.set_location(l_proc, 30);
8533 end if;
8534 --
8535 -- Validate Blood Type
8536 --
8537 per_per_bus1.chk_blood_type
8538 (p_person_id => p_rec.person_id
8539 ,p_blood_type => p_rec.blood_type
8540 ,p_effective_date => p_effective_date
8541 ,p_validation_start_date => p_validation_start_date
8542 ,p_validation_end_date => p_validation_end_date
8543 ,p_object_version_number => p_rec.object_version_number
8544 );
8545 if g_debug then
8546 hr_utility.set_location(l_proc, 40);
8547 end if;
8548 --
8549 -- Validate Student Status
8550 --
8551 per_per_bus1.chk_student_status
8552 (p_person_id => p_rec.person_id
8553 ,p_student_status => p_rec.student_status
8554 ,p_effective_date => p_effective_date
8555 ,p_validation_start_date => p_validation_start_date
8556 ,p_validation_end_date => p_validation_end_date
8557 ,p_object_version_number => p_rec.object_version_number
8558 );
8559 if g_debug then
8560 hr_utility.set_location(l_proc, 50);
8561 end if;
8562 --
8563 -- Validate Work Schedule
8564 --
8565 per_per_bus1.chk_work_schedule
8566 (p_person_id => p_rec.person_id
8567 ,p_work_schedule => p_rec.work_schedule
8568 ,p_effective_date => p_effective_date
8569 ,p_validation_start_date => p_validation_start_date
8570 ,p_validation_end_date => p_validation_end_date
8571 ,p_object_version_number => p_rec.object_version_number
8572 );
8573 if g_debug then
8574 hr_utility.set_location(l_proc, 60);
8575 end if;
8576 --
8577 -- Validate Rehire Recommendation
8578 --
8579 per_per_bus1.chk_rehire_recommendation
8580 (p_person_id => p_rec.person_id
8581 ,p_rehire_recommendation => p_rec.rehire_recommendation
8582 ,p_effective_date => p_effective_date
8583 ,p_validation_start_date => p_validation_start_date
8584 ,p_validation_end_date => p_validation_end_date
8585 ,p_object_version_number => p_rec.object_version_number
8586 );
8587 if g_debug then
8588 hr_utility.set_location(l_proc, 70);
8589 end if;
8590 --
8591 -- Validate Benefit Group Id
8592 --
8593 per_per_bus1.chk_benefit_group_id
8594 (p_person_id => p_rec.person_id
8595 ,p_benefit_group_id => p_rec.benefit_group_id
8596 ,p_effective_date => p_effective_date
8597 ,p_object_version_number => p_rec.object_version_number
8598 );
8599 if g_debug then
8600 hr_utility.set_location(l_proc, 80);
8601 end if;
8602 --
8603 -- Validate Receipt of Death Certificate date.
8604 --
8605 per_per_bus1.chk_date_death_and_rcpt_cert
8606 (p_person_id => p_rec.person_id
8607 ,p_receipt_of_death_cert_date => p_rec.receipt_of_death_cert_date
8608 ,p_effective_date => p_effective_date
8609 ,p_object_version_number => p_rec.object_version_number
8610 ,p_date_of_death => p_rec.date_of_death
8611 );
8612 if g_debug then
8613 hr_utility.set_location(l_proc, 90);
8614 end if;
8615 --
8616 -- Validate the dependent's adoption date.
8617 --
8618 per_per_bus1.chk_birth_adoption_date
8619 (p_person_id => p_rec.person_id
8620 ,p_dpdnt_adoption_date => p_rec.dpdnt_adoption_date
8621 ,p_date_of_birth => p_rec.date_of_birth
8622 ,p_effective_date => p_effective_date
8623 ,p_object_version_number => p_rec.object_version_number
8624 );
8625 if g_debug then
8626 hr_utility.set_location(l_proc, 100);
8627 end if;
8628 --
8629 -- Validate registered disabled flag.
8630 --
8631 per_per_bus1.chk_rd_flag
8632 (p_person_id => p_rec.person_id
8633 ,p_registered_disabled_flag => p_rec.registered_disabled_flag
8634 ,p_effective_date => p_effective_date
8635 ,p_validation_start_date => p_validation_start_date
8636 ,p_validation_end_date => p_validation_end_date
8637 ,p_object_version_number => p_rec.object_version_number
8638 );
8639 if g_debug then
8640 hr_utility.set_location(l_proc, 110);
8641 end if;
8642 --
8643 -- Validate Date of Death.
8644 --
8645 per_per_bus1.chk_date_of_death
8646 (p_person_id => p_rec.person_id
8647 ,p_date_of_death => p_rec.date_of_death
8648 ,p_date_of_birth => p_rec.date_of_birth
8649 ,p_effective_date => p_effective_date
8650 ,p_object_version_number => p_rec.object_version_number
8651 );
8652 if g_debug then
8653 hr_utility.set_location(l_proc, 120);
8654 end if;
8655 --
8656 -- Validate uses tobacco flag.
8657 --
8658 per_per_bus1.chk_uses_tobacco
8659 (p_person_id => p_rec.person_id
8660 ,p_uses_tobacco_flag => p_rec.uses_tobacco_flag
8661 ,p_effective_date => p_effective_date
8662 ,p_validation_start_date => p_validation_start_date
8663 ,p_validation_end_date => p_validation_end_date
8664 ,p_object_version_number => p_rec.object_version_number
8665 );
8666 if g_debug then
8667 hr_utility.set_location(l_proc, 125);
8668 end if;
8669 --
8670 chk_orig_and_start_dates
8671 (p_person_id => p_rec.person_id
8672 ,p_person_type_id => p_rec.person_type_id
8673 ,p_business_group_id => p_rec.business_group_id
8674 ,p_original_date_of_hire => p_rec.original_date_of_hire
8675 ,p_start_date => p_rec.start_date
8676 ,p_effective_date => p_effective_date
8677 ,p_object_version_number => p_rec.object_version_number
8678 ,p_orig_hire_warning => p_orig_hire_warning
8679 );
8680 if g_debug then
8681 hr_utility.set_location(l_proc, 130);
8682 end if;
8683 --
8684 -- Call all supporting business operations
8685 -- Mapping to the appropriate Business Rules in perper.bru is provided.
8686 --
8687 -- Validate Person Type ID
8688 --
8689 chk_person_type_id
8690 (p_person_id => p_rec.person_id
8691 ,p_business_group_id => p_rec.business_group_id
8692 ,p_person_type_id => p_rec.person_type_id
8693 ,p_old_person_type_id => per_per_shd.g_old_rec.person_type_id
8694 ,p_current_employee_flag => p_rec.current_employee_flag
8695 ,p_current_applicant_flag => p_rec.current_applicant_flag
8696 ,p_current_emp_or_apl_flag => p_rec.current_emp_or_apl_flag
8697 ,p_effective_date => p_effective_date
8698 ,p_validation_start_date => p_validation_start_date
8699 ,p_object_version_number => p_rec.object_version_number
8700 ,p_datetrack_mode => p_datetrack_mode
8701 );
8702 if g_debug then
8703 hr_utility.set_location(l_proc, 20);
8704 end if;
8705 --
8706 --
8707 -- Validate National Identifier
8708 --
8709 open csr_bg;
8710 fetch csr_bg into l_legislation_code;
8711 close csr_bg;
8712 chk_national_identifier
8713 (p_person_id => p_rec.person_id
8714 ,p_business_group_id => p_rec.business_group_id
8715 ,p_national_identifier => p_rec.national_identifier
8716 ,p_date_of_birth => p_rec.date_of_birth
8717 ,p_sex => p_rec.sex
8718 ,p_effective_date => p_effective_date
8719 ,p_object_version_number => p_rec.object_version_number
8720 ,p_legislation_code => l_legislation_code
8721 ,p_person_type_id => p_rec.person_type_id
8722
8723 --changed for bu 6241572
8724 ,p_region_of_birth => p_rec.region_of_birth
8725 ,p_country_of_birth => p_rec.country_of_birth
8726 ,p_nationality => p_rec.nationality
8727 );
8728 --
8729 if g_debug then
8730 hr_utility.set_location(l_proc, 30);
8731 end if;
8732 --
8733 -- Validate Employee Number
8734 --
8735 chk_employee_number
8736 (p_person_id => p_rec.person_id
8737 ,p_business_group_id => p_rec.business_group_id
8738 ,p_person_type_id => p_rec.person_type_id
8739 ,p_employee_number => p_rec.employee_number
8740 ,p_national_identifier => p_rec.national_identifier
8741 ,p_effective_date => p_effective_date
8742 ,p_object_version_number => p_rec.object_version_number
8743 ,p_party_id => p_rec.party_id
8744 ,p_date_of_birth => p_rec.date_of_birth
8745 ,p_start_date => null
8746 );
8747 if g_debug then
8748 hr_utility.set_location(l_proc, 40);
8749 end if;
8750 --
8751 chk_npw_number
8752 (p_person_id => p_rec.person_id
8753 ,p_business_group_id => p_rec.business_group_id
8754 ,p_current_npw_flag => p_rec.current_npw_flag
8755 ,p_npw_number => p_rec.npw_number
8756 ,p_national_identifier => p_rec.national_identifier
8757 ,p_effective_date => p_effective_date
8758 ,p_object_version_number => p_rec.object_version_number
8759 ,p_party_id => p_rec.party_id
8760 ,p_date_of_birth => p_rec.date_of_birth
8761 ,p_start_date => null
8762 );
8763 if g_debug then
8764 hr_utility.set_location(l_proc, 43);
8765 end if;
8766 --
8767 chk_expense_check_send_to_addr
8768 (p_person_id => p_rec.person_id
8769 ,p_expense_check_send_to_addres => p_rec.expense_check_send_to_address
8770 ,p_effective_date => p_effective_date
8771 ,p_validation_start_date => p_validation_start_date
8772 ,p_validation_end_date => p_validation_end_date
8773 ,p_object_version_number => p_rec.object_version_number
8774 );
8775 if g_debug then
8776 hr_utility.set_location('Entering:'||l_proc, 45);
8777 end if;
8778 --
8779 -- Validate Start Date
8780 --
8781 chk_start_date
8782 (p_person_id => p_rec.person_id
8783 ,p_start_date => p_rec.start_date
8784 ,p_effective_date => p_effective_date
8785 ,p_object_version_number => p_rec.object_version_number
8786 );
8787 if g_debug then
8788 hr_utility.set_location(l_proc, 50);
8789 end if;
8790 --
8791 -- Validate Nationality
8792 --
8793 chk_nationality
8794 (p_person_id => p_rec.person_id
8795 ,p_nationality => p_rec.nationality
8796 ,p_effective_date => p_effective_date
8797 ,p_validation_start_date => p_validation_start_date
8798 ,p_validation_end_date => p_validation_end_date
8799 ,p_object_version_number => p_rec.object_version_number
8800 );
8801 if g_debug then
8802 hr_utility.set_location(l_proc, 60);
8803 end if;
8804 --
8805 chk_party_id
8806 (p_person_id => p_rec.person_id
8807 ,p_party_id => p_rec.party_id
8808 ,p_effective_date => p_effective_date
8809 ,p_object_version_number => p_rec.object_version_number);
8810 --
8811 -- Validate Marital Status
8812 --
8813 chk_marital_status
8814 (p_person_id => p_rec.person_id
8815 ,p_marital_status => p_rec.marital_status
8816 ,p_effective_date => p_effective_date
8817 ,p_validation_start_date => p_validation_start_date
8818 ,p_validation_end_date => p_validation_end_date
8819 ,p_object_version_number => p_rec.object_version_number
8820 );
8821 if g_debug then
8822 hr_utility.set_location(l_proc, 70);
8823 end if;
8824 --
8825 -- Validate Sex and Title
8826 --
8827 chk_sex_title
8828 (p_person_id => p_rec.person_id
8829 ,p_business_group_id => p_rec.business_group_id
8830 ,p_person_type_id => p_rec.person_type_id
8831 ,p_title => p_rec.title
8832 ,p_sex => p_rec.sex
8833 ,p_effective_date => p_effective_date
8834 ,p_validation_start_date => p_validation_start_date
8835 ,p_validation_end_date => p_validation_end_date
8836 ,p_object_version_number => p_rec.object_version_number
8837 );
8838 if g_debug then
8839 hr_utility.set_location(l_proc, 80);
8840 end if;
8841 --
8842 -- Validate Date of Birth
8843 --
8844 chk_date_of_birth
8845 (p_person_id => p_rec.person_id
8846 ,p_person_type_id => p_rec.person_type_id
8847 ,p_business_group_id => p_rec.business_group_id
8848 ,p_start_date => p_rec.start_date
8849 ,p_date_of_birth => p_rec.date_of_birth
8850 ,p_dob_null_warning => p_dob_null_warning
8851 ,p_effective_date => p_effective_date
8852 ,p_validation_start_date => p_validation_start_date
8853 ,p_validation_end_date => p_validation_end_date
8854 ,p_object_version_number => p_rec.object_version_number
8855 );
8856 if g_debug then
8857 hr_utility.set_location(l_proc, 90);
8858 end if;
8859 --
8860 -- Validate Town of Birth
8861 --
8862 chk_town_of_birth
8863 (p_person_id => p_rec.person_id
8864 ,p_town_of_birth => p_rec.town_of_birth
8865 ,p_effective_date => p_effective_date
8866 ,p_validation_start_date => p_validation_start_date
8867 ,p_validation_end_date => p_validation_end_date
8868 ,p_legislation_code => l_legislation_code
8869 );
8870 --
8871 -- Validate Region of Birth
8872 --
8873 chk_region_of_birth
8874 (p_person_id => p_rec.person_id
8875 ,p_region_of_birth => p_rec.region_of_birth
8876 ,p_effective_date => p_effective_date
8877 ,p_validation_start_date => p_validation_start_date
8878 ,p_validation_end_date => p_validation_end_date
8879 ,p_legislation_code => l_legislation_code
8880 );
8881 --
8882 -- Validate Country of Birth
8883 --
8884 chk_country_of_birth
8885 (p_person_id => p_rec.person_id
8886 ,p_country_of_birth => p_rec.country_of_birth
8887 );
8888 -- Fix 3573040
8889 -- Derive per_information_category parameter internally
8890 --
8891 chk_per_information_category
8892 (p_per_information_category => p_rec.per_information_category
8893 ,p_legislation_code => l_legislation_code
8894 );
8895 --
8896 -- Set Full Name, Order Name, List Names (Global and Local)
8897 --
8898 return_full_name
8899 (p_person_id => p_rec.person_id
8900 ,p_business_group_id => p_rec.business_group_id
8901 ,p_first_name => p_rec.first_name
8902 ,p_middle_names => p_rec.middle_names
8903 ,p_last_name => p_rec.last_name
8904 ,p_known_as => p_rec.known_as
8905 ,p_title => p_rec.title
8906 ,p_date_of_birth => p_rec.date_of_birth
8907 ,p_suffix => p_rec.suffix
8908 ,p_pre_name_adjunct => p_rec.pre_name_adjunct
8909 ,p_effective_date => p_effective_date
8910 ,p_object_version_number => p_rec.object_version_number,
8911 p_previous_last_name => p_rec.previous_last_name,
8912 p_email_address => p_rec.email_address ,
8913 p_employee_number => p_rec.employee_number ,
8914 p_applicant_number => p_rec.applicant_number ,
8915 p_npw_number => p_rec.npw_number ,
8916 p_per_information1 => p_rec.per_information1 ,
8917 p_per_information2 => p_rec.per_information2 ,
8918 p_per_information3 => p_rec.per_information3 ,
8919 p_per_information4 => p_rec.per_information4 ,
8920 p_per_information5 => p_rec.per_information5 ,
8921 p_per_information6 => p_rec.per_information6 ,
8922 p_per_information7 => p_rec.per_information7 ,
8923 p_per_information8 => p_rec.per_information8 ,
8924 p_per_information9 => p_rec.per_information9 ,
8925 p_per_information10 => p_rec.per_information10 ,
8926 p_per_information11 => p_rec.per_information11 ,
8927 p_per_information12 => p_rec.per_information12 ,
8928 p_per_information13 => p_rec.per_information13 ,
8929 p_per_information14 => p_rec.per_information14 ,
8930 p_per_information15 => p_rec.per_information15 ,
8931 p_per_information16 => p_rec.per_information16 ,
8932 p_per_information17 => p_rec.per_information17 ,
8933 p_per_information18 => p_rec.per_information18 ,
8934 p_per_information19 => p_rec.per_information19 ,
8935 p_per_information20 => p_rec.per_information20 ,
8936 p_per_information21 => p_rec.per_information21 ,
8937 p_per_information22 => p_rec.per_information22 ,
8938 p_per_information23 => p_rec.per_information23 ,
8939 p_per_information24 => p_rec.per_information24 ,
8940 p_per_information25 => p_rec.per_information25 ,
8941 p_per_information26 => p_rec.per_information26 ,
8942 p_per_information27 => p_rec.per_information27 ,
8943 p_per_information28 => p_rec.per_information28 ,
8944 p_per_information29 => p_rec.per_information29 ,
8945 p_per_information30 => p_rec.per_information30 ,
8946 p_attribute1 => p_rec.attribute1 ,
8947 p_attribute2 => p_rec.attribute2 ,
8948 p_attribute3 => p_rec.attribute3 ,
8949 p_attribute4 => p_rec.attribute4 ,
8950 p_attribute5 => p_rec.attribute5 ,
8951 p_attribute6 => p_rec.attribute6 ,
8952 p_attribute7 => p_rec.attribute7 ,
8953 p_attribute8 => p_rec.attribute8 ,
8954 p_attribute9 => p_rec.attribute9 ,
8955 p_attribute10 => p_rec.attribute10 ,
8956 p_attribute11 => p_rec.attribute11 ,
8957 p_attribute12 => p_rec.attribute12 ,
8958 p_attribute13 => p_rec.attribute13 ,
8959 p_attribute14 => p_rec.attribute14 ,
8960 p_attribute15 => p_rec.attribute15 ,
8961 p_attribute16 => p_rec.attribute16 ,
8962 p_attribute17 => p_rec.attribute17 ,
8963 p_attribute18 => p_rec.attribute18 ,
8964 p_attribute19 => p_rec.attribute19 ,
8965 p_attribute20 => p_rec.attribute20 ,
8966 p_attribute21 => p_rec.attribute21 ,
8967 p_attribute22 => p_rec.attribute22 ,
8968 p_attribute23 => p_rec.attribute23,
8969 p_attribute24 => p_rec.attribute24,
8970 p_attribute25 => p_rec.attribute25,
8971 p_attribute26 => p_rec.attribute26,
8972 p_attribute27 => p_rec.attribute27,
8973 p_attribute28 => p_rec.attribute28,
8974 p_attribute29 => p_rec.attribute29,
8975 p_attribute30 => p_rec.attribute30,
8976 p_full_name => p_rec.full_name,
8977 p_order_name => p_rec.order_name,
8978 p_global_name => p_rec.global_name,
8979 p_local_name => p_rec.local_name
8980 ,p_duplicate_flag => l_duplicate_flag
8981 ,p_name_combination_warning => p_name_combination_warning
8982 );
8983
8984 if g_debug then
8985 hr_utility.set_location(l_proc, 100);
8986 end if;
8987 --
8988 -- Validate benefit medical coverage dates
8989 --
8990 per_per_bus1.chk_coord_ben_med_cvg_dates
8991 (p_coord_ben_med_cvg_strt_dt => p_rec.coord_ben_med_cvg_strt_dt
8992 ,p_coord_ben_med_cvg_end_dt => p_rec.coord_ben_med_cvg_end_dt
8993 );
8994 --
8995 -- Validate benefit medical details
8996 --
8997 per_per_bus1.chk_coord_ben_med_details
8998 (p_coord_ben_med_cvg_strt_dt => p_rec.coord_ben_med_cvg_strt_dt
8999 ,p_coord_ben_med_cvg_end_dt => p_rec.coord_ben_med_cvg_end_dt
9000 ,p_coord_ben_med_ext_er => p_rec.coord_ben_med_ext_er
9001 ,p_coord_ben_med_pl_name => p_rec.coord_ben_med_pl_name
9002 ,p_coord_ben_med_insr_crr_name => p_rec.coord_ben_med_insr_crr_name
9003 ,p_coord_ben_med_insr_crr_ident => p_rec.coord_ben_med_insr_crr_ident
9004 );
9005 --
9006 -- Check other benefit coverage rules
9007 --
9008 per_per_bus1.chk_other_coverages
9009 (p_attribute10 => p_rec.attribute10
9010 ,p_coord_ben_med_insr_crr_name => p_rec.coord_ben_med_insr_crr_name
9011 ,p_coord_ben_med_cvg_end_dt => p_rec.coord_ben_med_cvg_end_dt
9012 ,p_coord_ben_no_cvg_flag => p_rec.coord_ben_no_cvg_flag
9013 ,p_effective_date => p_effective_date
9014 );
9015 --
9016 -- Validate Developer Descriptive Flexfields
9017 --
9018 chk_per_information
9019 (p_rec => p_rec
9020 ,p_effective_date => p_effective_date
9021 ,p_validation_start_date => p_validation_start_date
9022 ,p_validation_end_date => p_validation_end_date
9023 );
9024 --
9025 if g_debug then
9026 hr_utility.set_location(l_proc, 110);
9027 end if;
9028 /* Bug#3613987 - Removed chk_JP_names procedure
9029 --
9030 -- Create full_name for JP legislation
9031 --
9032 if l_legislation_code = 'JP' then
9033 --
9034 chk_JP_names
9035 (p_person_id => p_rec.person_id
9036 ,p_effective_date => p_effective_date
9037 ,p_object_version_number => p_rec.object_version_number
9038 ,p_first_name => p_rec.first_name
9039 ,p_last_name => p_rec.last_name
9040 ,p_per_information18 => p_rec.per_information18
9041 ,p_per_information19 => p_rec.per_information19);
9042 --,p_full_name => p_rec.full_name ); -- bug# 2689366 --
9043 --
9044 end if;
9045 */
9046 if g_debug then
9047 hr_utility.set_location(l_proc, 145);
9048 end if;
9049 --
9050 -- Validate Applicant Number
9051 --
9052 chk_applicant_number
9053 (p_person_id => p_rec.person_id
9054 ,p_applicant_number => p_rec.applicant_number
9055 ,p_business_group_id => p_rec.business_group_id
9056 ,p_current_applicant => p_rec.current_applicant_flag
9057 ,p_person_type_id => p_rec.person_type_id
9058 ,p_effective_date => p_effective_date
9059 ,p_object_version_number => p_rec.object_version_number
9060 ,p_party_id => p_rec.party_id
9061 ,p_date_of_birth => p_rec.date_of_birth
9062 ,p_start_date => null
9063 );
9064 if g_debug then
9065 hr_utility.set_location(l_proc, 120);
9066 end if;
9067 --
9068 -- Validate Date Employee Data Verified
9069 --
9070 chk_date_emp_data_verified
9071 (p_person_id => p_rec.person_id
9072 ,p_date_employee_data_verified => p_rec.date_employee_data_verified
9073 ,p_effective_start_date => p_validation_start_date
9074 ,p_object_version_number => p_rec.object_version_number
9075 );
9076 if g_debug then
9077 hr_utility.set_location(l_proc, 130);
9078 end if;
9079 --
9080 -- Validate Vendor Id
9081 --
9082 chk_vendor_id
9083 (p_person_id => p_rec.person_id
9084 ,p_vendor_id => p_rec.vendor_id
9085 ,p_person_type_id => p_rec.person_type_id
9086 ,p_business_group_id => p_rec.business_group_id
9087 ,p_effective_date => p_effective_date
9088 ,p_object_version_number => p_rec.object_version_number
9089 );
9090 if g_debug then
9091 hr_utility.set_location(l_proc, 150);
9092 end if;
9093 --
9094 chk_suffix
9095 (p_person_id => p_rec.person_id
9096 ,p_suffix => p_rec.suffix
9097 ,p_effective_date => p_effective_date
9098 ,p_object_version_number => p_rec.object_version_number
9099 );
9100 if g_debug then
9101 hr_utility.set_location(l_proc, 160);
9102 end if;
9103 --
9104 -- Validate work telephone
9105 --
9106 chk_work_telephone
9107 (p_person_id => p_rec.person_id
9108 ,p_work_telephone => p_rec.work_telephone
9109 ,p_effective_date => p_effective_date
9110 ,p_object_version_number => p_rec.object_version_number
9111 );
9112 --
9113 -- Call the datetrack update integrity operation
9114 --
9115 dt_update_validate
9116 (p_datetrack_mode => p_datetrack_mode,
9117 p_validation_start_date => p_validation_start_date,
9118 p_validation_end_date => p_validation_end_date
9119 );
9120 if g_debug then
9121 hr_utility.set_location(l_proc, 170);
9122 end if;
9123 --
9124 --
9125 -- Validate flex fields.
9126 --
9127 per_per_bus.chk_df(p_rec => p_rec);
9128 if g_debug then
9129 hr_utility.set_location(l_proc, 180);
9130 end if;
9131 --
9132 if g_debug then
9133 hr_utility.set_location(' Leaving:'||l_proc, 10000);
9134 end if;
9135 End update_validate;
9136 --
9137 -- ----------------------------------------------------------------------------
9138 -- |---------------------------< delete_validate >----------------------------|
9139 -- ----------------------------------------------------------------------------
9140 Procedure delete_validate
9141 (p_rec in per_per_shd.g_rec_type,
9142 p_effective_date in date,
9143 p_datetrack_mode in varchar2,
9144 p_validation_start_date in date,
9145 p_validation_end_date in date) is
9146 --
9147 l_proc varchar2(72);
9148 --
9149 Begin
9150 if g_debug then
9151 l_proc := g_package||'delete_validate';
9152 hr_utility.set_location('Entering:'||l_proc, 5);
9153 end if;
9154 --
9155 -- Set global variable used to improve calling of return_system_status_type
9156 -- when called multiple times on same pass through the validation process.
9157 -- A null value indicates that the function has not been called on this pass
9158 -- through the validation process.
9159 --
9160 g_previous_sys_per_type := NULL;
9161 --
9162 -- Call all supporting business operations. Mapping to the appropriate
9163 -- business rules on perper.bru is provided
9164 --
9165 -- check if delete operations are allowed
9166 --
9167 chk_delete
9168 (p_person_id => p_rec.person_id
9169 ,p_person_type_id => per_per_shd.g_old_rec.person_type_id
9170 ,p_business_group_id => per_per_shd.g_old_rec.business_group_id
9171 ,p_effective_date => p_effective_date
9172 ,p_datetrack_mode => p_datetrack_mode
9173 );
9174 --
9175 dt_delete_validate
9176 (p_datetrack_mode => p_datetrack_mode,
9177 p_validation_start_date => p_validation_start_date,
9178 p_validation_end_date => p_validation_end_date,
9179 p_person_id => p_rec.person_id);
9180 --
9181 if g_debug then
9182 hr_utility.set_location(' Leaving:'||l_proc, 10);
9183 end if;
9184 End delete_validate;
9185 --
9186 -- ---------------------------------------------------------------------------|
9187 -- |---------------------------< chk_person_type>-----------------------------|
9188 -- ----------------------------------------------------------------------------
9189 --
9190 procedure chk_person_type
9191 (p_person_type_id in out nocopy number
9192 ,p_business_group_id in number
9193 ,p_expected_sys_type in varchar2) is
9194 --
9195 l_system_person_type per_person_types.system_person_type%type;
9196 l_active_flag per_person_types.active_flag%type;
9197 l_business_group_id per_person_types.business_group_id%type;
9198 l_proc varchar2(30);
9199 --
9200 -- Bug fix 3632363. cursor modified to improve performance.
9201 cursor csr_get_default is
9202 select pet.person_type_id
9203 from per_person_types pet
9204 where pet.system_person_type = p_expected_sys_type
9205 and pet.business_group_id = p_business_group_id
9206 and pet.active_flag = 'Y'
9207 and pet.default_flag = 'Y';
9208 --
9209 cursor csr_person_type is
9210 select pet.system_person_type,
9211 pet.active_flag,
9212 pet.business_group_id
9213 from per_person_types pet
9214 where pet.person_type_id = p_person_type_id;
9215 --
9216 begin
9217 if g_debug then
9218 l_proc := 'chk_person_type';
9219 hr_utility.set_location(' Entering '||l_proc,10);
9220 end if;
9221 --
9222 -- Validate the specified business group
9223 --
9224 hr_api.validate_bus_grp_id
9225 (p_business_group_id => p_business_group_id
9226 ,p_associated_column1 => per_per_shd.g_tab_nam || '.BUSINESS_GROUP_ID'
9227 );
9228 hr_multi_message.end_validation_set;
9229 if g_debug then
9230 hr_utility.set_location(l_proc,20);
9231 end if;
9232 --
9233 -- If the person type hasn't been specified or is set to the system default
9234 -- hr_api.g_number, then fetch the default for
9235 -- the business group and system type.
9236 --
9237 if (p_person_type_id is null or p_person_type_id = hr_api.g_number) then
9238 if g_debug then
9239 hr_utility.set_location(l_proc,30);
9240 end if;
9241 --
9242 -- Get the required default person type
9243 --
9244 open csr_get_default;
9245 fetch csr_get_default
9246 into p_person_type_id;
9247 if csr_get_default%notfound then
9248 close csr_get_default;
9249 hr_utility.set_message(801, 'HR_7972_PER_NO_DEFAULT_TYPE');
9250 hr_utility.raise_error;
9251 end if;
9252 close csr_get_default;
9253 if g_debug then
9254 hr_utility.set_location(l_proc,40);
9255 end if;
9256 else
9257 if g_debug then
9258 hr_utility.set_location(l_proc,50);
9259 end if;
9260 --
9261 -- Validate the specified person type.
9262 --
9263 open csr_person_type;
9264 fetch csr_person_type
9265 into l_system_person_type,
9266 l_active_flag,
9267 l_business_group_id;
9268 if csr_person_type%notfound then
9269 close csr_person_type;
9270 hr_utility.set_message(801, 'HR_7513_PER_TYPE_INVALID');
9271 hr_utility.raise_error;
9272 end if;
9273 close csr_person_type;
9274 if g_debug then
9275 hr_utility.set_location(l_proc,60);
9276 end if;
9277 --
9278 if l_active_flag <> 'Y' then
9279 hr_utility.set_message(801, 'HR_7973_PER_TYPE_NOT_ACTIVE');
9280 hr_utility.raise_error;
9281 elsif l_business_group_id <> p_business_group_id then
9282 hr_utility.set_message(801, 'HR_7974_PER_TYPE_INV_BUS_GROUP');
9283 hr_utility.raise_error;
9284 elsif l_system_person_type <> p_expected_sys_type then
9285 hr_utility.set_message(801, 'HR_7970_PER_WRONG_SYS_TYPE');
9286 hr_utility.set_message_token('SYSTYPE', p_expected_sys_type);
9287 hr_utility.raise_error;
9288 end if;
9289 if g_debug then
9290 hr_utility.set_location(l_proc,70);
9291 end if;
9292 end if;
9293 end chk_person_type;
9294 --
9295 -- ---------------------------------------------------------------------------
9296 -- |---------------------< return_legislation_code >-------------------------|
9297 -- ---------------------------------------------------------------------------
9298 --
9299 function return_legislation_code
9300 (p_person_id in number
9301 ) return varchar2 is
9302 --
9303 -- Declare cursor
9304 --
9305 cursor csr_leg_code is
9306 select pbg.legislation_code
9307 from per_business_groups pbg
9308 , per_all_people_f per
9309 where per.person_id = p_person_id
9310 and pbg.business_group_id = per.business_group_id
9311 order by per.effective_start_date;
9312 --
9313 -- Declare local variables
9314 --
9315 l_legislation_code varchar2(150);
9316 l_proc varchar2(72) ;
9317 begin
9318 if g_debug then
9319 l_proc := g_package||'return_legislation_code';
9320 hr_utility.set_location('Entering:'|| l_proc, 10);
9321 end if;
9322 --
9323 -- HR/TCA merge allows person_id to be null
9324 --
9325 if p_person_id is null then
9326 g_person_id := p_person_id;
9327 l_legislation_code := NULL;
9328 if g_debug then
9329 hr_utility.set_location(l_proc, 15);
9330 end if;
9331 --
9332 -- Ensure that all the mandatory parameter are not null
9333 --
9334 --hr_api.mandatory_arg_error(p_api_name => l_proc,
9335 -- p_argument => 'person_id',
9336 -- p_argument_value => p_person_id);
9337 --
9338 else
9339 if nvl(g_person_id, hr_api.g_number) = p_person_id then
9340 --
9341 -- The legislation code has already been found with a previous
9342 -- call to this function. Just return the value in the global
9343 -- variable.
9344 --
9345 l_legislation_code := g_legislation_code;
9346 if g_debug then
9347 hr_utility.set_location(l_proc, 20);
9348 end if;
9349 else
9350 --
9351 -- The ID is different to the last call to this function
9352 -- or this is the first call to this function.
9353 --
9354 open csr_leg_code;
9355 fetch csr_leg_code into l_legislation_code;
9356 if csr_leg_code%notfound then
9357 close csr_leg_code;
9358 --
9359 -- The primary key is invalid therefore we must error
9360 --
9361 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
9362 hr_utility.raise_error;
9363 end if;
9364 --
9365 close csr_leg_code;
9366 if g_debug then
9367 hr_utility.set_location(' Leaving:'|| l_proc, 20);
9368 end if;
9369 --
9370 g_person_id := p_person_id;
9371 g_legislation_code := l_legislation_code;
9372 end if;
9373 end if; -- HR/TCA merge
9374 if g_debug then
9375 hr_utility.set_location(' Leaving:'|| l_proc, 25);
9376 end if;
9377 --
9378 return l_legislation_code;
9379 end return_legislation_code;
9380 --
9381 -- ----------------------------------------------------------------------------
9382 -- |------------------------< chk_system_pers_type>---------------------------|
9383 -- ----------------------------------------------------------------------------
9384 --
9385 procedure chk_system_pers_type
9386 (p_person_id in number
9387 ,p_validation_start_date in date
9388 ,p_validation_end_date in date
9389 ,p_datetrack_mode in varchar2
9390 ,p_effective_date in date
9391 )
9392 is
9393 --
9394 l_exists varchar2(1);
9395 l_person_type varchar2(30);
9396 l_proc varchar2(72) := g_package||'chk_system_pers_type';
9397 --
9398 cursor csr_get_system_person_type is
9399 select ppt.system_person_type
9400 from per_all_people_f ppf
9401 , per_person_types ppt
9402 where p_effective_date between ppf.effective_start_date
9403 and ppf.effective_end_date
9404 and ppf.person_id = p_person_id
9405 and ppt.person_type_id = ppf.person_type_id;
9406 --
9407 cursor csr_chk_future_changes is
9408 select null
9409 from sys.dual
9410 where exists(select null
9411 from per_all_people_f ppf
9412 , per_person_types ppt
9413 where ppf.effective_start_date between
9414 p_validation_start_date
9415 and p_validation_end_date
9416 and ppf.person_id = p_person_id
9417 and ppt.person_type_id = ppf.person_type_id
9418 and ppt.system_person_type <> l_person_type);
9419
9420 --
9421 begin
9422 if g_debug then
9423 hr_utility.set_location('Entering:'|| l_proc, 1);
9424 end if;
9425 --
9426 -- Check mandatory parameters have been set
9427 --
9428 hr_api.mandatory_arg_error
9429 (p_api_name => l_proc
9430 ,p_argument => 'person_id'
9431 ,p_argument_value => p_person_id
9432 );
9433 --
9434 hr_api.mandatory_arg_error
9435 (p_api_name => l_proc
9436 ,p_argument => 'validation_start_date'
9437 ,p_argument_value => p_validation_start_date
9438 );
9439 --
9440 hr_api.mandatory_arg_error
9441 (p_api_name => l_proc
9442 ,p_argument => 'validation_end_date'
9443 ,p_argument_value => p_validation_end_date
9444 );
9445 --
9446 if g_debug then
9447 hr_utility.set_location(l_proc, 2);
9448 end if;
9449 --
9450 -- Get current value for system_person_type (i.e. as of the
9451 -- effective date)
9452 --
9453 open csr_get_system_person_type;
9454 fetch csr_get_system_person_type into l_person_type;
9455 close csr_get_system_person_type;
9456 --
9457 if g_debug then
9458 hr_utility.set_location(l_proc, 3);
9459 end if;
9460 --
9461 -- Check that no future changes exist for the person type
9462 --
9463 open csr_chk_future_changes;
9464 fetch csr_chk_future_changes into l_exists;
9465 if csr_chk_future_changes%found then
9466 close csr_chk_future_changes;
9467 hr_utility.set_message(801, 'HR_7979_PER_SYS_PERS_TYP_CHANG');
9468 hr_utility.raise_error;
9469 end if;
9470 close csr_chk_future_changes;
9471 --
9472 if g_debug then
9473 hr_utility.set_location(' Leaving:'|| l_proc, 4);
9474 end if;
9475 end chk_system_pers_type;
9476 --
9477 end per_per_bus;