264: SELECT user_name
265: FROM fnd_user
266: WHERE employee_id = p_person_id;
267: BEGIN
268: hr_utility.set_location ('Entering ' || g_package || ' : ' || l_proc,
269: 3000
270: );
271: hr_utility.TRACE ('p_person_id : ' || p_person_id);
272:
267: BEGIN
268: hr_utility.set_location ('Entering ' || g_package || ' : ' || l_proc,
269: 3000
270: );
271: hr_utility.TRACE ('p_person_id : ' || p_person_id);
272:
273: OPEN c2;
274:
275: FETCH c2
276: INTO l_fnd_user_name;
277:
278: IF c2%NOTFOUND
279: THEN
280: hr_utility.TRACE ('fnd person does not exist ' || p_person_id);
281: wf_core.RAISE ('fnd person does not exist ' || p_person_id);
282: END IF;
283:
284: CLOSE c2;
282: END IF;
283:
284: CLOSE c2;
285:
286: hr_utility.TRACE ('l_fnd_user_name : ' || l_fnd_user_name);
287: hr_utility.set_location ('Exiting ' || g_package || ' : ' || l_proc,
288: 3000
289: );
290: RETURN l_fnd_user_name;
283:
284: CLOSE c2;
285:
286: hr_utility.TRACE ('l_fnd_user_name : ' || l_fnd_user_name);
287: hr_utility.set_location ('Exiting ' || g_package || ' : ' || l_proc,
288: 3000
289: );
290: RETURN l_fnd_user_name;
291: EXCEPTION
325: WHERE item_key = p_item_key
326: AND item_type = g_itemtype
327: AND assigned_user = p_fnd_user_name;
328: BEGIN
329: hr_utility.set_location ('Entering ' || g_package || ' : ' || l_proc, 2000);
330: hr_utility.TRACE ('p_item_key : ' || p_item_key);
331: hr_utility.TRACE ('p_fnd_user_name : ' || p_fnd_user_name);
332:
333: IF p_fnd_user_name IS NULL THEN
326: AND item_type = g_itemtype
327: AND assigned_user = p_fnd_user_name;
328: BEGIN
329: hr_utility.set_location ('Entering ' || g_package || ' : ' || l_proc, 2000);
330: hr_utility.TRACE ('p_item_key : ' || p_item_key);
331: hr_utility.TRACE ('p_fnd_user_name : ' || p_fnd_user_name);
332:
333: IF p_fnd_user_name IS NULL THEN
334: hr_utility.TRACE ('p_fnd_user_name is null');
327: AND assigned_user = p_fnd_user_name;
328: BEGIN
329: hr_utility.set_location ('Entering ' || g_package || ' : ' || l_proc, 2000);
330: hr_utility.TRACE ('p_item_key : ' || p_item_key);
331: hr_utility.TRACE ('p_fnd_user_name : ' || p_fnd_user_name);
332:
333: IF p_fnd_user_name IS NULL THEN
334: hr_utility.TRACE ('p_fnd_user_name is null');
335: wf_core.RAISE ('p_fnd_user_name is null');
330: hr_utility.TRACE ('p_item_key : ' || p_item_key);
331: hr_utility.TRACE ('p_fnd_user_name : ' || p_fnd_user_name);
332:
333: IF p_fnd_user_name IS NULL THEN
334: hr_utility.TRACE ('p_fnd_user_name is null');
335: wf_core.RAISE ('p_fnd_user_name is null');
336: END IF;
337:
338: OPEN c1;
338: OPEN c1;
339: FETCH c1 INTO l_notification_id;
340:
341: IF c1%NOTFOUND THEN
342: hr_utility.TRACE ( 'Notification id not present for the user '
343: || p_fnd_user_name
344: || 'for the item key'
345: || p_item_key);
346: wf_core.RAISE ( 'Notification id is not present for the user '
349: || p_item_key);
350: END IF;
351:
352: CLOSE c1;
353: hr_utility.TRACE ('l_notification_id : ' || l_notification_id);
354: hr_utility.set_location ('Exiting ' || g_package || ' : ' || l_proc, 2000);
355: RETURN l_notification_id;
356: EXCEPTION
357: WHEN OTHERS THEN
350: END IF;
351:
352: CLOSE c1;
353: hr_utility.TRACE ('l_notification_id : ' || l_notification_id);
354: hr_utility.set_location ('Exiting ' || g_package || ' : ' || l_proc, 2000);
355: RETURN l_notification_id;
356: EXCEPTION
357: WHEN OTHERS THEN
358: wf_core.CONTEXT (g_package
436: l_err_stack VARCHAR2 (32000);
437: l_for_period VARCHAR2(30);
438: l_proc VARCHAR2 (100) := 'set_common_item_attributes';
439: BEGIN
440: hr_utility.set_location ('Entering ' || g_package || ':' || l_proc,
441: 100);
442: l_rcvr_fnd_user_name := get_fnd_user_name (p_rcvr_person_id);
443: hr_utility.TRACE ('l_rcvr_fnd_user_name ' || l_rcvr_fnd_user_name);
444:
439: BEGIN
440: hr_utility.set_location ('Entering ' || g_package || ':' || l_proc,
441: 100);
442: l_rcvr_fnd_user_name := get_fnd_user_name (p_rcvr_person_id);
443: hr_utility.TRACE ('l_rcvr_fnd_user_name ' || l_rcvr_fnd_user_name);
444:
445: l_for_period := get_for_period (p_group_per_in_ler_id);
446: hr_utility.TRACE ('l_for_period ' || l_for_period);
447:
442: l_rcvr_fnd_user_name := get_fnd_user_name (p_rcvr_person_id);
443: hr_utility.TRACE ('l_rcvr_fnd_user_name ' || l_rcvr_fnd_user_name);
444:
445: l_for_period := get_for_period (p_group_per_in_ler_id);
446: hr_utility.TRACE ('l_for_period ' || l_for_period);
447:
448: l_from_fnd_user_name := get_fnd_user_name (p_from_person_id);
449: hr_utility.TRACE ('l_from_fnd_user_name ' || l_from_fnd_user_name);
450:
445: l_for_period := get_for_period (p_group_per_in_ler_id);
446: hr_utility.TRACE ('l_for_period ' || l_for_period);
447:
448: l_from_fnd_user_name := get_fnd_user_name (p_from_person_id);
449: hr_utility.TRACE ('l_from_fnd_user_name ' || l_from_fnd_user_name);
450:
451: wf_engine.setitemattrtext (itemtype => g_itemtype,
452: itemkey => p_item_key,
453: aname => 'MESSAGE_TYPE',
452: itemkey => p_item_key,
453: aname => 'MESSAGE_TYPE',
454: avalue => p_message_type
455: );
456: hr_utility.TRACE ( ' item attribute MESSAGE_TYPE is set to '
457: || p_message_type
458: );
459: wf_engine.setitemattrtext (itemtype => g_itemtype,
460: itemkey => p_item_key,
460: itemkey => p_item_key,
461: aname => 'RCVR_USER_NAME',
462: avalue => l_rcvr_fnd_user_name
463: );
464: hr_utility.TRACE ( ' item attribute RCVR_USER_NAME is set to '
465: || l_rcvr_fnd_user_name
466: );
467: wf_engine.setitemattrtext (itemtype => g_itemtype,
468: itemkey => p_item_key,
469: aname => 'RCVR_PERSON_NAME',
470: avalue => get_person_name
471: (p_group_per_in_ler_id)
472: );
473: hr_utility.TRACE ( ' item attribute RCVR_PERSON_NAME is set to '
474: || l_rcvr_fnd_user_name
475: );
476: wf_engine.setitemattrtext
477: (itemtype => 'BENCWBFY',
492: aname => 'FOR_PERIOD',
493: avalue => l_for_period
494: );
495:
496: hr_utility.TRACE ( ' item attribute l_for_period is set to '
497: || l_for_period
498: );
499:
500: hr_utility.TRACE (' item attribute PLAN_NAME is set ');
496: hr_utility.TRACE ( ' item attribute l_for_period is set to '
497: || l_for_period
498: );
499:
500: hr_utility.TRACE (' item attribute PLAN_NAME is set ');
501: wf_engine.setitemattrtext (itemtype => 'BENCWBFY',
502: itemkey => p_item_key,
503: aname => 'GROUP_PER_IN_LER_ID',
504: avalue => p_group_per_in_ler_id
502: itemkey => p_item_key,
503: aname => 'GROUP_PER_IN_LER_ID',
504: avalue => p_group_per_in_ler_id
505: );
506: hr_utility.TRACE ( ' item attribute GROUP_PER_IN_LER_ID is set to '
507: || p_group_per_in_ler_id
508: );
509: wf_engine.setitemattrtext (itemtype => 'BENCWBFY',
510: itemkey => p_item_key,
510: itemkey => p_item_key,
511: aname => 'TRANSACTION_ID',
512: avalue => p_transaction_id
513: );
514: hr_utility.TRACE ( ' item attribute TRANSACTION_ID is set to '
515: || p_transaction_id
516: );
517: wf_engine.setitemattrtext (itemtype => g_itemtype,
518: itemkey => p_item_key,
518: itemkey => p_item_key,
519: aname => 'FROM_ROLE',
520: avalue => l_from_fnd_user_name
521: );
522: hr_utility.TRACE ( ' item attribute FROM_ROLE is set to '
523: || l_from_fnd_user_name
524: );
525: hr_utility.set_location ('Exiting ' || g_package || ':' || l_proc, 100);
526: END;
521: );
522: hr_utility.TRACE ( ' item attribute FROM_ROLE is set to '
523: || l_from_fnd_user_name
524: );
525: hr_utility.set_location ('Exiting ' || g_package || ':' || l_proc, 100);
526: END;
527:
528: PROCEDURE set_access_due_item_attributes (p_item_key IN NUMBER)
529: IS
527:
528: PROCEDURE set_access_due_item_attributes (p_item_key IN NUMBER)
529: IS
530: BEGIN
531: hr_utility.TRACE ('p_item_key ' || p_item_key);
532:
533: wf_engine.setitemattrtext (itemtype => g_itemtype,
534: itemkey => p_item_key,
535: aname => 'FYI_COMMENTS',
539:
540: PROCEDURE set_appr_ntf_item_attribute (p_item_key IN NUMBER)
541: IS
542: BEGIN
543: hr_utility.TRACE ('p_item_key ' || p_item_key);
544:
545: wf_engine.setitemattrtext (itemtype => g_itemtype,
546: itemkey => p_item_key,
547: aname => 'FYI_COMMENTS',
551:
552: PROCEDURE set_iss_budgt_item_attributes (p_item_key IN NUMBER)
553: IS
554: BEGIN
555: hr_utility.TRACE ('p_item_key ' || p_item_key);
556:
557: wf_engine.setitemattrtext (itemtype => g_itemtype,
558: itemkey => p_item_key,
559: aname => 'FYI_COMMENTS',
576: l_err_msg VARCHAR2 (2000);
577: l_err_stack VARCHAR2 (32000);
578: BEGIN
579:
580: hr_utility.set_location ('Entering ' || g_package || ':' || l_proc, 10);
581:
582: --
583: -- A unique itemkey is generated for every workflow transaction
584: --
585: SELECT ben_cwb_wf_ntf_s.NEXTVAL
586: INTO l_itemkey
587: FROM DUAL;
588:
589: hr_utility.TRACE ('l_itemkey : ' || l_itemkey);
590:
591: IF l_itemkey IS NULL
592: THEN
593: hr_utility.TRACE ('l_itemkey is null');
589: hr_utility.TRACE ('l_itemkey : ' || l_itemkey);
590:
591: IF l_itemkey IS NULL
592: THEN
593: hr_utility.TRACE ('l_itemkey is null');
594: fnd_message.set_name ('BEN', 'BEN_93399_CWB_NTF_ITEM_KEY_ERR');
595: fnd_message.raise_error;
596: END IF;
597:
596: END IF;
597:
598: IF p_rcvr_person_id IS NULL
599: THEN
600: hr_utility.TRACE ('p_rcvr_person_id is null');
601: fnd_message.set_name ('BEN', 'BEN_93400_CWB_NTF_NO_PERSON_ID');
602: fnd_message.raise_error;
603: END IF;
604:
601: fnd_message.set_name ('BEN', 'BEN_93400_CWB_NTF_NO_PERSON_ID');
602: fnd_message.raise_error;
603: END IF;
604:
605: hr_utility.TRACE ('p_rcvr_person_id : ' || p_rcvr_person_id);
606:
607: BEGIN
608: wf_engine.createprocess (itemtype => g_itemtype,
609: itemkey => l_itemkey,
608: wf_engine.createprocess (itemtype => g_itemtype,
609: itemkey => l_itemkey,
610: process => g_wfprocess
611: );
612: hr_utility.TRACE ( 'Workflow process '
613: || g_wfprocess
614: || ' for itemtype '
615: || g_itemtype
616: || ' itemkey '
623: wf_core.get_error (l_err_name, l_err_msg, l_err_stack);
624:
625: IF (l_err_name IS NOT NULL)
626: THEN
627: hr_utility.TRACE ( 'Following Workflow error has occured'
628: || l_err_msg
629: || 'Error stack for this is '
630: || l_err_stack
631: );
637: );
638: wf_core.CLEAR;
639: fnd_message.raise_error;
640: ELSE
641: hr_utility.TRACE
642: ( 'A general error has occured while creating the workflow process '
643: || 'and it is not a worflow error'
644: );
645: fnd_message.set_name ('BEN', 'BEN_93402_CWB_NTF_CRE_PROC_ERR');
657: p_from_person_id => p_from_person_id,
658: p_group_per_in_ler_id => p_group_per_in_ler_id,
659: p_transaction_id => p_transaction_id
660: );
661: hr_utility.TRACE ('common item attributes are set');
662:
663: --
664: -- setting issued budget item attributes.
665: --
667: OR p_message_type = 'BUDGET_ISSUED_LLM'
668: )
669: THEN
670: set_iss_budgt_item_attributes (p_item_key => l_itemkey);
671: hr_utility.TRACE
672: ('issued budget item attributes are set successfully');
673: END IF;
674:
675: --
677: --
678: IF (p_message_type = 'WS_REJECTED')
679: THEN
680: set_appr_ntf_item_attribute (p_item_key => l_itemkey);
681: hr_utility.TRACE ('approval item attributes are set successfully');
682: END IF;
683:
684: --
685:
686: --
687: IF (p_message_type = 'WS_RECALLED')
688: THEN
689: set_appr_ntf_item_attribute (p_item_key => l_itemkey);
690: hr_utility.TRACE ('RECALLED item attributes are set successfully');
691: END IF;
692:
693: --
694: -- setting access and due dates item attributes.
695: --
696: IF (p_message_type = 'ACCESS')
697: THEN
698: set_access_due_item_attributes (p_item_key => l_itemkey);
699: hr_utility.TRACE
700: ('access and due dates item attributes are set successfully');
701: END IF;
702:
703: IF (p_message_type = 'WS_SUBMITTED')
702:
703: IF (p_message_type = 'WS_SUBMITTED')
704: THEN
705: set_appr_ntf_item_attribute (p_item_key => l_itemkey);
706: hr_utility.TRACE
707: ('ws submitted item attributes are set successfully');
708: END IF;
709:
710: BEGIN
709:
710: BEGIN
711: wf_engine.startprocess (itemtype => g_itemtype,
712: itemkey => l_itemkey);
713: hr_utility.TRACE ( 'Workflow process '
714: || g_wfprocess
715: || ' for itemtype '
716: || g_itemtype
717: || ' itemkey '
724: wf_core.get_error (l_err_name, l_err_msg, l_err_stack);
725:
726: IF (l_err_name IS NOT NULL)
727: THEN
728: hr_utility.TRACE ( 'Following Workflow error has occured'
729: || l_err_msg
730: || 'Follwing is the error stack '
731: || l_err_stack
732: );
738: );
739: wf_core.CLEAR;
740: fnd_message.raise_error;
741: ELSE
742: hr_utility.TRACE
743: ( 'A general error has occured while starting the workflow process '
744: || 'and it is not a worflow error'
745: );
746: fnd_message.set_name ('BEN', 'BEN_93404_CWB_NTF_STRT_PRC_ERR');
748: fnd_message.raise_error;
749: END IF;
750: END;
751:
752: hr_utility.set_location ('Exiting ' || g_package || ':' || l_proc, 10);
753: EXCEPTION
754: WHEN OTHERS
755: THEN
756: RAISE;
792:
793: l_proc VARCHAR2 (61) := g_package || ':' || 'plan_comp_ntf';
794: l_itemkey NUMBER;
795: BEGIN
796: hr_utility.set_location (l_proc || ' Entering ', 10);
797:
798: FOR i IN c1
799: LOOP
800: hr_utility.set_location ('checking people for role ' || i.role_name,
796: hr_utility.set_location (l_proc || ' Entering ', 10);
797:
798: FOR i IN c1
799: LOOP
800: hr_utility.set_location ('checking people for role ' || i.role_name,
801: 20
802: );
803:
804: FOR j IN c2 (i.role_id)
802: );
803:
804: FOR j IN c2 (i.role_id)
805: LOOP
806: hr_utility.set_location ( 'person '
807: || j.person_name
808: || ' has this role ',
809: 20
810: );
807: || j.person_name
808: || ' has this role ',
809: 20
810: );
811: hr_utility.set_location ('user ' || j.user_name
812: || ' has this role ',
813: 20
814: );
815: cwb_fyi_ntf_api (p_transaction_id => p_transaction_id,
820: );
821: END LOOP;
822: END LOOP;
823:
824: hr_utility.set_location (l_proc || ' Exiting ', 100);
825: END;
826:
827: PROCEDURE which_message (
828: itemtype IN VARCHAR2,
834: IS
835: l_message_type VARCHAR2 (60);
836: l_proc VARCHAR2 (100) := 'which_message';
837: BEGIN
838: hr_utility.set_location ('Entering ' || g_package || ' : ' || l_proc,
839: 10000
840: );
841: hr_utility.TRACE ('itemtype : ' || itemtype);
842: hr_utility.TRACE ('itemkey : ' || itemkey);
837: BEGIN
838: hr_utility.set_location ('Entering ' || g_package || ' : ' || l_proc,
839: 10000
840: );
841: hr_utility.TRACE ('itemtype : ' || itemtype);
842: hr_utility.TRACE ('itemkey : ' || itemkey);
843: hr_utility.TRACE ('actid : ' || actid);
844: hr_utility.TRACE ('funcmode : ' || funcmode);
845:
838: hr_utility.set_location ('Entering ' || g_package || ' : ' || l_proc,
839: 10000
840: );
841: hr_utility.TRACE ('itemtype : ' || itemtype);
842: hr_utility.TRACE ('itemkey : ' || itemkey);
843: hr_utility.TRACE ('actid : ' || actid);
844: hr_utility.TRACE ('funcmode : ' || funcmode);
845:
846: IF (funcmode = 'RUN')
839: 10000
840: );
841: hr_utility.TRACE ('itemtype : ' || itemtype);
842: hr_utility.TRACE ('itemkey : ' || itemkey);
843: hr_utility.TRACE ('actid : ' || actid);
844: hr_utility.TRACE ('funcmode : ' || funcmode);
845:
846: IF (funcmode = 'RUN')
847: THEN
840: );
841: hr_utility.TRACE ('itemtype : ' || itemtype);
842: hr_utility.TRACE ('itemkey : ' || itemkey);
843: hr_utility.TRACE ('actid : ' || actid);
844: hr_utility.TRACE ('funcmode : ' || funcmode);
845:
846: IF (funcmode = 'RUN')
847: THEN
848: l_message_type :=
868: RESULT := 'COMPLETE';
869: RETURN;
870: END IF;
871:
872: hr_utility.TRACE ('l_message_type : ' || l_message_type);
873: RESULT := '';
874: hr_utility.set_location ('Exiting ' || g_package || ' : ' || l_proc,
875: 10000
876: );
870: END IF;
871:
872: hr_utility.TRACE ('l_message_type : ' || l_message_type);
873: RESULT := '';
874: hr_utility.set_location ('Exiting ' || g_package || ' : ' || l_proc,
875: 10000
876: );
877: RETURN;
878: EXCEPTION