1: PACKAGE BODY PO_DRAFTS_GRP AS
2: /* $Header: PO_DRAFTS_GRP.plb 120.12.12020000.2 2013/02/10 16:35:48 vegajula ship $ */
3:
4: d_pkg_name CONSTANT varchar2(50) :=
5: PO_LOG.get_package_base('PO_DRAFTS_GRP');
1: PACKAGE BODY PO_DRAFTS_GRP AS
2: /* $Header: PO_DRAFTS_GRP.plb 120.12.12020000.2 2013/02/10 16:35:48 vegajula ship $ */
3:
4: d_pkg_name CONSTANT varchar2(50) :=
5: PO_LOG.get_package_base('PO_DRAFTS_GRP');
6:
1: PACKAGE BODY PO_DRAFTS_GRP AS
2: /* $Header: PO_DRAFTS_GRP.plb 120.12.12020000.2 2013/02/10 16:35:48 vegajula ship $ */
3:
4: d_pkg_name CONSTANT varchar2(50) :=
5: PO_LOG.get_package_base('PO_DRAFTS_GRP');
6:
7: -----------------------------------------------------------------------
8: --Start of Comments
9: --Name: get_online_auth_status_code
42: d_position NUMBER;
43:
44: l_api_version NUMBER := 1.0;
45:
46: l_draft_id PO_DRAFTS.draft_id%TYPE;
47: l_draft_status PO_DRAFTS.status%TYPE;
48: l_draft_owner_role PO_DRAFTS.owner_role%TYPE;
49:
50: BEGIN
43:
44: l_api_version NUMBER := 1.0;
45:
46: l_draft_id PO_DRAFTS.draft_id%TYPE;
47: l_draft_status PO_DRAFTS.status%TYPE;
48: l_draft_owner_role PO_DRAFTS.owner_role%TYPE;
49:
50: BEGIN
51:
44: l_api_version NUMBER := 1.0;
45:
46: l_draft_id PO_DRAFTS.draft_id%TYPE;
47: l_draft_status PO_DRAFTS.status%TYPE;
48: l_draft_owner_role PO_DRAFTS.owner_role%TYPE;
49:
50: BEGIN
51:
52: d_position := 0;
68: END IF;
69:
70: x_online_auth_status_code := g_NO_DRAFT;
71:
72: PO_DRAFTS_PVT.find_draft
73: ( p_po_header_id => p_po_header_id,
74: x_draft_id => l_draft_id,
75: x_draft_status => l_draft_status,
76: x_draft_owner_role => l_draft_owner_role
79: d_position := 10;
80:
81: IF (l_draft_id IS NOT NULL) THEN
82: IF (l_draft_owner_role = PO_GLOBAL.g_ROLE_SUPPLIER) THEN
83: IF (l_draft_status IN (PO_DRAFTS_PVT.g_status_DRAFT,
84: PO_DRAFTS_PVT.g_status_PDOI_PROCESSING)) THEN
85:
86: d_position := 20;
87: x_online_auth_status_code := g_SUPPLIER_SUBMISSION_PENDING;
80:
81: IF (l_draft_id IS NOT NULL) THEN
82: IF (l_draft_owner_role = PO_GLOBAL.g_ROLE_SUPPLIER) THEN
83: IF (l_draft_status IN (PO_DRAFTS_PVT.g_status_DRAFT,
84: PO_DRAFTS_PVT.g_status_PDOI_PROCESSING)) THEN
85:
86: d_position := 20;
87: x_online_auth_status_code := g_SUPPLIER_SUBMISSION_PENDING;
88:
85:
86: d_position := 20;
87: x_online_auth_status_code := g_SUPPLIER_SUBMISSION_PENDING;
88:
89: ELSIF (l_draft_status = PO_DRAFTS_PVT.g_status_IN_PROCESS) THEN
90:
91: d_position := 30;
92: x_online_auth_status_code := g_SUPPLIER_CHANGES_SUBMITTED;
93: END IF;
92: x_online_auth_status_code := g_SUPPLIER_CHANGES_SUBMITTED;
93: END IF;
94:
95: ELSIF (l_draft_owner_role = PO_GLOBAL.g_ROLE_CAT_ADMIN) THEN
96: IF (l_draft_status IN (PO_DRAFTS_PVT.g_status_DRAFT,
97: PO_DRAFTS_PVT.g_status_PDOI_PROCESSING)) THEN
98:
99: d_position := 40;
100: x_online_auth_status_code := g_CAT_ADMIN_SUBMISSION_PENDING;
93: END IF;
94:
95: ELSIF (l_draft_owner_role = PO_GLOBAL.g_ROLE_CAT_ADMIN) THEN
96: IF (l_draft_status IN (PO_DRAFTS_PVT.g_status_DRAFT,
97: PO_DRAFTS_PVT.g_status_PDOI_PROCESSING)) THEN
98:
99: d_position := 40;
100: x_online_auth_status_code := g_CAT_ADMIN_SUBMISSION_PENDING;
101:
98:
99: d_position := 40;
100: x_online_auth_status_code := g_CAT_ADMIN_SUBMISSION_PENDING;
101:
102: ELSIF (l_draft_status = PO_DRAFTS_PVT.g_status_IN_PROCESS) THEN
103: d_position := 50;
104: x_online_auth_status_code := g_CAT_ADMIN_CHANGES_SUBMITTED;
105: END IF;
106:
200:
201: d_position := 20;
202:
203: -- check whether supplier can take the functional lock of the document
204: PO_DRAFTS_PVT.update_permission_check
205: ( p_calling_module => PO_DRAFTS_PVT.g_call_mod_HTML_UI,
206: p_po_header_id => p_po_header_id,
207: p_role => PO_GLOBAL.g_role_SUPPLIER,
208: x_update_allowed => x_authoring_allowed,
201: d_position := 20;
202:
203: -- check whether supplier can take the functional lock of the document
204: PO_DRAFTS_PVT.update_permission_check
205: ( p_calling_module => PO_DRAFTS_PVT.g_call_mod_HTML_UI,
206: p_po_header_id => p_po_header_id,
207: p_role => PO_GLOBAL.g_role_SUPPLIER,
208: x_update_allowed => x_authoring_allowed,
209: x_locking_applicable => l_locking_applicable,
301: END IF;
302:
303: d_position := 10;
304:
305: PO_DRAFTS_PVT.get_upload_status_info
306: ( p_po_header_id => p_po_header_id,
307: p_role => p_role,
308: x_upload_status_code => x_upload_status_code,
309: x_upload_requestor_role_id => x_upload_requestor_role_id,
391: END IF;
392:
393: d_position := 10;
394:
395: PO_DRAFTS_PVT.get_in_process_upload_info
396: ( p_po_header_id => p_po_header_id,
397: x_upload_in_progress => x_upload_in_progress,
398: x_upload_status_code => x_upload_status_code,
399: x_upload_requestor_role => x_upload_requestor_role,
456: l_return_status VARCHAR2(1);
457:
458: l_draft_id NUMBER;
459: -- Bug 12700941
460: l_draft_status PO_DRAFTS.status%TYPE;
461: l_draft_owner_role PO_DRAFTS.owner_role%TYPE;
462:
463: l_changes_exist_tbl PO_TBL_VARCHAR1;
464: l_unlock VARCHAR2(1) := FND_API.G_FALSE;
457:
458: l_draft_id NUMBER;
459: -- Bug 12700941
460: l_draft_status PO_DRAFTS.status%TYPE;
461: l_draft_owner_role PO_DRAFTS.owner_role%TYPE;
462:
463: l_changes_exist_tbl PO_TBL_VARCHAR1;
464: l_unlock VARCHAR2(1) := FND_API.G_FALSE;
465:
484: END IF;
485:
486: -- Bug 12700941 starts
487: -- Getting the lock owner role as well
488: PO_DRAFTS_PVT.find_draft
489: ( p_po_header_id => p_po_header_id,
490: x_draft_id => l_draft_id,
491: x_draft_status =>l_draft_status,
492: x_draft_owner_role =>l_draft_owner_role
504: IF (l_draft_id IS NOT NULL) THEN
505: d_position := 20;
506:
507: l_changes_exist_tbl :=
508: PO_DRAFTS_PVT.changes_exist_for_draft
509: ( p_draft_id_tbl => PO_TBL_NUMBER(l_draft_id)
510: );
511:
512: -- Bug 12700941 starts
511:
512: -- Bug 12700941 starts
513: -- changes_exist_for_draft returns true even when the current requset for uplaod fails
514: -- if the any of teh previous upload requests was successful but
515: -- In such case, the draft (po_drafts) status need to be set back to 'DRAFT'
516: -- for cat.admin/supplier
517: -- and draft record (po_drafts) should be deleted for role= Buyer as For Buyer the draft record is not retained
518:
519: IF (l_changes_exist_tbl(1) = FND_API.G_FALSE OR l_draft_owner_role =PO_GLOBAL.g_role_BUYER) THEN
513: -- changes_exist_for_draft returns true even when the current requset for uplaod fails
514: -- if the any of teh previous upload requests was successful but
515: -- In such case, the draft (po_drafts) status need to be set back to 'DRAFT'
516: -- for cat.admin/supplier
517: -- and draft record (po_drafts) should be deleted for role= Buyer as For Buyer the draft record is not retained
518:
519: IF (l_changes_exist_tbl(1) = FND_API.G_FALSE OR l_draft_owner_role =PO_GLOBAL.g_role_BUYER) THEN
520: d_position := 30;
521:
520: d_position := 30;
521:
522: l_unlock := FND_API.G_TRUE;
523:
524: PO_DRAFTS_PVT.remove_draft_changes
525: ( p_draft_id => l_draft_id,
526: p_exclude_ctrl_tbl => FND_API.G_FALSE,
527: x_return_status => l_return_status
528: );
532: END IF;
533:
534: ELSE
535:
536: PO_DRAFTS_PVT.update_draft_status( p_draft_id => l_draft_id,
537: p_new_status =>PO_DRAFTS_PVT.g_status_DRAFT);
538:
539: END IF;
540: -- Bug 12700941 ends
533:
534: ELSE
535:
536: PO_DRAFTS_PVT.update_draft_status( p_draft_id => l_draft_id,
537: p_new_status =>PO_DRAFTS_PVT.g_status_DRAFT);
538:
539: END IF;
540: -- Bug 12700941 ends
541: ELSE
550:
551: d_position := 50;
552:
553: IF ( l_unlock = FND_API.G_TRUE ) THEN
554: PO_DRAFTS_PVT.unlock_document
555: ( p_po_header_id => p_po_header_id
556: );
557: END IF;
558:
637: END IF;
638:
639: d_position := 10;
640:
641: PO_DRAFTS_PVT.lock_document_with_validate
642: ( p_calling_module => p_calling_module,
643: p_po_header_id => p_po_header_id,
644: p_role => p_role,
645: p_role_user_id => p_role_user_id,
660: p_procedure_name => d_api_name || '.' || d_position
661: );
662: END lock_document_with_validate;
663:
664: END PO_DRAFTS_GRP;