1: PACKAGE BODY hr_person AS
2: /* $Header: peperson.pkb 120.9.12020000.5 2013/01/30 09:42:35 srannama ship $ */
3: --
4: g_debug boolean := hr_utility.debug_enabled;
5:
6: -- Bug 2678794: defintions changed to varchar2
7: -- to avoid ORA-06502 when implicit numeric conversions occur.
8: --
137:
138: EXCEPTION
139: when no_data_found then
140: if g_debug then
141: hr_utility.trace('Unique Person Number 999');
142: end if;
143: return('Y');
144:
145: END IS_UNIQUE_PERSON_NUMBER;
224:
225: if l_is_unique = 'N' then
226: p_person_number := null;
227: if p_person_type = 'EMP' then
228: hr_utility.set_message(800,'HR_7692_PERSON_NUM_EXIST');
229: elsif p_person_type = 'APL' then
230: hr_utility.set_message(800,'HR_7693_PERSON_NUM_EXISTS');
231: elsif p_person_type = 'CWK' then
232: hr_utility.set_message(800,'HR_289656_CWK_NUM_EXIST');
226: p_person_number := null;
227: if p_person_type = 'EMP' then
228: hr_utility.set_message(800,'HR_7692_PERSON_NUM_EXIST');
229: elsif p_person_type = 'APL' then
230: hr_utility.set_message(800,'HR_7693_PERSON_NUM_EXISTS');
231: elsif p_person_type = 'CWK' then
232: hr_utility.set_message(800,'HR_289656_CWK_NUM_EXIST');
233: end if;
234: hr_utility.raise_error;
228: hr_utility.set_message(800,'HR_7692_PERSON_NUM_EXIST');
229: elsif p_person_type = 'APL' then
230: hr_utility.set_message(800,'HR_7693_PERSON_NUM_EXISTS');
231: elsif p_person_type = 'CWK' then
232: hr_utility.set_message(800,'HR_289656_CWK_NUM_EXIST');
233: end if;
234: hr_utility.raise_error;
235: end if;
236: p_person_number := l_person_number;
230: hr_utility.set_message(800,'HR_7693_PERSON_NUM_EXISTS');
231: elsif p_person_type = 'CWK' then
232: hr_utility.set_message(800,'HR_289656_CWK_NUM_EXIST');
233: end if;
234: hr_utility.raise_error;
235: end if;
236: p_person_number := l_person_number;
237: ELSE
238: -- ------------------------------------------------------------------------+
274: END LOOP;
275: if l_is_unique = 'N' then
276: p_person_number := null;
277: if p_person_type = 'EMP' then
278: hr_utility.set_message(800,'HR_7692_PERSON_NUM_EXIST');
279: elsif p_person_type = 'APL' then
280: hr_utility.set_message(800,'HR_7693_PERSON_NUM_EXISTS');
281: elsif p_person_type = 'CWK' then
282: hr_utility.set_message(800,'HR_289656_CWK_NUM_EXIST');
276: p_person_number := null;
277: if p_person_type = 'EMP' then
278: hr_utility.set_message(800,'HR_7692_PERSON_NUM_EXIST');
279: elsif p_person_type = 'APL' then
280: hr_utility.set_message(800,'HR_7693_PERSON_NUM_EXISTS');
281: elsif p_person_type = 'CWK' then
282: hr_utility.set_message(800,'HR_289656_CWK_NUM_EXIST');
283: end if;
284: hr_utility.raise_error;
278: hr_utility.set_message(800,'HR_7692_PERSON_NUM_EXIST');
279: elsif p_person_type = 'APL' then
280: hr_utility.set_message(800,'HR_7693_PERSON_NUM_EXISTS');
281: elsif p_person_type = 'CWK' then
282: hr_utility.set_message(800,'HR_289656_CWK_NUM_EXIST');
283: end if;
284: hr_utility.raise_error;
285: else
286: if NOT l_use_sequence then
280: hr_utility.set_message(800,'HR_7693_PERSON_NUM_EXISTS');
281: elsif p_person_type = 'CWK' then
282: hr_utility.set_message(800,'HR_289656_CWK_NUM_EXIST');
283: end if;
284: hr_utility.raise_error;
285: else
286: if NOT l_use_sequence then
287: UPDATE per_number_generation_controls
288: SET next_value = l_person_number + 1
292: p_person_number := l_person_number;
293: end if;
294: EXCEPTION
295: when e_MaxExceeds then
296: hr_utility.set_message(800,'PER_289194_MAX_NUM_REACHED');
297: hr_utility.raise_error;
298: END;
299: -- ------------------------------------------------------------------------+
300: -- End existing mechanisms +
293: end if;
294: EXCEPTION
295: when e_MaxExceeds then
296: hr_utility.set_message(800,'PER_289194_MAX_NUM_REACHED');
297: hr_utility.raise_error;
298: END;
299: -- ------------------------------------------------------------------------+
300: -- End existing mechanisms +
301: -- ------------------------------------------------------------------------+
370: --
371: begin
372: --
373: --
374: hr_utility.set_location('hr_person.generate_number',1);
375: --
376: if p_current_applicant = 'Y' then
377: --
378: if g_debug then
375: --
376: if p_current_applicant = 'Y' then
377: --
378: if g_debug then
379: hr_utility.set_location('number_generation',1);
380: end if;
381: --
382: SELECT pbg.method_of_generation_apl_num
383: , pbg.legislation_code
387: WHERE pbg.business_group_id = p_business_group_id;
388: --
389: if l_method_of_generation = 'A' then
390: if g_debug then
391: hr_utility.set_location('number_generation',2);
392: end if;
393: if p_applicant_number is NOT NULL then
394: begin
395: select person_id
443: exception
444: when others then p_applicant_number := NULL;
445: end;
446: if g_debug then
447: hr_utility.set_location('hr_person.generate_number',15);
448: end if;
449: apl_number_sv := p_applicant_number;
450: end if;
451: -- <<
480: -- WHERE rowid = l_rowid ;
481: -- ------------------------------------------------------------+
482:
483: if g_debug then
484: hr_utility.set_location('hr_person.generate_number',20);
485: end if;
486: apl_number_sv := p_applicant_number;
487:
488: end if;
495: )
496: then
497: if p_national_identifier is null then
498: if l_legislation_code = 'US' then
499: hr_utility.set_message(801,'HR_7580_ALL_MAN_SOL_FIELD');
500: else
501: hr_utility.set_message(801,'HR_7578_ALL_MAN_NAT_FIELD');
502: end if;
503: hr_utility.raise_error;
497: if p_national_identifier is null then
498: if l_legislation_code = 'US' then
499: hr_utility.set_message(801,'HR_7580_ALL_MAN_SOL_FIELD');
500: else
501: hr_utility.set_message(801,'HR_7578_ALL_MAN_NAT_FIELD');
502: end if;
503: hr_utility.raise_error;
504: elsif p_applicant_number is null then -- bug2986823
505: p_applicant_number := p_national_identifier ;
499: hr_utility.set_message(801,'HR_7580_ALL_MAN_SOL_FIELD');
500: else
501: hr_utility.set_message(801,'HR_7578_ALL_MAN_NAT_FIELD');
502: end if;
503: hr_utility.raise_error;
504: elsif p_applicant_number is null then -- bug2986823
505: p_applicant_number := p_national_identifier ;
506: end if;
507: elsif l_method_of_generation = 'M'
505: p_applicant_number := p_national_identifier ;
506: end if;
507: elsif l_method_of_generation = 'M'
508: and p_applicant_number IS NULL then
509: hr_utility.set_message(801,'HR_7579_ALL_MAN_APP_FIELD');
510: hr_utility.raise_error;
511: end if;
512: --
513: end if;
506: end if;
507: elsif l_method_of_generation = 'M'
508: and p_applicant_number IS NULL then
509: hr_utility.set_message(801,'HR_7579_ALL_MAN_APP_FIELD');
510: hr_utility.raise_error;
511: end if;
512: --
513: end if;
514: if p_current_employee = 'Y' then
513: end if;
514: if p_current_employee = 'Y' then
515: --
516: if g_debug then
517: hr_utility.set_location('hr_person.generate_number',4);
518: end if;
519: SELECT pbg.method_of_generation_emp_num
520: , pbg.legislation_code
521: INTO l_method_of_generation
524: WHERE pbg.business_group_id = p_business_group_id;
525: --
526: if l_method_of_generation = 'A' then
527: if g_debug then
528: hr_utility.set_location('hr_person.generate_number',5);
529: end if;
530: if p_employee_number is NOT NULL then
531: begin
532: select person_id
608: -- WHERE rowid = l_rowid ;
609: -- ------------------------------------------------------------+
610:
611: if g_debug then
612: hr_utility.set_location('hr_person.generate_number',6);
613: end if;
614: emp_number_sv := p_employee_number;
615:
616: end if;
623: )
624: then
625: if p_national_identifier is null then
626: if l_legislation_code = 'US' then
627: hr_utility.set_message(801,'HR_7580_ALL_MAN_SOL_FIELD');
628: else
629: hr_utility.set_message(801,'HR_7578_ALL_MAN_NAT_FIELD');
630: end if;
631: hr_utility.raise_error;
625: if p_national_identifier is null then
626: if l_legislation_code = 'US' then
627: hr_utility.set_message(801,'HR_7580_ALL_MAN_SOL_FIELD');
628: else
629: hr_utility.set_message(801,'HR_7578_ALL_MAN_NAT_FIELD');
630: end if;
631: hr_utility.raise_error;
632: elsif p_employee_number is null then -- bug#2986823
633: p_employee_number := p_national_identifier ;
627: hr_utility.set_message(801,'HR_7580_ALL_MAN_SOL_FIELD');
628: else
629: hr_utility.set_message(801,'HR_7578_ALL_MAN_NAT_FIELD');
630: end if;
631: hr_utility.raise_error;
632: elsif p_employee_number is null then -- bug#2986823
633: p_employee_number := p_national_identifier ;
634: end if;
635: elsif l_method_of_generation = 'M'
633: p_employee_number := p_national_identifier ;
634: end if;
635: elsif l_method_of_generation = 'M'
636: and p_employee_number IS NULL then
637: hr_utility.set_message(801,'HR_7581_ALL_MAN_EMP');
638: hr_utility.raise_error;
639: end if;
640: --
641: end if;
634: end if;
635: elsif l_method_of_generation = 'M'
636: and p_employee_number IS NULL then
637: hr_utility.set_message(801,'HR_7581_ALL_MAN_EMP');
638: hr_utility.raise_error;
639: end if;
640: --
641: end if;
642: if p_current_npw = 'Y' then
641: end if;
642: if p_current_npw = 'Y' then
643: --
644: if g_debug then
645: hr_utility.set_location('hr_person.generate_number',10);
646: end if;
647: SELECT pbg.method_of_generation_cwk_num
648: , pbg.method_of_generation_emp_num
649: , pbg.legislation_code
656: if l_method_of_generation = 'A'
657: or (l_method_of_generation = 'E' and
658: l_method_of_gen_emp = 'A') then
659: if g_debug then
660: hr_utility.set_location('hr_person.generate_number',15);
661: end if;
662: if p_npw_number is NOT NULL then
663: begin
664: select person_id
685:
686: -- Second check
687: if p_npw_number is NOT NULL then
688: if g_debug then
689: hr_utility.set_location('hr_person.generate_number',20);
690: end if;
691: begin
692: select null
693: into p_npw_number
705: end if;
706:
707: if p_npw_number IS NULL then
708: if g_debug then
709: hr_utility.set_location('hr_person.generate_number',25);
710: end if;
711:
712: if l_method_of_generation = 'A' then
713: --
713: --
714: -- Automatic numbering so use the CWK number type.
715: --
716: if g_debug then
717: hr_utility.set_location('hr_person.generate_number',27);
718: end if;
719: -- -> #2660279: NEW code
720: Get_Person_Number(p_person_type => 'CWK'
721: ,p_person_number => p_npw_number
751: -- Use the next employee number sequence instead of the
752: -- CWK type.
753: --
754: if g_debug then
755: hr_utility.set_location('hr_person.generate_number',28);
756: end if;
757: -- -> #2660279: NEW code
758: Get_Person_Number(p_person_type => 'EMP'
759: ,p_person_number => p_npw_number
785:
786: end if;
787:
788: if g_debug then
789: hr_utility.set_location('hr_person.generate_number',29);
790: end if;
791: npw_number_sv := p_npw_number;
792:
793: end if;
801: and p_npw_number <> p_national_identifier)
802: )
803: then
804: if g_debug then
805: hr_utility.set_location('hr_person.generate_number',30);
806: end if;
807: if p_national_identifier is null then
808: if l_legislation_code = 'US' then
809: hr_utility.set_message(801,'HR_7580_ALL_MAN_SOL_FIELD');
805: hr_utility.set_location('hr_person.generate_number',30);
806: end if;
807: if p_national_identifier is null then
808: if l_legislation_code = 'US' then
809: hr_utility.set_message(801,'HR_7580_ALL_MAN_SOL_FIELD');
810: else
811: hr_utility.set_message(801,'HR_7578_ALL_MAN_NAT_FIELD');
812: end if;
813: hr_utility.raise_error;
807: if p_national_identifier is null then
808: if l_legislation_code = 'US' then
809: hr_utility.set_message(801,'HR_7580_ALL_MAN_SOL_FIELD');
810: else
811: hr_utility.set_message(801,'HR_7578_ALL_MAN_NAT_FIELD');
812: end if;
813: hr_utility.raise_error;
814: elsif p_npw_number is null then -- bug#2986823
815: p_npw_number := p_national_identifier ;
809: hr_utility.set_message(801,'HR_7580_ALL_MAN_SOL_FIELD');
810: else
811: hr_utility.set_message(801,'HR_7578_ALL_MAN_NAT_FIELD');
812: end if;
813: hr_utility.raise_error;
814: elsif p_npw_number is null then -- bug#2986823
815: p_npw_number := p_national_identifier ;
816: end if;
817: elsif(l_method_of_generation = 'M'
818: or (l_method_of_generation = 'E' and
819: l_method_of_gen_emp = 'M'))
820: and p_npw_number IS NULL then
821: if g_debug then
822: hr_utility.set_location('hr_person.generate_number',35);
823: end if;
824: -- Changed the application id form 801 to 800 for fix of #3295346
825: hr_utility.set_message(800,'HR_289692_ALL_MAN_CWK');
826: hr_utility.raise_error;
821: if g_debug then
822: hr_utility.set_location('hr_person.generate_number',35);
823: end if;
824: -- Changed the application id form 801 to 800 for fix of #3295346
825: hr_utility.set_message(800,'HR_289692_ALL_MAN_CWK');
826: hr_utility.raise_error;
827: end if;
828: --
829: end if;
822: hr_utility.set_location('hr_person.generate_number',35);
823: end if;
824: -- Changed the application id form 801 to 800 for fix of #3295346
825: hr_utility.set_message(800,'HR_289692_ALL_MAN_CWK');
826: hr_utility.raise_error;
827: end if;
828: --
829: end if;
830: --
968: p_duplicate_flag:='N';
969: --
970:
971: if g_debug then
972: hr_utility.set_location('hr_person.derive_full_name',1);
973: end if;
974:
975: if p_title IS NOT NULL and
976: fnd_profile.value('PER_USE_TITLE_IN_FULL_NAME') = 'Y' then
981: AND p_title = lookup_code;
982: end if;
983:
984: if g_debug then
985: hr_utility.set_location('l_title_meaning = '||l_title_meaning,4);
986: end if;
987: --
988: --
989: -- Note this is only a select because PL/SQL can't cope with DECODEs
988: --
989: -- Note this is only a select because PL/SQL can't cope with DECODEs
990: --
991: if g_debug then
992: hr_utility.set_location('hr_person.derive_full_name',2);
993: end if;
994: SELECT rtrim(substrb(DECODE(p_pre_name_adjunct,'','',p_pre_name_adjunct||' ')||
995: p_last_name||','||DECODE(l_title_meaning,'','',
996: ' '||l_title_meaning)||DECODE(p_first_name,'','',
1006: --
1007: p_full_name := rtrim(l_full_name);
1008: --
1009: if g_debug then
1010: hr_utility.set_location('hr_person.derive_full_name',4);
1011: end if;
1012: open csr_leg_cod;
1013: fetch csr_leg_cod into l_leg_code;
1014: if csr_leg_cod%found then
1015:
1016: -- Start of bug # 2459815
1017: -- check for installed legislation
1018: -- added the or condition for the fix of #3291084
1019: if ( hr_utility.chk_product_install('Oracle Human Resources',l_leg_code) or (l_leg_code = 'JP')) then
1020: -- if a legislation exits then we must call the function
1021: -- hr_XX_utility.per_XX_full_name which derives the full name
1022: -- according to the legislation.
1023:
1178: if fnd_profile.value('HR_CROSS_BUSINESS_GROUP') = 'N' then
1179: begin
1180: --
1181: if g_debug then
1182: hr_utility.set_location('hr_person.derive_full_name',3);
1183: end if;
1184: SELECT 'Y'
1185: INTO l_status
1186: FROM sys.dual
1204: AND p_person_id <> pp.person_id)
1205: OR p_person_id IS NULL)
1206: AND pp.business_group_id +0 = p_business_group_id);
1207: --
1208: hr_utility.set_message(801,'HR_PERSON_DUPLICATE');
1209:
1210: raise local_warning;
1211:
1212: --
1218: --
1219: --
1220: exception
1221: when local_warning then
1222: hr_utility.set_warning;
1223: p_duplicate_flag:='Y';
1224: -- #3907786 start
1225: when others then
1226: if csr_leg_cod%isopen then
1424: local_warning exception;
1425: --
1426: begin
1427: if g_debug then
1428: hr_utility.set_location('hr_person.validate_national_identifier',1);
1429: end if;
1430: SELECT org_information9
1431: INTO l_legislation_code
1432: FROM hr_organization_information
1450: -- Note this should be printed out as a warning when called from the form
1451: -- but should be picked up as an error by HRLink
1452: --
1453: if l_legislation_code = 'US' then
1454: hr_utility.set_message(801,'HR_EMP_SS_EXISTS');
1455: elsif l_legislation_code = 'GB' then
1456: hr_utility.set_message(801,'HR_EMP_NI_EXISTS');
1457: -- psingla - If the legislation is Polish and profile PER_NI_UNIQUE_ERROR_WARNING is set to NULL
1458: elsif l_legislation_code = 'PL' and fnd_profile.value('PER_NI_UNIQUE_ERROR_WARNING') is NULL then -- For Poland
1452: --
1453: if l_legislation_code = 'US' then
1454: hr_utility.set_message(801,'HR_EMP_SS_EXISTS');
1455: elsif l_legislation_code = 'GB' then
1456: hr_utility.set_message(801,'HR_EMP_NI_EXISTS');
1457: -- psingla - If the legislation is Polish and profile PER_NI_UNIQUE_ERROR_WARNING is set to NULL
1458: elsif l_legislation_code = 'PL' and fnd_profile.value('PER_NI_UNIQUE_ERROR_WARNING') is NULL then -- For Poland
1459: null;
1460: else
1457: -- psingla - If the legislation is Polish and profile PER_NI_UNIQUE_ERROR_WARNING is set to NULL
1458: elsif l_legislation_code = 'PL' and fnd_profile.value('PER_NI_UNIQUE_ERROR_WARNING') is NULL then -- For Poland
1459: null;
1460: else
1461: hr_utility.set_message(801,'HR_EMP_NAT_ID_EXISTS');
1462: end if;
1463: /* psingla - If the legislation is Polish and profile PER_NI_UNIQUE_ERROR_WARNING
1464: is set to NULL then only null statement to be executed.*/
1465: if l_legislation_code = 'PL' and fnd_profile.value('PER_NI_UNIQUE_ERROR_WARNING') is NULL then -- For Poland
1474: raise;
1475: end;
1476: exception
1477: when NO_DATA_FOUND then
1478: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1479: hr_utility.set_message_token('PROCEDURE','CHECK_NI_UNIQUE');
1480: hr_utility.set_message_token('STEP','1');
1481: hr_utility.raise_error;
1482: when local_warning then
1475: end;
1476: exception
1477: when NO_DATA_FOUND then
1478: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1479: hr_utility.set_message_token('PROCEDURE','CHECK_NI_UNIQUE');
1480: hr_utility.set_message_token('STEP','1');
1481: hr_utility.raise_error;
1482: when local_warning then
1483: hr_utility.set_warning;
1476: exception
1477: when NO_DATA_FOUND then
1478: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1479: hr_utility.set_message_token('PROCEDURE','CHECK_NI_UNIQUE');
1480: hr_utility.set_message_token('STEP','1');
1481: hr_utility.raise_error;
1482: when local_warning then
1483: hr_utility.set_warning;
1484: end check_ni_unique;
1477: when NO_DATA_FOUND then
1478: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1479: hr_utility.set_message_token('PROCEDURE','CHECK_NI_UNIQUE');
1480: hr_utility.set_message_token('STEP','1');
1481: hr_utility.raise_error;
1482: when local_warning then
1483: hr_utility.set_warning;
1484: end check_ni_unique;
1485: -- ------------------- validate_national_identifier -----------------------
1479: hr_utility.set_message_token('PROCEDURE','CHECK_NI_UNIQUE');
1480: hr_utility.set_message_token('STEP','1');
1481: hr_utility.raise_error;
1482: when local_warning then
1483: hr_utility.set_warning;
1484: end check_ni_unique;
1485: -- ------------------- validate_national_identifier -----------------------
1486: --
1487: -- Pass in national identifier and validate both construct (dependent on
1500: begin
1501: --
1502: --
1503: if g_debug then
1504: hr_utility.set_location('hr_person.validate_national_identifier',1);
1505: end if;
1506: SELECT org_information9
1507: INTO l_legislation_code
1508: FROM hr_organization_information
1535: NULL ;
1536: else
1537: --Fix for bug2356249 start here.
1538: if nvl(fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION'),'ERROR') ='WARN' THEN
1539: hr_utility.set_warning;
1540: elsif nvl(fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION'),'ERROR') ='ERROR' then
1541: hr_utility.set_message(801,'HR_6522_EMP_INVALID_NI_NO');
1542: hr_utility.raise_error;
1543: end if;
1537: --Fix for bug2356249 start here.
1538: if nvl(fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION'),'ERROR') ='WARN' THEN
1539: hr_utility.set_warning;
1540: elsif nvl(fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION'),'ERROR') ='ERROR' then
1541: hr_utility.set_message(801,'HR_6522_EMP_INVALID_NI_NO');
1542: hr_utility.raise_error;
1543: end if;
1544: --Fix for bug2356249 ends here.
1545: end if;
1538: if nvl(fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION'),'ERROR') ='WARN' THEN
1539: hr_utility.set_warning;
1540: elsif nvl(fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION'),'ERROR') ='ERROR' then
1541: hr_utility.set_message(801,'HR_6522_EMP_INVALID_NI_NO');
1542: hr_utility.raise_error;
1543: end if;
1544: --Fix for bug2356249 ends here.
1545: end if;
1546:
1556: null;
1557: else
1558: --Fix for bug2356249 start here.
1559: if nvl(fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION'),'ERROR') ='WARN' THEN
1560: hr_utility.set_warning;
1561: elsif nvl(fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION'),'ERROR') ='ERROR' then
1562: hr_utility.set_message(801,'HR_7056_EMP_INVALID_SS_NO');
1563: hr_utility.raise_error;
1564: end if;
1558: --Fix for bug2356249 start here.
1559: if nvl(fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION'),'ERROR') ='WARN' THEN
1560: hr_utility.set_warning;
1561: elsif nvl(fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION'),'ERROR') ='ERROR' then
1562: hr_utility.set_message(801,'HR_7056_EMP_INVALID_SS_NO');
1563: hr_utility.raise_error;
1564: end if;
1565: --Fix for bug2356249 ends here.
1566: end if;
1559: if nvl(fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION'),'ERROR') ='WARN' THEN
1560: hr_utility.set_warning;
1561: elsif nvl(fnd_profile.value('PER_NATIONAL_IDENTIFIER_VALIDATION'),'ERROR') ='ERROR' then
1562: hr_utility.set_message(801,'HR_7056_EMP_INVALID_SS_NO');
1563: hr_utility.raise_error;
1564: end if;
1565: --Fix for bug2356249 ends here.
1566: end if;
1567: end if;
1586: begin
1587: --
1588: --
1589: if g_debug then
1590: hr_utility.set_location('hr_person.validate_dob',1);
1591: end if;
1592: if p_date_of_birth > p_start_date
1593: then
1594: hr_utility.set_message(801,'HR_6523_PERSON_DOB_GT_START');
1590: hr_utility.set_location('hr_person.validate_dob',1);
1591: end if;
1592: if p_date_of_birth > p_start_date
1593: then
1594: hr_utility.set_message(801,'HR_6523_PERSON_DOB_GT_START');
1595: hr_utility.raise_error;
1596: end if;
1597: --
1598: end validate_dob;
1591: end if;
1592: if p_date_of_birth > p_start_date
1593: then
1594: hr_utility.set_message(801,'HR_6523_PERSON_DOB_GT_START');
1595: hr_utility.raise_error;
1596: end if;
1597: --
1598: end validate_dob;
1599: --
1608: begin
1609: --
1610: --
1611: if g_debug then
1612: hr_utility.set_location('hr_person.validate_sex_and_title',1);
1613: end if;
1614: if p_current_employee = 'Y' then
1615: if p_sex IS NULL then
1616: hr_utility.set_message(801,'HR_6524_EMP_MANDATORY_SEX');
1612: hr_utility.set_location('hr_person.validate_sex_and_title',1);
1613: end if;
1614: if p_current_employee = 'Y' then
1615: if p_sex IS NULL then
1616: hr_utility.set_message(801,'HR_6524_EMP_MANDATORY_SEX');
1617: hr_utility.raise_error;
1618: end if;
1619: end if;
1620: --
1613: end if;
1614: if p_current_employee = 'Y' then
1615: if p_sex IS NULL then
1616: hr_utility.set_message(801,'HR_6524_EMP_MANDATORY_SEX');
1617: hr_utility.raise_error;
1618: end if;
1619: end if;
1620: --
1621: if g_debug then
1618: end if;
1619: end if;
1620: --
1621: if g_debug then
1622: hr_utility.set_location('hr_person.validate_sex_and_title',2);
1623: end if;
1624: if p_sex IS NULL then
1625: hr_utility.set_message(801,'PAY_6361_USER_TABLE_UNIQUE');
1626: raise local_warning;
1621: if g_debug then
1622: hr_utility.set_location('hr_person.validate_sex_and_title',2);
1623: end if;
1624: if p_sex IS NULL then
1625: hr_utility.set_message(801,'PAY_6361_USER_TABLE_UNIQUE');
1626: raise local_warning;
1627: elsif p_title IS NULL then
1628: hr_utility.set_message(801,'PAY_6361_USER_TABLE_UNIQUE');
1629: raise local_warning;
1624: if p_sex IS NULL then
1625: hr_utility.set_message(801,'PAY_6361_USER_TABLE_UNIQUE');
1626: raise local_warning;
1627: elsif p_title IS NULL then
1628: hr_utility.set_message(801,'PAY_6361_USER_TABLE_UNIQUE');
1629: raise local_warning;
1630: elsif p_title = 'MR.' then
1631: if p_sex <> 'M' then
1632: hr_utility.set_message(801,'HR_6527_PERSON_SEX_AND_TITLE');
1628: hr_utility.set_message(801,'PAY_6361_USER_TABLE_UNIQUE');
1629: raise local_warning;
1630: elsif p_title = 'MR.' then
1631: if p_sex <> 'M' then
1632: hr_utility.set_message(801,'HR_6527_PERSON_SEX_AND_TITLE');
1633: hr_utility.raise_error;
1634: end if;
1635: elsif p_title IN ('MRS.','MS.','MISS') then
1636: if p_sex <> 'F' then
1629: raise local_warning;
1630: elsif p_title = 'MR.' then
1631: if p_sex <> 'M' then
1632: hr_utility.set_message(801,'HR_6527_PERSON_SEX_AND_TITLE');
1633: hr_utility.raise_error;
1634: end if;
1635: elsif p_title IN ('MRS.','MS.','MISS') then
1636: if p_sex <> 'F' then
1637: hr_utility.set_message(801,'HR_6527_PERSON_SEX_AND_TITLE');
1633: hr_utility.raise_error;
1634: end if;
1635: elsif p_title IN ('MRS.','MS.','MISS') then
1636: if p_sex <> 'F' then
1637: hr_utility.set_message(801,'HR_6527_PERSON_SEX_AND_TITLE');
1638: hr_utility.raise_error;
1639: end if;
1640: end if;
1641: --
1634: end if;
1635: elsif p_title IN ('MRS.','MS.','MISS') then
1636: if p_sex <> 'F' then
1637: hr_utility.set_message(801,'HR_6527_PERSON_SEX_AND_TITLE');
1638: hr_utility.raise_error;
1639: end if;
1640: end if;
1641: --
1642: exception
1640: end if;
1641: --
1642: exception
1643: when local_warning then
1644: hr_utility.set_warning;
1645: --
1646: end validate_sex_and_title;
1647: --
1648: -- --------------------------------------------------------------------- +
1663: begin
1664: --
1665: --
1666: if g_debug then
1667: hr_utility.set_location('hr_person.validate_unique_number',1);
1668: end if;
1669: if p_current_applicant = 'Y' then
1670: if p_applicant_number IS NULL then
1671: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1667: hr_utility.set_location('hr_person.validate_unique_number',1);
1668: end if;
1669: if p_current_applicant = 'Y' then
1670: if p_applicant_number IS NULL then
1671: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1672: hr_utility.set_message_token('PROCEDURE','VALIDATE_UNIQUE_NUMBER');
1673: hr_utility.set_message_token('STEP','1');
1674: hr_utility.raise_error;
1675: end if;
1668: end if;
1669: if p_current_applicant = 'Y' then
1670: if p_applicant_number IS NULL then
1671: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1672: hr_utility.set_message_token('PROCEDURE','VALIDATE_UNIQUE_NUMBER');
1673: hr_utility.set_message_token('STEP','1');
1674: hr_utility.raise_error;
1675: end if;
1676: --
1669: if p_current_applicant = 'Y' then
1670: if p_applicant_number IS NULL then
1671: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1672: hr_utility.set_message_token('PROCEDURE','VALIDATE_UNIQUE_NUMBER');
1673: hr_utility.set_message_token('STEP','1');
1674: hr_utility.raise_error;
1675: end if;
1676: --
1677: if g_debug then
1670: if p_applicant_number IS NULL then
1671: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1672: hr_utility.set_message_token('PROCEDURE','VALIDATE_UNIQUE_NUMBER');
1673: hr_utility.set_message_token('STEP','1');
1674: hr_utility.raise_error;
1675: end if;
1676: --
1677: if g_debug then
1678: hr_utility.set_location('hr_person.validate_unique_number',2);
1674: hr_utility.raise_error;
1675: end if;
1676: --
1677: if g_debug then
1678: hr_utility.set_location('hr_person.validate_unique_number',2);
1679: end if;
1680: -- #2660279:
1681: -- --> delete this code
1682: -- SELECT 'Y'
1696: ,p_business_group_id => p_business_group_id
1697: ) = 'N'
1698: then
1699:
1700: hr_utility.set_message(801,'HR_7693_PERSON_NUM_EXISTS');
1701: hr_utility.raise_error;
1702: end if;
1703: -- << End New code
1704: --
1697: ) = 'N'
1698: then
1699:
1700: hr_utility.set_message(801,'HR_7693_PERSON_NUM_EXISTS');
1701: hr_utility.raise_error;
1702: end if;
1703: -- << End New code
1704: --
1705: end if;
1704: --
1705: end if;
1706: --
1707: if g_debug then
1708: hr_utility.set_location('hr_person.validate_unique_number',3);
1709: end if;
1710: if p_current_employee = 'Y' then
1711: if p_employee_number IS NULL then
1712: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1708: hr_utility.set_location('hr_person.validate_unique_number',3);
1709: end if;
1710: if p_current_employee = 'Y' then
1711: if p_employee_number IS NULL then
1712: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1713: hr_utility.set_message_token('PROCEDURE','VALIDATE_UNIQUE_NUMBER');
1714: hr_utility.set_message_token('STEP','3');
1715: hr_utility.raise_error;
1716: end if;
1709: end if;
1710: if p_current_employee = 'Y' then
1711: if p_employee_number IS NULL then
1712: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1713: hr_utility.set_message_token('PROCEDURE','VALIDATE_UNIQUE_NUMBER');
1714: hr_utility.set_message_token('STEP','3');
1715: hr_utility.raise_error;
1716: end if;
1717: --
1710: if p_current_employee = 'Y' then
1711: if p_employee_number IS NULL then
1712: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1713: hr_utility.set_message_token('PROCEDURE','VALIDATE_UNIQUE_NUMBER');
1714: hr_utility.set_message_token('STEP','3');
1715: hr_utility.raise_error;
1716: end if;
1717: --
1718: if g_debug then
1711: if p_employee_number IS NULL then
1712: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1713: hr_utility.set_message_token('PROCEDURE','VALIDATE_UNIQUE_NUMBER');
1714: hr_utility.set_message_token('STEP','3');
1715: hr_utility.raise_error;
1716: end if;
1717: --
1718: if g_debug then
1719: hr_utility.set_location('hr_person.validate_unique_number',4);
1715: hr_utility.raise_error;
1716: end if;
1717: --
1718: if g_debug then
1719: hr_utility.set_location('hr_person.validate_unique_number',4);
1720: end if;
1721: -- #2660279: >> New code
1722: if is_unique_person_number(p_person_id => p_person_id
1723: ,p_person_type => 'EMP'
1725: ,p_business_group_id => p_business_group_id
1726: ) = 'N'
1727: then
1728:
1729: hr_utility.set_message(801,'HR_7692_PERSON_NUM_EXIST');
1730: hr_utility.raise_error;
1731: end if;
1732: -- << end new code
1733: --
1726: ) = 'N'
1727: then
1728:
1729: hr_utility.set_message(801,'HR_7692_PERSON_NUM_EXIST');
1730: hr_utility.raise_error;
1731: end if;
1732: -- << end new code
1733: --
1734:
1750: --
1751: -- << end 2660279
1752: end if;
1753: if g_debug then
1754: hr_utility.set_location('hr_person.validate_unique_number',5);
1755: end if;
1756: -- +---------------------------------------------------------------------+
1757: -- Processing contingent workers
1758: -- +---------------------------------------------------------------------+
1757: -- Processing contingent workers
1758: -- +---------------------------------------------------------------------+
1759: if p_current_npw = 'Y' then
1760: if p_npw_number IS NULL then
1761: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1762: hr_utility.set_message_token('PROCEDURE','VALIDATE_UNIQUE_NUMBER');
1763: hr_utility.set_message_token('STEP','4');
1764: hr_utility.raise_error;
1765: end if;
1758: -- +---------------------------------------------------------------------+
1759: if p_current_npw = 'Y' then
1760: if p_npw_number IS NULL then
1761: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1762: hr_utility.set_message_token('PROCEDURE','VALIDATE_UNIQUE_NUMBER');
1763: hr_utility.set_message_token('STEP','4');
1764: hr_utility.raise_error;
1765: end if;
1766: --
1759: if p_current_npw = 'Y' then
1760: if p_npw_number IS NULL then
1761: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1762: hr_utility.set_message_token('PROCEDURE','VALIDATE_UNIQUE_NUMBER');
1763: hr_utility.set_message_token('STEP','4');
1764: hr_utility.raise_error;
1765: end if;
1766: --
1767: if g_debug then
1760: if p_npw_number IS NULL then
1761: hr_utility.set_message(801,'HR_6153_ALL_PROCEDURE_FAIL');
1762: hr_utility.set_message_token('PROCEDURE','VALIDATE_UNIQUE_NUMBER');
1763: hr_utility.set_message_token('STEP','4');
1764: hr_utility.raise_error;
1765: end if;
1766: --
1767: if g_debug then
1768: hr_utility.set_location('hr_person.validate_unique_number',6);
1764: hr_utility.raise_error;
1765: end if;
1766: --
1767: if g_debug then
1768: hr_utility.set_location('hr_person.validate_unique_number',6);
1769: end if;
1770: -- #2660279:
1771: -- >> delete code
1772: -- SELECT 'Y'
1792: ,p_business_group_id => p_business_group_id
1793: ) = 'N'
1794: then
1795:
1796: hr_utility.set_message(800,'HR_289656_CWK_NUM_EXIST');
1797: hr_utility.raise_error;
1798: end if;
1799: -- << end new code
1800: --
1793: ) = 'N'
1794: then
1795:
1796: hr_utility.set_message(800,'HR_289656_CWK_NUM_EXIST');
1797: hr_utility.raise_error;
1798: end if;
1799: -- << end new code
1800: --
1801: end if;
2029: p_test_func varchar2(60);
2030:
2031: BEGIN
2032: IF g_debug THEN
2033: hr_utility.set_location ('hr_person.fpt_check_ft_person_type',10);
2034: END IF;
2035:
2036: IF (nvl(fnd_profile.value('HR_ALLOW_FPT_UPDATES'),'N') = 'Y') THEN
2037:
2079: RETURN TRUE;
2080: EXCEPTION
2081: WHEN no_data_found THEN
2082: RETURN FALSE;
2083: WHEN hr_utility.hr_error THEN
2084: RAISE;
2085: RETURN FALSE;
2086: WHEN others THEN
2087: hr_utility.oracle_error (sqlcode);
2083: WHEN hr_utility.hr_error THEN
2084: RAISE;
2085: RETURN FALSE;
2086: WHEN others THEN
2087: hr_utility.oracle_error (sqlcode);
2088: RETURN FALSE;
2089: END fpt_check_ft_person_type;
2090:
2091: ------------------------- END: fpt_chk_future_person_type ------------------
2130: --
2131: BEGIN
2132: --
2133: if g_debug then
2134: hr_utility.set_location('hr_person.chk_future_person_type',1);
2135: end if;
2136: --
2137: --
2138: -- Fix for bug 7045968 starts here
2196: --
2197: exception
2198: when no_data_found then
2199: RETURN FALSE;
2200: when hr_utility.hr_error then
2201: raise;
2202: RETURN FALSE;
2203: when others then
2204: hr_utility.oracle_error(sqlcode);
2200: when hr_utility.hr_error then
2201: raise;
2202: RETURN FALSE;
2203: when others then
2204: hr_utility.oracle_error(sqlcode);
2205: RETURN FALSE;
2206: END chk_future_person_type;
2207: ------------------------- END: chk_future_person_type --------------------
2208: --
2228: --
2229: BEGIN
2230: --
2231: if g_debug then
2232: hr_utility.set_location('hr_person.chk_prev_person_type',1);
2233: hr_utility.set_location('p_system_person_type= '||p_system_person_type,10);
2234: hr_utility.set_location('p_person_id= '||p_person_id,20);
2235: hr_utility.set_location('p_business_group_id= '||p_business_group_id,30);
2236: hr_utility.set_location('p_effective_start_date= '||p_effective_start_date,40);
2229: BEGIN
2230: --
2231: if g_debug then
2232: hr_utility.set_location('hr_person.chk_prev_person_type',1);
2233: hr_utility.set_location('p_system_person_type= '||p_system_person_type,10);
2234: hr_utility.set_location('p_person_id= '||p_person_id,20);
2235: hr_utility.set_location('p_business_group_id= '||p_business_group_id,30);
2236: hr_utility.set_location('p_effective_start_date= '||p_effective_start_date,40);
2237: end if;
2230: --
2231: if g_debug then
2232: hr_utility.set_location('hr_person.chk_prev_person_type',1);
2233: hr_utility.set_location('p_system_person_type= '||p_system_person_type,10);
2234: hr_utility.set_location('p_person_id= '||p_person_id,20);
2235: hr_utility.set_location('p_business_group_id= '||p_business_group_id,30);
2236: hr_utility.set_location('p_effective_start_date= '||p_effective_start_date,40);
2237: end if;
2238:
2231: if g_debug then
2232: hr_utility.set_location('hr_person.chk_prev_person_type',1);
2233: hr_utility.set_location('p_system_person_type= '||p_system_person_type,10);
2234: hr_utility.set_location('p_person_id= '||p_person_id,20);
2235: hr_utility.set_location('p_business_group_id= '||p_business_group_id,30);
2236: hr_utility.set_location('p_effective_start_date= '||p_effective_start_date,40);
2237: end if;
2238:
2239: select 'Y'
2232: hr_utility.set_location('hr_person.chk_prev_person_type',1);
2233: hr_utility.set_location('p_system_person_type= '||p_system_person_type,10);
2234: hr_utility.set_location('p_person_id= '||p_person_id,20);
2235: hr_utility.set_location('p_business_group_id= '||p_business_group_id,30);
2236: hr_utility.set_location('p_effective_start_date= '||p_effective_start_date,40);
2237: end if;
2238:
2239: select 'Y'
2240: into p_test_func
2295: --
2296: exception
2297: when no_data_found then
2298: RETURN FALSE;
2299: when hr_utility.hr_error then
2300: raise;
2301: RETURN FALSE;
2302: when others then
2303: hr_utility.oracle_error(sqlcode);
2299: when hr_utility.hr_error then
2300: raise;
2301: RETURN FALSE;
2302: when others then
2303: hr_utility.oracle_error(sqlcode);
2304: RETURN FALSE;
2305: END chk_prev_person_type;
2306: ------------------------- BEGIN: chk_prev_person_type --------------------
2307: --
2333: l_primary_flag VARCHAR2(1) :='Y';
2334: --
2335: begin
2336: if g_debug then
2337: hr_utility.set_location('hr_person.validate_address',1);
2338: end if;
2339: --
2340: --
2341: select 'Error : Primary address exists'
2357: -- Primary exists and form trying to enter primary
2358: -- then raise error
2359: --
2360: if p_primary_flag = 'Y' then
2361: hr_utility.set_message(801,'HR_6510_PER_PRIMARY_ADDRESS');
2362: hr_utility.raise_error;
2363: end if;
2364: exception
2365: when NO_DATA_FOUND then
2358: -- then raise error
2359: --
2360: if p_primary_flag = 'Y' then
2361: hr_utility.set_message(801,'HR_6510_PER_PRIMARY_ADDRESS');
2362: hr_utility.raise_error;
2363: end if;
2364: exception
2365: when NO_DATA_FOUND then
2366: -- if no primary found
2368: -- do nothing
2369: -- else flag an error
2370: --
2371: if p_primary_flag <> 'Y' then
2372: hr_utility.set_message(801,'HR_7144_PER_NO_PRIM_ADD');
2373: hr_utility.raise_error;
2374: end if;
2375: end validate_address;
2376: ------------------------- END: validate_address --------------------
2369: -- else flag an error
2370: --
2371: if p_primary_flag <> 'Y' then
2372: hr_utility.set_message(801,'HR_7144_PER_NO_PRIM_ADD');
2373: hr_utility.raise_error;
2374: end if;
2375: end validate_address;
2376: ------------------------- END: validate_address --------------------
2377: