1: Package Body HXC_NOTIFICATION_PROCESS_PKG as
2: /* $Header: hxcnotifprocess.pkb 120.8.12010000.2 2008/08/05 12:05:35 ubhat ship $ */
3: g_pkg constant varchar2(30) := 'hxc_notification_process_pkg.';
4: g_debug BOOLEAN :=hr_utility.debug_enabled;
5:
6: --This process activity procedure simply determines whether the previous approval was performed by the supervisor
7: --the approver.We look it up off the application period id and check the approval mechanism on the corresponding
8: --approval component id.
30: l_preparer_timeout number;
31: l_proc constant varchar2(61) := g_pkg ||'approved_by';
32:
33: BEGIN
34: g_debug:=hr_utility.debug_enabled;
35: if g_debug then
36: hr_utility.set_location(l_proc, 10);
37: end if;
38:
32:
33: BEGIN
34: g_debug:=hr_utility.debug_enabled;
35: if g_debug then
36: hr_utility.set_location(l_proc, 10);
37: end if;
38:
39: l_app_bb_id:= wf_engine.GetItemAttrNumber(itemtype => p_itemtype,
40: itemkey => p_itemkey,
74:
75: if l_app_mechanism = 'HR_SUPERVISOR' then
76:
77: if g_debug then
78: hr_utility.set_location(l_proc, 20);
79: end if;
80: hxc_approval_wf_helper.set_notif_attribute_values
81: (p_itemtype,
82: p_itemkey,
92: end if;
93:
94: else
95: if g_debug then
96: hr_utility.set_location(l_proc, 30);
97: end if;
98: p_result := 'COMPLETE:PERSON';
99: end if;
100:
105: -- The line below records this function call in the error system
106: -- in the case of an exception.
107: --
108: if g_debug then
109: hr_utility.set_location(l_proc, 999);
110: end if;
111:
112: wf_core.context('HXCNOTIFPROCESS', 'hxc_notification_process_pkg.approved_by',
113: p_itemtype, p_itemkey, to_char(p_actid), p_funcmode);
213: l_preparer_role wf_local_roles.name%type;
214: l_proc constant varchar2(61) := g_pkg ||'timeouts_enabled';
215:
216: BEGIN
217: g_debug:=hr_utility.debug_enabled;
218:
219: if g_debug then
220: hr_utility.set_location(l_proc, 10);
221: end if;
216: BEGIN
217: g_debug:=hr_utility.debug_enabled;
218:
219: if g_debug then
220: hr_utility.set_location(l_proc, 10);
221: end if;
222:
223:
224: --find application period id item attribute value
269:
270: if l_resend_number > 0 then
271: -- set Approval timeout
272: if g_debug then
273: hr_utility.set_location(l_proc, 20);
274: end if;
275:
276: --Bug 5359397.
277: --TC_FROM_ROLE needs ro reset to preparer role since we are overwriting this attribute with approver role
303:
304: p_result := 'COMPLETE:Y';
305: else
306: if g_debug then
307: hr_utility.set_location(l_proc, 30);
308: end if;
309: p_result := 'COMPLETE:N';
310: end if;
311: exception
314: -- The line below records this function call in the error system
315: -- in the case of an exception.
316: --
317: if g_debug then
318: hr_utility.set_location(l_proc, 999);
319: end if;
320:
321: wf_core.context('HXCNOTIFPROCESS', 'hxc_notification_process_pkg.timeouts_enabled',
322: p_itemtype, p_itemkey, to_char(p_actid), p_funcmode);
356: l_resend_counter number;
357: l_proc constant varchar2(61) := g_pkg ||'reset_for_next_timeout';
358: BEGIN
359:
360: g_debug:=hr_utility.debug_enabled;
361:
362: if g_debug then
363: hr_utility.set_location(l_proc, 10);
364: end if;
359:
360: g_debug:=hr_utility.debug_enabled;
361:
362: if g_debug then
363: hr_utility.set_location(l_proc, 10);
364: end if;
365:
366: l_timecard_id := wf_engine.GetItemAttrNumber
367: (itemtype => p_itemtype,
416:
417: if l_current_recipient = hxc_app_comp_notifications_api.c_recipient_approver then
418:
419: if g_debug then
420: hr_utility.set_location(l_proc, 20);
421: end if;
422:
423: --set the attibutes for the PREPARER
424:
475: elsif l_current_recipient = hxc_app_comp_notifications_api.c_recipient_preparer then
476: --set the attibutes for the ADMIN
477:
478: if g_debug then
479: hr_utility.set_location(l_proc, 30);
480: end if;
481:
482: l_admin_timeout := hxc_notification_helper.admin_timeout_value(l_approval_style_id);
483: l_resend_counter := wf_engine.GetItemAttrNumber(itemtype => p_itemtype,
540:
541: --In this case all the attributes were already set in the l_current_recipient = 'PREPARER' section.
542:
543: if g_debug then
544: hr_utility.set_location(l_proc, 40);
545: end if;
546:
547: wf_engine.SetItemAttrNumber(itemtype => p_itemtype,
548: itemkey => p_itemkey,
559: -- The line below records this function call in the error system
560: -- in the case of an exception.
561: --
562: if g_debug then
563: hr_utility.set_location(l_proc, 999);
564: end if;
565: wf_core.context('HXCNOTIFPROCESS', 'hxc_notification_process_pkg.reset_for_next_timeout',
566: p_itemtype, p_itemkey, to_char(p_actid), p_funcmode);
567: raise;
652: l_proc constant varchar2(61) := g_pkg ||'restart_workflow';
653:
654: begin
655:
656: g_debug:=hr_utility.debug_enabled;
657:
658: l_process_name := 'HXC_APPLY_NOTIFY';
659:
660:
658: l_process_name := 'HXC_APPLY_NOTIFY';
659:
660:
661: if g_debug then
662: hr_utility.set_location(l_proc, 10);
663: end if;
664:
665: --This restart_workflow is called from two places
666: --1.) When Adminstrator chooses to restart the workflow.
733: where application_period_id = l_app_bb_id
734: and application_period_ovn = l_app_bb_ovn;
735:
736: if g_debug then
737: hr_utility.trace('l_item_key is : ' || l_item_key);
738: end if;
739:
740: wf_engine.CreateProcess(itemtype => p_itemtype,
741: itemkey => l_item_key,
756: l_category_sequence;
757:
758: close c_csr_get_appl_periods;
759: if g_debug then
760: hr_utility.set_location(l_proc, 20);
761: end if;
762:
763: wf_engine.SetItemAttrDate(itemtype => p_itemtype,
764: itemkey => l_item_key,
769: itemkey => l_item_key,
770: aname => 'FORMATTED_APP_START_DATE',
771: avalue => to_char(l_period_start_date,'YYYY/MM/DD'));
772: if g_debug then
773: hr_utility.set_location(l_proc, 30);
774: hr_utility.trace('APP_START_DATE is : ' ||
775: to_char(l_period_start_date, 'DD-MM-YYYY'));
776: end if;
777:
770: aname => 'FORMATTED_APP_START_DATE',
771: avalue => to_char(l_period_start_date,'YYYY/MM/DD'));
772: if g_debug then
773: hr_utility.set_location(l_proc, 30);
774: hr_utility.trace('APP_START_DATE is : ' ||
775: to_char(l_period_start_date, 'DD-MM-YYYY'));
776: end if;
777:
778: wf_engine.SetItemAttrDate(itemtype => p_itemtype,
780: aname => 'APP_END_DATE',
781: avalue => l_period_end_date);
782:
783: if g_debug then
784: hr_utility.set_location(l_proc, 40);
785: hr_utility.trace('APP_END_DATE is : ' ||
786: to_char(l_period_end_date, 'DD-MM-YYYY'));
787: end if;
788:
781: avalue => l_period_end_date);
782:
783: if g_debug then
784: hr_utility.set_location(l_proc, 40);
785: hr_utility.trace('APP_END_DATE is : ' ||
786: to_char(l_period_end_date, 'DD-MM-YYYY'));
787: end if;
788:
789: wf_engine.SetItemAttrNumber(itemtype => p_itemtype,
791: aname => 'APP_BB_ID',
792: avalue => l_app_bb_id);
793:
794: if g_debug then
795: hr_utility.set_location(l_proc, 50);
796: hr_utility.trace('APP_BB_ID is : ' || to_char(l_app_bb_id));
797: end if;
798:
799: wf_engine.SetItemAttrNumber(itemtype => p_itemtype,
792: avalue => l_app_bb_id);
793:
794: if g_debug then
795: hr_utility.set_location(l_proc, 50);
796: hr_utility.trace('APP_BB_ID is : ' || to_char(l_app_bb_id));
797: end if;
798:
799: wf_engine.SetItemAttrNumber(itemtype => p_itemtype,
800: itemkey => l_item_key,
802: avalue => l_app_bb_ovn);
803:
804:
805: if g_debug then
806: hr_utility.set_location(l_proc, 60);
807: hr_utility.trace('APP_BB_OVN is : ' ||
808: to_char(l_app_bb_ovn));
809: end if;
810:
803:
804:
805: if g_debug then
806: hr_utility.set_location(l_proc, 60);
807: hr_utility.trace('APP_BB_OVN is : ' ||
808: to_char(l_app_bb_ovn));
809: end if;
810:
811: wf_engine.SetItemAttrNumber(itemtype => p_itemtype,
813: aname => 'RESOURCE_ID',
814: avalue => l_tc_resource_id);
815:
816: if g_debug then
817: hr_utility.set_location(l_proc, 70);
818: hr_utility.trace('RESOURCE_ID is : ' || to_char(l_tc_resource_id));
819: end if;
820:
821: wf_engine.SetItemAttrText(itemtype => p_itemtype,
814: avalue => l_tc_resource_id);
815:
816: if g_debug then
817: hr_utility.set_location(l_proc, 70);
818: hr_utility.trace('RESOURCE_ID is : ' || to_char(l_tc_resource_id));
819: end if;
820:
821: wf_engine.SetItemAttrText(itemtype => p_itemtype,
822: itemkey => l_item_key,
823: aname => 'TIME_RECIPIENT_ID',
824: avalue => l_time_recipient);
825:
826: if g_debug then
827: hr_utility.set_location(l_proc, 80);
828: hr_utility.trace('TIME_RECIPIENT_ID is : ' || l_time_recipient);
829: end if;
830:
831: wf_engine.SetItemAttrText(itemtype => p_itemtype,
824: avalue => l_time_recipient);
825:
826: if g_debug then
827: hr_utility.set_location(l_proc, 80);
828: hr_utility.trace('TIME_RECIPIENT_ID is : ' || l_time_recipient);
829: end if;
830:
831: wf_engine.SetItemAttrText(itemtype => p_itemtype,
832: itemkey => l_item_key,
833: aname => 'TC_RESUBMITTED',
834: avalue => l_tc_resubmitted);
835:
836: if g_debug then
837: hr_utility.set_location(l_proc, 90);
838: hr_utility.trace('TC_RESUBMITTED is : ' || l_tc_resubmitted);
839: end if;
840:
841: wf_engine.SetItemAttrText(itemtype => p_itemtype,
834: avalue => l_tc_resubmitted);
835:
836: if g_debug then
837: hr_utility.set_location(l_proc, 90);
838: hr_utility.trace('TC_RESUBMITTED is : ' || l_tc_resubmitted);
839: end if;
840:
841: wf_engine.SetItemAttrText(itemtype => p_itemtype,
842: itemkey => l_item_key,
843: aname => 'BB_NEW',
844: avalue => l_bb_new);
845:
846: if g_debug then
847: hr_utility.set_location(l_proc, 100);
848: hr_utility.trace('BB_NEW is : ' || l_bb_new);
849: end if;
850:
851: wf_engine.SetItemAttrNumber(itemtype => p_itemtype,
844: avalue => l_bb_new);
845:
846: if g_debug then
847: hr_utility.set_location(l_proc, 100);
848: hr_utility.trace('BB_NEW is : ' || l_bb_new);
849: end if;
850:
851: wf_engine.SetItemAttrNumber(itemtype => p_itemtype,
852: itemkey => l_item_key,
853: aname => 'TC_BLD_BLK_ID',
854: avalue => l_timecard_id);
855:
856: if g_debug then
857: hr_utility.set_location(l_proc, 110);
858: hr_utility.trace('TC_BLD_BLK_ID is : ' || to_char(l_timecard_id));
859: end if;
860:
861: wf_engine.SetItemAttrNumber(itemtype => p_itemtype,
854: avalue => l_timecard_id);
855:
856: if g_debug then
857: hr_utility.set_location(l_proc, 110);
858: hr_utility.trace('TC_BLD_BLK_ID is : ' || to_char(l_timecard_id));
859: end if;
860:
861: wf_engine.SetItemAttrNumber(itemtype => p_itemtype,
862: itemkey => l_item_key,
863: aname => 'TC_BLD_BLK_OVN',
864: avalue => l_timecard_ovn);
865:
866: if g_debug then
867: hr_utility.set_location(l_proc, 120);
868: hr_utility.trace('TC_BLD_BLK_OVN is : ' || to_char(l_timecard_ovn));
869: end if;
870: l_approval_style_id := hxc_approval_wf_pkg.get_approval_style_id(l_tc_start_time,
871: l_tc_stop_time,
864: avalue => l_timecard_ovn);
865:
866: if g_debug then
867: hr_utility.set_location(l_proc, 120);
868: hr_utility.trace('TC_BLD_BLK_OVN is : ' || to_char(l_timecard_ovn));
869: end if;
870: l_approval_style_id := hxc_approval_wf_pkg.get_approval_style_id(l_tc_start_time,
871: l_tc_stop_time,
872: l_tc_resource_id);