53: cursor Is_linked(c_element_version_id NUMBER) IS
54: select '1'
55: from pa_object_relationships
56: where object_id_from1 = c_element_version_id
57: and object_type_from = 'PA_TASKS'
58: and relationship_type = 'L';
59:
60: cursor Is_structure(c_element_version_id NUMBER) IS
61: select '1'
68: from pa_proj_element_versions
69: where element_version_id = c_element_version_id;
70: l_from_struc_ver_id NUMBER;
71:
72: cursor Check_PA_TASKS_Exists(c_task_id NUMBER) IS
73: select '1'
74: from PA_TASKS
75: where task_id = c_task_id;
76:
70: l_from_struc_ver_id NUMBER;
71:
72: cursor Check_PA_TASKS_Exists(c_task_id NUMBER) IS
73: select '1'
74: from PA_TASKS
75: where task_id = c_task_id;
76:
77: cursor Is_Same_Struc(c_elem_ver_from NUMBER, c_elem_ver_to NUMBER) IS
78: select '1'
152: where a.element_version_id = c_to
153: and a.proj_element_id = b.proj_element_id
154: and a.project_id = b.project_id
155: )
156: and object_type_from IN ('PA_TASKS','PA_STRUCTURES')
157: and object_type_to IN ('PA_TASKS','PA_STRUCTURES')
158: and relationship_type IN ('S','L')
159: connect by prior object_id_to1 = object_id_from1
160: and object_type_from IN ('PA_TASKS','PA_STRUCTURES')
153: and a.proj_element_id = b.proj_element_id
154: and a.project_id = b.project_id
155: )
156: and object_type_from IN ('PA_TASKS','PA_STRUCTURES')
157: and object_type_to IN ('PA_TASKS','PA_STRUCTURES')
158: and relationship_type IN ('S','L')
159: connect by prior object_id_to1 = object_id_from1
160: and object_type_from IN ('PA_TASKS','PA_STRUCTURES')
161: and prior object_type_to IN ('PA_TASKS','PA_STRUCTURES')
156: and object_type_from IN ('PA_TASKS','PA_STRUCTURES')
157: and object_type_to IN ('PA_TASKS','PA_STRUCTURES')
158: and relationship_type IN ('S','L')
159: connect by prior object_id_to1 = object_id_from1
160: and object_type_from IN ('PA_TASKS','PA_STRUCTURES')
161: and prior object_type_to IN ('PA_TASKS','PA_STRUCTURES')
162: and prior relationship_type IN ('S','L')
163: );
164:
157: and object_type_to IN ('PA_TASKS','PA_STRUCTURES')
158: and relationship_type IN ('S','L')
159: connect by prior object_id_to1 = object_id_from1
160: and object_type_from IN ('PA_TASKS','PA_STRUCTURES')
161: and prior object_type_to IN ('PA_TASKS','PA_STRUCTURES')
162: and prior relationship_type IN ('S','L')
163: );
164:
165:
168: from pa_object_relationships a
169: where NOT EXISTS (select '1' from pa_object_relationships b
170: where b.object_id_to1 = a.object_id_from1)
171: start with a.object_id_to1 = c_element_version_id
172: and a.object_type_to IN ('PA_STRUCTURES','PA_TASKS')
173: connect by prior a.object_id_from1 = a.object_id_to1
174: and a.relationship_type IN ('S','L')
175: union
176: select a.object_id_from1
175: union
176: select a.object_id_from1
177: from pa_object_relationships a
178: where a.object_id_from1 = c_element_version_id
179: and object_type_from IN ('PA_STRUCTURES', 'PA_TASKS')
180: and relationship_type = 'S';
181: l_top_node_id NUMBER;
182:
183: cursor Is_Version_Exist(c_top_node_id NUMBER, c_linking_node_id NUMBER) IS
184: select object_id_to1
185: from pa_object_relationships
186: where relationship_type IN ('S', 'L')
187: start with object_id_from1 = c_top_node_id
188: and object_type_from IN ('PA_STRUCTURES','PA_TASKS')
189: connect by object_id_from1 = prior object_id_to1
190: and relationship_type IN ('L','S')
191: intersect
192: (
201: ( select object_id_to1
202: from pa_object_relationships
203: where relationship_type IN ('S','L')
204: start with object_id_from1 = c_linking_node_id
205: and object_type_from IN ('PA_STRUCTURES','PA_TASKS')
206: connect by object_id_from1 = prior object_id_to1
207: and relationship_type IN('L','S')
208: -- UNION
209: -- select object_id_from1
209: -- select object_id_from1
210: -- from pa_object_relationships
211: -- where relationship_type IN ('S','L')
212: -- start with object_id_to1 = c_linking_node_id
213: -- and object_type_to IN ('PA_STRUCTURES','PA_TASKS')
214: -- connect by prior object_id_from1 = object_id_to1
215: -- and relationship_type IN ('S','L')
216: UNION
217: select element_version_id
287: l_from_struc_ver_id, 'FINANCIAL') = 'Y') THEN
288: --Check for transaction for this task
289:
290:
291: IF (l_object_type = 'PA_TASKS') THEN
292: --Bug 2183974
293: --Check if this task is valid in PA_TASKS first
294: OPEN Check_PA_TASKS_Exists(l_element_id);
295: FETCH Check_PA_TASKS_Exists into l_dummy;
289:
290:
291: IF (l_object_type = 'PA_TASKS') THEN
292: --Bug 2183974
293: --Check if this task is valid in PA_TASKS first
294: OPEN Check_PA_TASKS_Exists(l_element_id);
295: FETCH Check_PA_TASKS_Exists into l_dummy;
296: IF Check_PA_TASKS_Exists%NOTFOUND THEN
297: CLOSE Check_PA_TASKS_Exists;
290:
291: IF (l_object_type = 'PA_TASKS') THEN
292: --Bug 2183974
293: --Check if this task is valid in PA_TASKS first
294: OPEN Check_PA_TASKS_Exists(l_element_id);
295: FETCH Check_PA_TASKS_Exists into l_dummy;
296: IF Check_PA_TASKS_Exists%NOTFOUND THEN
297: CLOSE Check_PA_TASKS_Exists;
298: x_error_message_code := 'PA_PS_PA_TASKS_NOT_EXISTS';
291: IF (l_object_type = 'PA_TASKS') THEN
292: --Bug 2183974
293: --Check if this task is valid in PA_TASKS first
294: OPEN Check_PA_TASKS_Exists(l_element_id);
295: FETCH Check_PA_TASKS_Exists into l_dummy;
296: IF Check_PA_TASKS_Exists%NOTFOUND THEN
297: CLOSE Check_PA_TASKS_Exists;
298: x_error_message_code := 'PA_PS_PA_TASKS_NOT_EXISTS';
299: x_return_status := FND_API.G_RET_STS_ERROR;
292: --Bug 2183974
293: --Check if this task is valid in PA_TASKS first
294: OPEN Check_PA_TASKS_Exists(l_element_id);
295: FETCH Check_PA_TASKS_Exists into l_dummy;
296: IF Check_PA_TASKS_Exists%NOTFOUND THEN
297: CLOSE Check_PA_TASKS_Exists;
298: x_error_message_code := 'PA_PS_PA_TASKS_NOT_EXISTS';
299: x_return_status := FND_API.G_RET_STS_ERROR;
300: return;
293: --Check if this task is valid in PA_TASKS first
294: OPEN Check_PA_TASKS_Exists(l_element_id);
295: FETCH Check_PA_TASKS_Exists into l_dummy;
296: IF Check_PA_TASKS_Exists%NOTFOUND THEN
297: CLOSE Check_PA_TASKS_Exists;
298: x_error_message_code := 'PA_PS_PA_TASKS_NOT_EXISTS';
299: x_return_status := FND_API.G_RET_STS_ERROR;
300: return;
301: ELSE
294: OPEN Check_PA_TASKS_Exists(l_element_id);
295: FETCH Check_PA_TASKS_Exists into l_dummy;
296: IF Check_PA_TASKS_Exists%NOTFOUND THEN
297: CLOSE Check_PA_TASKS_Exists;
298: x_error_message_code := 'PA_PS_PA_TASKS_NOT_EXISTS';
299: x_return_status := FND_API.G_RET_STS_ERROR;
300: return;
301: ELSE
302: --Task exists
299: x_return_status := FND_API.G_RET_STS_ERROR;
300: return;
301: ELSE
302: --Task exists
303: CLOSE Check_PA_TASKS_Exists;
304: PA_TASK_UTILS.CHECK_CREATE_SUBTASK_OK(x_task_id => l_element_id,
305: x_err_code => l_err_code,
306: x_err_stack => l_err_stack,
307: x_err_stage => l_err_stage
550: AND ppv2.object_type = 'PA_STRUCTURES'
551: AND ppv1.element_version_id = por.object_id_from1
552: AND por.relationship_type in ( 'LW', 'LF' ) -- ( 'WL', 'FL' ) -- Bug # 4760126.
553: AND ppv2.element_version_id = por.object_id_to1
554: AND object_type_from = 'PA_TASKS' --Bug 6429264
555: AND object_type_to = 'PA_STRUCTURES' --Bug 6429264
556: ;
557: l_return_value VARCHAR2(1) := 'N';
558: BEGIN
911: start with por.object_id_to2 = c_pre_project_id
912: connect by prior por.object_id_from2 = por.object_id_to2
913: and prior por.relationship_type = por.relationship_type
914: and por.relationship_type in ('LW', 'LF')
915: AND object_type_from = 'PA_TASKS' --Bug 6429264
916: AND object_type_to = 'PA_STRUCTURES' --Bug 6429264
917: union all
918: -- This query selects all the child projects of the predecessor project.
919: select por.object_id_to1 task_ver_id, por.object_id_to2 project_id
922: start with por.object_id_from2 = c_pre_project_id
923: connect by prior por.object_id_to2 = por.object_id_from2
924: and prior por.relationship_type = por.relationship_type
925: and por.relationship_type in ('LW', 'LF')
926: AND object_type_from = 'PA_TASKS' --Bug 6429264
927: AND object_type_to = 'PA_STRUCTURES' --Bug 6429264
928: ;
929:
930: rec_sub_proj_hierarchy cur_sub_proj_hierarchy%ROWTYPE;
1079: FROM pa_object_relationships por
1080: WHERE por.object_id_from1 = c_element_version_id
1081: --Bug8534395: Commented below predicate to allow tasks from other project to be shown as predecessors.
1082: --AND por.object_id_from2 = por.object_id_to2
1083: AND por.object_type_from = 'PA_TASKS' --4141109 Replaced LIKE with Equijoin
1084: AND por.object_type_to = 'PA_TASKS' --4141109 Replaced LIKE with Equijoin
1085: AND por.relationship_type = 'D'); --4141109 Replaced LIKE with Equijoin
1086: l_cur_task_names_rec cur_task_names%ROWTYPE;
1087: BEGIN
1080: WHERE por.object_id_from1 = c_element_version_id
1081: --Bug8534395: Commented below predicate to allow tasks from other project to be shown as predecessors.
1082: --AND por.object_id_from2 = por.object_id_to2
1083: AND por.object_type_from = 'PA_TASKS' --4141109 Replaced LIKE with Equijoin
1084: AND por.object_type_to = 'PA_TASKS' --4141109 Replaced LIKE with Equijoin
1085: AND por.relationship_type = 'D'); --4141109 Replaced LIKE with Equijoin
1086: l_cur_task_names_rec cur_task_names%ROWTYPE;
1087: BEGIN
1088: OPEN cur_task_names(p_element_version_id);
1146: where por.relationship_type IN ('LW', 'LF')
1147: and ppev.element_version_id = por.object_id_to1
1148: and por.object_id_to2 = ppev.project_id
1149: and por.object_id_to2 = p_project_id
1150: AND object_type_from = 'PA_TASKS' --Bug 6429264
1151: AND object_type_to = 'PA_STRUCTURES'; --Bug 6429264
1152:
1153: CURSOR c2 IS
1154: select 1
1154: select 1
1155: from pa_object_relationships
1156: where relationship_type IN ('LW', 'LF')
1157: and object_id_from2 = p_project_id
1158: AND object_type_from = 'PA_TASKS' --Bug 6429264
1159: AND object_type_to = 'PA_STRUCTURES'; --Bug 6429264
1160:
1161: l_dummy number;
1162: BEGIN
1195: where por.relationship_type IN ('LW', 'LF')
1196: and ppev.element_version_id = por.object_id_to1
1197: and por.object_id_to2 = ppev.project_id
1198: and por.object_id_to2 = p_project_id
1199: AND object_type_from = 'PA_TASKS' --Bug 6429264
1200: AND object_type_to = 'PA_STRUCTURES'; --Bug 6429264
1201:
1202: l_dummy NUMBER;
1203: BEGIN
1346: pa_proj_elements ppe,
1347: pa_projects_all ppa
1348: WHERE ppe.project_id = ppev.project_id
1349: AND ppe.proj_element_id = ppev.proj_element_id
1350: AND ppev.object_type = 'PA_TASKS'
1351: AND ppe.object_type = 'PA_TASKS'
1352: AND ppe.project_id = ppa.project_id
1353: AND ppev.element_version_id IN (
1354: SELECT object_id_from1
1347: pa_projects_all ppa
1348: WHERE ppe.project_id = ppev.project_id
1349: AND ppe.proj_element_id = ppev.proj_element_id
1350: AND ppev.object_type = 'PA_TASKS'
1351: AND ppe.object_type = 'PA_TASKS'
1352: AND ppe.project_id = ppa.project_id
1353: AND ppev.element_version_id IN (
1354: SELECT object_id_from1
1355: FROM pa_object_relationships
1358: AND object_type_to = 'PA_STRUCTURES'
1359: CONNECT BY object_id_from2 = prior object_id_to2
1360: and prior relationship_type = relationship_type
1361: AND relationship_type IN ('LW','LF')
1362: AND object_type_from = 'PA_TASKS');
1363: -- End of Bug 3621794
1364: --
1365: --bug 3893970
1366: CURSOR get_multi_rollup(c_project_id NUMBER) IS