1 PACKAGE BODY CN_CW_WORKBENCH_UTILITY AS
2 -- $Header: cnvcwutb.pls 120.1 2005/08/08 03:17 raramasa noship $
3
4 g_package VARCHAR2(33) := ' cn_workbench_utility.';
5
6
7 function get_go_to_task_image_name(p_org_id in number)
8 return varchar2 IS
9
10 l_setup_task_status varchar2(60);
11 l_complete varchar2(1):= 'N';
12 l_image varchar2(200);
13
14 CURSOR cn_setup_task_status (p_org_id number) IS
15 SELECT setup_task_status
16 FROM CN_CW_SETUP_TASKS_VL
17 where org_id=p_org_id and workbench_item_code='APPLICATION_PARAMETERS' and
18 setup_task_code in('GENERAL_SETTINGS','GENERAL_LEDGER_SETTINGS');
19
20 BEGIN
21 FOR cn_task_status IN cn_setup_task_status(p_org_id)
22 LOOP
23 l_setup_task_status := NVL(cn_task_status.setup_task_status,'NOT_APPLICABLE') ;
24 if l_setup_task_status = 'COMPLETED' then
25 l_complete := 'Y';
26 else
27 l_complete := 'N';
28 exit;
29 end if;
30 end loop;
31
32 if l_complete='Y' then
33 l_image := '/OA_MEDIA/takeaction_enabled.gif';
34 else
35 l_image := '/OA_MEDIA/takeaction_disabled.gif';
36 end if;
37 return l_image;
38
39
40
41 exception
42 when others then
43 fnd_message.raise_error;
44 end;
45
46 --------------------------------------------------------------------
47 -- This function returns the required image location for the workbench
48 -- items
49 --------------------------------------------------------------------
50
51 function get_required_field (p_workbench_item_code in varchar2)
52 return varchar2 is
53 required_image varchar2(200);
54 begin
55 if(p_workbench_item_code ='APPLICATION_PARAMETERS' or p_workbench_item_code='COLLECTION_CALC_TABLE_MAPPINGS' or
56 p_workbench_item_code='CALCULATION' or p_workbench_item_code='GENERAL_LEDGER' or
57 p_workbench_item_code='PROFILE' or p_workbench_item_code='CREATE_MAINTAIN_USERS' or
58 p_workbench_item_code='CREATE_MAINTAIN_RESOURCES' ) then
59 required_image:='/OA_MEDIA/requiredicon_status.gif';
60 return required_image;
61 else
62 return null;
63 end if;
64 end;
65
66
67 --------------------------------------------------------------------
68 -- This function returns to status of the workbench items based upon the
69 -- status of the tasks of the workbench items.
70 --
71 -- If any task is 'In Progress' then the main status will also be
72 -- In Progress'.
73 -- If any task is 'Complete' and no task is 'In Progress' then the
74 -- main status will be 'Complete'.
75 -- If all tasks are 'Not Applicable' then the main status will also
76 -- be 'Not Applicable'.
77 -- If all tasks are 'Not Started' then the main status will also
78 -- be 'Not Started'
79 --
80 --------------------------------------------------------------------
81 FUNCTION get_item_status_name (p_workbench_item_code in varchar2,
82 p_org_id in varchar2)
83 return varchar2 IS
84
85 CURSOR csr_setup_task_status (p_workbench_item_code varchar2,
86 p_org_id number) IS
87 SELECT setup_task_status
88 FROM CN_CW_SETUP_TASKS_VL
89 WHERE workbench_item_code = p_workbench_item_code and org_id =p_org_id
90 ORDER BY setup_task_status;
91
92 l_proc varchar2(72) := g_package || 'get_item_status_name';
93 l_setup_task_status varchar2(60);
94 l_workbench_item_status varchar2(60);
95 l_workbench_item_status_image varchar2(60);
96
97 l_complete varchar2(1):= 'N';
98 l_in_progress varchar2(1):= 'N';
99 l_not_started varchar2(1):= 'N';
100 l_not_applicable varchar2(1):= 'N';
101
102 BEGIN
103
104 --------------------------------------------------------------------
105 -- If any task is 'In Progress' then the main status will also be
106 -- In Progress'.
107 -- If any task is 'Complete' and no task is 'In Progress' then the
108 -- main status will be 'Complete'.
109 -- If all tasks are 'Not Applicable' then the main status will also
110 -- be 'Not Applicable'.
111 -- If all tasks are 'Not Started' then the main status will also
112 -- be 'No activity'
113 --------------------------------------------------------------------
114
115 FOR l_rec in csr_setup_task_status(p_workbench_item_code,
116 p_org_id)
117 LOOP
118 l_setup_task_status := nvl(l_rec.setup_task_status,'NOTAPPLICABLE');
119 if l_setup_task_status = 'COMPLETED' then
120 l_complete := 'Y';
121 elsif l_setup_task_status = 'INPROGRESS' then
122 l_in_progress := 'Y';
123 exit;
124 elsif l_setup_task_status = 'NOTSTARTED' then
125 l_not_started := 'Y';
126 elsif l_setup_task_status = 'NOTAPPLICABLE' then
127 l_not_applicable := 'Y';
128 else
129 l_not_applicable := 'Y';
130 end if;
131 END LOOP;
132
133 if (l_complete = 'Y' and
134 l_in_progress = 'N' and
135 l_not_started = 'N') then
136 l_workbench_item_status_image := '/OA_MEDIA/completeind_status.gif';
137
138 elsif (l_complete = 'N' and
139 l_in_progress = 'N' and
140 l_not_started = 'Y') then
141 l_workbench_item_status_image := '/OA_MEDIA/notstartedind_status.gif';
142
143 elsif (l_complete = 'N' and
144 l_in_progress = 'N' and
145 l_not_started = 'N') then
146 l_workbench_item_status_image := '/OA_MEDIA/notapplicableind_status.gif';
147
148 elsif (l_complete = 'Y' and
149 l_not_started = 'Y') then
150 l_workbench_item_status_image := '/OA_MEDIA/inprogressind_status.gif';
151
152 elsif (l_in_progress = 'Y') then
153 l_workbench_item_status_image := '/OA_MEDIA/inprogressind_status.gif';
154
155 else
156 l_workbench_item_status_image := '/OA_MEDIA/notapplicableind_status.gif';
157
158 end if;
159
160 return l_workbench_item_status_image;
161
162 exception
163 when others then
164 fnd_message.raise_error;
165 end;
166
167
168
169 END cn_cw_workbench_utility;