69: --Check for Required Parameters
70: --Resource subtype
71: IF l_resource_type_code IS NULL THEN
72: x_return_status := fnd_api.g_ret_sts_unexp_error;
73: fnd_message.set_name('JTF', 'JTF_TASK_NULL_RES_TYPE_CODE');
74: fnd_msg_pub.ADD;
75: RAISE fnd_api.g_exc_unexpected_error;
76: END IF;
77:
77:
78: --Required Units
79: IF l_required_units IS NULL THEN
80: x_return_status := fnd_api.g_ret_sts_unexp_error;
81: fnd_message.set_name('JTF', 'JTF_TASK_NULL_REQ_UNIT');
82: fnd_msg_pub.ADD;
83: RAISE fnd_api.g_exc_unexpected_error;
84: END IF;
85:
92: , p_flag_value => l_enabled_flag
93: );
94:
95: IF (l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
96: fnd_message.set_name('JTF', 'JTF_TASK_INVALID_FLAG');
97: fnd_message.set_token('ENABLED_FLAG', p_enabled_flag);
98: RAISE fnd_api.g_exc_unexpected_error;
99: END IF;
100:
93: );
94:
95: IF (l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
96: fnd_message.set_name('JTF', 'JTF_TASK_INVALID_FLAG');
97: fnd_message.set_token('ENABLED_FLAG', p_enabled_flag);
98: RAISE fnd_api.g_exc_unexpected_error;
99: END IF;
100:
101: ---- if Enabled flag is null,Task is not Active
148: END IF;
149:
150: IF l_task_id IS NULL THEN
151: x_return_status := fnd_api.g_ret_sts_unexp_error;
152: fnd_message.set_name('JTF', 'JTF_TASK_INVALID_TASK_ID');
153: fnd_message.set_token('TASK_ID', p_task_id);
154: fnd_msg_pub.ADD;
155: RAISE fnd_api.g_exc_unexpected_error;
156: END IF;
149:
150: IF l_task_id IS NULL THEN
151: x_return_status := fnd_api.g_ret_sts_unexp_error;
152: fnd_message.set_name('JTF', 'JTF_TASK_INVALID_TASK_ID');
153: fnd_message.set_token('TASK_ID', p_task_id);
154: fnd_msg_pub.ADD;
155: RAISE fnd_api.g_exc_unexpected_error;
156: END IF;
157: ELSIF(p_task_type_id <> fnd_api.g_miss_num OR p_task_type_name <> fnd_api.g_miss_char) THEN
178: END IF;
179:
180: IF l_task_type_id IS NULL THEN
181: x_return_status := fnd_api.g_ret_sts_unexp_error;
182: fnd_message.set_name('JTF', 'JTF_TASK_INVALID_TYPE_ID');
183: fnd_message.set_token('TASK_ID', p_task_type_id);
184: fnd_msg_pub.ADD;
185: RAISE fnd_api.g_exc_unexpected_error;
186: END IF;
179:
180: IF l_task_type_id IS NULL THEN
181: x_return_status := fnd_api.g_ret_sts_unexp_error;
182: fnd_message.set_name('JTF', 'JTF_TASK_INVALID_TYPE_ID');
183: fnd_message.set_token('TASK_ID', p_task_type_id);
184: fnd_msg_pub.ADD;
185: RAISE fnd_api.g_exc_unexpected_error;
186: END IF;
187: ELSIF (l_task_template_id IS NULL) AND(l_task_id IS NULL) AND(l_task_type_id IS NULL) THEN
185: RAISE fnd_api.g_exc_unexpected_error;
186: END IF;
187: ELSIF (l_task_template_id IS NULL) AND(l_task_id IS NULL) AND(l_task_type_id IS NULL) THEN
188: x_return_status := fnd_api.g_ret_sts_unexp_error;
189: fnd_message.set_name('JTF', 'JTF_TASK_INV_INPUT');
190: fnd_msg_pub.ADD;
191: RAISE fnd_api.g_exc_unexpected_error;
192: ELSIF (l_task_template_id IS NOT NULL)
193: AND (l_task_id IS NOT NULL)
192: ELSIF (l_task_template_id IS NOT NULL)
193: AND (l_task_id IS NOT NULL)
194: AND (l_task_type_id IS NOT NULL) THEN
195: x_return_status := fnd_api.g_ret_sts_unexp_error;
196: fnd_message.set_name('JTF', 'JTF_TASK_INV_INPUT');
197: fnd_msg_pub.ADD;
198: RAISE fnd_api.g_exc_unexpected_error;
199: ELSIF (l_task_template_id IS NOT NULL) AND(l_task_id IS NOT NULL) THEN
200: x_return_status := fnd_api.g_ret_sts_unexp_error;
197: fnd_msg_pub.ADD;
198: RAISE fnd_api.g_exc_unexpected_error;
199: ELSIF (l_task_template_id IS NOT NULL) AND(l_task_id IS NOT NULL) THEN
200: x_return_status := fnd_api.g_ret_sts_unexp_error;
201: fnd_message.set_name('JTF', 'JTF_TASK_INV_INPUT');
202: fnd_msg_pub.ADD;
203: RAISE fnd_api.g_exc_unexpected_error;
204: ELSIF (l_task_id IS NOT NULL) AND(l_task_type_id IS NOT NULL) THEN
205: x_return_status := fnd_api.g_ret_sts_unexp_error;
202: fnd_msg_pub.ADD;
203: RAISE fnd_api.g_exc_unexpected_error;
204: ELSIF (l_task_id IS NOT NULL) AND(l_task_type_id IS NOT NULL) THEN
205: x_return_status := fnd_api.g_ret_sts_unexp_error;
206: fnd_message.set_name('JTF', 'JTF_TASK_INV_INPUT');
207: fnd_msg_pub.ADD;
208: RAISE fnd_api.g_exc_unexpected_error;
209: ELSIF (l_task_template_id IS NOT NULL) AND(l_task_type_id IS NOT NULL) THEN
210: x_return_status := fnd_api.g_ret_sts_unexp_error;
207: fnd_msg_pub.ADD;
208: RAISE fnd_api.g_exc_unexpected_error;
209: ELSIF (l_task_template_id IS NOT NULL) AND(l_task_type_id IS NOT NULL) THEN
210: x_return_status := fnd_api.g_ret_sts_unexp_error;
211: fnd_message.set_name('JTF', 'JTF_TASK_INV_INPUT');
212: fnd_msg_pub.ADD;
213: RAISE fnd_api.g_exc_unexpected_error;
214: END IF;
215:
213: RAISE fnd_api.g_exc_unexpected_error;
214: END IF;
215:
216: IF NOT jtf_task_resources_pvt.validate_resource_type_code(p_resource_type_code => l_resource_type_code) THEN
217: fnd_message.set_name('JTF', 'JTF_TASK_INV_RES_TYP_COD');
218: fnd_message.set_token('RESOURCE_CODE', p_resource_type_code);
219: --fnd_msg.add;
220: RAISE fnd_api.g_exc_error;
221: END IF;
214: END IF;
215:
216: IF NOT jtf_task_resources_pvt.validate_resource_type_code(p_resource_type_code => l_resource_type_code) THEN
217: fnd_message.set_name('JTF', 'JTF_TASK_INV_RES_TYP_COD');
218: fnd_message.set_token('RESOURCE_CODE', p_resource_type_code);
219: --fnd_msg.add;
220: RAISE fnd_api.g_exc_error;
221: END IF;
222:
220: RAISE fnd_api.g_exc_error;
221: END IF;
222:
223: IF (l_return_status = fnd_api.g_ret_sts_error) THEN
224: fnd_message.set_name('JTF', 'JTF_TASK_INV_RES_TYP_COD');
225: fnd_message.set_token('RESOURCE_CODE', p_resource_type_code);
226: --fnd_msg.add;
227: RAISE fnd_api.g_exc_error;
228: ELSIF(l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
221: END IF;
222:
223: IF (l_return_status = fnd_api.g_ret_sts_error) THEN
224: fnd_message.set_name('JTF', 'JTF_TASK_INV_RES_TYP_COD');
225: fnd_message.set_token('RESOURCE_CODE', p_resource_type_code);
226: --fnd_msg.add;
227: RAISE fnd_api.g_exc_error;
228: ELSIF(l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
229: fnd_message.set_name('JTF', 'JTF_TASK_INV_RES_TYP_COD');
225: fnd_message.set_token('RESOURCE_CODE', p_resource_type_code);
226: --fnd_msg.add;
227: RAISE fnd_api.g_exc_error;
228: ELSIF(l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
229: fnd_message.set_name('JTF', 'JTF_TASK_INV_RES_TYP_COD');
230: fnd_message.set_token('RESOURCE_CODE', p_resource_type_code);
231: --fnd_msg.add;
232: RAISE fnd_api.g_exc_unexpected_error;
233: END IF;
226: --fnd_msg.add;
227: RAISE fnd_api.g_exc_error;
228: ELSIF(l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
229: fnd_message.set_name('JTF', 'JTF_TASK_INV_RES_TYP_COD');
230: fnd_message.set_token('RESOURCE_CODE', p_resource_type_code);
231: --fnd_msg.add;
232: RAISE fnd_api.g_exc_unexpected_error;
233: END IF;
234:
401: END IF;
402:
403: -- check if the resource requirement is invalid or null.
404: IF (l_resource_req_id IS NULL) THEN
405: fnd_message.set_name('JTF', 'JTF_TASK_NULL_RES_REQ_ID');
406: fnd_msg_pub.ADD;
407: x_return_status := fnd_api.g_ret_sts_unexp_error;
408: RAISE fnd_api.g_exc_unexpected_error;
409: END IF;
413: FETCH jtf_rsrc_req_cur
414: INTO task_rsrc_req_rec;
415:
416: IF jtf_rsrc_req_cur%NOTFOUND THEN
417: fnd_message.set_name('JTF', 'JTF_TASK_INV_RES_REQ_ID');
418: fnd_message.set_token('RESOURCE_REQ_ID', p_resource_req_id);
419: fnd_msg_pub.ADD;
420: x_return_status := fnd_api.g_ret_sts_unexp_error;
421: RAISE fnd_api.g_exc_unexpected_error;
414: INTO task_rsrc_req_rec;
415:
416: IF jtf_rsrc_req_cur%NOTFOUND THEN
417: fnd_message.set_name('JTF', 'JTF_TASK_INV_RES_REQ_ID');
418: fnd_message.set_token('RESOURCE_REQ_ID', p_resource_req_id);
419: fnd_msg_pub.ADD;
420: x_return_status := fnd_api.g_ret_sts_unexp_error;
421: RAISE fnd_api.g_exc_unexpected_error;
422: END IF;
461: END IF;
462:
463: IF l_task_id IS NULL THEN
464: x_return_status := fnd_api.g_ret_sts_unexp_error;
465: fnd_message.set_name('JTF', 'JTF_TASK_INVALID_TASK_ID');
466: fnd_message.set_token('TASK_ID', p_task_id);
467: fnd_msg_pub.ADD;
468: RAISE fnd_api.g_exc_unexpected_error;
469: END IF;
462:
463: IF l_task_id IS NULL THEN
464: x_return_status := fnd_api.g_ret_sts_unexp_error;
465: fnd_message.set_name('JTF', 'JTF_TASK_INVALID_TASK_ID');
466: fnd_message.set_token('TASK_ID', p_task_id);
467: fnd_msg_pub.ADD;
468: RAISE fnd_api.g_exc_unexpected_error;
469: END IF;
470: ELSE
612: END IF;
613:
614: ---- if resource req is null, then it is an error
615: IF (l_resource_req_id IS NULL) THEN
616: fnd_message.set_name('JTF', 'JTF_TASK_DELETING_RES_REQ_ID');
617: fnd_message.set_token('RESOURCE_REQ_ID', p_resource_req_id);
618: fnd_msg_pub.ADD;
619: x_return_status := fnd_api.g_ret_sts_unexp_error;
620: RAISE fnd_api.g_exc_unexpected_error;
613:
614: ---- if resource req is null, then it is an error
615: IF (l_resource_req_id IS NULL) THEN
616: fnd_message.set_name('JTF', 'JTF_TASK_DELETING_RES_REQ_ID');
617: fnd_message.set_token('RESOURCE_REQ_ID', p_resource_req_id);
618: fnd_msg_pub.ADD;
619: x_return_status := fnd_api.g_ret_sts_unexp_error;
620: RAISE fnd_api.g_exc_unexpected_error;
621: END IF;
626: FETCH jtf_task_rsc_req_u_cur
627: INTO x;
628:
629: IF jtf_task_rsc_req_u_cur%NOTFOUND THEN
630: fnd_message.set_name('JTF', 'JTF_TASK_INV_RES_REQ_ID');
631: fnd_message.set_token('TASK_ID', p_resource_req_id);
632: fnd_msg_pub.ADD;
633: x_return_status := fnd_api.g_ret_sts_unexp_error;
634: RAISE fnd_api.g_exc_unexpected_error;
627: INTO x;
628:
629: IF jtf_task_rsc_req_u_cur%NOTFOUND THEN
630: fnd_message.set_name('JTF', 'JTF_TASK_INV_RES_REQ_ID');
631: fnd_message.set_token('TASK_ID', p_resource_req_id);
632: fnd_msg_pub.ADD;
633: x_return_status := fnd_api.g_ret_sts_unexp_error;
634: RAISE fnd_api.g_exc_unexpected_error;
635: ELSE
768: -- required parameters to control records returned
769:
770: -- p_query_or_next_code should be Q or N
771: IF (p_query_or_next_code NOT IN('Q', 'N')) OR(p_query_or_next_code IS NULL) THEN
772: fnd_message.set_name('JTF', 'JTF_TK_INV_QRY_NXT');
773: fnd_msg_pub.ADD;
774: RAISE fnd_api.g_exc_error;
775: END IF;
776:
775: END IF;
776:
777: -- p_show_all should be Y or N
778: IF (p_show_all NOT IN('Y', 'N')) OR(p_show_all IS NULL) THEN
779: fnd_message.set_name('JTF', 'JTF_TK_INV_SHOW_ALL');
780: fnd_msg_pub.ADD;
781: RAISE fnd_api.g_exc_error;
782: END IF;
783:
782: END IF;
783:
784: IF (p_show_all = 'N') THEN
785: IF (p_start_pointer IS NULL) THEN
786: fnd_message.set_name('JTF', 'JTF_TK_NULL_STRT_PTR');
787: fnd_msg_pub.ADD;
788: RAISE fnd_api.g_exc_error;
789: END IF;
790:
788: RAISE fnd_api.g_exc_error;
789: END IF;
790:
791: IF (p_rec_wanted IS NULL) THEN
792: fnd_message.set_name('JTF', 'JTF_TK_NULL_REC_WANT');
793: fnd_msg_pub.ADD;
794: RAISE fnd_api.g_exc_error;
795: END IF;
796: END IF;
876: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
877: EXCEPTION
878: WHEN resource_locked THEN
879: ROLLBACK TO lock_task_resources_pub;
880: fnd_message.set_name('JTF', 'JTF_TASK_RESOURCE_LOCKED');
881: fnd_message.set_token('P_LOCKED_RESOURCE', 'Resources');
882: x_return_status := fnd_api.g_ret_sts_unexp_error;
883: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
884: WHEN fnd_api.g_exc_unexpected_error THEN
877: EXCEPTION
878: WHEN resource_locked THEN
879: ROLLBACK TO lock_task_resources_pub;
880: fnd_message.set_name('JTF', 'JTF_TASK_RESOURCE_LOCKED');
881: fnd_message.set_token('P_LOCKED_RESOURCE', 'Resources');
882: x_return_status := fnd_api.g_ret_sts_unexp_error;
883: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
884: WHEN fnd_api.g_exc_unexpected_error THEN
885: ROLLBACK TO lock_task_resources_pub;
886: x_return_status := fnd_api.g_ret_sts_unexp_error;
887: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
888: WHEN OTHERS THEN
889: ROLLBACK TO lock_task_resources_pub;
890: fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
891: fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
892: x_return_status := fnd_api.g_ret_sts_unexp_error;
893: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
894: END;
887: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
888: WHEN OTHERS THEN
889: ROLLBACK TO lock_task_resources_pub;
890: fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
891: fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
892: x_return_status := fnd_api.g_ret_sts_unexp_error;
893: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
894: END;
895: END;