96: RETURN wf_rolename ;
97:
98: exception
99: when no_data_found then
100: fnd_message.set_name('JTF', 'JTF_RS_ROLE_NOTFOUND');
101: fnd_message.set_token('P_RESOURCE_NAME', l_resource_name);
102: fnd_msg_pub.add;
103: return null ;
104: when too_many_rows then
97:
98: exception
99: when no_data_found then
100: fnd_message.set_name('JTF', 'JTF_RS_ROLE_NOTFOUND');
101: fnd_message.set_token('P_RESOURCE_NAME', l_resource_name);
102: fnd_msg_pub.add;
103: return null ;
104: when too_many_rows then
105: fnd_message.set_name('JTF', 'JTF_RS_MORE_WF_ROLES');
101: fnd_message.set_token('P_RESOURCE_NAME', l_resource_name);
102: fnd_msg_pub.add;
103: return null ;
104: when too_many_rows then
105: fnd_message.set_name('JTF', 'JTF_RS_MORE_WF_ROLES');
106: fnd_message.set_token('P_RESOURCE_NAME', l_resource_name);
107: fnd_msg_pub.add;
108: return null ;
109: when others then
102: fnd_msg_pub.add;
103: return null ;
104: when too_many_rows then
105: fnd_message.set_name('JTF', 'JTF_RS_MORE_WF_ROLES');
106: fnd_message.set_token('P_RESOURCE_NAME', l_resource_name);
107: fnd_msg_pub.add;
108: return null ;
109: when others then
110: fnd_message.set_name('JTF', 'JTF_RS_RESOURCE_GET_ROLE_ERR');
106: fnd_message.set_token('P_RESOURCE_NAME', l_resource_name);
107: fnd_msg_pub.add;
108: return null ;
109: when others then
110: fnd_message.set_name('JTF', 'JTF_RS_RESOURCE_GET_ROLE_ERR');
111: fnd_msg_pub.add;
112: return null ;
113: END;
114:
520: OR l_managing_emp_num IS NOT NULL) THEN
521:
522: -- dbms_output.put_line('For OTHER category, source_id, address_id, contact_id and managing_emp_id should be all null');
523:
524: fnd_message.set_name('JTF', 'JTF_RS_OTHER_IDS_NOT_NULL');
525: fnd_msg_pub.add;
526: RAISE fnd_api.g_exc_error;
527:
528: END IF;
536: /* Validate the source_id */
537:
538: IF (l_source_id IS NULL) THEN
539: -- dbms_output.put_line('For PARTNER category, source_id should not be null');
540: fnd_message.set_name('JTF', 'JTF_RS_PARTNER_IDS_NULL');
541: fnd_msg_pub.add;
542: RAISE fnd_api.g_exc_error;
543: ELSE
544: IF G_RS_ID_PUB_FLAG = 'Y' THEN --This flag is checked for migration purpose.
545: OPEN c_validate_partner(l_source_id);
546: FETCH c_validate_partner INTO l_check_flag;
547: IF c_validate_partner%NOTFOUND THEN
548: -- dbms_output.put_line('Partner does not exist for the passed source_id');
549: fnd_message.set_name('JTF', 'JTF_RS_INVALID_PARTNER_IDS');
550: fnd_msg_pub.add;
551: RAISE fnd_api.g_exc_error;
552: END IF;
553: CLOSE c_validate_partner;
556: FETCH c_validate_partner_migr INTO l_check_flag,l_source_name;
557: JTF_RESOURCE_UTL.G_SOURCE_NAME := l_source_name;
558: IF c_validate_partner_migr%NOTFOUND THEN
559: -- dbms_output.put_line('Partner does not exist for the passed source_id');
560: fnd_message.set_name('JTF', 'JTF_RS_INVALID_PARTNER_IDS');
561: fnd_msg_pub.add;
562: RAISE fnd_api.g_exc_error;
563: END IF;
564: CLOSE c_validate_partner_migr;
571: OPEN c_validate_partner_address(l_source_id, l_address_id);
572: FETCH c_validate_partner_address INTO l_check_flag;
573: IF c_validate_partner_address%NOTFOUND THEN
574: -- dbms_output.put_line('Invalid Partner Address Id');
575: fnd_message.set_name('JTF', 'JTF_RS_ERR_PARTNER_ADDRESS_ID');
576: fnd_message.set_token('P_ADDRESS_ID', l_address_id);
577: fnd_msg_pub.add;
578: RAISE fnd_api.g_exc_error;
579: END IF;
572: FETCH c_validate_partner_address INTO l_check_flag;
573: IF c_validate_partner_address%NOTFOUND THEN
574: -- dbms_output.put_line('Invalid Partner Address Id');
575: fnd_message.set_name('JTF', 'JTF_RS_ERR_PARTNER_ADDRESS_ID');
576: fnd_message.set_token('P_ADDRESS_ID', l_address_id);
577: fnd_msg_pub.add;
578: RAISE fnd_api.g_exc_error;
579: END IF;
580: CLOSE c_validate_partner_address;
587: OPEN c_validate_partner_contact(l_source_id, l_address_id, l_contact_id);
588: FETCH c_validate_partner_contact INTO l_check_flag;
589: IF c_validate_partner_contact%NOTFOUND THEN
590: -- dbms_output.put_line('Invalid Partner Contact Id');
591: fnd_message.set_name('JTF', 'JTF_RS_ERR_PARTNER_CONTACT_ID');
592: fnd_message.set_token('P_CONTACT_ID', l_contact_id);
593: fnd_msg_pub.add;
594: RAISE fnd_api.g_exc_error;
595: END IF;
588: FETCH c_validate_partner_contact INTO l_check_flag;
589: IF c_validate_partner_contact%NOTFOUND THEN
590: -- dbms_output.put_line('Invalid Partner Contact Id');
591: fnd_message.set_name('JTF', 'JTF_RS_ERR_PARTNER_CONTACT_ID');
592: fnd_message.set_token('P_CONTACT_ID', l_contact_id);
593: fnd_msg_pub.add;
594: RAISE fnd_api.g_exc_error;
595: END IF;
596: CLOSE c_validate_partner_contact;
605: */
606: IF l_category NOT IN ('OTHER' , 'PARTNER' , 'TBH', 'EMPLOYEE') THEN
607: IF l_source_id IS NULL THEN
608: -- dbms_output.put_line('Source Id should not be Null');
609: fnd_message.set_name('JTF', 'JTF_RS_SOURCE_ID_NULL');
610: fnd_msg_pub.add;
611: RAISE fnd_api.g_exc_error;
612: END IF;
613:
629: END IF;
630: END IF;
631:
632: IF l_found = FALSE THEN
633: fnd_message.set_name('JTF', 'JTF_RS_INVALID_SOURCE_ID');
634: fnd_message.set_token('P_SOURCE_ID', l_source_id);
635: fnd_msg_pub.add;
636: RAISE fnd_api.g_exc_error;
637: END IF;
630: END IF;
631:
632: IF l_found = FALSE THEN
633: fnd_message.set_name('JTF', 'JTF_RS_INVALID_SOURCE_ID');
634: fnd_message.set_token('P_SOURCE_ID', l_source_id);
635: fnd_msg_pub.add;
636: RAISE fnd_api.g_exc_error;
637: END IF;
638:
644:
645: if l_category = 'EMPLOYEE' THEN
646: -- First check is null check for source id
647: IF l_source_id IS NULL THEN
648: fnd_message.set_name('JTF', 'JTF_RS_SOURCE_ID_NULL');
649: fnd_msg_pub.add;
650: RAISE fnd_api.g_exc_error;
651: END IF;
652:
655: close c_emp_exist;
656:
657: if(nvl(r_emp_exist.value , 'y') <> 'x')
658: then
659: fnd_message.set_name('JTF', 'JTF_RS_INVALID_SOURCE_ID');
660: fnd_message.set_token('P_SOURCE_ID', l_source_id);
661: fnd_msg_pub.add;
662: RAISE fnd_api.g_exc_error;
663: end if;
656:
657: if(nvl(r_emp_exist.value , 'y') <> 'x')
658: then
659: fnd_message.set_name('JTF', 'JTF_RS_INVALID_SOURCE_ID');
660: fnd_message.set_token('P_SOURCE_ID', l_source_id);
661: fnd_msg_pub.add;
662: RAISE fnd_api.g_exc_error;
663: end if;
664:
680: IF c_validate_party_address%NOTFOUND THEN
681:
682: -- dbms_output.put_line('Invalid Party Address');
683:
684: fnd_message.set_name('JTF', 'JTF_RS_INVALID_PARTY_ADDRESS');
685: fnd_message.set_token('P_ADDRESS_ID', l_address_id);
686: fnd_msg_pub.add;
687:
688: RAISE fnd_api.g_exc_error;
681:
682: -- dbms_output.put_line('Invalid Party Address');
683:
684: fnd_message.set_name('JTF', 'JTF_RS_INVALID_PARTY_ADDRESS');
685: fnd_message.set_token('P_ADDRESS_ID', l_address_id);
686: fnd_msg_pub.add;
687:
688: RAISE fnd_api.g_exc_error;
689:
709: IF c_validate_party_contact%NOTFOUND THEN
710:
711: -- dbms_output.put_line('Invalid Party Contact Id');
712:
713: fnd_message.set_name('JTF', 'JTF_RS_ERR_PARTY_CONTACT_ID');
714: fnd_message.set_token('P_CONTACT_ID', l_contact_id);
715: fnd_msg_pub.add;
716:
717: RAISE fnd_api.g_exc_error;
710:
711: -- dbms_output.put_line('Invalid Party Contact Id');
712:
713: fnd_message.set_name('JTF', 'JTF_RS_ERR_PARTY_CONTACT_ID');
714: fnd_message.set_token('P_CONTACT_ID', l_contact_id);
715: fnd_msg_pub.add;
716:
717: RAISE fnd_api.g_exc_error;
718:
740: IF (l_contact_id IS NOT NULL) THEN
741:
742: -- dbms_output.put_line('For SUPPLIER_CONTACT category, address_id and contact_id should be null');
743:
744: fnd_message.set_name('JTF', 'JTF_RS_SC_IDS_NOT_NULL');
745: fnd_msg_pub.add;
746:
747: RAISE fnd_api.g_exc_error;
748:
762: IF (l_contact_id IS NOT NULL OR l_managing_emp_id IS NOT NULL OR l_managing_emp_num IS NOT NULL) THEN
763:
764: -- dbms_output.put_line('For EMPLOYEE category, contact_id should be null');
765:
766: fnd_message.set_name('JTF', 'JTF_RS_EMP_IDS_NOT_NULL');
767: fnd_msg_pub.add;
768:
769: RAISE fnd_api.g_exc_error;
770:
800: IF l_start_date_active IS NULL THEN
801:
802: -- dbms_output.put_line('Start Date Active cannot be null');
803:
804: fnd_message.set_name('JTF', 'JTF_RS_START_DATE_NULL');
805: fnd_msg_pub.add;
806:
807: RAISE fnd_api.g_exc_error;
808:
927: IF c_assigned_to_group_id%NOTFOUND THEN
928:
929: -- dbms_output.put_line('Invalid Assigned To Group Id');
930:
931: fnd_message.set_name('JTF', 'JTF_RS_ERR_ASSIGN_TO_GRP_ID');
932: fnd_message.set_token('P_ASSIGNED_TO_GROUP_ID', l_assigned_to_group_id);
933: fnd_msg_pub.add;
934: RAISE fnd_api.g_exc_error;
935:
928:
929: -- dbms_output.put_line('Invalid Assigned To Group Id');
930:
931: fnd_message.set_name('JTF', 'JTF_RS_ERR_ASSIGN_TO_GRP_ID');
932: fnd_message.set_token('P_ASSIGNED_TO_GROUP_ID', l_assigned_to_group_id);
933: fnd_msg_pub.add;
934: RAISE fnd_api.g_exc_error;
935:
936: END IF;
969: IF l_commissionable_flag <> 'Y' AND l_commissionable_flag <> 'N' THEN
970:
971: -- dbms_output.put_line('Commissionable Flag should either be ''Y'' or ''N'' ');
972:
973: fnd_message.set_name('JTF', 'JTF_RS_INVALID_FLAG_VALUE');
974: fnd_msg_pub.add;
975:
976: RAISE fnd_api.g_exc_error;
977:
983: IF l_hold_payment <> 'Y' AND l_hold_payment <> 'N' THEN
984:
985: -- dbms_output.put_line('Hold Payment should either be ''Y'' or ''N'' ');
986:
987: fnd_message.set_name('JTF', 'JTF_RS_INVALID_FLAG_VALUE');
988: fnd_msg_pub.add;
989: RAISE fnd_api.g_exc_error;
990:
991: END IF;
1018: IF l_category NOT IN ('EMPLOYEE', 'PARTY', 'SUPPLIER_CONTACT') THEN
1019:
1020: IF l_user_id IS NOT NULL THEN
1021:
1022: fnd_message.set_name('JTF', 'JTF_RS_USERID_ERROR');
1023: fnd_msg_pub.add;
1024:
1025: RAISE fnd_api.g_exc_error;
1026:
1057: IF c_validate_user_id%FOUND THEN
1058:
1059: -- dbms_output.put_line('duplicate user Id');
1060:
1061: fnd_message.set_name('JTF', 'JTF_RS_ERR_DUPLICATE_USER_ID');
1062: fnd_message.set_token('P_USER_ID', l_user_id);
1063: fnd_msg_pub.add;
1064:
1065: RAISE fnd_api.g_exc_error;
1058:
1059: -- dbms_output.put_line('duplicate user Id');
1060:
1061: fnd_message.set_name('JTF', 'JTF_RS_ERR_DUPLICATE_USER_ID');
1062: fnd_message.set_token('P_USER_ID', l_user_id);
1063: fnd_msg_pub.add;
1064:
1065: RAISE fnd_api.g_exc_error;
1066:
1309: FND_MSG_PUB.count_and_get (p_count => x_msg_count,
1310: p_data => x_msg_data);
1311: WHEN OTHERS THEN
1312: ROLLBACK TO create_resource_pub;
1313: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
1314: fnd_message.set_token('P_SQLCODE',SQLCODE);
1315: fnd_message.set_token('P_SQLERRM',SQLERRM);
1316: fnd_message.set_token('P_API_NAME', l_api_name);
1317: FND_MSG_PUB.add;
1310: p_data => x_msg_data);
1311: WHEN OTHERS THEN
1312: ROLLBACK TO create_resource_pub;
1313: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
1314: fnd_message.set_token('P_SQLCODE',SQLCODE);
1315: fnd_message.set_token('P_SQLERRM',SQLERRM);
1316: fnd_message.set_token('P_API_NAME', l_api_name);
1317: FND_MSG_PUB.add;
1318: x_return_status := fnd_api.g_ret_sts_unexp_error;
1311: WHEN OTHERS THEN
1312: ROLLBACK TO create_resource_pub;
1313: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
1314: fnd_message.set_token('P_SQLCODE',SQLCODE);
1315: fnd_message.set_token('P_SQLERRM',SQLERRM);
1316: fnd_message.set_token('P_API_NAME', l_api_name);
1317: FND_MSG_PUB.add;
1318: x_return_status := fnd_api.g_ret_sts_unexp_error;
1319: FND_MSG_PUB.count_and_get (p_count => x_msg_count,
1312: ROLLBACK TO create_resource_pub;
1313: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
1314: fnd_message.set_token('P_SQLCODE',SQLCODE);
1315: fnd_message.set_token('P_SQLERRM',SQLERRM);
1316: fnd_message.set_token('P_API_NAME', l_api_name);
1317: FND_MSG_PUB.add;
1318: x_return_status := fnd_api.g_ret_sts_unexp_error;
1319: FND_MSG_PUB.count_and_get (p_count => x_msg_count,
1320: p_data => x_msg_data);
1578: IF l_resource_id IS NULL AND l_resource_number is NULL THEN
1579:
1580: -- dbms_output.put_line('Resource Id and Resource Number are null');
1581:
1582: fnd_message.set_name('JTF', 'JTF_RS_RESOURCE_NULL');
1583: fnd_msg_pub.add;
1584:
1585: RAISE fnd_api.g_exc_error;
1586:
1596: IF c_resource_id%NOTFOUND THEN
1597:
1598: -- dbms_output.put_line('Invalid or Inactive Resource');
1599:
1600: fnd_message.set_name('JTF', 'JTF_RS_INVALID_RESOURCE');
1601: fnd_message.set_token('P_RESOURCE_ID', l_resource_id);
1602: fnd_msg_pub.add;
1603:
1604: RAISE fnd_api.g_exc_error;
1597:
1598: -- dbms_output.put_line('Invalid or Inactive Resource');
1599:
1600: fnd_message.set_name('JTF', 'JTF_RS_INVALID_RESOURCE');
1601: fnd_message.set_token('P_RESOURCE_ID', l_resource_id);
1602: fnd_msg_pub.add;
1603:
1604: RAISE fnd_api.g_exc_error;
1605:
1616: IF c_resource_number%NOTFOUND THEN
1617:
1618: -- dbms_output.put_line('Invalid or Inactive Resource');
1619:
1620: fnd_message.set_name('JTF', 'JTF_RS_INVALID_RESOURCE_NUMBER');
1621: fnd_message.set_token('P_RESOURCE_NUMBER', l_resource_number);
1622: fnd_msg_pub.add;
1623:
1624: RAISE fnd_api.g_exc_error;
1617:
1618: -- dbms_output.put_line('Invalid or Inactive Resource');
1619:
1620: fnd_message.set_name('JTF', 'JTF_RS_INVALID_RESOURCE_NUMBER');
1621: fnd_message.set_token('P_RESOURCE_NUMBER', l_resource_number);
1622: fnd_msg_pub.add;
1623:
1624: RAISE fnd_api.g_exc_error;
1625:
1636: IF ( l_managing_emp_id IS NOT NULL AND l_managing_emp_id <> fnd_api.g_miss_num) THEN
1637:
1638: -- dbms_output.put_line('For OTHER category, source_id, address_id, contact_id and managing_emp_id should be all null');
1639:
1640: fnd_message.set_name('JTF', 'JTF_RS_OTHER_IDS_NOT_NULL');
1641: fnd_msg_pub.add;
1642: RAISE fnd_api.g_exc_error;
1643:
1644: END IF;
1719: FND_MSG_PUB.count_and_get (p_count => x_msg_count,
1720: p_data => x_msg_data);
1721: WHEN OTHERS THEN
1722: ROLLBACK TO update_resource_pub;
1723: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
1724: fnd_message.set_token('P_SQLCODE',SQLCODE);
1725: fnd_message.set_token('P_SQLERRM',SQLERRM);
1726: fnd_message.set_token('P_API_NAME', l_api_name);
1727: FND_MSG_PUB.add;
1720: p_data => x_msg_data);
1721: WHEN OTHERS THEN
1722: ROLLBACK TO update_resource_pub;
1723: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
1724: fnd_message.set_token('P_SQLCODE',SQLCODE);
1725: fnd_message.set_token('P_SQLERRM',SQLERRM);
1726: fnd_message.set_token('P_API_NAME', l_api_name);
1727: FND_MSG_PUB.add;
1728: x_return_status := fnd_api.g_ret_sts_unexp_error;
1721: WHEN OTHERS THEN
1722: ROLLBACK TO update_resource_pub;
1723: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
1724: fnd_message.set_token('P_SQLCODE',SQLCODE);
1725: fnd_message.set_token('P_SQLERRM',SQLERRM);
1726: fnd_message.set_token('P_API_NAME', l_api_name);
1727: FND_MSG_PUB.add;
1728: x_return_status := fnd_api.g_ret_sts_unexp_error;
1729: FND_MSG_PUB.count_and_get (p_count => x_msg_count,
1722: ROLLBACK TO update_resource_pub;
1723: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
1724: fnd_message.set_token('P_SQLCODE',SQLCODE);
1725: fnd_message.set_token('P_SQLERRM',SQLERRM);
1726: fnd_message.set_token('P_API_NAME', l_api_name);
1727: FND_MSG_PUB.add;
1728: x_return_status := fnd_api.g_ret_sts_unexp_error;
1729: FND_MSG_PUB.count_and_get (p_count => x_msg_count,
1730: p_data => x_msg_data);
1929: IF l_resource_id IS NULL AND l_resource_number is NULL THEN
1930:
1931: -- dbms_output.put_line('Resource Id and Resource Number are null');
1932:
1933: fnd_message.set_name('JTF', 'JTF_RS_RESOURCE_NULL');
1934: fnd_msg_pub.add;
1935:
1936: RAISE fnd_api.g_exc_error;
1937:
1947: IF c_resource_id%NOTFOUND THEN
1948:
1949: -- dbms_output.put_line('Invalid or Inactive Resource');
1950:
1951: fnd_message.set_name('JTF', 'JTF_RS_INVALID_RESOURCE');
1952: fnd_message.set_token('P_RESOURCE_ID', l_resource_id);
1953: fnd_msg_pub.add;
1954:
1955: RAISE fnd_api.g_exc_error;
1948:
1949: -- dbms_output.put_line('Invalid or Inactive Resource');
1950:
1951: fnd_message.set_name('JTF', 'JTF_RS_INVALID_RESOURCE');
1952: fnd_message.set_token('P_RESOURCE_ID', l_resource_id);
1953: fnd_msg_pub.add;
1954:
1955: RAISE fnd_api.g_exc_error;
1956:
1967: IF c_resource_number%NOTFOUND THEN
1968:
1969: -- dbms_output.put_line('Invalid or Inactive Resource');
1970:
1971: fnd_message.set_name('JTF', 'JTF_RS_INVALID_RESOURCE_NUMBER');
1972: fnd_message.set_token('P_RESOURCE_NUMBER', l_resource_number);
1973: fnd_msg_pub.add;
1974:
1975: RAISE fnd_api.g_exc_error;
1968:
1969: -- dbms_output.put_line('Invalid or Inactive Resource');
1970:
1971: fnd_message.set_name('JTF', 'JTF_RS_INVALID_RESOURCE_NUMBER');
1972: fnd_message.set_token('P_RESOURCE_NUMBER', l_resource_number);
1973: fnd_msg_pub.add;
1974:
1975: RAISE fnd_api.g_exc_error;
1976:
1990: OR (l_managing_emp_id IS NOT NULL AND l_managing_emp_id <> fnd_api.g_miss_num )) THEN
1991:
1992: -- dbms_output.put_line('For OTHER category, source_id, address_id, contact_id and managing_emp_id should be all null');
1993:
1994: fnd_message.set_name('JTF', 'JTF_RS_OTHER_IDS_NOT_NULL');
1995: fnd_msg_pub.add;
1996: RAISE fnd_api.g_exc_error;
1997:
1998: END IF;
2119: FND_MSG_PUB.count_and_get (p_count => x_msg_count,
2120: p_data => x_msg_data);
2121: WHEN OTHERS THEN
2122: ROLLBACK TO update_resource_pub;
2123: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
2124: fnd_message.set_token('P_SQLCODE',SQLCODE);
2125: fnd_message.set_token('P_SQLERRM',SQLERRM);
2126: fnd_message.set_token('P_API_NAME', l_api_name);
2127: FND_MSG_PUB.add;
2120: p_data => x_msg_data);
2121: WHEN OTHERS THEN
2122: ROLLBACK TO update_resource_pub;
2123: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
2124: fnd_message.set_token('P_SQLCODE',SQLCODE);
2125: fnd_message.set_token('P_SQLERRM',SQLERRM);
2126: fnd_message.set_token('P_API_NAME', l_api_name);
2127: FND_MSG_PUB.add;
2128: x_return_status := fnd_api.g_ret_sts_unexp_error;
2121: WHEN OTHERS THEN
2122: ROLLBACK TO update_resource_pub;
2123: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
2124: fnd_message.set_token('P_SQLCODE',SQLCODE);
2125: fnd_message.set_token('P_SQLERRM',SQLERRM);
2126: fnd_message.set_token('P_API_NAME', l_api_name);
2127: FND_MSG_PUB.add;
2128: x_return_status := fnd_api.g_ret_sts_unexp_error;
2129: FND_MSG_PUB.count_and_get (p_count => x_msg_count,
2122: ROLLBACK TO update_resource_pub;
2123: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
2124: fnd_message.set_token('P_SQLCODE',SQLCODE);
2125: fnd_message.set_token('P_SQLERRM',SQLERRM);
2126: fnd_message.set_token('P_API_NAME', l_api_name);
2127: FND_MSG_PUB.add;
2128: x_return_status := fnd_api.g_ret_sts_unexp_error;
2129: FND_MSG_PUB.count_and_get (p_count => x_msg_count,
2130: p_data => x_msg_data);
2352:
2353:
2354: /* Validate the Resource. */
2355: IF l_resource_id IS NULL THEN
2356: fnd_message.set_name('JTF', 'JTF_RS_RESOURCE_NULL');
2357: fnd_msg_pub.add;
2358: RAISE fnd_api.g_exc_error;
2359:
2360: END IF;
2363: IF l_resource_id IS NOT NULL THEN
2364: OPEN res_cur(l_resource_id);
2365: FETCH res_cur INTO res_rec;
2366: IF res_cur%NOTFOUND THEN
2367: fnd_message.set_name('JTF', 'JTF_RS_INVALID_RESOURCE');
2368: fnd_message.set_token('P_RESOURCE_ID', l_resource_id);
2369: fnd_msg_pub.add;
2370: RAISE fnd_api.g_exc_error;
2371:
2364: OPEN res_cur(l_resource_id);
2365: FETCH res_cur INTO res_rec;
2366: IF res_cur%NOTFOUND THEN
2367: fnd_message.set_name('JTF', 'JTF_RS_INVALID_RESOURCE');
2368: fnd_message.set_token('P_RESOURCE_ID', l_resource_id);
2369: fnd_msg_pub.add;
2370: RAISE fnd_api.g_exc_error;
2371:
2372: END IF;
2371:
2372: END IF;
2373: IF res_rec.category <> 'TBH'
2374: THEN
2375: fnd_message.set_name('JTF', 'JTF_RS_NOT_TBH');
2376: fnd_msg_pub.add;
2377: RAISE fnd_api.g_exc_error;
2378: END IF;
2379: CLOSE res_cur;
2419: FND_MSG_PUB.count_and_get (p_count => x_msg_count,
2420: p_data => x_msg_data);
2421: WHEN OTHERS THEN
2422: ROLLBACK TO delete_resource_pub;
2423: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
2424: fnd_message.set_token('P_SQLCODE',SQLCODE);
2425: fnd_message.set_token('P_SQLERRM',SQLERRM);
2426: fnd_message.set_token('P_API_NAME', l_api_name);
2427: FND_MSG_PUB.add;
2420: p_data => x_msg_data);
2421: WHEN OTHERS THEN
2422: ROLLBACK TO delete_resource_pub;
2423: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
2424: fnd_message.set_token('P_SQLCODE',SQLCODE);
2425: fnd_message.set_token('P_SQLERRM',SQLERRM);
2426: fnd_message.set_token('P_API_NAME', l_api_name);
2427: FND_MSG_PUB.add;
2428: x_return_status := fnd_api.g_ret_sts_unexp_error;
2421: WHEN OTHERS THEN
2422: ROLLBACK TO delete_resource_pub;
2423: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
2424: fnd_message.set_token('P_SQLCODE',SQLCODE);
2425: fnd_message.set_token('P_SQLERRM',SQLERRM);
2426: fnd_message.set_token('P_API_NAME', l_api_name);
2427: FND_MSG_PUB.add;
2428: x_return_status := fnd_api.g_ret_sts_unexp_error;
2429: FND_MSG_PUB.count_and_get (p_count => x_msg_count,
2422: ROLLBACK TO delete_resource_pub;
2423: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
2424: fnd_message.set_token('P_SQLCODE',SQLCODE);
2425: fnd_message.set_token('P_SQLERRM',SQLERRM);
2426: fnd_message.set_token('P_API_NAME', l_api_name);
2427: FND_MSG_PUB.add;
2428: x_return_status := fnd_api.g_ret_sts_unexp_error;
2429: FND_MSG_PUB.count_and_get (p_count => x_msg_count,
2430: p_data => x_msg_data);
2882: OR l_managing_emp_num IS NOT NULL) THEN
2883:
2884: -- dbms_output.put_line('For OTHER category, source_id, address_id, contact_id and managing_emp_id should be all null');
2885:
2886: fnd_message.set_name('JTF', 'JTF_RS_OTHER_IDS_NOT_NULL');
2887: fnd_msg_pub.add;
2888:
2889: RAISE fnd_api.g_exc_error;
2890:
2899: /* Validate the source_id */
2900:
2901: IF (l_source_id IS NULL) THEN
2902: -- dbms_output.put_line('For PARTNER category, source_id should not be null');
2903: fnd_message.set_name('JTF', 'JTF_RS_PARTNER_IDS_NULL');
2904: fnd_msg_pub.add;
2905: RAISE fnd_api.g_exc_error;
2906:
2907: ELSE
2908: OPEN c_validate_partner(l_source_id);
2909: FETCH c_validate_partner INTO l_check_flag;
2910: IF c_validate_partner%NOTFOUND THEN
2911: -- dbms_output.put_line('Partner does not exist for the passed source_id');
2912: fnd_message.set_name('JTF', 'JTF_RS_INVALID_PARTNER_IDS');
2913: fnd_msg_pub.add;
2914: RAISE fnd_api.g_exc_error;
2915:
2916: END IF;
2923: OPEN c_validate_partner_address(l_source_id, l_address_id);
2924: FETCH c_validate_partner_address INTO l_check_flag;
2925: IF c_validate_partner_address%NOTFOUND THEN
2926: -- dbms_output.put_line('Invalid Partner Address Id');
2927: fnd_message.set_name('JTF', 'JTF_RS_ERR_PARTNER_ADDRESS_ID');
2928: fnd_message.set_token('P_ADDRESS_ID', l_address_id);
2929: fnd_msg_pub.add;
2930: RAISE fnd_api.g_exc_error;
2931:
2924: FETCH c_validate_partner_address INTO l_check_flag;
2925: IF c_validate_partner_address%NOTFOUND THEN
2926: -- dbms_output.put_line('Invalid Partner Address Id');
2927: fnd_message.set_name('JTF', 'JTF_RS_ERR_PARTNER_ADDRESS_ID');
2928: fnd_message.set_token('P_ADDRESS_ID', l_address_id);
2929: fnd_msg_pub.add;
2930: RAISE fnd_api.g_exc_error;
2931:
2932: END IF;
2940: OPEN c_validate_partner_contact(l_source_id, l_address_id, l_contact_id);
2941: FETCH c_validate_partner_contact INTO l_check_flag;
2942: IF c_validate_partner_contact%NOTFOUND THEN
2943: -- dbms_output.put_line('Invalid Partner Contact Id');
2944: fnd_message.set_name('JTF', 'JTF_RS_ERR_PARTNER_CONTACT_ID');
2945: fnd_message.set_token('P_CONTACT_ID', l_contact_id);
2946: fnd_msg_pub.add;
2947: RAISE fnd_api.g_exc_error;
2948:
2941: FETCH c_validate_partner_contact INTO l_check_flag;
2942: IF c_validate_partner_contact%NOTFOUND THEN
2943: -- dbms_output.put_line('Invalid Partner Contact Id');
2944: fnd_message.set_name('JTF', 'JTF_RS_ERR_PARTNER_CONTACT_ID');
2945: fnd_message.set_token('P_CONTACT_ID', l_contact_id);
2946: fnd_msg_pub.add;
2947: RAISE fnd_api.g_exc_error;
2948:
2949: END IF;
2960:
2961: IF l_category NOT IN ('OTHER' , 'PARTNER' , 'TBH', 'EMPLOYEE') THEN
2962: IF l_source_id IS NULL THEN
2963: -- dbms_output.put_line('Source Id should not be Null');
2964: fnd_message.set_name('JTF', 'JTF_RS_SOURCE_ID_NULL');
2965: fnd_msg_pub.add;
2966: RAISE fnd_api.g_exc_error;
2967:
2968: END IF;
2991: IF l_found = FALSE THEN
2992:
2993: -- dbms_output.put_line('Invalid Source Id');
2994:
2995: fnd_message.set_name('JTF', 'JTF_RS_INVALID_SOURCE_ID');
2996: fnd_message.set_token('P_SOURCE_ID', l_source_id);
2997: fnd_msg_pub.add;
2998:
2999: RAISE fnd_api.g_exc_error;
2992:
2993: -- dbms_output.put_line('Invalid Source Id');
2994:
2995: fnd_message.set_name('JTF', 'JTF_RS_INVALID_SOURCE_ID');
2996: fnd_message.set_token('P_SOURCE_ID', l_source_id);
2997: fnd_msg_pub.add;
2998:
2999: RAISE fnd_api.g_exc_error;
3000:
3010:
3011: if l_category = 'EMPLOYEE' THEN
3012: -- First check is null check for source id
3013: IF l_source_id IS NULL THEN
3014: fnd_message.set_name('JTF', 'JTF_RS_SOURCE_ID_NULL');
3015: fnd_msg_pub.add;
3016: RAISE fnd_api.g_exc_error;
3017: END IF;
3018:
3021: close c_emp_exist;
3022:
3023: if(nvl(r_emp_exist.value , 'y') <> 'x')
3024: then
3025: fnd_message.set_name('JTF', 'JTF_RS_INVALID_SOURCE_ID');
3026: fnd_message.set_token('P_SOURCE_ID', l_source_id);
3027: fnd_msg_pub.add;
3028: RAISE fnd_api.g_exc_error;
3029: end if;
3022:
3023: if(nvl(r_emp_exist.value , 'y') <> 'x')
3024: then
3025: fnd_message.set_name('JTF', 'JTF_RS_INVALID_SOURCE_ID');
3026: fnd_message.set_token('P_SOURCE_ID', l_source_id);
3027: fnd_msg_pub.add;
3028: RAISE fnd_api.g_exc_error;
3029: end if;
3030:
3046: IF c_validate_party_address%NOTFOUND THEN
3047:
3048: -- dbms_output.put_line('Invalid Party Address');
3049:
3050: fnd_message.set_name('JTF', 'JTF_RS_INVALID_PARTY_ADDRESS');
3051: fnd_message.set_token('P_ADDRESS_ID', l_address_id);
3052: fnd_msg_pub.add;
3053:
3054: RAISE fnd_api.g_exc_error;
3047:
3048: -- dbms_output.put_line('Invalid Party Address');
3049:
3050: fnd_message.set_name('JTF', 'JTF_RS_INVALID_PARTY_ADDRESS');
3051: fnd_message.set_token('P_ADDRESS_ID', l_address_id);
3052: fnd_msg_pub.add;
3053:
3054: RAISE fnd_api.g_exc_error;
3055:
3076: IF c_validate_party_contact%NOTFOUND THEN
3077:
3078: -- dbms_output.put_line('Invalid Party Contact Id');
3079:
3080: fnd_message.set_name('JTF', 'JTF_RS_ERR_PARTY_CONTACT_ID');
3081: fnd_message.set_token('P_CONTACT_ID', l_contact_id);
3082: fnd_msg_pub.add;
3083:
3084: RAISE fnd_api.g_exc_error;
3077:
3078: -- dbms_output.put_line('Invalid Party Contact Id');
3079:
3080: fnd_message.set_name('JTF', 'JTF_RS_ERR_PARTY_CONTACT_ID');
3081: fnd_message.set_token('P_CONTACT_ID', l_contact_id);
3082: fnd_msg_pub.add;
3083:
3084: RAISE fnd_api.g_exc_error;
3085:
3107: IF (l_contact_id IS NOT NULL) THEN
3108:
3109: -- dbms_output.put_line('For SUPPLIER_CONTACT category, address_id and contact_id should be null');
3110:
3111: fnd_message.set_name('JTF', 'JTF_RS_SC_IDS_NOT_NULL');
3112: fnd_msg_pub.add;
3113:
3114: RAISE fnd_api.g_exc_error;
3115:
3129: IF (l_contact_id IS NOT NULL OR l_managing_emp_id IS NOT NULL OR l_managing_emp_num IS NOT NULL) THEN
3130:
3131: -- dbms_output.put_line('For EMPLOYEE category, contact_id should be null');
3132:
3133: fnd_message.set_name('JTF', 'JTF_RS_EMP_IDS_NOT_NULL');
3134: fnd_msg_pub.add;
3135:
3136: RAISE fnd_api.g_exc_error;
3137:
3171: IF l_start_date_active IS NULL THEN
3172:
3173: -- dbms_output.put_line('Start Date Active cannot be null');
3174:
3175: fnd_message.set_name('JTF', 'JTF_RS_START_DATE_NULL');
3176: fnd_msg_pub.add;
3177:
3178: RAISE fnd_api.g_exc_error;
3179:
3309: IF c_assigned_to_group_id%NOTFOUND THEN
3310:
3311: -- dbms_output.put_line('Invalid Assigned To Group Id');
3312:
3313: fnd_message.set_name('JTF', 'JTF_RS_ERR_ASSIGN_TO_GRP_ID');
3314: fnd_message.set_token('P_ASSIGNED_TO_GROUP_ID', l_assigned_to_group_id);
3315: fnd_msg_pub.add;
3316:
3317: RAISE fnd_api.g_exc_error;
3310:
3311: -- dbms_output.put_line('Invalid Assigned To Group Id');
3312:
3313: fnd_message.set_name('JTF', 'JTF_RS_ERR_ASSIGN_TO_GRP_ID');
3314: fnd_message.set_token('P_ASSIGNED_TO_GROUP_ID', l_assigned_to_group_id);
3315: fnd_msg_pub.add;
3316:
3317: RAISE fnd_api.g_exc_error;
3318:
3355: IF l_commissionable_flag <> 'Y' AND l_commissionable_flag <> 'N' THEN
3356:
3357: -- dbms_output.put_line('Commissionable Flag should either be ''Y'' or ''N'' ');
3358:
3359: fnd_message.set_name('JTF', 'JTF_RS_INVALID_FLAG_VALUE');
3360: fnd_msg_pub.add;
3361:
3362: RAISE fnd_api.g_exc_error;
3363:
3370: IF l_hold_payment <> 'Y' AND l_hold_payment <> 'N' THEN
3371:
3372: -- dbms_output.put_line('Hold Payment should either be ''Y'' or ''N'' ');
3373:
3374: fnd_message.set_name('JTF', 'JTF_RS_INVALID_FLAG_VALUE');
3375: fnd_msg_pub.add;
3376:
3377: RAISE fnd_api.g_exc_error;
3378:
3409: IF l_category NOT IN ('EMPLOYEE', 'PARTY', 'SUPPLIER_CONTACT') THEN
3410:
3411: IF l_user_id IS NOT NULL THEN
3412:
3413: fnd_message.set_name('JTF', 'JTF_RS_USERID_ERROR');
3414: fnd_msg_pub.add;
3415:
3416: RAISE fnd_api.g_exc_error;
3417:
3448: IF c_validate_user_id%FOUND THEN
3449:
3450: -- dbms_output.put_line('duplicate user Id');
3451:
3452: fnd_message.set_name('JTF', 'JTF_RS_ERR_DUPLICATE_USER_ID');
3453: fnd_message.set_token('P_USER_ID', l_user_id);
3454: fnd_msg_pub.add;
3455:
3456: RAISE fnd_api.g_exc_error;
3449:
3450: -- dbms_output.put_line('duplicate user Id');
3451:
3452: fnd_message.set_name('JTF', 'JTF_RS_ERR_DUPLICATE_USER_ID');
3453: fnd_message.set_token('P_USER_ID', l_user_id);
3454: fnd_msg_pub.add;
3455:
3456: RAISE fnd_api.g_exc_error;
3457:
3698: FND_MSG_PUB.count_and_get (p_count => x_msg_count,
3699: p_data => x_msg_data);
3700: WHEN OTHERS THEN
3701: ROLLBACK TO create_resource_sp;
3702: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
3703: fnd_message.set_token('P_SQLCODE',SQLCODE);
3704: fnd_message.set_token('P_SQLERRM',SQLERRM);
3705: fnd_message.set_token('P_API_NAME', l_api_name);
3706: FND_MSG_PUB.add;
3699: p_data => x_msg_data);
3700: WHEN OTHERS THEN
3701: ROLLBACK TO create_resource_sp;
3702: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
3703: fnd_message.set_token('P_SQLCODE',SQLCODE);
3704: fnd_message.set_token('P_SQLERRM',SQLERRM);
3705: fnd_message.set_token('P_API_NAME', l_api_name);
3706: FND_MSG_PUB.add;
3707: x_return_status := fnd_api.g_ret_sts_unexp_error;
3700: WHEN OTHERS THEN
3701: ROLLBACK TO create_resource_sp;
3702: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
3703: fnd_message.set_token('P_SQLCODE',SQLCODE);
3704: fnd_message.set_token('P_SQLERRM',SQLERRM);
3705: fnd_message.set_token('P_API_NAME', l_api_name);
3706: FND_MSG_PUB.add;
3707: x_return_status := fnd_api.g_ret_sts_unexp_error;
3708: FND_MSG_PUB.count_and_get (p_count => x_msg_count,
3701: ROLLBACK TO create_resource_sp;
3702: fnd_message.set_name ('JTF', 'JTF_RS_UNEXP_ERROR');
3703: fnd_message.set_token('P_SQLCODE',SQLCODE);
3704: fnd_message.set_token('P_SQLERRM',SQLERRM);
3705: fnd_message.set_token('P_API_NAME', l_api_name);
3706: FND_MSG_PUB.add;
3707: x_return_status := fnd_api.g_ret_sts_unexp_error;
3708: FND_MSG_PUB.count_and_get (p_count => x_msg_count,
3709: p_data => x_msg_data);