21: | HISTORY |
22: | 04-APR-2001 A Tereshenkov Created |
23: | Dec 19, 02 Sreedhar changed the process_group_id proc to add the |
24: | person_id as cursor paramter to c_email_info and |
25: | c_fnd_user_present. Also changed the c_email_info |
26: | to pick up the primary email address. bug 2712258 |
27: | |
28: | 27-JAN-2003 pkpatel (changed for Bug No 2753318, 2753728 )
29: | Create_Fnd_User, copy the password back to the workflow
25: | c_fnd_user_present. Also changed the c_email_info |
26: | to pick up the primary email address. bug 2712258 |
27: | |
28: | 27-JAN-2003 pkpatel (changed for Bug No 2753318, 2753728 )
29: | Create_Fnd_User, copy the password back to the workflow
30: | Generate_User, Added the validation that the password if entered should be at least 5 characters.
31: | Generate_Password, added the call of fnd_user_pkg.update_user if the primary email of the person has been changed.
32: | Create_Party, IGS_PE_TYP_INSTANCES_PKG.INSERT_row was commented
33: | 24-APR-2003 pkpatel Bug No: 2908802
27: | |
28: | 27-JAN-2003 pkpatel (changed for Bug No 2753318, 2753728 )
29: | Create_Fnd_User, copy the password back to the workflow
30: | Generate_User, Added the validation that the password if entered should be at least 5 characters.
31: | Generate_Password, added the call of fnd_user_pkg.update_user if the primary email of the person has been changed.
32: | Create_Party, IGS_PE_TYP_INSTANCES_PKG.INSERT_row was commented
33: | 24-APR-2003 pkpatel Bug No: 2908802
34: | Modified Create_Fnd_User procedure
35: | 01-jul-2003 KUMMA, 2803555, Added the code to set the tokens for message IGS_PE_WF_EXISTS
30: | Generate_User, Added the validation that the password if entered should be at least 5 characters.
31: | Generate_Password, added the call of fnd_user_pkg.update_user if the primary email of the person has been changed.
32: | Create_Party, IGS_PE_TYP_INSTANCES_PKG.INSERT_row was commented
33: | 24-APR-2003 pkpatel Bug No: 2908802
34: | Modified Create_Fnd_User procedure
35: | 01-jul-2003 KUMMA, 2803555, Added the code to set the tokens for message IGS_PE_WF_EXISTS
36: | added statement to add the blank lines between successive messages inside procedure Process_Group_ID
37: | 23-JUL-2003 asbala Bug No:2667343 Replaced Hard coded strings populating l_msg_data and errbuf with
38: | new messages
41: | 14-DEC-2004 pkpatel Bug 3316053 (Modified the logic for person number/alt id in generate_user.
42: | Set and Retrieve the new workflow item attribute in generate_user and ceate_party procedures.
43: | 23-APR-2003 asbala 3528702: Modified cursor c_resp. The job can now assign responsibilities other than those mapped too 'OTHER'.
44: | 23-JUN-2003 ssawhney bug 3713297 ..need to always select primary address and primary will always be ACTIVE
45: | 13-Apr-2005 ssaleem Bug 4293911 Fnd User customer Id replaced with person
46: | party id
47: | 21-SEP-2005 skpandey Bug: 3663505
48: | Description: Added ATTRIBUTES 21 TO 24 in create_party procedure to store additional information
49: | 19-Jan-06 gmaheswa 4869740: random number generators: dbms_random package is replaced by FND_CRYPTO for generating random numbers.
158: FROM hz_parties
159: WHERE party_id = cp_party_id;
160:
161: l_name VARCHAR2(30);
162: l_user_name FND_USER.USER_NAME%TYPE;
163: l_person_number HZ_PARTIES.PARTY_NUMBER%TYPE;
164: l_first_name HZ_PARTIES.PERSON_FIRST_NAME%TYPE;
165: l_last_name HZ_PARTIES. PERSON_LAST_NAME%TYPE;
166: l_middle_name HZ_PARTIES. PERSON_MIDDLE_NAME%TYPE;
172: l_gender HZ_PERSON_PROFILES.GENDER%TYPE;
173: l_birth_date DATE;
174: l_email_address HZ_CONTACT_POINTS.EMAIL_ADDRESS%TYPE;
175: l_email_format HZ_CONTACT_POINTS.EMAIL_FORMAT%TYPE;
176: l_test_user_name FND_USER.USER_NAME%TYPE;
177: l_number NUMBER;
178: l_init_user_name FND_USER.USER_NAME%TYPE;
179: l_count NUMBER := 0;
180: BEGIN
174: l_email_address HZ_CONTACT_POINTS.EMAIL_ADDRESS%TYPE;
175: l_email_format HZ_CONTACT_POINTS.EMAIL_FORMAT%TYPE;
176: l_test_user_name FND_USER.USER_NAME%TYPE;
177: l_number NUMBER;
178: l_init_user_name FND_USER.USER_NAME%TYPE;
179: l_count NUMBER := 0;
180: BEGIN
181: l_wf_name :='IGSPEGEN';
182: l_process_name :='MAIN_PROCESS';
231: l_init_user_name := replace(l_init_user_name, '~','');
232: l_init_user_name := replace(l_init_user_name, ':','');
233:
234: l_user_name := l_init_user_name;
235: l_test_user_name := fnd_user_pkg.TestUserName(l_user_name);
236:
237: WHILE (l_test_user_name <> fnd_user_pkg.USER_OK_CREATE AND l_count <= 100)
238: LOOP
239: l_number := FND_CRYPTO.RANDOMNUMBER;
233:
234: l_user_name := l_init_user_name;
235: l_test_user_name := fnd_user_pkg.TestUserName(l_user_name);
236:
237: WHILE (l_test_user_name <> fnd_user_pkg.USER_OK_CREATE AND l_count <= 100)
238: LOOP
239: l_number := FND_CRYPTO.RANDOMNUMBER;
240: IF l_number<0 THEN
241: l_number:=-l_number;
240: IF l_number<0 THEN
241: l_number:=-l_number;
242: END IF;
243: l_user_name := SUBSTR(l_init_user_name||SUBSTR(l_number,1,5),1,100);
244: l_test_user_name := fnd_user_pkg.TestUserName(l_user_name);
245: l_count := l_count+1;
246: END LOOP;
247:
248: IF (l_count > 100) THEN
458: NULL;
459:
460: END Create_Party ;
461:
462: PROCEDURE Create_Fnd_User
463: (
464: itemtype IN VARCHAR2,
465: itemkey IN VARCHAR2,
466: actid IN NUMBER,
482: || No need to verify the existing responsibility attached.
483: || asbala 23-APR-2003 3528702: Modified cursor c_resp. The job can now assign responsibilities other than those mapped too 'OTHER'.
484: || This bug resulted in a regression in funtionality.
485: || Combinedly c_get_Sys_typ, c_resp and c_get_assigned_resp achieve the same functionality as c_resp did before 2908802 changes.
486: || gmaheswa 19-Jan-06 4869740: depreciated api's: fnd_user_pvt package is replaced by fnd_user_pkg.
487: */
488: l_api_name CONSTANT VARCHAR2(30) := 'Create_Fnd_User' ;
489: l_return_status VARCHAR2(1);
490: l_user_id fnd_user.user_id%TYPE;
484: || This bug resulted in a regression in funtionality.
485: || Combinedly c_get_Sys_typ, c_resp and c_get_assigned_resp achieve the same functionality as c_resp did before 2908802 changes.
486: || gmaheswa 19-Jan-06 4869740: depreciated api's: fnd_user_pvt package is replaced by fnd_user_pkg.
487: */
488: l_api_name CONSTANT VARCHAR2(30) := 'Create_Fnd_User' ;
489: l_return_status VARCHAR2(1);
490: l_user_id fnd_user.user_id%TYPE;
491: l_user_name VARCHAR2(255);
492: l_user_password VARCHAR2(255);
486: || gmaheswa 19-Jan-06 4869740: depreciated api's: fnd_user_pvt package is replaced by fnd_user_pkg.
487: */
488: l_api_name CONSTANT VARCHAR2(30) := 'Create_Fnd_User' ;
489: l_return_status VARCHAR2(1);
490: l_user_id fnd_user.user_id%TYPE;
491: l_user_name VARCHAR2(255);
492: l_user_password VARCHAR2(255);
493: l_email_address VARCHAR2(255);
494: l_party_id hz_parties.party_id%TYPE;
510: -- Pass the password back to the workflow.
511: wf_engine.SetItemAttrText(itemtype,itemkey,'USER_PASSWORD', l_user_password );
512:
513: -- Create a user
514: l_user_id := fnd_user_pkg.CreateUserIdParty (
515: x_user_name => l_user_name,
516: x_owner => 'CUST',
517: x_unencrypted_password => l_user_password,
518: x_email_address => l_email_address,
555: wf_core.context('IGS_PE_USERID_PKG', l_api_name,
556: itemtype, itemkey, to_char(actid), funcmode,Generate_Message(),l_user_name,sqlerrm,fnd_message.get);
557: RAISE ;
558:
559: END Create_Fnd_User ;
560:
561:
562: -- Stubbed as part of UMX uptake
563: PROCEDURE Validate_Username
833: || Change History :
834: || Who When What
835: || (reverse chronological order - newest change first)
836: || pkpatel 23-JAN-2003 Bug NO: 2753318
837: || The fnd user was updated with the primary email address from hz_contact points
838: || so that the mail will go to the person's primary email.
839: || gmaheswa 19-Jna-06 4869740: Stubbed
840: */
841: BEGIN
1021: l_msg_data VARCHAR2(20000);
1022: l_error_text VARCHAR2(20000);
1023: l_email_address igs_pe_contacts_v.email_address%TYPE;
1024: l_email_format igs_pe_contacts_v.email_format%TYPE;
1025: l_user_name fnd_user.user_name%TYPE;
1026: l_user_end_date fnd_user.end_date%TYPE;
1027:
1028: l_commit VARCHAR2(100);
1029: l_init_msg_list VARCHAR2(100);
1022: l_error_text VARCHAR2(20000);
1023: l_email_address igs_pe_contacts_v.email_address%TYPE;
1024: l_email_format igs_pe_contacts_v.email_format%TYPE;
1025: l_user_name fnd_user.user_name%TYPE;
1026: l_user_end_date fnd_user.end_date%TYPE;
1027:
1028: l_commit VARCHAR2(100);
1029: l_init_msg_list VARCHAR2(100);
1030: l_valid_lvl NUMBER;
1066: SELECT email_address
1067: FROM hz_parties
1068: WHERE party_id = cp_person_id;
1069:
1070: CURSOR c_fnd_user_present(p_person_id IGS_PE_PERSON.PERSON_ID%TYPE) IS
1071: SELECT fnd.user_name,end_date
1072: FROM fnd_user fnd
1073: WHERE fnd.person_party_id = p_person_id;
1074:
1067: FROM hz_parties
1068: WHERE party_id = cp_person_id;
1069:
1070: CURSOR c_fnd_user_present(p_person_id IGS_PE_PERSON.PERSON_ID%TYPE) IS
1071: SELECT fnd.user_name,end_date
1072: FROM fnd_user fnd
1073: WHERE fnd.person_party_id = p_person_id;
1074:
1075: BEGIN
1068: WHERE party_id = cp_person_id;
1069:
1070: CURSOR c_fnd_user_present(p_person_id IGS_PE_PERSON.PERSON_ID%TYPE) IS
1071: SELECT fnd.user_name,end_date
1072: FROM fnd_user fnd
1073: WHERE fnd.person_party_id = p_person_id;
1074:
1075: BEGIN
1076: -- use local variables instead of the parameters (since parameters cannot be initialised here)
1156: EXIT WHEN pgroup_refcur%NOTFOUND;
1157:
1158: FND_MSG_PUB.initialize;
1159: --
1160: -- Check to determine if the person already has a user name assigned in fnd_user
1161: --
1162: l_user_name := NULL;
1163: l_user_end_date := NULL;
1164:
1161: --
1162: l_user_name := NULL;
1163: l_user_end_date := NULL;
1164:
1165: OPEN c_fnd_user_present(l_member_rec.person_id);
1166: FETCH c_fnd_user_present
1167: INTO l_user_name, l_user_end_date;
1168:
1169: IF (c_fnd_user_present%NOTFOUND) THEN
1162: l_user_name := NULL;
1163: l_user_end_date := NULL;
1164:
1165: OPEN c_fnd_user_present(l_member_rec.person_id);
1166: FETCH c_fnd_user_present
1167: INTO l_user_name, l_user_end_date;
1168:
1169: IF (c_fnd_user_present%NOTFOUND) THEN
1170:
1165: OPEN c_fnd_user_present(l_member_rec.person_id);
1166: FETCH c_fnd_user_present
1167: INTO l_user_name, l_user_end_date;
1168:
1169: IF (c_fnd_user_present%NOTFOUND) THEN
1170:
1171: --
1172: -- Ensure that the person has email information setup.
1173: --
1265: --
1266: IF (c_email_info%ISOPEN) THEN
1267: CLOSE c_email_info;
1268: END IF;
1269: IF (c_fnd_user_present%ISOPEN) THEN
1270: CLOSE c_fnd_user_present;
1271: END IF;
1272:
1273: END LOOP;
1266: IF (c_email_info%ISOPEN) THEN
1267: CLOSE c_email_info;
1268: END IF;
1269: IF (c_fnd_user_present%ISOPEN) THEN
1270: CLOSE c_fnd_user_present;
1271: END IF;
1272:
1273: END LOOP;
1274: CLOSE pgroup_refcur;
1343: AND ap.application_id =rsp.application_id
1344: AND ap.application_short_name = st.application_short_name;
1345:
1346: -- Cursor to check whether a particular responsibility is assigned to a person
1347: CURSOR c_get_assigned_resp (cp_user_id fnd_user_resp_groups_direct.user_id%TYPE,
1348: cp_responsibility_id fnd_user_resp_groups_direct.responsibility_id%TYPE,
1349: cp_resp_app_id fnd_user_resp_groups_direct.responsibility_application_id%TYPE) IS
1350: SELECT responsibility_id
1351: FROM fnd_user_resp_groups_direct
1344: AND ap.application_short_name = st.application_short_name;
1345:
1346: -- Cursor to check whether a particular responsibility is assigned to a person
1347: CURSOR c_get_assigned_resp (cp_user_id fnd_user_resp_groups_direct.user_id%TYPE,
1348: cp_responsibility_id fnd_user_resp_groups_direct.responsibility_id%TYPE,
1349: cp_resp_app_id fnd_user_resp_groups_direct.responsibility_application_id%TYPE) IS
1350: SELECT responsibility_id
1351: FROM fnd_user_resp_groups_direct
1352: WHERE user_id = cp_user_id
1345:
1346: -- Cursor to check whether a particular responsibility is assigned to a person
1347: CURSOR c_get_assigned_resp (cp_user_id fnd_user_resp_groups_direct.user_id%TYPE,
1348: cp_responsibility_id fnd_user_resp_groups_direct.responsibility_id%TYPE,
1349: cp_resp_app_id fnd_user_resp_groups_direct.responsibility_application_id%TYPE) IS
1350: SELECT responsibility_id
1351: FROM fnd_user_resp_groups_direct
1352: WHERE user_id = cp_user_id
1353: AND responsibility_id = cp_responsibility_id
1347: CURSOR c_get_assigned_resp (cp_user_id fnd_user_resp_groups_direct.user_id%TYPE,
1348: cp_responsibility_id fnd_user_resp_groups_direct.responsibility_id%TYPE,
1349: cp_resp_app_id fnd_user_resp_groups_direct.responsibility_application_id%TYPE) IS
1350: SELECT responsibility_id
1351: FROM fnd_user_resp_groups_direct
1352: WHERE user_id = cp_user_id
1353: AND responsibility_id = cp_responsibility_id
1354: AND responsibility_application_id = cp_resp_app_id;
1355:
1374: FETCH c_get_assigned_resp INTO c_get_assigned_resp_rec;
1375: IF c_get_assigned_resp%NOTFOUND THEN
1376:
1377: --Create a resp
1378: FND_USER_RESP_GROUPS_API.INSERT_ASSIGNMENT(
1379: user_id => p_user_id,
1380: responsibility_id => c_resp_rec.resp_id,
1381: responsibility_application_id => c_resp_rec.apps_id,
1382: security_group_id => 0,
1682:
1683: l_encoded_message VARCHAR2 (32100);
1684:
1685: BEGIN
1686: x_return_status := fnd_user_pkg.TestUserName (x_user_name => p_user_name);
1687: IF NOT (x_return_status = fnd_user_pkg.USER_OK_CREATE) THEN
1688: l_encoded_message := fnd_message.get_encoded;
1689: fnd_message.parse_encoded (encoded_message => l_encoded_message,
1690: app_short_name => x_message_app_name,
1683: l_encoded_message VARCHAR2 (32100);
1684:
1685: BEGIN
1686: x_return_status := fnd_user_pkg.TestUserName (x_user_name => p_user_name);
1687: IF NOT (x_return_status = fnd_user_pkg.USER_OK_CREATE) THEN
1688: l_encoded_message := fnd_message.get_encoded;
1689: fnd_message.parse_encoded (encoded_message => l_encoded_message,
1690: app_short_name => x_message_app_name,
1691: message_name => x_message_name);
1739: AND (cp_pref_alt_id IS NULL OR alt.api_person_id = cp_pref_alt_id )
1740: AND (cp_person_num IS NULL OR pe.person_number = cp_person_num )
1741: AND NVL(pe.gender,'X') = NVL(cp_gender,'X');
1742:
1743: -- FND user check
1744: CURSOR c_fnd_user(cp_party_id NUMBER) IS
1745: SELECT user_id
1746: FROM fnd_user
1747: WHERE person_party_id = cp_party_id;
1740: AND (cp_person_num IS NULL OR pe.person_number = cp_person_num )
1741: AND NVL(pe.gender,'X') = NVL(cp_gender,'X');
1742:
1743: -- FND user check
1744: CURSOR c_fnd_user(cp_party_id NUMBER) IS
1745: SELECT user_id
1746: FROM fnd_user
1747: WHERE person_party_id = cp_party_id;
1748:
1742:
1743: -- FND user check
1744: CURSOR c_fnd_user(cp_party_id NUMBER) IS
1745: SELECT user_id
1746: FROM fnd_user
1747: WHERE person_party_id = cp_party_id;
1748:
1749: l_count NUMBER;
1750: l_user_id FND_USER.USER_ID%TYPE;
1746: FROM fnd_user
1747: WHERE person_party_id = cp_party_id;
1748:
1749: l_count NUMBER;
1750: l_user_id FND_USER.USER_ID%TYPE;
1751: l_party_id HZ_PARTIES.PARTY_ID%TYPE;
1752:
1753: l_zip_count NUMBER;
1754: l_zip_exact_match BOOLEAN;
1827: l_label := 'igs.plsql.igs_pe_userid_pkg.Validate_Person.Dup_Person_Check';
1828: l_debug_str := 'Exact match found: Person_Id = '||l_party_id;
1829: fnd_log.string( fnd_log.level_procedure,l_label,l_debug_str);
1830: END IF;
1831: OPEN c_fnd_user(l_party_id);
1832: FETCH c_fnd_user INTO l_user_id;
1833: CLOSE c_fnd_user;
1834:
1835: p_person_id := l_party_id;
1828: l_debug_str := 'Exact match found: Person_Id = '||l_party_id;
1829: fnd_log.string( fnd_log.level_procedure,l_label,l_debug_str);
1830: END IF;
1831: OPEN c_fnd_user(l_party_id);
1832: FETCH c_fnd_user INTO l_user_id;
1833: CLOSE c_fnd_user;
1834:
1835: p_person_id := l_party_id;
1836: IF l_user_id IS NOT NULL THEN
1829: fnd_log.string( fnd_log.level_procedure,l_label,l_debug_str);
1830: END IF;
1831: OPEN c_fnd_user(l_party_id);
1832: FETCH c_fnd_user INTO l_user_id;
1833: CLOSE c_fnd_user;
1834:
1835: p_person_id := l_party_id;
1836: IF l_user_id IS NOT NULL THEN
1837: assign_responsibility(l_party_id, l_user_id);
2242: x_message_text OUT NOCOPY VARCHAR2
2243: ) IS
2244:
2245: l_result VARCHAR2(1);
2246: l_user_name fnd_user.user_name%TYPE;
2247: BEGIN
2248: IF p_user_name IS NULL THEN
2249: l_user_name := '-1';
2250: ELSE