[Home] [Help]
PACKAGE BODY: APPS.EAM_WORKORDER_WORKFLOW_PVT
Source
1 PACKAGE BODY EAM_WORKORDER_WORKFLOW_PVT AS
2 /* $Header: EAMVWWFB.pls 120.6.12020000.4 2013/03/28 08:13:47 shengywa ship $*/
3
4 g_pkg_name CONSTANT VARCHAR2(50):= 'EAM_WORKORDER_WORKFLOW_PVT';
5 g_module_name CONSTANT VARCHAR2(60):= 'eam.plsql.' || g_pkg_name;
6
7 /* Function called from subscription .This will in turn laucnh the workflow
8 */
9 function Launch_Workflow
10 (p_subscription_guid in raw,
11 p_event in out NOCOPY wf_event_t)
12 return varchar2
13 is
14 Debug_File UTL_FILE.FILE_TYPE;
15 x_return_status VARCHAR2(50);
16 l_param_list wf_parameter_list_t;
17 l_param wf_parameter_t;
18 l_param_idx NUMBER;
19 l_name VARCHAR2(200);
20 l_value VARCHAR2(200);
21 l_item_type VARCHAR2(200);
22 l_item_key VARCHAR2(200);
23 l_wf_process VARCHAR2(200);
24
25 begin
26
27 l_param_list:=p_event.getParameterList;
28
29 l_param_idx := l_param_list.FIRST;
30 while ( l_param_idx is not null) loop
31
32 l_param := l_param_list(l_param_idx);
33
34 IF(l_param.name = 'WORKFLOW_NAME') THEN
35 l_item_type := l_param.value;
36 END IF;
37
38 IF(l_param.name = 'WORKFLOW_PROCESS') THEN
39 l_wf_process := l_param.value;
40 END IF;
41
42 l_param_idx := l_param_list.NEXT(l_param_idx);
43 end loop;
44
45 IF(l_item_type IS NULL OR l_wf_process IS NULL) THEN
46 RETURN 'ERROR';
47 END IF;
48
49 l_item_key := p_event.getEventKey;
50
51 wf_engine.CreateProcess( itemtype =>l_item_type,
52 itemkey => l_item_key,
53 process => l_wf_process );
54
55
56 l_param_idx := l_param_list.FIRST;
57 while ( l_param_idx is not null) loop
58
59 l_param := l_param_list(l_param_idx);
60
61 BEGIN
62
63 wf_engine.SetItemAttrText( itemtype => l_item_type,
64 itemkey => l_item_key,
65 aname => l_param.name,
66 avalue => l_param.value);
67
68 EXCEPTION
69 WHEN OTHERS THEN --if attribute in event is not present in workflow...an exception will be thrown.
70 NULL;
71 END;
72
73 l_param_idx := l_param_list.NEXT(l_param_idx);
74 end loop;
75
76 wf_engine.StartProcess( itemtype => l_item_type,
77 itemkey => l_item_key);
78
79
80 x_return_status := 'SUCCESS';
81 return x_return_status;
82
83 exception
84 when others then
85 return 'ERROR';
86 end Launch_Workflow;
87
88 /*Procedure called from Work Order Release Approval when the workflow is approved*/
89 PROCEDURE Update_Status_Approved( itemtype in varchar2,
90 itemkey in varchar2,
91 actid in number,
92 funcmode in varchar2,
93 resultout out NOCOPY varchar2) is
94 l_wip_entity_id number := wf_engine.GetItemAttrNumber( itemtype => itemtype,
95 itemkey => itemkey, aname => 'WIP_ENTITY_ID');
96 l_wip_entity_name varchar2(240):= wf_engine.GetItemAttrtext( itemtype => itemtype,
97 itemkey => itemkey, aname => 'WIP_ENTITY_NAME');
98 l_new_system_status number:= wf_engine.GetItemAttrNumber( itemtype => itemtype,
99 itemkey => itemkey, aname => 'NEW_SYSTEM_STATUS');
100 l_new_wo_status number := wf_engine.GetItemAttrNumber( itemtype => itemtype,
101 itemkey => itemkey, aname => 'NEW_WO_STATUS');
102 l_organization_id number:= wf_engine.GetItemAttrNumber( itemtype => itemtype,
103 itemkey => itemkey, aname => 'ORGANIZATION_ID');
104 l_request_id number;
105 l_err_msg varchar2(2000);
106 l_mesg_token_tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
107 l_status_error EXCEPTION;
108
109 l_workorder_rec EAM_PROCESS_WO_PUB.eam_wo_rec_type;
110 l_eam_op_tbl EAM_PROCESS_WO_PUB.eam_op_tbl_type;
111 l_eam_op_network_tbl EAM_PROCESS_WO_PUB.eam_op_network_tbl_type;
112 l_eam_res_tbl EAM_PROCESS_WO_PUB.eam_res_tbl_type;
113 l_eam_res_usage_tbl EAM_PROCESS_WO_PUB.eam_res_usage_tbl_type;
114 l_eam_res_inst_tbl EAM_PROCESS_WO_PUB.eam_res_inst_tbl_type;
115 l_eam_sub_res_tbl EAM_PROCESS_WO_PUB.eam_sub_res_tbl_type;
116 l_eam_mat_req_tbl EAM_PROCESS_WO_PUB.eam_mat_req_tbl_type;
117 l_eam_direct_items_tbl EAM_PROCESS_WO_PUB.eam_direct_items_tbl_type;
118
119
120 l_eam_wo_rec_out EAM_PROCESS_WO_PUB.eam_wo_rec_type;
121 l_eam_op_tbl_out EAM_PROCESS_WO_PUB.eam_op_tbl_type;
122 l_eam_op_network_tbl_out EAM_PROCESS_WO_PUB.eam_op_network_tbl_type;
123 l_eam_res_tbl_out EAM_PROCESS_WO_PUB.eam_res_tbl_type;
124 l_eam_res_usage_tbl_out EAM_PROCESS_WO_PUB.eam_res_usage_tbl_type;
125 l_eam_res_inst_tbl_out EAM_PROCESS_WO_PUB.eam_res_inst_tbl_type;
126 l_eam_sub_res_tbl_out EAM_PROCESS_WO_PUB.eam_sub_res_tbl_type;
127 l_eam_mat_req_tbl_out EAM_PROCESS_WO_PUB.eam_mat_req_tbl_type;
128 l_eam_direct_items_tbl_out EAM_PROCESS_WO_PUB.eam_direct_items_tbl_type;
129
130 l_output_dir VARCHAR2(512);
131 l_return_status VARCHAR2(1);
132 l_msg_count NUMBER;
133 l_msg_data VARCHAR2(2000);
134
135 BEGIN
136
137
138 If (funcmode = 'RUN') then
139
140 /* get output directory path from database */
141 EAM_WORKORDER_UTIL_PKG.log_path(l_output_dir);
142
143 --commenting for bug 10149577
144 --l_workorder_rec.user_id := fnd_global.user_id;
145 --l_workorder_rec.responsibility_id := fnd_global.resp_id;
146 l_workorder_rec.transaction_type := EAM_PROCESS_WO_PUB.G_WF_OPR_UPDATE;
147 l_workorder_rec.header_id := l_wip_entity_Id;
148 l_workorder_rec.batch_id := 1;
149 l_workorder_rec.wip_entity_id := l_wip_entity_Id;
150 l_workorder_rec.organization_id := l_organization_id;
151 l_workorder_rec.status_type := l_new_system_status;
152 l_workorder_rec.user_defined_status_id := l_new_wo_status;
153 l_workorder_rec.pending_flag := 'N';
154
155
156 EAM_PROCESS_WO_PUB.PROCESS_WO
157 ( p_init_msg_list =>TRUE
158 , p_commit => 'N'
159 , p_eam_wo_rec => l_workorder_rec
160 , p_eam_op_tbl => l_eam_op_tbl
161 , p_eam_op_network_tbl => l_eam_op_network_tbl
162 , p_eam_res_tbl => l_eam_res_tbl
163 , p_eam_res_inst_tbl => l_eam_res_inst_tbl
164 , p_eam_sub_res_tbl => l_eam_sub_res_tbl
165 , p_eam_res_usage_tbl => l_eam_res_usage_tbl
166 , p_eam_mat_req_tbl => l_eam_mat_req_tbl
167 , p_eam_direct_items_tbl => l_eam_direct_items_tbl
168 , x_eam_wo_rec => l_eam_wo_rec_out
169 , x_eam_op_tbl => l_eam_op_tbl_out
170 , x_eam_op_network_tbl => l_eam_op_network_tbl_out
171 , x_eam_res_tbl => l_eam_res_tbl_out
172 , x_eam_res_inst_tbl => l_eam_res_inst_tbl_out
173 , x_eam_sub_res_tbl => l_eam_sub_res_tbl_out
174 , x_eam_res_usage_tbl => l_eam_res_usage_tbl_out
175 , x_eam_mat_req_tbl => l_eam_mat_req_tbl_out
176 , x_eam_direct_items_tbl => l_eam_direct_items_tbl_out
177 , x_return_status => l_return_status
178 , x_msg_count => l_msg_count
179 , p_debug => NVL(fnd_profile.value('EAM_DEBUG'), 'N')
180 , p_output_dir => l_output_dir
181 , p_debug_filename => 'workflowapproved.log'
182 , p_debug_file_mode => 'W'
183 );
184
185
186 if nvl(l_return_status, 'S') <> 'S' then
187 l_return_status := FND_API.G_RET_STS_ERROR;
188 -- if (l_log and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)) then
189 -- FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
190 -- 'Error while releasing using EAM_WO_CHANGE_STATUS_PVT.Change_Status');
191 -- end if;
192 RAISE l_status_error;
193 ELSE
194 COMMIT;
195 end if;
196
197 resultout := 'COMPLETE:';
198 return;
199 end if;
200
201 if (funcmode = 'CANCEL') then
202 resultout := 'COMPLETE:';
203 return;
204 end if;
205
206 if (funcmode = 'TIMEOUT') then
207 resultout := 'COMPLETE:';
208 return;
209 end if;
210
211 EXCEPTION
212 WHEN OTHERS THEN
213 wf_core.context('EAMWOREL','UPDATE_STATUS_APPROVED',
214 itemtype, itemkey, actid, funcmode);
215 raise;
216 END Update_Status_Approved;
217
218
219 /* Procedure called from Work Order Release Approval when the workflow is Rejected
220 */
221 PROCEDURE Update_Status_Rejected( itemtype in varchar2,
222 itemkey in varchar2,
223 actid in number,
224 funcmode in varchar2,
225 resultout out NOCOPY varchar2) is
226 l_wip_entity_id number := wf_engine.GetItemAttrNumber( itemtype => itemtype,
227 itemkey => itemkey, aname => 'WIP_ENTITY_ID');
228 l_wip_entity_name varchar2(240):= wf_engine.GetItemAttrtext( itemtype => itemtype,
229 itemkey => itemkey, aname => 'WIP_ENTITY_NAME');
230 l_organization_id number:= wf_engine.GetItemAttrNumber( itemtype => itemtype,
231 itemkey => itemkey, aname => 'ORGANIZATION_ID');
232 l_request_id number;
233 l_err_msg varchar2(2000);
234 l_mesg_token_tbl EAM_ERROR_MESSAGE_PVT.Mesg_Token_Tbl_Type;
235 l_status_error EXCEPTION;
236
237 l_workorder_rec EAM_PROCESS_WO_PUB.eam_wo_rec_type;
238 l_eam_op_tbl EAM_PROCESS_WO_PUB.eam_op_tbl_type;
239 l_eam_op_network_tbl EAM_PROCESS_WO_PUB.eam_op_network_tbl_type;
240 l_eam_res_tbl EAM_PROCESS_WO_PUB.eam_res_tbl_type;
241 l_eam_res_usage_tbl EAM_PROCESS_WO_PUB.eam_res_usage_tbl_type;
242 l_eam_res_inst_tbl EAM_PROCESS_WO_PUB.eam_res_inst_tbl_type;
243 l_eam_sub_res_tbl EAM_PROCESS_WO_PUB.eam_sub_res_tbl_type;
244 l_eam_mat_req_tbl EAM_PROCESS_WO_PUB.eam_mat_req_tbl_type;
245 l_eam_direct_items_tbl EAM_PROCESS_WO_PUB.eam_direct_items_tbl_type;
246
247
248 l_eam_wo_rec_out EAM_PROCESS_WO_PUB.eam_wo_rec_type;
249 l_eam_op_tbl_out EAM_PROCESS_WO_PUB.eam_op_tbl_type;
250 l_eam_op_network_tbl_out EAM_PROCESS_WO_PUB.eam_op_network_tbl_type;
251 l_eam_res_tbl_out EAM_PROCESS_WO_PUB.eam_res_tbl_type;
252 l_eam_res_usage_tbl_out EAM_PROCESS_WO_PUB.eam_res_usage_tbl_type;
253 l_eam_res_inst_tbl_out EAM_PROCESS_WO_PUB.eam_res_inst_tbl_type;
254 l_eam_sub_res_tbl_out EAM_PROCESS_WO_PUB.eam_sub_res_tbl_type;
255 l_eam_mat_req_tbl_out EAM_PROCESS_WO_PUB.eam_mat_req_tbl_type;
256 l_eam_direct_items_tbl_out EAM_PROCESS_WO_PUB.eam_direct_items_tbl_type;
257
258 l_output_dir VARCHAR2(512);
259 l_return_status VARCHAR2(1);
260 l_msg_count NUMBER;
261
262 BEGIN
263
264
265 If (funcmode = 'RUN') then
266
267
268 /* get output directory path from database */
269 EAM_WORKORDER_UTIL_PKG.log_path(l_output_dir);
270
271 --commenting for bug 10149577
272 --l_workorder_rec.user_id := fnd_global.user_id;
273 --l_workorder_rec.responsibility_id := fnd_global.resp_id;
274 l_workorder_rec.transaction_type := EAM_PROCESS_WO_PUB.G_WF_OPR_UPDATE;
275 l_workorder_rec.header_id := l_wip_entity_Id;
276 l_workorder_rec.batch_id := 1;
277 l_workorder_rec.wip_entity_id := l_wip_entity_Id;
278 l_workorder_rec.organization_id := l_organization_id;
279 l_workorder_rec.status_type :=7; --Cancelled
280 l_workorder_rec.user_defined_status_id := 99; --Cancelled by Approver
281 l_workorder_rec.pending_flag := 'N';
282
283 EAM_PROCESS_WO_PUB.PROCESS_WO
284 ( p_init_msg_list =>TRUE
285 , p_commit => 'N'
286 , p_eam_wo_rec => l_workorder_rec
287 , p_eam_op_tbl => l_eam_op_tbl
288 , p_eam_op_network_tbl => l_eam_op_network_tbl
289 , p_eam_res_tbl => l_eam_res_tbl
290 , p_eam_res_inst_tbl => l_eam_res_inst_tbl
291 , p_eam_sub_res_tbl => l_eam_sub_res_tbl
292 , p_eam_res_usage_tbl => l_eam_res_usage_tbl
293 , p_eam_mat_req_tbl => l_eam_mat_req_tbl
294 , p_eam_direct_items_tbl => l_eam_direct_items_tbl
295 , x_eam_wo_rec => l_eam_wo_rec_out
296 , x_eam_op_tbl => l_eam_op_tbl_out
297 , x_eam_op_network_tbl => l_eam_op_network_tbl_out
298 , x_eam_res_tbl => l_eam_res_tbl_out
299 , x_eam_res_inst_tbl => l_eam_res_inst_tbl_out
300 , x_eam_sub_res_tbl => l_eam_sub_res_tbl_out
301 , x_eam_res_usage_tbl => l_eam_res_usage_tbl_out
302 , x_eam_mat_req_tbl => l_eam_mat_req_tbl_out
303 , x_eam_direct_items_tbl => l_eam_direct_items_tbl_out
304 , x_return_status => l_return_status
305 , x_msg_count => l_msg_count
306 , p_debug => NVL(fnd_profile.value('EAM_DEBUG'), 'N')
307 , p_output_dir => l_output_dir
308 , p_debug_filename => 'workflowapproved.log'
309 , p_debug_file_mode => 'W'
310 );
311
312 if nvl(l_return_status, 'S') <> 'S' then
313 l_return_status := FND_API.G_RET_STS_ERROR;
314 -- if (l_log and (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)) then
315 -- FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, l_module,
316 -- 'Error while releasing using EAM_WO_CHANGE_STATUS_PVT.Change_Status');
317 -- end if;
318 RAISE l_status_error;
319 ELSE
320 COMMIT;
321 end if;
322
323 resultout := 'COMPLETE:';
324 return;
325 end if;
326
327 if (funcmode = 'CANCEL') then
328 resultout := 'COMPLETE:';
329 return;
330 end if;
331
332 if (funcmode = 'TIMEOUT') then
333 resultout := 'COMPLETE:';
334 return;
335 end if;
336
337
338 EXCEPTION
339 when others then
340 wf_core.context('EAMWOREL','UPDATE_STATUS_REJECTED',
341 itemtype, itemkey, actid, funcmode);
342 raise;
343 END Update_Status_Rejected;
344
345 /* Procedure called from Work Order Release Approval to find the next approver
346 */
347 procedure Get_Next_Approver(itemtype in varchar2,
348 itemkey in varchar2,
349 actid in number,
350 funcmode in varchar2,
351 resultout out NOCOPY varchar2) IS
352 E_FAILURE EXCEPTION;
353 l_transaction_id number;
354 l_next_approver ame_util.approverRecord2;
355 l_next_approvers ame_util.approversTable2;
356 l_next_approvers_count number;
357 l_approver_index number;
358 l_is_approval_complete VARCHAR2(1);
359 l_transaction_type VARCHAR2(200);
360 l_role_users WF_DIRECTORY.UserTable;
361 l_role_name VARCHAR2(320) ;
362 l_role_display_name VARCHAR2(360) ;
363
364 BEGIN
365
366 IF (funcmode = 'RUN') THEN
367
368 l_transaction_id := TO_NUMBER(itemkey);
369 l_transaction_type := 'oracle.apps.eam.workorder.release.approval';
370
371 wf_engine.SetItemAttrText( itemtype => itemtype,
372 itemkey => itemkey,
373 aname => 'AME_TRANSACTION_TYPE',
374 avalue => l_transaction_type);
375
376 wf_engine.SetItemAttrText( itemtype => itemtype,
377 itemkey => itemkey,
378 aname => 'AME_TRANSACTION_ID',
379 avalue => l_transaction_id );
380
381 ame_api2.getNextApprovers4(applicationIdIn=>426,
382 transactionTypeIn=>l_transaction_type,
383 transactionIdIn=>l_transaction_id,
384 flagApproversAsNotifiedIn => ame_util.booleanTrue,
385 approvalProcessCompleteYNOut => l_is_approval_complete,
386 nextApproversOut=>l_next_approvers);
387
388 if (l_is_approval_complete = ame_util.booleanTrue) then
389 resultout:='COMPLETE:'||'APPROVAL_COMPLETE';
390 return;
391
392 -- Incase of consensus voting method, next approver count might be zero but there will be pending approvers
393 elsif (l_next_approvers.Count = 0) then
394
395 ame_api2.getPendingApprovers(applicationIdIn=>426,
396 transactionTypeIn=>l_transaction_type,
397 transactionIdIn=>l_transaction_id,
398 approvalProcessCompleteYNOut => l_is_approval_complete,
399 approversOut =>l_next_approvers);
400 end if;
401
402 l_next_approvers_count := l_next_approvers.Count;
403
404
405 if (l_next_approvers_count = 0) then
406 resultout:='COMPLETE:'||'NO_NEXT_APPROVER';
407 return;
408 end if;
409
410 if (l_next_approvers_count > 0) then
411 resultout:='COMPLETE:'||'VALID_APPROVER';
412 --return;
413 end if;
414
415 if (l_next_approvers_count = 1) then
416 l_next_approver:=l_next_approvers(l_next_approvers.first());
417 wf_engine.SetItemAttrText( itemtype => itemType,
418 itemkey => itemkey,
419 aname => 'APPROVER_USER_NAME' ,
420 avalue => l_next_approver.name);
421
422 wf_engine.SetItemAttrText( itemtype => itemType,
423 itemkey => itemkey,
424 aname => 'APPROVER_DISPLAY_NAME' ,
425 avalue => l_next_approver.display_name);
426 resultout:='COMPLETE:'||'VALID_APPROVER';
427 --return;
428 end if;
429
430 l_approver_index := l_next_approvers.first();
431
432 while ( l_approver_index is not null ) loop
433 l_role_users(l_approver_index):= l_next_approvers(l_approver_index).name ;
434
435 l_approver_index := l_next_approvers.next(l_approver_index);
436
437
438 end loop;
439
440 wf_directory.CreateAdHocRole2( role_name => l_role_name
441 ,role_display_name => l_role_display_name
442 ,language => NULL
443 ,territory => NULL
444 ,role_description => 'EAM ROLE DESC'
445 ,notification_preference => null
446 ,role_users => l_role_users
447 ,email_address => null
448 ,fax => null
449 ,status => 'ACTIVE'
450 ,expiration_date => null
451 ,parent_orig_system => null
452 ,parent_orig_system_id => null
453 ,owner_tag => null
454 );
455
456
457 wf_engine.setitemattrtext(itemtype => itemtype,
458 itemkey => itemkey,
459 aname => 'RECIPIENT_ROLE',
460 avalue => l_role_name
461 );
462 return;
463
464 END IF; -- run
465
466 EXCEPTION
467 WHEN OTHERS THEN
468 RAISE;
469 END Get_Next_Approver;
470
471 /* Procedure called from Work Order Release Approval when an approver responds to a notification
472 */
473 procedure Update_AME_With_Response(itemtype in varchar2,
474 itemkey in varchar2,
475 actid in number,
476 funcmode in varchar2,
477 resultout out NOCOPY varchar2) IS
478 E_FAILURE EXCEPTION;
479 l_transaction_id number;
480 l_nid number;
481 l_gid number;
482 l_approver_name varchar2(240);
483 l_result varchar2(100);
484 l_ame_status varchar2(20);
485 l_original_approver_name varchar2(240);
486 l_forwardeeIn ame_util.approverRecord2;
487
488
489 BEGIN
490 IF (funcmode = 'RUN') THEN
491
492 l_transaction_id := itemkey;
493 l_gid := WF_ENGINE.context_nid;
494 -- FP 14377930
495 SELECT responder,original_recipient,notification_id
496 into l_approver_name,l_original_approver_name,l_nid
497 FROM wf_notifications
498 WHERE group_id=l_gid
499 AND status = 'CLOSED';
500
501 IF(l_approver_name <> l_original_approver_name and l_original_approver_name is not null) then
502 l_approver_name:=l_original_approver_name;
503 END IF;
504
505 l_result := Wf_Notification.GetAttrText(l_nid, 'RESULT');
506
507
508
509 if (l_result = 'APPROVED') then -- this may vary based on lookup type used for approval
510
511 l_ame_status := ame_util.approvedStatus;
512 elsif (l_result = 'REJECTED') then
513 l_ame_status := ame_util.rejectStatus;
514 else -- reject for lack of information, conservative approach
515 l_ame_status := ame_util.rejectStatus;
516 end if;
517 --Set approver as approved or rejected based on approver response
518 ame_api2.updateApprovalStatus2(applicationIdIn=>426,
519 transactionTypeIn=>'oracle.apps.eam.workorder.release.approval',
520 transactionIdIn=>l_transaction_id,
521 approvalStatusIn => l_ame_status,
522 approverNameIn => l_approver_name);
523
524
525 ELSIF ( funcmode = 'TRANSFER' ) THEN
526
527
528 l_transaction_id := itemkey;
529 l_forwardeeIn.name :=WF_ENGINE.context_new_role;
530 l_original_approver_name:= WF_ENGINE.context_original_recipient;
531
532
533 ame_api2.updateApprovalStatus2(applicationIdIn=>426,
534 transactionTypeIn=>'oracle.apps.eam.workorder.release.approval',
535 transactionIdIn=>l_transaction_id,
536 approvalStatusIn => 'FORWARD',
537 approverNameIn => l_original_approver_name,
538 forwardeeIn => l_forwardeeIn );
539
540
541
542 END IF; -- run
543
544 resultout:= wf_engine.eng_completed || ':' || l_result;
545
546 EXCEPTION
547 WHEN OTHERS THEN
548 RAISE;
549 END Update_AME_With_Response;
550
551
552 /* Procedure called from the public package 'EAM_WORKFLOW_DETAILS_PUB'
553 This procedure will launch the seeded workflow when status is changed to Released
554 */
555 PROCEDURE Is_Approval_Required_Released
556 (
557 p_old_wo_rec IN EAM_PROCESS_WO_PUB.eam_wo_rec_type,
558 p_new_wo_rec IN EAM_PROCESS_WO_PUB.eam_wo_rec_type,
559 x_approval_required OUT NOCOPY BOOLEAN,
560 x_workflow_name OUT NOCOPY VARCHAR2,
561 x_workflow_process OUT NOCOPY VARCHAR2
562 )
563 IS
564 BEGIN
565
566 IF(p_new_wo_rec.status_type =3 AND --status is released
567 ((p_new_wo_rec.transaction_type=EAM_PROCESS_WO_PUB.G_OPR_CREATE) OR
568 ((p_new_wo_rec.transaction_type=EAM_PROCESS_WO_PUB.G_OPR_UPDATE) AND
569 ((p_old_wo_rec.status_type IN (1,17,7) ) OR (p_old_wo_rec.status_type=6 AND p_old_wo_rec.date_released IS NULL) ) ) )
570 )THEN
571 x_approval_required := TRUE;
572 x_workflow_name := 'EAMWOREL';
573 x_workflow_process := 'EAM_WO_RELEASE_APPROVAL';
574 END IF;
575
576 END Is_Approval_Required_Released;
577
578 END EAM_WORKORDER_WORKFLOW_PVT;