[Home] [Help]
1: PACKAGE BODY PA_CI_ACTIONS_PVT AS
2: /* $Header: PACIACVB.pls 120.3.12020000.2 2012/07/31 14:23:48 svmohamm ship $ */
3:
4:
5: PROCEDURE CREATE_CI_ACTION (
54: and sv.project_status_code = ci.status_code ;
55:
56: BEGIN
57: -- Initialize the Error Stack
58: PA_DEBUG.init_err_stack('PA_CI_ACTIONS_PVT.CREATE_CI_ACTION');
59:
60: -- Initialize the return status to success
61: x_return_status := FND_API.G_RET_STS_SUCCESS;
62:
73: return;
74: end if;
75:
76: if (p_ci_id IS NOT NULL) then
77: l_action_number := PA_CI_ACTIONS_UTIL.get_next_ci_action_number(p_ci_id);
78: end if;
79:
80: -- Validate the Input Values
81: If (x_return_status = fnd_api.g_ret_sts_success
80: -- Validate the Input Values
81: If (x_return_status = fnd_api.g_ret_sts_success
82: AND p_validate_only <> fnd_api.g_true) then
83:
84: PA_CI_ACTIONS_PKG.INSERT_ROW(
85: P_CI_ACTION_ID => l_ci_action_id,
86: P_CI_ID => P_CI_ID,
87: P_CI_ACTION_NUMBER => l_action_number,
88: P_STATUS_CODE => 'CI_ACTION_OPEN',
109: end if;
110:
111: If (x_return_status = fnd_api.g_ret_sts_success
112: AND p_validate_only <> fnd_api.g_true) then
113: PA_CI_ACTIONS_PVT.ADD_CI_COMMENT(
114: p_api_version => P_API_VERSION,
115: p_init_msg_list => P_INIT_MSG_LIST,
116: p_commit => P_COMMIT,
117: p_validate_only => P_VALIDATE_ONLY,
199: THEN
200: ROLLBACK TO ADD_ACTION;
201: END IF;
202: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
203: fnd_msg_pub.add_exc_msg(p_pkg_name => 'PA_CI_ACTIONS_PVT',
204: p_procedure_name => 'CREATE_CI_ACTIONS',
205: p_error_text => SUBSTRB(SQLERRM,1,240));
206: RAISE;
207: END CREATE_CI_ACTION;
226: )
227: IS
228: Cursor check_record_changed IS
229: select rowid
230: from pa_ci_actions
231: where ci_action_id = p_ci_action_id
232: and record_version_number = p_record_version_number
233: for update;
234:
234:
235: Cursor ci_action IS
236: select ci_id, type_code, assigned_to, date_required,
237: sign_off_required_flag, source_ci_action_id, created_by, creation_date
238: from pa_ci_actions
239: where ci_action_id = p_ci_action_id;
240:
241: l_party_id number;
242: l_created_by number;
264: from pa_control_items
265: where ci_id = l_ci_id;
266: BEGIN
267: -- Initialize the Error Stack
268: PA_DEBUG.init_err_stack('PA_CI_ACTIONS_PVT.CLOSE_CI_ACTION');
269:
270: -- Initialize the return status to success
271: x_return_status := FND_API.G_RET_STS_SUCCESS;
272:
313: -- End Modification for Bug#12839389
314:
315: If (x_return_status = fnd_api.g_ret_sts_success
316: AND p_validate_only <> fnd_api.g_true) then
317: PA_CI_ACTIONS_PKG.UPDATE_ROW(
318: P_CI_ACTION_ID => P_CI_ACTION_ID,
319: P_CI_ID => l_ci_id,
320: P_STATUS_CODE => l_action_status_code,
321: P_TYPE_CODE => l_type_code,
342: end if;
343:
344: If (x_return_status = fnd_api.g_ret_sts_success
345: AND p_validate_only <> fnd_api.g_true) then
346: PA_CI_ACTIONS_PVT.ADD_CI_COMMENT(
347: p_api_version => P_API_VERSION,
348: p_init_msg_list => P_INIT_MSG_LIST,
349: p_commit => P_COMMIT,
350: p_validate_only => P_VALIDATE_ONLY,
415: IF p_commit = FND_API.G_TRUE THEN
416: ROLLBACK TO CLOSE_CI_ACTION;
417: END IF;
418: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
419: fnd_msg_pub.add_exc_msg(p_pkg_name => 'PA_CI_ACTIONS_PVT',
420: p_procedure_name => 'CLOSE_CI_ACTIONS',
421: p_error_text => SUBSTRB(SQLERRM,1,240));
422: RAISE;
423: END CLOSE_CI_ACTION;
447: )
448: IS
449: Cursor check_record_changed IS
450: select rowid
451: from pa_ci_actions
452: where ci_action_id = p_ci_action_id
453: and record_version_number = p_record_version_number
454: for update;
455:
455:
456: Cursor ci_action IS
457: select ci_id, type_code, assigned_to, date_required,
458: sign_off_required_flag, source_ci_action_id
459: from pa_ci_actions
460: where ci_action_id = p_ci_action_id;
461:
462: l_new_ci_action_id number;
463: l_ci_id number;
474:
475:
476: BEGIN
477: -- Initialize the Error Stack
478: PA_DEBUG.init_err_stack('PA_CI_ACTIONS_PVT.REASSIGN_CI_ACTION');
479:
480: -- Initialize the return status to success
481: x_return_status := FND_API.G_RET_STS_SUCCESS;
482: x_msg_data := 0;
516:
517: -- Validate if the action is being reassigned to the same person and check if date is before system date.
518: select assigned_to
519: into l_assigned_to_party
520: from pa_ci_actions
521: where ci_action_id = p_ci_action_id;
522:
523:
524: if (p_assigned_to is not null and (l_assigned_to_party = p_assigned_to OR ((P_DATE_REQUIRED is not null) and (P_DATE_REQUIRED < sysdate))))then
541:
542:
543: If (x_return_status = fnd_api.g_ret_sts_success
544: AND p_validate_only <> fnd_api.g_true) then
545: PA_CI_ACTIONS_PVT.CLOSE_CI_ACTION
546: (
547: p_api_version => P_API_VERSION,
548: p_init_msg_list => P_INIT_MSG_LIST,
549: p_commit => P_COMMIT,
562:
563: If (x_return_status = fnd_api.g_ret_sts_success
564: AND p_validate_only <> fnd_api.g_true) then
565:
566: PA_CI_ACTIONS_PVT.CREATE_CI_ACTION
567: (
568: P_API_VERSION => P_API_VERSION,
569: P_INIT_MSG_LIST => P_INIT_MSG_LIST,
570: P_COMMIT => P_COMMIT,
599: IF p_commit = FND_API.G_TRUE THEN
600: ROLLBACK TO REASSIGN_CI_ACTION;
601: END IF;
602: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
603: fnd_msg_pub.add_exc_msg(p_pkg_name => 'PA_CI_ACTIONS_PVT',
604: p_procedure_name => 'REASSIGN_CI_ACTION',
605: p_error_text => SUBSTRB(SQLERRM,1,240));
606: RAISE;
607: END REASSIGN_CI_ACTION;
624: )
625: IS
626: Cursor check_record_changed IS
627: select rowid
628: from pa_ci_actions
629: where ci_action_id = p_ci_action_id
630: and record_version_number = p_record_version_number
631: for update;
632:
632:
633: Cursor ci_action IS
634: select ci_id, type_code, assigned_to, date_required,
635: sign_off_required_flag, source_ci_action_id, created_by, creation_date, sign_off_flag
636: from pa_ci_actions
637: where ci_action_id = p_ci_action_id;
638:
639: l_party_id number;
640: l_created_by number;
702: CLOSE check_record_changed;
703: end if;
704: If (x_return_status = fnd_api.g_ret_sts_success
705: AND p_validate_only <> fnd_api.g_true) then
706: PA_CI_ACTIONS_PKG.UPDATE_ROW(
707: P_CI_ACTION_ID => P_CI_ACTION_ID,
708: P_CI_ID => l_ci_id,
709: P_STATUS_CODE => 'CI_ACTION_CANCELED',
710: P_TYPE_CODE => l_type_code,
730: end if;
731:
732: If (x_return_status = fnd_api.g_ret_sts_success
733: AND p_validate_only <> fnd_api.g_true) then
734: PA_CI_ACTIONS_PVT.ADD_CI_COMMENT(
735: p_api_version => P_API_VERSION,
736: p_init_msg_list => P_INIT_MSG_LIST,
737: p_commit => P_COMMIT,
738: p_validate_only => P_VALIDATE_ONLY,
791: IF p_commit = FND_API.G_TRUE THEN
792: ROLLBACK TO CLOSE_CI_ACTION;
793: END IF;
794: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
795: fnd_msg_pub.add_exc_msg(p_pkg_name => 'PA_CI_ACTIONS_PVT',
796: p_procedure_name => 'CLOSE_CI_ACTIONS',
797: p_error_text => SUBSTRB(SQLERRM,1,240));
798: RAISE;
799: END CANCEL_CI_ACTION;
899: IF p_commit = FND_API.G_TRUE THEN
900: ROLLBACK TO UPDATE_CI_COMMENT;
901: END IF;
902: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
903: fnd_msg_pub.add_exc_msg(p_pkg_name => 'PA_CI_ACTIONS_PVT',
904: p_procedure_name => 'UPDATE_CI_COMMENT',
905: p_error_text => SUBSTRB(SQLERRM,1,240));
906: RAISE;
907:
971: IF p_commit = FND_API.G_TRUE THEN
972: ROLLBACK TO ADD_CI_COMMENT;
973: END IF;
974: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
975: fnd_msg_pub.add_exc_msg(p_pkg_name => 'PA_CI_ACTIONS_PVT',
976: p_procedure_name => 'ADD_CI_COMMENT',
977: p_error_text => SUBSTRB(SQLERRM,1,240));
978: RAISE;
979: END ADD_CI_COMMENT;
1002: l_cancel_comment varchar2(32767);
1003:
1004: CURSOR cancel_action IS
1005: SELECT ci_action_id, record_version_number
1006: FROM PA_CI_ACTIONS pca
1007: WHERE pca.ci_id = p_ci_id
1008: AND status_code = 'CI_ACTION_OPEN';
1009:
1010:
1029: LOOP
1030: FETCH cancel_action INTO l_ci_action_id,
1031: l_record_version_number;
1032: EXIT WHEN cancel_action%NOTFOUND;
1033: PA_CI_ACTIONS_PVT.CANCEL_CI_ACTION
1034: (
1035: p_api_version => P_API_VERSION,
1036: p_init_msg_list => P_INIT_MSG_LIST,
1037: p_commit => P_COMMIT,
1061: IF p_commit = FND_API.G_TRUE THEN
1062: ROLLBACK TO ADD_CI_COMMENT;
1063: END IF;
1064: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1065: fnd_msg_pub.add_exc_msg(p_pkg_name => 'PA_CI_ACTIONS_PVT',
1066: p_procedure_name => 'DELETE_ALL_ACTIONS',
1067: p_error_text => SUBSTRB(SQLERRM,1,240));
1068: RAISE;
1069: END CANCEL_ALL_ACTIONS;
1086: l_ci_comment_id number;
1087:
1088: CURSOR delete_action IS
1089: SELECT ci_action_id
1090: FROM PA_CI_ACTIONS
1091: WHERE ci_id = p_ci_id;
1092:
1093: CURSOR delete_comment IS
1094: SELECT ci_comment_id
1110: OPEN delete_action;
1111: LOOP
1112: FETCH delete_action INTO l_ci_action_id;
1113: EXIT WHEN delete_action%NOTFOUND;
1114: PA_CI_ACTIONS_PKG.DELETE_ROW(
1115: P_CI_ACTION_ID => l_ci_action_id);
1116: OPEN delete_comment;
1117: LOOP
1118: FETCH delete_comment INTO l_ci_comment_id;
1140: IF p_commit = FND_API.G_TRUE THEN
1141: ROLLBACK TO ADD_CI_COMMENT;
1142: END IF;
1143: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1144: fnd_msg_pub.add_exc_msg(p_pkg_name => 'PA_CI_ACTIONS_PVT',
1145: p_procedure_name => 'DELETE_ALL_ACTIONS',
1146: p_error_text => SUBSTRB(SQLERRM,1,240));
1147: RAISE;
1148: END DELETE_ALL_ACTIONS;
1147: RAISE;
1148: END DELETE_ALL_ACTIONS;
1149:
1150:
1151: END PA_CI_ACTIONS_PVT; -- Package Body PA_CI_ACTIONS_PVT