100:
101: -- Return the requester username
102: function getRequesterUsername (userID in varchar2) return varchar2 is
103:
104: requesterUsername fnd_user.user_name%type;
105:
106: cursor getUserNameCursor is
107: select USER_NAME
108: from FND_USER
104: requesterUsername fnd_user.user_name%type;
105:
106: cursor getUserNameCursor is
107: select USER_NAME
108: from FND_USER
109: where USER_ID = userID
110: and (nvl (END_DATE, sysdate + 1) > sysdate
111: or to_char(END_DATE) = to_char(FND_API.G_MISS_DATE));
112: -- Bug Fix: 4741111: Added the clause to look for pending users
129: return requesterUsername;
130: end getRequesterUsername;
131:
132: -- Return the userid from username
133: function getUserID (username in varchar2) return fnd_user.user_id%type is
134:
135: userId fnd_user.user_id%type;
136:
137: cursor getUserIDCursor is
131:
132: -- Return the userid from username
133: function getUserID (username in varchar2) return fnd_user.user_id%type is
134:
135: userId fnd_user.user_id%type;
136:
137: cursor getUserIDCursor is
138: select user_id
139: from FND_USER
135: userId fnd_user.user_id%type;
136:
137: cursor getUserIDCursor is
138: select user_id
139: from FND_USER
140: where USER_NAME = username
141: and (nvl (END_DATE, sysdate + 1) > sysdate OR
142: to_char(END_DATE) = to_char(FND_API.G_MISS_DATE));
143:
211: --
212: -- Description
213: -- Return the organization information of the user.
214: -- IN
215: -- p_user_id - fnd user_id
216: -- OUT
217: -- x_org_name - organization's name
218: -- x_org_number - organization's number
219: --
216: -- OUT
217: -- x_org_name - organization's name
218: -- x_org_number - organization's number
219: --
220: procedure get_org_info (p_user_id in fnd_user.user_id%type,
221: x_org_name out NOCOPY hz_parties.party_name%type,
222: x_org_number out NOCOPY hz_parties.party_number%type) is
223:
224: l_method_name varchar2 (12) := 'GET_ORG_INFO';
224: l_method_name varchar2 (12) := 'GET_ORG_INFO';
225:
226: cursor getOrgNameAndNumber is
227: select hz.party_name, hz.party_number
228: from fnd_user fnd, hz_parties hz, hz_relationships hzr
229: where fnd.user_id = p_user_id
230: and fnd.customer_id = hzr.party_id
231: and hzr.start_date <= sysdate
232: and nvl (hzr.end_date, sysdate + 1) > sysdate
225:
226: cursor getOrgNameAndNumber is
227: select hz.party_name, hz.party_number
228: from fnd_user fnd, hz_parties hz, hz_relationships hzr
229: where fnd.user_id = p_user_id
230: and fnd.customer_id = hzr.party_id
231: and hzr.start_date <= sysdate
232: and nvl (hzr.end_date, sysdate + 1) > sysdate
233: and hzr.relationship_code in ('EMPLOYEE_OF','CONTACT_OF')
297: -- Initiate workflow for a um approval
298: -- This API will not launch the workflow process.
299: -- To launch workflow process, call LaunchProcess.
300: -- IN
301: -- ownerUserID -- The FND userID of the workflow owner
302: -- requestType -- The type of request, 'ENROLLMENT/USERTYPE'
303: -- requestID -- ID of the request.
304: -- requesterUserID -- The FND userID of the requester
305: -- requestRegID -- USERTYPE_REG_ID or SUBSCRIPTION_REG_ID
300: -- IN
301: -- ownerUserID -- The FND userID of the workflow owner
302: -- requestType -- The type of request, 'ENROLLMENT/USERTYPE'
303: -- requestID -- ID of the request.
304: -- requesterUserID -- The FND userID of the requester
305: -- requestRegID -- USERTYPE_REG_ID or SUBSCRIPTION_REG_ID
306: --
307: procedure CreateProcess (ownerUserId in number := null,
308: requestType in varchar2,
313: itemtype varchar2 (8);
314: itemkey number := requestRegID;
315: itemUserKey wf_items.user_key%type;
316: userID number;
317: requesterUsername fnd_user.user_name%type;
318: requesterUsertypeID number;
319: approvalID number;
320: usePendingReqFlag varchar2 (1);
321: processOwner varchar2 (100);
604: approvalID number;
605: approvalURL fnd_profile_option_values.profile_option_value%type;
606: companyNumber number;
607: senderName fnd_profile_option_values.profile_option_value%type;
608: ownerUsername fnd_user.user_name%type;
609: requesterUserID fnd_user.user_id%type;
610: requesterUserName fnd_user.user_name%type;
611: requestId number;
612: requestName varchar2 (1000);
605: approvalURL fnd_profile_option_values.profile_option_value%type;
606: companyNumber number;
607: senderName fnd_profile_option_values.profile_option_value%type;
608: ownerUsername fnd_user.user_name%type;
609: requesterUserID fnd_user.user_id%type;
610: requesterUserName fnd_user.user_name%type;
611: requestId number;
612: requestName varchar2 (1000);
613: requestType varchar2 (10);
606: companyNumber number;
607: senderName fnd_profile_option_values.profile_option_value%type;
608: ownerUsername fnd_user.user_name%type;
609: requesterUserID fnd_user.user_id%type;
610: requesterUserName fnd_user.user_name%type;
611: requestId number;
612: requestName varchar2 (1000);
613: requestType varchar2 (10);
614: respApplID number;
628:
629: --
630: cursor getCompanyNumber is
631: select hz.party_number
632: from hz_parties hz, hz_relationships hzr, fnd_user fnd
633: where fnd.user_id = requesterUserID
634: and fnd.customer_id = hzr.party_id
635: and hzr.start_date <= sysdate
636: and nvl (hzr.end_date, sysdate + 1) > sysdate
629: --
630: cursor getCompanyNumber is
631: select hz.party_number
632: from hz_parties hz, hz_relationships hzr, fnd_user fnd
633: where fnd.user_id = requesterUserID
634: and fnd.customer_id = hzr.party_id
635: and hzr.start_date <= sysdate
636: and nvl (hzr.end_date, sysdate + 1) > sysdate
637: and hzr.relationship_code in ('EMPLOYEE_OF','CONTACT_OF')
886:
887: exception
888: when MISSING_REQUESTER_USER_ID then
889: wf_core.context ('JTF_UM_WF_APPROVAL', 'Initialization', itemtype, itemkey, to_char (actid), funcmode,
890: 'Requester User ID is missing in the FND_USER');
891: raise;
892: when others then
893: wf_core.context ('JTF_UM_WF_APPROVAL', 'Initialization', itemtype, itemkey, to_char (actid), funcmode);
894: raise;
917: x_role_name out NOCOPY varchar2,
918: x_role_name_display out NOCOPY varchar2) is
919:
920: l_method_name varchar2 (20) := 'GET_ORG_AD_HOC_ROLE';
921: l_requester_user_id fnd_user.user_id%type;
922: l_org_name hz_parties.party_name%type;
923: l_org_number hz_parties.party_number%type;
924: l_uni_approver_not_found boolean := true;
925: l_role_name wf_local_roles.name%type;
930: from WF_LOCAL_ROLES
931: where name = x_role_name;
932:
933: cursor getUniversalApprovers is
934: select fnd.user_name
935: from hz_parties hz_org, hz_relationships hzr, fnd_user fnd
936: where hz_org.party_number = l_org_number
937: and hz_org.party_type = 'ORGANIZATION'
938: and hz_org.party_id = hzr.object_id
931: where name = x_role_name;
932:
933: cursor getUniversalApprovers is
934: select fnd.user_name
935: from hz_parties hz_org, hz_relationships hzr, fnd_user fnd
936: where hz_org.party_number = l_org_number
937: and hz_org.party_type = 'ORGANIZATION'
938: and hz_org.party_id = hzr.object_id
939: and hzr.start_date <= sysdate
956: and role_perms.jtf_auth_permission_id = perm.jtf_auth_permission_id
957: and prin_maps.jtf_auth_domain_id = domains_b.jtf_auth_domain_id
958: and domains_b.domain_name = 'CRM_DOMAIN'
959: and perm.permission_name = 'JTF_PRIMARY_USER_SUMMARY'
960: and prin_b.principal_name = fnd.user_name
961: );
962: --changes for 4734470
963:
964: UserTable WF_DIRECTORY.UserTable;
1057: resultout out NOCOPY varchar2) is
1058: --
1059: applID number;
1060: approverID number (15);
1061: approverUsername fnd_user.user_name%type;
1062: approverUserID fnd_user.user_id%type;
1063: requestType varchar2 (10);
1064: requestId number;
1065: resultType varchar2 (5);
1058: --
1059: applID number;
1060: approverID number (15);
1061: approverUsername fnd_user.user_name%type;
1062: approverUserID fnd_user.user_id%type;
1063: requestType varchar2 (10);
1064: requestId number;
1065: resultType varchar2 (5);
1066: uniPrimaryUser fnd_profile_option_values.profile_option_value%type;
1228: and APPROVAL_ID = l_approvalID;
1229:
1230: cursor nextApproverInfoCursor is
1231: select a.APPROVER_ID, a.USER_ID, f.USER_NAME
1232: from JTF_UM_APPROVERS a, FND_USER f
1233: where a.APPROVER_SEQ > l_approverSeq
1234: and a.APPROVAL_ID = l_approvalID
1235: and a.org_party_id is null
1236: and a.EFFECTIVE_START_DATE <= sysdate
1242: order by a.APPROVER_SEQ;
1243:
1244: cursor nextOrgApproverInfoCursor is
1245: select a.APPROVER_ID, a.USER_ID, f.USER_NAME
1246: from JTF_UM_APPROVERS a, FND_USER f
1247: where a.APPROVER_SEQ > l_approverSeq
1248: and a.APPROVAL_ID = l_approvalID
1249: and a.ORG_PARTY_ID = l_org_party_id
1250: and a.EFFECTIVE_START_DATE <= sysdate
1266: -- select the requesters org party id
1267: cursor requesterOrgCursor is
1268: select hzr.object_id requester_org_id
1269: from hz_relationships hzr,
1270: FND_USER fu
1271: where fu.USER_ID = l_requesterUserID
1272: and fu.CUSTOMER_ID = hzr.PARTY_ID
1273: and hzr.start_date <= sysdate
1274: and nvl (hzr.END_DATE, sysdate + 1) > sysdate
1519: requestType varchar2 (10);
1520:
1521: cursor getUserID is
1522: select USER_ID
1523: from FND_USER
1524: where USER_NAME = ownerUsername;
1525: --
1526: begin
1527:
1680: l_return_status varchar2 (1);
1681:
1682: cursor getUserID is
1683: select USER_ID
1684: from FND_USER
1685: where USER_NAME = WF_ENGINE.context_text;
1686: --
1687: begin
1688:
1878: and STATUS_CODE = 'PENDING';
1879:
1880: cursor requesterUserNameCursor is
1881: select USER_NAME
1882: from FND_USER
1883: where USER_ID = requesterUserID
1884: and (nvl(END_DATE,sysdate) >= sysdate OR
1885: to_char(END_DATE) = to_char(FND_API.G_MISS_DATE));
1886:
2082:
2083: userStartDate date;
2084: userEndDate date;
2085: -- adding for Bug 4320347
2086: l_customer_id FND_USER.CUSTOMER_ID%TYPE;
2087: l_person_party_id FND_USER.PERSON_PARTY_ID%TYPE;
2088: -- end of changes for 4320347
2089: --
2090: cursor enrollmentsCursor is
2083: userStartDate date;
2084: userEndDate date;
2085: -- adding for Bug 4320347
2086: l_customer_id FND_USER.CUSTOMER_ID%TYPE;
2087: l_person_party_id FND_USER.PERSON_PARTY_ID%TYPE;
2088: -- end of changes for 4320347
2089: --
2090: cursor enrollmentsCursor is
2091: select WF_ITEM_TYPE, SUBSCRIPTION_REG_ID
2169: -- release the user name
2170: -- check if user is a pending user
2171: Select start_date,end_date,USER_NAME,customer_id,person_party_id
2172: Into userStartDate,userEndDate,requesterUsername,l_customer_id,l_person_party_id
2173: From FND_USER
2174: Where user_id = requesterUserID;
2175:
2176: If to_char(userStartDate) = to_char(FND_API.G_MISS_DATE)
2177: And to_char(userEndDate) = to_char(FND_API.G_MISS_DATE) then
2175:
2176: If to_char(userStartDate) = to_char(FND_API.G_MISS_DATE)
2177: And to_char(userEndDate) = to_char(FND_API.G_MISS_DATE) then
2178: -- release user
2179: FND_USER_PKG.RemovePendingUser(requesterUsername);
2180: End If;
2181:
2182: -- Event handling
2183: -- Get the values for creation of parameters for the event
2295: l_result varchar (10);
2296:
2297: cursor getFNDUserID is
2298: select user_id
2299: from fnd_user
2300: where (nvl (end_date, sysdate + 1) > sysdate
2301: OR to_char(END_DATE) = to_char(FND_API.G_MISS_DATE))
2302:
2303: and user_name = l_approver_username;
2459: funcmode in varchar2,
2460: resultout out NOCOPY varchar2) is
2461:
2462: l_appl_id JTF_UM_USERTYPES_B.APPLICATION_ID%TYPE;
2463: l_approver_username fnd_user.user_name%type;
2464: l_org_name hz_parties.party_name%type;
2465: l_org_number hz_parties.party_number%type;
2466: l_primary_user_role fnd_profile_option_values.profile_option_value%type;
2467: l_procedure_name CONSTANT varchar2(26) := 'universal_approvers_exists';
2466: l_primary_user_role fnd_profile_option_values.profile_option_value%type;
2467: l_procedure_name CONSTANT varchar2(26) := 'universal_approvers_exists';
2468: l_request_id number;
2469: l_request_type varchar2 (10);
2470: l_requester_user_id fnd_user.user_id%type;
2471: l_universal_approvers fnd_profile_option_values.profile_option_value%type;
2472:
2473: begin
2474:
2693: cursor getOrgDetail is
2694: SELECT party.status FROM HZ_PARTIES PARTY, HZ_RELATIONSHIPS PREL
2695: WHERE PARTY.PARTY_ID = PREL.OBJECT_ID
2696: AND PREL.PARTY_ID = (select fnd.customer_id
2697: from jtf_um_usertype_reg reg , fnd_user fnd
2698: where usertype_reg_id = to_number(itemkey)
2699: and reg.user_id=fnd.USER_ID
2700: )
2701: AND PREL.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
2695: WHERE PARTY.PARTY_ID = PREL.OBJECT_ID
2696: AND PREL.PARTY_ID = (select fnd.customer_id
2697: from jtf_um_usertype_reg reg , fnd_user fnd
2698: where usertype_reg_id = to_number(itemkey)
2699: and reg.user_id=fnd.USER_ID
2700: )
2701: AND PREL.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
2702: AND PREL.OBJECT_TABLE_NAME = 'HZ_PARTIES'
2703: AND PREL.START_DATE < SYSDATE
3185: p_org_party_id in number) is
3186:
3187: cursor usertype_reg is
3188: select utreg.usertype_reg_id, utreg.user_id
3189: from jtf_um_usertype_reg utreg, fnd_user fu, hz_relationships hzr
3190: where utreg.usertype_id = p_usertype_id
3191: and utreg.status_code = 'PENDING'
3192: and nvl (utreg.effective_end_date, sysdate + 1) > sysdate
3193: and utreg.user_id = fu.user_id
3314: or effective_end_date > sysdate);
3315:
3316: cursor subscription_reg_w_org is
3317: select subreg.subscription_reg_id, fu.user_id, subreg.wf_item_type
3318: from jtf_um_subscription_reg subreg, fnd_user fu, hz_relationships hzr
3319: where subreg.subscription_id = p_subscription_id
3320: and subreg.status_code = 'PENDING'
3321: and nvl (subreg.effective_end_date, sysdate + 1) > sysdate
3322: and subreg.user_id = fu.user_id