1 PACKAGE BODY UMX_REGISTER_USER_PVT as
2 /* $Header: UMXIBURB.pls 120.5 2006/07/13 23:28:22 kching noship $ */
3 -- Start of Comments
4 -- Package name : UMX_REGISTER_USER_PVT
5 -- Purpose :
6 -- This package contains specification user registration
7
8
9 Procedure CreatePersonPartyInternal (p_event in out NOCOPY WF_EVENT_T,
10 p_person_party_id out NOCOPY varchar2)
11 IS
12
13 --l_person_party_id hz_parties.party_id%type;
14 l_first_name hz_parties.person_first_name%type;
15 l_last_name hz_parties.person_last_name%type;
16 l_middle_name hz_parties.person_middle_name%type;
17 l_pre_name_adjunct hz_parties.person_pre_name_adjunct%type;
18 l_person_name_suffix hz_parties.person_name_suffix%type;
19
20 l_party_number hz_parties.party_number%type;
21 l_person_rec HZ_PARTY_V2PUB.PERSON_REC_TYPE;
22 l_profile_id NUMBER;
23
24
25 X_Return_Status VARCHAR2 (20);
26 X_Msg_Count NUMBER;
27 X_Msg_data VARCHAR2 (300);
28
29
30 BEGIN
31
32 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
33 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
34 'fnd.plsql.UMXIBURB.createpersonpartyinternal.begin','');
35 end if;
36
37
38 -- read from the event object
39 l_first_name := p_event.getvalueforparameter ('FIRST_NAME');
40 l_last_name := p_event.getvalueforparameter ('LAST_NAME');
41 l_middle_name := p_event.getvalueforparameter ('MIDDLE_NAME');
42 l_pre_name_adjunct := p_event.getvalueforparameter ('PRE_NAME_ADJUNCT');
43
44 l_person_name_suffix := p_event.getvalueforparameter ('PERSON_SUFFIX');
45
46
47 --populate the person record
48
49 l_person_rec.person_first_name := l_first_name;
50 l_person_rec.person_middle_name := l_middle_name;
51 l_person_rec.person_last_name := l_last_name;
52 l_person_rec.person_pre_name_adjunct := l_pre_name_adjunct;
53 l_person_rec.person_name_suffix := l_person_name_suffix;
54 l_person_rec.created_by_module := G_CREATED_BY_MODULE;
55 l_person_rec.application_id := 0;
56
57 if (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
58 FND_LOG.STRING (FND_LOG.LEVEL_STATEMENT,
59 'fnd.plsql.UMXIBURB.createpersonpartyinternal',
60 'invoking Hz_party_v2_pub.createperson');
61 end if;
62
63
64 HZ_PARTY_V2PUB.create_person (
65 p_person_rec => l_person_rec,
66 x_party_id => p_person_party_id,
67 x_party_number => l_party_number,
68 x_profile_id => l_profile_id,
69 x_return_status => X_Return_Status,
70 x_msg_count => X_Msg_Count,
71 x_msg_data => X_Msg_Data);
72
73 if (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
74 FND_LOG.STRING (FND_LOG.LEVEL_STATEMENT,
75 'fnd.plsql.UMXIBURB.createpersonpartyinternal',
76 'completed Hz_party_v2_pub.createperson: ' || x_return_status);
77 end if;
78
79 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
80 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
81 end if;
82
83 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
84 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
85 'fnd.plsql.UMXIBURB.createpersonpartyinternal.end','');
86 end if;
87
88 END CreatePersonPartyInternal;
89
90
91
92 Procedure CreateContactPointInternal (p_event in out NOCOPY WF_EVENT_T,
93 p_contact_party_id in varchar2)
94 IS
95
96
97 l_contact_point_id hz_contact_points.contact_point_id%type;
98 l_contact_preference_id hz_contact_preferences.contact_preference_id%type;
99 l_email_format HZ_CONTACT_POINTS.email_format%type;
100 l_email_address HZ_CONTACT_POINTS.email_address%type;
101 --initially this was raw phone num changed to phone_number
102 -- bug #3483248
103 l_primary_phone HZ_CONTACT_POINTS.phone_number%type;
104 l_area_code HZ_CONTACT_POINTS.phone_area_code%type;
105 l_country_code HZ_CONTACT_POINTS.phone_country_code%type;
106 l_phone_purpose HZ_CONTACT_POINTS.contact_point_purpose%type;
107 l_phone_extension HZ_CONTACT_POINTS.phone_extension%type;
108 l_profile_id number;
109
110
111 l_contact_point_rec HZ_CONTACT_POINT_V2PUB.CONTACT_POINT_REC_TYPE;
112 l_email_rec HZ_CONTACT_POINT_V2PUB.EMAIL_REC_TYPE;
113 l_phone_rec HZ_CONTACT_POINT_V2PUB.PHONE_REC_TYPE;
114
115 X_Return_Status VARCHAR2 (20);
116 X_Msg_Count NUMBER;
117 X_Msg_data VARCHAR2 (300);
118
119 BEGIN
120
121 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
122 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
123 'fnd.plsql.UMXIBURB.createcontactpointinternal.begin','');
124 end if;
125
126 -- get the values from event object
127 l_email_address := p_event.getvalueforparameter ('EMAIL_ADDRESS');
128 l_email_format := p_event.getvalueforparameter ('EMAIL_PREFERENCE');
129 l_primary_phone := p_event.getvalueforparameter ('PRIMARY_PHONE');
130 l_area_code := p_event.getvalueforparameter ('AREA_CODE');
131 l_country_code := p_event.getvalueforparameter ('COUNTRY_CODE');
132 l_phone_purpose := p_event.getvalueforparameter ('PHONE_PURPOSE');
133 l_phone_extension := p_event.getvalueforparameter ('PHONE_EXTENSION');
134
135
136 --populate the record
137
138 l_contact_point_rec.status := 'A';
139 l_contact_point_rec.owner_table_name := 'HZ_PARTIES';
140 l_contact_point_rec.owner_table_id := p_contact_party_id;
141 l_contact_point_rec.primary_flag := 'Y';
142 l_contact_point_rec.created_by_module := G_CREATED_BY_MODULE;
143 l_contact_point_rec.application_id := 0;
144
145 if l_email_address is not null then
146 l_contact_point_rec.contact_point_type := 'EMAIL';
147
148 l_email_rec.email_address := l_email_address;
149 l_email_rec.email_format := l_email_format;
150
151
152
153 HZ_CONTACT_POINT_V2PUB.create_contact_point (
154 p_contact_point_rec => l_contact_point_rec,
155 p_email_rec => l_email_rec,
156 x_contact_point_id => l_contact_point_id,
157 x_return_status => X_Return_Status,
158 x_msg_count => X_Msg_Count,
159 x_msg_data => X_Msg_Data);
160
161
162 if (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
163 FND_LOG.STRING (FND_LOG.LEVEL_STATEMENT,
164 'fnd.plsql.UMXIBURB.createcontactpointinternal',
165 'processed HZ_CONTACT_POINT_V2 mail: ' || x_return_status);
166 end if;
167
168 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
169 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
170 end if;
171
172 end if; --mail address not null
173
174
175
176 if l_primary_phone is not null then
177 l_contact_point_rec.contact_point_type := 'PHONE';
178 l_contact_point_rec.contact_point_purpose := l_phone_purpose;
179 --bug #3483248
180 l_phone_rec.phone_number := l_primary_phone;
181 l_phone_rec.phone_area_code := l_area_code;
182 l_phone_rec.phone_country_code := l_country_code;
183 l_phone_rec.phone_extension := l_phone_extension;
184 l_phone_rec.phone_line_type := 'GEN';
185
186 HZ_CONTACT_POINT_V2PUB.create_contact_point (
187 p_contact_point_rec => l_contact_point_rec,
188 p_phone_rec => l_phone_rec,
189 x_contact_point_id => l_contact_point_id,
190 x_return_status => X_Return_Status,
191 x_msg_count => X_Msg_Count,
192 x_msg_data => X_Msg_Data );
193
194
195 if (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
196 FND_LOG.STRING (FND_LOG.LEVEL_STATEMENT,
197 'fnd.plsql.UMXIBURB.createcontactpointinternal',
198 'processed HZ_CONTACT_POINT_V2 phone: ' || x_return_status);
199 end if;
200
201 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
202 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
203 end if;
204
205
206 end if;
207
208 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
209 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
210 'fnd.plsql.UMXIBURB.createcontactpointinternal.end','');
211 end if;
212
213 END CreateContactPointInternal;
214
215
216
217
218
219
220 --
221 -- Procedure
222 -- Registerb2bUser_Internal
223 -- Description
224 -- check if ame approval has been defined for this registration service.
225 -- IN
226 -- itemtype - A valid item type from (WF_ITEM_TYPES table).
227 -- itemkey - A string generated from the application object's primary key.
228 -- actid - The function activity (instance id).
229 -- command - Run/Cancel/Timeout
230 -- OUT
231 -- resultout - result of the process based on which the next step is followed
232
233 Procedure RegisterB2BUser_Internal (p_event in out NOCOPY WF_EVENT_T,
234 p_person_party_id out NOCOPy varchar2) IS
235
236
237 l_org_contact_id NUMBER;
238 l_party_rel_id NUMBER;
239 l_profile_id NUMBER;
240 l_org_party_id NUMBER;
241
242 l_org_contact_rec HZ_PARTY_CONTACT_V2PUB.org_contact_rec_type;
243 l_party_rel_rec HZ_RELATIONSHIP_V2PUB.relationship_rec_type;
244 x_org_contact_party_id NUMBER;
245 l_party_id NUMBER;-- to be used for contactpoints
246 l_party_number VARCHAR2 (100);
247
248 X_Return_Status VARCHAR2 (20);
249 X_Msg_Count NUMBER;
250 X_Msg_data VARCHAR2 (300);
251
252 Begin
253 --null;
254 -- create person.
255 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
256 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
257 'fnd.plsql.UMXIBURB.Registerb2bUser_Internal.begin',
258 '');
259 end if;
260
261
262 CreatePersonPartyInternal (p_event, p_person_party_id);
263
264 -- l_org_party_id := p_event.getvalueforparameter ('ORG_PARTY_ID');
265
266 -- create org relation for this personpartyId and the organization Number
267
268 l_org_party_id := p_event.getvalueforparameter ('ORGANIZATION_PARTY_ID');
269
270 l_party_rel_rec.subject_id := p_person_party_id;
271 l_party_rel_rec.subject_type := 'PERSON';
272 l_party_rel_rec.subject_table_name := 'HZ_PARTIES';
273 l_party_rel_rec.relationship_type := 'EMPLOYMENT';
274 l_party_rel_rec.relationship_code := 'EMPLOYEE_OF';
275 l_party_rel_rec.start_date := sysdate; -- change later
276 l_party_rel_rec.object_id := l_org_party_id;
277 l_party_rel_rec.object_type := 'ORGANIZATION';
278 l_party_rel_rec.object_table_name := 'HZ_PARTIES';
279 l_party_rel_rec.created_by_module := G_CREATED_BY_MODULE;
280 l_party_rel_rec.application_id := 0;
281 l_org_contact_rec.party_rel_rec := l_party_rel_rec;
282 l_org_contact_rec.created_by_module := G_CREATED_BY_MODULE;
283 l_org_contact_rec.application_id := 0;
284
285 HZ_PARTY_CONTACT_V2PUB.create_org_contact (
286 --p_init_msg_list => P_Init_Msg_List,
287 p_org_contact_rec => l_org_contact_rec,
288 x_org_contact_id => x_org_contact_party_id,
289 x_party_rel_id => l_party_rel_id,
290 x_party_id => l_party_id,
291 x_party_number => l_party_number,
292 x_return_status => X_Return_Status,
293 x_msg_count => X_Msg_Count,
294 x_msg_data => X_Msg_data
295 );
296 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
297 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
298 end if;
299
300 CreateContactPointInternal (p_event, to_char (l_party_id));
301
302 -- create contact
303
304 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
305 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
306 'fnd.plsql.UMXIBURB.Registerb2bUser_Internal.end',
307 '');
308 end if;
309 end RegisterB2BUser_Internal;
310
311
312 --
313 -- Procedure
314 -- RegisterB2CUser_Internal
315 -- Description
316 -- check if ame approval has been defined for this registration service.
317 -- IN
318 -- itemtype - A valid item type from (WF_ITEM_TYPES table).
319 -- itemkey - A string generated from the application object's primary key.
320 -- actid - The function activity (instance id).
321 -- command - Run/Cancel/Timeout
322 -- OUT
323 -- resultout - result of the process based on which the next step is followed
324
325 Procedure RegisterB2CUser_Internal (p_event in out NOCOPY WF_EVENT_T,
326 p_person_party_id out NOCOPY varchar2 )
327
328 IS
329 l_contact_preference_rec HZ_CONTACT_PREFERENCE_V2PUB.CONTACT_PREFERENCE_REC_TYPE;
330 l_contact_preference VARCHAR2 (5);
331 l_contact_preference_id number;
332 X_Return_Status VARCHAR2 (20);
333 X_Msg_Count NUMBER;
334 X_Msg_data VARCHAR2 (300);
335 BEGIN
336
337 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
338 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
339 'fnd.plsql.UMXIBURB.RegisterB2CUser_Internal.begin',
340 '');
341 end if;
342 -- Create individual person party
343
344 CreatePersonPartyInternal (p_event,p_person_party_id);
345 CreateContactPointInternal (p_event,p_person_party_id);
346
347 -- populate contact preference
348 l_contact_preference := p_event.getvalueforparameter ('CONTACT_PREFERENCE');
349
350 if (l_contact_preference = 'Y') then
351 l_contact_preference_rec.preference_code := 'DO';
352 else
353 l_contact_preference_rec.preference_code := 'DO_NOT';
354 end if;
355
356 l_contact_preference_rec.contact_level_table := 'HZ_PARTIES';
357 l_contact_preference_rec.contact_level_table_id := p_person_party_id;
358 l_contact_preference_rec.contact_type := 'EMAIL';
359 l_contact_preference_rec.requested_by := 'INTERNAL';
360 l_contact_preference_rec.created_by_module := G_CREATED_BY_MODULE;
361 l_contact_preference_rec.application_id := 0;
362
363 if (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
364 FND_LOG.STRING (FND_LOG.LEVEL_STATEMENT,
365 'fnd.plsql.UMXIBURB.RegisterB2CUser_Internal',
366 'invoking hz_createContactpreference for party_id:' || p_person_party_id);
367 end if;
368
369 HZ_CONTACT_PREFERENCE_V2PUB.create_contact_preference (
370 p_contact_preference_rec => l_contact_preference_rec,
371 x_contact_preference_id => l_contact_preference_id,
372 x_return_status => x_return_status,
373 x_msg_count => x_msg_count,
374 x_msg_data => x_msg_data
375 );
376
377 if x_return_status <> FND_API.G_RET_STS_SUCCESS then
378 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
379 end if;
380
381 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
382 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
383 'fnd.plsql.UMXIBURB.RegisterB2CUser_Internal.end',
384 '');
385 end if;
386 END RegisterB2CUser_Internal;
387
388
389 --
390 -- Function
391 -- create_person_party
392 --
393 -- Description
394 -- This method is a subscriber to the event oracle.apps.fnd.umx.createpersonp
395 -- TCA apis are used to populate into hz tables
396 -- based on the page from where this is invoked, a B2B or B2C party is created
397 -- IN
398 -- the signature follows Workflow business events standards
399 -- p_subscription_guid - Run/Cancel/Timeout
400 -- IN/OUT
401 -- p_event - WF_EVENT_T which holds the data that needs to passed from/to
402 -- subscriber of the event
403 --
404
405 function create_person_party (p_subscription_guid in raw,
406 p_event in out NOCOPY WF_EVENT_T)
407 return varchar2 is
408
409
410
411 BEGIN
412
413 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
414 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
415 'fnd.plsql.UMXIBURB.Createpersonparty.begin',
416 '');
417 end if;
418
419 -- removing all the implimentation since we split this into two subscriptions
420 -- register_individual_user and register_business_user
421 -- this code should never be invoked. Disabled the subscription
422 return 'ERROR';
423 END create_person_party;
424
425 --
426 -- Procedure
427 -- Get_Party_Email_Address
428 -- Description
429 -- This API will ...
430 -- Get the email address from the person party.
431 -- If email is missing, then ...
432 -- Get the email address from the party relationship.
433 -- If email is still missing, then return null
434 --
435 -- IN
436 -- p_person_party_id - The party ID of the person defined in hz_parties table
437 -- OUT
438 -- x_email_address - Email address of the person
439
440 Procedure Get_Party_Email_Address (p_person_party_id in hz_parties.party_id%type,
441 x_email_address out NOCOPY hz_parties.email_address%type) is
442
443 cursor get_email_from_person_party (p_person_party_id in hz_parties.party_id%type) is
444 select email_address
445 from hz_parties
446 where party_id = p_person_party_id;
447
448 cursor get_email_from_party_rel (p_person_party_id in hz_parties.party_id%type) is
449 select hzp_rel.email_address
450 from hz_parties hzp_rel, hz_relationships hzr
451 where hzr.subject_id = p_person_party_id
452 and hzr.party_id = hzp_rel.party_id
453 and hzp_rel.email_address is not null;
454
455 begin
456
457 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
458 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
459 'fnd.plsql.UMXIBURB.GetPartyEmailAddress.begin',
460 'personPartyId: ' || p_person_party_id);
461 end if;
462
463 open get_email_from_person_party (p_person_party_id);
464 fetch get_email_from_person_party into x_email_address;
465 close get_email_from_person_party;
466
467 if (x_email_address is null) then
468 -- We need to get the email address from Party Relationship table
469 open get_email_from_party_rel (p_person_party_id);
470 fetch get_email_from_party_rel into x_email_address;
471 close get_email_from_party_rel;
472 end if;
473
474 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
475 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
476 'fnd.plsql.UMXIBURB.getpartyemailaddress.end',
477 'emailAddress: ' || x_email_address);
478 end if;
479
480 end Get_Party_Email_Address;
481
482 FUNCTION GET_PERSON_EMAIL_ADDRESS (p_person_party_id in hz_parties.party_id%type) return varchar2 is
483
484 l_email_address hz_parties.email_address%type;
485 begin
486
487 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
488 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
489 'fnd.plsql.UMXIBURB.getpersonemailaddress.begin',
490 'Invoking getPartyemailaddress:' || p_person_party_id);
491 end if;
492
493 Get_Party_Email_Address (p_person_party_id => p_person_party_id,
494 x_email_address => l_email_address);
495
496 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
497 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
498 'fnd.plsql.UMXIBURB.getpersonemailaddress.end',
499 'after getPartyemailaddress:' || l_email_address);
500 end if;
501
502 return l_email_address;
503
504 end GET_PERSON_EMAIL_ADDRESS;
505
506 --
507 -- Function
508 -- Register_Business_user
509 --
510 -- Description
511 -- This method is a subscriber to the event oracle.apps.fnd.umx.b2bparty.create
512 -- TCA apis are used to populate into hz tables
513 -- This method creates a business User
514 -- IN
515 -- the signature follows Workflow business events standards
516 -- p_subscription_guid - Run/Cancel/Timeout
517 -- IN/OUT
518 -- p_event - WF_EVENT_T which holds the data that needs to passed from/to
519 -- subscriber of the event
520 --
521 function Register_Business_User (p_subscription_guid in raw,
522 p_event in out NOCOPY WF_EVENT_T) return varchar2 is
523
524 l_parameter_list wf_parameter_list_t;
525 l_success VARCHAR2 (10);
526 p_person_party_id varchar2 (30);
527
528 BEGIN
529
530 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
531 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
532 'fnd.plsql.UMXIBURB.Register_Business_User.begin',
533 'Begin');
534 end if;
535
536 if (p_event.getValueForParameter ('UMX_CUSTOM_EVENT_CONTEXT') = UMX_PUB.BEFORE_ACT_ACTIVATION) then
537
538
539 /**
540 **log all the params passed to this subscription
541 */
542 if (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
543 l_parameter_list := p_event.getparameterlist ();
544 for i in 1..l_parameter_list.count loop
545 FND_LOG.STRING (FND_LOG.LEVEL_STATEMENT,
546 'fnd.plsql.UMXIBURB.Register_Business_User',
547 'name:' || l_parameter_list (i).getName () ||
548 ' value:' || l_parameter_list (i).getValue ());
549 end loop;
550 end if;
551
552 --create B2B party and populate the event object back to main workflow
553
554 RegisterB2BUser_Internal (p_event,p_person_party_id);
555
556 if (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
557 FND_LOG.STRING (FND_LOG.LEVEL_STATEMENT,
558 'fnd.plsql.UMXIBURB.Register_Business_User',
559 'Invoking setevent object personPartyId: ' || p_person_party_id);
560 end if;
561
562 l_success := UMX_REGISTRATION_UTIL.set_event_object (p_event, 'PERSON_PARTY_ID', p_person_party_id);
563 end if;
564
565 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
566 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
567 'fnd.plsql.UMXIBURB.Register_Business_User.end',
568 'End');
569 end if;
570 return 'SUCCESS';
571
572 EXCEPTION
573 WHEN OTHERS THEN
574
575 if (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
576 FND_LOG.STRING (FND_LOG.LEVEL_STATEMENT,
577 'fnd.plsql.UMXIBURB.Register_Business_User',
578 'Exception occurs');
579 end if;
580
581 WF_CORE.CONTEXT ('UMX_REGISTER_USER_PVT', 'REGISTER_BUSINESS_USER',
582 p_event.getEventName ( ),p_subscription_guid,
583 sqlerrm,sqlcode);
584
585 WF_EVENT.SetErrorInfo (p_event,'ERROR');
586
587 return 'ERROR';
588
589 END Register_Business_User;
590
591
592 --
593 -- Function
594 -- Register_Individual_User
595 --
596 -- Description
597 -- This method is a subscriber to the event oracle.apps.fnd.umx.b2cparty.create
598 -- TCA apis are used to populate into hz tables
599 -- This method creates a business User
600 -- IN
601 -- the signature follows Workflow business events standards
602 -- p_subscription_guid - Run/Cancel/Timeout
603 -- IN/OUT
604 -- p_event - WF_EVENT_T which holds the data that needs to passed from/to
605 -- subscriber of the event
606 --
607 function Register_Individual_user (p_subscription_guid in raw,
608 p_event in out NOCOPY WF_EVENT_T) return varchar2 is
609
610 l_parameter_list wf_parameter_list_t;
611 l_success VARCHAR2 (10);
612 p_person_party_id varchar2 (30);
613
614 BEGIN
615
616 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
617 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
618 'fnd.plsql.UMXIBURB.Register_Individual_user.begin',
619 'Begin');
620 end if;
621
622 if (p_event.getValueForParameter ('UMX_CUSTOM_EVENT_CONTEXT') = UMX_PUB.BEFORE_ACT_ACTIVATION) then
623
624 /**
625 **log all the params passed to this subscription
626 */
627
628 if (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
629
630 l_parameter_list := p_event.getparameterlist ();
631 for i in 1..l_parameter_list.count loop
632 FND_LOG.STRING (FND_LOG.LEVEL_STATEMENT,
633 'fnd.plsql.UMXIBURB.Register_Individual_user','name:' || l_parameter_list (i).getName () ||
634 ' value:' || l_parameter_list (i).getValue ());
635 end loop;
636
637 end if;
638
639 --create B2C party and populate the event object back to main workflow
640 RegisterB2CUser_Internal (p_event, p_person_party_id);
641
642 if (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
643 FND_LOG.STRING (FND_LOG.LEVEL_STATEMENT,
644 'fnd.plsql.UMXIBURB.Register_Individual_user',
645 'Invoking setevent object personPartyId: ' || p_person_party_id);
646 end if;
647
648 l_success := UMX_REGISTRATION_UTIL.set_event_object (p_event,'PERSON_PARTY_ID', p_person_party_id);
649
650 end if;
651
652 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
653 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE,
654 'fnd.plsql.UMXIBURB.Register_Individual_user.end',
655 'End');
656 end if;
657 return 'SUCCESS';
658
659 EXCEPTION
660 WHEN OTHERS THEN
661
662 WF_CORE.CONTEXT ('UMX_REGISTER_USER_PVT', 'REGISTER_Individual_user',
663 p_event.getEventName (), p_subscription_guid,
664 sqlerrm,sqlcode);
665 WF_EVENT.SetErrorInfo (p_event,'ERROR');
666 return 'ERROR';
667
668 END Register_Individual_User;
669
670 --
671 -- Function
672 -- userExists
673 -- Description
674 -- This API is no longer a wrapper for fnd_user_pkg.userExists. It will
675 -- query from fnd_user table and it
676 -- will return 'Y' if username is being used and
677 -- 'N' if username is not being used.
678 -- IN
679 -- p_user_name - User name
680 -- OUT
681 -- 'Y' - User name is being used.
682 -- 'N' - User name is not being used.
683 function userExists (p_user_name in fnd_user.user_name%type) return varchar2 is
684 retString varchar2 (1);
685
686 cursor get_fnd_user is
687 select 'Y' from fnd_user where user_name = p_user_name;
688
689 begin
690 open get_fnd_user;
691 fetch get_fnd_user into retString;
692 if (get_fnd_user%notfound) then
693 retString := 'N';
694 end if;
695 close get_fnd_user;
696
697 return retString;
698 end userExists;
699
700 --
701 -- Procedure
702 -- TestUserName
703 -- Description
704 -- This API is a wrapper to fnd_user_pkg.TestUserName.
705 -- "This api test whether a username exists in FND and/or in OID."
706 -- IN
707 -- p_user_name - User name to be tested.
708 -- OUT
709 -- x_return_status - The following statuses are defined in fnd_user_pkg:
710 -- USER_OK_CREATE : User does not exist in either FND or OID
711 -- USER_INVALID_NAME : User name is not valid
712 -- USER_EXISTS_IN_FND : User exists in FND
713 -- USER_SYNCHED : User exists in OID and next time when this user gets created
714 -- in FND, the two will be synched together.
715 -- USER_EXISTS_NO_LINK_ALLOWED: User exists in OID and no synching allowed.
716 -- x_message_app_name - The application short name of the message in the fnd
717 -- message stack that contents the detail message.
718 -- x_message_name - The message name of the message in the FND message stack that
719 -- contents the detail message.
720 -- x_message_text - The detail message in the FND message stack.
721 ----------------------------------------------------------------------------
722 Procedure TestUserName (p_user_name in fnd_user.user_name%type,
723 x_return_status out nocopy pls_integer,
724 x_message_app_name out nocopy fnd_application.application_short_name%type,
725 x_message_name out nocopy fnd_new_messages.message_name%type,
726 x_message_text out nocopy fnd_new_messages.message_text%type) is
727
728 l_encoded_message varchar2 (32100);
729
730 begin
731
732 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
733 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE, 'fnd.plsql.UMXIBURB.TestUserName.begin',
734 'p_user_name=' || p_user_name);
735 end if;
736
737 x_return_status := fnd_user_pkg.TestUserName (x_user_name => p_user_name);
738
739 if (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
740 FND_LOG.STRING (FND_LOG.LEVEL_STATEMENT, 'fnd.plsql.UMXIBURB.TestUserName',
741 'After invoking fnd_user_pkg.TestUserName x_return_status=>' || x_return_status);
742 end if;
743
744 if (x_return_status = fnd_user_pkg.USER_SYNCHED) then
745 x_message_app_name := 'FND';
746 x_message_name := 'UMX_REG_USER_SYNCHED_CONF_MSG';
747 elsif not (x_return_status = fnd_user_pkg.USER_OK_CREATE) then
748 l_encoded_message := fnd_message.get_encoded;
749 fnd_message.parse_encoded (encoded_message => l_encoded_message,
750 app_short_name => x_message_app_name,
751 message_name => x_message_name);
752 fnd_message.set_encoded (l_encoded_message);
753 x_message_text := fnd_message.get;
754 end if;
755
756 if (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) then
757 FND_LOG.STRING (FND_LOG.LEVEL_PROCEDURE, 'fnd.plsql.UMXIBURB.TestUserName.end',
758 'x_message_app_name=' || x_message_app_name || ' x_message_name=' || x_message_name ||
759 ' x_message_text=' || x_message_text);
760 end if;
761
762 end TestUserName;
763
764 end UMX_REGISTER_USER_PVT;