97: l_effective_to DATE;
98: lv_message_body VARCHAR2(4000);
99:
100: BEGIN
101: l_name := wf_engine.GetItemAttrText(itemtype, itemkey, 'LAT_NAME');
102: l_version_number := wf_engine.GetItemAttrText(itemtype,
103: itemkey,
104: 'VERSION_NUMBER');
105: l_effective_from := wf_engine.GetItemAttrDate(itemtype,
98: lv_message_body VARCHAR2(4000);
99:
100: BEGIN
101: l_name := wf_engine.GetItemAttrText(itemtype, itemkey, 'LAT_NAME');
102: l_version_number := wf_engine.GetItemAttrText(itemtype,
103: itemkey,
104: 'VERSION_NUMBER');
105: l_effective_from := wf_engine.GetItemAttrDate(itemtype,
106: itemkey,
101: l_name := wf_engine.GetItemAttrText(itemtype, itemkey, 'LAT_NAME');
102: l_version_number := wf_engine.GetItemAttrText(itemtype,
103: itemkey,
104: 'VERSION_NUMBER');
105: l_effective_from := wf_engine.GetItemAttrDate(itemtype,
106: itemkey,
107: 'EFFECTIVE_FROM');
108: l_effective_to := wf_engine.GetItemAttrDate(itemtype,
109: itemkey,
104: 'VERSION_NUMBER');
105: l_effective_from := wf_engine.GetItemAttrDate(itemtype,
106: itemkey,
107: 'EFFECTIVE_FROM');
108: l_effective_to := wf_engine.GetItemAttrDate(itemtype,
109: itemkey,
110: 'EFFECTIVE_TO');
111: lv_message_body := '
134: l_effective_to DATE;
135: lv_message_body VARCHAR2(4000);
136:
137: BEGIN
138: l_name := wf_engine.GetItemAttrText(itemtype, itemkey, 'LA_NAME');
139:
140: l_effective_from := wf_engine.GetItemAttrDate(itemtype,
141: itemkey,
142: 'EFFECTIVE_FROM');
136:
137: BEGIN
138: l_name := wf_engine.GetItemAttrText(itemtype, itemkey, 'LA_NAME');
139:
140: l_effective_from := wf_engine.GetItemAttrDate(itemtype,
141: itemkey,
142: 'EFFECTIVE_FROM');
143: l_effective_to := wf_engine.GetItemAttrDate(itemtype,
144: itemkey,
139:
140: l_effective_from := wf_engine.GetItemAttrDate(itemtype,
141: itemkey,
142: 'EFFECTIVE_FROM');
143: l_effective_to := wf_engine.GetItemAttrDate(itemtype,
144: itemkey,
145: 'EFFECTIVE_TO');
146: lv_message_body := '
179:
180: l_lease_app_rec c_get_lease_app_details%ROWTYPE;
181: BEGIN
182: -- get the value of the version id from the workflow
183: l_lease_app_id := wf_engine.GetItemAttrText(itemtype,
184: itemkey,
185: 'LA_ID');
186:
187: -- set the attributes required in the workflow
189: FETCH c_get_lease_app_details INTO l_lease_app_rec;
190: CLOSE c_get_lease_app_details;
191:
192: -- set the attributes of the workflow
193: wf_engine.SetItemAttrText(itemtype,
194: itemkey,
195: 'LA_NAME',
196: l_lease_app_rec.lease_app_name);
197:
194: itemkey,
195: 'LA_NAME',
196: l_lease_app_rec.lease_app_name);
197:
198: wf_engine.SetItemAttrText(itemtype,
199: itemkey,
200: 'EFFECTIVE_FROM',
201: l_lease_app_rec.effective_from);
202:
199: itemkey,
200: 'EFFECTIVE_FROM',
201: l_lease_app_rec.effective_from);
202:
203: wf_engine.SetItemAttrText(itemtype,
204: itemkey,
205: 'EFFECTIVE_TO',
206: l_lease_app_rec.effective_to);
207:
217: CLOSE c_get_app_id_csr;
218:
219: -- set the values of the approver and the requestor
220:
221: wf_engine.SetItemAttrText(itemtype,
222: itemkey,
223: G_WF_ITM_APPROVER,
224: l_user_name);
225:
222: itemkey,
223: G_WF_ITM_APPROVER,
224: l_user_name);
225:
226: wf_engine.SetItemAttrText(itemtype,
227: itemkey,
228: G_WF_ITM_REQUESTER,
229: l_user_name);
230:
227: itemkey,
228: G_WF_ITM_REQUESTER,
229: l_user_name);
230:
231: wf_engine.SetItemAttrText(itemtype,
232: itemkey,
233: G_WF_ITM_REQUESTER_ID,
234: fnd_global.user_id);
235: wf_engine.SetItemAttrText(itemtype,
231: wf_engine.SetItemAttrText(itemtype,
232: itemkey,
233: G_WF_ITM_REQUESTER_ID,
234: fnd_global.user_id);
235: wf_engine.SetItemAttrText(itemtype,
236: itemkey,
237: G_WF_ITM_TRANSACTION_TYPE_ID,
238: itemtype);
239: wf_engine.SetItemAttrText(itemtype,
235: wf_engine.SetItemAttrText(itemtype,
236: itemkey,
237: G_WF_ITM_TRANSACTION_TYPE_ID,
238: itemtype);
239: wf_engine.SetItemAttrText(itemtype,
240: itemkey,
241: G_WF_ITM_TRANSACTION_ID,
242: l_lease_app_id);
243: wf_engine.SetItemAttrText(itemtype,
239: wf_engine.SetItemAttrText(itemtype,
240: itemkey,
241: G_WF_ITM_TRANSACTION_ID,
242: l_lease_app_id);
243: wf_engine.SetItemAttrText(itemtype,
244: itemkey,
245: G_WF_ITM_APPLICATION_ID,
246: l_application_id);
247:
298: FETCH obj_name_csr INTO l_object_name;
299: CLOSE obj_name_csr;
300:
301: IF (itemtype = 'OKLSTLAT') THEN
302: l_name := wf_engine.GetItemAttrText(itemtype, itemkey, 'LAT_NAME');
303:
304: wf_engine.SetItemAttrDocument(itemtype => itemtype,
305: itemkey => itemkey,
306: aname => G_WF_ITM_MESSAGE_BODY,
300:
301: IF (itemtype = 'OKLSTLAT') THEN
302: l_name := wf_engine.GetItemAttrText(itemtype, itemkey, 'LAT_NAME');
303:
304: wf_engine.SetItemAttrDocument(itemtype => itemtype,
305: itemkey => itemkey,
306: aname => G_WF_ITM_MESSAGE_BODY,
307: documentid => 'plsql:okl_lease_app_wf.get_lat_msg_doc/' ||
308: itemkey);
305: itemkey => itemkey,
306: aname => G_WF_ITM_MESSAGE_BODY,
307: documentid => 'plsql:okl_lease_app_wf.get_lat_msg_doc/' ||
308: itemkey);
309: wf_engine.SetItemAttrText(itemtype => itemtype,
310: itemkey => itemkey,
311: aname => G_WF_ITM_MESSAGE_DESCR,
312: avalue => get_lat_msg_body(itemtype,
313: itemkey));
311: aname => G_WF_ITM_MESSAGE_DESCR,
312: avalue => get_lat_msg_body(itemtype,
313: itemkey));
314: ELSIF (itemtype = 'OKLSOLAW') THEN
315: l_name := wf_engine.GetItemAttrText(itemtype, itemkey, 'LA_NAME');
316:
317: wf_engine.SetItemAttrDocument(itemtype => itemtype,
318: itemkey => itemkey,
319: aname => G_WF_ITM_MESSAGE_BODY,
313: itemkey));
314: ELSIF (itemtype = 'OKLSOLAW') THEN
315: l_name := wf_engine.GetItemAttrText(itemtype, itemkey, 'LA_NAME');
316:
317: wf_engine.SetItemAttrDocument(itemtype => itemtype,
318: itemkey => itemkey,
319: aname => G_WF_ITM_MESSAGE_BODY,
320: documentid => 'plsql:okl_lease_app_wf.get_la_withdraw_msg_doc/' ||
321: itemkey);
318: itemkey => itemkey,
319: aname => G_WF_ITM_MESSAGE_BODY,
320: documentid => 'plsql:okl_lease_app_wf.get_la_withdraw_msg_doc/' ||
321: itemkey);
322: wf_engine.SetItemAttrText(itemtype => itemtype,
323: itemkey => itemkey,
324: aname => G_WF_ITM_MESSAGE_DESCR,
325: avalue => get_lease_app_msg_body(itemtype,
326: itemkey));
324: aname => G_WF_ITM_MESSAGE_DESCR,
325: avalue => get_lease_app_msg_body(itemtype,
326: itemkey));
327: ELSIF (itemtype = 'OKLSOLAP') THEN
328: l_name := wf_engine.GetItemAttrText(itemtype, itemkey, 'LA_NAME');
329:
330: wf_engine.SetItemAttrDocument(itemtype => itemtype,
331: itemkey => itemkey,
332: aname => G_WF_ITM_MESSAGE_BODY,
326: itemkey));
327: ELSIF (itemtype = 'OKLSOLAP') THEN
328: l_name := wf_engine.GetItemAttrText(itemtype, itemkey, 'LA_NAME');
329:
330: wf_engine.SetItemAttrDocument(itemtype => itemtype,
331: itemkey => itemkey,
332: aname => G_WF_ITM_MESSAGE_BODY,
333: documentid => 'plsql:okl_lease_app_wf.get_la_approval_msg_doc/' ||
334: itemkey);
331: itemkey => itemkey,
332: aname => G_WF_ITM_MESSAGE_BODY,
333: documentid => 'plsql:okl_lease_app_wf.get_la_approval_msg_doc/' ||
334: itemkey);
335: wf_engine.SetItemAttrText(itemtype => itemtype,
336: itemkey => itemkey,
337: aname => G_WF_ITM_MESSAGE_DESCR,
338: avalue => get_lease_app_msg_body(itemtype,
339: itemkey));
353: l_reminder_message := get_message('OKL_FE_REMINDER_APPROVAL_SUB',
354: l_object_name,
355: l_name);
356:
357: wf_engine.SetItemAttrText(itemtype,
358: itemkey,
359: G_WF_ITM_APP_REQUEST_SUB,
360: l_request_message);
361: wf_engine.SetItemAttrText(itemtype,
357: wf_engine.SetItemAttrText(itemtype,
358: itemkey,
359: G_WF_ITM_APP_REQUEST_SUB,
360: l_request_message);
361: wf_engine.SetItemAttrText(itemtype,
362: itemkey,
363: G_WF_ITM_APP_REMINDER_SUB,
364: l_reminder_message);
365: wf_engine.SetItemAttrText(itemtype,
361: wf_engine.SetItemAttrText(itemtype,
362: itemkey,
363: G_WF_ITM_APP_REMINDER_SUB,
364: l_reminder_message);
365: wf_engine.SetItemAttrText(itemtype,
366: itemkey,
367: G_WF_ITM_APP_REMINDER_HEAD,
368: l_reminder_message);
369: wf_engine.SetItemAttrText(itemtype,
365: wf_engine.SetItemAttrText(itemtype,
366: itemkey,
367: G_WF_ITM_APP_REMINDER_HEAD,
368: l_reminder_message);
369: wf_engine.SetItemAttrText(itemtype,
370: itemkey,
371: G_WF_ITM_APP_APPROVED_SUB,
372: l_approved_message);
373: wf_engine.SetItemAttrText(itemtype,
369: wf_engine.SetItemAttrText(itemtype,
370: itemkey,
371: G_WF_ITM_APP_APPROVED_SUB,
372: l_approved_message);
373: wf_engine.SetItemAttrText(itemtype,
374: itemkey,
375: G_WF_ITM_APP_APPROVED_HEAD,
376: l_approved_message);
377: wf_engine.SetItemAttrText(itemtype,
373: wf_engine.SetItemAttrText(itemtype,
374: itemkey,
375: G_WF_ITM_APP_APPROVED_HEAD,
376: l_approved_message);
377: wf_engine.SetItemAttrText(itemtype,
378: itemkey,
379: G_WF_ITM_APP_REJECTED_SUB,
380: l_rejected_message);
381: wf_engine.SetItemAttrText(itemtype,
377: wf_engine.SetItemAttrText(itemtype,
378: itemkey,
379: G_WF_ITM_APP_REJECTED_SUB,
380: l_rejected_message);
381: wf_engine.SetItemAttrText(itemtype,
382: itemkey,
383: G_WF_ITM_APP_REJECTED_HEAD,
384: l_rejected_message);
385: EXCEPTION
462:
463: BEGIN
464:
465: -- get the value of the version id from the workflow
466: l_lat_version_id := wf_engine.GetItemAttrText(itemtype,
467: itemkey,
468: 'VERSION_ID');
469:
470: -- Query the details of the Lease Application Template
472: FETCH c_get_lat_details INTO lp_lat_dtls_rec;
473: CLOSE c_get_lat_details;
474:
475: -- set the attributes of the workflow
476: wf_engine.SetItemAttrText(itemtype,
477: itemkey,
478: 'LAT_NAME',
479: lp_lat_dtls_rec.lat_name);
480:
477: itemkey,
478: 'LAT_NAME',
479: lp_lat_dtls_rec.lat_name);
480:
481: wf_engine.SetItemAttrText(itemtype,
482: itemkey,
483: 'VERSION_NUMBER',
484: lp_lat_dtls_rec.version_number);
485:
482: itemkey,
483: 'VERSION_NUMBER',
484: lp_lat_dtls_rec.version_number);
485:
486: wf_engine.SetItemAttrText(itemtype,
487: itemkey,
488: 'VERSION_STATUS',
489: lp_lat_dtls_rec.version_number);
490:
487: itemkey,
488: 'VERSION_STATUS',
489: lp_lat_dtls_rec.version_number);
490:
491: wf_engine.SetItemAttrText(itemtype,
492: itemkey,
493: 'EFFECTIVE_FROM',
494: lp_lat_dtls_rec.effective_from);
495:
492: itemkey,
493: 'EFFECTIVE_FROM',
494: lp_lat_dtls_rec.effective_from);
495:
496: wf_engine.SetItemAttrText(itemtype,
497: itemkey,
498: 'EFFECTIVE_TO',
499: lp_lat_dtls_rec.effective_to);
500:
510: CLOSE c_get_app_id_csr;
511:
512: -- set the values of the approver and the requestor
513:
514: wf_engine.SetItemAttrText(itemtype,
515: itemkey,
516: G_WF_ITM_APPROVER,
517: l_user_name);
518:
515: itemkey,
516: G_WF_ITM_APPROVER,
517: l_user_name);
518:
519: wf_engine.SetItemAttrText(itemtype,
520: itemkey,
521: G_WF_ITM_REQUESTER,
522: l_user_name);
523:
520: itemkey,
521: G_WF_ITM_REQUESTER,
522: l_user_name);
523:
524: wf_engine.SetItemAttrText(itemtype,
525: itemkey,
526: G_WF_ITM_REQUESTER_ID,
527: fnd_global.user_id);
528: wf_engine.SetItemAttrText(itemtype,
524: wf_engine.SetItemAttrText(itemtype,
525: itemkey,
526: G_WF_ITM_REQUESTER_ID,
527: fnd_global.user_id);
528: wf_engine.SetItemAttrText(itemtype,
529: itemkey,
530: G_WF_ITM_TRANSACTION_TYPE_ID,
531: itemtype);
532: wf_engine.SetItemAttrText(itemtype,
528: wf_engine.SetItemAttrText(itemtype,
529: itemkey,
530: G_WF_ITM_TRANSACTION_TYPE_ID,
531: itemtype);
532: wf_engine.SetItemAttrText(itemtype,
533: itemkey,
534: G_WF_ITM_TRANSACTION_ID,
535: l_lat_version_id);
536: wf_engine.SetItemAttrText(itemtype,
532: wf_engine.SetItemAttrText(itemtype,
533: itemkey,
534: G_WF_ITM_TRANSACTION_ID,
535: l_lat_version_id);
536: wf_engine.SetItemAttrText(itemtype,
537: itemkey,
538: G_WF_ITM_APPLICATION_ID,
539: l_application_id);
540:
633:
634: BEGIN
635:
636: IF (funcmode = 'RUN') THEN
637: l_la_id := wf_engine.GetItemAttrText(itemtype,
638: itemkey,
639: 'LA_ID');
640:
641: OPEN c_get_la_status(l_la_id);
651: --Set the message for rejection
652: OPEN obj_name_csr('LAP');
653: FETCH obj_name_csr INTO l_object_name;
654: CLOSE obj_name_csr;
655: l_name := wf_engine.GetItemAttrText(itemtype, itemkey, 'LA_NAME');
656:
657: wf_engine.SetItemAttrDocument(itemtype => itemtype,
658: itemkey => itemkey,
659: aname => G_WF_ITM_MESSAGE_BODY,
653: FETCH obj_name_csr INTO l_object_name;
654: CLOSE obj_name_csr;
655: l_name := wf_engine.GetItemAttrText(itemtype, itemkey, 'LA_NAME');
656:
657: wf_engine.SetItemAttrDocument(itemtype => itemtype,
658: itemkey => itemkey,
659: aname => G_WF_ITM_MESSAGE_BODY,
660: documentid => 'plsql:okl_lease_app_wf.get_la_withdraw_msg_doc/' ||
661: itemkey);
658: itemkey => itemkey,
659: aname => G_WF_ITM_MESSAGE_BODY,
660: documentid => 'plsql:okl_lease_app_wf.get_la_withdraw_msg_doc/' ||
661: itemkey);
662: wf_engine.SetItemAttrText(itemtype => itemtype,
663: itemkey => itemkey,
664: aname => G_WF_ITM_MESSAGE_DESCR,
665: avalue => get_lease_app_msg_body(itemtype,
666: itemkey));
669: l_object_name,
670: l_name);
671:
672: -- Set the message header
673: wf_engine.SetItemAttrText(itemtype,
674: itemkey,
675: G_WF_ITM_APP_REJECTED_SUB,
676: l_rejected_message);
677: wf_engine.SetItemAttrText(itemtype,
673: wf_engine.SetItemAttrText(itemtype,
674: itemkey,
675: G_WF_ITM_APP_REJECTED_SUB,
676: l_rejected_message);
677: wf_engine.SetItemAttrText(itemtype,
678: itemkey,
679: G_WF_ITM_APP_REJECTED_HEAD,
680: l_rejected_message);
681:
832: WHERE LAVV.ID = cp_version_id;
833: BEGIN
834: -- RUN mode
835: IF (funcmode = 'RUN') THEN
836: l_result := wf_engine.GetItemAttrText(itemtype, itemkey, 'RESULT');
837: lv_approval_status_ame := wf_engine.GetItemAttrText(itemtype => itemtype,
838: itemkey => itemkey,
839: aname => 'APPROVED_YN');
840: -- If the approver has approved
833: BEGIN
834: -- RUN mode
835: IF (funcmode = 'RUN') THEN
836: l_result := wf_engine.GetItemAttrText(itemtype, itemkey, 'RESULT');
837: lv_approval_status_ame := wf_engine.GetItemAttrText(itemtype => itemtype,
838: itemkey => itemkey,
839: aname => 'APPROVED_YN');
840: -- If the approver has approved
841: IF (l_result = G_WF_ITM_APPROVED_YN_YES OR lv_approval_status_ame = 'Y') THEN
838: itemkey => itemkey,
839: aname => 'APPROVED_YN');
840: -- If the approver has approved
841: IF (l_result = G_WF_ITM_APPROVED_YN_YES OR lv_approval_status_ame = 'Y') THEN
842: l_lat_version_id := wf_engine.GetItemAttrText(itemtype,
843: itemkey,
844: 'VERSION_ID');
845:
846: -- Call API to activate the Lease Application template
925: BEGIN
926: -- RUN mode
927: IF (funcmode = 'RUN') THEN
928:
929: lv_approval_status_ame := wf_engine.GetItemAttrText(itemtype => itemtype,
930: itemkey => itemkey,
931: aname => 'APPROVED_YN');
932: -- If the approver has approved
933: IF (lv_approval_status_ame = 'Y') THEN
930: itemkey => itemkey,
931: aname => 'APPROVED_YN');
932: -- If the approver has approved
933: IF (lv_approval_status_ame = 'Y') THEN
934: l_lease_app_id := wf_engine.GetItemAttrText(itemtype,
935: itemkey,
936: 'LA_ID');
937:
938: -- Call API to change the Lease Application status to WITHDRAWN