[Home] [Help]
PACKAGE BODY: APPS.JTF_TASKS_PUB
Source
1 PACKAGE BODY jtf_tasks_pub AS
2 /* $Header: jtfptktb.pls 120.15 2008/03/26 09:58:33 venjayar ship $ */
3 g_entity CONSTANT jtf_tasks_b.entity%TYPE := 'TASK';
4 g_free_busy_type CONSTANT jtf_task_all_assignments.free_busy_type%TYPE := 'FREE';
5
6 -- new version without table type parameters
7 -- Remove the fix of Bug 2152549
8 PROCEDURE create_task(
9 p_api_version IN NUMBER
10 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
11 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
12 , p_task_id IN NUMBER DEFAULT NULL
13 , p_task_name IN VARCHAR2
14 , p_task_type_name IN VARCHAR2 DEFAULT NULL
15 , p_task_type_id IN NUMBER DEFAULT NULL
16 , p_description IN VARCHAR2 DEFAULT NULL
17 , p_task_status_name IN VARCHAR2 DEFAULT NULL
18 , p_task_status_id IN NUMBER DEFAULT NULL
19 , p_task_priority_name IN VARCHAR2 DEFAULT NULL
20 , p_task_priority_id IN NUMBER DEFAULT NULL
21 , p_owner_type_name IN VARCHAR2 DEFAULT NULL
22 , p_owner_type_code IN VARCHAR2 DEFAULT NULL
23 , p_owner_id IN NUMBER DEFAULT NULL
24 , p_owner_territory_id IN NUMBER DEFAULT NULL
25 , p_assigned_by_name IN VARCHAR2 DEFAULT NULL
26 , p_assigned_by_id IN NUMBER DEFAULT NULL
27 , p_customer_number IN VARCHAR2 DEFAULT NULL
28 , p_customer_id IN NUMBER DEFAULT NULL
29 , p_cust_account_number IN VARCHAR2 DEFAULT NULL
30 , p_cust_account_id IN NUMBER DEFAULT NULL
31 , p_address_id IN NUMBER DEFAULT NULL
32 , p_address_number IN VARCHAR2 DEFAULT NULL
33 , p_planned_start_date IN DATE DEFAULT NULL
34 , p_planned_end_date IN DATE DEFAULT NULL
35 , p_scheduled_start_date IN DATE DEFAULT NULL
36 , p_scheduled_end_date IN DATE DEFAULT NULL
37 , p_actual_start_date IN DATE DEFAULT NULL
38 , p_actual_end_date IN DATE DEFAULT NULL
39 , p_timezone_id IN NUMBER DEFAULT NULL
40 , p_timezone_name IN VARCHAR2 DEFAULT NULL
41 , p_source_object_type_code IN VARCHAR2 DEFAULT NULL
42 , p_source_object_id IN NUMBER DEFAULT NULL
43 , p_source_object_name IN VARCHAR2 DEFAULT NULL
44 , p_duration IN NUMBER DEFAULT NULL
45 , p_duration_uom IN VARCHAR2 DEFAULT NULL
46 , p_planned_effort IN NUMBER DEFAULT NULL
47 , p_planned_effort_uom IN VARCHAR2 DEFAULT NULL
48 , p_actual_effort IN NUMBER DEFAULT NULL
49 , p_actual_effort_uom IN VARCHAR2 DEFAULT NULL
50 , p_percentage_complete IN NUMBER DEFAULT NULL
51 , p_reason_code IN VARCHAR2 DEFAULT NULL
52 , p_private_flag IN VARCHAR2 DEFAULT NULL
53 , p_publish_flag IN VARCHAR2 DEFAULT NULL
54 , p_restrict_closure_flag IN VARCHAR2 DEFAULT NULL
55 , p_multi_booked_flag IN VARCHAR2 DEFAULT NULL
56 , p_milestone_flag IN VARCHAR2 DEFAULT NULL
57 , p_holiday_flag IN VARCHAR2 DEFAULT NULL
58 , p_billable_flag IN VARCHAR2 DEFAULT NULL
59 , p_bound_mode_code IN VARCHAR2 DEFAULT NULL
60 , p_soft_bound_flag IN VARCHAR2 DEFAULT NULL
61 , p_workflow_process_id IN NUMBER DEFAULT NULL
62 , p_notification_flag IN VARCHAR2 DEFAULT NULL
63 , p_notification_period IN NUMBER DEFAULT NULL
64 , p_notification_period_uom IN VARCHAR2 DEFAULT NULL
65 , p_parent_task_number IN VARCHAR2 DEFAULT NULL
66 , p_parent_task_id IN NUMBER DEFAULT NULL
67 , p_alarm_start IN NUMBER DEFAULT NULL
68 , p_alarm_start_uom IN VARCHAR2 DEFAULT NULL
69 , p_alarm_on IN VARCHAR2 DEFAULT NULL
70 , p_alarm_count IN NUMBER DEFAULT NULL
71 , p_alarm_interval IN NUMBER DEFAULT NULL
72 , p_alarm_interval_uom IN VARCHAR2 DEFAULT NULL
73 , p_palm_flag IN VARCHAR2 DEFAULT NULL
74 , p_wince_flag IN VARCHAR2 DEFAULT NULL
75 , p_laptop_flag IN VARCHAR2 DEFAULT NULL
76 , p_device1_flag IN VARCHAR2 DEFAULT NULL
77 , p_device2_flag IN VARCHAR2 DEFAULT NULL
78 , p_device3_flag IN VARCHAR2 DEFAULT NULL
79 , p_costs IN NUMBER DEFAULT NULL
80 , p_currency_code IN VARCHAR2 DEFAULT NULL
81 , p_escalation_level IN VARCHAR2 DEFAULT NULL
82 , x_return_status OUT NOCOPY VARCHAR2
83 , x_msg_count OUT NOCOPY NUMBER
84 , x_msg_data OUT NOCOPY VARCHAR2
85 , x_task_id OUT NOCOPY NUMBER
86 , p_attribute1 IN VARCHAR2 DEFAULT NULL
87 , p_attribute2 IN VARCHAR2 DEFAULT NULL
88 , p_attribute3 IN VARCHAR2 DEFAULT NULL
89 , p_attribute4 IN VARCHAR2 DEFAULT NULL
90 , p_attribute5 IN VARCHAR2 DEFAULT NULL
91 , p_attribute6 IN VARCHAR2 DEFAULT NULL
92 , p_attribute7 IN VARCHAR2 DEFAULT NULL
93 , p_attribute8 IN VARCHAR2 DEFAULT NULL
94 , p_attribute9 IN VARCHAR2 DEFAULT NULL
95 , p_attribute10 IN VARCHAR2 DEFAULT NULL
96 , p_attribute11 IN VARCHAR2 DEFAULT NULL
97 , p_attribute12 IN VARCHAR2 DEFAULT NULL
98 , p_attribute13 IN VARCHAR2 DEFAULT NULL
99 , p_attribute14 IN VARCHAR2 DEFAULT NULL
100 , p_attribute15 IN VARCHAR2 DEFAULT NULL
101 , p_attribute_category IN VARCHAR2 DEFAULT NULL
102 , p_date_selected IN VARCHAR2 DEFAULT NULL
103 , p_category_id IN NUMBER DEFAULT NULL
104 , p_show_on_calendar IN VARCHAR2 DEFAULT NULL
105 , p_owner_status_id IN NUMBER DEFAULT NULL
106 , p_template_id IN NUMBER DEFAULT NULL
107 , p_template_group_id IN NUMBER DEFAULT NULL
108 , p_enable_workflow IN VARCHAR2
109 , p_abort_workflow IN VARCHAR2
110 ) IS
111 l_api_version CONSTANT NUMBER := 1.0;
112 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_TASK';
113 BEGIN
114 SAVEPOINT create_task_pub2;
115 x_return_status := fnd_api.g_ret_sts_success;
116
117 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
118 RAISE fnd_api.g_exc_unexpected_error;
119 END IF;
120
121 IF fnd_api.to_boolean(p_init_msg_list) THEN
122 fnd_msg_pub.initialize;
123 END IF;
124
125 -- call new version, passing defaults for new functionality
126 -- Remove the fix of Bug 2152549: call create_task_b which is non-overloading procedure
127 create_task(
128 p_api_version => p_api_version
129 , p_init_msg_list => p_init_msg_list
130 , p_commit => fnd_api.g_false
131 , p_task_id => p_task_id
132 , p_task_name => p_task_name
133 , p_task_type_name => p_task_type_name
134 , p_task_type_id => p_task_type_id
135 , p_description => p_description
136 , p_task_status_name => p_task_status_name
137 , p_task_status_id => p_task_status_id
138 , p_task_priority_name => p_task_priority_name
139 , p_task_priority_id => p_task_priority_id
140 , p_owner_type_name => p_owner_type_name
141 , p_owner_type_code => p_owner_type_code
142 , p_owner_id => p_owner_id
143 , p_owner_territory_id => p_owner_territory_id
144 , p_assigned_by_name => p_assigned_by_name
145 , p_assigned_by_id => p_assigned_by_id
146 , p_customer_number => p_customer_number
147 , p_customer_id => p_customer_id
148 , p_cust_account_number => p_cust_account_number
149 , p_cust_account_id => p_cust_account_id
150 , p_address_id => p_address_id
151 , p_address_number => p_address_number
152 , p_planned_start_date => p_planned_start_date
153 , p_planned_end_date => p_planned_end_date
154 , p_scheduled_start_date => p_scheduled_start_date
155 , p_scheduled_end_date => p_scheduled_end_date
156 , p_actual_start_date => p_actual_start_date
157 , p_actual_end_date => p_actual_end_date
158 , p_timezone_id => p_timezone_id
159 , p_timezone_name => p_timezone_name
160 , p_source_object_type_code => p_source_object_type_code
161 , p_source_object_id => p_source_object_id
162 , p_source_object_name => p_source_object_name
163 , p_duration => p_duration
164 , p_duration_uom => p_duration_uom
165 , p_planned_effort => p_planned_effort
166 , p_planned_effort_uom => p_planned_effort_uom
167 , p_actual_effort => p_actual_effort
168 , p_actual_effort_uom => p_actual_effort_uom
169 , p_percentage_complete => p_percentage_complete
170 , p_reason_code => p_reason_code
171 , p_private_flag => p_private_flag
172 , p_publish_flag => p_publish_flag
173 , p_restrict_closure_flag => p_restrict_closure_flag
174 , p_multi_booked_flag => p_multi_booked_flag
175 , p_milestone_flag => p_milestone_flag
176 , p_holiday_flag => p_holiday_flag
177 , p_billable_flag => p_billable_flag
178 , p_bound_mode_code => p_bound_mode_code
179 , p_soft_bound_flag => p_soft_bound_flag
180 , p_workflow_process_id => p_workflow_process_id
181 , p_notification_flag => p_notification_flag
182 , p_notification_period => p_notification_period
183 , p_notification_period_uom => p_notification_period_uom
184 , p_parent_task_number => p_parent_task_number
185 , p_parent_task_id => p_parent_task_id
186 , p_alarm_start => p_alarm_start
187 , p_alarm_start_uom => p_alarm_start_uom
188 , p_alarm_on => p_alarm_on
189 , p_alarm_count => p_alarm_count
190 , p_alarm_interval => p_alarm_interval
191 , p_alarm_interval_uom => p_alarm_interval_uom
192 , p_palm_flag => p_palm_flag
193 , p_wince_flag => p_wince_flag
194 , p_laptop_flag => p_laptop_flag
195 , p_device1_flag => p_device1_flag
196 , p_device2_flag => p_device2_flag
197 , p_device3_flag => p_device3_flag
198 , p_costs => p_costs
199 , p_currency_code => p_currency_code
200 , p_escalation_level => p_escalation_level
201 , x_return_status => x_return_status
202 , x_msg_count => x_msg_count
203 , x_msg_data => x_msg_data
204 , x_task_id => x_task_id
205 , p_attribute1 => p_attribute1
206 , p_attribute2 => p_attribute2
207 , p_attribute3 => p_attribute3
208 , p_attribute4 => p_attribute4
209 , p_attribute5 => p_attribute5
210 , p_attribute6 => p_attribute6
211 , p_attribute7 => p_attribute7
212 , p_attribute8 => p_attribute8
216 , p_attribute12 => p_attribute12
213 , p_attribute9 => p_attribute9
214 , p_attribute10 => p_attribute10
215 , p_attribute11 => p_attribute11
217 , p_attribute13 => p_attribute13
218 , p_attribute14 => p_attribute14
219 , p_attribute15 => p_attribute15
220 , p_attribute_category => p_attribute_category
221 , p_date_selected => p_date_selected
222 , p_category_id => p_category_id
223 , p_show_on_calendar => p_show_on_calendar
224 , p_owner_status_id => p_owner_status_id
225 , p_template_id => p_template_id
226 , p_template_group_id => p_template_group_id
227 , p_enable_workflow => p_enable_workflow
228 , p_abort_workflow => p_abort_workflow
229 , p_task_split_flag => NULL
230 , p_child_position => NULL
231 , p_child_sequence_num => NULL
232 );
233
234 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
235 x_return_status := fnd_api.g_ret_sts_unexp_error;
236 RAISE fnd_api.g_exc_unexpected_error;
237 END IF;
238
239 IF fnd_api.to_boolean(p_commit) THEN
240 COMMIT WORK;
241 END IF;
242
243 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
244 EXCEPTION
245 WHEN fnd_api.g_exc_unexpected_error THEN
246 ROLLBACK TO create_task_pub2;
247 x_return_status := fnd_api.g_ret_sts_unexp_error;
248 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
249 WHEN OTHERS THEN
250 ROLLBACK TO create_task_pub2;
251 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
252 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
253 fnd_msg_pub.ADD;
254 x_return_status := fnd_api.g_ret_sts_unexp_error;
255 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
256 END;
257
258 -- Overloaded Version for the Simplex Fix.
259 -- new version without table type parameters
260 -- Remove the fix of Bug 2152549
261 PROCEDURE create_task(
262 p_api_version IN NUMBER
263 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
264 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
265 , p_task_id IN NUMBER DEFAULT NULL
266 , p_task_name IN VARCHAR2
267 , p_task_type_name IN VARCHAR2 DEFAULT NULL
268 , p_task_type_id IN NUMBER DEFAULT NULL
269 , p_description IN VARCHAR2 DEFAULT NULL
270 , p_task_status_name IN VARCHAR2 DEFAULT NULL
271 , p_task_status_id IN NUMBER DEFAULT NULL
272 , p_task_priority_name IN VARCHAR2 DEFAULT NULL
273 , p_task_priority_id IN NUMBER DEFAULT NULL
274 , p_owner_type_name IN VARCHAR2 DEFAULT NULL
275 , p_owner_type_code IN VARCHAR2 DEFAULT NULL
276 , p_owner_id IN NUMBER DEFAULT NULL
277 , p_owner_territory_id IN NUMBER DEFAULT NULL
278 , p_assigned_by_name IN VARCHAR2 DEFAULT NULL
279 , p_assigned_by_id IN NUMBER DEFAULT NULL
280 , p_customer_number IN VARCHAR2 DEFAULT NULL
281 , p_customer_id IN NUMBER DEFAULT NULL
282 , p_cust_account_number IN VARCHAR2 DEFAULT NULL
283 , p_cust_account_id IN NUMBER DEFAULT NULL
284 , p_address_id IN NUMBER DEFAULT NULL
285 , p_address_number IN VARCHAR2 DEFAULT NULL
286 , p_planned_start_date IN DATE DEFAULT NULL
287 , p_planned_end_date IN DATE DEFAULT NULL
288 , p_scheduled_start_date IN DATE DEFAULT NULL
289 , p_scheduled_end_date IN DATE DEFAULT NULL
290 , p_actual_start_date IN DATE DEFAULT NULL
291 , p_actual_end_date IN DATE DEFAULT NULL
292 , p_timezone_id IN NUMBER DEFAULT NULL
293 , p_timezone_name IN VARCHAR2 DEFAULT NULL
294 , p_source_object_type_code IN VARCHAR2 DEFAULT NULL
295 , p_source_object_id IN NUMBER DEFAULT NULL
296 , p_source_object_name IN VARCHAR2 DEFAULT NULL
297 , p_duration IN NUMBER DEFAULT NULL
298 , p_duration_uom IN VARCHAR2 DEFAULT NULL
299 , p_planned_effort IN NUMBER DEFAULT NULL
300 , p_planned_effort_uom IN VARCHAR2 DEFAULT NULL
301 , p_actual_effort IN NUMBER DEFAULT NULL
302 , p_actual_effort_uom IN VARCHAR2 DEFAULT NULL
303 , p_percentage_complete IN NUMBER DEFAULT NULL
304 , p_reason_code IN VARCHAR2 DEFAULT NULL
305 , p_private_flag IN VARCHAR2 DEFAULT NULL
306 , p_publish_flag IN VARCHAR2 DEFAULT NULL
307 , p_restrict_closure_flag IN VARCHAR2 DEFAULT NULL
308 , p_multi_booked_flag IN VARCHAR2 DEFAULT NULL
309 , p_milestone_flag IN VARCHAR2 DEFAULT NULL
310 , p_holiday_flag IN VARCHAR2 DEFAULT NULL
311 , p_billable_flag IN VARCHAR2 DEFAULT NULL
312 , p_bound_mode_code IN VARCHAR2 DEFAULT NULL
316 , p_notification_period IN NUMBER DEFAULT NULL
313 , p_soft_bound_flag IN VARCHAR2 DEFAULT NULL
314 , p_workflow_process_id IN NUMBER DEFAULT NULL
315 , p_notification_flag IN VARCHAR2 DEFAULT NULL
317 , p_notification_period_uom IN VARCHAR2 DEFAULT NULL
318 , p_parent_task_number IN VARCHAR2 DEFAULT NULL
319 , p_parent_task_id IN NUMBER DEFAULT NULL
320 , p_alarm_start IN NUMBER DEFAULT NULL
321 , p_alarm_start_uom IN VARCHAR2 DEFAULT NULL
322 , p_alarm_on IN VARCHAR2 DEFAULT NULL
323 , p_alarm_count IN NUMBER DEFAULT NULL
324 , p_alarm_interval IN NUMBER DEFAULT NULL
325 , p_alarm_interval_uom IN VARCHAR2 DEFAULT NULL
326 , p_palm_flag IN VARCHAR2 DEFAULT NULL
327 , p_wince_flag IN VARCHAR2 DEFAULT NULL
328 , p_laptop_flag IN VARCHAR2 DEFAULT NULL
329 , p_device1_flag IN VARCHAR2 DEFAULT NULL
330 , p_device2_flag IN VARCHAR2 DEFAULT NULL
331 , p_device3_flag IN VARCHAR2 DEFAULT NULL
332 , p_costs IN NUMBER DEFAULT NULL
333 , p_currency_code IN VARCHAR2 DEFAULT NULL
334 , p_escalation_level IN VARCHAR2 DEFAULT NULL
335 , x_return_status OUT NOCOPY VARCHAR2
336 , x_msg_count OUT NOCOPY NUMBER
337 , x_msg_data OUT NOCOPY VARCHAR2
338 , x_task_id OUT NOCOPY NUMBER
339 , p_attribute1 IN VARCHAR2 DEFAULT NULL
340 , p_attribute2 IN VARCHAR2 DEFAULT NULL
341 , p_attribute3 IN VARCHAR2 DEFAULT NULL
342 , p_attribute4 IN VARCHAR2 DEFAULT NULL
343 , p_attribute5 IN VARCHAR2 DEFAULT NULL
344 , p_attribute6 IN VARCHAR2 DEFAULT NULL
345 , p_attribute7 IN VARCHAR2 DEFAULT NULL
346 , p_attribute8 IN VARCHAR2 DEFAULT NULL
347 , p_attribute9 IN VARCHAR2 DEFAULT NULL
348 , p_attribute10 IN VARCHAR2 DEFAULT NULL
349 , p_attribute11 IN VARCHAR2 DEFAULT NULL
350 , p_attribute12 IN VARCHAR2 DEFAULT NULL
351 , p_attribute13 IN VARCHAR2 DEFAULT NULL
352 , p_attribute14 IN VARCHAR2 DEFAULT NULL
353 , p_attribute15 IN VARCHAR2 DEFAULT NULL
354 , p_attribute_category IN VARCHAR2 DEFAULT NULL
355 , p_date_selected IN VARCHAR2 DEFAULT NULL
356 , p_category_id IN NUMBER DEFAULT NULL
357 , p_show_on_calendar IN VARCHAR2 DEFAULT NULL
358 , p_owner_status_id IN NUMBER DEFAULT NULL
359 , p_template_id IN NUMBER DEFAULT NULL
360 , p_template_group_id IN NUMBER DEFAULT NULL
361 , p_enable_workflow IN VARCHAR2
362 , p_abort_workflow IN VARCHAR2
363 , p_task_split_flag IN VARCHAR2
364 , p_reference_flag IN VARCHAR2 DEFAULT NULL
365 , p_child_position IN VARCHAR2 DEFAULT NULL
366 , p_child_sequence_num IN NUMBER DEFAULT NULL
367 ) IS
368 l_api_version CONSTANT NUMBER := 1.0;
369 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_TASK';
370 BEGIN
371 SAVEPOINT create_task_pub1;
372 x_return_status := fnd_api.g_ret_sts_success;
373
374 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
375 RAISE fnd_api.g_exc_unexpected_error;
376 END IF;
377
378 IF fnd_api.to_boolean(p_init_msg_list) THEN
379 fnd_msg_pub.initialize;
380 END IF;
381
382 -- call new version, passing defaults for new functionality
383 create_task(
384 p_api_version => p_api_version
385 , p_init_msg_list => p_init_msg_list
386 , p_commit => fnd_api.g_false
387 , p_task_id => p_task_id
388 , p_task_name => p_task_name
389 , p_task_type_name => p_task_type_name
390 , p_task_type_id => p_task_type_id
391 , p_description => p_description
392 , p_task_status_name => p_task_status_name
393 , p_task_status_id => p_task_status_id
394 , p_task_priority_name => p_task_priority_name
395 , p_task_priority_id => p_task_priority_id
396 , p_owner_type_name => p_owner_type_name
397 , p_owner_type_code => p_owner_type_code
398 , p_owner_id => p_owner_id
399 , p_owner_territory_id => p_owner_territory_id
400 , p_assigned_by_name => p_assigned_by_name
401 , p_assigned_by_id => p_assigned_by_id
402 , p_customer_number => p_customer_number
403 , p_customer_id => p_customer_id
404 , p_cust_account_number => p_cust_account_number
405 , p_cust_account_id => p_cust_account_id
406 , p_address_id => p_address_id
407 , p_address_number => p_address_number
408 , p_planned_start_date => p_planned_start_date
412 , p_actual_start_date => p_actual_start_date
409 , p_planned_end_date => p_planned_end_date
410 , p_scheduled_start_date => p_scheduled_start_date
411 , p_scheduled_end_date => p_scheduled_end_date
413 , p_actual_end_date => p_actual_end_date
414 , p_timezone_id => p_timezone_id
415 , p_timezone_name => p_timezone_name
416 , p_source_object_type_code => p_source_object_type_code
417 , p_source_object_id => p_source_object_id
418 , p_source_object_name => p_source_object_name
419 , p_duration => p_duration
420 , p_duration_uom => p_duration_uom
421 , p_planned_effort => p_planned_effort
422 , p_planned_effort_uom => p_planned_effort_uom
423 , p_actual_effort => p_actual_effort
424 , p_actual_effort_uom => p_actual_effort_uom
425 , p_percentage_complete => p_percentage_complete
426 , p_reason_code => p_reason_code
427 , p_private_flag => p_private_flag
428 , p_publish_flag => p_publish_flag
429 , p_restrict_closure_flag => p_restrict_closure_flag
430 , p_multi_booked_flag => p_multi_booked_flag
431 , p_milestone_flag => p_milestone_flag
432 , p_holiday_flag => p_holiday_flag
433 , p_billable_flag => p_billable_flag
434 , p_bound_mode_code => p_bound_mode_code
435 , p_soft_bound_flag => p_soft_bound_flag
436 , p_workflow_process_id => p_workflow_process_id
437 , p_notification_flag => p_notification_flag
438 , p_notification_period => p_notification_period
439 , p_notification_period_uom => p_notification_period_uom
440 , p_parent_task_number => p_parent_task_number
441 , p_parent_task_id => p_parent_task_id
442 , p_alarm_start => p_alarm_start
443 , p_alarm_start_uom => p_alarm_start_uom
444 , p_alarm_on => p_alarm_on
445 , p_alarm_count => p_alarm_count
446 , p_alarm_interval => p_alarm_interval
447 , p_alarm_interval_uom => p_alarm_interval_uom
448 , p_palm_flag => p_palm_flag
449 , p_wince_flag => p_wince_flag
450 , p_laptop_flag => p_laptop_flag
451 , p_device1_flag => p_device1_flag
452 , p_device2_flag => p_device2_flag
453 , p_device3_flag => p_device3_flag
454 , p_costs => p_costs
455 , p_currency_code => p_currency_code
456 , p_escalation_level => p_escalation_level
457 , p_task_assign_tbl => g_miss_task_assign_tbl
458 , p_task_depends_tbl => g_miss_task_depends_tbl
459 , p_task_rsrc_req_tbl => g_miss_task_rsrc_req_tbl
460 , p_task_refer_tbl => g_miss_task_refer_tbl
461 , p_task_dates_tbl => g_miss_task_dates_tbl
462 , p_task_notes_tbl => g_miss_task_notes_tbl
463 , p_task_recur_rec => g_miss_task_recur_rec
464 , p_task_contacts_tbl => g_miss_task_contacts_tbl
465 , x_return_status => x_return_status
466 , x_msg_count => x_msg_count
467 , x_msg_data => x_msg_data
468 , x_task_id => x_task_id
469 , p_attribute1 => p_attribute1
470 , p_attribute2 => p_attribute2
471 , p_attribute3 => p_attribute3
472 , p_attribute4 => p_attribute4
473 , p_attribute5 => p_attribute5
474 , p_attribute6 => p_attribute6
475 , p_attribute7 => p_attribute7
476 , p_attribute8 => p_attribute8
477 , p_attribute9 => p_attribute9
478 , p_attribute10 => p_attribute10
479 , p_attribute11 => p_attribute11
480 , p_attribute12 => p_attribute12
481 , p_attribute13 => p_attribute13
482 , p_attribute14 => p_attribute14
483 , p_attribute15 => p_attribute15
484 , p_attribute_category => p_attribute_category
485 , p_date_selected => p_date_selected
486 , p_category_id => p_category_id
487 , p_show_on_calendar => p_show_on_calendar
488 , p_owner_status_id => p_owner_status_id
489 , p_template_id => p_template_id
490 , p_template_group_id => p_template_group_id
491 , p_enable_workflow => p_enable_workflow
492 , p_abort_workflow => p_abort_workflow
493 , p_task_split_flag => p_task_split_flag
494 , p_reference_flag => p_reference_flag
495 , p_child_position => p_child_position
496 , p_child_sequence_num => p_child_sequence_num
497 , p_location_id => NULL
498 );
499
500 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
501 x_return_status := fnd_api.g_ret_sts_unexp_error;
502 RAISE fnd_api.g_exc_unexpected_error;
503 END IF;
504
505 IF fnd_api.to_boolean(p_commit) THEN
506 COMMIT WORK;
507 END IF;
508
509 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
510 EXCEPTION
514 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
511 WHEN fnd_api.g_exc_unexpected_error THEN
512 ROLLBACK TO create_task_pub1;
513 x_return_status := fnd_api.g_ret_sts_unexp_error;
515 WHEN OTHERS THEN
516 ROLLBACK TO create_task_pub1;
517 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
518 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
519 fnd_msg_pub.ADD;
520 x_return_status := fnd_api.g_ret_sts_unexp_error;
521 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
522 END;
523
524 -- Overloaded Version for Location Id Enh# 3691788.
525 PROCEDURE create_task(
526 p_api_version IN NUMBER
527 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
528 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
529 , p_task_id IN NUMBER DEFAULT NULL
530 , p_task_name IN VARCHAR2
531 , p_task_type_name IN VARCHAR2 DEFAULT NULL
532 , p_task_type_id IN NUMBER DEFAULT NULL
533 , p_description IN VARCHAR2 DEFAULT NULL
534 , p_task_status_name IN VARCHAR2 DEFAULT NULL
535 , p_task_status_id IN NUMBER DEFAULT NULL
536 , p_task_priority_name IN VARCHAR2 DEFAULT NULL
537 , p_task_priority_id IN NUMBER DEFAULT NULL
538 , p_owner_type_name IN VARCHAR2 DEFAULT NULL
539 , p_owner_type_code IN VARCHAR2 DEFAULT NULL
540 , p_owner_id IN NUMBER DEFAULT NULL
541 , p_owner_territory_id IN NUMBER DEFAULT NULL
542 , p_assigned_by_name IN VARCHAR2 DEFAULT NULL
543 , p_assigned_by_id IN NUMBER DEFAULT NULL
544 , p_customer_number IN VARCHAR2 DEFAULT NULL
545 , p_customer_id IN NUMBER DEFAULT NULL
546 , p_cust_account_number IN VARCHAR2 DEFAULT NULL
547 , p_cust_account_id IN NUMBER DEFAULT NULL
548 , p_address_id IN NUMBER DEFAULT NULL
549 , p_address_number IN VARCHAR2 DEFAULT NULL
550 , p_planned_start_date IN DATE DEFAULT NULL
551 , p_planned_end_date IN DATE DEFAULT NULL
552 , p_scheduled_start_date IN DATE DEFAULT NULL
553 , p_scheduled_end_date IN DATE DEFAULT NULL
554 , p_actual_start_date IN DATE DEFAULT NULL
555 , p_actual_end_date IN DATE DEFAULT NULL
556 , p_timezone_id IN NUMBER DEFAULT NULL
557 , p_timezone_name IN VARCHAR2 DEFAULT NULL
558 , p_source_object_type_code IN VARCHAR2 DEFAULT NULL
559 , p_source_object_id IN NUMBER DEFAULT NULL
560 , p_source_object_name IN VARCHAR2 DEFAULT NULL
561 , p_duration IN NUMBER DEFAULT NULL
562 , p_duration_uom IN VARCHAR2 DEFAULT NULL
563 , p_planned_effort IN NUMBER DEFAULT NULL
564 , p_planned_effort_uom IN VARCHAR2 DEFAULT NULL
565 , p_actual_effort IN NUMBER DEFAULT NULL
566 , p_actual_effort_uom IN VARCHAR2 DEFAULT NULL
567 , p_percentage_complete IN NUMBER DEFAULT NULL
568 , p_reason_code IN VARCHAR2 DEFAULT NULL
569 , p_private_flag IN VARCHAR2 DEFAULT NULL
570 , p_publish_flag IN VARCHAR2 DEFAULT NULL
571 , p_restrict_closure_flag IN VARCHAR2 DEFAULT NULL
572 , p_multi_booked_flag IN VARCHAR2 DEFAULT NULL
573 , p_milestone_flag IN VARCHAR2 DEFAULT NULL
574 , p_holiday_flag IN VARCHAR2 DEFAULT NULL
575 , p_billable_flag IN VARCHAR2 DEFAULT NULL
576 , p_bound_mode_code IN VARCHAR2 DEFAULT NULL
577 , p_soft_bound_flag IN VARCHAR2 DEFAULT NULL
578 , p_workflow_process_id IN NUMBER DEFAULT NULL
579 , p_notification_flag IN VARCHAR2 DEFAULT NULL
580 , p_notification_period IN NUMBER DEFAULT NULL
581 , p_notification_period_uom IN VARCHAR2 DEFAULT NULL
582 , p_parent_task_number IN VARCHAR2 DEFAULT NULL
583 , p_parent_task_id IN NUMBER DEFAULT NULL
584 , p_alarm_start IN NUMBER DEFAULT NULL
585 , p_alarm_start_uom IN VARCHAR2 DEFAULT NULL
586 , p_alarm_on IN VARCHAR2 DEFAULT NULL
587 , p_alarm_count IN NUMBER DEFAULT NULL
588 , p_alarm_interval IN NUMBER DEFAULT NULL
589 , p_alarm_interval_uom IN VARCHAR2 DEFAULT NULL
590 , p_palm_flag IN VARCHAR2 DEFAULT NULL
591 , p_wince_flag IN VARCHAR2 DEFAULT NULL
592 , p_laptop_flag IN VARCHAR2 DEFAULT NULL
593 , p_device1_flag IN VARCHAR2 DEFAULT NULL
594 , p_device2_flag IN VARCHAR2 DEFAULT NULL
595 , p_device3_flag IN VARCHAR2 DEFAULT NULL
596 , p_costs IN NUMBER DEFAULT NULL
600 , p_task_depends_tbl IN task_depends_tbl DEFAULT g_miss_task_depends_tbl
597 , p_currency_code IN VARCHAR2 DEFAULT NULL
598 , p_escalation_level IN VARCHAR2 DEFAULT NULL
599 , p_task_assign_tbl IN task_assign_tbl DEFAULT g_miss_task_assign_tbl
601 , p_task_rsrc_req_tbl IN task_rsrc_req_tbl DEFAULT g_miss_task_rsrc_req_tbl
602 , p_task_refer_tbl IN task_refer_tbl DEFAULT g_miss_task_refer_tbl
603 , p_task_dates_tbl IN task_dates_tbl DEFAULT g_miss_task_dates_tbl
604 , p_task_notes_tbl IN task_notes_tbl DEFAULT g_miss_task_notes_tbl
605 , p_task_recur_rec IN task_recur_rec DEFAULT g_miss_task_recur_rec
606 , p_task_contacts_tbl IN task_contacts_tbl DEFAULT g_miss_task_contacts_tbl
607 , x_return_status OUT NOCOPY VARCHAR2
608 , x_msg_count OUT NOCOPY NUMBER
609 , x_msg_data OUT NOCOPY VARCHAR2
610 , x_task_id OUT NOCOPY NUMBER
611 , p_attribute1 IN VARCHAR2 DEFAULT NULL
612 , p_attribute2 IN VARCHAR2 DEFAULT NULL
613 , p_attribute3 IN VARCHAR2 DEFAULT NULL
614 , p_attribute4 IN VARCHAR2 DEFAULT NULL
615 , p_attribute5 IN VARCHAR2 DEFAULT NULL
616 , p_attribute6 IN VARCHAR2 DEFAULT NULL
617 , p_attribute7 IN VARCHAR2 DEFAULT NULL
618 , p_attribute8 IN VARCHAR2 DEFAULT NULL
619 , p_attribute9 IN VARCHAR2 DEFAULT NULL
620 , p_attribute10 IN VARCHAR2 DEFAULT NULL
621 , p_attribute11 IN VARCHAR2 DEFAULT NULL
622 , p_attribute12 IN VARCHAR2 DEFAULT NULL
623 , p_attribute13 IN VARCHAR2 DEFAULT NULL
624 , p_attribute14 IN VARCHAR2 DEFAULT NULL
625 , p_attribute15 IN VARCHAR2 DEFAULT NULL
626 , p_attribute_category IN VARCHAR2 DEFAULT NULL
627 , p_date_selected IN VARCHAR2 DEFAULT NULL
628 , p_category_id IN NUMBER DEFAULT NULL
629 , p_show_on_calendar IN VARCHAR2 DEFAULT NULL
630 , p_owner_status_id IN NUMBER DEFAULT NULL
631 , p_template_id IN NUMBER DEFAULT NULL
632 , p_template_group_id IN NUMBER DEFAULT NULL
633 , p_enable_workflow IN VARCHAR2 DEFAULT fnd_profile.VALUE('JTF_TASK_ENABLE_WORKFLOW')
634 , p_abort_workflow IN VARCHAR2 DEFAULT fnd_profile.VALUE('JTF_TASK_ABORT_PREV_WF')
635 , p_task_split_flag IN VARCHAR2 DEFAULT NULL
636 , p_reference_flag IN VARCHAR2 DEFAULT NULL
637 , p_child_position IN VARCHAR2 DEFAULT NULL
638 , p_child_sequence_num IN NUMBER DEFAULT NULL
639 , p_location_id IN NUMBER
640 ) IS
641 l_api_version CONSTANT NUMBER := 1.0;
642 l_api_name CONSTANT VARCHAR2(30) := 'VALIDATE_TASK';
643 l_task_number jtf_tasks_b.task_number%TYPE;
644 /* Modified by TSINGHAL dt 8/10/2003 for bug fix 3182170 start */
645 l_task_name jtf_tasks_tl.task_name%TYPE;
646 /* Modified by TSINGHAL dt 8/10/2003 for bug fix 3182170 End */
647 l_task_type_id jtf_tasks_b.task_type_id%TYPE := p_task_type_id;
648 l_task_priority_id jtf_tasks_b.task_priority_id%TYPE := p_task_priority_id;
649 l_task_status_id jtf_tasks_b.task_status_id%TYPE := p_task_status_id;
650 l_owner_type_name jtf_objects_tl.NAME%TYPE := p_owner_type_name;
651 l_owner_type_code jtf_objects_b.object_code%TYPE := p_owner_type_code;
652 l_owner_id jtf_tasks_b.owner_id%TYPE := p_owner_id;
653 l_timezone_id hz_timezones.timezone_id%TYPE := p_timezone_id;
654 l_timezone_name hz_timezones.global_timezone_name%TYPE := p_timezone_name;
655 l_planned_start_date DATE := p_planned_start_date;
656 l_planned_end_date DATE := p_planned_end_date;
657 l_actual_start_date DATE := p_actual_start_date;
658 l_actual_end_date DATE := p_actual_end_date;
659 l_scheduled_start_date DATE := p_scheduled_start_date;
660 l_scheduled_end_date DATE := p_scheduled_end_date;
661 l_assigned_by_name fnd_user.user_name%TYPE := p_assigned_by_name;
662 l_assigned_by_id NUMBER := p_assigned_by_id;
663 l_cust_account_number hz_cust_accounts.account_number%TYPE := p_cust_account_number;
664 l_cust_account_id hz_cust_accounts.cust_account_id%TYPE := p_cust_account_id;
665 l_customer_id hz_parties.party_id%TYPE := p_customer_id;
669 l_address_number hz_party_sites.party_site_number%TYPE := p_address_number;
666 l_customer_number hz_parties.party_number%TYPE := p_customer_number;
667 l_address_id hz_party_sites.party_site_id%TYPE := p_address_id;
668 l_location_id hz_locations.location_id%TYPE := p_location_id;
670 l_parent_task_id jtf_tasks_b.task_id%TYPE := p_parent_task_id;
671 l_parent_task_number jtf_tasks_b.task_number%TYPE := p_parent_task_number;
672 l_source_object_type_code jtf_tasks_b.source_object_type_code%TYPE := p_source_object_type_code;
673 l_source_object_id jtf_tasks_b.source_object_id%TYPE := p_source_object_id;
674 l_source_object_name jtf_tasks_b.source_object_name%TYPE
675 := jtf_task_utl.check_truncation(p_object_name => p_source_object_name);
676 x CHAR;
677 l_costs jtf_tasks_b.costs%TYPE := p_costs;
678 l_currency_code jtf_tasks_b.currency_code%TYPE := p_currency_code;
679 y BOOLEAN;
680 l_date_selected jtf_tasks_b.date_selected%TYPE;
681 l_owner_status_id jtf_task_all_assignments.assignment_status_id%TYPE;
682 l_type VARCHAR2(10);
683 l_msg_data VARCHAR2(2000); -- debug
684 l_task_id jtf_tasks_b.task_id%TYPE;
685 l_notes_id NUMBER;
686 l_dependency_id jtf_task_depends.dependency_id%TYPE;
687 l_recurrence_rule_id jtf_task_recur_rules.recurrence_rule_id%TYPE;
688 l_resource_req_id jtf_task_rsc_reqs.resource_req_id%TYPE;
689 l_task_rec jtf_task_recurrences_pub.task_details_rec;
690 l_reccurence_generated NUMBER;
691 /*** Start: Added a local variable to fix bug 2107464 ***/
692 l_task_contact_id jtf_task_contacts.task_contact_id%TYPE;
693 /*** End: Added a local variable to fix bug 2107464 ***/
694 l_task_date_id jtf_task_dates.task_date_id%TYPE;
695 l_task_assignment_id jtf_task_all_assignments.task_assignment_id%TYPE;
696 l_task_reference_id jtf_task_references_b.task_reference_id%TYPE;
697 current_record INTEGER;
698
699 CURSOR c_owner_status_id(b_owner_status_id jtf_task_all_assignments.assignment_status_id%TYPE) IS
700 SELECT task_status_id
701 FROM jtf_task_statuses_b
702 WHERE task_status_id = b_owner_status_id
703 --AND assigned_flag = 'Y'
704 AND assignment_status_flag = 'Y' -- Fix bug 2500664
705 AND NVL(end_date_active, SYSDATE) >= SYSDATE
706 AND NVL(start_date_active, SYSDATE) <= SYSDATE;
707 BEGIN
708 SAVEPOINT create_task_pub;
709 x_return_status := fnd_api.g_ret_sts_success;
710
711 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
712 RAISE fnd_api.g_exc_unexpected_error;
713 END IF;
714
715 IF fnd_api.to_boolean(p_init_msg_list) THEN
716 fnd_msg_pub.initialize;
717 END IF;
718
719 /* Modified by TSINGHAL bug fix Validate task name length 3182170 Start*/
720 l_task_name := check_param_length(p_task_name, 'JTF_TASK_NAME_INVALID_LENGTH', 80);
721 /* Modified by TSINGHAL bug fix 3182170 End*/
722
723 -------
724 ------- Validate Task Type
725 -------
726 jtf_task_utl.validate_task_type(
727 p_task_type_id => l_task_type_id
728 , p_task_type_name => p_task_type_name
729 , x_return_status => x_return_status
730 , x_task_type_id => l_task_type_id
731 );
732
733 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
734 x_return_status := fnd_api.g_ret_sts_unexp_error;
735 RAISE fnd_api.g_exc_unexpected_error;
736 END IF;
737
738 IF l_task_type_id IS NULL THEN
739 fnd_message.set_name('JTF', 'JTF_TASK_MISSING_TASK_TYPE');
740 fnd_msg_pub.ADD;
741 RAISE fnd_api.g_exc_unexpected_error;
742 END IF;
743
744 -------
745 ------- Validate Task Status
746 -------
747 IF l_task_type_id = '22' THEN
748 l_type := 'ESCALATION';
749 ELSE
750 l_type := 'TASK';
751 END IF;
752
753 jtf_task_utl.validate_task_status(
754 p_task_status_id => l_task_status_id
755 , p_task_status_name => p_task_status_name
756 , p_validation_type => l_type
757 , x_return_status => x_return_status
758 , x_task_status_id => l_task_status_id
759 );
760
761 IF l_task_status_id IS NULL THEN
762 fnd_message.set_name('JTF', 'JTF_TASK_MISSING_TASK_STATUS');
763 fnd_msg_pub.ADD;
764 RAISE fnd_api.g_exc_unexpected_error;
765 END IF;
766
767 -------
768 ------- Validate Task Priority
769 -------
770 jtf_task_utl.validate_task_priority(
771 p_task_priority_id => l_task_priority_id
772 , p_task_priority_name => p_task_priority_name
773 , x_return_status => x_return_status
774 , x_task_priority_id => l_task_priority_id
775 );
776 -------
777 ------- Validate Location Id
778 -------
782 , p_task_id => NULL
779 jtf_task_utl.validate_location_id(
780 p_location_id => l_location_id
781 , p_address_id => l_address_id
783 , x_return_status => x_return_status
784 );
785
786 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
787 x_return_status := fnd_api.g_ret_sts_unexp_error;
788 RAISE fnd_api.g_exc_unexpected_error;
789 END IF;
790
791 -------
792 ------- Validate Duration
793 -------
794 jtf_task_utl.validate_effort
795 (
796 p_tag => jtf_task_utl.get_translated_lookup
797 ('JTF_TASK_TRANSLATED_MESSAGES'
798 , 'DURATION')
799 , p_tag_uom => jtf_task_utl.get_translated_lookup
800 ('JTF_TASK_TRANSLATED_MESSAGES'
801 , 'DURATION_UOM')
802 , x_return_status => x_return_status
803 , p_effort => p_duration
804 , p_effort_uom => p_duration_uom
805 );
806
807 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
808 x_return_status := fnd_api.g_ret_sts_unexp_error;
809 RAISE fnd_api.g_exc_unexpected_error;
810 END IF;
811
812 -------
813 ------- Validate Planned Effort
814 -------
815 jtf_task_utl.validate_effort(
816 p_tag => jtf_task_utl.get_translated_lookup('JTF_TASK_TRANSLATED_MESSAGES', 'PLANNED_EFFORT')
817 , p_tag_uom => jtf_task_utl.get_translated_lookup('JTF_TASK_TRANSLATED_MESSAGES', 'PLANNED_EFFORT_UOM')
818 , x_return_status => x_return_status
819 , p_effort => p_planned_effort
820 , p_effort_uom => p_planned_effort_uom
821 );
822
823 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
824 x_return_status := fnd_api.g_ret_sts_unexp_error;
825 RAISE fnd_api.g_exc_unexpected_error;
826 END IF;
827
828 -------
829 ------- Validate Actual Effort
830 -------
831 jtf_task_utl.validate_effort(
832 p_tag => jtf_task_utl.get_translated_lookup('JTF_TASK_TRANSLATED_MESSAGES', 'ACTUAL_EFFORT')
833 , p_tag_uom => jtf_task_utl.get_translated_lookup('JTF_TASK_TRANSLATED_MESSAGES', 'ACTUAL_EFFORT_UOM')
834 , x_return_status => x_return_status
835 , p_effort => p_actual_effort
836 , p_effort_uom => p_actual_effort_uom
837 );
838
839 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
840 x_return_status := fnd_api.g_ret_sts_unexp_error;
841 RAISE fnd_api.g_exc_unexpected_error;
842 END IF;
843
844 -------
845 ------- Validate Owner and Owner Sub Type
846 -------
847 jtf_task_utl.validate_task_owner(
848 p_owner_type_code => l_owner_type_code
849 , p_owner_type_name => NULL
850 , p_owner_id => l_owner_id
851 , x_return_status => x_return_status
852 , x_owner_id => l_owner_id
853 , x_owner_type_code => l_owner_type_code
854 );
855
856 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
857 fnd_message.set_name('JTF', 'JTF_TASK_MISSING_OWNER');
858 fnd_msg_pub.ADD;
859 x_return_status := fnd_api.g_ret_sts_unexp_error;
860 RAISE fnd_api.g_exc_unexpected_error;
861 END IF;
862
863 IF l_owner_id IS NULL THEN
864 fnd_message.set_name('JTF', 'JTF_TASK_OWNER');
865 fnd_msg_pub.ADD;
866 RAISE fnd_api.g_exc_unexpected_error;
867 END IF;
868
869 IF l_owner_type_code IS NULL THEN
870 fnd_message.set_name('JTF', 'JTF_TASK_OWNER_TYPE_CODE');
871 fnd_msg_pub.ADD;
872 RAISE fnd_api.g_exc_unexpected_error;
873 END IF;
874
875 -------
876 ------- Validate Planned Dates
877 -------
878 jtf_task_utl.validate_dates(
879 p_date_tag => jtf_task_utl.get_translated_lookup
880 ('JTF_TASK_TRANSLATED_MESSAGES'
881 , 'PLANNED')
882 , p_start_date => l_planned_start_date
883 , p_end_date => l_planned_end_date
884 , x_return_status => x_return_status
885 );
886
887 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
888 x_return_status := fnd_api.g_ret_sts_unexp_error;
889 RAISE fnd_api.g_exc_unexpected_error;
890 END IF;
891
892 -------
893 ------- Validate Actual Dates
894 -------
895 jtf_task_utl.validate_dates
896 (
897 p_date_tag => jtf_task_utl.get_translated_lookup
898 ('JTF_TASK_TRANSLATED_MESSAGES'
899 , 'ACTUAL')
900 , p_start_date => l_actual_start_date
901 , p_end_date => l_actual_end_date
902 , x_return_status => x_return_status
903 );
904
905 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
909
906 x_return_status := fnd_api.g_ret_sts_unexp_error;
907 RAISE fnd_api.g_exc_unexpected_error;
908 END IF;
910 -------
911 ------- Validate Scheduled Dates
912 -------
913 jtf_task_utl.validate_dates
914 (
915 p_date_tag => jtf_task_utl.get_translated_lookup
916 ('JTF_TASK_TRANSLATED_MESSAGES'
917 , 'SCHEDULED')
918 , p_start_date => l_scheduled_start_date
919 , p_end_date => l_scheduled_end_date
920 , x_return_status => x_return_status
921 );
922
923 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
924 x_return_status := fnd_api.g_ret_sts_unexp_error;
925 RAISE fnd_api.g_exc_unexpected_error;
926 END IF;
927
928 -------
929 ------- Validate Timezones
930 -------
931 jtf_task_utl.validate_timezones(
932 p_timezone_id => l_timezone_id
933 , p_timezone_name => l_timezone_name
934 , x_return_status => x_return_status
935 , x_timezone_id => l_timezone_id
936 );
937
938 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
939 x_return_status := fnd_api.g_ret_sts_unexp_error;
940 RAISE fnd_api.g_exc_unexpected_error;
941 END IF;
942
943 -------
944 ------- Validate source object details
945 -------
946 --- only if object is not TASK, fix for bug #2058164
947 IF l_source_object_type_code <> 'TASK' THEN
948 jtf_task_utl.validate_source_object(
949 p_object_code => l_source_object_type_code
950 , p_object_id => l_source_object_id
951 , p_object_name => l_source_object_name
952 , x_return_status => x_return_status
953 );
954
955 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
956 x_return_status := fnd_api.g_ret_sts_unexp_error;
957 RAISE fnd_api.g_exc_unexpected_error;
958 END IF;
959 END IF;
960
961 -------
962 ------- Call the private flag
963 -------
964 jtf_task_utl.validate_flag
965 (
966 x_return_status => x_return_status
967 , p_flag_name => jtf_task_utl.get_translated_lookup
968 ('JTF_TASK_TRANSLATED_MESSAGES'
969 , 'PRIVATE_FLAG')
970 , p_flag_value => p_private_flag
971 );
972
973 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
974 x_return_status := fnd_api.g_ret_sts_unexp_error;
975 RAISE fnd_api.g_exc_unexpected_error;
976 END IF;
977
978 -------
979 ------- Call the publish flag
980 -------
981 jtf_task_utl.validate_flag
982 (
983 x_return_status => x_return_status
984 , p_flag_name => jtf_task_utl.get_translated_lookup
985 ('JTF_TASK_TRANSLATED_MESSAGES'
986 , 'PUBLISH_FLAG')
987 , p_flag_value => p_publish_flag
988 );
989
990 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
991 x_return_status := fnd_api.g_ret_sts_unexp_error;
992 RAISE fnd_api.g_exc_unexpected_error;
993 END IF;
994
995 -------
996 ------- Call the Restrict closure flag
997 -------
998 jtf_task_utl.validate_flag
999 (
1000 p_api_name => l_api_name
1001 , p_init_msg_list => fnd_api.g_false
1002 , x_return_status => x_return_status
1003 , p_flag_name => jtf_task_utl.get_translated_lookup
1004 ('JTF_TASK_TRANSLATED_MESSAGES'
1005 , 'RESTRICT_CLOSURE_FLAG')
1006 , p_flag_value => p_restrict_closure_flag
1007 );
1008
1009 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1010 x_return_status := fnd_api.g_ret_sts_unexp_error;
1011 RAISE fnd_api.g_exc_unexpected_error;
1012 END IF;
1013
1014 -------
1015 ------- Call the Multi Booked flag
1016 -------
1017 jtf_task_utl.validate_flag
1018 (
1019 p_api_name => l_api_name
1020 , p_init_msg_list => fnd_api.g_false
1021 , x_return_status => x_return_status
1022 , p_flag_name => jtf_task_utl.get_translated_lookup
1023 ('JTF_TASK_TRANSLATED_MESSAGES'
1024 , 'MULTIBOOKED_FLAG')
1025 , p_flag_value => p_multi_booked_flag
1026 );
1027
1028 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1029 x_return_status := fnd_api.g_ret_sts_unexp_error;
1030 RAISE fnd_api.g_exc_unexpected_error;
1031 END IF;
1032
1033 -------
1034 ------- Call the milestone flag
1035 -------
1039 , p_init_msg_list => fnd_api.g_false
1036 jtf_task_utl.validate_flag
1037 (
1038 p_api_name => l_api_name
1040 , x_return_status => x_return_status
1041 , p_flag_name => jtf_task_utl.get_translated_lookup
1042 ('JTF_TASK_TRANSLATED_MESSAGES'
1043 , 'MILESTONE_FLAG')
1044 , p_flag_value => p_milestone_flag
1045 );
1046
1047 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1048 x_return_status := fnd_api.g_ret_sts_unexp_error;
1049 RAISE fnd_api.g_exc_unexpected_error;
1050 END IF;
1051
1052 -------
1053 ------- Call the Holiday Flag
1054 -------
1055 jtf_task_utl.validate_flag
1056 (
1057 p_api_name => l_api_name
1058 , p_init_msg_list => fnd_api.g_false
1059 , x_return_status => x_return_status
1060 , p_flag_name => jtf_task_utl.get_translated_lookup
1061 ('JTF_TASK_TRANSLATED_MESSAGES'
1062 , 'HOLIDAY_FLAG')
1063 , p_flag_value => p_holiday_flag
1064 );
1065
1066 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1067 x_return_status := fnd_api.g_ret_sts_unexp_error;
1068 RAISE fnd_api.g_exc_unexpected_error;
1069 END IF;
1070
1071 -------
1072 ------- Call the Billable Flag
1073 -------
1074 jtf_task_utl.validate_flag
1075 (
1076 x_return_status => x_return_status
1077 , p_flag_name => jtf_task_utl.get_translated_lookup
1078 ('JTF_TASK_TRANSLATED_MESSAGES'
1079 , 'BILLABLE_FLAG')
1080 , p_flag_value => p_billable_flag
1081 );
1082
1083 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1084 x_return_status := fnd_api.g_ret_sts_unexp_error;
1085 RAISE fnd_api.g_exc_unexpected_error;
1086 END IF;
1087
1088 -------
1089 ------- Call the Validate Notification Parameters
1090 -------
1091 jtf_task_utl.validate_notification(
1092 p_notification_flag => p_notification_flag
1093 , p_notification_period => p_notification_period
1094 , p_notification_period_uom => p_notification_period_uom
1095 , x_return_status => x_return_status
1096 );
1097
1098 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1099 x_return_status := fnd_api.g_ret_sts_unexp_error;
1100 RAISE fnd_api.g_exc_unexpected_error;
1101 END IF;
1102
1103 -------
1104 ------- Call the soft bound Flag
1105 -------
1106 jtf_task_utl.validate_flag
1107 (
1108 p_api_name => l_api_name
1109 , p_init_msg_list => fnd_api.g_false
1110 , x_return_status => x_return_status
1111 , p_flag_name => jtf_task_utl.get_translated_lookup
1112 ('JTF_TASK_TRANSLATED_MESSAGES'
1113 , 'SOFTBOUND_FLAG')
1114 , p_flag_value => p_soft_bound_flag
1115 );
1116
1117 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1118 x_return_status := fnd_api.g_ret_sts_unexp_error;
1119 RAISE fnd_api.g_exc_unexpected_error;
1120 END IF;
1121
1122 -------
1123 ------- Call the Palm Flag
1124 -------
1125 jtf_task_utl.validate_flag
1126 (
1127 p_api_name => l_api_name
1128 , p_init_msg_list => fnd_api.g_false
1129 , x_return_status => x_return_status
1130 , p_flag_name => jtf_task_utl.get_translated_lookup
1131 ('JTF_TASK_TRANSLATED_MESSAGES'
1132 , 'PALM_FLAG')
1133 , p_flag_value => p_palm_flag
1134 );
1135
1136 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1137 x_return_status := fnd_api.g_ret_sts_unexp_error;
1138 RAISE fnd_api.g_exc_unexpected_error;
1139 END IF;
1140
1141 -------
1142 ------- Call the Wince Flag
1143 -------
1144 jtf_task_utl.validate_flag
1145 (
1146 p_api_name => l_api_name
1147 , p_init_msg_list => fnd_api.g_false
1148 , x_return_status => x_return_status
1149 , p_flag_name => jtf_task_utl.get_translated_lookup
1150 ('JTF_TASK_TRANSLATED_MESSAGES'
1151 , 'WINCE_FLAG')
1152 , p_flag_value => p_wince_flag
1153 );
1154
1155 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1156 x_return_status := fnd_api.g_ret_sts_unexp_error;
1157 RAISE fnd_api.g_exc_unexpected_error;
1158 END IF;
1159
1160 -------
1161 ------- Call the Laptop Flag
1162 -------
1163 jtf_task_utl.validate_flag
1164 (
1168 , p_flag_name => jtf_task_utl.get_translated_lookup
1165 p_api_name => l_api_name
1166 , p_init_msg_list => fnd_api.g_false
1167 , x_return_status => x_return_status
1169 ('JTF_TASK_TRANSLATED_MESSAGES'
1170 , 'LAPTOP_FLAG')
1171 , p_flag_value => p_laptop_flag
1172 );
1173
1174 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1175 x_return_status := fnd_api.g_ret_sts_unexp_error;
1176 RAISE fnd_api.g_exc_unexpected_error;
1177 END IF;
1178
1179 -------
1180 ------- Validating the alarm details
1181 -------
1182 jtf_task_utl.validate_alarm(
1183 p_alarm_start => p_alarm_start
1184 , p_alarm_start_uom => p_alarm_start_uom
1185 , p_alarm_on => p_alarm_on
1186 , p_alarm_count => p_alarm_count
1187 , p_alarm_interval => p_alarm_interval
1188 , p_alarm_interval_uom => p_alarm_interval_uom
1189 , x_return_status => x_return_status
1190 );
1191
1192 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1193 x_return_status := fnd_api.g_ret_sts_unexp_error;
1194 RAISE fnd_api.g_exc_unexpected_error;
1195 END IF;
1196
1197 -------
1198 ------- Validating the assigned_by_id
1199 -------
1200 jtf_task_utl.validate_assigned_by(
1201 p_assigned_by_id => l_assigned_by_id
1202 , p_assigned_by_name => l_assigned_by_name
1203 , x_return_status => x_return_status
1204 , x_assigned_by_id => l_assigned_by_id
1205 ); -------
1206 ------- Validating the parent task id
1207 -------
1208 -- Fix Bug 2119074 : Must validate p_parent_task_number when p_parent_task_id is null
1209 --IF p_parent_task_id IS NOT NULL
1210 --THEN
1211 jtf_task_utl.validate_task(
1212 p_task_id => l_parent_task_id
1213 , p_task_number => l_parent_task_number
1214 , x_task_id => l_parent_task_id
1215 , x_return_status => x_return_status
1216 );
1217
1218 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1219 x_return_status := fnd_api.g_ret_sts_unexp_error;
1220 RAISE fnd_api.g_exc_unexpected_error;
1221 END IF;
1222
1223 --END IF;
1224
1225 -------
1226 ------- Call the Customer Info
1227 -------
1228 jtf_task_utl.validate_customer_info(
1229 p_cust_account_number => l_cust_account_number
1230 , p_cust_account_id => l_cust_account_id
1231 , p_customer_number => l_customer_number
1232 , p_customer_id => l_customer_id
1233 , p_address_id => l_address_id
1234 , p_address_number => l_address_number
1235 , x_return_status => x_return_status
1236 , x_cust_account_id => l_cust_account_id
1237 , x_customer_id => l_customer_id
1238 , x_address_id => l_address_id
1239 );
1240
1241 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1242 x_return_status := fnd_api.g_ret_sts_unexp_error;
1243 RAISE fnd_api.g_exc_unexpected_error;
1244 END IF;
1245
1246 -------
1247 ------- Validate Percentage Complete
1248 -------
1249 IF p_percentage_complete IS NOT NULL THEN
1250 IF p_percentage_complete < 0 OR p_percentage_complete > 100 THEN
1251 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_PCT_COMPLETE');
1252 fnd_msg_pub.ADD;
1253 x_return_status := fnd_api.g_ret_sts_unexp_error;
1254 RAISE fnd_api.g_exc_unexpected_error;
1255 END IF;
1256 END IF;
1257
1258 -------
1259 ------- Bound mode code.
1260 -------
1261 IF p_bound_mode_code IS NOT NULL THEN
1262 y := jtf_task_utl.validate_lookup('JTF_TASK_BOUND_MODE_CODE', p_bound_mode_code, NULL);
1263
1264 IF y = FALSE THEN
1265 x_return_status := fnd_api.g_ret_sts_unexp_error;
1266 RAISE fnd_api.g_exc_unexpected_error;
1267 END IF;
1268 END IF;
1269
1270 -------
1271 ------- Validating costs
1272 -------
1273 jtf_task_utl.validate_costs(p_costs => l_costs, p_currency_code => l_currency_code
1274 , x_return_status => x_return_status);
1275
1276 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1277 x_return_status := fnd_api.g_ret_sts_unexp_error;
1278 RAISE fnd_api.g_exc_unexpected_error;
1279 END IF;
1280
1281 ---------------
1282 --------------- Validate date_selected
1283 ---------------
1284 IF l_date_selected IS NOT NULL AND l_date_selected <> fnd_api.g_miss_char THEN
1285 IF l_date_selected NOT IN('P', 'S', 'A', 'D') THEN
1286 x_return_status := fnd_api.g_ret_sts_unexp_error;
1287 RAISE fnd_api.g_exc_unexpected_error;
1288 END IF;
1289 END IF;
1290
1291 ---------------
1292 --------------- Validate owner_status_id
1293 ---------------
1294 IF p_owner_status_id IS NOT NULL AND p_owner_status_id <> fnd_api.g_miss_num THEN
1295 OPEN c_owner_status_id(p_owner_status_id);
1296
1300 IF c_owner_status_id%NOTFOUND THEN
1297 FETCH c_owner_status_id
1298 INTO l_owner_status_id;
1299
1301 CLOSE c_owner_status_id;
1302
1303 x_return_status := fnd_api.g_ret_sts_unexp_error;
1304 RAISE fnd_api.g_exc_unexpected_error;
1305 ELSE
1306 CLOSE c_owner_status_id;
1307 END IF;
1308 END IF;
1309
1310 -------
1311 ------- Call the private api.
1312 -------
1313 jtf_tasks_pvt.create_task(
1314 p_api_version => 1.0
1315 , p_init_msg_list => fnd_api.g_false
1316 , p_commit => fnd_api.g_false
1317 , p_task_id => p_task_id
1318 , p_task_type_id => l_task_type_id
1319 , p_task_name => l_task_name
1320 , x_return_status => x_return_status
1321 , x_msg_count => x_msg_count
1322 , x_msg_data => x_msg_data
1323 , x_task_id => x_task_id
1324 , p_task_status_id => l_task_status_id
1325 , p_task_priority_id => l_task_priority_id
1326 , p_owner_id => l_owner_id
1327 , p_owner_type_code => l_owner_type_code
1328 , p_owner_territory_id => p_owner_territory_id
1329 , p_source_object_id => l_source_object_id
1330 , p_source_object_name => l_source_object_name
1331 , p_duration => p_duration
1332 , p_duration_uom => p_duration_uom
1333 , p_planned_effort => p_planned_effort
1334 , p_planned_effort_uom => p_planned_effort_uom
1335 , p_actual_effort => p_actual_effort
1336 , p_actual_effort_uom => p_actual_effort_uom
1337 , p_percentage_complete => p_percentage_complete
1338 , p_reason_code => p_reason_code
1339 , p_private_flag => p_private_flag
1340 , p_publish_flag => p_publish_flag
1341 , p_restrict_closure_flag => p_restrict_closure_flag
1342 , p_multi_booked_flag => p_multi_booked_flag
1343 , p_milestone_flag => p_milestone_flag
1344 , p_holiday_flag => p_holiday_flag
1345 , p_billable_flag => p_billable_flag
1346 , p_bound_mode_code => p_bound_mode_code
1347 , p_soft_bound_flag => p_soft_bound_flag
1348 , p_workflow_process_id => p_workflow_process_id
1349 , p_notification_flag => p_notification_flag
1350 , p_notification_period => p_notification_period
1351 , p_notification_period_uom => p_notification_period_uom
1352 , p_parent_task_id => l_parent_task_id
1353 , p_alarm_start => p_alarm_start
1354 , p_alarm_start_uom => p_alarm_start_uom
1355 , p_alarm_on => p_alarm_on
1356 , p_alarm_count => p_alarm_count
1357 , p_alarm_interval => p_alarm_interval
1358 , p_alarm_interval_uom => p_alarm_interval_uom
1359 , p_palm_flag => p_palm_flag
1360 , p_wince_flag => p_wince_flag
1361 , p_laptop_flag => p_laptop_flag
1362 , p_device1_flag => p_device1_flag
1363 , p_device2_flag => p_device2_flag
1364 , p_device3_flag => p_device3_flag
1365 , p_assigned_by_id => l_assigned_by_id
1366 , p_cust_account_id => p_cust_account_id
1367 , p_customer_id => p_customer_id
1368 , p_address_id => p_address_id
1369 , p_planned_start_date => p_planned_start_date
1370 , p_planned_end_date => p_planned_end_date
1371 , p_scheduled_start_date => p_scheduled_start_date
1372 , p_scheduled_end_date => p_scheduled_end_date
1373 , p_actual_start_date => p_actual_start_date
1374 , p_actual_end_date => p_actual_end_date
1375 , p_source_object_type_code => l_source_object_type_code
1376 , p_timezone_id => l_timezone_id
1377 , p_description => p_description
1378 , p_costs => p_costs
1379 , p_currency_code => p_currency_code
1380 , p_escalation_level => p_escalation_level
1381 , p_attribute1 => p_attribute1
1382 , p_attribute2 => p_attribute2
1383 , p_attribute3 => p_attribute3
1384 , p_attribute4 => p_attribute4
1385 , p_attribute5 => p_attribute5
1386 , p_attribute6 => p_attribute6
1387 , p_attribute7 => p_attribute7
1388 , p_attribute8 => p_attribute8
1389 , p_attribute9 => p_attribute9
1390 , p_attribute10 => p_attribute10
1391 , p_attribute11 => p_attribute11
1392 , p_attribute12 => p_attribute12
1393 , p_attribute13 => p_attribute13
1394 , p_attribute14 => p_attribute14
1395 , p_attribute15 => p_attribute15
1396 , p_attribute_category => p_attribute_category
1397 , p_date_selected => p_date_selected
1401 , p_template_id => p_template_id
1398 , p_category_id => p_category_id
1399 , p_show_on_calendar => p_show_on_calendar
1400 , p_owner_status_id => l_owner_status_id
1402 , p_template_group_id => p_template_group_id
1403 , p_enable_workflow => p_enable_workflow
1404 , p_abort_workflow => p_abort_workflow
1405 , p_entity => g_entity
1406 , p_free_busy_type => g_free_busy_type
1407 , p_task_confirmation_status => 'N'
1408 , p_task_confirmation_counter => 0
1409 , p_task_split_flag => p_task_split_flag
1410 , p_reference_flag => p_reference_flag
1411 , p_child_position => p_child_position
1412 , p_child_sequence_num => p_child_sequence_num
1413 , p_location_id => l_location_id
1414 );
1415
1416 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1417 x_return_status := fnd_api.g_ret_sts_unexp_error;
1418 RAISE fnd_api.g_exc_unexpected_error;
1419 END IF;
1420
1421 l_task_id := x_task_id;
1422
1423 -------
1424 -------
1425 ------- Create the dependencies
1426 -------
1427 -------
1428 IF p_task_depends_tbl.COUNT > 0 THEN
1429 current_record := p_task_depends_tbl.FIRST;
1430
1431 FOR i IN 1 .. p_task_depends_tbl.COUNT LOOP
1432 jtf_task_dependency_pub.create_task_dependency
1433 (
1434 p_api_version => 1.0
1435 , p_init_msg_list => fnd_api.g_false
1436 , p_commit => fnd_api.g_false
1437 , p_validation_level => fnd_api.g_valid_level_full
1438 , p_task_id => l_task_id
1439 , p_dependent_on_task_id => p_task_depends_tbl(current_record).dependent_on_task_id
1440 , p_dependent_on_task_number => p_task_depends_tbl(current_record).dependent_on_task_number
1441 , p_dependency_type_code => p_task_depends_tbl(current_record).dependency_type_code
1442 , p_template_flag => jtf_task_utl.g_no
1443 , p_adjustment_time => p_task_depends_tbl(current_record).adjustment_time
1444 , p_adjustment_time_uom => p_task_depends_tbl(current_record).adjustment_time_uom
1445 , p_validated_flag => p_task_depends_tbl(current_record).validated_flag
1446 , x_dependency_id => l_dependency_id
1447 , x_return_status => x_return_status
1448 , x_msg_count => x_msg_count
1449 , x_msg_data => x_msg_data
1450 );
1451
1452 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1453 x_return_status := fnd_api.g_ret_sts_unexp_error;
1454 RAISE fnd_api.g_exc_unexpected_error;
1455 END IF;
1456
1457 current_record := p_task_depends_tbl.NEXT(current_record);
1458 END LOOP;
1459 END IF;
1460
1461 -------
1462 ------- Create References
1463 -------
1464 IF p_task_refer_tbl.COUNT > 0 THEN
1465 current_record := p_task_refer_tbl.FIRST;
1466
1467 FOR i IN 1 .. p_task_refer_tbl.COUNT LOOP
1468 jtf_task_references_pub.create_references
1469 (
1470 p_api_version => 1.0
1471 , p_init_msg_list => fnd_api.g_false
1472 , p_commit => fnd_api.g_false
1473 , p_task_id => l_task_id
1474 , p_object_type_code => p_task_refer_tbl(current_record).object_type_code
1475 ,
1476 -- p_object_type_name => p_task_refer_tbl (current_record).object_type_name,
1477 p_object_name => p_task_refer_tbl(current_record).object_name
1478 , p_object_id => p_task_refer_tbl(current_record).object_id
1479 , p_object_details => p_task_refer_tbl(current_record).object_details
1480 , p_reference_code => p_task_refer_tbl(current_record).reference_code
1481 , p_usage => p_task_refer_tbl(current_record).USAGE
1482 , x_return_status => x_return_status
1483 , x_msg_count => x_msg_count
1484 , x_msg_data => x_msg_data
1485 , x_task_reference_id => l_task_reference_id
1486 );
1487
1488 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1489 x_return_status := fnd_api.g_ret_sts_unexp_error;
1490 RAISE fnd_api.g_exc_unexpected_error;
1491 END IF;
1492
1493 current_record := p_task_refer_tbl.NEXT(current_record);
1494 END LOOP;
1495 END IF;
1496
1497 -------
1498 ------- Create Resource Requirements
1499 -------
1500 IF p_task_rsrc_req_tbl.COUNT > 0 THEN
1501 current_record := p_task_rsrc_req_tbl.FIRST;
1502
1503 FOR i IN 1 .. p_task_rsrc_req_tbl.COUNT LOOP
1504 jtf_task_resources_pub.create_task_rsrc_req
1505 (
1506 p_api_version => 1.0
1507 , p_init_msg_list => fnd_api.g_false
1511 , p_required_units => p_task_rsrc_req_tbl(i).required_units
1508 , p_commit => fnd_api.g_false
1509 , p_task_id => l_task_id
1510 , p_resource_type_code => p_task_rsrc_req_tbl(i).resource_type_code
1512 , p_enabled_flag => p_task_rsrc_req_tbl(i).enabled_flag
1513 , x_return_status => x_return_status
1514 , x_msg_count => x_msg_count
1515 , x_msg_data => x_msg_data
1516 , x_resource_req_id => l_resource_req_id
1517 );
1518
1519 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1520 x_return_status := fnd_api.g_ret_sts_unexp_error;
1521 RAISE fnd_api.g_exc_unexpected_error;
1522 END IF;
1523
1524 current_record := p_task_rsrc_req_tbl.NEXT(current_record);
1525 END LOOP;
1526 END IF;
1527
1528 -------
1529 ------- Create Assignments
1530 -------
1531 IF p_task_assign_tbl.COUNT > 0 THEN
1532 current_record := p_task_assign_tbl.FIRST;
1533
1534 FOR i IN 1 .. p_task_assign_tbl.COUNT LOOP
1535 jtf_task_assignments_pub.create_task_assignment
1536 (
1537 p_api_version => 1.0
1538 , p_init_msg_list => fnd_api.g_false
1539 , p_commit => fnd_api.g_false
1540 , p_task_id => l_task_id
1541 , p_resource_type_code => p_task_assign_tbl(i).resource_type_code
1542 , p_resource_id => p_task_assign_tbl(i).resource_id
1543 , p_actual_effort => p_task_assign_tbl(i).actual_effort
1544 , p_actual_effort_uom => p_task_assign_tbl(i).actual_effort_uom
1545 , p_schedule_flag => p_task_assign_tbl(i).schedule_flag
1546 , p_alarm_type_code => p_task_assign_tbl(i).alarm_type_code
1547 , p_alarm_contact => p_task_assign_tbl(i).alarm_contact
1548 , p_sched_travel_distance => p_task_assign_tbl(i).sched_travel_duration
1549 , p_sched_travel_duration => p_task_assign_tbl(i).sched_travel_duration
1550 , p_sched_travel_duration_uom => p_task_assign_tbl(i).sched_travel_duration_uom
1551 , p_actual_travel_distance => p_task_assign_tbl(i).actual_travel_distance
1552 , p_actual_travel_duration => p_task_assign_tbl(i).actual_travel_duration
1553 , p_actual_travel_duration_uom => p_task_assign_tbl(i).actual_travel_duration_uom
1554 , p_actual_start_date => p_task_assign_tbl(i).actual_start_date
1555 , p_actual_end_date => p_task_assign_tbl(i).actual_end_date
1556 , p_palm_flag => p_task_assign_tbl(i).palm_flag
1557 , p_wince_flag => p_task_assign_tbl(i).wince_flag
1558 , p_laptop_flag => p_task_assign_tbl(i).laptop_flag
1559 , p_device1_flag => p_task_assign_tbl(i).device1_flag
1560 , p_device2_flag => p_task_assign_tbl(i).device2_flag
1561 , p_device3_flag => p_task_assign_tbl(i).device3_flag
1562 , p_resource_territory_id => p_task_assign_tbl(i).resource_territory_id
1563 , p_assignment_status_id => p_task_assign_tbl(i).assignment_status_id
1564 , p_shift_construct_id => p_task_assign_tbl(i).shift_construct_id
1565 , p_show_on_calendar => p_task_assign_tbl(i).show_on_calendar
1566 , p_category_id => p_task_assign_tbl(i).category_id
1567 , x_return_status => x_return_status
1568 , x_msg_count => x_msg_count
1569 , x_msg_data => x_msg_data
1570 , x_task_assignment_id => l_task_assignment_id
1571 );
1572
1573 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1574 x_return_status := fnd_api.g_ret_sts_unexp_error;
1575 RAISE fnd_api.g_exc_unexpected_error;
1576 END IF;
1577
1578 current_record := p_task_rsrc_req_tbl.NEXT(current_record);
1579 END LOOP;
1580 END IF;
1581
1582 -------
1583 ------- Create Dates
1584 -------
1585 IF p_task_dates_tbl.COUNT > 0 THEN
1586 current_record := p_task_dates_tbl.FIRST;
1587
1588 FOR i IN 1 .. p_task_dates_tbl.COUNT LOOP
1589 jtf_task_dates_pub.create_task_dates
1590 (
1591 p_api_version => 1.0
1592 , p_init_msg_list => fnd_api.g_false
1593 , p_commit => fnd_api.g_false
1594 , p_task_id => l_task_id
1595 , p_date_type_id => p_task_dates_tbl(current_record).date_type_id
1596 , p_date_type_name => p_task_dates_tbl(current_record).date_type_name
1597 , p_date_value => p_task_dates_tbl(current_record).date_value
1598 , x_return_status => x_return_status
1599 , x_msg_count => x_msg_count
1600 , x_msg_data => x_msg_data
1601 , x_task_date_id => l_task_date_id
1602 );
1603
1604 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1605 x_return_status := fnd_api.g_ret_sts_unexp_error;
1609 current_record := p_task_dates_tbl.NEXT(current_record);
1606 RAISE fnd_api.g_exc_unexpected_error;
1607 END IF;
1608
1610 END LOOP;
1611 END IF;
1612
1613 -------
1614 ------- Create Notes
1615 -------
1616 IF p_task_notes_tbl.COUNT > 0 THEN
1617 current_record := p_task_notes_tbl.FIRST;
1618
1619 FOR i IN 1 .. p_task_notes_tbl.COUNT LOOP
1620 jtf_notes_pub.create_note(
1621 p_api_version => 1.0
1622 , p_init_msg_list => fnd_api.g_false
1623 , p_commit => fnd_api.g_false
1624 , p_validation_level => fnd_api.g_valid_level_full
1625 , p_parent_note_id => p_task_notes_tbl(i).parent_note_id
1626 , x_return_status => x_return_status
1627 , x_msg_count => x_msg_count
1628 , x_msg_data => x_msg_count
1629 , p_org_id => p_task_notes_tbl(i).org_id
1630 , p_source_object_id => l_task_id
1631 , p_source_object_code => 'TASK'
1632 , p_notes => p_task_notes_tbl(i).notes
1633 , p_notes_detail => p_task_notes_tbl(i).notes_detail
1634 , p_note_status => p_task_notes_tbl(i).note_status
1635 , p_entered_by => p_task_notes_tbl(i).entered_by
1636 , p_entered_date => p_task_notes_tbl(i).entered_date
1637 , x_jtf_note_id => l_notes_id
1638 , p_note_type => p_task_notes_tbl(i).note_type
1639 , p_jtf_note_contexts_tab => jtf_notes_pub.jtf_note_contexts_tab
1640 , p_creation_date => SYSDATE
1641 , p_last_update_date => SYSDATE
1642 , p_last_updated_by => fnd_global.login_id
1643 , p_attribute1 => p_task_notes_tbl(i).attribute1
1644 , p_attribute2 => p_task_notes_tbl(i).attribute2
1645 , p_attribute3 => p_task_notes_tbl(i).attribute3
1646 , p_attribute4 => p_task_notes_tbl(i).attribute4
1647 , p_attribute5 => p_task_notes_tbl(i).attribute5
1648 , p_attribute6 => p_task_notes_tbl(i).attribute6
1649 , p_attribute7 => p_task_notes_tbl(i).attribute7
1650 , p_attribute8 => p_task_notes_tbl(i).attribute8
1651 , p_attribute9 => p_task_notes_tbl(i).attribute9
1652 , p_attribute10 => p_task_notes_tbl(i).attribute10
1653 , p_attribute11 => p_task_notes_tbl(i).attribute11
1654 , p_attribute12 => p_task_notes_tbl(i).attribute12
1655 , p_attribute13 => p_task_notes_tbl(i).attribute13
1656 , p_attribute14 => p_task_notes_tbl(i).attribute14
1657 , p_attribute15 => p_task_notes_tbl(i).attribute15
1658 , p_context => p_task_notes_tbl(i).CONTEXT
1659 );
1660
1661 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1662 x_return_status := fnd_api.g_ret_sts_unexp_error;
1663 RAISE fnd_api.g_exc_unexpected_error;
1664 END IF;
1665
1666 current_record := p_task_dates_tbl.NEXT(current_record);
1667 END LOOP;
1668 END IF;
1669
1670 -------
1671 -------
1672 ------- Create recurrences
1673 -------
1674 -------
1675 IF (
1676 p_task_recur_rec.occurs_which IS NOT NULL
1677 OR p_task_recur_rec.day_of_week IS NOT NULL
1678 OR p_task_recur_rec.date_of_month IS NOT NULL
1679 OR p_task_recur_rec.occurs_month IS NOT NULL
1680 OR p_task_recur_rec.occurs_uom IS NOT NULL
1681 OR p_task_recur_rec.occurs_every IS NOT NULL
1682 OR p_task_recur_rec.occurs_number IS NOT NULL
1683 OR p_task_recur_rec.start_date_active IS NOT NULL
1684 OR p_task_recur_rec.end_date_active IS NOT NULL
1685 ) THEN
1686 jtf_task_recurrences_pub.create_task_recurrence
1687 (
1688 p_api_version => 1.0
1689 , p_init_msg_list => fnd_api.g_false
1690 , p_commit => fnd_api.g_false
1691 , p_task_id => l_task_id
1692 , p_occurs_which => p_task_recur_rec.occurs_which
1693 , p_template_flag => jtf_task_utl.g_no
1694 , p_day_of_week => p_task_recur_rec.day_of_week
1695 , p_date_of_month => p_task_recur_rec.date_of_month
1696 , p_occurs_month => p_task_recur_rec.occurs_month
1697 , p_occurs_uom => p_task_recur_rec.occurs_uom
1698 , p_occurs_every => p_task_recur_rec.occurs_every
1699 , p_occurs_number => p_task_recur_rec.occurs_number
1700 , p_start_date_active => p_task_recur_rec.start_date_active
1701 , p_end_date_active => p_task_recur_rec.end_date_active
1702 , x_return_status => x_return_status
1703 , x_msg_count => x_msg_count
1704 , x_msg_data => x_msg_data
1705 , x_recurrence_rule_id => l_recurrence_rule_id
1706 , x_task_rec => l_task_rec
1707 , x_reccurences_generated => l_reccurence_generated
1708 );
1709
1710 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1714 END IF;
1711 x_return_status := fnd_api.g_ret_sts_unexp_error;
1712 RAISE fnd_api.g_exc_unexpected_error;
1713 END IF;
1715
1716 /***** Start: Fix bug 2107464 ***************/
1717 -------
1718 ------- Create Contacts
1719 -------
1720 IF p_task_contacts_tbl.COUNT > 0 THEN
1721 --current_record := p_task_contacts_tbl.FIRST;
1722 FOR i IN p_task_contacts_tbl.FIRST .. p_task_contacts_tbl.COUNT LOOP
1723 jtf_task_contacts_pub.create_task_contacts
1724 (
1725 p_api_version => 1.0
1726 , p_init_msg_list => fnd_api.g_false
1727 , p_commit => fnd_api.g_false
1728 , p_task_id => l_task_id
1729 , p_contact_id => p_task_contacts_tbl(i).contact_id
1730 , p_contact_type_code => p_task_contacts_tbl(i).contact_type_code
1731 , p_escalation_notify_flag => p_task_contacts_tbl(i).escalation_notify_flag
1732 , p_escalation_requester_flag => p_task_contacts_tbl(i).escalation_requester_flag
1733 , x_task_contact_id => l_task_contact_id
1734 , x_return_status => x_return_status
1735 , x_msg_count => x_msg_count
1736 , x_msg_data => x_msg_data
1737 );
1738
1739 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1740 x_return_status := fnd_api.g_ret_sts_unexp_error;
1741 RAISE fnd_api.g_exc_unexpected_error;
1742 END IF;
1743 --current_record := p_task_dates_tbl.NEXT (current_record);
1744 END LOOP;
1745 END IF;
1746
1747 /***** End: Fix bug 2107464 ***************/
1748
1749 -------
1750 -------
1751 -------
1752 IF fnd_api.to_boolean(p_commit) THEN
1753 COMMIT WORK;
1754 END IF;
1755
1756 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1757 EXCEPTION
1758 WHEN fnd_api.g_exc_unexpected_error THEN
1759 ROLLBACK TO create_task_pub;
1760 x_return_status := fnd_api.g_ret_sts_unexp_error;
1761 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1762 WHEN OTHERS THEN
1763 ROLLBACK TO create_task_pub;
1764 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
1765 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
1766 fnd_msg_pub.ADD;
1767 x_return_status := fnd_api.g_ret_sts_unexp_error;
1768 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1769 END;
1770
1771 -- original version including table type parameters
1772 -- Remove the fix of Bug 2152549
1773 PROCEDURE create_task(
1774 p_api_version IN NUMBER
1775 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
1776 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
1777 , p_task_id IN NUMBER DEFAULT NULL
1778 , p_task_name IN VARCHAR2
1779 , p_task_type_name IN VARCHAR2 DEFAULT NULL
1780 , p_task_type_id IN NUMBER DEFAULT NULL
1781 , p_description IN VARCHAR2 DEFAULT NULL
1782 , p_task_status_name IN VARCHAR2 DEFAULT NULL
1783 , p_task_status_id IN NUMBER DEFAULT NULL
1784 , p_task_priority_name IN VARCHAR2 DEFAULT NULL
1785 , p_task_priority_id IN NUMBER DEFAULT NULL
1786 , p_owner_type_name IN VARCHAR2 DEFAULT NULL
1787 , p_owner_type_code IN VARCHAR2 DEFAULT NULL
1788 , p_owner_id IN NUMBER DEFAULT NULL
1789 , p_owner_territory_id IN NUMBER DEFAULT NULL
1790 , p_assigned_by_name IN VARCHAR2 DEFAULT NULL
1791 , p_assigned_by_id IN NUMBER DEFAULT NULL
1792 , p_customer_number IN VARCHAR2 DEFAULT NULL
1793 , -- from hz_parties
1794 p_customer_id IN NUMBER DEFAULT NULL
1795 , p_cust_account_number IN VARCHAR2 DEFAULT NULL
1796 , p_cust_account_id IN NUMBER DEFAULT NULL
1797 , p_address_id IN NUMBER DEFAULT NULL
1798 , ---- hz_party_sites
1799 p_address_number IN VARCHAR2 DEFAULT NULL
1800 , p_planned_start_date IN DATE DEFAULT NULL
1801 , p_planned_end_date IN DATE DEFAULT NULL
1802 , p_scheduled_start_date IN DATE DEFAULT NULL
1803 , p_scheduled_end_date IN DATE DEFAULT NULL
1804 , p_actual_start_date IN DATE DEFAULT NULL
1805 , p_actual_end_date IN DATE DEFAULT NULL
1806 , p_timezone_id IN NUMBER DEFAULT NULL
1807 , p_timezone_name IN VARCHAR2 DEFAULT NULL
1808 , p_source_object_type_code IN VARCHAR2 DEFAULT NULL
1809 , p_source_object_id IN NUMBER DEFAULT NULL
1810 , p_source_object_name IN VARCHAR2 DEFAULT NULL
1811 , p_duration IN NUMBER DEFAULT NULL
1812 , p_duration_uom IN VARCHAR2 DEFAULT NULL
1813 , p_planned_effort IN NUMBER DEFAULT NULL
1817 , p_percentage_complete IN NUMBER DEFAULT NULL
1814 , p_planned_effort_uom IN VARCHAR2 DEFAULT NULL
1815 , p_actual_effort IN NUMBER DEFAULT NULL
1816 , p_actual_effort_uom IN VARCHAR2 DEFAULT NULL
1818 , p_reason_code IN VARCHAR2 DEFAULT NULL
1819 , p_private_flag IN VARCHAR2 DEFAULT NULL
1820 , p_publish_flag IN VARCHAR2 DEFAULT NULL
1821 , p_restrict_closure_flag IN VARCHAR2 DEFAULT NULL
1822 , p_multi_booked_flag IN VARCHAR2 DEFAULT NULL
1823 , p_milestone_flag IN VARCHAR2 DEFAULT NULL
1824 , p_holiday_flag IN VARCHAR2 DEFAULT NULL
1825 , p_billable_flag IN VARCHAR2 DEFAULT NULL
1826 , p_bound_mode_code IN VARCHAR2 DEFAULT NULL
1827 , p_soft_bound_flag IN VARCHAR2 DEFAULT NULL
1828 , p_workflow_process_id IN NUMBER DEFAULT NULL
1829 , p_notification_flag IN VARCHAR2 DEFAULT NULL
1830 , p_notification_period IN NUMBER DEFAULT NULL
1831 , p_notification_period_uom IN VARCHAR2 DEFAULT NULL
1832 , p_parent_task_number IN VARCHAR2 DEFAULT NULL
1833 , p_parent_task_id IN NUMBER DEFAULT NULL
1834 , p_alarm_start IN NUMBER DEFAULT NULL
1835 , p_alarm_start_uom IN VARCHAR2 DEFAULT NULL
1836 , p_alarm_on IN VARCHAR2 DEFAULT NULL
1837 , p_alarm_count IN NUMBER DEFAULT NULL
1838 , p_alarm_interval IN NUMBER DEFAULT NULL
1839 , p_alarm_interval_uom IN VARCHAR2 DEFAULT NULL
1840 , p_palm_flag IN VARCHAR2 DEFAULT NULL
1841 , p_wince_flag IN VARCHAR2 DEFAULT NULL
1842 , p_laptop_flag IN VARCHAR2 DEFAULT NULL
1843 , p_device1_flag IN VARCHAR2 DEFAULT NULL
1844 , p_device2_flag IN VARCHAR2 DEFAULT NULL
1845 , p_device3_flag IN VARCHAR2 DEFAULT NULL
1846 , p_costs IN NUMBER DEFAULT NULL
1847 , p_currency_code IN VARCHAR2 DEFAULT NULL
1848 , p_escalation_level IN VARCHAR2 DEFAULT NULL
1849 , p_task_assign_tbl IN task_assign_tbl DEFAULT g_miss_task_assign_tbl
1850 , p_task_depends_tbl IN task_depends_tbl DEFAULT g_miss_task_depends_tbl
1851 , p_task_rsrc_req_tbl IN task_rsrc_req_tbl DEFAULT g_miss_task_rsrc_req_tbl
1852 , p_task_refer_tbl IN task_refer_tbl DEFAULT g_miss_task_refer_tbl
1853 , p_task_dates_tbl IN task_dates_tbl DEFAULT g_miss_task_dates_tbl
1854 , p_task_notes_tbl IN task_notes_tbl DEFAULT g_miss_task_notes_tbl
1855 , p_task_recur_rec IN task_recur_rec DEFAULT g_miss_task_recur_rec
1856 , p_task_contacts_tbl IN task_contacts_tbl DEFAULT g_miss_task_contacts_tbl
1857 , x_return_status OUT NOCOPY VARCHAR2
1858 , x_msg_count OUT NOCOPY NUMBER
1859 , x_msg_data OUT NOCOPY VARCHAR2
1860 , x_task_id OUT NOCOPY NUMBER
1861 , p_attribute1 IN VARCHAR2 DEFAULT NULL
1862 , p_attribute2 IN VARCHAR2 DEFAULT NULL
1863 , p_attribute3 IN VARCHAR2 DEFAULT NULL
1864 , p_attribute4 IN VARCHAR2 DEFAULT NULL
1865 , p_attribute5 IN VARCHAR2 DEFAULT NULL
1866 , p_attribute6 IN VARCHAR2 DEFAULT NULL
1867 , p_attribute7 IN VARCHAR2 DEFAULT NULL
1868 , p_attribute8 IN VARCHAR2 DEFAULT NULL
1869 , p_attribute9 IN VARCHAR2 DEFAULT NULL
1870 , p_attribute10 IN VARCHAR2 DEFAULT NULL
1871 , p_attribute11 IN VARCHAR2 DEFAULT NULL
1872 , p_attribute12 IN VARCHAR2 DEFAULT NULL
1873 , p_attribute13 IN VARCHAR2 DEFAULT NULL
1874 , p_attribute14 IN VARCHAR2 DEFAULT NULL
1875 , p_attribute15 IN VARCHAR2 DEFAULT NULL
1876 , p_attribute_category IN VARCHAR2 DEFAULT NULL
1877 , p_date_selected IN VARCHAR2 DEFAULT NULL
1878 , p_category_id IN NUMBER DEFAULT NULL
1879 , p_show_on_calendar IN VARCHAR2 DEFAULT NULL
1880 , p_owner_status_id IN NUMBER DEFAULT NULL
1881 , p_template_id IN NUMBER DEFAULT NULL
1882 , p_template_group_id IN NUMBER DEFAULT NULL
1883 ) IS
1884 l_api_version CONSTANT NUMBER := 1.0;
1885 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_TASK';
1886 BEGIN
1887 SAVEPOINT create_task_pub2;
1888 x_return_status := fnd_api.g_ret_sts_success;
1889
1890 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1891 RAISE fnd_api.g_exc_unexpected_error;
1892 END IF;
1893
1894 IF fnd_api.to_boolean(p_init_msg_list) THEN
1895 fnd_msg_pub.initialize;
1896 END IF;
1897
1898 -- call new version, passing defaults for new functionality
1899 -- Remove the fix of Bug 2152549: call create_task_b which is non-overloading procedure
1903 ,
1900 create_task(
1901 p_api_version => p_api_version
1902 , p_init_msg_list => p_init_msg_list
1904 -- passing FALSE so we can commit after processing the table parameters
1905 p_commit => fnd_api.g_false
1906 , p_task_id => p_task_id
1907 , p_task_name => p_task_name
1908 , p_task_type_name => p_task_type_name
1909 , p_task_type_id => p_task_type_id
1910 , p_description => p_description
1911 , p_task_status_name => p_task_status_name
1912 , p_task_status_id => p_task_status_id
1913 , p_task_priority_name => p_task_priority_name
1914 , p_task_priority_id => p_task_priority_id
1915 , p_owner_type_name => p_owner_type_name
1916 , p_owner_type_code => p_owner_type_code
1917 , p_owner_id => p_owner_id
1918 , p_owner_territory_id => p_owner_territory_id
1919 , p_assigned_by_name => p_assigned_by_name
1920 , p_assigned_by_id => p_assigned_by_id
1921 , p_customer_number => p_customer_number
1922 , p_customer_id => p_customer_id
1923 , p_cust_account_number => p_cust_account_number
1924 , p_cust_account_id => p_cust_account_id
1925 , p_address_id => p_address_id
1926 , p_address_number => p_address_number
1927 , p_planned_start_date => p_planned_start_date
1928 , p_planned_end_date => p_planned_end_date
1929 , p_scheduled_start_date => p_scheduled_start_date
1930 , p_scheduled_end_date => p_scheduled_end_date
1931 , p_actual_start_date => p_actual_start_date
1932 , p_actual_end_date => p_actual_end_date
1933 , p_timezone_id => p_timezone_id
1934 , p_timezone_name => p_timezone_name
1935 , p_source_object_type_code => p_source_object_type_code
1936 , p_source_object_id => p_source_object_id
1937 , p_source_object_name => p_source_object_name
1938 , p_duration => p_duration
1939 , p_duration_uom => p_duration_uom
1940 , p_planned_effort => p_planned_effort
1941 , p_planned_effort_uom => p_planned_effort_uom
1942 , p_actual_effort => p_actual_effort
1943 , p_actual_effort_uom => p_actual_effort_uom
1944 , p_percentage_complete => p_percentage_complete
1945 , p_reason_code => p_reason_code
1946 , p_private_flag => p_private_flag
1947 , p_publish_flag => p_publish_flag
1948 , p_restrict_closure_flag => p_restrict_closure_flag
1949 , p_multi_booked_flag => p_multi_booked_flag
1950 , p_milestone_flag => p_milestone_flag
1951 , p_holiday_flag => p_holiday_flag
1952 , p_billable_flag => p_billable_flag
1953 , p_bound_mode_code => p_bound_mode_code
1954 , p_soft_bound_flag => p_soft_bound_flag
1955 , p_workflow_process_id => p_workflow_process_id
1956 , p_notification_flag => p_notification_flag
1957 , p_notification_period => p_notification_period
1958 , p_notification_period_uom => p_notification_period_uom
1959 , p_parent_task_number => p_parent_task_number
1960 , p_parent_task_id => p_parent_task_id
1961 , p_alarm_start => p_alarm_start
1962 , p_alarm_start_uom => p_alarm_start_uom
1963 , p_alarm_on => p_alarm_on
1964 , p_alarm_count => p_alarm_count
1965 , p_alarm_interval => p_alarm_interval
1966 , p_alarm_interval_uom => p_alarm_interval_uom
1967 , p_palm_flag => p_palm_flag
1968 , p_wince_flag => p_wince_flag
1969 , p_laptop_flag => p_laptop_flag
1970 , p_device1_flag => p_device1_flag
1971 , p_device2_flag => p_device2_flag
1972 , p_device3_flag => p_device3_flag
1973 , p_costs => p_costs
1974 , p_currency_code => p_currency_code
1975 , p_escalation_level => p_escalation_level
1976 , p_task_assign_tbl => p_task_assign_tbl
1977 , p_task_depends_tbl => p_task_depends_tbl
1978 , p_task_rsrc_req_tbl => p_task_rsrc_req_tbl
1979 , p_task_refer_tbl => p_task_refer_tbl
1980 , p_task_dates_tbl => p_task_dates_tbl
1981 , p_task_notes_tbl => p_task_notes_tbl
1982 , p_task_recur_rec => p_task_recur_rec
1983 , p_task_contacts_tbl => p_task_contacts_tbl
1984 , x_return_status => x_return_status
1985 , x_msg_count => x_msg_count
1986 , x_msg_data => x_msg_data
1987 , x_task_id => x_task_id
1988 , p_attribute1 => p_attribute1
1989 , p_attribute2 => p_attribute2
1990 , p_attribute3 => p_attribute3
1991 , p_attribute4 => p_attribute4
1992 , p_attribute5 => p_attribute5
1993 , p_attribute6 => p_attribute6
1994 , p_attribute7 => p_attribute7
1995 , p_attribute8 => p_attribute8
1996 , p_attribute9 => p_attribute9
1997 , p_attribute10 => p_attribute10
2001 , p_attribute14 => p_attribute14
1998 , p_attribute11 => p_attribute11
1999 , p_attribute12 => p_attribute12
2000 , p_attribute13 => p_attribute13
2002 , p_attribute15 => p_attribute15
2003 , p_attribute_category => p_attribute_category
2004 , p_date_selected => p_date_selected
2005 , p_category_id => p_category_id
2006 , p_show_on_calendar => p_show_on_calendar
2007 , p_owner_status_id => p_owner_status_id
2008 , p_template_id => p_template_id
2009 , p_template_group_id => p_template_group_id
2010 , p_enable_workflow => fnd_profile.VALUE('JTF_TASK_ENABLE_WORKFLOW')
2011 , p_abort_workflow => fnd_profile.VALUE('JTF_TASK_ABORT_PREV_WF')
2012 , p_task_split_flag => NULL
2013 , p_reference_flag => NULL
2014 , p_child_position => NULL
2015 , p_child_sequence_num => NULL
2016 , p_location_id => NULL
2017 );
2018
2019 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
2020 x_return_status := fnd_api.g_ret_sts_unexp_error;
2021 RAISE fnd_api.g_exc_unexpected_error;
2022 END IF;
2023
2024 IF fnd_api.to_boolean(p_commit) THEN
2025 COMMIT WORK;
2026 END IF;
2027
2028 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2029 EXCEPTION
2030 WHEN fnd_api.g_exc_unexpected_error THEN
2031 ROLLBACK TO create_task_pub2;
2032 x_return_status := fnd_api.g_ret_sts_unexp_error;
2033 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2034 WHEN OTHERS THEN
2035 ROLLBACK TO create_task_pub2;
2036 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
2037 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
2038 fnd_msg_pub.ADD;
2039 x_return_status := fnd_api.g_ret_sts_unexp_error;
2040 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2041 END;
2042
2043 -- Old Version
2044 PROCEDURE update_task(
2045 p_api_version IN NUMBER
2046 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
2047 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
2048 , p_object_version_number IN OUT NOCOPY NUMBER
2049 , p_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
2050 , p_task_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2051 , p_task_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2052 , p_task_type_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2053 , p_task_type_id IN NUMBER DEFAULT fnd_api.g_miss_num
2054 , p_description IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2055 , p_task_status_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2056 , p_task_status_id IN NUMBER DEFAULT fnd_api.g_miss_num
2057 , p_task_priority_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2058 , p_task_priority_id IN NUMBER DEFAULT fnd_api.g_miss_num
2059 , p_owner_type_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2060 , p_owner_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2061 , p_owner_id IN NUMBER DEFAULT fnd_api.g_miss_num
2062 , p_owner_territory_id IN NUMBER DEFAULT fnd_api.g_miss_num
2063 , p_assigned_by_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2064 , p_assigned_by_id IN NUMBER DEFAULT fnd_api.g_miss_num
2065 , p_customer_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2066 , p_customer_id IN NUMBER DEFAULT fnd_api.g_miss_num
2067 , p_cust_account_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2068 , p_cust_account_id IN NUMBER DEFAULT fnd_api.g_miss_num
2069 , p_address_id IN NUMBER DEFAULT fnd_api.g_miss_num
2070 , p_address_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2071 , p_planned_start_date IN DATE DEFAULT fnd_api.g_miss_date
2072 , p_planned_end_date IN DATE DEFAULT fnd_api.g_miss_date
2073 , p_scheduled_start_date IN DATE DEFAULT fnd_api.g_miss_date
2074 , p_scheduled_end_date IN DATE DEFAULT fnd_api.g_miss_date
2075 , p_actual_start_date IN DATE DEFAULT fnd_api.g_miss_date
2076 , p_actual_end_date IN DATE DEFAULT fnd_api.g_miss_date
2077 , p_timezone_id IN NUMBER DEFAULT fnd_api.g_miss_num
2078 , p_timezone_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2079 , p_source_object_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2080 , p_source_object_id IN NUMBER DEFAULT fnd_api.g_miss_num
2081 , p_source_object_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2082 , p_duration IN NUMBER DEFAULT fnd_api.g_miss_num
2083 , p_duration_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2084 , p_planned_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2085 , p_planned_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2086 , p_actual_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2087 , p_actual_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2088 , p_percentage_complete IN NUMBER DEFAULT fnd_api.g_miss_num
2092 , p_restrict_closure_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2089 , p_reason_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2090 , p_private_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2091 , p_publish_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2093 , p_multi_booked_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2094 , p_milestone_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2095 , p_holiday_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2096 , p_billable_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2097 , p_bound_mode_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2098 , p_soft_bound_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2099 , p_workflow_process_id IN NUMBER DEFAULT fnd_api.g_miss_num
2100 , p_notification_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2101 , p_notification_period IN NUMBER DEFAULT fnd_api.g_miss_num
2102 , p_notification_period_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2103 , p_alarm_start IN NUMBER DEFAULT fnd_api.g_miss_num
2104 , p_alarm_start_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2105 , p_alarm_on IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2106 , p_alarm_count IN NUMBER DEFAULT fnd_api.g_miss_num
2107 , p_alarm_fired_count IN NUMBER DEFAULT fnd_api.g_miss_num
2108 , p_alarm_interval IN NUMBER DEFAULT fnd_api.g_miss_num
2109 , p_alarm_interval_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2110 , p_palm_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2111 , p_wince_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2112 , p_laptop_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2113 , p_device1_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2114 , p_device2_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2115 , p_device3_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2116 , p_costs IN NUMBER DEFAULT fnd_api.g_miss_num
2117 , p_currency_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2118 , p_escalation_level IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2119 , x_return_status OUT NOCOPY VARCHAR2
2120 , x_msg_count OUT NOCOPY NUMBER
2121 , x_msg_data OUT NOCOPY VARCHAR2
2122 , p_attribute1 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2123 , p_attribute2 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2124 , p_attribute3 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2125 , p_attribute4 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2126 , p_attribute5 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2127 , p_attribute6 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2128 , p_attribute7 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2129 , p_attribute8 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2130 , p_attribute9 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2131 , p_attribute10 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2132 , p_attribute11 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2133 , p_attribute12 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2134 , p_attribute13 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2135 , p_attribute14 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2136 , p_attribute15 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2137 , p_attribute_category IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2138 , p_date_selected IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2139 , p_category_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2140 , p_show_on_calendar IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2141 , p_owner_status_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2142 , p_parent_task_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2143 , p_parent_task_number IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2144 ) IS
2145 l_api_version CONSTANT NUMBER := 1.0;
2146 l_api_name CONSTANT VARCHAR2(30) := 'UPDATE_TASK';
2147 BEGIN
2148 SAVEPOINT update_task_pub1;
2149
2150 -----------
2151 -----------
2152 -----------
2153 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
2154 RAISE fnd_api.g_exc_unexpected_error;
2155 END IF;
2156
2157 IF fnd_api.to_boolean(p_init_msg_list) THEN
2158 fnd_msg_pub.initialize;
2159 END IF;
2160
2161 update_task
2162 (
2163 p_api_version => 1.0
2164 , p_init_msg_list => fnd_api.g_false
2165 , --commented out as it cleared stack fnd_api.g_true,
2166 p_commit => fnd_api.g_false
2167 , p_object_version_number => p_object_version_number
2168 , p_task_id => p_task_id
2169 , p_task_number => p_task_number
2170 , p_task_name => p_task_name
2171 , p_task_type_name => p_task_type_name
2172 , p_task_type_id => p_task_type_id
2176 , p_task_priority_name => p_task_priority_name
2173 , p_description => p_description
2174 , p_task_status_name => p_task_status_name
2175 , p_task_status_id => p_task_status_id
2177 , p_task_priority_id => p_task_priority_id
2178 , p_owner_type_name => p_owner_type_name
2179 , p_owner_type_code => p_owner_type_code
2180 , p_owner_id => p_owner_id
2181 , p_owner_territory_id => p_owner_territory_id
2182 , p_assigned_by_name => p_assigned_by_name
2183 , p_assigned_by_id => p_assigned_by_id
2184 , p_customer_number => p_customer_number
2185 , p_customer_id => p_customer_id
2186 , p_cust_account_number => p_cust_account_number
2187 , p_cust_account_id => p_cust_account_id
2188 , p_address_id => p_address_id
2189 , p_address_number => p_address_number
2190 , p_planned_start_date => p_planned_start_date
2191 , p_planned_end_date => p_planned_end_date
2192 , p_scheduled_start_date => p_scheduled_start_date
2193 , p_scheduled_end_date => p_scheduled_end_date
2194 , p_actual_start_date => p_actual_start_date
2195 , p_actual_end_date => p_actual_end_date
2196 , p_timezone_id => p_timezone_id
2197 , p_timezone_name => p_timezone_name
2198 , p_source_object_type_code => p_source_object_type_code
2199 , p_source_object_id => p_source_object_id
2200 , p_source_object_name => p_source_object_name
2201 , p_duration => p_duration
2202 , p_duration_uom => p_duration_uom
2203 , p_planned_effort => p_planned_effort
2204 , p_planned_effort_uom => p_planned_effort_uom
2205 , p_actual_effort => p_actual_effort
2206 , p_actual_effort_uom => p_actual_effort_uom
2207 , p_percentage_complete => p_percentage_complete
2208 , p_reason_code => p_reason_code
2209 , p_private_flag => p_private_flag
2210 , p_publish_flag => p_publish_flag
2211 , p_restrict_closure_flag => p_restrict_closure_flag
2212 , p_multi_booked_flag => p_multi_booked_flag
2213 , p_milestone_flag => p_milestone_flag
2214 , p_holiday_flag => p_holiday_flag
2215 , p_billable_flag => p_billable_flag
2216 , p_bound_mode_code => p_bound_mode_code
2217 , p_soft_bound_flag => p_soft_bound_flag
2218 , p_workflow_process_id => p_workflow_process_id
2219 , p_notification_flag => p_notification_flag
2220 , p_notification_period => p_notification_period
2221 , p_notification_period_uom => p_notification_period_uom
2222 , p_alarm_start => p_alarm_start
2223 , p_alarm_start_uom => p_alarm_start_uom
2224 , p_alarm_on => p_alarm_on
2225 , p_alarm_count => p_alarm_count
2226 , p_alarm_fired_count => p_alarm_fired_count
2227 , p_alarm_interval => p_alarm_interval
2228 , p_alarm_interval_uom => p_alarm_interval_uom
2229 , p_palm_flag => p_palm_flag
2230 , p_wince_flag => p_wince_flag
2231 , p_laptop_flag => p_laptop_flag
2232 , p_device1_flag => p_device1_flag
2233 , p_device2_flag => p_device2_flag
2234 , p_device3_flag => p_device3_flag
2235 , p_costs => p_costs
2236 , p_currency_code => p_currency_code
2237 , p_escalation_level => p_escalation_level
2238 , x_return_status => x_return_status
2239 , x_msg_count => x_msg_count
2240 , x_msg_data => x_msg_data
2241 , p_attribute1 => p_attribute1
2242 , p_attribute2 => p_attribute2
2243 , p_attribute3 => p_attribute3
2244 , p_attribute4 => p_attribute4
2245 , p_attribute5 => p_attribute5
2246 , p_attribute6 => p_attribute6
2247 , p_attribute7 => p_attribute7
2248 , p_attribute8 => p_attribute8
2249 , p_attribute9 => p_attribute9
2250 , p_attribute10 => p_attribute10
2251 , p_attribute11 => p_attribute11
2252 , p_attribute12 => p_attribute12
2253 , p_attribute13 => p_attribute13
2254 , p_attribute14 => p_attribute14
2255 , p_attribute15 => p_attribute15
2256 , p_attribute_category => p_attribute_category
2257 , p_date_selected => p_date_selected
2258 , p_category_id => p_category_id
2259 , p_show_on_calendar => p_show_on_calendar
2260 , p_owner_status_id => p_owner_status_id
2261 , p_parent_task_id => p_parent_task_id
2262 , p_parent_task_number => p_parent_task_number
2263 , p_enable_workflow => fnd_profile.VALUE('JTF_TASK_ENABLE_WORKFLOW')
2264 , p_abort_workflow => fnd_profile.VALUE('JTF_TASK_ABORT_PREV_WF')
2265 );
2266
2267 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
2271
2268 x_return_status := fnd_api.g_ret_sts_unexp_error;
2269 RAISE fnd_api.g_exc_unexpected_error;
2270 END IF;
2272 -------
2273 -------
2274 -------
2275 IF fnd_api.to_boolean(p_commit) THEN
2276 COMMIT WORK;
2277 END IF;
2278
2279 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2280 EXCEPTION
2281 WHEN fnd_api.g_exc_unexpected_error THEN
2282 ROLLBACK TO update_task_pub1;
2283 x_return_status := fnd_api.g_ret_sts_unexp_error;
2284 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2285 WHEN OTHERS THEN
2286 ROLLBACK TO update_task_pub1;
2287 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
2288 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
2289 fnd_msg_pub.ADD;
2290 x_return_status := fnd_api.g_ret_sts_unexp_error;
2291 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2292 END;
2293
2294 -- Old Version
2295 PROCEDURE update_task(
2296 p_api_version IN NUMBER
2297 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
2298 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
2299 , p_object_version_number IN OUT NOCOPY NUMBER
2300 , p_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
2301 , p_task_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2302 , p_task_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2303 , p_task_type_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2304 , p_task_type_id IN NUMBER DEFAULT fnd_api.g_miss_num
2305 , p_description IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2306 , p_task_status_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2307 , p_task_status_id IN NUMBER DEFAULT fnd_api.g_miss_num
2308 , p_task_priority_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2309 , p_task_priority_id IN NUMBER DEFAULT fnd_api.g_miss_num
2310 , p_owner_type_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2311 , p_owner_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2312 , p_owner_id IN NUMBER DEFAULT fnd_api.g_miss_num
2313 , p_owner_territory_id IN NUMBER DEFAULT fnd_api.g_miss_num
2314 , p_assigned_by_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2315 , p_assigned_by_id IN NUMBER DEFAULT fnd_api.g_miss_num
2316 , p_customer_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2317 , p_customer_id IN NUMBER DEFAULT fnd_api.g_miss_num
2318 , p_cust_account_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2319 , p_cust_account_id IN NUMBER DEFAULT fnd_api.g_miss_num
2320 , p_address_id IN NUMBER DEFAULT fnd_api.g_miss_num
2321 , p_address_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2322 , p_planned_start_date IN DATE DEFAULT fnd_api.g_miss_date
2323 , p_planned_end_date IN DATE DEFAULT fnd_api.g_miss_date
2324 , p_scheduled_start_date IN DATE DEFAULT fnd_api.g_miss_date
2325 , p_scheduled_end_date IN DATE DEFAULT fnd_api.g_miss_date
2326 , p_actual_start_date IN DATE DEFAULT fnd_api.g_miss_date
2327 , p_actual_end_date IN DATE DEFAULT fnd_api.g_miss_date
2328 , p_timezone_id IN NUMBER DEFAULT fnd_api.g_miss_num
2329 , p_timezone_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2330 , p_source_object_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2331 , p_source_object_id IN NUMBER DEFAULT fnd_api.g_miss_num
2332 , p_source_object_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2333 , p_duration IN NUMBER DEFAULT fnd_api.g_miss_num
2334 , p_duration_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2335 , p_planned_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2336 , p_planned_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2337 , p_actual_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2338 , p_actual_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2339 , p_percentage_complete IN NUMBER DEFAULT fnd_api.g_miss_num
2340 , p_reason_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2341 , p_private_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2342 , p_publish_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2343 , p_restrict_closure_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2344 , p_multi_booked_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2345 , p_milestone_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2346 , p_holiday_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2347 , p_billable_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2348 , p_bound_mode_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2349 , p_soft_bound_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2350 , p_workflow_process_id IN NUMBER DEFAULT fnd_api.g_miss_num
2354 , p_alarm_start IN NUMBER DEFAULT fnd_api.g_miss_num
2351 , p_notification_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2352 , p_notification_period IN NUMBER DEFAULT fnd_api.g_miss_num
2353 , p_notification_period_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2355 , p_alarm_start_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2356 , p_alarm_on IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2357 , p_alarm_count IN NUMBER DEFAULT fnd_api.g_miss_num
2358 , p_alarm_fired_count IN NUMBER DEFAULT fnd_api.g_miss_num
2359 , p_alarm_interval IN NUMBER DEFAULT fnd_api.g_miss_num
2360 , p_alarm_interval_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2361 , p_palm_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2362 , p_wince_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2363 , p_laptop_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2364 , p_device1_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2365 , p_device2_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2366 , p_device3_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2367 , p_costs IN NUMBER DEFAULT fnd_api.g_miss_num
2368 , p_currency_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2369 , p_escalation_level IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2370 , x_return_status OUT NOCOPY VARCHAR2
2371 , x_msg_count OUT NOCOPY NUMBER
2372 , x_msg_data OUT NOCOPY VARCHAR2
2373 , p_attribute1 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2374 , p_attribute2 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2375 , p_attribute3 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2376 , p_attribute4 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2377 , p_attribute5 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2378 , p_attribute6 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2379 , p_attribute7 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2380 , p_attribute8 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2381 , p_attribute9 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2382 , p_attribute10 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2383 , p_attribute11 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2384 , p_attribute12 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2385 , p_attribute13 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2386 , p_attribute14 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2387 , p_attribute15 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2388 , p_attribute_category IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2389 , p_date_selected IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2390 , p_category_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2391 , p_show_on_calendar IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2392 , p_owner_status_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2393 , p_parent_task_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2394 , p_parent_task_number IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2395 , p_enable_workflow IN VARCHAR2
2396 , p_abort_workflow IN VARCHAR2
2397 ) IS
2398 l_api_version CONSTANT NUMBER := 1.0;
2399 l_api_name CONSTANT VARCHAR2(30) := 'UPDATE_TASK';
2400 BEGIN
2401 SAVEPOINT update_task_pub2;
2402
2403 -----------
2404 -----------
2405 -----------
2406 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
2407 RAISE fnd_api.g_exc_unexpected_error;
2408 END IF;
2409
2410 IF fnd_api.to_boolean(p_init_msg_list) THEN
2411 fnd_msg_pub.initialize;
2412 END IF;
2413
2414 update_task
2415 (
2416 p_api_version => 1.0
2417 , p_init_msg_list => fnd_api.g_false
2418 , --commented out as it cleared stack fnd_api.g_true,
2419 p_commit => fnd_api.g_false
2420 , p_object_version_number => p_object_version_number
2421 , p_task_id => p_task_id
2422 , p_task_number => p_task_number
2423 , p_task_name => p_task_name
2424 , p_task_type_name => p_task_type_name
2425 , p_task_type_id => p_task_type_id
2426 , p_description => p_description
2427 , p_task_status_name => p_task_status_name
2428 , p_task_status_id => p_task_status_id
2429 , p_task_priority_name => p_task_priority_name
2430 , p_task_priority_id => p_task_priority_id
2431 , p_owner_type_name => p_owner_type_name
2432 , p_owner_type_code => p_owner_type_code
2433 , p_owner_id => p_owner_id
2434 , p_owner_territory_id => p_owner_territory_id
2435 , p_assigned_by_name => p_assigned_by_name
2436 , p_assigned_by_id => p_assigned_by_id
2440 , p_cust_account_id => p_cust_account_id
2437 , p_customer_number => p_customer_number
2438 , p_customer_id => p_customer_id
2439 , p_cust_account_number => p_cust_account_number
2441 , p_address_id => p_address_id
2442 , p_address_number => p_address_number
2443 , p_planned_start_date => p_planned_start_date
2444 , p_planned_end_date => p_planned_end_date
2445 , p_scheduled_start_date => p_scheduled_start_date
2446 , p_scheduled_end_date => p_scheduled_end_date
2447 , p_actual_start_date => p_actual_start_date
2448 , p_actual_end_date => p_actual_end_date
2449 , p_timezone_id => p_timezone_id
2450 , p_timezone_name => p_timezone_name
2451 , p_source_object_type_code => p_source_object_type_code
2452 , p_source_object_id => p_source_object_id
2453 , p_source_object_name => p_source_object_name
2454 , p_duration => p_duration
2455 , p_duration_uom => p_duration_uom
2456 , p_planned_effort => p_planned_effort
2457 , p_planned_effort_uom => p_planned_effort_uom
2458 , p_actual_effort => p_actual_effort
2459 , p_actual_effort_uom => p_actual_effort_uom
2460 , p_percentage_complete => p_percentage_complete
2461 , p_reason_code => p_reason_code
2462 , p_private_flag => p_private_flag
2463 , p_publish_flag => p_publish_flag
2464 , p_restrict_closure_flag => p_restrict_closure_flag
2465 , p_multi_booked_flag => p_multi_booked_flag
2466 , p_milestone_flag => p_milestone_flag
2467 , p_holiday_flag => p_holiday_flag
2468 , p_billable_flag => p_billable_flag
2469 , p_bound_mode_code => p_bound_mode_code
2470 , p_soft_bound_flag => p_soft_bound_flag
2471 , p_workflow_process_id => p_workflow_process_id
2472 , p_notification_flag => p_notification_flag
2473 , p_notification_period => p_notification_period
2474 , p_notification_period_uom => p_notification_period_uom
2475 , p_alarm_start => p_alarm_start
2476 , p_alarm_start_uom => p_alarm_start_uom
2477 , p_alarm_on => p_alarm_on
2478 , p_alarm_count => p_alarm_count
2479 , p_alarm_fired_count => p_alarm_fired_count
2480 , p_alarm_interval => p_alarm_interval
2481 , p_alarm_interval_uom => p_alarm_interval_uom
2482 , p_palm_flag => p_palm_flag
2483 , p_wince_flag => p_wince_flag
2484 , p_laptop_flag => p_laptop_flag
2485 , p_device1_flag => p_device1_flag
2486 , p_device2_flag => p_device2_flag
2487 , p_device3_flag => p_device3_flag
2488 , p_costs => p_costs
2489 , p_currency_code => p_currency_code
2490 , p_escalation_level => p_escalation_level
2491 , x_return_status => x_return_status
2492 , x_msg_count => x_msg_count
2493 , x_msg_data => x_msg_data
2494 , p_attribute1 => p_attribute1
2495 , p_attribute2 => p_attribute2
2496 , p_attribute3 => p_attribute3
2497 , p_attribute4 => p_attribute4
2498 , p_attribute5 => p_attribute5
2499 , p_attribute6 => p_attribute6
2500 , p_attribute7 => p_attribute7
2501 , p_attribute8 => p_attribute8
2502 , p_attribute9 => p_attribute9
2503 , p_attribute10 => p_attribute10
2504 , p_attribute11 => p_attribute11
2505 , p_attribute12 => p_attribute12
2506 , p_attribute13 => p_attribute13
2507 , p_attribute14 => p_attribute14
2508 , p_attribute15 => p_attribute15
2509 , p_attribute_category => p_attribute_category
2510 , p_date_selected => p_date_selected
2511 , p_category_id => p_category_id
2512 , p_show_on_calendar => p_show_on_calendar
2513 , p_owner_status_id => p_owner_status_id
2514 , p_parent_task_id => p_parent_task_id
2515 , p_parent_task_number => p_parent_task_number
2516 , p_enable_workflow => p_enable_workflow
2517 , p_abort_workflow => p_abort_workflow
2518 , p_task_split_flag => fnd_api.g_miss_char
2519 , p_child_position => fnd_api.g_miss_char
2520 , p_child_sequence_num => fnd_api.g_miss_num
2521 );
2522
2523 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
2524 x_return_status := fnd_api.g_ret_sts_unexp_error;
2525 RAISE fnd_api.g_exc_unexpected_error;
2526 END IF;
2527
2528 -------
2529 -------
2530 -------
2531 IF fnd_api.to_boolean(p_commit) THEN
2532 COMMIT WORK;
2533 END IF;
2534
2535 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2536 EXCEPTION
2537 WHEN fnd_api.g_exc_unexpected_error THEN
2538 ROLLBACK TO update_task_pub2;
2542 ROLLBACK TO update_task_pub2;
2539 x_return_status := fnd_api.g_ret_sts_unexp_error;
2540 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2541 WHEN OTHERS THEN
2543 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
2544 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
2545 fnd_msg_pub.ADD;
2546 x_return_status := fnd_api.g_ret_sts_unexp_error;
2547 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2548 END;
2549
2550 -- Old version
2551 PROCEDURE update_task(
2552 p_api_version IN NUMBER
2553 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
2554 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
2555 , p_object_version_number IN OUT NOCOPY NUMBER
2556 , p_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
2557 , p_task_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2558 , p_task_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2559 , p_task_type_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2560 , p_task_type_id IN NUMBER DEFAULT fnd_api.g_miss_num
2561 , p_description IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2562 , p_task_status_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2563 , p_task_status_id IN NUMBER DEFAULT fnd_api.g_miss_num
2564 , p_task_priority_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2565 , p_task_priority_id IN NUMBER DEFAULT fnd_api.g_miss_num
2566 , p_owner_type_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2567 , p_owner_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2568 , p_owner_id IN NUMBER DEFAULT fnd_api.g_miss_num
2569 , p_owner_territory_id IN NUMBER DEFAULT fnd_api.g_miss_num
2570 , p_assigned_by_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2571 , p_assigned_by_id IN NUMBER DEFAULT fnd_api.g_miss_num
2572 , p_customer_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2573 , p_customer_id IN NUMBER DEFAULT fnd_api.g_miss_num
2574 , p_cust_account_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2575 , p_cust_account_id IN NUMBER DEFAULT fnd_api.g_miss_num
2576 , p_address_id IN NUMBER DEFAULT fnd_api.g_miss_num
2577 , p_address_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2578 , p_planned_start_date IN DATE DEFAULT fnd_api.g_miss_date
2579 , p_planned_end_date IN DATE DEFAULT fnd_api.g_miss_date
2580 , p_scheduled_start_date IN DATE DEFAULT fnd_api.g_miss_date
2581 , p_scheduled_end_date IN DATE DEFAULT fnd_api.g_miss_date
2582 , p_actual_start_date IN DATE DEFAULT fnd_api.g_miss_date
2583 , p_actual_end_date IN DATE DEFAULT fnd_api.g_miss_date
2584 , p_timezone_id IN NUMBER DEFAULT fnd_api.g_miss_num
2585 , p_timezone_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2586 , p_source_object_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2587 , p_source_object_id IN NUMBER DEFAULT fnd_api.g_miss_num
2588 , p_source_object_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2589 , p_duration IN NUMBER DEFAULT fnd_api.g_miss_num
2590 , p_duration_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2591 , p_planned_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2592 , p_planned_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2593 , p_actual_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2594 , p_actual_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2595 , p_percentage_complete IN NUMBER DEFAULT fnd_api.g_miss_num
2596 , p_reason_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2597 , p_private_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2598 , p_publish_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2599 , p_restrict_closure_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2600 , p_multi_booked_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2601 , p_milestone_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2602 , p_holiday_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2603 , p_billable_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2604 , p_bound_mode_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2605 , p_soft_bound_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2606 , p_workflow_process_id IN NUMBER DEFAULT fnd_api.g_miss_num
2607 , p_notification_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2608 , p_notification_period IN NUMBER DEFAULT fnd_api.g_miss_num
2609 , p_notification_period_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2610 , p_alarm_start IN NUMBER DEFAULT fnd_api.g_miss_num
2611 , p_alarm_start_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2612 , p_alarm_on IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2613 , p_alarm_count IN NUMBER DEFAULT fnd_api.g_miss_num
2614 , p_alarm_fired_count IN NUMBER DEFAULT fnd_api.g_miss_num
2615 , p_alarm_interval IN NUMBER DEFAULT fnd_api.g_miss_num
2619 , p_laptop_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2616 , p_alarm_interval_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2617 , p_palm_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2618 , p_wince_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2620 , p_device1_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2621 , p_device2_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2622 , p_device3_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2623 , p_costs IN NUMBER DEFAULT fnd_api.g_miss_num
2624 , p_currency_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2625 , p_escalation_level IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2626 , x_return_status OUT NOCOPY VARCHAR2
2627 , x_msg_count OUT NOCOPY NUMBER
2628 , x_msg_data OUT NOCOPY VARCHAR2
2629 , p_attribute1 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2630 , p_attribute2 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2631 , p_attribute3 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2632 , p_attribute4 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2633 , p_attribute5 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2634 , p_attribute6 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2635 , p_attribute7 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2636 , p_attribute8 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2637 , p_attribute9 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2638 , p_attribute10 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2639 , p_attribute11 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2640 , p_attribute12 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2641 , p_attribute13 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2642 , p_attribute14 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2643 , p_attribute15 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2644 , p_attribute_category IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2645 , p_date_selected IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2646 , p_category_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2647 , p_show_on_calendar IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2648 , p_owner_status_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2649 , p_parent_task_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2650 , p_parent_task_number IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2651 , p_enable_workflow IN VARCHAR2
2652 , p_abort_workflow IN VARCHAR2
2653 , p_task_split_flag IN VARCHAR2
2654 , p_child_position IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2655 , p_child_sequence_num IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2656 ) IS
2657 l_api_version CONSTANT NUMBER := 1.0;
2658 l_api_name CONSTANT VARCHAR2(30) := 'UPDATE_TASK';
2659 BEGIN
2660 SAVEPOINT update_task_pub3;
2661
2662 -----------
2663 -----------
2664 -----------
2665 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
2666 RAISE fnd_api.g_exc_unexpected_error;
2667 END IF;
2668
2669 IF fnd_api.to_boolean(p_init_msg_list) THEN
2670 fnd_msg_pub.initialize;
2671 END IF;
2672
2673 update_task
2674 (
2675 p_api_version => 1.0
2676 , p_init_msg_list => fnd_api.g_false
2677 , --commented out as it cleared stack fnd_api.g_true,
2678 p_commit => fnd_api.g_false
2679 , p_object_version_number => p_object_version_number
2680 , p_task_id => p_task_id
2681 , p_task_number => p_task_number
2682 , p_task_name => p_task_name
2683 , p_task_type_name => p_task_type_name
2684 , p_task_type_id => p_task_type_id
2685 , p_description => p_description
2686 , p_task_status_name => p_task_status_name
2687 , p_task_status_id => p_task_status_id
2688 , p_task_priority_name => p_task_priority_name
2689 , p_task_priority_id => p_task_priority_id
2690 , p_owner_type_name => p_owner_type_name
2691 , p_owner_type_code => p_owner_type_code
2692 , p_owner_id => p_owner_id
2693 , p_owner_territory_id => p_owner_territory_id
2694 , p_assigned_by_name => p_assigned_by_name
2695 , p_assigned_by_id => p_assigned_by_id
2696 , p_customer_number => p_customer_number
2697 , p_customer_id => p_customer_id
2698 , p_cust_account_number => p_cust_account_number
2699 , p_cust_account_id => p_cust_account_id
2700 , p_address_id => p_address_id
2701 , p_address_number => p_address_number
2702 , p_planned_start_date => p_planned_start_date
2703 , p_planned_end_date => p_planned_end_date
2704 , p_scheduled_start_date => p_scheduled_start_date
2705 , p_scheduled_end_date => p_scheduled_end_date
2709 , p_timezone_name => p_timezone_name
2706 , p_actual_start_date => p_actual_start_date
2707 , p_actual_end_date => p_actual_end_date
2708 , p_timezone_id => p_timezone_id
2710 , p_source_object_type_code => p_source_object_type_code
2711 , p_source_object_id => p_source_object_id
2712 , p_source_object_name => p_source_object_name
2713 , p_duration => p_duration
2714 , p_duration_uom => p_duration_uom
2715 , p_planned_effort => p_planned_effort
2716 , p_planned_effort_uom => p_planned_effort_uom
2717 , p_actual_effort => p_actual_effort
2718 , p_actual_effort_uom => p_actual_effort_uom
2719 , p_percentage_complete => p_percentage_complete
2720 , p_reason_code => p_reason_code
2721 , p_private_flag => p_private_flag
2722 , p_publish_flag => p_publish_flag
2723 , p_restrict_closure_flag => p_restrict_closure_flag
2724 , p_multi_booked_flag => p_multi_booked_flag
2725 , p_milestone_flag => p_milestone_flag
2726 , p_holiday_flag => p_holiday_flag
2727 , p_billable_flag => p_billable_flag
2728 , p_bound_mode_code => p_bound_mode_code
2729 , p_soft_bound_flag => p_soft_bound_flag
2730 , p_workflow_process_id => p_workflow_process_id
2731 , p_notification_flag => p_notification_flag
2732 , p_notification_period => p_notification_period
2733 , p_notification_period_uom => p_notification_period_uom
2734 , p_alarm_start => p_alarm_start
2735 , p_alarm_start_uom => p_alarm_start_uom
2736 , p_alarm_on => p_alarm_on
2737 , p_alarm_count => p_alarm_count
2738 , p_alarm_fired_count => p_alarm_fired_count
2739 , p_alarm_interval => p_alarm_interval
2740 , p_alarm_interval_uom => p_alarm_interval_uom
2741 , p_palm_flag => p_palm_flag
2742 , p_wince_flag => p_wince_flag
2743 , p_laptop_flag => p_laptop_flag
2744 , p_device1_flag => p_device1_flag
2745 , p_device2_flag => p_device2_flag
2746 , p_device3_flag => p_device3_flag
2747 , p_costs => p_costs
2748 , p_currency_code => p_currency_code
2749 , p_escalation_level => p_escalation_level
2750 , x_return_status => x_return_status
2751 , x_msg_count => x_msg_count
2752 , x_msg_data => x_msg_data
2753 , p_attribute1 => p_attribute1
2754 , p_attribute2 => p_attribute2
2755 , p_attribute3 => p_attribute3
2756 , p_attribute4 => p_attribute4
2757 , p_attribute5 => p_attribute5
2758 , p_attribute6 => p_attribute6
2759 , p_attribute7 => p_attribute7
2760 , p_attribute8 => p_attribute8
2761 , p_attribute9 => p_attribute9
2762 , p_attribute10 => p_attribute10
2763 , p_attribute11 => p_attribute11
2764 , p_attribute12 => p_attribute12
2765 , p_attribute13 => p_attribute13
2766 , p_attribute14 => p_attribute14
2767 , p_attribute15 => p_attribute15
2768 , p_attribute_category => p_attribute_category
2769 , p_date_selected => p_date_selected
2770 , p_category_id => p_category_id
2771 , p_show_on_calendar => p_show_on_calendar
2772 , p_owner_status_id => p_owner_status_id
2773 , p_parent_task_id => p_parent_task_id
2774 , p_parent_task_number => p_parent_task_number
2775 , p_enable_workflow => p_enable_workflow
2776 , p_abort_workflow => p_abort_workflow
2777 , p_task_split_flag => p_task_split_flag
2778 , p_child_position => p_child_position
2779 , p_child_sequence_num => p_child_sequence_num
2780 , p_location_id => fnd_api.g_miss_num
2781 );
2782
2783 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
2784 x_return_status := fnd_api.g_ret_sts_unexp_error;
2785 RAISE fnd_api.g_exc_unexpected_error;
2786 END IF;
2787
2788 -------
2789 -------
2790 -------
2791 IF fnd_api.to_boolean(p_commit) THEN
2792 COMMIT WORK;
2793 END IF;
2794
2795 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2796 EXCEPTION
2797 WHEN fnd_api.g_exc_unexpected_error THEN
2798 ROLLBACK TO update_task_pub3;
2799 x_return_status := fnd_api.g_ret_sts_unexp_error;
2800 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2801 WHEN OTHERS THEN
2802 ROLLBACK TO update_task_pub3;
2803 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
2804 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
2805 fnd_msg_pub.ADD;
2806 x_return_status := fnd_api.g_ret_sts_unexp_error;
2807 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2808 END;
2809
2810 PROCEDURE update_task(
2811 p_api_version IN NUMBER
2815 , p_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
2812 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
2813 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
2814 , p_object_version_number IN OUT NOCOPY NUMBER
2816 , p_task_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2817 , p_task_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2818 , p_task_type_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2819 , p_task_type_id IN NUMBER DEFAULT fnd_api.g_miss_num
2820 , p_description IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2821 , p_task_status_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2822 , p_task_status_id IN NUMBER DEFAULT fnd_api.g_miss_num
2823 , p_task_priority_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2824 , p_task_priority_id IN NUMBER DEFAULT fnd_api.g_miss_num
2825 , p_owner_type_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2826 , p_owner_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2827 , p_owner_id IN NUMBER DEFAULT fnd_api.g_miss_num
2828 , p_owner_territory_id IN NUMBER DEFAULT fnd_api.g_miss_num
2829 , p_assigned_by_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2830 , p_assigned_by_id IN NUMBER DEFAULT fnd_api.g_miss_num
2831 , p_customer_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2832 , p_customer_id IN NUMBER DEFAULT fnd_api.g_miss_num
2833 , p_cust_account_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2834 , p_cust_account_id IN NUMBER DEFAULT fnd_api.g_miss_num
2835 , p_address_id IN NUMBER DEFAULT fnd_api.g_miss_num
2836 , p_address_number IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2837 , p_planned_start_date IN DATE DEFAULT fnd_api.g_miss_date
2838 , p_planned_end_date IN DATE DEFAULT fnd_api.g_miss_date
2839 , p_scheduled_start_date IN DATE DEFAULT fnd_api.g_miss_date
2840 , p_scheduled_end_date IN DATE DEFAULT fnd_api.g_miss_date
2841 , p_actual_start_date IN DATE DEFAULT fnd_api.g_miss_date
2842 , p_actual_end_date IN DATE DEFAULT fnd_api.g_miss_date
2843 , p_timezone_id IN NUMBER DEFAULT fnd_api.g_miss_num
2844 , p_timezone_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2845 , p_source_object_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2846 , p_source_object_id IN NUMBER DEFAULT fnd_api.g_miss_num
2847 , p_source_object_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2848 , p_duration IN NUMBER DEFAULT fnd_api.g_miss_num
2849 , p_duration_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2850 , p_planned_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2851 , p_planned_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2852 , p_actual_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2853 , p_actual_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2854 , p_percentage_complete IN NUMBER DEFAULT fnd_api.g_miss_num
2855 , p_reason_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2856 , p_private_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2857 , p_publish_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2858 , p_restrict_closure_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2859 , p_multi_booked_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2860 , p_milestone_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2861 , p_holiday_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2862 , p_billable_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2863 , p_bound_mode_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2864 , p_soft_bound_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2865 , p_workflow_process_id IN NUMBER DEFAULT fnd_api.g_miss_num
2866 , p_notification_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2867 , p_notification_period IN NUMBER DEFAULT fnd_api.g_miss_num
2868 , p_notification_period_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2869 , p_alarm_start IN NUMBER DEFAULT fnd_api.g_miss_num
2870 , p_alarm_start_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2871 , p_alarm_on IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2872 , p_alarm_count IN NUMBER DEFAULT fnd_api.g_miss_num
2873 , p_alarm_fired_count IN NUMBER DEFAULT fnd_api.g_miss_num
2874 , p_alarm_interval IN NUMBER DEFAULT fnd_api.g_miss_num
2875 , p_alarm_interval_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2876 , p_palm_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2877 , p_wince_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2878 , p_laptop_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2879 , p_device1_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2880 , p_device2_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2881 , p_device3_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2885 , x_return_status OUT NOCOPY VARCHAR2
2882 , p_costs IN NUMBER DEFAULT fnd_api.g_miss_num
2883 , p_currency_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2884 , p_escalation_level IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2886 , x_msg_count OUT NOCOPY NUMBER
2887 , x_msg_data OUT NOCOPY VARCHAR2
2888 , p_attribute1 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2889 , p_attribute2 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2890 , p_attribute3 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2891 , p_attribute4 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2892 , p_attribute5 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2893 , p_attribute6 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2894 , p_attribute7 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2895 , p_attribute8 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2896 , p_attribute9 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2897 , p_attribute10 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2898 , p_attribute11 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2899 , p_attribute12 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2900 , p_attribute13 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2901 , p_attribute14 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2902 , p_attribute15 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2903 , p_attribute_category IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2904 , p_date_selected IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2905 , p_category_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2906 , p_show_on_calendar IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2907 , p_owner_status_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2908 , p_parent_task_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2909 , p_parent_task_number IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2910 , p_enable_workflow IN VARCHAR2
2911 , p_abort_workflow IN VARCHAR2
2912 , p_task_split_flag IN VARCHAR2
2913 , p_child_position IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2914 , p_child_sequence_num IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2915 , p_location_id IN NUMBER
2916 ) IS
2917 l_api_version CONSTANT NUMBER := 1.0;
2918 l_api_name CONSTANT VARCHAR2(30) := 'UPDATE_TASK';
2919 l_task_id jtf_tasks_b.task_id%TYPE := p_task_id;
2920 l_task_number jtf_tasks_b.task_number%TYPE := p_task_number;
2921 /* Modified by TSINGHAL dt 8/10/2003 for bug fix 3182170 start */
2922 l_task_name jtf_tasks_tl.task_name%TYPE;
2923 /* Modified by TSINGHAL dt 8/10/2003 for bug fix 3182170 End */
2924 l_task_type_name jtf_task_types_tl.NAME%TYPE := p_task_type_name;
2925 l_task_type_id jtf_task_types_b.task_type_id%TYPE := p_task_type_id;
2926 l_task_status_name jtf_task_statuses_tl.NAME%TYPE := p_task_status_name;
2927 l_task_status_id jtf_task_statuses_b.task_status_id%TYPE := p_task_status_id;
2928 l_task_priority_name jtf_task_priorities_tl.NAME%TYPE := p_task_priority_name;
2929 l_task_priority_id jtf_task_priorities_b.task_priority_id%TYPE := p_task_priority_id;
2930 l_assigned_by_name fnd_user.user_name%TYPE := p_assigned_by_name;
2931 l_assigned_by_id NUMBER := p_assigned_by_id;
2932 l_customer_id hz_parties.party_id%TYPE;
2933 l_customer_number hz_parties.party_number%TYPE;
2934 l_cust_account_id hz_cust_accounts.cust_account_id%TYPE;
2935 l_cust_account_number hz_cust_accounts.account_number%TYPE;
2936 l_address_id hz_party_sites.party_site_id%TYPE;
2937 l_location_id hz_locations.location_id%TYPE;
2938 l_address_number hz_party_sites.party_site_number%TYPE;
2939 l_planned_start_date DATE;
2940 l_planned_end_date DATE;
2941 l_scheduled_start_date DATE;
2942 l_scheduled_end_date DATE;
2943 l_actual_start_date DATE;
2944 l_actual_end_date DATE;
2945 l_source_object_type_code jtf_tasks_b.source_object_type_code%TYPE;
2946 l_source_object_id jtf_tasks_b.source_object_id%TYPE;
2947 l_source_object_name jtf_tasks_b.source_object_name%TYPE;
2948 l_timezone_id jtf_tasks_b.timezone_id%TYPE := p_timezone_id;
2949 l_timezone_name hz_timezones.global_timezone_name%TYPE := p_timezone_name;
2950 l_duration jtf_tasks_b.DURATION%TYPE;
2951 l_duration_uom jtf_tasks_b.duration_uom%TYPE;
2952 l_owner_type_code jtf_tasks_b.owner_type_code%TYPE;
2953 l_owner_id jtf_tasks_b.owner_id%TYPE;
2954 l_owner_status_id jtf_task_all_assignments.assignment_status_id%TYPE;
2958 l_publish_flag jtf_tasks_b.publish_flag%TYPE;
2955 l_percentage_complete jtf_tasks_b.percentage_complete%TYPE;
2956 l_reason_code jtf_tasks_b.reason_code%TYPE;
2957 l_private_flag jtf_tasks_b.private_flag%TYPE;
2959 l_restrict_closure_flag jtf_tasks_b.restrict_closure_flag%TYPE;
2960 l_multi_booked_flag jtf_tasks_b.multi_booked_flag%TYPE;
2961 l_palm_flag jtf_tasks_b.palm_flag%TYPE;
2962 l_wince_flag jtf_tasks_b.wince_flag%TYPE;
2963 l_laptop_flag jtf_tasks_b.laptop_flag%TYPE;
2964 l_device1_flag jtf_tasks_b.device1_flag%TYPE;
2965 l_device2_flag jtf_tasks_b.device2_flag%TYPE;
2966 l_device3_flag jtf_tasks_b.device3_flag%TYPE;
2967 l_description jtf_tasks_tl.description%TYPE;
2968 l_planned_effort jtf_tasks_b.planned_effort%TYPE;
2969 l_planned_effort_uom jtf_tasks_b.planned_effort_uom%TYPE;
2970 l_actual_effort jtf_tasks_b.actual_effort%TYPE;
2971 l_actual_effort_uom jtf_tasks_b.actual_effort_uom%TYPE;
2972 l_milestone_flag jtf_tasks_b.milestone_flag%TYPE;
2973 l_holiday_flag jtf_tasks_b.holiday_flag%TYPE;
2974 l_currency_code jtf_tasks_b.currency_code%TYPE;
2975 l_costs jtf_tasks_b.costs%TYPE;
2976 l_notification_flag jtf_tasks_b.notification_flag%TYPE;
2977 l_notification_period jtf_tasks_b.notification_period%TYPE;
2978 l_notification_period_uom jtf_tasks_b.notification_period_uom%TYPE;
2979 l_billable_flag jtf_tasks_b.billable_flag%TYPE;
2980 l_bound_mode_code jtf_tasks_b.bound_mode_code%TYPE;
2981 l_soft_bound_flag jtf_tasks_b.soft_bound_flag%TYPE;
2982 l_workflow_process_id jtf_tasks_b.workflow_process_id%TYPE;
2983 l_parent_task_id jtf_tasks_b.parent_task_id%TYPE;
2984 l_parent_task_number jtf_tasks_b.task_number%TYPE;
2985 l_alarm_start jtf_tasks_b.alarm_start%TYPE;
2986 l_alarm_start_uom jtf_tasks_b.alarm_start_uom%TYPE;
2987 l_alarm_on jtf_tasks_b.alarm_on%TYPE;
2988 l_alarm_count jtf_tasks_b.alarm_count%TYPE;
2989 l_alarm_fired_count jtf_tasks_b.alarm_fired_count%TYPE;
2990 l_alarm_interval jtf_tasks_b.alarm_interval%TYPE;
2991 l_alarm_interval_uom jtf_tasks_b.alarm_interval_uom%TYPE;
2992 l_owner_type_name jtf_objects_tl.NAME%TYPE;
2993 l_date_selected jtf_tasks_b.date_selected%TYPE;
2994 l_type VARCHAR2(10);
2995 y BOOLEAN;
2996 l_task_split_flag jtf_tasks_b.task_split_flag%TYPE;
2997
2998 CURSOR c_task_update(l_task_id IN NUMBER) IS
2999 SELECT DECODE(p_task_id, fnd_api.g_miss_num, task_id, p_task_id) task_id
3000 , DECODE(p_task_number, fnd_api.g_miss_char, task_number, p_task_number) task_number
3001 , DECODE(p_task_name, fnd_api.g_miss_char, task_name, p_task_name) task_name
3002 , DECODE(p_task_type_id, fnd_api.g_miss_num, task_type_id, p_task_type_id) task_type_id
3003 , DECODE(p_description, fnd_api.g_miss_char, description, p_description) description
3004 , DECODE(p_task_status_id, fnd_api.g_miss_num, task_status_id, p_task_status_id)
3005 task_status_id
3006 , DECODE(p_task_priority_id, fnd_api.g_miss_num, task_priority_id, p_task_priority_id)
3007 task_priority_id
3008 , DECODE(p_owner_type_code, fnd_api.g_miss_char, owner_type_code, p_owner_type_code)
3009 owner_type_code
3010 , DECODE(p_owner_id, fnd_api.g_miss_num, owner_id, p_owner_id) owner_id
3011 , DECODE(
3012 p_owner_territory_id
3013 , fnd_api.g_miss_num, owner_territory_id
3014 , p_owner_territory_id
3015 ) owner_territory_id
3016 , DECODE(p_assigned_by_id, fnd_api.g_miss_num, assigned_by_id, p_assigned_by_id)
3017 assigned_by_id
3018 , DECODE(p_customer_id, fnd_api.g_miss_num, customer_id, p_customer_id) customer_id
3019 , DECODE(p_cust_account_id, fnd_api.g_miss_num, cust_account_id, p_cust_account_id)
3020 cust_account_id
3021 , DECODE(p_address_id, fnd_api.g_miss_num, address_id, p_address_id) address_id
3022 , DECODE(p_location_id, fnd_api.g_miss_num, location_id, p_location_id) location_id
3023 , DECODE(
3024 p_planned_start_date
3025 , fnd_api.g_miss_date, planned_start_date
3026 , p_planned_start_date
3027 ) planned_start_date
3028 , DECODE(p_planned_end_date, fnd_api.g_miss_date, planned_end_date, p_planned_end_date)
3029 planned_end_date
3030 , DECODE(
3031 p_scheduled_start_date
3032 , fnd_api.g_miss_date, scheduled_start_date
3033 , p_scheduled_start_date
3034 ) scheduled_start_date
3035 , DECODE(
3036 p_scheduled_end_date
3037 , fnd_api.g_miss_date, scheduled_end_date
3038 , p_scheduled_end_date
3039 ) scheduled_end_date
3040 , DECODE(
3041 p_actual_start_date
3045 , DECODE(p_actual_end_date, fnd_api.g_miss_date, actual_end_date, p_actual_end_date)
3042 , fnd_api.g_miss_date, actual_start_date
3043 , p_actual_start_date
3044 ) actual_start_date
3046 actual_end_date
3047 , DECODE(p_timezone_id, fnd_api.g_miss_num, timezone_id, p_timezone_id) timezone_id
3048 , DECODE(
3049 p_source_object_type_code
3050 , fnd_api.g_miss_char, source_object_type_code
3051 , p_source_object_type_code
3052 ) source_object_type_code
3053 , DECODE(p_source_object_id, fnd_api.g_miss_num, source_object_id, p_source_object_id)
3054 source_object_id
3055 , DECODE(
3056 p_source_object_name
3057 , fnd_api.g_miss_char, source_object_name
3058 , jtf_task_utl.check_truncation(p_source_object_name)
3059 ) source_object_name
3060 , DECODE(p_duration, fnd_api.g_miss_num, DURATION, p_duration) DURATION
3061 , DECODE(p_duration_uom, fnd_api.g_miss_char, duration_uom, p_duration_uom) duration_uom
3062 , DECODE(p_planned_effort, fnd_api.g_miss_num, planned_effort, p_planned_effort)
3063 planned_effort
3064 , DECODE(
3065 p_planned_effort_uom
3066 , fnd_api.g_miss_char, planned_effort_uom
3067 , p_planned_effort_uom
3068 ) planned_effort_uom
3069 , DECODE(p_actual_effort, fnd_api.g_miss_num, actual_effort, p_actual_effort)
3070 actual_effort
3071 , DECODE(
3072 p_actual_effort_uom
3073 , fnd_api.g_miss_char, actual_effort_uom
3074 , p_actual_effort_uom
3075 ) actual_effort_uom
3076 , DECODE(
3077 p_percentage_complete
3078 , fnd_api.g_miss_num, percentage_complete
3079 , p_percentage_complete
3080 ) percentage_complete
3081 , DECODE(p_reason_code, fnd_api.g_miss_char, reason_code, p_reason_code) reason_code
3082 , DECODE(p_private_flag, fnd_api.g_miss_char, private_flag, p_private_flag) private_flag
3083 , DECODE(p_publish_flag, fnd_api.g_miss_char, publish_flag, p_publish_flag) publish_flag
3084 , DECODE(
3085 p_restrict_closure_flag
3086 , fnd_api.g_miss_char, restrict_closure_flag
3087 , p_restrict_closure_flag
3088 ) restrict_closure_flag
3089 , DECODE(
3090 p_multi_booked_flag
3091 , fnd_api.g_miss_char, multi_booked_flag
3092 , p_multi_booked_flag
3093 ) multi_booked_flag
3094 , DECODE(p_milestone_flag, fnd_api.g_miss_char, milestone_flag, p_milestone_flag)
3095 milestone_flag
3096 , DECODE(p_holiday_flag, fnd_api.g_miss_char, holiday_flag, p_holiday_flag) holiday_flag
3097 , DECODE(p_billable_flag, fnd_api.g_miss_char, billable_flag, p_billable_flag)
3098 billable_flag
3099 , DECODE(p_bound_mode_code, fnd_api.g_miss_char, bound_mode_code, p_bound_mode_code)
3100 bound_mode_code
3101 , DECODE(p_soft_bound_flag, fnd_api.g_miss_char, soft_bound_flag, p_soft_bound_flag)
3102 soft_bound_flag
3103 , DECODE(
3104 p_workflow_process_id
3105 , fnd_api.g_miss_num, workflow_process_id
3106 , p_workflow_process_id
3107 ) workflow_process_id
3108 , DECODE(
3109 p_notification_flag
3110 , fnd_api.g_miss_char, notification_flag
3111 , p_notification_flag
3112 ) notification_flag
3113 , DECODE(
3114 p_notification_period
3115 , fnd_api.g_miss_num, notification_period
3116 , p_notification_period
3117 ) notification_period
3118 , DECODE(
3119 p_notification_period_uom
3120 , fnd_api.g_miss_char, notification_period_uom
3121 , p_notification_period_uom
3122 ) notification_period_uom
3123 , DECODE(p_alarm_start, fnd_api.g_miss_num, alarm_start, p_alarm_start) alarm_start
3124 , DECODE(p_alarm_start_uom, fnd_api.g_miss_char, alarm_start_uom, p_alarm_start_uom)
3125 alarm_start_uom
3126 , DECODE(p_alarm_on, fnd_api.g_miss_char, alarm_on, p_alarm_on) alarm_on
3127 , DECODE(p_alarm_count, fnd_api.g_miss_num, alarm_count, p_alarm_count) alarm_count
3128 , DECODE(
3129 p_alarm_fired_count
3130 , fnd_api.g_miss_num, alarm_fired_count
3131 , p_alarm_fired_count
3132 ) alarm_fired_count
3133 , DECODE(p_alarm_interval, fnd_api.g_miss_num, alarm_interval, p_alarm_interval)
3137 , fnd_api.g_miss_char, alarm_interval_uom
3134 alarm_interval
3135 , DECODE(
3136 p_alarm_interval_uom
3138 , p_alarm_interval_uom
3139 ) alarm_interval_uom
3140 , DECODE(p_palm_flag, fnd_api.g_miss_char, palm_flag, p_palm_flag) palm_flag
3141 , DECODE(p_wince_flag, fnd_api.g_miss_char, wince_flag, p_wince_flag) wince_flag
3142 , DECODE(p_laptop_flag, fnd_api.g_miss_char, laptop_flag, p_laptop_flag) laptop_flag
3143 , DECODE(p_device1_flag, fnd_api.g_miss_char, device1_flag, p_device1_flag) device1_flag
3144 , DECODE(p_device2_flag, fnd_api.g_miss_char, device2_flag, p_device2_flag) device2_flag
3145 , DECODE(p_device3_flag, fnd_api.g_miss_char, device3_flag, p_device3_flag) device3_flag
3146 , DECODE(p_costs, fnd_api.g_miss_num, costs, p_costs) costs
3147 , DECODE(p_currency_code, fnd_api.g_miss_char, currency_code, p_currency_code)
3148 currency_code
3149 , DECODE(p_escalation_level, fnd_api.g_miss_char, escalation_level, p_escalation_level)
3150 escalation_level
3151 , DECODE(p_attribute1, fnd_api.g_miss_char, attribute1, p_attribute1) attribute1
3152 , DECODE(p_attribute2, fnd_api.g_miss_char, attribute2, p_attribute2) attribute2
3153 , DECODE(p_attribute3, fnd_api.g_miss_char, attribute3, p_attribute3) attribute3
3154 , DECODE(p_attribute4, fnd_api.g_miss_char, attribute4, p_attribute4) attribute4
3155 , DECODE(p_attribute5, fnd_api.g_miss_char, attribute5, p_attribute5) attribute5
3156 , DECODE(p_attribute6, fnd_api.g_miss_char, attribute6, p_attribute6) attribute6
3157 , DECODE(p_attribute7, fnd_api.g_miss_char, attribute7, p_attribute7) attribute7
3158 , DECODE(p_attribute8, fnd_api.g_miss_char, attribute8, p_attribute8) attribute8
3159 , DECODE(p_attribute9, fnd_api.g_miss_char, attribute9, p_attribute9) attribute9
3160 , DECODE(p_attribute10, fnd_api.g_miss_char, attribute10, p_attribute10) attribute10
3161 , DECODE(p_attribute11, fnd_api.g_miss_char, attribute11, p_attribute11) attribute11
3162 , DECODE(p_attribute12, fnd_api.g_miss_char, attribute12, p_attribute12) attribute12
3163 , DECODE(p_attribute13, fnd_api.g_miss_char, attribute13, p_attribute13) attribute13
3164 , DECODE(p_attribute14, fnd_api.g_miss_char, attribute14, p_attribute14) attribute14
3165 , DECODE(p_attribute15, fnd_api.g_miss_char, attribute15, p_attribute15) attribute15
3166 , DECODE(
3167 p_attribute_category
3168 , fnd_api.g_miss_char, attribute_category
3169 , p_attribute_category
3170 ) attribute_category
3171 , DECODE(p_date_selected, fnd_api.g_miss_char, date_selected, p_date_selected)
3172 date_selected
3173 , DECODE(p_parent_task_id, fnd_api.g_miss_num, parent_task_id, p_parent_task_id)
3174 parent_task_id
3175 , DECODE(p_task_split_flag, fnd_api.g_miss_char, task_split_flag, p_task_split_flag)
3176 task_split_flag
3177 , DECODE(p_child_position, fnd_api.g_miss_char, child_position, p_child_position)
3178 child_position
3179 , DECODE(
3180 p_child_sequence_num
3181 , fnd_api.g_miss_num, child_sequence_num
3182 , p_child_sequence_num
3183 ) child_sequence_num
3184 FROM jtf_tasks_vl
3185 WHERE task_id = l_task_id;
3186
3187 task_rec c_task_update%ROWTYPE;
3188
3189 CURSOR c_owner_status_id(b_owner_status_id jtf_task_all_assignments.assignment_status_id%TYPE) IS
3190 SELECT task_status_id
3191 FROM jtf_task_statuses_b
3192 WHERE task_status_id = b_owner_status_id
3193 --AND assigned_flag = 'Y'
3194 AND assignment_status_flag = 'Y' -- Fix bug 2500664
3195 AND NVL(end_date_active, SYSDATE) >= SYSDATE
3196 AND NVL(start_date_active, SYSDATE) <= SYSDATE;
3197 BEGIN
3198 SAVEPOINT update_task_pub;
3199
3200 -----------
3201 -----------
3202 -----------
3203 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
3204 RAISE fnd_api.g_exc_unexpected_error;
3205 END IF;
3206
3207 IF fnd_api.to_boolean(p_init_msg_list) THEN
3208 fnd_msg_pub.initialize;
3209 END IF;
3210
3211 /* Modified by TSINGHAL bug fix Validate task name length 3182170 Start*/
3212 l_task_name :=
3213 check_param_length(p_task_name, 'JTF_TASK_NAME_INVALID_LENGTH', 80);
3214 /* Modified by TSINGHAL bug fix 3182170 End*/
3215
3216 /* --------
3217 -------- Call the Internal User Hook
3218 --------
3219 p_task_user_hooks.task_id := p_task_id;
3220 p_task_user_hooks.task_name := p_task_name;
3221 p_task_user_hooks.task_type_name := p_task_type_name;
3222 p_task_user_hooks.task_type_id := p_task_type_id;
3226 p_task_user_hooks.task_priority_name := p_task_priority_name;
3223 p_task_user_hooks.description := p_description;
3224 p_task_user_hooks.task_status_name := p_task_status_name;
3225 p_task_user_hooks.task_status_id := p_task_status_id;
3227 p_task_user_hooks.task_priority_id := p_task_priority_id;
3228 p_task_user_hooks.owner_type_name := p_owner_type_name;
3229 p_task_user_hooks.owner_type_code := p_owner_type_code;
3230 p_task_user_hooks.owner_id := p_owner_id;
3231 p_task_user_hooks.owner_territory_id := p_owner_territory_id;
3232 p_task_user_hooks.assigned_by_name := p_assigned_by_name;
3233 p_task_user_hooks.assigned_by_id := p_assigned_by_id;
3234 p_task_user_hooks.customer_number := p_customer_number;
3235 p_task_user_hooks.customer_id := p_customer_id;
3236 p_task_user_hooks.cust_account_number := p_cust_account_number;
3237 p_task_user_hooks.cust_account_id := p_cust_account_id;
3238 p_task_user_hooks.address_id := p_address_id;
3239 p_task_user_hooks.location_id := p_location_id;
3240 p_task_user_hooks.address_number := p_address_number;
3241 p_task_user_hooks.planned_start_date := p_planned_start_date;
3242 p_task_user_hooks.planned_end_date := p_planned_end_date;
3243 p_task_user_hooks.scheduled_start_date := p_scheduled_start_date;
3244 p_task_user_hooks.scheduled_end_date := p_scheduled_end_date;
3245 p_task_user_hooks.actual_start_date := p_actual_start_date;
3246 p_task_user_hooks.actual_end_date := p_actual_end_date;
3247 p_task_user_hooks.timezone_id := p_timezone_id;
3248 p_task_user_hooks.timezone_name := p_timezone_name;
3249 p_task_user_hooks.source_object_type_code := p_source_object_type_code;
3250 p_task_user_hooks.source_object_id := p_source_object_id;
3251 p_task_user_hooks.source_object_name := p_source_object_name;
3252 p_task_user_hooks.duration := p_duration;
3253 p_task_user_hooks.duration_uom := p_duration_uom;
3254 p_task_user_hooks.planned_effort := p_planned_effort;
3255 p_task_user_hooks.planned_effort_uom := p_planned_effort_uom;
3256 p_task_user_hooks.actual_effort := p_actual_effort;
3257 p_task_user_hooks.actual_effort_uom := p_actual_effort_uom;
3258 p_task_user_hooks.percentage_complete := p_percentage_complete;
3259 p_task_user_hooks.reason_code := p_reason_code;
3260 p_task_user_hooks.private_flag := p_private_flag;
3261 p_task_user_hooks.publish_flag := p_publish_flag;
3262 p_task_user_hooks.restrict_closure_flag := p_restrict_closure_flag;
3263 p_task_user_hooks.multi_booked_flag := p_multi_booked_flag;
3264 p_task_user_hooks.milestone_flag := p_milestone_flag;
3265 p_task_user_hooks.holiday_flag := p_holiday_flag;
3266 p_task_user_hooks.billable_flag := p_billable_flag;
3267 p_task_user_hooks.bound_mode_code := p_bound_mode_code;
3268 p_task_user_hooks.soft_bound_flag := p_soft_bound_flag;
3269 p_task_user_hooks.workflow_process_id := p_workflow_process_id;
3270 p_task_user_hooks.notification_flag := p_notification_flag;
3271 p_task_user_hooks.notification_period := p_notification_period;
3272 p_task_user_hooks.notification_period_uom := p_notification_period_uom;
3273 p_task_user_hooks.alarm_start := p_alarm_start;
3274 p_task_user_hooks.alarm_start_uom := p_alarm_start_uom;
3275 p_task_user_hooks.alarm_on := p_alarm_on;
3276 p_task_user_hooks.alarm_count := p_alarm_count;
3277 p_task_user_hooks.alarm_interval := p_alarm_interval;
3278 p_task_user_hooks.alarm_interval_uom := p_alarm_interval_uom;
3279 p_task_user_hooks.palm_flag := p_palm_flag;
3280 p_task_user_hooks.wince_flag := p_wince_flag;
3281 p_task_user_hooks.laptop_flag := p_laptop_flag;
3282 p_task_user_hooks.device1_flag := p_device1_flag;
3283 p_task_user_hooks.device2_flag := p_device2_flag;
3284 p_task_user_hooks.device3_flag := p_device3_flag;
3285 p_task_user_hooks.costs := p_costs;
3286 p_task_user_hooks.currency_code := p_currency_code;
3287 p_task_user_hooks.escalation_level := p_escalation_level;
3288
3289 jtf_tasks_iuhk.update_task_pre (x_return_status);
3290
3291 IF NOT (x_return_status = fnd_api.g_ret_sts_success)
3292 THEN
3293 x_return_status := fnd_api.g_ret_sts_unexp_error;
3294 RAISE fnd_api.g_exc_unexpected_error;
3295 END IF;
3296
3297 */
3298 x_return_status := fnd_api.g_ret_sts_success;
3299
3300 -----
3301 ----- Validate Tasks
3302 -----
3303 IF (l_task_id = fnd_api.g_miss_num AND l_task_number = fnd_api.g_miss_char) THEN
3304 fnd_message.set_name('JTF', 'JTF_TASK_MISSING_TASK');
3305 fnd_msg_pub.ADD;
3306 x_return_status := fnd_api.g_ret_sts_unexp_error;
3307 RAISE fnd_api.g_exc_unexpected_error;
3308 ELSE
3309 SELECT DECODE(l_task_id, fnd_api.g_miss_num, NULL, l_task_id)
3310 INTO l_task_id
3311 FROM DUAL;
3312
3313 SELECT DECODE(l_task_number, fnd_api.g_miss_char, NULL, l_task_number)
3314 INTO l_task_number
3315 FROM DUAL;
3316
3320 , x_task_id => l_task_id
3317 jtf_task_utl.validate_task(
3318 p_task_id => l_task_id
3319 , p_task_number => l_task_number
3321 , x_return_status => x_return_status
3322 );
3323
3324 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3325 x_return_status := fnd_api.g_ret_sts_unexp_error;
3326 RAISE fnd_api.g_exc_unexpected_error;
3327 END IF;
3328
3329 IF l_task_id IS NULL THEN
3330 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_TASK_NUMBER');
3331 fnd_message.set_token('P_TASK_NUMBER', l_task_number);
3332 fnd_msg_pub.ADD;
3333 x_return_status := fnd_api.g_ret_sts_unexp_error;
3334 RAISE fnd_api.g_exc_unexpected_error;
3335 END IF;
3336 END IF;
3337
3338 -----
3339 ----- Task Name
3340 -----
3341 IF l_task_name IS NULL THEN
3342 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_TASK_NAME');
3343 fnd_msg_pub.ADD;
3344 x_return_status := fnd_api.g_ret_sts_unexp_error;
3345 RAISE fnd_api.g_exc_unexpected_error;
3346 END IF;
3347
3348 -----
3349 ----- Task Description
3350 -----
3351 l_description := task_rec.description;
3352
3353 OPEN c_task_update(l_task_id);
3354
3355 FETCH c_task_update
3356 INTO task_rec;
3357
3358 IF c_task_update%NOTFOUND THEN
3359 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_TASK_ID');
3360 fnd_message.set_token('P_TASK_ID', l_task_id);
3361 fnd_msg_pub.ADD;
3362 x_return_status := fnd_api.g_ret_sts_unexp_error;
3363 RAISE fnd_api.g_exc_unexpected_error;
3364 END IF;
3365
3366 -----
3367 ----- Task Type
3368 -----
3369 IF (l_task_type_name = fnd_api.g_miss_char AND l_task_type_id = fnd_api.g_miss_num) THEN
3370 l_task_type_id := task_rec.task_type_id;
3371 ELSIF(l_task_type_name = fnd_api.g_miss_char AND l_task_type_id <> fnd_api.g_miss_num) THEN
3372 jtf_task_utl.validate_task_type(
3373 p_task_type_id => l_task_type_id
3374 , p_task_type_name => NULL
3375 , x_return_status => x_return_status
3376 , x_task_type_id => l_task_type_id
3377 );
3378 ELSIF(l_task_type_name <> fnd_api.g_miss_char AND l_task_type_id = fnd_api.g_miss_num) THEN
3379 jtf_task_utl.validate_task_type(
3380 p_task_type_id => NULL
3381 , p_task_type_name => l_task_type_name
3382 , x_return_status => x_return_status
3383 , x_task_type_id => l_task_type_id
3384 );
3385 ELSE
3386 jtf_task_utl.validate_task_type(
3387 p_task_type_id => l_task_type_id
3388 , p_task_type_name => l_task_type_name
3389 , x_return_status => x_return_status
3390 , x_task_type_id => l_task_type_id
3391 );
3392 END IF;
3393
3394 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3395 x_return_status := fnd_api.g_ret_sts_unexp_error;
3396 RAISE fnd_api.g_exc_unexpected_error;
3397 END IF;
3398
3399 IF l_task_type_id IS NULL THEN
3400 fnd_message.set_name('JTF', 'JTF_TASK_MISSING_TYPE');
3401 fnd_msg_pub.ADD;
3402 RAISE fnd_api.g_exc_unexpected_error;
3403 END IF;
3404
3405 -------
3406 ------- Validate Location Id
3407 -------
3408 jtf_task_utl.validate_location_id(
3409 p_location_id => p_location_id
3410 , p_address_id => p_address_id
3411 , p_task_id => l_task_id
3412 , x_return_status => x_return_status
3413 );
3414
3415 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3416 x_return_status := fnd_api.g_ret_sts_unexp_error;
3417 RAISE fnd_api.g_exc_unexpected_error;
3418 END IF;
3419
3420 -----
3421 ----- Task Status
3422 -----
3423 IF l_task_type_id = '22' THEN
3424 l_type := 'ESCALATION';
3425 ELSE
3426 l_type := 'TASK';
3427 END IF;
3428
3429 IF (l_task_status_name = fnd_api.g_miss_char AND l_task_status_id = fnd_api.g_miss_num) THEN
3430 l_task_status_id := task_rec.task_status_id;
3431 ELSIF(l_task_status_name = fnd_api.g_miss_char AND l_task_status_id <> fnd_api.g_miss_num) THEN
3432 jtf_task_utl.validate_task_status(
3433 p_task_status_id => l_task_status_id
3434 , p_task_status_name => NULL
3435 , p_validation_type => l_type
3436 , x_return_status => x_return_status
3437 , x_task_status_id => l_task_status_id
3438 );
3439 ELSIF(l_task_status_name <> fnd_api.g_miss_char AND l_task_status_id = fnd_api.g_miss_num) THEN
3440 jtf_task_utl.validate_task_status(
3441 p_task_status_id => NULL
3442 , p_task_status_name => l_task_status_name
3443 , p_validation_type => l_type
3444 , x_return_status => x_return_status
3445 , x_task_status_id => l_task_status_id
3446 );
3447 ELSE
3451 , p_validation_type => l_type
3448 jtf_task_utl.validate_task_status(
3449 p_task_status_id => l_task_status_id
3450 , p_task_status_name => l_task_status_name
3452 , x_return_status => x_return_status
3453 , x_task_status_id => l_task_status_id
3454 );
3455 END IF;
3456
3457 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3458 x_return_status := fnd_api.g_ret_sts_unexp_error;
3459 RAISE fnd_api.g_exc_unexpected_error;
3460 END IF;
3461
3462 IF l_task_status_id IS NULL THEN
3463 fnd_message.set_name('JTF', 'JTF_TASK_MISSING_status');
3464 fnd_msg_pub.ADD;
3465 RAISE fnd_api.g_exc_unexpected_error;
3466 END IF;
3467
3468 --------
3469 -------- Task Priority
3470 --------
3471 IF (l_task_priority_name = fnd_api.g_miss_char AND l_task_priority_id = fnd_api.g_miss_num) THEN
3472 l_task_priority_id := task_rec.task_priority_id;
3473 ELSIF(l_task_priority_name = fnd_api.g_miss_char AND l_task_priority_id <> fnd_api.g_miss_num) THEN
3474 jtf_task_utl.validate_task_priority(
3475 p_task_priority_id => l_task_priority_id
3476 , p_task_priority_name => NULL
3477 , x_return_status => x_return_status
3478 , x_task_priority_id => l_task_priority_id
3479 );
3480 ELSIF(l_task_priority_name <> fnd_api.g_miss_char AND l_task_priority_id = fnd_api.g_miss_num) THEN
3481 jtf_task_utl.validate_task_priority(
3482 p_task_priority_id => NULL
3483 , p_task_priority_name => l_task_priority_name
3484 , x_return_status => x_return_status
3485 , x_task_priority_id => l_task_priority_id
3486 );
3487 ELSE
3488 jtf_task_utl.validate_task_priority(
3489 p_task_priority_id => l_task_priority_id
3490 , p_task_priority_name => l_task_priority_name
3491 , x_return_status => x_return_status
3492 , x_task_priority_id => l_task_priority_id
3493 );
3494 END IF;
3495
3496 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3497 x_return_status := fnd_api.g_ret_sts_unexp_error;
3498 RAISE fnd_api.g_exc_unexpected_error;
3499 END IF;
3500
3501 --------
3502 -------- Asssigned By Name
3503 --------
3504 IF (l_assigned_by_name = fnd_api.g_miss_char AND l_assigned_by_id = fnd_api.g_miss_num) THEN
3505 l_assigned_by_id := task_rec.assigned_by_id;
3506 ELSIF (l_assigned_by_name = fnd_api.g_miss_char)
3507 AND (l_assigned_by_id <> fnd_api.g_miss_num OR l_assigned_by_id IS NULL) THEN
3508 jtf_task_utl.validate_assigned_by(
3509 p_assigned_by_id => l_assigned_by_id
3510 , p_assigned_by_name => NULL
3511 , x_return_status => x_return_status
3512 , x_assigned_by_id => l_assigned_by_id
3513 );
3514 ELSIF (l_assigned_by_name <> fnd_api.g_miss_char OR l_assigned_by_name IS NULL)
3515 AND (l_assigned_by_id = fnd_api.g_miss_num) THEN
3516 jtf_task_utl.validate_assigned_by(
3517 p_assigned_by_id => NULL
3518 , p_assigned_by_name => l_assigned_by_name
3519 , x_return_status => x_return_status
3520 , x_assigned_by_id => l_assigned_by_id
3521 );
3522 ELSE
3523 jtf_task_utl.validate_assigned_by(
3524 p_assigned_by_id => l_assigned_by_id
3525 , p_assigned_by_name => l_assigned_by_name
3526 , x_return_status => x_return_status
3527 , x_assigned_by_id => l_assigned_by_id
3528 );
3529 END IF;
3530
3531 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3532 x_return_status := fnd_api.g_ret_sts_unexp_error;
3533 RAISE fnd_api.g_exc_unexpected_error;
3534 END IF;
3535
3536 -----------
3537 ----------- Customer Id
3538 -----------
3539 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3540 x_return_status := fnd_api.g_ret_sts_unexp_error;
3541 RAISE fnd_api.g_exc_unexpected_error;
3542 END IF;
3543
3544 IF (
3545 p_customer_id <> fnd_api.g_miss_num
3546 OR p_customer_id IS NULL
3547 OR p_customer_number <> fnd_api.g_miss_char
3548 OR p_customer_number IS NULL
3549 ) THEN
3550 SELECT DECODE(p_customer_id, fnd_api.g_miss_num, NULL, p_customer_id)
3551 INTO l_customer_id
3552 FROM DUAL;
3553
3554 SELECT DECODE(p_customer_number, fnd_api.g_miss_char, NULL, p_customer_number)
3555 INTO l_customer_number
3556 FROM DUAL;
3557
3558 jtf_task_utl.validate_party(
3559 p_party_id => l_customer_id
3560 , p_party_number => l_customer_number
3561 , x_party_id => l_customer_id
3562 , x_return_status => x_return_status
3563 );
3564 ELSE
3565 l_customer_id := task_rec.customer_id;
3566 END IF;
3567
3568 -----------
3569 ----------- Address Id.
3570 -----------
3571 IF (p_address_id <> fnd_api.g_miss_num OR p_address_number <> fnd_api.g_miss_char) THEN
3575
3572 SELECT DECODE(p_address_id, fnd_api.g_miss_num, NULL, p_address_id)
3573 INTO l_address_id
3574 FROM DUAL;
3576 SELECT DECODE(p_address_number, fnd_api.g_miss_char, NULL, p_address_number)
3577 INTO l_address_number
3578 FROM DUAL;
3579
3580 jtf_task_utl.validate_party_site(
3581 p_party_site_id => l_address_id
3582 , p_party_site_number => l_address_number
3583 , x_party_site_id => l_address_id
3584 , x_return_status => x_return_status
3585 );
3586 ELSE
3587 l_address_id := task_rec.address_id;
3588 END IF;
3589
3590 -----------
3591 ----------- Customer Account Info.
3592 -----------
3593 IF (p_cust_account_id <> fnd_api.g_miss_num OR p_cust_account_number <> fnd_api.g_miss_char) THEN
3594 SELECT DECODE(p_cust_account_id, fnd_api.g_miss_num, NULL, p_cust_account_id)
3595 INTO l_cust_account_id
3596 FROM DUAL;
3597
3598 SELECT DECODE(p_cust_account_number, fnd_api.g_miss_char, NULL, p_cust_account_number)
3599 INTO l_cust_account_number
3600 FROM DUAL;
3601
3602 jtf_task_utl.validate_cust_account(
3603 p_cust_account_id => l_cust_account_id
3604 , p_cust_account_number => l_cust_account_number
3605 , x_cust_account_id => l_cust_account_id
3606 , x_return_status => x_return_status
3607 );
3608 ELSE
3609 l_cust_account_id := task_rec.cust_account_id;
3610 END IF;
3611
3612 /* removing fix for bug #1628560
3613 ----
3614 ---- Cross-validate customer/address/account
3615 ----
3616 jtf_task_utl.validate_party_site_acct (
3617 p_party_id => l_customer_id,
3618 p_party_site_id => l_address_id,
3619 p_cust_account_id => l_cust_account_id,
3620 x_return_status => x_return_status
3621 );
3622
3623 IF NOT (x_return_status = fnd_api.g_ret_sts_success)
3624 THEN
3625 x_return_status := fnd_api.g_ret_sts_unexp_error;
3626 RAISE fnd_api.g_exc_unexpected_error;
3627 END IF;
3628
3629 */ ----
3630 ---- Planned Dates
3631 ----
3632 l_planned_start_date := task_rec.planned_start_date;
3633 l_planned_end_date := task_rec.planned_end_date;
3634 jtf_task_utl.validate_dates
3635 (
3636 p_date_tag => jtf_task_utl.get_translated_lookup
3637 ('JTF_TASK_TRANSLATED_MESSAGES'
3638 , 'PLANNED')
3639 , p_start_date => l_planned_start_date
3640 , p_end_date => l_planned_end_date
3641 , x_return_status => x_return_status
3642 );
3643
3644 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3645 x_return_status := fnd_api.g_ret_sts_unexp_error;
3646 RAISE fnd_api.g_exc_unexpected_error;
3647 END IF;
3648
3649 ----
3650 ---- scheduled Dates
3651 ----
3652 l_scheduled_start_date := task_rec.scheduled_start_date;
3653 l_scheduled_end_date := task_rec.scheduled_end_date;
3654 jtf_task_utl.validate_dates
3655 (
3656 p_date_tag => jtf_task_utl.get_translated_lookup
3657 ('JTF_TASK_TRANSLATED_MESSAGES'
3658 , 'SCHEDULED')
3659 , p_start_date => l_scheduled_start_date
3660 , p_end_date => l_scheduled_end_date
3661 , x_return_status => x_return_status
3662 );
3663
3664 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3665 x_return_status := fnd_api.g_ret_sts_unexp_error;
3666 RAISE fnd_api.g_exc_unexpected_error;
3667 END IF;
3668
3669 ----
3670 ---- Actual Dates
3671 ----
3672 l_actual_start_date := task_rec.actual_start_date;
3673 l_actual_end_date := task_rec.actual_end_date;
3674 jtf_task_utl.validate_dates
3675 (
3676 p_date_tag => jtf_task_utl.get_translated_lookup
3677 ('JTF_TASK_TRANSLATED_MESSAGES'
3678 , 'ACTUAL')
3679 , p_start_date => l_actual_start_date
3680 , p_end_date => l_actual_end_date
3681 , x_return_status => x_return_status
3682 );
3683
3684 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3685 x_return_status := fnd_api.g_ret_sts_unexp_error;
3686 RAISE fnd_api.g_exc_unexpected_error;
3687 END IF;
3688
3689 --------
3690 -------- Validate source object details
3691 --------
3692 l_source_object_type_code := task_rec.source_object_type_code;
3693 l_source_object_id := task_rec.source_object_id;
3694 l_source_object_name := task_rec.source_object_name;
3695
3696 --- Added the if condition. It will validate only if the field is being updated, else it will be ignored.
3700 jtf_task_utl.validate_source_object(
3697 IF p_source_object_type_code = fnd_api.g_miss_char AND p_source_object_id = fnd_api.g_miss_num THEN
3698 --Commented out for minipatch 401
3699 --ELSE
3701 p_object_code => l_source_object_type_code
3702 , p_object_id => l_source_object_id
3703 , p_object_name => l_source_object_name
3704 , x_return_status => x_return_status
3705 );
3706 END IF;
3707
3708 ---- Also, since we are denormalizing the source_object_name,
3709 ---- on every update, the source_object_name is updated to the
3710 ---- proper source_object_name.
3711 l_source_object_name :=
3712 jtf_task_utl.check_truncation
3713 (
3714 p_object_name => jtf_task_utl.get_owner(
3715 task_rec.source_object_type_code
3716 , task_rec.source_object_id
3717 )
3718 );
3719
3720 ---- Commented out by lokumar as part of bug#5741482
3721 ---- source_object_name is ultimately updated at PKG level
3722 /*
3723 update jtf_tasks_b
3724 set source_object_name = l_source_object_name
3725 where task_id = l_task_id ;
3726 */
3727 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3728 x_return_status := fnd_api.g_ret_sts_unexp_error;
3729 RAISE fnd_api.g_exc_unexpected_error;
3730 END IF;
3731
3732 ----------
3733 ---------- Validate duration
3734 ----------
3735 l_duration := task_rec.DURATION;
3736 l_duration_uom := task_rec.duration_uom;
3737
3738 ----------
3739 ---------- Do not validate if either duration or duration_uom
3740 ---------- is missing, to fix bug #1893801
3741 ----------
3742 IF (
3743 l_duration <> fnd_api.g_miss_num
3744 AND l_duration IS NOT NULL
3745 AND l_duration_uom <> fnd_api.g_miss_char
3746 AND l_duration_uom IS NOT NULL
3747 ) THEN
3748 jtf_task_utl.validate_effort
3749 (
3750 p_tag => jtf_task_utl.get_translated_lookup
3751 ('JTF_TASK_TRANSLATED_MESSAGES'
3752 , 'DURATION')
3753 , p_tag_uom => jtf_task_utl.get_translated_lookup
3754 ('JTF_TASK_TRANSLATED_MESSAGES'
3755 , 'DURATION_UOM')
3756 , p_effort => l_duration
3757 , p_effort_uom => l_duration_uom
3758 , x_return_status => x_return_status
3759 );
3760
3761 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3762 x_return_status := fnd_api.g_ret_sts_unexp_error;
3763 RAISE fnd_api.g_exc_unexpected_error;
3764 END IF;
3765 END IF;
3766
3767 ----------
3768 ---------- Validate actual_effort
3769 ----------
3770 l_actual_effort := task_rec.actual_effort;
3771 l_actual_effort_uom := task_rec.actual_effort_uom;
3772 jtf_task_utl.validate_effort
3773 (
3774 p_tag => jtf_task_utl.get_translated_lookup
3775 ('JTF_TASK_TRANSLATED_MESSAGES'
3776 , 'ACTUAL_EFFORT')
3777 , p_tag_uom => jtf_task_utl.get_translated_lookup
3778 ('JTF_TASK_TRANSLATED_MESSAGES'
3779 , 'ACTUAL_EFFORT_UOM')
3780 , p_effort => l_actual_effort
3781 , p_effort_uom => l_actual_effort_uom
3782 , x_return_status => x_return_status
3783 );
3784
3785 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3786 x_return_status := fnd_api.g_ret_sts_unexp_error;
3787 RAISE fnd_api.g_exc_unexpected_error;
3788 END IF;
3789
3790 ----------
3791 ---------- Validate planned_effort
3792 ----------
3793 l_planned_effort := task_rec.planned_effort;
3794 l_planned_effort_uom := task_rec.planned_effort_uom;
3795 jtf_task_utl.validate_effort
3796 (
3797 p_tag => jtf_task_utl.get_translated_lookup
3798 ('JTF_TASK_TRANSLATED_MESSAGES'
3799 , 'PLANNED_EFFORT')
3800 , p_tag_uom => jtf_task_utl.get_translated_lookup
3801 ('JTF_TASK_TRANSLATED_MESSAGES'
3802 , 'PLANNED_EFFORT_UOM')
3803 , p_effort => l_planned_effort
3804 , p_effort_uom => l_planned_effort_uom
3805 , x_return_status => x_return_status
3806 );
3807
3808 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3809 x_return_status := fnd_api.g_ret_sts_unexp_error;
3813 -------
3810 RAISE fnd_api.g_exc_unexpected_error;
3811 END IF;
3812
3814 ------- Validate percentage complete
3815 -------
3816 IF (p_percentage_complete <> fnd_api.g_miss_num OR p_percentage_complete IS NULL) THEN
3817 IF p_percentage_complete < 0 OR p_percentage_complete > 100 THEN
3818 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_PCT_COMPLETE');
3819 fnd_msg_pub.ADD;
3820 x_return_status := fnd_api.g_ret_sts_unexp_error;
3821 RAISE fnd_api.g_exc_unexpected_error;
3822 END IF;
3823 END IF;
3824
3825 l_percentage_complete := task_rec.percentage_complete;
3826
3827 -------
3828 ------- Validate private flag
3829 -------
3830 IF p_private_flag <> fnd_api.g_miss_char THEN
3831 jtf_task_utl.validate_flag
3832 (
3833 p_flag_name => jtf_task_utl.get_translated_lookup
3834 ('JTF_TASK_TRANSLATED_MESSAGES'
3835 , 'PRIVATE_FLAG')
3836 , p_flag_value => p_private_flag
3837 , x_return_status => x_return_status
3838 );
3839
3840 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3841 x_return_status := fnd_api.g_ret_sts_unexp_error;
3842 RAISE fnd_api.g_exc_unexpected_error;
3843 END IF;
3844
3845 l_private_flag := p_private_flag;
3846 ELSE
3847 l_private_flag := task_rec.private_flag;
3848 END IF;
3849
3850 -------
3851 ------- Validate publish flag
3852 -------
3853 IF p_publish_flag <> fnd_api.g_miss_char OR p_publish_flag IS NULL THEN
3854 jtf_task_utl.validate_flag
3855 (
3856 p_flag_name => jtf_task_utl.get_translated_lookup
3857 ('JTF_TASK_TRANSLATED_MESSAGES'
3858 , 'PUBLISH_FLAG')
3859 , p_flag_value => p_publish_flag
3860 , x_return_status => x_return_status
3861 );
3862
3863 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3864 x_return_status := fnd_api.g_ret_sts_unexp_error;
3865 RAISE fnd_api.g_exc_unexpected_error;
3866 END IF;
3867
3868 l_publish_flag := p_publish_flag;
3869 ELSE
3870 l_publish_flag := task_rec.publish_flag;
3871 END IF;
3872
3873 -------
3874 ------- Validate restrict closure flag
3875 -------
3876 IF p_restrict_closure_flag <> fnd_api.g_miss_char OR p_restrict_closure_flag IS NULL THEN
3877 jtf_task_utl.validate_flag
3878 (
3879 p_flag_name => jtf_task_utl.get_translated_lookup
3880 ('JTF_TASK_TRANSLATED_MESSAGES'
3881 , 'RESTRICT_CLOSURE_FLAG')
3882 , p_flag_value => p_restrict_closure_flag
3883 , x_return_status => x_return_status
3884 );
3885
3886 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3887 x_return_status := fnd_api.g_ret_sts_unexp_error;
3888 RAISE fnd_api.g_exc_unexpected_error;
3889 END IF;
3890
3891 l_restrict_closure_flag := p_restrict_closure_flag;
3892 ELSE
3893 l_restrict_closure_flag := task_rec.restrict_closure_flag;
3894 END IF;
3895
3896 -------
3897 ------- Validate multibooked flag
3898 -------
3899 IF p_multi_booked_flag <> fnd_api.g_miss_char OR p_multi_booked_flag IS NULL THEN
3900 jtf_task_utl.validate_flag
3901 (
3902 p_flag_name => jtf_task_utl.get_translated_lookup
3903 ('JTF_TASK_TRANSLATED_MESSAGES'
3904 , 'MULTIBOOKED_FLAG')
3905 , p_flag_value => p_multi_booked_flag
3906 , x_return_status => x_return_status
3907 );
3908
3909 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3910 x_return_status := fnd_api.g_ret_sts_unexp_error;
3911 RAISE fnd_api.g_exc_unexpected_error;
3912 END IF;
3913
3914 l_multi_booked_flag := p_multi_booked_flag;
3915 ELSE
3916 l_multi_booked_flag := task_rec.multi_booked_flag;
3917 END IF;
3918
3919 -------
3920 ------- Validate milestone flag
3921 -------
3922 IF p_milestone_flag <> fnd_api.g_miss_char OR p_milestone_flag IS NULL THEN
3923 jtf_task_utl.validate_flag
3924 (
3925 p_flag_name => jtf_task_utl.get_translated_lookup
3926 ('JTF_TASK_TRANSLATED_MESSAGES'
3927 , 'MILESTONE_FLAG')
3928 , p_flag_value => p_milestone_flag
3929 , x_return_status => x_return_status
3930 );
3931
3932 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3933 x_return_status := fnd_api.g_ret_sts_unexp_error;
3934 RAISE fnd_api.g_exc_unexpected_error;
3938 ELSE
3935 END IF;
3936
3937 l_milestone_flag := p_milestone_flag;
3939 l_milestone_flag := task_rec.milestone_flag;
3940 END IF;
3941
3942 -------
3943 ------- Validate holiday flag
3944 -------
3945 IF p_holiday_flag <> fnd_api.g_miss_char OR p_holiday_flag IS NULL THEN
3946 jtf_task_utl.validate_flag
3947 (
3948 p_flag_name => jtf_task_utl.get_translated_lookup
3949 ('JTF_TASK_TRANSLATED_MESSAGES'
3950 , 'HOILDAY_FLAG')
3951 , p_flag_value => p_holiday_flag
3952 , x_return_status => x_return_status
3953 );
3954
3955 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3956 x_return_status := fnd_api.g_ret_sts_unexp_error;
3957 RAISE fnd_api.g_exc_unexpected_error;
3958 END IF;
3959
3960 l_holiday_flag := p_holiday_flag;
3961 ELSE
3962 l_holiday_flag := task_rec.holiday_flag;
3963 END IF;
3964
3965 -------
3966 ------- Validate palm flag
3967 -------
3968 IF p_palm_flag <> fnd_api.g_miss_char THEN
3969 jtf_task_utl.validate_flag
3970 (
3971 p_flag_name => jtf_task_utl.get_translated_lookup
3972 ('JTF_TASK_TRANSLATED_MESSAGES'
3973 , 'PALM_FLAG')
3974 , p_flag_value => p_palm_flag
3975 , x_return_status => x_return_status
3976 );
3977
3978 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3979 x_return_status := fnd_api.g_ret_sts_unexp_error;
3980 RAISE fnd_api.g_exc_unexpected_error;
3981 END IF;
3982
3983 l_palm_flag := p_palm_flag;
3984 ELSE
3985 l_palm_flag := task_rec.palm_flag;
3986 END IF;
3987
3988 -------
3989 ------- Validate wince flag
3990 -------
3991 IF p_wince_flag <> fnd_api.g_miss_char OR p_wince_flag IS NULL THEN
3992 jtf_task_utl.validate_flag
3993 (
3994 p_flag_name => jtf_task_utl.get_translated_lookup
3995 ('JTF_TASK_TRANSLATED_MESSAGES'
3996 , 'WINCE_FLAG')
3997 , p_flag_value => p_wince_flag
3998 , x_return_status => x_return_status
3999 );
4000
4001 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4002 x_return_status := fnd_api.g_ret_sts_unexp_error;
4003 RAISE fnd_api.g_exc_unexpected_error;
4004 END IF;
4005
4006 l_wince_flag := p_wince_flag;
4007 ELSE
4008 l_wince_flag := task_rec.wince_flag;
4009 END IF;
4010
4011 -------
4012 ------- Validate laptop flag
4013 -------
4014 IF p_laptop_flag <> fnd_api.g_miss_char OR p_laptop_flag IS NULL THEN
4015 jtf_task_utl.validate_flag
4016 (
4017 p_flag_name => jtf_task_utl.get_translated_lookup
4018 ('JTF_TASK_TRANSLATED_MESSAGES'
4019 , 'LAPTOP_FLAG')
4020 , p_flag_value => p_laptop_flag
4021 , x_return_status => x_return_status
4022 );
4023
4024 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4025 x_return_status := fnd_api.g_ret_sts_unexp_error;
4026 RAISE fnd_api.g_exc_unexpected_error;
4027 END IF;
4028
4029 l_laptop_flag := p_laptop_flag;
4030 ELSE
4031 l_laptop_flag := task_rec.laptop_flag;
4032 END IF;
4033
4034 -------
4035 ------- Validate billable flag
4036 -------
4037 IF p_billable_flag <> fnd_api.g_miss_char THEN
4038 jtf_task_utl.validate_flag
4039 (
4040 p_flag_name => jtf_task_utl.get_translated_lookup
4041 ('JTF_TASK_TRANSLATED_MESSAGES'
4042 , 'BILLABLE_FLAG')
4043 , p_flag_value => p_billable_flag
4044 , x_return_status => x_return_status
4045 );
4046
4047 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4048 x_return_status := fnd_api.g_ret_sts_unexp_error;
4049 RAISE fnd_api.g_exc_unexpected_error;
4050 END IF;
4051
4052 l_billable_flag := p_billable_flag;
4053 ELSE
4054 l_billable_flag := task_rec.billable_flag;
4055 END IF;
4056
4057 --------
4058 -------- Task Timezone
4059 --------
4060 IF (p_timezone_name = fnd_api.g_miss_char AND p_timezone_id = fnd_api.g_miss_num) THEN
4061 l_timezone_id := task_rec.timezone_id;
4062 ELSIF p_timezone_name = fnd_api.g_miss_char
4063 AND (p_timezone_id <> fnd_api.g_miss_num OR p_timezone_id IS NULL) THEN
4064 jtf_task_utl.validate_timezones(
4065 p_timezone_id => p_timezone_id
4066 , p_timezone_name => NULL
4067 , x_return_status => x_return_status
4071 AND p_timezone_id = fnd_api.g_miss_num THEN
4068 , x_timezone_id => l_timezone_id
4069 );
4070 ELSIF (p_timezone_name <> fnd_api.g_miss_char OR p_timezone_name IS NULL)
4072 jtf_task_utl.validate_timezones(
4073 p_timezone_id => NULL
4074 , p_timezone_name => p_timezone_name
4075 , x_return_status => x_return_status
4076 , x_timezone_id => l_timezone_id
4077 );
4078 ELSE
4079 jtf_task_utl.validate_timezones(
4080 p_timezone_id => p_timezone_id
4081 , p_timezone_name => p_timezone_name
4082 , x_return_status => x_return_status
4083 , x_timezone_id => l_timezone_id
4084 );
4085 END IF;
4086
4087 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4088 x_return_status := fnd_api.g_ret_sts_unexp_error;
4089 RAISE fnd_api.g_exc_unexpected_error;
4090 END IF;
4091
4092 -------
4093 ------- Validate soft bound flag
4094 -------
4095 IF p_soft_bound_flag <> fnd_api.g_miss_char OR p_soft_bound_flag IS NULL THEN
4096 jtf_task_utl.validate_flag
4097 (
4098 p_flag_name => jtf_task_utl.get_translated_lookup
4099 ('JTF_TASK_TRANSLATED_MESSAGES'
4100 , 'SOFTBOUND_FLAG')
4101 , p_flag_value => p_soft_bound_flag
4102 , x_return_status => x_return_status
4103 );
4104
4105 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4106 x_return_status := fnd_api.g_ret_sts_unexp_error;
4107 RAISE fnd_api.g_exc_unexpected_error;
4108 END IF;
4109
4110 l_soft_bound_flag := p_soft_bound_flag;
4111 ELSE
4112 l_soft_bound_flag := task_rec.soft_bound_flag;
4113 END IF;
4114
4115 -------
4116 ------- Validate device1 flag
4117 -------
4118 IF p_device1_flag <> fnd_api.g_miss_char OR p_device1_flag IS NULL THEN
4119 jtf_task_utl.validate_flag
4120 (
4121 p_flag_name => jtf_task_utl.get_translated_lookup
4122 ('JTF_TASK_TRANSLATED_MESSAGES'
4123 , 'DEVICE1_FLAG')
4124 , p_flag_value => p_device1_flag
4125 , x_return_status => x_return_status
4126 );
4127
4128 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4129 x_return_status := fnd_api.g_ret_sts_unexp_error;
4130 RAISE fnd_api.g_exc_unexpected_error;
4131 END IF;
4132
4133 l_device1_flag := p_device1_flag;
4134 ELSE
4135 l_device1_flag := task_rec.device1_flag;
4136 END IF;
4137
4138 -------
4139 ------- Validate device2 flag
4140 -------
4141 IF p_device2_flag <> fnd_api.g_miss_char OR p_device2_flag IS NULL THEN
4142 jtf_task_utl.validate_flag
4143 (
4144 p_flag_name => jtf_task_utl.get_translated_lookup
4145 ('JTF_TASK_TRANSLATED_MESSAGES'
4146 , 'DEVICE2_FLAG')
4147 , p_flag_value => p_device2_flag
4148 , x_return_status => x_return_status
4149 );
4150
4151 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4152 x_return_status := fnd_api.g_ret_sts_unexp_error;
4153 RAISE fnd_api.g_exc_unexpected_error;
4154 END IF;
4155
4156 l_device2_flag := p_device2_flag;
4157 ELSE
4158 l_device2_flag := task_rec.device2_flag;
4159 END IF;
4160
4161 -------
4162 ------- Validate device3 flag
4163 -------
4164 IF p_device3_flag <> fnd_api.g_miss_char OR p_device3_flag IS NULL THEN
4165 jtf_task_utl.validate_flag
4166 (
4167 p_flag_name => jtf_task_utl.get_translated_lookup
4168 ('JTF_TASK_TRANSLATED_MESSAGES'
4169 , 'DEVICE3_FLAG')
4170 , p_flag_value => p_device3_flag
4171 , x_return_status => x_return_status
4172 );
4173
4174 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4175 x_return_status := fnd_api.g_ret_sts_unexp_error;
4176 RAISE fnd_api.g_exc_unexpected_error;
4177 END IF;
4178
4179 l_device3_flag := p_device3_flag;
4180 ELSE
4181 l_device3_flag := task_rec.device3_flag;
4182 END IF;
4183
4184 -------
4185 ------- Validate Notification
4186 -------
4187 IF (
4188 p_notification_period <> fnd_api.g_miss_num
4189 OR p_notification_period IS NULL
4190 OR p_notification_period_uom <> fnd_api.g_miss_char
4191 OR p_notification_period_uom IS NULL
4192 OR p_notification_flag <> fnd_api.g_miss_char
4193 OR p_notification_flag IS NULL
4197 THEN
4194 ) THEN
4195 /* IF ( p_notification_period <> fnd_api.g_miss_num
4196 OR p_notification_period IS NULL)
4198 l_notification_period := p_notification_period;
4199 ELSE
4200 l_notification_period := task_rec.notification_period;
4201 END IF;
4202
4203 IF ( p_notification_period_uom <> fnd_api.g_miss_char
4204 OR p_notification_period_uom IS NULL)
4205 THEN
4206 l_notification_period_uom := p_notification_period_uom;
4207 ELSE
4208 l_notification_period_uom := task_rec.notification_period_uom;
4209 END IF;
4210
4211 IF ( p_notification_flag <> fnd_api.g_miss_char
4212 OR p_notification_flag IS NULL)
4213 THEN
4214 l_notification_flag := p_notification_flag;
4215 ELSE
4216 l_notification_flag := task_rec.notification_flag;
4217 END IF;
4218 */
4219 l_notification_flag := task_rec.notification_flag;
4220 l_notification_period := task_rec.notification_period;
4221 l_notification_period_uom := task_rec.notification_period_uom;
4222 jtf_task_utl.validate_notification(
4223 p_notification_flag => l_notification_flag
4224 , p_notification_period => l_notification_period
4225 , p_notification_period_uom => l_notification_period_uom
4226 , x_return_status => x_return_status
4227 );
4228
4229 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4230 fnd_message.set_name('JTF', 'INVALID_NOTIFICATION');
4231 fnd_msg_pub.ADD;
4232 x_return_status := fnd_api.g_ret_sts_unexp_error;
4233 RAISE fnd_api.g_exc_unexpected_error;
4234 END IF;
4235 ELSE
4236 l_notification_flag := task_rec.notification_flag;
4237 l_notification_period := task_rec.notification_period;
4238 l_notification_period_uom := task_rec.notification_period_uom;
4239 END IF;
4240
4241 -----------
4242 ----------- Validate alarm
4243 -----------
4244 IF (
4245 p_alarm_start <> fnd_api.g_miss_num
4246 OR p_alarm_start_uom <> fnd_api.g_miss_char
4247 OR p_alarm_on <> fnd_api.g_miss_char
4248 OR p_alarm_count <> fnd_api.g_miss_num
4249 OR p_alarm_fired_count <> fnd_api.g_miss_num
4250 OR p_alarm_interval <> fnd_api.g_miss_num
4251 OR p_alarm_interval_uom <> fnd_api.g_miss_char
4252 OR p_alarm_start IS NULL
4253 OR p_alarm_start_uom IS NULL
4254 OR p_alarm_on IS NULL
4255 OR p_alarm_count IS NULL
4256 OR p_alarm_fired_count IS NULL
4257 OR p_alarm_interval IS NULL
4258 OR p_alarm_interval_uom IS NULL
4259 ) THEN
4260 l_alarm_start := task_rec.alarm_start;
4261 l_alarm_start_uom := task_rec.alarm_start_uom;
4262 l_alarm_on := task_rec.alarm_on;
4263 l_alarm_interval := task_rec.alarm_interval;
4264 l_alarm_interval_uom := task_rec.alarm_interval_uom;
4265 l_alarm_count := task_rec.alarm_count;
4266 l_alarm_fired_count := task_rec.alarm_fired_count;
4267 jtf_task_utl.validate_alarm(
4268 p_alarm_start => l_alarm_start
4269 , p_alarm_start_uom => l_alarm_start_uom
4270 , p_alarm_on => l_alarm_on
4271 , p_alarm_count => l_alarm_count
4272 , p_alarm_interval => l_alarm_interval
4273 , p_alarm_interval_uom => l_alarm_interval_uom
4274 , x_return_status => x_return_status
4275 );
4276
4277 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4278 fnd_message.set_name('JTF', 'INVALID_ALARM_PARAM');
4279 fnd_msg_pub.ADD;
4280 x_return_status := fnd_api.g_ret_sts_unexp_error;
4281 RAISE fnd_api.g_exc_unexpected_error;
4282 END IF;
4283
4284 IF l_alarm_fired_count IS NOT NULL THEN
4285 IF l_alarm_fired_count > l_alarm_count THEN
4286 fnd_message.set_name('JTF', 'INVALID_ALARM_PARAM');
4287 fnd_msg_pub.ADD;
4288 x_return_status := fnd_api.g_ret_sts_unexp_error;
4289 RAISE fnd_api.g_exc_unexpected_error;
4290 END IF;
4291 END IF;
4292 ELSE
4293 l_alarm_start := task_rec.alarm_start;
4294 l_alarm_start_uom := task_rec.alarm_start_uom;
4295 l_alarm_on := task_rec.alarm_on;
4296 l_alarm_interval := task_rec.alarm_interval;
4297 l_alarm_interval_uom := task_rec.alarm_interval_uom;
4298 l_alarm_count := task_rec.alarm_count;
4299 l_alarm_fired_count := task_rec.alarm_fired_count;
4300 END IF;
4301
4302 l_owner_id := task_rec.owner_id;
4303 l_owner_type_code := task_rec.owner_type_code;
4304
4305 -----
4306 ----- Validate Owner
4307 -----
4308 IF (
4309 p_owner_type_code <> fnd_api.g_miss_char
4310 OR p_owner_type_code IS NULL
4311 OR p_owner_id IS NULL
4315 ) THEN
4312 OR p_owner_id <> fnd_api.g_miss_num
4313 OR p_owner_type_name IS NULL
4314 OR p_owner_type_name <> fnd_api.g_miss_char
4316 l_owner_type_name := p_owner_type_name;
4317 jtf_task_utl.validate_task_owner(
4318 p_owner_type_name => l_owner_type_name
4319 , p_owner_type_code => l_owner_type_code
4320 , p_owner_id => l_owner_id
4321 , x_return_status => x_return_status
4322 , x_owner_id => l_owner_id
4323 , x_owner_type_code => l_owner_type_code
4324 );
4325 END IF;
4326
4327 ----------
4328 ---------- Validate costs
4329 ----------
4330 l_costs := task_rec.costs;
4331 l_currency_code := task_rec.currency_code;
4332
4333 IF (
4334 p_costs <> fnd_api.g_miss_num
4335 OR p_costs IS NULL
4336 OR p_currency_code IS NULL
4337 OR p_currency_code <> fnd_api.g_miss_char
4338 ) THEN
4339 l_costs := task_rec.costs;
4340 l_currency_code := task_rec.currency_code;
4341 jtf_task_utl.validate_costs(p_costs => l_costs, p_currency_code => l_currency_code
4342 , x_return_status => x_return_status);
4343
4344 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4345 x_return_status := fnd_api.g_ret_sts_unexp_error;
4346 RAISE fnd_api.g_exc_unexpected_error;
4347 END IF;
4348 END IF;
4349
4350 ---------------
4351 --------------- Bound mode code.
4352 ---------------
4353 l_bound_mode_code := task_rec.bound_mode_code;
4354
4355 IF l_bound_mode_code IS NOT NULL AND l_bound_mode_code <> fnd_api.g_miss_char THEN
4356 y := jtf_task_utl.validate_lookup('JTF_TASK_BOUND_MODE_CODE', l_bound_mode_code, NULL);
4357
4358 IF y = FALSE THEN
4359 x_return_status := fnd_api.g_ret_sts_unexp_error;
4360 RAISE fnd_api.g_exc_unexpected_error;
4361 END IF;
4362 END IF;
4363
4364 ---------------
4365 --------------- Validate date_selected
4366 ---------------
4367 l_date_selected := task_rec.date_selected;
4368
4369 IF l_date_selected IS NOT NULL AND l_date_selected <> fnd_api.g_miss_char THEN
4370 IF l_date_selected NOT IN('P', 'S', 'A', 'D') THEN
4371 x_return_status := fnd_api.g_ret_sts_unexp_error;
4372 RAISE fnd_api.g_exc_unexpected_error;
4373 END IF;
4374 END IF;
4375
4376 ---------------
4377 --------------- Validate owner_status_id
4378 ---------------
4379 IF p_owner_status_id IS NOT NULL AND p_owner_status_id <> fnd_api.g_miss_num THEN
4380 OPEN c_owner_status_id(p_owner_status_id);
4381
4382 FETCH c_owner_status_id
4383 INTO l_owner_status_id;
4384
4385 IF c_owner_status_id%NOTFOUND THEN
4386 CLOSE c_owner_status_id;
4387
4388 x_return_status := fnd_api.g_ret_sts_unexp_error;
4389 RAISE fnd_api.g_exc_unexpected_error;
4390 ELSE
4391 CLOSE c_owner_status_id;
4392 END IF;
4393 ELSE
4394 -- Added NVL on 08/08/2006 for bug# 5452407
4395 l_owner_status_id := NVL(fnd_profile.VALUE(NAME => 'JTF_TASK_DEFAULT_ASSIGNEE_STATUS'), 3);
4396 END IF;
4397
4398 ------- Validating the parent task id
4399 -------
4400 IF (p_parent_task_id IS NOT NULL AND p_parent_task_id <> fnd_api.g_miss_num)
4401 OR (p_parent_task_number IS NOT NULL AND p_parent_task_number <> fnd_api.g_miss_char) THEN
4402 SELECT DECODE(p_parent_task_id, fnd_api.g_miss_num, NULL, p_parent_task_id)
4403 INTO l_parent_task_id
4404 FROM DUAL;
4405
4406 SELECT DECODE(p_parent_task_number, fnd_api.g_miss_char, NULL, p_parent_task_number)
4407 INTO l_parent_task_number
4408 FROM DUAL;
4409
4410 jtf_task_utl.validate_task(
4411 p_task_id => l_parent_task_id
4412 , p_task_number => l_parent_task_number
4413 , x_task_id => l_parent_task_id
4414 , x_return_status => x_return_status
4415 );
4416
4417 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4418 x_return_status := fnd_api.g_ret_sts_unexp_error;
4419 RAISE fnd_api.g_exc_unexpected_error;
4420 END IF;
4421 -- Bug 2786689 : Fixing Cyclic Task Issue : Removed code to
4422 -- PVT api.
4423 ELSE
4424 l_parent_task_id := p_parent_task_id;
4425 END IF;
4426
4427 l_reason_code := task_rec.reason_code;
4428 jtf_tasks_pvt.update_task(
4429 p_api_version => 1.0
4430 , p_init_msg_list => fnd_api.g_false
4431 , p_commit => fnd_api.g_false
4432 , p_object_version_number => p_object_version_number
4433 , p_task_id => l_task_id
4434 , p_task_name => l_task_name
4435 , p_task_type_id => l_task_type_id
4436 , p_description => task_rec.description
4440 , p_owner_id => l_owner_id
4437 , p_task_status_id => l_task_status_id
4438 , p_task_priority_id => l_task_priority_id
4439 , p_owner_type_code => l_owner_type_code
4441 , p_owner_territory_id => p_owner_territory_id
4442 , p_assigned_by_id => l_assigned_by_id
4443 , p_customer_id => l_customer_id
4444 , p_cust_account_id => l_cust_account_id
4445 , p_address_id => l_address_id
4446 , p_planned_start_date => l_planned_start_date
4447 , p_planned_end_date => l_planned_end_date
4448 , p_scheduled_start_date => l_scheduled_start_date
4449 , p_scheduled_end_date => l_scheduled_end_date
4450 , p_actual_start_date => l_actual_start_date
4451 , p_actual_end_date => l_actual_end_date
4452 , p_timezone_id => l_timezone_id
4453 , p_source_object_type_code => l_source_object_type_code
4454 , p_source_object_id => l_source_object_id
4455 , p_source_object_name => l_source_object_name
4456 , p_duration => l_duration
4457 , p_duration_uom => l_duration_uom
4458 , p_planned_effort => l_planned_effort
4459 , p_planned_effort_uom => l_planned_effort_uom
4460 , p_actual_effort => l_actual_effort
4461 , p_actual_effort_uom => l_actual_effort_uom
4462 , p_percentage_complete => l_percentage_complete
4463 , p_reason_code => l_reason_code
4464 , p_private_flag => l_private_flag
4465 , p_publish_flag => l_publish_flag
4466 , p_restrict_closure_flag => l_restrict_closure_flag
4467 , p_multi_booked_flag => l_multi_booked_flag
4468 , p_milestone_flag => l_milestone_flag
4469 , p_holiday_flag => l_holiday_flag
4470 , p_billable_flag => l_billable_flag
4471 , p_bound_mode_code => l_bound_mode_code
4472 , p_soft_bound_flag => l_soft_bound_flag
4473 , p_workflow_process_id => task_rec.workflow_process_id
4474 , p_notification_flag => l_notification_flag
4475 , p_notification_period => l_notification_period
4476 , p_notification_period_uom => l_notification_period_uom
4477 , p_parent_task_id => l_parent_task_id
4478 , p_alarm_start => l_alarm_start
4479 , p_alarm_start_uom => l_alarm_start_uom
4480 , p_alarm_on => l_alarm_on
4481 , p_alarm_count => l_alarm_count
4482 , p_alarm_fired_count => l_alarm_fired_count
4483 , p_alarm_interval => l_alarm_interval
4484 , p_alarm_interval_uom => l_alarm_interval_uom
4485 , p_palm_flag => l_palm_flag
4486 , p_wince_flag => l_wince_flag
4487 , p_laptop_flag => l_laptop_flag
4488 , p_device1_flag => l_device1_flag
4489 , p_device2_flag => l_device2_flag
4490 , p_device3_flag => l_device3_flag
4491 , p_costs => l_costs
4492 , p_currency_code => l_currency_code
4493 , p_escalation_level => p_escalation_level
4494 , x_return_status => x_return_status
4495 , x_msg_count => x_msg_count
4496 , x_msg_data => x_msg_data
4497 , p_attribute1 => task_rec.attribute1
4498 , p_attribute2 => task_rec.attribute2
4499 , p_attribute3 => task_rec.attribute3
4500 , p_attribute4 => task_rec.attribute4
4501 , p_attribute5 => task_rec.attribute5
4502 , p_attribute6 => task_rec.attribute6
4503 , p_attribute7 => task_rec.attribute7
4504 , p_attribute8 => task_rec.attribute8
4505 , p_attribute9 => task_rec.attribute9
4506 , p_attribute10 => task_rec.attribute10
4507 , p_attribute11 => task_rec.attribute11
4508 , p_attribute12 => task_rec.attribute12
4509 , p_attribute13 => task_rec.attribute13
4510 , p_attribute14 => task_rec.attribute14
4511 , p_attribute15 => task_rec.attribute15
4512 , p_attribute_category => task_rec.attribute_category
4513 , p_date_selected => task_rec.date_selected
4514 , p_category_id => p_category_id
4515 , p_show_on_calendar => p_show_on_calendar
4516 , p_owner_status_id => l_owner_status_id
4517 , p_enable_workflow => p_enable_workflow
4518 , p_abort_workflow => p_abort_workflow
4519 ,
4520 -- p_task_confirmation_status => 'N', -- confirmation status should be changed in jtf_tasks_confirmations apis
4521 p_task_confirmation_status => fnd_api.g_miss_char
4522 , p_task_confirmation_counter => fnd_api.g_miss_num
4523 , p_task_split_flag => task_rec.task_split_flag
4524 , p_change_mode => jtf_task_repeat_appt_pvt.g_one
4525 , p_free_busy_type => g_free_busy_type
4526 , p_child_position => task_rec.child_position
4527 , p_child_sequence_num => task_rec.child_sequence_num
4528 , p_location_id => task_rec.location_id
4529 );
4530
4531 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4532 x_return_status := fnd_api.g_ret_sts_unexp_error;
4536 -----------
4533 RAISE fnd_api.g_exc_unexpected_error;
4534 END IF;
4535
4537 ----------- Call Internal API hooks.
4538 -----------
4539 /* jtf_tasks_iuhk.update_task_post (x_return_status);
4540
4541
4542 IF NOT (x_return_status = fnd_api.g_ret_sts_success)
4543 THEN
4544 x_return_status := fnd_api.g_ret_sts_unexp_error;
4545 RAISE fnd_api.g_exc_unexpected_error;
4546 END IF;
4547
4548 */ -----------
4549 -----------
4550 -----------
4551
4552 -- Added by SBARAT on 21/10/2005 for bug# 4670385
4553 IF fnd_api.to_boolean(p_commit) THEN
4554 COMMIT WORK;
4555 END IF;
4556
4557 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4558 EXCEPTION
4559 WHEN fnd_api.g_exc_unexpected_error THEN
4560 ROLLBACK TO update_task_pub;
4561 x_return_status := fnd_api.g_ret_sts_unexp_error;
4562 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4563 WHEN NO_DATA_FOUND THEN
4564 ROLLBACK TO update_task_pub;
4565 x_return_status := fnd_api.g_ret_sts_unexp_error;
4566 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4567 WHEN OTHERS THEN
4568 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
4569 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
4570 fnd_msg_pub.ADD;
4571 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4572 ROLLBACK TO update_task_pub;
4573 x_return_status := fnd_api.g_ret_sts_unexp_error;
4574 END;
4575
4576 -- Old Version
4577 PROCEDURE delete_task(
4578 p_api_version IN NUMBER
4579 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
4580 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
4581 , p_object_version_number IN NUMBER
4582 , p_task_id IN NUMBER DEFAULT NULL
4583 , p_task_number IN VARCHAR2 DEFAULT NULL
4584 , p_delete_future_recurrences IN VARCHAR2 DEFAULT fnd_api.g_false
4585 , x_return_status OUT NOCOPY VARCHAR2
4586 , x_msg_count OUT NOCOPY NUMBER
4587 , x_msg_data OUT NOCOPY VARCHAR2
4588 ) IS
4589 l_api_version CONSTANT NUMBER := 1.0;
4590 l_api_name CONSTANT VARCHAR2(30) := 'DELETE_TASK';
4591 BEGIN
4592 SAVEPOINT delete_task_pub2;
4593 x_return_status := fnd_api.g_ret_sts_success;
4594
4595 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
4596 RAISE fnd_api.g_exc_unexpected_error;
4597 END IF;
4598
4599 IF fnd_api.to_boolean(p_init_msg_list) THEN
4600 fnd_msg_pub.initialize;
4601 END IF;
4602
4603 delete_task(
4604 p_api_version => 1.0
4605 , p_init_msg_list => fnd_api.g_true
4606 , p_commit => fnd_api.g_false
4607 , p_object_version_number => p_object_version_number
4608 , p_task_id => p_task_id
4609 , p_task_number => p_task_number
4610 , p_delete_future_recurrences => p_delete_future_recurrences
4611 , x_return_status => x_return_status
4612 , x_msg_count => x_msg_count
4613 , x_msg_data => x_msg_data
4614 , p_enable_workflow => fnd_profile.VALUE('JTF_TASK_ENABLE_WORKFLOW')
4615 , p_abort_workflow => fnd_profile.VALUE('JTF_TASK_ABORT_PREV_WF')
4616 );
4617
4618 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4619 x_return_status := fnd_api.g_ret_sts_unexp_error;
4620 RAISE fnd_api.g_exc_unexpected_error;
4621 END IF;
4622
4623 IF fnd_api.to_boolean(p_commit) THEN
4624 COMMIT WORK;
4625 END IF;
4626
4627 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4628 EXCEPTION
4629 WHEN fnd_api.g_exc_unexpected_error THEN
4630 ROLLBACK TO delete_task_pub2;
4631 x_return_status := fnd_api.g_ret_sts_unexp_error;
4632 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4633 WHEN OTHERS THEN
4634 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
4635 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
4636 fnd_msg_pub.ADD;
4637 ROLLBACK TO delete_task_pub2;
4638 x_return_status := fnd_api.g_ret_sts_unexp_error;
4639 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4640 END;
4641
4642 -- New Version
4643 PROCEDURE delete_task(
4644 p_api_version IN NUMBER
4645 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
4646 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
4647 , p_object_version_number IN NUMBER
4648 , p_task_id IN NUMBER DEFAULT NULL
4649 , p_task_number IN VARCHAR2 DEFAULT NULL
4650 , p_delete_future_recurrences IN VARCHAR2 DEFAULT fnd_api.g_false
4651 , x_return_status OUT NOCOPY VARCHAR2
4652 , x_msg_count OUT NOCOPY NUMBER
4653 , x_msg_data OUT NOCOPY VARCHAR2
4654 , p_enable_workflow IN VARCHAR2
4655 , p_abort_workflow IN VARCHAR2
4659 l_task_id jtf_tasks_b.task_id%TYPE := p_task_id;
4656 ) IS
4657 l_api_version CONSTANT NUMBER := 1.0;
4658 l_api_name CONSTANT VARCHAR2(30) := 'DELETE_TASK';
4660 l_task_number jtf_tasks_b.task_number%TYPE := p_task_number;
4661 BEGIN
4662 SAVEPOINT delete_task_pub;
4663 x_return_status := fnd_api.g_ret_sts_success;
4664
4665 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
4666 RAISE fnd_api.g_exc_unexpected_error;
4667 END IF;
4668
4669 IF fnd_api.to_boolean(p_init_msg_list) THEN
4670 fnd_msg_pub.initialize;
4671 END IF;
4672
4673 IF (l_task_id IS NULL AND l_task_number IS NULL) THEN
4674 fnd_message.set_name('JTF', 'JTF_TASK_MISSING_TASK');
4675 fnd_msg_pub.ADD;
4676 x_return_status := fnd_api.g_ret_sts_unexp_error;
4677 RAISE fnd_api.g_exc_unexpected_error;
4678 ELSE
4679 jtf_task_utl.validate_task(
4680 p_task_id => l_task_id
4681 , p_task_number => l_task_number
4682 , x_task_id => l_task_id
4683 , x_return_status => x_return_status
4684 );
4685
4686 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4687 x_return_status := fnd_api.g_ret_sts_unexp_error;
4688 RAISE fnd_api.g_exc_unexpected_error;
4689 END IF;
4690 END IF;
4691
4692 jtf_tasks_pvt.delete_task(
4693 p_api_version => 1.0
4694 , p_init_msg_list => fnd_api.g_false
4695 , p_commit => fnd_api.g_false
4696 , p_object_version_number => p_object_version_number
4697 , p_task_id => l_task_id
4698 , p_delete_future_recurrences => p_delete_future_recurrences
4699 , x_return_status => x_return_status
4700 , x_msg_count => x_msg_count
4701 , x_msg_data => x_msg_data
4702 , p_enable_workflow => p_enable_workflow
4703 , p_abort_workflow => p_abort_workflow
4704 );
4705
4706 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4707 x_return_status := fnd_api.g_ret_sts_unexp_error;
4708 RAISE fnd_api.g_exc_unexpected_error;
4709 END IF;
4710
4711 IF fnd_api.to_boolean(p_commit) THEN
4712 COMMIT WORK;
4713 END IF;
4714
4715 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4716 EXCEPTION
4717 WHEN fnd_api.g_exc_unexpected_error THEN
4718 ROLLBACK TO delete_task_pub;
4719 x_return_status := fnd_api.g_ret_sts_unexp_error;
4720 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4721 WHEN OTHERS THEN
4722 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
4723 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
4724 fnd_msg_pub.ADD;
4725 ROLLBACK TO delete_task_pub;
4726 x_return_status := fnd_api.g_ret_sts_unexp_error;
4727 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4728 END;
4729
4730 PROCEDURE export_query_task -- INPUT VARIABLES
4731
4732 -- p_file_name - file name for output of export file, always
4733 -- placed in /sqlcom/out directory
4734 --
4735 -- possible query variables which are named after fields in jtf_tasks_v
4736 -- p_task_number - query by task number
4737 -- p_task_id
4738 -- p_task_name
4739 -- p_description
4740 -- p_task_status_name
4741 -- p_task_status_id
4742 -- p_task_priority_name
4743 -- p_task_priority_id
4744 -- p_owner_type_code
4745 -- p_owner_id
4746 -- p_assigned_name
4747 -- p_assigned_by_id
4748 -- p_address_id
4749 -- p_planned_start_date
4750 -- p_planned_end_date
4751 -- p_scheduled_start_date
4752 -- p_scheduled_end_date
4753 -- p_actual_start_date
4754 -- p_actual_end_date
4755 -- p_object_type_code
4756 -- p_object_name
4757 -- p_percentage_complete
4758 -- p_reason_code
4759 -- p_private_flag
4760 -- p_restrict_closure_flag
4761 -- p_multi_booked_flag
4762 -- p_milestone_flag
4763 -- p_holiday_flag
4764 -- p_workflow_process_id
4765 -- p_notification_flag
4766 -- p_parent_task_id
4767 -- p_alarm_on
4768 -- p_alarm_count
4769 -- p_alarm_fired_count
4773 --
4770 --
4771 -- p_ref_object_id -- referenced object id
4772 -- p_ref_object_type_code -- referenced object type code
4774 -- p_sort_data -- sort data structucture based on sort date
4775 -- p_start_pointer -- return records starting at this number
4776 -- p_rec_wanted -- return the next 'n' records from start_pointer
4777 -- p_show_all -- return all the records (value Y or N), overrides start_pointer, rec_wanted
4778 -- p_query_or_next_code -- run query or retrieve records from previous query (value Q/N)
4779 --
4780 -- OUTPUT values
4781 -- x_task_table -- pl/sql table of records
4782 -- x_total_retrieved -- total number of records selected by query
4783 -- x_total_returned -- number of records returned in pl/sql table
4784 (
4785 p_api_version IN NUMBER
4786 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
4787 , p_validate_level IN VARCHAR2 DEFAULT fnd_api.g_valid_level_full
4788 , p_file_name IN VARCHAR2
4789 , p_task_number IN jtf_tasks_v.task_number%TYPE DEFAULT NULL
4790 , p_task_id IN jtf_tasks_v.task_id%TYPE DEFAULT NULL
4791 , p_task_name IN jtf_tasks_v.task_name%TYPE DEFAULT NULL
4792 , p_description IN jtf_tasks_v.description%TYPE DEFAULT NULL
4793 , p_task_type_name IN jtf_tasks_v.task_type%TYPE DEFAULT NULL
4794 , p_task_type_id IN jtf_tasks_v.task_type_id%TYPE DEFAULT NULL
4795 , p_task_status_name IN jtf_tasks_v.task_status%TYPE DEFAULT NULL
4796 , p_task_status_id IN jtf_tasks_v.task_status_id%TYPE DEFAULT NULL
4797 , p_task_priority_name IN jtf_tasks_v.task_priority%TYPE DEFAULT NULL
4798 , p_task_priority_id IN jtf_tasks_v.task_priority_id%TYPE DEFAULT NULL
4799 , p_owner_type_code IN jtf_tasks_v.owner_type_code%TYPE DEFAULT NULL
4800 , p_owner_id IN jtf_tasks_v.owner_id%TYPE DEFAULT NULL
4801 , p_assigned_name IN jtf_tasks_v.assigned_by_name%TYPE DEFAULT NULL
4802 , p_assigned_by_id IN jtf_tasks_v.assigned_by_id%TYPE DEFAULT NULL
4803 , p_address_id IN jtf_tasks_v.address_id%TYPE DEFAULT NULL
4804 , p_owner_territory_id IN jtf_tasks_v.owner_territory_id%TYPE DEFAULT NULL
4805 , p_customer_id IN jtf_tasks_v.customer_id%TYPE DEFAULT NULL
4806 , p_customer_name IN jtf_tasks_v.customer_name%TYPE DEFAULT NULL
4807 , p_customer_number IN jtf_tasks_v.customer_number%TYPE DEFAULT NULL
4808 , p_cust_account_number IN jtf_tasks_v.cust_account_number%TYPE DEFAULT NULL
4809 , p_cust_account_id IN jtf_tasks_v.cust_account_id%TYPE DEFAULT NULL
4810 , p_planned_start_date IN jtf_tasks_v.planned_start_date%TYPE DEFAULT NULL
4811 , p_planned_end_date IN jtf_tasks_v.planned_end_date%TYPE DEFAULT NULL
4812 , p_scheduled_start_date IN jtf_tasks_v.scheduled_start_date%TYPE DEFAULT NULL
4813 , p_scheduled_end_date IN jtf_tasks_v.scheduled_end_date%TYPE DEFAULT NULL
4814 , p_actual_start_date IN jtf_tasks_v.actual_start_date%TYPE DEFAULT NULL
4815 , p_actual_end_date IN jtf_tasks_v.actual_end_date%TYPE DEFAULT NULL
4816 , p_object_type_code IN jtf_tasks_v.source_object_type_code%TYPE DEFAULT NULL
4817 , p_object_name IN jtf_tasks_v.source_object_name%TYPE DEFAULT NULL
4818 , p_source_object_id IN jtf_tasks_v.source_object_id%TYPE DEFAULT NULL
4819 , p_percentage_complete IN jtf_tasks_v.percentage_complete%TYPE DEFAULT NULL
4820 , p_reason_code IN jtf_tasks_v.reason_code%TYPE DEFAULT NULL
4821 , p_private_flag IN jtf_tasks_v.private_flag%TYPE DEFAULT NULL
4822 , p_restrict_closure_flag IN jtf_tasks_v.restrict_closure_flag%TYPE DEFAULT NULL
4823 , p_multi_booked_flag IN jtf_tasks_v.multi_booked_flag%TYPE DEFAULT NULL
4824 , p_milestone_flag IN jtf_tasks_v.milestone_flag%TYPE DEFAULT NULL
4825 , p_holiday_flag IN jtf_tasks_v.holiday_flag%TYPE DEFAULT NULL
4826 , p_workflow_process_id IN jtf_tasks_v.workflow_process_id%TYPE DEFAULT NULL
4827 , p_notification_flag IN jtf_tasks_v.notification_flag%TYPE DEFAULT NULL
4828 , p_parent_task_id IN jtf_tasks_v.parent_task_id%TYPE DEFAULT NULL
4829 , p_alarm_on IN jtf_tasks_v.alarm_on%TYPE DEFAULT NULL
4830 , p_alarm_count IN jtf_tasks_v.alarm_count%TYPE DEFAULT NULL
4831 , p_alarm_fired_count IN jtf_tasks_v.alarm_fired_count%TYPE DEFAULT NULL
4832 , p_ref_object_id IN NUMBER DEFAULT NULL
4833 , p_ref_object_type_code IN VARCHAR2 DEFAULT NULL
4834 , p_sort_data IN sort_data
4835 , p_start_pointer IN NUMBER
4836 , p_rec_wanted IN NUMBER
4837 , p_show_all IN VARCHAR2
4838 , p_query_or_next_code IN VARCHAR2 DEFAULT 'Q'
4842 , x_return_status OUT NOCOPY VARCHAR2
4839 , x_task_table OUT NOCOPY task_table_type
4840 , x_total_retrieved OUT NOCOPY NUMBER
4841 , x_total_returned OUT NOCOPY NUMBER
4843 , x_msg_count OUT NOCOPY NUMBER
4844 , x_msg_data OUT NOCOPY VARCHAR2
4845 , x_object_version_number IN OUT NOCOPY NUMBER
4846 ) IS
4847 l_api_version CONSTANT NUMBER := 1.0;
4848 l_api_name CONSTANT VARCHAR2(30) := 'EXPORT_QUERY_TASK';
4849 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
4850 l_msg_data VARCHAR2(2000);
4851 l_msg_count NUMBER;
4852 BEGIN
4853 x_return_status := fnd_api.g_ret_sts_success;
4854
4855 -- standard call to check for call compatibility
4856 IF (NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name)) THEN
4857 RAISE fnd_api.g_exc_unexpected_error;
4858 END IF;
4859
4860 -- initialize message list i p_init_msg_list is set to true
4861 IF (fnd_api.to_boolean(p_init_msg_list)) THEN
4862 fnd_msg_pub.initialize;
4863 END IF;
4864
4865 export_query_task(
4866 p_api_version => p_api_version
4867 , p_init_msg_list => p_init_msg_list
4868 , p_validate_level => p_validate_level
4869 , p_file_name => p_file_name
4870 , p_task_number => p_task_number
4871 , p_task_id => p_task_id
4872 , p_task_name => p_task_name
4873 , p_description => p_description
4874 , p_task_type_name => p_task_type_name
4875 , p_task_type_id => p_task_type_id
4876 , p_task_status_name => p_task_status_name
4877 , p_task_status_id => p_task_status_id
4878 , p_task_priority_name => p_task_priority_name
4879 , p_task_priority_id => p_task_priority_id
4880 , p_owner_type_code => p_owner_type_code
4881 , p_owner_id => p_owner_id
4882 , p_assigned_name => p_assigned_name
4883 , p_assigned_by_id => p_assigned_by_id
4884 , p_address_id => p_address_id
4885 , p_owner_territory_id => p_owner_territory_id
4886 , p_customer_id => p_customer_id
4887 , p_customer_name => p_customer_name
4888 , p_customer_number => p_customer_number
4889 , p_cust_account_number => p_cust_account_number
4890 , p_cust_account_id => p_cust_account_id
4891 , p_planned_start_date => p_planned_start_date
4892 , p_planned_end_date => p_planned_end_date
4893 , p_scheduled_start_date => p_scheduled_start_date
4894 , p_scheduled_end_date => p_scheduled_end_date
4895 , p_actual_start_date => p_actual_start_date
4896 , p_actual_end_date => p_actual_end_date
4897 , p_object_type_code => p_object_type_code
4898 , p_object_name => p_object_name
4899 , p_source_object_id => p_source_object_id
4900 , p_percentage_complete => p_percentage_complete
4901 , p_reason_code => p_reason_code
4902 , p_private_flag => p_private_flag
4903 , p_restrict_closure_flag => p_restrict_closure_flag
4904 , p_multi_booked_flag => p_multi_booked_flag
4905 , p_milestone_flag => p_milestone_flag
4906 , p_holiday_flag => p_holiday_flag
4907 , p_workflow_process_id => p_workflow_process_id
4908 , p_notification_flag => p_notification_flag
4909 , p_parent_task_id => p_parent_task_id
4910 , p_alarm_on => p_alarm_on
4911 , p_alarm_count => p_alarm_count
4912 , p_alarm_fired_count => p_alarm_fired_count
4913 , p_ref_object_id => p_ref_object_id
4914 , p_ref_object_type_code => p_ref_object_type_code
4915 , p_sort_data => p_sort_data
4916 , p_start_pointer => p_start_pointer
4917 , p_rec_wanted => p_rec_wanted
4918 , p_show_all => p_show_all
4919 , p_query_or_next_code => p_query_or_next_code
4920 , x_task_table => x_task_table
4921 , x_total_retrieved => x_total_retrieved
4922 , x_total_returned => x_total_returned
4923 , x_return_status => x_return_status
4924 , x_msg_count => x_msg_count
4925 , x_msg_data => x_msg_data
4926 , x_object_version_number => x_object_version_number
4927 , p_location_id => NULL
4928 );
4929 EXCEPTION
4930 WHEN fnd_api.g_exc_error THEN
4931 x_return_status := fnd_api.g_ret_sts_error;
4932 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4933 WHEN fnd_api.g_exc_unexpected_error THEN
4934 x_return_status := fnd_api.g_ret_sts_unexp_error;
4935 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4936 WHEN OTHERS THEN
4937 x_return_status := fnd_api.g_ret_sts_unexp_error;
4938
4939 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
4940 fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
4941 END IF;
4942
4943 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4944 END export_query_task;
4945
4949 -- placed in /sqlcom/out directory
4946 PROCEDURE export_query_task -- INPUT VARIABLES
4947
4948 -- p_file_name - file name for output of export file, always
4950 --
4951 -- possible query variables which are named after fields in jtf_tasks_v
4952 -- p_task_number - query by task number
4953 -- p_task_id
4954 -- p_task_name
4955 -- p_description
4956 -- p_task_status_name
4957 -- p_task_status_id
4958 -- p_task_priority_name
4959 -- p_task_priority_id
4960 -- p_owner_type_code
4961 -- p_owner_id
4962 -- p_assigned_name
4963 -- p_assigned_by_id
4964 -- p_address_id
4965 -- p_planned_start_date
4966 -- p_planned_end_date
4967 -- p_scheduled_start_date
4968 -- p_scheduled_end_date
4969 -- p_actual_start_date
4970 -- p_actual_end_date
4971 -- p_object_type_code
4972 -- p_object_name
4973 -- p_percentage_complete
4974 -- p_reason_code
4975 -- p_private_flag
4976 -- p_restrict_closure_flag
4977 -- p_multi_booked_flag
4978 -- p_milestone_flag
4979 -- p_holiday_flag
4980 -- p_workflow_process_id
4981 -- p_notification_flag
4982 -- p_parent_task_id
4983 -- p_alarm_on
4984 -- p_alarm_count
4985 -- p_alarm_fired_count
4986 --
4987 -- p_ref_object_id -- referenced object id
4988 -- p_ref_object_type_code -- referenced object type code
4989 --
4990 -- p_sort_data -- sort data structucture based on sort date
4991 -- p_start_pointer -- return records starting at this number
4992 -- p_rec_wanted -- return the next 'n' records from start_pointer
4993 -- p_show_all -- return all the records (value Y or N), overrides start_pointer, rec_wanted
4994 -- p_query_or_next_code -- run query or retrieve records from previous query (value Q/N)
4995 --
4996 -- OUTPUT values
4997 -- x_task_table -- pl/sql table of records
4998 -- x_total_retrieved -- total number of records selected by query
4999 -- x_total_returned -- number of records returned in pl/sql table
5000 (
5001 p_api_version IN NUMBER
5002 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
5003 , p_validate_level IN VARCHAR2 DEFAULT fnd_api.g_valid_level_full
5004 , p_file_name IN VARCHAR2
5005 , p_task_number IN jtf_tasks_v.task_number%TYPE DEFAULT NULL
5006 , p_task_id IN jtf_tasks_v.task_id%TYPE DEFAULT NULL
5007 , p_task_name IN jtf_tasks_v.task_name%TYPE DEFAULT NULL
5008 , p_description IN jtf_tasks_v.description%TYPE DEFAULT NULL
5009 , p_task_type_name IN jtf_tasks_v.task_type%TYPE DEFAULT NULL
5010 , p_task_type_id IN jtf_tasks_v.task_type_id%TYPE DEFAULT NULL
5011 , p_task_status_name IN jtf_tasks_v.task_status%TYPE DEFAULT NULL
5012 , p_task_status_id IN jtf_tasks_v.task_status_id%TYPE DEFAULT NULL
5013 , p_task_priority_name IN jtf_tasks_v.task_priority%TYPE DEFAULT NULL
5014 , p_task_priority_id IN jtf_tasks_v.task_priority_id%TYPE DEFAULT NULL
5015 , p_owner_type_code IN jtf_tasks_v.owner_type_code%TYPE DEFAULT NULL
5016 , p_owner_id IN jtf_tasks_v.owner_id%TYPE DEFAULT NULL
5017 , p_assigned_name IN jtf_tasks_v.assigned_by_name%TYPE DEFAULT NULL
5018 , p_assigned_by_id IN jtf_tasks_v.assigned_by_id%TYPE DEFAULT NULL
5019 , p_address_id IN jtf_tasks_v.address_id%TYPE DEFAULT NULL
5020 , p_owner_territory_id IN jtf_tasks_v.owner_territory_id%TYPE DEFAULT NULL
5021 , p_customer_id IN jtf_tasks_v.customer_id%TYPE DEFAULT NULL
5022 , p_customer_name IN jtf_tasks_v.customer_name%TYPE DEFAULT NULL
5023 , p_customer_number IN jtf_tasks_v.customer_number%TYPE DEFAULT NULL
5024 , p_cust_account_number IN jtf_tasks_v.cust_account_number%TYPE DEFAULT NULL
5025 , p_cust_account_id IN jtf_tasks_v.cust_account_id%TYPE DEFAULT NULL
5029 , p_scheduled_end_date IN jtf_tasks_v.scheduled_end_date%TYPE DEFAULT NULL
5026 , p_planned_start_date IN jtf_tasks_v.planned_start_date%TYPE DEFAULT NULL
5027 , p_planned_end_date IN jtf_tasks_v.planned_end_date%TYPE DEFAULT NULL
5028 , p_scheduled_start_date IN jtf_tasks_v.scheduled_start_date%TYPE DEFAULT NULL
5030 , p_actual_start_date IN jtf_tasks_v.actual_start_date%TYPE DEFAULT NULL
5031 , p_actual_end_date IN jtf_tasks_v.actual_end_date%TYPE DEFAULT NULL
5032 , p_object_type_code IN jtf_tasks_v.source_object_type_code%TYPE DEFAULT NULL
5033 , p_object_name IN jtf_tasks_v.source_object_name%TYPE DEFAULT NULL
5034 , p_source_object_id IN jtf_tasks_v.source_object_id%TYPE DEFAULT NULL
5035 , p_percentage_complete IN jtf_tasks_v.percentage_complete%TYPE DEFAULT NULL
5036 , p_reason_code IN jtf_tasks_v.reason_code%TYPE DEFAULT NULL
5037 , p_private_flag IN jtf_tasks_v.private_flag%TYPE DEFAULT NULL
5038 , p_restrict_closure_flag IN jtf_tasks_v.restrict_closure_flag%TYPE DEFAULT NULL
5039 , p_multi_booked_flag IN jtf_tasks_v.multi_booked_flag%TYPE DEFAULT NULL
5040 , p_milestone_flag IN jtf_tasks_v.milestone_flag%TYPE DEFAULT NULL
5041 , p_holiday_flag IN jtf_tasks_v.holiday_flag%TYPE DEFAULT NULL
5042 , p_workflow_process_id IN jtf_tasks_v.workflow_process_id%TYPE DEFAULT NULL
5043 , p_notification_flag IN jtf_tasks_v.notification_flag%TYPE DEFAULT NULL
5044 , p_parent_task_id IN jtf_tasks_v.parent_task_id%TYPE DEFAULT NULL
5045 , p_alarm_on IN jtf_tasks_v.alarm_on%TYPE DEFAULT NULL
5046 , p_alarm_count IN jtf_tasks_v.alarm_count%TYPE DEFAULT NULL
5047 , p_alarm_fired_count IN jtf_tasks_v.alarm_fired_count%TYPE DEFAULT NULL
5048 , p_ref_object_id IN NUMBER DEFAULT NULL
5049 , p_ref_object_type_code IN VARCHAR2 DEFAULT NULL
5050 , p_sort_data IN sort_data
5051 , p_start_pointer IN NUMBER
5052 , p_rec_wanted IN NUMBER
5053 , p_show_all IN VARCHAR2
5054 , p_query_or_next_code IN VARCHAR2 DEFAULT 'Q'
5055 , x_task_table OUT NOCOPY task_table_type
5056 , x_total_retrieved OUT NOCOPY NUMBER
5057 , x_total_returned OUT NOCOPY NUMBER
5058 , x_return_status OUT NOCOPY VARCHAR2
5059 , x_msg_count OUT NOCOPY NUMBER
5060 , x_msg_data OUT NOCOPY VARCHAR2
5061 , x_object_version_number IN OUT NOCOPY NUMBER
5062 , p_location_id IN NUMBER
5063 ) IS
5064 l_api_version CONSTANT NUMBER := 1.0;
5065 l_api_name CONSTANT VARCHAR2(30) := 'EXPORT_QUERY_TASK';
5066 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
5067 l_msg_data VARCHAR2(2000);
5068 l_msg_count NUMBER;
5069 v_task_table jtf_tasks_pub.task_table_type;
5070 BEGIN
5071 x_return_status := fnd_api.g_ret_sts_success;
5072
5073 -- standard call to check for call compatibility
5074 IF (NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name)) THEN
5075 RAISE fnd_api.g_exc_unexpected_error;
5076 END IF;
5077
5078 -- initialize message list i p_init_msg_list is set to true
5079 IF (fnd_api.to_boolean(p_init_msg_list)) THEN
5080 fnd_msg_pub.initialize;
5081 END IF;
5082
5083 query_task(
5084 p_api_version
5085 , p_init_msg_list
5086 , p_validate_level
5087 , p_task_number
5088 , p_task_id
5089 , p_task_name
5090 , p_description
5091 , p_task_type_name
5092 , p_task_type_id
5093 , p_task_status_name
5094 , p_task_status_id
5095 , p_task_priority_name
5096 , p_task_priority_id
5097 , p_owner_type_code
5098 , p_owner_id
5099 , p_assigned_name
5100 , p_assigned_by_id
5101 , p_address_id
5102 , p_owner_territory_id
5103 , p_customer_id
5104 , p_customer_name
5105 , p_customer_number
5106 , p_cust_account_number
5107 , p_cust_account_id
5108 , p_planned_start_date
5109 , p_planned_end_date
5110 , p_scheduled_start_date
5111 , p_scheduled_end_date
5112 , p_actual_start_date
5113 , p_actual_end_date
5114 , p_object_type_code
5115 , p_object_name
5116 , p_source_object_id
5117 , p_percentage_complete
5118 , p_reason_code
5119 , p_private_flag
5120 , p_restrict_closure_flag
5121 , p_multi_booked_flag
5122 , p_milestone_flag
5123 , p_holiday_flag
5124 , p_workflow_process_id
5125 , p_notification_flag
5126 , p_parent_task_id
5127 , p_alarm_on
5128 , p_alarm_count
5129 , p_alarm_fired_count
5130 , p_ref_object_id
5131 , p_ref_object_type_code
5132 , p_sort_data
5133 , p_start_pointer
5134 , p_rec_wanted
5135 , p_show_all
5136 , p_query_or_next_code
5137 , v_task_table
5138 , x_total_retrieved
5139 , x_total_returned
5140 , x_return_status
5141 , x_msg_count
5142 , x_msg_data
5143 , x_object_version_number
5144 , p_location_id
5148 , p_init_msg_list
5145 );
5146 export_file(
5147 p_api_version
5149 , p_validate_level
5150 , p_file_name
5151 , v_task_table
5152 , x_return_status
5153 , x_msg_count
5154 , x_msg_data
5155 , x_object_version_number
5156 );
5157 EXCEPTION
5158 WHEN fnd_api.g_exc_error THEN
5159 x_return_status := fnd_api.g_ret_sts_error;
5160 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5161 WHEN fnd_api.g_exc_unexpected_error THEN
5162 x_return_status := fnd_api.g_ret_sts_unexp_error;
5163 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5164 WHEN OTHERS THEN
5165 x_return_status := fnd_api.g_ret_sts_unexp_error;
5166
5167 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
5168 fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
5169 END IF;
5170
5171 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5172 END export_query_task;
5173
5174 PROCEDURE export_file(
5175 p_api_version IN NUMBER
5176 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
5177 , p_validate_level IN VARCHAR2 DEFAULT fnd_api.g_valid_level_full
5178 , p_file_name IN VARCHAR2
5179 , p_task_table IN jtf_tasks_pub.task_table_type
5180 , x_return_status OUT NOCOPY VARCHAR2
5181 , x_msg_count OUT NOCOPY NUMBER
5182 , x_msg_data OUT NOCOPY VARCHAR2
5183 , x_object_version_number IN OUT NOCOPY NUMBER
5184 ) IS
5185 l_path CONSTANT VARCHAR2(30) := '/sqlcom/out'; -- directory for file output
5186 l_api_version CONSTANT NUMBER := 1.0;
5187 l_api_name CONSTANT VARCHAR2(30) := 'EXPORT_FILE';
5188 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
5189 l_msg_data VARCHAR2(2000);
5190 l_msg_count NUMBER;
5191 l_tbl_count NUMBER := p_task_table.COUNT;
5192 BEGIN -- export_file
5193 x_return_status := fnd_api.g_ret_sts_success;
5194
5195 -- standard call to check for call compatibility
5196 IF (NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name)) THEN
5197 RAISE fnd_api.g_exc_unexpected_error;
5198 END IF;
5199
5200 -- initialize message list i p_init_msg_list is set to true
5201 IF (fnd_api.to_boolean(p_init_msg_list)) THEN
5202 fnd_msg_pub.initialize;
5203 END IF;
5204
5205 -- required parameters to control records returned
5206
5207 -- p_file_name must not be null
5208 IF (p_file_name IS NULL) THEN
5209 fnd_message.set_name('JTF', 'JTF_TK_EXP_FILE_NAME_NULL');
5210 RAISE fnd_api.g_exc_error;
5211 END IF;
5212
5213 -- l_table_count must be > 0, or no records are in the table
5214 IF (l_tbl_count = 0) THEN
5215 fnd_message.set_name('JTF', 'JTF_TK_EXP_TABLE_EMPTY');
5216 RAISE fnd_api.g_exc_error;
5217 END IF;
5218
5219 jtf_tasks_pvt.export_file(l_path, p_file_name, p_task_table, x_return_status, x_msg_count
5220 , x_msg_data);
5221 EXCEPTION
5222 WHEN fnd_api.g_exc_error THEN
5223 ROLLBACK TO query_next_task;
5224 x_return_status := fnd_api.g_ret_sts_error;
5225 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5226 WHEN fnd_api.g_exc_unexpected_error THEN
5227 ROLLBACK TO query_next_task;
5228 x_return_status := fnd_api.g_ret_sts_unexp_error;
5229 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5230 WHEN OTHERS THEN
5231 ROLLBACK TO query_next_task;
5232 x_return_status := fnd_api.g_ret_sts_unexp_error;
5233
5234 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
5235 fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
5236 END IF;
5237
5238 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5239 END export_file;
5240
5241 PROCEDURE val_task(
5242 v_task_id IN OUT NOCOPY jtf_tasks_v.task_id%TYPE
5243 , p_task_number IN jtf_tasks_v.task_number%TYPE
5244 , p_task_name IN jtf_tasks_v.task_name%TYPE
5245 ) IS
5246 CURSOR c_task_number IS
5247 SELECT task_id
5248 FROM jtf_tasks_b
5249 WHERE task_number = p_task_number;
5250
5251 CURSOR c_task_name IS
5252 -- Fix for Bug # 2516412 - changed the view jtf_tasks_v to jtf_tasks_vl
5253 SELECT NULL
5254 FROM jtf_tasks_vl
5255 WHERE task_name = p_task_name AND NVL(deleted_flag, 'N') = 'N';
5256
5257 v_dummy VARCHAR2(1);
5258 BEGIN
5259 IF (p_task_number IS NOT NULL) THEN
5260 OPEN c_task_number;
5261
5262 FETCH c_task_number
5263 INTO v_task_id;
5264
5265 IF c_task_number%NOTFOUND THEN
5266 CLOSE c_task_number;
5267
5268 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_TASK_NUMBER');
5269 fnd_message.set_token('P_TASK_NUMBER', p_task_number);
5270 fnd_msg_pub.ADD;
5271 RAISE fnd_api.g_exc_error;
5272 ELSE
5273 CLOSE c_task_number;
5274 END IF;
5275 ELSIF(p_task_name IS NOT NULL) THEN
5276 OPEN c_task_name;
5277
5278 FETCH c_task_name
5279 INTO v_dummy;
5280
5284 fnd_message.set_name('JTF', 'JTF_TASK_INV_TK_NAME');
5281 IF c_task_name%NOTFOUND THEN
5282 CLOSE c_task_name;
5283
5285 fnd_msg_pub.ADD;
5286 RAISE fnd_api.g_exc_error;
5287 ELSE
5288 CLOSE c_task_name;
5289 END IF;
5290 END IF;
5291 END;
5292
5293 PROCEDURE val_task_id(p_task_id IN jtf_tasks_v.task_id%TYPE) IS
5294 CURSOR c_task_id IS
5295 SELECT NULL
5296 FROM jtf_tasks_b
5297 WHERE task_id = p_task_id;
5298
5299 v_dummy VARCHAR2(1);
5300 BEGIN
5301 IF (p_task_id IS NOT NULL) THEN
5302 OPEN c_task_id;
5303
5304 FETCH c_task_id
5305 INTO v_dummy;
5306
5307 IF c_task_id%NOTFOUND THEN
5308 CLOSE c_task_id;
5309
5310 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_TASK_ID');
5311 fnd_message.set_token('P_TASK_ID', p_task_id);
5312 fnd_msg_pub.ADD;
5313 RAISE fnd_api.g_exc_error;
5314 ELSE
5315 CLOSE c_task_id;
5316 END IF;
5317 END IF;
5318 END val_task_id;
5319
5320 PROCEDURE val_dates(p_start IN DATE, p_end IN DATE) IS
5321 BEGIN
5322 IF (p_start IS NOT NULL) AND(p_end IS NOT NULL) THEN
5323 IF (p_end < p_start) THEN
5324 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_DATES');
5325 fnd_message.set_token('P_DATE_TAG', p_start);
5326 fnd_msg_pub.ADD;
5327 RAISE fnd_api.g_exc_error;
5328 END IF;
5329 END IF;
5330 END val_dates;
5331
5332 PROCEDURE val_assigned(
5333 v_assigned_by_id IN OUT NOCOPY jtf_tasks_v.assigned_by_id%TYPE
5334 , p_assigned_name IN jtf_tasks_v.assigned_by_name%TYPE
5335 ) IS
5336 CURSOR c_assigned_by_name IS
5337 SELECT user_id assigned_by_id
5338 FROM fnd_user
5339 WHERE user_name = p_assigned_name
5340 AND NVL(end_date, SYSDATE) >= SYSDATE
5341 AND NVL(start_date, SYSDATE) <= SYSDATE;
5342 BEGIN
5343 IF (p_assigned_name IS NOT NULL) THEN
5344 OPEN c_assigned_by_name;
5345
5346 FETCH c_assigned_by_name
5347 INTO v_assigned_by_id;
5348
5349 IF c_assigned_by_name%NOTFOUND THEN
5350 CLOSE c_assigned_by_name;
5351
5352 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_ASSIGNED_NAME');
5353 fnd_msg_pub.ADD;
5354 RAISE fnd_api.g_exc_error;
5355 ELSE
5356 CLOSE c_assigned_by_name;
5357 END IF;
5358 END IF;
5359 END;
5360
5361 PROCEDURE val_object_type(
5362 v_object_type_code IN OUT NOCOPY jtf_tasks_v.source_object_type_code%TYPE
5363 , p_object_name IN jtf_tasks_v.source_object_name%TYPE
5364 ) IS
5365 CURSOR c_object_type_name IS
5366 SELECT object_code
5367 FROM jtf_objects_vl
5368 WHERE NAME = p_object_name
5369 AND NVL(end_date_active, SYSDATE) >= SYSDATE
5370 AND NVL(start_date_active, SYSDATE) <= SYSDATE;
5371 BEGIN
5372 IF (p_object_name IS NOT NULL) THEN
5373 OPEN c_object_type_name;
5374
5375 FETCH c_object_type_name
5376 INTO v_object_type_code;
5377
5378 IF c_object_type_name%NOTFOUND THEN
5379 CLOSE c_object_type_name;
5380
5381 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_OBJECT_CODE');
5382 fnd_message.set_token('P_object_type_code', p_object_name);
5383 fnd_msg_pub.ADD;
5384 RAISE fnd_api.g_exc_error;
5385 ELSE
5386 CLOSE c_object_type_name;
5387 END IF;
5388 END IF;
5389 END;
5390
5391 PROCEDURE val_customer(
5392 p_customer_id IN OUT NOCOPY jtf_tasks_v.customer_id%TYPE
5393 , p_customer_name IN jtf_tasks_v.customer_name%TYPE
5394 , p_customer_number IN jtf_tasks_v.customer_number%TYPE
5395 ) IS
5396 CURSOR c1 IS
5397 SELECT party_id
5398 FROM hz_parties
5399 WHERE party_name = p_customer_name;
5400
5401 CURSOR c2 IS
5402 SELECT party_id
5403 FROM hz_parties
5404 WHERE party_number = p_customer_number;
5405 BEGIN
5406 IF (p_customer_number IS NOT NULL) THEN
5407 OPEN c2;
5408
5409 FETCH c2
5410 INTO p_customer_id;
5411
5412 IF c2%NOTFOUND THEN
5413 CLOSE c2;
5414
5415 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_CUST_NUMBER');
5416 fnd_message.set_token('P_customer_number', p_customer_number);
5417 fnd_msg_pub.ADD;
5418 RAISE fnd_api.g_exc_error;
5419 ELSE
5420 CLOSE c2;
5421 END IF;
5422 ELSIF(p_customer_name IS NOT NULL) THEN
5423 OPEN c1;
5424
5425 FETCH c1
5426 INTO p_customer_id;
5427
5428 IF c1%NOTFOUND THEN
5429 CLOSE c1;
5430
5431 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_CUST_NAME');
5432 fnd_message.set_token('P_customer_name', p_customer_name);
5433 fnd_msg_pub.ADD;
5434 RAISE fnd_api.g_exc_error;
5435 ELSE
5436 CLOSE c1;
5437 END IF;
5438 END IF;
5439 END val_customer;
5440
5441 PROCEDURE val_cust_account(
5442 p_cust_account_id IN OUT NOCOPY jtf_tasks_v.cust_account_id%TYPE
5446 SELECT cust_account_id
5443 , p_cust_account_number IN jtf_tasks_v.cust_account_number%TYPE
5444 ) IS
5445 CURSOR c1 IS
5447 FROM hz_cust_accounts
5448 WHERE account_number = p_cust_account_number;
5449 BEGIN
5450 IF (p_cust_account_number IS NOT NULL) THEN
5451 OPEN c1;
5452
5453 FETCH c1
5454 INTO p_cust_account_id;
5455
5456 IF c1%NOTFOUND THEN
5457 CLOSE c1;
5458
5459 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_CUST_ACCT_NUM');
5460 fnd_message.set_token('P_CUST_ACCOUNT_NUMBER', p_cust_account_number);
5461 fnd_msg_pub.ADD;
5462 RAISE fnd_api.g_exc_error;
5463 ELSE
5464 CLOSE c1;
5465 END IF;
5466 END IF;
5467 END val_cust_account;
5468
5469 PROCEDURE val_priority(
5470 v_task_priority_id IN OUT NOCOPY jtf_tasks_v.task_priority_id%TYPE
5471 , p_task_priority_name IN jtf_tasks_v.task_priority%TYPE
5472 ) IS
5473 CURSOR c_task_priority_name IS
5474 SELECT task_priority_id
5475 FROM jtf_task_priorities_vl
5476 WHERE NAME = p_task_priority_name
5477 AND NVL(end_date_active, SYSDATE) >= SYSDATE
5478 AND NVL(start_date_active, SYSDATE) <= SYSDATE;
5479 BEGIN
5480 IF (p_task_priority_name IS NOT NULL) THEN
5481 OPEN c_task_priority_name;
5482
5483 FETCH c_task_priority_name
5484 INTO v_task_priority_id;
5485
5486 IF c_task_priority_name%NOTFOUND THEN
5487 CLOSE c_task_priority_name;
5488
5489 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_PRIORITY_NAME');
5490 fnd_message.set_token('P_TASK_PRIORITY_NAME', p_task_priority_name);
5491 fnd_msg_pub.ADD;
5492 RAISE fnd_api.g_exc_error;
5493 ELSE
5494 CLOSE c_task_priority_name;
5495 END IF;
5496 END IF;
5497 END val_priority;
5498
5499 PROCEDURE query_task -- possible query variables which are named after fields in jtf_tasks_v
5500
5501 -- p_task_number - query by task number
5502 -- p_task_id
5503 -- p_task_name
5504 -- p_description
5505 -- p_task_status_name
5506 -- p_task_status_id
5507 -- p_task_priority_name
5508 -- p_task_priority_id
5509 -- p_owner_type_code
5510 -- p_owner_id
5511 -- p_assigned_name
5512 -- p_assigned_by_id
5513 -- p_address_id
5514 -- p_planned_start_date
5515 -- p_planned_end_date
5516 -- p_scheduled_start_date
5517 -- p_scheduled_end_date
5518 -- p_actual_start_date
5519 -- p_actual_end_date
5520 -- p_object_type_code
5521 -- p_object_name
5522 -- p_percentage_complete
5523 -- p_reason_code
5524 -- p_private_flag
5525 -- p_restrict_closure_flag
5526 -- p_multi_booked_flag
5527 -- p_milestone_flag
5528 -- p_holiday_flag
5529 -- p_workflow_process_id
5530 -- p_notification_flag
5531 -- p_parent_task_id
5532 -- p_alarm_on
5533 -- p_alarm_count
5534 -- p_alarm_fired_count
5535 --
5536 -- p_ref_object_id -- referenced object id
5537 -- p_ref_object_type_code -- referenced object type code
5538 --
5539 -- p_sort_data -- sort data structucture based on sort date
5540
5541 -- p_query_or_next_code -- run query or retrieve records from previous query (value Q/N)
5542 --
5543 -- OUTPUT values
5544 -- x_task_table -- pl/sql table of records
5545 -- x_total_retrieved -- total number of records selected by query
5546 -- x_total_returned -- number of records returned in pl/sql table
5547 (
5548 p_api_version IN NUMBER
5549 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
5550 , p_validate_level IN VARCHAR2 DEFAULT fnd_api.g_valid_level_full
5551 , p_task_number IN jtf_tasks_v.task_number%TYPE DEFAULT NULL
5552 , p_task_id IN jtf_tasks_v.task_id%TYPE DEFAULT NULL
5553 , p_task_name IN jtf_tasks_v.task_name%TYPE DEFAULT NULL
5554 , p_description IN jtf_tasks_v.description%TYPE DEFAULT NULL
5555 , p_task_type_name IN jtf_tasks_v.task_type%TYPE DEFAULT NULL
5556 , p_task_type_id IN jtf_tasks_v.task_type_id%TYPE DEFAULT NULL
5557 , p_task_status_name IN jtf_tasks_v.task_status%TYPE DEFAULT NULL
5558 , p_task_status_id IN jtf_tasks_v.task_status_id%TYPE DEFAULT NULL
5562 , p_owner_id IN jtf_tasks_v.owner_id%TYPE DEFAULT NULL
5559 , p_task_priority_name IN jtf_tasks_v.task_priority%TYPE DEFAULT NULL
5560 , p_task_priority_id IN jtf_tasks_v.task_priority_id%TYPE DEFAULT NULL
5561 , p_owner_type_code IN jtf_tasks_v.owner_type_code%TYPE DEFAULT NULL
5563 , p_assigned_name IN jtf_tasks_v.assigned_by_name%TYPE DEFAULT NULL
5564 , p_assigned_by_id IN jtf_tasks_v.assigned_by_id%TYPE DEFAULT NULL
5565 , p_address_id IN jtf_tasks_v.address_id%TYPE DEFAULT NULL
5566 , p_owner_territory_id IN jtf_tasks_v.owner_territory_id%TYPE DEFAULT NULL
5567 , p_customer_id IN jtf_tasks_v.customer_id%TYPE DEFAULT NULL
5568 , p_customer_name IN jtf_tasks_v.customer_name%TYPE DEFAULT NULL
5569 , p_customer_number IN jtf_tasks_v.customer_number%TYPE DEFAULT NULL
5570 , p_cust_account_number IN jtf_tasks_v.cust_account_number%TYPE DEFAULT NULL
5571 , p_cust_account_id IN jtf_tasks_v.cust_account_id%TYPE DEFAULT NULL
5572 , p_planned_start_date IN jtf_tasks_v.planned_start_date%TYPE DEFAULT NULL
5573 , p_planned_end_date IN jtf_tasks_v.planned_end_date%TYPE DEFAULT NULL
5574 , p_scheduled_start_date IN jtf_tasks_v.scheduled_start_date%TYPE DEFAULT NULL
5575 , p_scheduled_end_date IN jtf_tasks_v.scheduled_end_date%TYPE DEFAULT NULL
5576 , p_actual_start_date IN jtf_tasks_v.actual_start_date%TYPE DEFAULT NULL
5577 , p_actual_end_date IN jtf_tasks_v.actual_end_date%TYPE DEFAULT NULL
5578 , p_object_type_code IN jtf_tasks_v.source_object_type_code%TYPE DEFAULT NULL
5579 , p_object_name IN jtf_tasks_v.source_object_name%TYPE DEFAULT NULL
5580 , p_source_object_id IN jtf_tasks_v.source_object_id%TYPE DEFAULT NULL
5581 , p_percentage_complete IN jtf_tasks_v.percentage_complete%TYPE DEFAULT NULL
5582 , p_reason_code IN jtf_tasks_v.reason_code%TYPE DEFAULT NULL
5583 , p_private_flag IN jtf_tasks_v.private_flag%TYPE DEFAULT NULL
5584 , p_restrict_closure_flag IN jtf_tasks_v.restrict_closure_flag%TYPE DEFAULT NULL
5585 , p_multi_booked_flag IN jtf_tasks_v.multi_booked_flag%TYPE DEFAULT NULL
5586 , p_milestone_flag IN jtf_tasks_v.milestone_flag%TYPE DEFAULT NULL
5587 , p_holiday_flag IN jtf_tasks_v.holiday_flag%TYPE DEFAULT NULL
5588 , p_workflow_process_id IN jtf_tasks_v.workflow_process_id%TYPE DEFAULT NULL
5589 , p_notification_flag IN jtf_tasks_v.notification_flag%TYPE DEFAULT NULL
5590 , p_parent_task_id IN jtf_tasks_v.parent_task_id%TYPE DEFAULT NULL
5591 , p_alarm_on IN jtf_tasks_v.alarm_on%TYPE DEFAULT NULL
5592 , p_alarm_count IN jtf_tasks_v.alarm_count%TYPE DEFAULT NULL
5593 , p_alarm_fired_count IN jtf_tasks_v.alarm_fired_count%TYPE DEFAULT NULL
5594 , p_ref_object_id IN NUMBER DEFAULT NULL
5595 , p_ref_object_type_code IN VARCHAR2 DEFAULT NULL
5596 , p_sort_data IN sort_data
5597 , p_start_pointer IN NUMBER
5598 , p_rec_wanted IN NUMBER
5599 , p_show_all IN VARCHAR2
5600 , p_query_or_next_code IN VARCHAR2 DEFAULT 'Q'
5601 , x_task_table OUT NOCOPY task_table_type
5602 , x_total_retrieved OUT NOCOPY NUMBER
5603 , x_total_returned OUT NOCOPY NUMBER
5604 , x_return_status OUT NOCOPY VARCHAR2
5605 , x_msg_count OUT NOCOPY NUMBER
5606 , x_msg_data OUT NOCOPY VARCHAR2
5607 , x_object_version_number IN OUT NOCOPY NUMBER
5608 ) IS
5609 l_api_version CONSTANT NUMBER := 1.0;
5610 l_api_name CONSTANT VARCHAR2(30) := 'QUERY_TASK';
5611 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
5612 l_msg_data VARCHAR2(2000);
5613 l_msg_count NUMBER;
5614 BEGIN
5615 SAVEPOINT query_task_pub1;
5616 x_return_status := fnd_api.g_ret_sts_success;
5617
5618 -- standard call to check for call compatibility
5619 IF (NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name)) THEN
5620 RAISE fnd_api.g_exc_unexpected_error;
5621 END IF;
5622
5623 -- initialize message list i p_init_msg_list is set to true
5624 IF (fnd_api.to_boolean(p_init_msg_list)) THEN
5625 fnd_msg_pub.initialize;
5626 END IF;
5627
5628 query_task(
5629 p_api_version => p_api_version
5630 , p_init_msg_list => p_init_msg_list
5631 , p_validate_level => p_validate_level
5632 , p_task_number => p_task_number
5633 , p_task_id => p_task_id
5634 , p_task_name => p_task_name
5635 , p_description => p_description
5636 , p_task_type_name => p_task_type_name
5637 , p_task_type_id => p_task_type_id
5638 , p_task_status_name => p_task_status_name
5639 , p_task_status_id => p_task_status_id
5640 , p_task_priority_name => p_task_priority_name
5641 , p_task_priority_id => p_task_priority_id
5642 , p_owner_type_code => p_owner_type_code
5643 , p_owner_id => p_owner_id
5644 , p_assigned_name => p_assigned_name
5648 , p_customer_id => p_customer_id
5645 , p_assigned_by_id => p_assigned_by_id
5646 , p_address_id => p_address_id
5647 , p_owner_territory_id => p_owner_territory_id
5649 , p_customer_name => p_customer_name
5650 , p_customer_number => p_customer_number
5651 , p_cust_account_number => p_cust_account_number
5652 , p_cust_account_id => p_cust_account_id
5653 , p_planned_start_date => p_planned_start_date
5654 , p_planned_end_date => p_planned_end_date
5655 , p_scheduled_start_date => p_scheduled_start_date
5656 , p_scheduled_end_date => p_scheduled_end_date
5657 , p_actual_start_date => p_actual_start_date
5658 , p_actual_end_date => p_actual_end_date
5659 , p_object_type_code => p_object_type_code
5660 , p_object_name => p_object_name
5661 , p_source_object_id => p_source_object_id
5662 , p_percentage_complete => p_percentage_complete
5663 , p_reason_code => p_reason_code
5664 , p_private_flag => p_private_flag
5665 , p_restrict_closure_flag => p_restrict_closure_flag
5666 , p_multi_booked_flag => p_multi_booked_flag
5667 , p_milestone_flag => p_milestone_flag
5668 , p_holiday_flag => p_holiday_flag
5669 , p_workflow_process_id => p_workflow_process_id
5670 , p_notification_flag => p_notification_flag
5671 , p_parent_task_id => p_parent_task_id
5672 , p_alarm_on => p_alarm_on
5673 , p_alarm_count => p_alarm_count
5674 , p_alarm_fired_count => p_alarm_fired_count
5675 , p_ref_object_id => p_ref_object_id
5676 , p_ref_object_type_code => p_ref_object_type_code
5677 , p_sort_data => p_sort_data
5678 , p_start_pointer => p_start_pointer
5679 , p_rec_wanted => p_rec_wanted
5680 , p_show_all => p_show_all
5681 , p_query_or_next_code => p_query_or_next_code
5682 , x_task_table => x_task_table
5683 , x_total_retrieved => x_total_retrieved
5684 , x_total_returned => x_total_returned
5685 , x_return_status => x_return_status
5686 , x_msg_count => x_msg_count
5687 , x_msg_data => x_msg_data
5688 , x_object_version_number => x_object_version_number
5689 , p_location_id => NULL
5690 );
5691 EXCEPTION
5692 WHEN fnd_api.g_exc_error THEN
5693 ROLLBACK TO query_task_pub1;
5694 x_return_status := fnd_api.g_ret_sts_error;
5695 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5696 WHEN fnd_api.g_exc_unexpected_error THEN
5697 ROLLBACK TO query_task_pub1;
5698 x_return_status := fnd_api.g_ret_sts_unexp_error;
5699 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5700 WHEN OTHERS THEN
5701 ROLLBACK TO query_task_pub1;
5702 x_return_status := fnd_api.g_ret_sts_unexp_error;
5703
5704 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
5705 fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
5706 END IF;
5707
5708 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5709 END query_task;
5710
5711 PROCEDURE query_task -- possible query variables which are named after fields in jtf_tasks_v
5712
5713 -- p_task_number - query by task number
5714 -- p_task_id
5715 -- p_task_name
5716 -- p_description
5717 -- p_task_status_name
5718 -- p_task_status_id
5719 -- p_task_priority_name
5720 -- p_task_priority_id
5721 -- p_owner_type_code
5722 -- p_owner_id
5723 -- p_assigned_name
5724 -- p_assigned_by_id
5725 -- p_address_id
5726 -- p_planned_start_date
5727 -- p_planned_end_date
5728 -- p_scheduled_start_date
5729 -- p_scheduled_end_date
5730 -- p_actual_start_date
5731 -- p_actual_end_date
5732 -- p_object_type_code
5733 -- p_object_name
5734 -- p_percentage_complete
5735 -- p_reason_code
5736 -- p_private_flag
5737 -- p_restrict_closure_flag
5738 -- p_multi_booked_flag
5739 -- p_milestone_flag
5740 -- p_holiday_flag
5741 -- p_workflow_process_id
5742 -- p_notification_flag
5743 -- p_parent_task_id
5744 -- p_alarm_on
5745 -- p_alarm_count
5746 -- p_alarm_fired_count
5747 --
5748 -- p_ref_object_id -- referenced object id
5749 -- p_ref_object_type_code -- referenced object type code
5753 -- p_query_or_next_code -- run query or retrieve records from previous query (value Q/N)
5750 --
5751 -- p_sort_data -- sort data structucture based on sort date
5752
5754 --
5755 -- OUTPUT values
5756 -- x_task_table -- pl/sql table of records
5757 -- x_total_retrieved -- total number of records selected by query
5758 -- x_total_returned -- number of records returned in pl/sql table
5759 (
5760 p_api_version IN NUMBER
5761 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
5762 , p_validate_level IN VARCHAR2 DEFAULT fnd_api.g_valid_level_full
5763 , p_task_number IN jtf_tasks_v.task_number%TYPE DEFAULT NULL
5764 , p_task_id IN jtf_tasks_v.task_id%TYPE DEFAULT NULL
5765 , p_task_name IN jtf_tasks_v.task_name%TYPE DEFAULT NULL
5766 , p_description IN jtf_tasks_v.description%TYPE DEFAULT NULL
5767 , p_task_type_name IN jtf_tasks_v.task_type%TYPE DEFAULT NULL
5768 , p_task_type_id IN jtf_tasks_v.task_type_id%TYPE DEFAULT NULL
5769 , p_task_status_name IN jtf_tasks_v.task_status%TYPE DEFAULT NULL
5770 , p_task_status_id IN jtf_tasks_v.task_status_id%TYPE DEFAULT NULL
5771 , p_task_priority_name IN jtf_tasks_v.task_priority%TYPE DEFAULT NULL
5772 , p_task_priority_id IN jtf_tasks_v.task_priority_id%TYPE DEFAULT NULL
5773 , p_owner_type_code IN jtf_tasks_v.owner_type_code%TYPE DEFAULT NULL
5774 , p_owner_id IN jtf_tasks_v.owner_id%TYPE DEFAULT NULL
5775 , p_assigned_name IN jtf_tasks_v.assigned_by_name%TYPE DEFAULT NULL
5776 , p_assigned_by_id IN jtf_tasks_v.assigned_by_id%TYPE DEFAULT NULL
5777 , p_address_id IN jtf_tasks_v.address_id%TYPE DEFAULT NULL
5778 , p_owner_territory_id IN jtf_tasks_v.owner_territory_id%TYPE DEFAULT NULL
5779 , p_customer_id IN jtf_tasks_v.customer_id%TYPE DEFAULT NULL
5780 , p_customer_name IN jtf_tasks_v.customer_name%TYPE DEFAULT NULL
5781 , p_customer_number IN jtf_tasks_v.customer_number%TYPE DEFAULT NULL
5782 , p_cust_account_number IN jtf_tasks_v.cust_account_number%TYPE DEFAULT NULL
5783 , p_cust_account_id IN jtf_tasks_v.cust_account_id%TYPE DEFAULT NULL
5784 , p_planned_start_date IN jtf_tasks_v.planned_start_date%TYPE DEFAULT NULL
5785 , p_planned_end_date IN jtf_tasks_v.planned_end_date%TYPE DEFAULT NULL
5786 , p_scheduled_start_date IN jtf_tasks_v.scheduled_start_date%TYPE DEFAULT NULL
5787 , p_scheduled_end_date IN jtf_tasks_v.scheduled_end_date%TYPE DEFAULT NULL
5788 , p_actual_start_date IN jtf_tasks_v.actual_start_date%TYPE DEFAULT NULL
5789 , p_actual_end_date IN jtf_tasks_v.actual_end_date%TYPE DEFAULT NULL
5790 , p_object_type_code IN jtf_tasks_v.source_object_type_code%TYPE DEFAULT NULL
5791 , p_object_name IN jtf_tasks_v.source_object_name%TYPE DEFAULT NULL
5792 , p_source_object_id IN jtf_tasks_v.source_object_id%TYPE DEFAULT NULL
5793 , p_percentage_complete IN jtf_tasks_v.percentage_complete%TYPE DEFAULT NULL
5794 , p_reason_code IN jtf_tasks_v.reason_code%TYPE DEFAULT NULL
5795 , p_private_flag IN jtf_tasks_v.private_flag%TYPE DEFAULT NULL
5796 , p_restrict_closure_flag IN jtf_tasks_v.restrict_closure_flag%TYPE DEFAULT NULL
5797 , p_multi_booked_flag IN jtf_tasks_v.multi_booked_flag%TYPE DEFAULT NULL
5798 , p_milestone_flag IN jtf_tasks_v.milestone_flag%TYPE DEFAULT NULL
5799 , p_holiday_flag IN jtf_tasks_v.holiday_flag%TYPE DEFAULT NULL
5800 , p_workflow_process_id IN jtf_tasks_v.workflow_process_id%TYPE DEFAULT NULL
5801 , p_notification_flag IN jtf_tasks_v.notification_flag%TYPE DEFAULT NULL
5802 , p_parent_task_id IN jtf_tasks_v.parent_task_id%TYPE DEFAULT NULL
5803 , p_alarm_on IN jtf_tasks_v.alarm_on%TYPE DEFAULT NULL
5804 , p_alarm_count IN jtf_tasks_v.alarm_count%TYPE DEFAULT NULL
5805 , p_alarm_fired_count IN jtf_tasks_v.alarm_fired_count%TYPE DEFAULT NULL
5806 , p_ref_object_id IN NUMBER DEFAULT NULL
5807 , p_ref_object_type_code IN VARCHAR2 DEFAULT NULL
5808 , p_sort_data IN sort_data
5809 , p_start_pointer IN NUMBER
5810 , p_rec_wanted IN NUMBER
5811 , p_show_all IN VARCHAR2
5812 , p_query_or_next_code IN VARCHAR2 DEFAULT 'Q'
5813 , x_task_table OUT NOCOPY task_table_type
5814 , x_total_retrieved OUT NOCOPY NUMBER
5815 , x_total_returned OUT NOCOPY NUMBER
5816 , x_return_status OUT NOCOPY VARCHAR2
5817 , x_msg_count OUT NOCOPY NUMBER
5818 , x_msg_data OUT NOCOPY VARCHAR2
5819 , x_object_version_number IN OUT NOCOPY NUMBER
5820 , p_location_id IN NUMBER
5821 ) IS
5822 l_api_version CONSTANT NUMBER := 1.0;
5823 l_api_name CONSTANT VARCHAR2(30) := 'QUERY_TASK';
5824 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
5825 l_msg_data VARCHAR2(2000);
5826 l_msg_count NUMBER;
5830 v_object_type_code jtf_tasks_v.source_object_type_code%TYPE := p_object_type_code;
5827 v_task_id jtf_tasks_v.task_id%TYPE := p_task_id;
5828 v_task_type_id jtf_tasks_v.task_type_id%TYPE := p_task_type_id;
5829 v_task_status_id jtf_tasks_v.task_status_id%TYPE := p_task_status_id;
5831 v_task_priority_id jtf_tasks_v.task_priority_id%TYPE := p_task_priority_id;
5832 v_customer_id jtf_tasks_v.customer_id%TYPE := p_customer_id;
5833 v_cust_account_id jtf_tasks_v.cust_account_id%TYPE := p_cust_account_id;
5834 v_assigned_by_id jtf_tasks_v.assigned_by_id%TYPE;
5835 l_type VARCHAR2(10);
5836 BEGIN
5837 SAVEPOINT query_task_pub2;
5838 x_return_status := fnd_api.g_ret_sts_success;
5839
5840 -- standard call to check for call compatibility
5841 IF (NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name)) THEN
5842 RAISE fnd_api.g_exc_unexpected_error;
5843 END IF;
5844
5845 -- initialize message list i p_init_msg_list is set to true
5846 IF (fnd_api.to_boolean(p_init_msg_list)) THEN
5847 fnd_msg_pub.initialize;
5848 END IF;
5849
5850 -- required parameters to control records returned
5851
5852 -- p_ref_object_type_code or p_ref object_id is not null then both must exist
5853 IF (p_ref_object_type_code IS NOT NULL) OR(p_ref_object_id IS NOT NULL) THEN
5854 IF (p_ref_object_type_code IS NULL) OR(p_ref_object_id IS NULL) THEN
5855 fnd_message.set_name('JTF', 'JTF_TK_OBJECT_TYPE_ID_RQD');
5856 fnd_msg_pub.ADD;
5857 RAISE fnd_api.g_exc_error;
5858 END IF;
5859 END IF;
5860
5861 -- p_query_or_next_code should be Q or N
5862 IF (p_query_or_next_code NOT IN('Q', 'N')) OR(p_query_or_next_code IS NULL) THEN
5863 fnd_message.set_name('JTF', 'JTF_TK_INV_QRY_NXT');
5864 fnd_msg_pub.ADD;
5865 RAISE fnd_api.g_exc_error;
5866 END IF;
5867
5868 -- p_show_all should be Y or N
5869 IF (p_show_all NOT IN('Y', 'N')) OR(p_show_all IS NULL) THEN
5870 fnd_message.set_name('JTF', 'JTF_TK_INV_SHOW_ALL');
5871 fnd_msg_pub.ADD;
5872 RAISE fnd_api.g_exc_error;
5873 END IF;
5874
5875 IF (p_show_all = 'N') THEN
5876 IF (p_start_pointer IS NULL) THEN
5877 fnd_message.set_name('JTF', 'JTF_TK_NULL_STRT_PTR');
5878 fnd_msg_pub.ADD;
5879 RAISE fnd_api.g_exc_error;
5880 END IF;
5881
5882 IF (p_rec_wanted IS NULL) THEN
5883 fnd_message.set_name('JTF', 'JTF_TK_NULL_REC_WANT');
5884 fnd_msg_pub.ADD;
5885 RAISE fnd_api.g_exc_error;
5886 END IF;
5887 END IF;
5888
5889 -- validate query parameters
5890 IF (v_task_id IS NULL) THEN
5891 val_task(v_task_id, p_task_number, p_task_name);
5892 END IF;
5893
5894 IF (v_object_type_code IS NULL) THEN
5895 val_object_type(v_object_type_code, p_object_name);
5896 END IF;
5897
5898 IF (v_task_type_id IS NULL AND p_task_type_name IS NOT NULL) THEN
5899 jtf_task_utl.validate_task_type(p_task_type_id, p_task_type_name, l_return_status
5900 , v_task_type_id);
5901
5902 IF (l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
5903 RAISE fnd_api.g_exc_unexpected_error;
5904 END IF;
5905 END IF;
5906
5907 IF (p_task_status_id IS NULL AND p_task_status_name IS NOT NULL) THEN
5908 IF v_task_type_id = '22' THEN
5909 l_type := 'ESCALATION';
5910 ELSE
5911 l_type := 'TASK';
5912 END IF;
5913
5914 jtf_task_utl.validate_task_status(p_task_status_id, p_task_status_name, l_type
5915 , l_return_status, v_task_status_id);
5916
5917 IF (l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
5918 RAISE fnd_api.g_exc_unexpected_error;
5919 END IF;
5920 END IF;
5921
5922 IF (v_task_priority_id IS NULL) THEN
5923 val_priority(v_task_priority_id, p_task_priority_name);
5924 END IF;
5925
5926 v_assigned_by_id := p_assigned_by_id;
5927
5928 IF (v_assigned_by_id IS NOT NULL) THEN
5929 val_assigned(v_assigned_by_id, p_assigned_name);
5930 END IF;
5931
5932 IF (p_customer_id IS NULL) AND(p_customer_name IS NOT NULL OR p_customer_number IS NOT NULL) THEN
5933 val_customer(v_customer_id, p_customer_name, p_customer_number);
5934 END IF;
5935
5936 IF (p_cust_account_id IS NULL) AND(p_cust_account_number IS NOT NULL) THEN
5937 val_cust_account(v_cust_account_id, p_cust_account_number);
5938 END IF;
5939
5940 val_dates(p_planned_start_date, p_planned_end_date);
5941 val_dates(p_scheduled_start_date, p_scheduled_end_date);
5942 val_dates(p_actual_start_date, p_actual_end_date);
5943 -- private flag
5944 jtf_task_utl.validate_flag(
5945 l_api_name
5946 , p_init_msg_list
5947 , l_return_status
5948 , jtf_task_utl.get_translated_lookup('JTF_TASK_TRANSLATED_MESSAGES', 'PRIVATE_FLAG')
5949 , p_private_flag
5950 );
5951
5952 IF (l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
5953 RAISE fnd_api.g_exc_unexpected_error;
5954 END IF;
5955
5956 -- restrict closure
5957 jtf_task_utl.validate_flag(
5961 , jtf_task_utl.get_translated_lookup('JTF_TASK_TRANSLATED_MESSAGES', 'RESTRICT_CLOSURE_FLAG')
5958 l_api_name
5959 , p_init_msg_list
5960 , l_return_status
5962 , p_restrict_closure_flag
5963 );
5964
5965 IF (l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
5966 RAISE fnd_api.g_exc_unexpected_error;
5967 END IF;
5968
5969 -- multi_booked_flag
5970 jtf_task_utl.validate_flag(
5971 l_api_name
5972 , p_init_msg_list
5973 , l_return_status
5974 , jtf_task_utl.get_translated_lookup('JTF_TASK_TRANSLATED_MESSAGES', 'MULTIBOOKED_FLAG')
5975 , p_multi_booked_flag
5976 );
5977
5978 IF (l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
5979 RAISE fnd_api.g_exc_unexpected_error;
5980 END IF;
5981
5982 -- milestone_flag
5983 jtf_task_utl.validate_flag(
5984 l_api_name
5985 , p_init_msg_list
5986 , l_return_status
5987 , jtf_task_utl.get_translated_lookup('JTF_TASK_TRANSLATED_MESSAGES', 'MILESTONE_FLAG')
5988 , p_milestone_flag
5989 );
5990
5991 IF (l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
5992 RAISE fnd_api.g_exc_unexpected_error;
5993 END IF;
5994
5995 -- holiday_flag
5996 jtf_task_utl.validate_flag(
5997 l_api_name
5998 , p_init_msg_list
5999 , l_return_status
6000 , jtf_task_utl.get_translated_lookup('JTF_TASK_TRANSLATED_MESSAGES', 'HOLIDAY_FLAG')
6001 , p_holiday_flag
6002 );
6003
6004 IF (l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
6005 RAISE fnd_api.g_exc_unexpected_error;
6006 END IF;
6007
6008 -- notification_flag
6009 jtf_task_utl.validate_flag(
6010 l_api_name
6011 , p_init_msg_list
6012 , l_return_status
6013 , jtf_task_utl.get_translated_lookup('JTF_TASK_TRANSLATED_MESSAGES', 'NOTIFICATION_FLAG')
6014 , p_notification_flag
6015 );
6016
6017 IF (l_return_status = fnd_api.g_ret_sts_unexp_error) THEN
6018 RAISE fnd_api.g_exc_unexpected_error;
6019 END IF;
6020
6021 --call private api to execute the fetch
6022 jtf_tasks_pvt.query_task(
6023 0
6024 , v_task_id
6025 , p_description
6026 , v_task_type_id
6027 , v_task_status_id
6028 , p_task_priority_id
6029 , p_owner_type_code
6030 , p_owner_id
6031 , p_assigned_by_id
6032 , p_address_id
6033 , p_owner_territory_id
6034 , p_customer_id
6035 , p_cust_account_id
6036 , p_planned_start_date
6037 , p_planned_end_date
6038 , p_scheduled_start_date
6039 , p_scheduled_end_date
6040 , p_actual_start_date
6041 , p_actual_end_date
6042 , v_object_type_code
6043 , p_source_object_id
6044 , p_percentage_complete
6045 , p_reason_code
6046 , p_private_flag
6047 , p_restrict_closure_flag
6048 , p_multi_booked_flag
6049 , p_milestone_flag
6050 , p_holiday_flag
6051 , p_workflow_process_id
6052 , p_notification_flag
6053 , p_parent_task_id
6054 , p_alarm_on
6055 , p_alarm_count
6056 , p_alarm_fired_count
6057 , p_ref_object_id
6058 , p_ref_object_type_code
6059 , p_task_name
6060 , p_sort_data
6061 , p_start_pointer
6062 , p_rec_wanted
6063 , p_show_all
6064 , p_query_or_next_code
6065 , x_task_table
6066 , x_total_retrieved
6067 , x_total_returned
6068 , x_return_status
6069 , x_msg_count
6070 , x_msg_data
6071 , p_location_id
6072 );
6073 EXCEPTION
6074 WHEN fnd_api.g_exc_error THEN
6075 ROLLBACK TO query_task_pub2;
6076 x_return_status := fnd_api.g_ret_sts_error;
6077 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
6078 WHEN fnd_api.g_exc_unexpected_error THEN
6079 ROLLBACK TO query_task_pub2;
6080 x_return_status := fnd_api.g_ret_sts_unexp_error;
6081 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
6082 WHEN OTHERS THEN
6083 ROLLBACK TO query_task_pub2;
6084 x_return_status := fnd_api.g_ret_sts_unexp_error;
6085
6086 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
6087 fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
6088 END IF;
6089
6090 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
6091 END query_task;
6092
6093 PROCEDURE query_next_task -- INPUT VARIABLES
6094
6095 -- p_file_name - file name for output of export file, always
6096 -- placed in /sqlcom/out directory
6097 --
6098 -- p_task_id -- current task id
6099 -- p_query_type -- values Dependency or Date for type of query
6100
6101 --The following parameters only used if p_query_type is date
6102 -- p_date_type -- date type, values scheduled, planned, actual
6103 -- p_date_start_or_end -- use start or end date of current task values start/end
6104 -- p_owner_id -- query owner_id from jtf_tasks_v
6105 -- p_owner_type_code -- query owner_type_code from jtf_tasks_v
6106 -- p_assigned_by -- assigned_by
6107
6108 -- p_sort_data -- sort data structucture based on sort date
6109 -- p_start_pointer -- return records starting at this number
6110 -- p_rec_wanted -- return the next 'n' records from start_pointer
6111 -- p_show_all -- return all the records (value Y or N), overrides start_pointer, rec_wanted
6112 -- p_query_or_next_code -- run query or retrieve records from previous query (value Q/N)
6113 --
6114 -- OUTPUT values
6115 -- x_task_table -- pl/sql table of records
6116 -- x_total_retrieved -- total number of records selected by query
6117 -- x_total_returned -- number of records returned in pl/sql table
6118 (
6119 p_api_version IN NUMBER
6120 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
6121 , p_validate_level IN VARCHAR2 DEFAULT fnd_api.g_valid_level_full
6122 , p_task_id IN jtf_tasks_v.task_id%TYPE
6123 , -- current task id
6124 p_query_type IN VARCHAR2 DEFAULT 'Dependency'
6125 , -- values Dependency or Date
6126 p_date_type IN VARCHAR2 DEFAULT NULL
6127 , p_date_start_or_end IN VARCHAR2 DEFAULT NULL
6128 , p_owner_id IN jtf_tasks_v.owner_id%TYPE DEFAULT NULL
6129 , p_owner_type_code IN jtf_tasks_v.owner_type_code%TYPE DEFAULT NULL
6130 , p_assigned_by IN jtf_tasks_v.assigned_by_id%TYPE DEFAULT NULL
6131 , p_sort_data IN sort_data
6132 , p_start_pointer IN NUMBER
6133 , p_rec_wanted IN NUMBER
6134 , p_show_all IN VARCHAR2 DEFAULT 'Y'
6135 , p_query_or_next_code IN VARCHAR2 DEFAULT 'Q'
6136 , x_task_table OUT NOCOPY task_table_type
6137 , x_total_retrieved OUT NOCOPY NUMBER
6138 , x_total_returned OUT NOCOPY NUMBER
6139 , x_return_status OUT NOCOPY VARCHAR2
6140 , x_msg_count OUT NOCOPY NUMBER
6141 , x_msg_data OUT NOCOPY VARCHAR2
6142 , x_object_version_number IN OUT NOCOPY NUMBER
6143 ) IS
6144 l_api_version CONSTANT NUMBER := 1.0;
6145 l_api_name CONSTANT VARCHAR2(30) := 'QUERY_NEXT_TASK';
6146 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
6147 l_msg_data VARCHAR2(2000);
6148 l_msg_count NUMBER;
6149 l_query_type VARCHAR2(20) := UPPER(p_query_type);
6150 l_date_type VARCHAR2(20) := UPPER(p_date_type);
6151 l_date_start_or_end VARCHAR2(6) := UPPER(p_date_start_or_end);
6152 BEGIN
6153 SAVEPOINT query_next_task;
6154 x_return_status := fnd_api.g_ret_sts_success;
6155
6156 -- standard call to check for call compatibility
6160
6157 IF (NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name)) THEN
6158 RAISE fnd_api.g_exc_unexpected_error;
6159 END IF;
6161 -- initialize message list i p_init_msg_list is set to true
6162 IF (fnd_api.to_boolean(p_init_msg_list)) THEN
6163 fnd_msg_pub.initialize;
6164 END IF;
6165
6166 -- required parameters to control records returned
6167
6168 -- p_query_or_next_code should be Q or N
6169 IF (p_query_or_next_code NOT IN('Q', 'N')) OR(p_query_or_next_code IS NULL) THEN
6170 fnd_message.set_name('JTF', 'JTF_TK_INV_QRY_NXT');
6171 fnd_msg_pub.ADD;
6172 RAISE fnd_api.g_exc_error;
6173 END IF;
6174
6175 -- p_show_all should be Y or N
6176 IF (p_show_all NOT IN('Y', 'N')) OR(p_show_all IS NULL) THEN
6177 fnd_message.set_name('JTF', 'JTF_TK_INV_SHOW_ALL');
6178 fnd_msg_pub.ADD;
6179 RAISE fnd_api.g_exc_error;
6180 END IF;
6181
6182 IF (p_show_all = 'N') THEN
6183 IF (p_start_pointer IS NULL) THEN
6184 fnd_message.set_name('JTF', 'JTF_TK_NULL_STRT_PTR');
6185 fnd_msg_pub.ADD;
6186 RAISE fnd_api.g_exc_error;
6187 END IF;
6188
6189 IF (p_rec_wanted IS NULL) THEN
6190 fnd_message.set_name('JTF', 'JTF_TK_NULL_REC_WANT');
6191 fnd_msg_pub.ADD;
6192 RAISE fnd_api.g_exc_error;
6193 END IF;
6194 END IF;
6195
6196 -- parameters to control querying
6197 IF (l_query_type NOT IN('DEPENDENCY', 'ASSIGNED', 'OWNER')) THEN
6198 fnd_message.set_name('JTF', 'JTF_TK_QRY_NXT_INV_QRY_TYP');
6199 fnd_msg_pub.ADD;
6200 RAISE fnd_api.g_exc_error;
6201 ELSE
6202 -- check date_type and date_start_or_end
6203 IF (l_date_type NOT IN('SCHEDULED', 'PLANNED', 'ACTUAL')) THEN
6204 fnd_message.set_name('JTF', 'JTF_TK_QRY_NXT_INV_DT_TYPE');
6205 fnd_msg_pub.ADD;
6206 RAISE fnd_api.g_exc_error;
6207 END IF;
6208
6209 IF (l_date_start_or_end NOT IN('END', 'START')) THEN
6210 fnd_message.set_name('JTF', 'JTF_TK_QRY_NXT_INV_STRT_END_DT');
6211 fnd_msg_pub.ADD;
6212 RAISE fnd_api.g_exc_error;
6213 END IF;
6214
6215 IF (l_query_type = 'ASSIGNED') THEN
6216 IF (p_assigned_by IS NULL) THEN
6217 fnd_message.set_name('JTF', 'JTF_TK_QRY_NXT_NUL_ASGND_BY');
6218 fnd_msg_pub.ADD;
6219 RAISE fnd_api.g_exc_error;
6220 END IF;
6221 ELSIF(l_query_type = 'OWNER') THEN
6222 IF (p_owner_type_code IS NULL OR p_owner_id IS NULL) THEN
6223 fnd_message.set_name('JTF', 'JTF_TK_QRY_NXT_NUL_OWNER');
6224 fnd_msg_pub.ADD;
6225 RAISE fnd_api.g_exc_error;
6226 END IF;
6227 END IF;
6228 END IF;
6229
6230 -- validate query parameters
6231
6232 -- task id should not be null
6233 IF (p_task_id IS NULL) THEN
6234 fnd_message.set_name('JTF', 'JTF_TASK_MISSING_TASK');
6235 fnd_msg_pub.ADD;
6236 RAISE fnd_api.g_exc_error;
6237 END IF;
6238
6239 -- check for valid task_id
6240 val_task_id(p_task_id);
6241 --call private api to execute the fetch
6242 jtf_tasks_pvt.query_next_task(
6243 0
6244 , p_task_id
6245 , UPPER(p_query_type)
6246 , UPPER(p_date_type)
6247 , UPPER(p_date_start_or_end)
6248 , p_owner_id
6249 , p_owner_type_code
6250 , p_assigned_by
6251 , p_sort_data
6252 , p_start_pointer
6253 , p_rec_wanted
6254 , p_show_all
6255 , p_query_or_next_code
6256 , x_task_table
6257 , x_total_retrieved
6258 , x_total_returned
6259 , x_return_status
6260 , x_msg_count
6261 , x_msg_data
6262 );
6263 EXCEPTION
6264 WHEN fnd_api.g_exc_error THEN
6265 ROLLBACK TO query_next_task;
6266 x_return_status := fnd_api.g_ret_sts_error;
6267 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
6268 WHEN fnd_api.g_exc_unexpected_error THEN
6269 ROLLBACK TO query_next_task;
6270 x_return_status := fnd_api.g_ret_sts_unexp_error;
6271 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
6272 WHEN OTHERS THEN
6273 ROLLBACK TO query_next_task;
6274 x_return_status := fnd_api.g_ret_sts_unexp_error;
6275
6276 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
6277 fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
6278 END IF;
6279
6280 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
6281 END query_next_task;
6282
6283 -----------
6284 ----------- Copy Task
6285 -----------
6286 -----------
6287 PROCEDURE copy_task(
6288 p_api_version IN NUMBER
6289 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
6290 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
6291 , p_source_task_id IN NUMBER DEFAULT NULL
6292 , p_source_task_number IN VARCHAR2 DEFAULT NULL
6293 , p_target_task_id IN NUMBER DEFAULT NULL
6297 , p_create_recurrences IN VARCHAR2 DEFAULT fnd_api.g_false
6294 , p_copy_task_assignments IN VARCHAR2 DEFAULT fnd_api.g_false
6295 , p_copy_task_rsc_reqs IN VARCHAR2 DEFAULT fnd_api.g_false
6296 , p_copy_task_depends IN VARCHAR2 DEFAULT fnd_api.g_false
6298 , p_copy_task_references IN VARCHAR2 DEFAULT fnd_api.g_false
6299 , p_copy_task_dates IN VARCHAR2 DEFAULT fnd_api.g_false
6300 , x_return_status OUT NOCOPY VARCHAR2
6301 , p_copy_notes IN VARCHAR2 DEFAULT fnd_api.g_false
6302 , p_resource_id IN NUMBER DEFAULT NULL
6303 , p_resource_type IN VARCHAR2 DEFAULT NULL
6304 , x_msg_count OUT NOCOPY NUMBER
6305 , x_msg_data OUT NOCOPY VARCHAR2
6306 , x_task_id OUT NOCOPY NUMBER
6307 , p_copy_task_contacts IN VARCHAR2 DEFAULT jtf_task_utl.g_false_char
6308 , p_copy_task_contact_points IN VARCHAR2 DEFAULT jtf_task_utl.g_false_char
6309 ) IS
6310 l_api_version CONSTANT NUMBER := 1.0;
6311 l_api_name CONSTANT VARCHAR2(30) := 'COPY_TASK';
6312 l_source_task_id jtf_tasks_b.task_id%TYPE := p_source_task_id;
6313 l_target_task_id jtf_tasks_b.task_id%TYPE := p_target_task_id;
6314 l_task_number jtf_tasks_b.task_id%TYPE := p_source_task_number;
6315 l_dependency_id jtf_task_depends.dependency_id%TYPE;
6316 l_task_assignment_id jtf_task_all_assignments.task_assignment_id%TYPE;
6317 l_resource_req_id jtf_task_rsc_reqs.resource_req_id%TYPE;
6318 l_task_reference_id jtf_task_references_b.task_reference_id%TYPE;
6319 l_task_date_id jtf_task_dates.task_date_id%TYPE;
6320 l_recurrence_rule_id jtf_task_recur_rules.recurrence_rule_id%TYPE;
6321 l_task_rec jtf_task_recurrences_pub.task_details_rec;
6322 l_output_dates_counter NUMBER;
6323
6324 CURSOR c_task IS
6325 SELECT tk.laptop_flag
6326 , tk.device1_flag
6327 , tk.device2_flag
6328 , tk.device3_flag
6329 , tk.template_id
6330 , tk.template_group_id
6331 , tk.currency_code
6332 , tk.costs
6333 , tk.task_type_id
6334 , tk.task_status_id
6335 , tk.task_priority_id
6336 , tk.owner_id
6337 , tk.owner_type_code
6338 , tk.assigned_by_id
6339 , tk.cust_account_id
6340 , tk.customer_id
6341 , tk.address_id
6342 , tk.location_id
6343 , tk.planned_start_date
6344 , tk.planned_end_date
6345 , tk.scheduled_start_date
6346 , tk.scheduled_end_date
6347 , tk.actual_start_date
6348 , tk.actual_end_date
6349 , tk.source_object_type_code
6350 , tk.timezone_id
6351 , tk.source_object_id
6352 , tk.source_object_name
6353 , tk.DURATION
6354 , tk.duration_uom
6355 , tk.planned_effort
6356 , tk.planned_effort_uom
6357 , tk.actual_effort
6358 , tk.actual_effort_uom
6359 , tk.percentage_complete
6360 , tk.reason_code
6361 , tk.private_flag
6362 , tk.publish_flag
6363 , tk.restrict_closure_flag
6364 , tk.multi_booked_flag
6365 , tk.milestone_flag
6366 , tk.holiday_flag
6367 , tk.billable_flag
6368 , tk.bound_mode_code
6369 , tk.soft_bound_flag
6370 , tk.workflow_process_id
6371 , tk.notification_flag
6372 , tk.notification_period
6373 , tk.notification_period_uom
6374 , tk.parent_task_id
6375 , tk.recurrence_rule_id
6376 , tk.alarm_start
6377 , tk.alarm_start_uom
6378 , tk.alarm_on
6379 , tk.alarm_count
6380 , tk.alarm_fired_count
6381 , tk.alarm_interval
6382 , tk.alarm_interval_uom
6383 , tk.deleted_flag
6384 , tk.palm_flag
6385 , tk.wince_flag
6386 , tk.task_name
6387 , tk.description
6388 , tk.date_selected
6389 , tk.attribute1
6390 , tk.attribute2
6391 , tk.attribute3
6392 , tk.attribute4
6393 , tk.attribute5
6394 , tk.attribute6
6395 , tk.attribute7
6396 , tk.attribute8
6397 , tk.attribute9
6398 , tk.attribute10
6399 , tk.attribute11
6400 , tk.attribute12
6401 , tk.attribute13
6402 , tk.attribute14
6403 , tk.attribute15
6404 , tk.attribute_category
6405 , NVL(tka.category_id, NULL) category_id
6406 , NVL(tka.show_on_calendar, NULL) show_on_calendar
6407 , NVL(tka.assignment_status_id, NULL) assignment_status_id
6408 , tka.free_busy_type free_busy_type
6409 , tk.entity
6410 FROM jtf_tasks_vl tk, jtf_task_all_assignments tka
6414 -- created by the task_create API
6411 WHERE tk.task_id = l_source_task_id AND tk.task_id = tka.task_id(+) AND 'OWNER' = tka.assignee_role(+);
6412
6413 -- Fetch also assignment details for OWNER, if present, as this is
6415 CURSOR c_depends IS
6416 SELECT dependent_on_task_id
6417 , dependency_type_code
6418 , template_flag
6419 , adjustment_time
6420 , adjustment_time_uom
6421 , validated_flag
6422 FROM jtf_task_depends
6423 WHERE task_id = l_source_task_id;
6424
6425 CURSOR c_references IS
6426 SELECT object_type_code
6427 , object_name
6428 , object_id
6429 , object_details
6430 , reference_code
6431 , USAGE
6432 FROM jtf_task_references_vl
6433 WHERE task_id = l_source_task_id;
6434
6435 CURSOR c_dates IS
6436 SELECT date_type_id
6437 , date_value
6438 FROM jtf_task_dates
6439 WHERE task_id = l_source_task_id;
6440
6441 CURSOR c_recurs IS
6442 SELECT occurs_which
6443 , day_of_week
6444 , date_of_month
6445 , occurs_month
6446 , occurs_uom
6447 , occurs_every
6448 , occurs_number
6449 , start_date_active
6450 , end_date_active
6451 FROM jtf_task_recur_rules
6452 WHERE recurrence_rule_id = l_recurrence_rule_id;
6453
6454 CURSOR c_rsc_reqs IS
6455 SELECT task_id
6456 , resource_type_code
6457 , required_units
6458 , enabled_flag
6459 FROM jtf_task_rsc_reqs
6460 WHERE task_id = l_source_task_id;
6461
6462 CURSOR c_assignments IS
6463 SELECT resource_type_code
6464 , resource_id
6465 , actual_effort
6466 , actual_effort_uom
6467 , schedule_flag
6468 , alarm_type_code
6469 , alarm_contact
6470 , sched_travel_distance
6471 , sched_travel_duration
6472 , sched_travel_duration_uom
6473 , actual_travel_distance
6474 , actual_travel_duration
6475 , actual_travel_duration_uom
6476 , actual_start_date
6477 , actual_end_date
6478 , palm_flag
6479 , wince_flag
6480 , laptop_flag
6481 , device1_flag
6482 , device2_flag
6483 , device3_flag
6484 , resource_territory_id
6485 , assignment_status_id
6486 , assignee_role
6487 , show_on_calendar
6488 , category_id
6489 , free_busy_type
6490 FROM jtf_task_all_assignments
6491 WHERE task_id = l_source_task_id AND assignee_role = 'ASSIGNEE';
6492
6493 -- Assignment record for OWNER is created by the task_create API
6494 CURSOR c1_assignments IS
6495 SELECT resource_type_code
6496 , resource_id
6497 , actual_effort
6498 , actual_effort_uom
6499 , schedule_flag
6500 , alarm_type_code
6501 , alarm_contact
6502 , sched_travel_distance
6503 , sched_travel_duration
6504 , sched_travel_duration_uom
6505 , actual_travel_distance
6506 , actual_travel_duration
6507 , actual_travel_duration_uom
6508 , actual_start_date
6509 , actual_end_date
6510 , palm_flag
6511 , wince_flag
6512 , laptop_flag
6513 , device1_flag
6514 , device2_flag
6515 , device3_flag
6516 , resource_territory_id
6517 , assignment_status_id
6518 , assignee_role
6519 , show_on_calendar
6520 , category_id
6521 , free_busy_type
6522 FROM jtf_task_all_assignments
6523 WHERE task_id = l_source_task_id AND assignee_role = 'ASSIGNEE';
6524
6525 CURSOR c_notes(p_source_object_code IN VARCHAR2) IS
6526 SELECT jtf_note_id
6527 , parent_note_id
6528 , source_object_id
6529 , source_object_code
6530 , source_number
6531 , last_update_date
6532 , last_updated_by
6533 , creation_date
6534 , created_by
6535 , last_update_login
6536 , notes
6537 , notes_detail
6538 , note_status
6539 , entered_by
6540 , entered_by_name
6541 , entered_date
6542 , source_object_meaning
6543 , note_type
6544 , note_type_meaning
6545 , attribute1
6546 , attribute2
6547 , attribute3
6548 , attribute4
6549 , attribute5
6550 , attribute6
6551 , attribute7
6552 , attribute8
6553 , attribute9
6554 , attribute10
6555 , attribute11
6556 , attribute12
6557 , attribute13
6558 , attribute14
6559 , attribute15
6560 , CONTEXT
6564
6561 , note_status_meaning
6562 FROM jtf_notes_vl
6563 WHERE source_object_id = l_source_task_id AND source_object_code = p_source_object_code;
6565 CURSOR c_contacts IS
6566 SELECT task_contact_id
6567 , contact_id
6568 , contact_type_code
6569 , escalation_notify_flag
6570 , escalation_requester_flag
6571 , primary_flag
6572 FROM jtf_task_contacts
6573 WHERE task_id = l_source_task_id;
6574
6575 CURSOR c_contact_points(b_contact_id jtf_task_phones.task_contact_id%TYPE) IS
6576 SELECT phone_id
6577 , task_phone_id
6578 , primary_flag
6579 FROM jtf_task_phones
6580 WHERE task_contact_id = b_contact_id;
6581
6582 tasks c_task%ROWTYPE;
6583 depends c_depends%ROWTYPE;
6584 REFERENCE c_references%ROWTYPE;
6585 dates c_dates%ROWTYPE;
6586 recurs c_recurs%ROWTYPE;
6587 rsc_reqs c_rsc_reqs%ROWTYPE;
6588 assignments c_assignments%ROWTYPE;
6589 notes c_notes%ROWTYPE;
6590 contacts c_contacts%ROWTYPE;
6591 contact_points c_contact_points%ROWTYPE;
6592 l_jtf_note_id NUMBER;
6593 l_rowid VARCHAR2(20);
6594 l_note_id NUMBER;
6595 l_source_object_id NUMBER;
6596 l_notes_detail VARCHAR2(32767);
6597 l_task_contact_id NUMBER;
6598 l_task_phone_id NUMBER;
6599 l_notes_source_object_code VARCHAR2(50); -- Added on 31/05/2006 for bug# 5211606
6600 BEGIN
6601 SAVEPOINT copy_task;
6602 x_return_status := fnd_api.g_ret_sts_success;
6603
6604 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
6605 RAISE fnd_api.g_exc_unexpected_error;
6606 END IF;
6607
6608 IF fnd_api.to_boolean(p_init_msg_list) THEN
6609 fnd_msg_pub.initialize;
6610 END IF;
6611
6612 IF l_source_task_id IS NULL THEN
6613 x_return_status := fnd_api.g_ret_sts_unexp_error;
6614 fnd_message.set_name('JTF', 'JTF_TASK_MISSING_TASK_ID');
6615 fnd_msg_pub.ADD;
6616 RAISE fnd_api.g_exc_unexpected_error;
6617 END IF;
6618
6619 jtf_task_utl.validate_task(
6620 x_return_status => x_return_status
6621 , p_task_id => p_source_task_id
6622 , p_task_number => p_source_task_number
6623 , x_task_id => l_source_task_id
6624 );
6625
6626 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
6627 RAISE fnd_api.g_exc_unexpected_error;
6628 END IF;
6629
6630 --- copy the main task.
6631 OPEN c_task;
6632 FETCH c_task INTO tasks;
6633 IF c_task%NOTFOUND THEN
6634 x_return_status := fnd_api.g_ret_sts_unexp_error;
6635 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_TASK_ID');
6636 fnd_message.set_token('P_TASK_ID', l_source_task_id);
6637 fnd_msg_pub.ADD;
6638 RAISE fnd_api.g_exc_unexpected_error;
6639 CLOSE c_task;
6640 END IF;
6641
6642 ----------------------------------------------------------------------------------------------------------------------------------
6643 IF (p_resource_id IS NOT NULL AND p_resource_type IS NOT NULL) THEN
6644 -- Copy task for all the members in a group or a team.
6645 jtf_tasks_pvt.create_task(
6646 p_api_version => 1.0
6647 , p_init_msg_list => fnd_api.g_false
6648 , p_commit => fnd_api.g_false
6649 , p_task_id => p_target_task_id
6650 , p_task_name => tasks.task_name
6651 , p_task_type_id => tasks.task_type_id
6652 , p_description => tasks.description
6653 , p_task_status_id => tasks.task_status_id
6654 , p_task_priority_id => tasks.task_priority_id
6655 , p_owner_type_code => p_resource_type
6656 , p_owner_id => p_resource_id
6657 , p_assigned_by_id => tasks.assigned_by_id
6658 , p_customer_id => tasks.customer_id
6659 , p_cust_account_id => tasks.cust_account_id
6660 , p_address_id => tasks.address_id
6661 , p_planned_start_date => tasks.planned_start_date
6662 , p_planned_end_date => tasks.planned_end_date
6663 , p_scheduled_start_date => tasks.scheduled_start_date
6664 , p_scheduled_end_date => tasks.scheduled_end_date
6665 , p_actual_start_date => tasks.actual_start_date
6666 , p_actual_end_date => tasks.actual_end_date
6667 , p_timezone_id => tasks.timezone_id
6668 , p_source_object_type_code => tasks.source_object_type_code
6669 , p_source_object_id => tasks.source_object_id
6670 , p_source_object_name => tasks.source_object_name
6671 , p_duration => tasks.DURATION
6672 , p_duration_uom => tasks.duration_uom
6673 , p_planned_effort => tasks.planned_effort
6677 , p_percentage_complete => tasks.percentage_complete
6674 , p_planned_effort_uom => tasks.planned_effort_uom
6675 , p_actual_effort => tasks.actual_effort
6676 , p_actual_effort_uom => tasks.actual_effort_uom
6678 , p_reason_code => tasks.reason_code
6679 , p_private_flag => tasks.private_flag
6680 , p_publish_flag => tasks.publish_flag
6681 , p_restrict_closure_flag => tasks.restrict_closure_flag
6682 , p_multi_booked_flag => tasks.multi_booked_flag
6683 , p_milestone_flag => tasks.milestone_flag
6684 , p_holiday_flag => tasks.holiday_flag
6685 , p_billable_flag => tasks.billable_flag
6686 , p_bound_mode_code => tasks.bound_mode_code
6687 , p_soft_bound_flag => tasks.soft_bound_flag
6688 , p_notification_flag => tasks.notification_flag
6689 , p_notification_period => tasks.notification_period
6690 , p_notification_period_uom => tasks.notification_period_uom
6691 , p_parent_task_id => tasks.parent_task_id
6692 , p_alarm_start => tasks.alarm_start
6693 , p_alarm_start_uom => tasks.alarm_start_uom
6694 , p_alarm_on => tasks.alarm_on
6695 , p_alarm_count => tasks.alarm_count
6696 , p_alarm_interval => tasks.alarm_interval
6697 , p_alarm_interval_uom => tasks.alarm_interval_uom
6698 , p_palm_flag => tasks.palm_flag
6699 , p_wince_flag => tasks.wince_flag
6700 , p_laptop_flag => tasks.laptop_flag
6701 , p_device1_flag => tasks.device1_flag
6702 , p_device2_flag => tasks.device2_flag
6703 , p_device3_flag => tasks.device3_flag
6704 , p_costs => tasks.costs
6705 , p_currency_code => tasks.currency_code
6706 , x_return_status => x_return_status
6707 , x_msg_count => x_msg_count
6708 , x_msg_data => x_msg_data
6709 , x_task_id => l_target_task_id
6710 , p_date_selected => tasks.date_selected
6711 , p_category_id => tasks.category_id
6712 , p_show_on_calendar => tasks.show_on_calendar
6713 , p_owner_status_id => tasks.assignment_status_id
6714 , p_attribute1 => tasks.attribute1
6715 , p_attribute2 => tasks.attribute2
6716 , p_attribute3 => tasks.attribute3
6717 , p_attribute4 => tasks.attribute4
6718 , p_attribute5 => tasks.attribute5
6719 , p_attribute6 => tasks.attribute6
6720 , p_attribute7 => tasks.attribute7
6721 , p_attribute8 => tasks.attribute8
6722 , p_attribute9 => tasks.attribute9
6723 , p_attribute10 => tasks.attribute10
6724 , p_attribute11 => tasks.attribute11
6725 , p_attribute12 => tasks.attribute12
6726 , p_attribute13 => tasks.attribute13
6727 , p_attribute14 => tasks.attribute14
6728 , p_attribute15 => tasks.attribute15
6729 , p_attribute_category => tasks.attribute_category
6730 , p_enable_workflow => fnd_profile.VALUE('JTF_TASK_ENABLE_WORKFLOW')
6731 , p_abort_workflow => fnd_profile.VALUE('JTF_TASK_ABORT_PREV_WF')
6732 , p_entity => tasks.entity
6733 , p_free_busy_type => tasks.free_busy_type
6734 , p_task_confirmation_status => 'N'
6735 , p_task_confirmation_counter => NULL
6736 , p_task_split_flag => NULL
6737 , p_reference_flag => NULL
6738 , p_child_position => NULL
6739 , p_child_sequence_num => NULL
6740 , p_location_id => tasks.location_id
6741 , p_template_id => tasks.template_id
6742 , p_template_group_id => tasks.template_group_id
6743 , p_copied_from_task_id => l_source_task_id
6744 );
6745
6746 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
6747 x_return_status := fnd_api.g_ret_sts_unexp_error;
6748 RAISE fnd_api.g_exc_unexpected_error;
6749 END IF;
6750
6751 --Create notes
6752 IF fnd_api.to_boolean(p_copy_notes) THEN
6753 -- Added on 31/05/2006 for bug# 5211606
6754 IF ((tasks.entity IS NOT NULL) AND(tasks.entity = 'ESCALATION')) THEN
6755 l_notes_source_object_code := 'ESC';
6756 ELSE
6757 l_notes_source_object_code := tasks.entity;
6758 END IF;
6759
6760 -- Modified on 31/05/2006 for bug# 5211606
6761 FOR notes_rec IN c_notes(l_notes_source_object_code) LOOP
6762 jtf_notes_pub.writelobtodata(notes_rec.jtf_note_id, l_notes_detail);
6763
6764 SELECT jtf_notes_s.NEXTVAL
6765 INTO l_note_id
6766 FROM DUAL;
6767
6768 jtf_notes_pkg.insert_row(
6769 x_rowid => l_rowid
6770 , x_jtf_note_id => l_note_id
6774 , x_entered_date => notes_rec.entered_date
6771 , x_source_object_code => notes_rec.source_object_code
6772 , x_note_status => notes_rec.note_status
6773 , x_entered_by => notes_rec.entered_by
6775 , x_note_type => notes_rec.note_type
6776 , x_attribute1 => notes_rec.attribute1
6777 , x_attribute2 => notes_rec.attribute2
6778 , x_attribute3 => notes_rec.attribute3
6779 , x_attribute4 => notes_rec.attribute4
6780 , x_attribute5 => notes_rec.attribute5
6781 , x_attribute6 => notes_rec.attribute6
6782 , x_attribute7 => notes_rec.attribute7
6783 , x_attribute8 => notes_rec.attribute8
6784 , x_attribute9 => notes_rec.attribute9
6785 , x_attribute10 => notes_rec.attribute10
6786 , x_attribute11 => notes_rec.attribute11
6787 , x_attribute12 => notes_rec.attribute12
6788 , x_attribute13 => notes_rec.attribute13
6789 , x_attribute14 => notes_rec.attribute14
6790 , x_attribute15 => notes_rec.attribute15
6791 , x_context => notes_rec.CONTEXT
6792 , x_parent_note_id => notes_rec.parent_note_id
6793 , x_source_object_id => l_target_task_id
6794 , x_notes => notes_rec.notes
6795 , x_notes_detail => l_notes_detail
6796 , x_creation_date => notes_rec.creation_date
6797 , x_created_by => notes_rec.created_by
6798 , x_last_update_date => notes_rec.last_update_date
6799 , x_last_updated_by => notes_rec.last_updated_by
6800 , x_last_update_login => notes_rec.last_update_login
6801 );
6802
6803 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
6804 x_return_status := fnd_api.g_ret_sts_unexp_error;
6805 RAISE fnd_api.g_exc_unexpected_error;
6806 END IF;
6807 END LOOP;
6808 END IF;
6809 ELSE
6810 jtf_tasks_pvt.create_task(
6811 p_api_version => 1.0
6812 , p_init_msg_list => fnd_api.g_false
6813 , p_commit => fnd_api.g_false
6814 , p_task_id => p_target_task_id
6815 , p_task_name => tasks.task_name
6816 , p_task_type_id => tasks.task_type_id
6817 , p_description => tasks.description
6818 , p_task_status_id => tasks.task_status_id
6819 , p_task_priority_id => tasks.task_priority_id
6820 , p_owner_type_code => tasks.owner_type_code
6821 , p_owner_id => tasks.owner_id
6822 , p_assigned_by_id => tasks.assigned_by_id
6823 , p_customer_id => tasks.customer_id
6824 , p_cust_account_id => tasks.cust_account_id
6825 , p_address_id => tasks.address_id
6826 , p_planned_start_date => tasks.planned_start_date
6827 , p_planned_end_date => tasks.planned_end_date
6828 , p_scheduled_start_date => tasks.scheduled_start_date
6829 , p_scheduled_end_date => tasks.scheduled_end_date
6830 , p_actual_start_date => tasks.actual_start_date
6831 , p_actual_end_date => tasks.actual_end_date
6832 , p_timezone_id => tasks.timezone_id
6833 , p_source_object_type_code => tasks.source_object_type_code
6834 , p_source_object_id => tasks.source_object_id
6835 , p_source_object_name => tasks.source_object_name
6836 , p_duration => tasks.DURATION
6837 , p_duration_uom => tasks.duration_uom
6838 , p_planned_effort => tasks.planned_effort
6839 , p_planned_effort_uom => tasks.planned_effort_uom
6840 , p_actual_effort => tasks.actual_effort
6841 , p_actual_effort_uom => tasks.actual_effort_uom
6842 , p_percentage_complete => tasks.percentage_complete
6843 , p_reason_code => tasks.reason_code
6844 , p_private_flag => tasks.private_flag
6845 , p_publish_flag => tasks.publish_flag
6846 , p_restrict_closure_flag => tasks.restrict_closure_flag
6847 , p_multi_booked_flag => tasks.multi_booked_flag
6848 , p_milestone_flag => tasks.milestone_flag
6849 , p_holiday_flag => tasks.holiday_flag
6850 , p_billable_flag => tasks.billable_flag
6851 , p_bound_mode_code => tasks.bound_mode_code
6852 , p_soft_bound_flag => tasks.soft_bound_flag
6853 , p_notification_flag => tasks.notification_flag
6854 , p_notification_period => tasks.notification_period
6855 , p_notification_period_uom => tasks.notification_period_uom
6856 , p_parent_task_id => tasks.parent_task_id
6857 , p_alarm_start => tasks.alarm_start
6858 , p_alarm_start_uom => tasks.alarm_start_uom
6862 , p_alarm_interval_uom => tasks.alarm_interval_uom
6859 , p_alarm_on => tasks.alarm_on
6860 , p_alarm_count => tasks.alarm_count
6861 , p_alarm_interval => tasks.alarm_interval
6863 , p_palm_flag => tasks.palm_flag
6864 , p_wince_flag => tasks.wince_flag
6865 , p_laptop_flag => tasks.laptop_flag
6866 , p_device1_flag => tasks.device1_flag
6867 , p_device2_flag => tasks.device2_flag
6868 , p_device3_flag => tasks.device3_flag
6869 , p_costs => tasks.costs
6870 , p_currency_code => tasks.currency_code
6871 , x_return_status => x_return_status
6872 , x_msg_count => x_msg_count
6873 , x_msg_data => x_msg_data
6874 , x_task_id => l_target_task_id
6875 , p_date_selected => tasks.date_selected
6876 , p_category_id => tasks.category_id
6877 , p_show_on_calendar => tasks.show_on_calendar
6878 , p_owner_status_id => tasks.assignment_status_id
6879 , p_attribute1 => tasks.attribute1
6880 , p_attribute2 => tasks.attribute2
6881 , p_attribute3 => tasks.attribute3
6882 , p_attribute4 => tasks.attribute4
6883 , p_attribute5 => tasks.attribute5
6884 , p_attribute6 => tasks.attribute6
6885 , p_attribute7 => tasks.attribute7
6886 , p_attribute8 => tasks.attribute8
6887 , p_attribute9 => tasks.attribute9
6888 , p_attribute10 => tasks.attribute10
6889 , p_attribute11 => tasks.attribute11
6890 , p_attribute12 => tasks.attribute12
6891 , p_attribute13 => tasks.attribute13
6892 , p_attribute14 => tasks.attribute14
6893 , p_attribute15 => tasks.attribute15
6894 , p_attribute_category => tasks.attribute_category
6895 , p_enable_workflow => fnd_profile.VALUE('JTF_TASK_ENABLE_WORKFLOW')
6896 , p_abort_workflow => fnd_profile.VALUE('JTF_TASK_ABORT_PREV_WF')
6897 , p_entity => tasks.entity
6898 , p_free_busy_type => tasks.free_busy_type
6899 , p_task_confirmation_status => 'N'
6900 , p_task_confirmation_counter => NULL
6901 , p_task_split_flag => NULL
6902 , p_reference_flag => NULL
6903 , p_child_position => NULL
6904 , p_child_sequence_num => NULL
6905 , p_location_id => tasks.location_id
6906 , p_template_id => tasks.template_id
6907 , p_template_group_id => tasks.template_group_id
6908 , p_copied_from_task_id => l_source_task_id
6909 );
6910 x_task_id := l_target_task_id;
6911
6912 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
6913 x_return_status := fnd_api.g_ret_sts_unexp_error;
6914 RAISE fnd_api.g_exc_unexpected_error;
6915 END IF;
6916 END IF;
6917
6918 IF c_task%ISOPEN THEN
6919 CLOSE c_task;
6920 END IF;
6921
6922 ------
6923 ------ Create contact point for the customer
6924 ------ (where task_contact_id = task_id)
6925 ------
6926 FOR contact_points IN c_contact_points(l_source_task_id) LOOP
6927 jtf_task_phones_pub.create_task_phones(
6928 p_api_version => 1.0
6929 , p_init_msg_list => fnd_api.g_false
6930 , p_commit => fnd_api.g_false
6931 , p_task_contact_id => l_target_task_id
6932 , p_phone_id => contact_points.phone_id
6933 , p_primary_flag => contact_points.primary_flag
6934 , p_owner_table_name => 'JTF_TASKS_B'
6935 , x_return_status => x_return_status
6936 , x_msg_count => x_msg_count
6937 , x_msg_data => x_msg_data
6938 , x_task_phone_id => l_task_phone_id
6939 );
6940
6941 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
6942 x_return_status := fnd_api.g_ret_sts_unexp_error;
6943 RAISE fnd_api.g_exc_unexpected_error;
6944 END IF;
6945 END LOOP;
6946
6947 -------------------------------------------------------------------------------------------------------------------------
6948 ------
6949 ------ Create dependencies
6950 ------
6951 IF fnd_api.to_boolean(p_copy_task_depends) THEN
6952 FOR depends IN c_depends LOOP
6953 jtf_task_dependency_pvt.create_task_dependency(
6954 p_api_version => 1.0
6955 , p_init_msg_list => fnd_api.g_false
6956 , p_commit => fnd_api.g_false
6957 , p_task_id => l_target_task_id
6958 , p_dependent_on_task_id => depends.dependent_on_task_id
6959 , p_dependency_type_code => depends.dependency_type_code
6960 , p_template_flag => depends.template_flag
6961 , p_adjustment_time => depends.adjustment_time
6965 , x_return_status => x_return_status
6962 , p_adjustment_time_uom => depends.adjustment_time_uom
6963 , p_validated_flag => depends.validated_flag
6964 , x_dependency_id => l_dependency_id
6966 , x_msg_count => x_msg_count
6967 , x_msg_data => x_msg_data
6968 );
6969
6970 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
6971 x_return_status := fnd_api.g_ret_sts_unexp_error;
6972 RAISE fnd_api.g_exc_unexpected_error;
6973 END IF;
6974 END LOOP;
6975 END IF;
6976
6977 ------
6978 ------ Create Resource Requirements
6979 ------
6980 IF fnd_api.to_boolean(p_copy_task_rsc_reqs) THEN
6981 FOR rsc_reqs IN c_rsc_reqs LOOP
6982 jtf_task_resources_pub.create_task_rsrc_req(
6983 p_api_version => 1.0
6984 , p_init_msg_list => fnd_api.g_false
6985 , p_commit => fnd_api.g_false
6986 , p_task_id => l_target_task_id
6987 , p_resource_type_code => rsc_reqs.resource_type_code
6988 , p_required_units => rsc_reqs.required_units
6989 , p_enabled_flag => rsc_reqs.enabled_flag
6990 , x_return_status => x_return_status
6991 , x_msg_count => x_msg_count
6992 , x_msg_data => x_msg_data
6993 , x_resource_req_id => l_resource_req_id
6994 );
6995
6996 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
6997 x_return_status := fnd_api.g_ret_sts_unexp_error;
6998 RAISE fnd_api.g_exc_unexpected_error;
6999 END IF;
7000 END LOOP;
7001 END IF;
7002
7003 -----------------------------------------------------------------------------------------------------
7004 ---Code added for mass task creation
7005
7006 ------
7007 ------ Create Task Assignments
7008 ------
7009 IF fnd_api.to_boolean(p_copy_task_assignments) THEN
7010 jtf_task_utl.g_validate_category := FALSE;
7011
7012 IF (p_resource_id IS NOT NULL AND p_resource_type IS NOT NULL) THEN
7013 FOR assignments IN c1_assignments LOOP
7014 jtf_task_assignments_pub.create_task_assignment(
7015 p_api_version => 1.0
7016 , p_init_msg_list => fnd_api.g_false
7017 , p_commit => fnd_api.g_false
7018 , p_task_id => l_target_task_id
7019 , p_resource_type_code => p_resource_type
7020 , p_resource_id => p_resource_id
7021 , p_resource_territory_id => assignments.resource_territory_id
7022 , p_assignment_status_id => assignments.assignment_status_id
7023 , p_actual_effort => assignments.actual_effort
7024 , p_actual_effort_uom => assignments.actual_effort_uom
7025 , p_schedule_flag => assignments.schedule_flag
7026 , p_alarm_type_code => assignments.alarm_type_code
7027 , p_alarm_contact => assignments.alarm_contact
7028 , p_sched_travel_distance => assignments.sched_travel_duration
7029 , p_sched_travel_duration => assignments.sched_travel_duration
7030 , p_sched_travel_duration_uom => assignments.sched_travel_duration_uom
7031 , p_actual_travel_distance => assignments.actual_travel_distance
7032 , p_actual_travel_duration => assignments.actual_travel_duration
7033 , p_actual_travel_duration_uom => assignments.actual_travel_duration_uom
7034 , p_actual_start_date => assignments.actual_start_date
7035 , p_actual_end_date => assignments.actual_end_date
7036 , p_palm_flag => assignments.palm_flag
7037 , p_wince_flag => assignments.wince_flag
7038 , p_laptop_flag => assignments.laptop_flag
7039 , p_device1_flag => assignments.device1_flag
7040 , p_device2_flag => assignments.device2_flag
7041 , p_device3_flag => assignments.device3_flag
7042 , x_return_status => x_return_status
7043 , x_msg_count => x_msg_count
7044 , x_msg_data => x_msg_data
7045 , x_task_assignment_id => l_task_assignment_id
7046 , p_show_on_calendar => assignments.show_on_calendar
7047 , p_category_id => assignments.category_id
7048 , p_enable_workflow => fnd_profile.VALUE('JTF_TASK_ENABLE_WORKFLOW')
7049 , p_abort_workflow => fnd_profile.VALUE('JTF_TASK_ABORT_PREV_WF')
7050 , p_object_capacity_id => NULL
7051 , p_free_busy_type => assignments.free_busy_type
7052 );
7053
7054 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
7055 x_return_status := fnd_api.g_ret_sts_unexp_error;
7056 RAISE fnd_api.g_exc_unexpected_error;
7057 END IF;
7058 END LOOP;
7059 ELSE
7060 FOR assignments IN c_assignments LOOP
7061 jtf_task_assignments_pub.create_task_assignment(
7062 p_api_version => 1.0
7063 , p_init_msg_list => fnd_api.g_false
7064 , p_commit => fnd_api.g_false
7068 , p_resource_territory_id => assignments.resource_territory_id
7065 , p_task_id => l_target_task_id
7066 , p_resource_type_code => assignments.resource_type_code
7067 , p_resource_id => assignments.resource_id
7069 , p_assignment_status_id => assignments.assignment_status_id
7070 , p_actual_effort => assignments.actual_effort
7071 , p_actual_effort_uom => assignments.actual_effort_uom
7072 , p_schedule_flag => assignments.schedule_flag
7073 , p_alarm_type_code => assignments.alarm_type_code
7074 , p_alarm_contact => assignments.alarm_contact
7075 , p_sched_travel_distance => assignments.sched_travel_duration
7076 , p_sched_travel_duration => assignments.sched_travel_duration
7077 , p_sched_travel_duration_uom => assignments.sched_travel_duration_uom
7078 , p_actual_travel_distance => assignments.actual_travel_distance
7079 , p_actual_travel_duration => assignments.actual_travel_duration
7080 , p_actual_travel_duration_uom => assignments.actual_travel_duration_uom
7081 , p_actual_start_date => assignments.actual_start_date
7082 , p_actual_end_date => assignments.actual_end_date
7083 , p_palm_flag => assignments.palm_flag
7084 , p_wince_flag => assignments.wince_flag
7085 , p_laptop_flag => assignments.laptop_flag
7086 , p_device1_flag => assignments.device1_flag
7087 , p_device2_flag => assignments.device2_flag
7088 , p_device3_flag => assignments.device3_flag
7089 , x_return_status => x_return_status
7090 , x_msg_count => x_msg_count
7091 , x_msg_data => x_msg_data
7092 , x_task_assignment_id => l_task_assignment_id
7093 , p_show_on_calendar => assignments.show_on_calendar
7094 , p_category_id => assignments.category_id
7095 , p_enable_workflow => fnd_profile.VALUE('JTF_TASK_ENABLE_WORKFLOW')
7096 , p_abort_workflow => fnd_profile.VALUE('JTF_TASK_ABORT_PREV_WF')
7097 , p_object_capacity_id => NULL
7098 , p_free_busy_type => assignments.free_busy_type
7099 );
7100
7101 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
7102 x_return_status := fnd_api.g_ret_sts_unexp_error;
7103 RAISE fnd_api.g_exc_unexpected_error;
7104 END IF;
7105 END LOOP;
7106 END IF;
7107 END IF;
7108
7109 ------
7110 ------ Create references
7111 ------
7112 IF fnd_api.to_boolean(p_copy_task_references) THEN
7113 FOR REFERENCE IN c_references LOOP
7114 jtf_task_utl.g_show_error_for_dup_reference := FALSE;
7115 jtf_task_references_pvt.create_references(
7116 p_api_version => 1.0
7117 , p_init_msg_list => fnd_api.g_false
7118 , p_commit => fnd_api.g_false
7119 , p_task_id => l_target_task_id
7120 , p_object_type_code => REFERENCE.object_type_code
7121 , p_object_name => REFERENCE.object_name
7122 , p_object_id => REFERENCE.object_id
7123 , p_object_details => REFERENCE.object_details
7124 , p_reference_code => REFERENCE.reference_code
7125 , p_usage => REFERENCE.USAGE
7126 , x_return_status => x_return_status
7127 , x_msg_data => x_msg_data
7128 , x_msg_count => x_msg_count
7129 , x_task_reference_id => l_task_reference_id
7130 );
7131
7132 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
7133 x_return_status := fnd_api.g_ret_sts_unexp_error;
7134 RAISE fnd_api.g_exc_unexpected_error;
7135 END IF;
7136 END LOOP;
7137 END IF;
7138
7139 ------
7140 ------ Create dates
7141 ------
7142 IF fnd_api.to_boolean(p_copy_task_dates) THEN
7143 FOR dates IN c_dates LOOP
7144 jtf_task_dates_pvt.create_task_dates(
7145 p_api_version => 1.0
7146 , p_init_msg_list => fnd_api.g_false
7147 , p_commit => fnd_api.g_false
7148 , p_task_id => l_target_task_id
7149 , p_date_type_id => dates.date_type_id
7150 , p_date_value => dates.date_value
7151 , x_return_status => x_return_status
7152 , x_msg_count => x_msg_count
7153 , x_msg_data => x_msg_data
7154 , x_task_date_id => l_task_date_id
7155 );
7156
7157 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
7158 x_return_status := fnd_api.g_ret_sts_unexp_error;
7159 RAISE fnd_api.g_exc_unexpected_error;
7160 END IF;
7161 END LOOP;
7162 END IF;
7163
7164 ---- if the user wants to create the recurrences, then check if the source task has a valid recurrence_id
7165 ---- if yes, then get the recurrence rule and pass it to the task while creating the task.
7166 ---- if no, then error out.
7167
7171 ---- get the recurrence rule id for the source task
7168 ---- For recurrences
7169 IF fnd_api.to_boolean(p_create_recurrences) THEN
7170 IF fnd_api.to_boolean(p_create_recurrences) THEN
7172 BEGIN
7173 SELECT recurrence_rule_id
7174 INTO l_recurrence_rule_id
7175 FROM jtf_tasks_b
7176 WHERE task_id = l_source_task_id;
7177 EXCEPTION
7178 WHEN NO_DATA_FOUND THEN
7179 x_return_status := fnd_api.g_ret_sts_unexp_error;
7180 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_TASK_ID');
7181 fnd_message.set_token('P_TASK_ID', l_source_task_id);
7182 fnd_msg_pub.ADD;
7183 RAISE fnd_api.g_exc_unexpected_error;
7184 WHEN OTHERS THEN
7185 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
7186 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
7187 x_return_status := fnd_api.g_ret_sts_unexp_error;
7188 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7189 RAISE fnd_api.g_exc_unexpected_error;
7190 END;
7191
7192 IF l_recurrence_rule_id IS NOT NULL THEN
7193 x_return_status := fnd_api.g_ret_sts_unexp_error;
7194
7195 FOR recurs IN c_recurs LOOP
7196 jtf_task_recurrences_pvt.create_task_recurrence(
7197 p_api_version => 1.0
7198 , p_init_msg_list => fnd_api.g_false
7199 , p_commit => fnd_api.g_false
7200 , p_task_id => l_target_task_id
7201 , p_occurs_which => recurs.occurs_which
7202 , p_day_of_week => recurs.day_of_week
7203 , p_date_of_month => recurs.date_of_month
7204 , p_occurs_month => recurs.occurs_month
7205 , p_occurs_uom => recurs.occurs_uom
7206 , p_occurs_every => recurs.occurs_every
7207 , p_occurs_number => recurs.occurs_number
7208 , p_start_date_active => recurs.start_date_active
7209 , p_end_date_active => recurs.end_date_active
7210 , p_template_flag => jtf_task_utl.g_no
7211 , x_return_status => x_return_status
7212 , x_msg_count => x_msg_count
7213 , x_msg_data => x_msg_data
7214 , x_recurrence_rule_id => l_recurrence_rule_id
7215 , x_task_rec => l_task_rec
7216 , x_output_dates_counter => l_output_dates_counter
7217 );
7218
7219 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
7220 x_return_status := fnd_api.g_ret_sts_unexp_error;
7221 RAISE fnd_api.g_exc_unexpected_error;
7222 END IF;
7223 END LOOP;
7224 END IF;
7225 END IF;
7226 END IF;
7227
7228 ------
7229 ------ Create contacts
7230 ------
7231 IF fnd_api.to_boolean(p_copy_task_contacts) THEN
7232 FOR contacts IN c_contacts LOOP
7233 jtf_task_contacts_pub.create_task_contacts(
7234 p_api_version => 1.0
7235 , p_init_msg_list => fnd_api.g_false
7236 , p_commit => fnd_api.g_false
7237 , p_task_id => l_target_task_id
7238 , p_contact_id => contacts.contact_id
7239 , p_contact_type_code => contacts.contact_type_code
7240 , p_escalation_notify_flag => contacts.escalation_notify_flag
7241 , p_escalation_requester_flag => contacts.escalation_requester_flag
7242 , p_primary_flag => contacts.primary_flag
7243 , x_return_status => x_return_status
7244 , x_msg_count => x_msg_count
7245 , x_msg_data => x_msg_data
7246 , x_task_contact_id => l_task_contact_id
7247 );
7248
7249 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
7250 x_return_status := fnd_api.g_ret_sts_unexp_error;
7251 RAISE fnd_api.g_exc_unexpected_error;
7252 END IF;
7253
7254 ------
7255 ------ Create contact points for each contact
7256 ------
7257 IF fnd_api.to_boolean(p_copy_task_contact_points) THEN
7258 FOR contact_points IN c_contact_points(contacts.task_contact_id) LOOP
7259 jtf_task_phones_pub.create_task_phones(
7260 p_api_version => 1.0
7261 , p_init_msg_list => fnd_api.g_false
7262 , p_commit => fnd_api.g_false
7263 , p_task_contact_id => l_task_contact_id
7264 , p_phone_id => contact_points.phone_id
7265 , p_primary_flag => contact_points.primary_flag
7266 , x_return_status => x_return_status
7267 , x_msg_count => x_msg_count
7268 , x_msg_data => x_msg_data
7269 , x_task_phone_id => l_task_phone_id
7270 );
7271
7272 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
7273 x_return_status := fnd_api.g_ret_sts_unexp_error;
7274 RAISE fnd_api.g_exc_unexpected_error;
7275 END IF;
7276 END LOOP;
7280
7277 END IF;
7278 END LOOP;
7279 END IF;
7281 --Added by RDESPOTO, updated by TWAN for fixing bug 3756747
7282 cac_view_util_pvt.create_repeat_collab_details(p_source_task_id, x_task_id);
7283
7284 IF c_task%ISOPEN THEN
7285 CLOSE c_task;
7286 END IF;
7287
7288 IF c_depends%ISOPEN THEN
7289 CLOSE c_depends;
7290 END IF;
7291
7292 IF c_references%ISOPEN THEN
7293 CLOSE c_references;
7294 END IF;
7295
7296 IF c_dates%ISOPEN THEN
7297 CLOSE c_dates;
7298 END IF;
7299
7300 IF c_recurs%ISOPEN THEN
7301 CLOSE c_recurs;
7302 END IF;
7303
7304 IF c_rsc_reqs%ISOPEN THEN
7305 CLOSE c_rsc_reqs;
7306 END IF;
7307
7308 IF c_assignments%ISOPEN THEN
7309 CLOSE c_assignments;
7310 END IF;
7311
7312 IF c1_assignments%ISOPEN THEN
7313 CLOSE c1_assignments;
7314 END IF;
7315
7316 IF c_contacts%ISOPEN THEN
7317 CLOSE c_contacts;
7318 END IF;
7319
7320 IF c_notes%ISOPEN THEN
7321 CLOSE c_notes;
7322 END IF;
7323
7324 IF fnd_api.to_boolean(p_commit) THEN
7325 COMMIT WORK;
7326 END IF;
7327
7328 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7329 EXCEPTION
7330 WHEN fnd_api.g_exc_unexpected_error THEN
7331 ROLLBACK TO copy_task;
7332 x_return_status := fnd_api.g_ret_sts_unexp_error;
7333 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7334
7335 IF c_task%ISOPEN THEN
7336 CLOSE c_task;
7337 END IF;
7338
7339 IF c_depends%ISOPEN THEN
7340 CLOSE c_depends;
7341 END IF;
7342
7343 IF c_references%ISOPEN THEN
7344 CLOSE c_references;
7345 END IF;
7346
7347 IF c_dates%ISOPEN THEN
7348 CLOSE c_dates;
7349 END IF;
7350
7351 IF c_recurs%ISOPEN THEN
7352 CLOSE c_recurs;
7353 END IF;
7354
7355 IF c_rsc_reqs%ISOPEN THEN
7356 CLOSE c_rsc_reqs;
7357 END IF;
7358
7359 IF c_assignments%ISOPEN THEN
7360 CLOSE c_assignments;
7361 END IF;
7362
7363 IF c1_assignments%ISOPEN THEN
7364 CLOSE c1_assignments;
7365 END IF;
7366
7367 IF c_contacts%ISOPEN THEN
7368 CLOSE c_contacts;
7369 END IF;
7370
7371 IF c_notes%ISOPEN THEN
7372 CLOSE c_notes;
7373 END IF;
7374 WHEN OTHERS THEN
7375 ROLLBACK TO copy_task;
7376 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
7377 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
7378 x_return_status := fnd_api.g_ret_sts_unexp_error;
7379 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7380
7381 IF c_task%ISOPEN THEN
7382 CLOSE c_task;
7383 END IF;
7384
7385 IF c_depends%ISOPEN THEN
7386 CLOSE c_depends;
7387 END IF;
7388
7389 IF c_references%ISOPEN THEN
7390 CLOSE c_references;
7391 END IF;
7392
7393 IF c_dates%ISOPEN THEN
7394 CLOSE c_dates;
7395 END IF;
7396
7397 IF c_recurs%ISOPEN THEN
7398 CLOSE c_recurs;
7399 END IF;
7400
7401 IF c_rsc_reqs%ISOPEN THEN
7402 CLOSE c_rsc_reqs;
7403 END IF;
7404
7405 IF c_assignments%ISOPEN THEN
7406 CLOSE c_assignments;
7407 END IF;
7408
7409 IF c1_assignments%ISOPEN THEN
7410 CLOSE c1_assignments;
7411 END IF;
7412
7413 IF c_contacts%ISOPEN THEN
7414 CLOSE c_contacts;
7415 END IF;
7416
7417 IF c_notes%ISOPEN THEN
7418 CLOSE c_notes;
7419 END IF;
7420 END copy_task;
7421
7422 -- Temp Enh. Refactoring Template Code in create_task_from_template proc....
7423 PROCEDURE create_task_from_template(
7424 p_api_version IN NUMBER
7425 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
7426 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
7427 , p_task_template_group_id IN NUMBER DEFAULT NULL
7428 , p_task_template_group_name IN VARCHAR2 DEFAULT NULL
7429 , p_owner_type_code IN VARCHAR2 DEFAULT NULL
7430 , p_owner_id IN NUMBER DEFAULT NULL
7431 , p_source_object_id IN NUMBER DEFAULT NULL
7432 , p_source_object_name IN VARCHAR2 DEFAULT NULL
7433 , x_return_status OUT NOCOPY VARCHAR2
7434 , x_msg_count OUT NOCOPY NUMBER
7435 , x_msg_data OUT NOCOPY VARCHAR2
7436 , x_task_details_tbl OUT NOCOPY task_details_tbl
7437 , p_assigned_by_id IN NUMBER DEFAULT NULL
7438 , p_cust_account_id IN NUMBER DEFAULT NULL
7439 , p_customer_id IN NUMBER DEFAULT NULL
7440 , p_address_id IN NUMBER DEFAULT NULL
7441 , p_actual_start_date IN DATE DEFAULT NULL
7442 , p_actual_end_date IN DATE DEFAULT NULL
7443 , p_planned_start_date IN DATE DEFAULT NULL
7447 , p_palm_flag IN VARCHAR2 DEFAULT NULL
7444 , p_planned_end_date IN DATE DEFAULT NULL
7445 , p_scheduled_start_date IN DATE DEFAULT NULL
7446 , p_scheduled_end_date IN DATE DEFAULT NULL
7448 , p_wince_flag IN VARCHAR2 DEFAULT NULL
7449 , p_laptop_flag IN VARCHAR2 DEFAULT NULL
7450 , p_device1_flag IN VARCHAR2 DEFAULT NULL
7451 , p_device2_flag IN VARCHAR2 DEFAULT NULL
7452 , p_device3_flag IN VARCHAR2 DEFAULT NULL
7453 , p_parent_task_id IN NUMBER DEFAULT NULL
7454 , p_percentage_complete IN NUMBER DEFAULT NULL
7455 , p_timezone_id IN NUMBER DEFAULT NULL
7456 , p_actual_effort IN NUMBER DEFAULT NULL
7457 , p_actual_effort_uom IN VARCHAR2 DEFAULT NULL
7458 , p_reason_code IN VARCHAR2 DEFAULT NULL
7459 , p_bound_mode_code IN VARCHAR2 DEFAULT NULL
7460 , p_soft_bound_flag IN VARCHAR2 DEFAULT NULL
7461 , p_workflow_process_id IN NUMBER DEFAULT NULL
7462 , p_owner_territory_id IN NUMBER DEFAULT NULL
7463 , p_costs IN NUMBER DEFAULT NULL
7464 , p_currency_code IN VARCHAR2 DEFAULT NULL
7465 , p_attribute1 IN VARCHAR2 DEFAULT NULL
7466 , p_attribute2 IN VARCHAR2 DEFAULT NULL
7467 , p_attribute3 IN VARCHAR2 DEFAULT NULL
7468 , p_attribute4 IN VARCHAR2 DEFAULT NULL
7469 , p_attribute5 IN VARCHAR2 DEFAULT NULL
7470 , p_attribute6 IN VARCHAR2 DEFAULT NULL
7471 , p_attribute7 IN VARCHAR2 DEFAULT NULL
7472 , p_attribute8 IN VARCHAR2 DEFAULT NULL
7473 , p_attribute9 IN VARCHAR2 DEFAULT NULL
7474 , p_attribute10 IN VARCHAR2 DEFAULT NULL
7475 , p_attribute11 IN VARCHAR2 DEFAULT NULL
7476 , p_attribute12 IN VARCHAR2 DEFAULT NULL
7477 , p_attribute13 IN VARCHAR2 DEFAULT NULL
7478 , p_attribute14 IN VARCHAR2 DEFAULT NULL
7479 , p_attribute15 IN VARCHAR2 DEFAULT NULL
7480 , p_attribute_category IN VARCHAR2 DEFAULT NULL
7481 , p_date_selected IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
7482 ) IS
7483 l_api_version CONSTANT NUMBER := 1.0;
7484 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_TASK_FROM_TEMPLATE';
7485 BEGIN
7486 SAVEPOINT create_task_from_template_pub1;
7487 x_return_status := fnd_api.g_ret_sts_success;
7488
7489 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
7490 RAISE fnd_api.g_exc_unexpected_error;
7491 END IF;
7492
7493 IF fnd_api.to_boolean(p_init_msg_list) THEN
7494 fnd_msg_pub.initialize;
7495 END IF;
7496
7497 -- call new version, passing defaults for new functionality
7498 create_task_from_template(
7499 p_api_version => p_api_version
7500 , p_init_msg_list => p_init_msg_list
7501 , p_commit => fnd_api.g_false
7502 , p_task_template_group_id => p_task_template_group_id
7503 , p_task_template_group_name => p_task_template_group_name
7504 , p_owner_type_code => p_owner_type_code
7505 , p_owner_id => p_owner_id
7506 , p_source_object_id => p_source_object_id
7507 , p_source_object_name => p_source_object_name
7508 , x_return_status => x_return_status
7509 , x_msg_count => x_msg_count
7510 , x_msg_data => x_msg_data
7511 , x_task_details_tbl => x_task_details_tbl
7512 , p_assigned_by_id => p_assigned_by_id
7513 , p_cust_account_id => p_cust_account_id
7514 , p_customer_id => p_customer_id
7515 , p_address_id => p_address_id
7516 , p_actual_start_date => p_actual_start_date
7517 , p_actual_end_date => p_actual_end_date
7518 , p_planned_start_date => p_planned_start_date
7519 , p_planned_end_date => p_planned_end_date
7520 , p_scheduled_start_date => p_scheduled_start_date
7521 , p_scheduled_end_date => p_scheduled_end_date
7522 , p_palm_flag => p_palm_flag
7523 , p_wince_flag => p_wince_flag
7524 , p_laptop_flag => p_laptop_flag
7525 , p_device1_flag => p_device1_flag
7526 , p_device2_flag => p_device2_flag
7527 , p_device3_flag => p_device3_flag
7528 , p_parent_task_id => p_parent_task_id
7529 , p_percentage_complete => p_percentage_complete
7530 , p_timezone_id => p_timezone_id
7531 , p_actual_effort => p_actual_effort
7532 , p_actual_effort_uom => p_actual_effort_uom
7533 , p_reason_code => p_reason_code
7534 , p_bound_mode_code => p_bound_mode_code
7535 , p_soft_bound_flag => p_soft_bound_flag
7536 , p_workflow_process_id => p_workflow_process_id
7540 , p_attribute1 => p_attribute1
7537 , p_owner_territory_id => p_owner_territory_id
7538 , p_costs => p_costs
7539 , p_currency_code => p_currency_code
7541 , p_attribute2 => p_attribute2
7542 , p_attribute3 => p_attribute3
7543 , p_attribute4 => p_attribute4
7544 , p_attribute5 => p_attribute5
7545 , p_attribute6 => p_attribute6
7546 , p_attribute7 => p_attribute7
7547 , p_attribute8 => p_attribute8
7548 , p_attribute9 => p_attribute9
7549 , p_attribute10 => p_attribute10
7550 , p_attribute11 => p_attribute11
7551 , p_attribute12 => p_attribute12
7552 , p_attribute13 => p_attribute13
7553 , p_attribute14 => p_attribute14
7554 , p_attribute15 => p_attribute15
7555 , p_attribute_category => p_attribute_category
7556 , p_date_selected => p_date_selected
7557 , p_location_id => NULL
7558 );
7559
7560 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
7561 x_return_status := fnd_api.g_ret_sts_unexp_error;
7562 RAISE fnd_api.g_exc_unexpected_error;
7563 END IF;
7564
7565 IF fnd_api.to_boolean(p_commit) THEN
7566 COMMIT WORK;
7567 END IF;
7568
7569 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7570 EXCEPTION
7571 WHEN fnd_api.g_exc_unexpected_error THEN
7572 ROLLBACK TO create_task_from_template_pub1;
7573 x_return_status := fnd_api.g_ret_sts_unexp_error;
7574 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7575 WHEN OTHERS THEN
7576 ROLLBACK TO create_task_from_template_pub1;
7577 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
7578 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
7579 fnd_msg_pub.ADD;
7580 x_return_status := fnd_api.g_ret_sts_unexp_error;
7581 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7582 END;
7583
7584 -- New Version...
7585 PROCEDURE create_task_from_template(
7586 p_api_version IN NUMBER
7587 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
7588 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
7589 , p_task_template_group_id IN NUMBER DEFAULT NULL
7590 , p_task_template_group_name IN VARCHAR2 DEFAULT NULL
7591 , p_owner_type_code IN VARCHAR2 DEFAULT NULL
7592 , p_owner_id IN NUMBER DEFAULT NULL
7593 , p_source_object_id IN NUMBER DEFAULT NULL
7594 , p_source_object_name IN VARCHAR2 DEFAULT NULL
7595 , x_return_status OUT NOCOPY VARCHAR2
7596 , x_msg_count OUT NOCOPY NUMBER
7597 , x_msg_data OUT NOCOPY VARCHAR2
7598 , x_task_details_tbl OUT NOCOPY task_details_tbl
7599 , p_assigned_by_id IN NUMBER DEFAULT NULL
7600 , p_cust_account_id IN NUMBER DEFAULT NULL
7601 , p_customer_id IN NUMBER DEFAULT NULL
7602 , p_address_id IN NUMBER DEFAULT NULL
7603 , p_actual_start_date IN DATE DEFAULT NULL
7604 , p_actual_end_date IN DATE DEFAULT NULL
7605 , p_planned_start_date IN DATE DEFAULT NULL
7606 , p_planned_end_date IN DATE DEFAULT NULL
7607 , p_scheduled_start_date IN DATE DEFAULT NULL
7608 , p_scheduled_end_date IN DATE DEFAULT NULL
7609 , p_palm_flag IN VARCHAR2 DEFAULT NULL
7610 , p_wince_flag IN VARCHAR2 DEFAULT NULL
7611 , p_laptop_flag IN VARCHAR2 DEFAULT NULL
7612 , p_device1_flag IN VARCHAR2 DEFAULT NULL
7613 , p_device2_flag IN VARCHAR2 DEFAULT NULL
7614 , p_device3_flag IN VARCHAR2 DEFAULT NULL
7615 , p_parent_task_id IN NUMBER DEFAULT NULL
7616 , p_percentage_complete IN NUMBER DEFAULT NULL
7617 , p_timezone_id IN NUMBER DEFAULT NULL
7618 , p_actual_effort IN NUMBER DEFAULT NULL
7619 , p_actual_effort_uom IN VARCHAR2 DEFAULT NULL
7620 , p_reason_code IN VARCHAR2 DEFAULT NULL
7621 , p_bound_mode_code IN VARCHAR2 DEFAULT NULL
7622 , p_soft_bound_flag IN VARCHAR2 DEFAULT NULL
7623 , p_workflow_process_id IN NUMBER DEFAULT NULL
7624 , p_owner_territory_id IN NUMBER DEFAULT NULL
7625 , p_costs IN NUMBER DEFAULT NULL
7626 , p_currency_code IN VARCHAR2 DEFAULT NULL
7627 , p_attribute1 IN VARCHAR2 DEFAULT NULL
7628 , p_attribute2 IN VARCHAR2 DEFAULT NULL
7629 , p_attribute3 IN VARCHAR2 DEFAULT NULL
7630 , p_attribute4 IN VARCHAR2 DEFAULT NULL
7631 , p_attribute5 IN VARCHAR2 DEFAULT NULL
7632 , p_attribute6 IN VARCHAR2 DEFAULT NULL
7633 , p_attribute7 IN VARCHAR2 DEFAULT NULL
7634 , p_attribute8 IN VARCHAR2 DEFAULT NULL
7635 , p_attribute9 IN VARCHAR2 DEFAULT NULL
7636 , p_attribute10 IN VARCHAR2 DEFAULT NULL
7637 , p_attribute11 IN VARCHAR2 DEFAULT NULL
7638 , p_attribute12 IN VARCHAR2 DEFAULT NULL
7639 , p_attribute13 IN VARCHAR2 DEFAULT NULL
7640 , p_attribute14 IN VARCHAR2 DEFAULT NULL
7641 , p_attribute15 IN VARCHAR2 DEFAULT NULL
7642 , p_attribute_category IN VARCHAR2 DEFAULT NULL
7643 , p_date_selected IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
7644 , p_location_id IN NUMBER
7645 ) IS
7646 l_api_version CONSTANT NUMBER := 1.0;
7647 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_TASK_FROM_TEMPLATE';
7648 l_task_template_group_info jtf_task_inst_templates_pub.task_template_group_info;
7649 l_task_template_info_tbl jtf_task_inst_templates_pub.task_template_info_tbl;
7650 l_task_contact_points_tbl jtf_task_inst_templates_pub.task_contact_points_tbl;
7651 g_task_details_tbl jtf_task_inst_templates_pub.task_details_tbl;
7652 BEGIN
7653 SAVEPOINT create_task_from_template_pub; -- Fix Bug 2896377
7654 x_return_status := fnd_api.g_ret_sts_success;
7655
7656 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
7657 RAISE fnd_api.g_exc_unexpected_error;
7658 END IF;
7659
7660 IF fnd_api.to_boolean(p_init_msg_list) THEN
7661 fnd_msg_pub.initialize;
7662 END IF;
7663
7664 l_task_template_group_info.task_template_group_id := p_task_template_group_id;
7665 l_task_template_group_info.owner_type_code := p_owner_type_code;
7666 l_task_template_group_info.owner_id := p_owner_id;
7667 l_task_template_group_info.source_object_id := p_source_object_id;
7668 l_task_template_group_info.source_object_name := p_source_object_name;
7669 l_task_template_group_info.assigned_by_id := p_assigned_by_id;
7670 l_task_template_group_info.cust_account_id := p_cust_account_id;
7671 l_task_template_group_info.customer_id := p_customer_id;
7672 l_task_template_group_info.address_id := p_address_id;
7673 l_task_template_group_info.location_id := p_location_id;
7674 l_task_template_group_info.actual_start_date := p_actual_start_date;
7675 l_task_template_group_info.actual_end_date := p_actual_end_date;
7676 l_task_template_group_info.planned_start_date := p_planned_start_date;
7677 l_task_template_group_info.planned_end_date := p_planned_end_date;
7678 l_task_template_group_info.scheduled_start_date := p_scheduled_start_date;
7679 l_task_template_group_info.scheduled_end_date := p_scheduled_end_date;
7680 l_task_template_group_info.palm_flag := p_palm_flag;
7681 l_task_template_group_info.wince_flag := p_wince_flag;
7682 l_task_template_group_info.laptop_flag := p_laptop_flag;
7683 l_task_template_group_info.device1_flag := p_device1_flag;
7684 l_task_template_group_info.device2_flag := p_device2_flag;
7685 l_task_template_group_info.device3_flag := p_device3_flag;
7686 l_task_template_group_info.parent_task_id := p_parent_task_id;
7687 l_task_template_group_info.percentage_complete := p_percentage_complete;
7688 l_task_template_group_info.timezone_id := p_timezone_id;
7689 l_task_template_group_info.actual_effort := p_actual_effort;
7690 l_task_template_group_info.actual_effort_uom := p_actual_effort_uom;
7691 l_task_template_group_info.reason_code := p_reason_code;
7692 l_task_template_group_info.bound_mode_code := p_bound_mode_code;
7693 l_task_template_group_info.soft_bound_flag := p_soft_bound_flag;
7694 l_task_template_group_info.workflow_process_id := p_workflow_process_id;
7695 l_task_template_group_info.owner_territory_id := p_owner_territory_id;
7696 l_task_template_group_info.costs := p_costs;
7697 l_task_template_group_info.currency_code := p_currency_code;
7698 l_task_template_group_info.attribute1 := p_attribute1;
7699 l_task_template_group_info.attribute2 := p_attribute2;
7700 l_task_template_group_info.attribute3 := p_attribute3;
7701 l_task_template_group_info.attribute4 := p_attribute4;
7702 l_task_template_group_info.attribute5 := p_attribute5;
7703 l_task_template_group_info.attribute6 := p_attribute6;
7704 l_task_template_group_info.attribute7 := p_attribute7;
7705 l_task_template_group_info.attribute8 := p_attribute8;
7706 l_task_template_group_info.attribute9 := p_attribute9;
7707 l_task_template_group_info.attribute10 := p_attribute10;
7708 l_task_template_group_info.attribute11 := p_attribute11;
7709 l_task_template_group_info.attribute12 := p_attribute12;
7710 l_task_template_group_info.attribute13 := p_attribute13;
7711 l_task_template_group_info.attribute14 := p_attribute14;
7712 l_task_template_group_info.attribute15 := p_attribute15;
7713 l_task_template_group_info.attribute_category := p_attribute_category;
7714 l_task_template_group_info.date_selected := p_date_selected;
7715 jtf_task_inst_templates_pub.create_task_from_template
7716 (
7717 p_api_version => p_api_version
7718 , p_init_msg_list => p_init_msg_list
7719 , p_commit => p_commit
7720 , p_task_template_group_info => l_task_template_group_info
7721 , p_task_templates_tbl => l_task_template_info_tbl
7722 , p_task_contact_points_tbl => l_task_contact_points_tbl
7723 , x_return_status => x_return_status
7724 , x_msg_count => x_msg_count
7725 , x_msg_data => x_msg_data
7726 , x_task_details_tbl => g_task_details_tbl
7727 );
7728
7729 FOR i IN 1 .. g_task_details_tbl.COUNT LOOP
7730 x_task_details_tbl(i).task_id := g_task_details_tbl(i).task_id;
7731 x_task_details_tbl(i).task_template_id := g_task_details_tbl(i).task_template_id;
7732 NULL;
7733 END LOOP;
7734
7735 IF fnd_api.to_boolean(p_commit) THEN
7736 COMMIT WORK;
7737 END IF;
7738
7739 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7740 EXCEPTION
7741 WHEN fnd_api.g_exc_unexpected_error THEN
7742 ROLLBACK TO create_task_from_template_pub; -- Fix Bug 2896377
7743 x_return_status := fnd_api.g_ret_sts_unexp_error;
7744 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7745 WHEN OTHERS THEN
7746 ROLLBACK TO create_task_from_template_pub; -- Fix Bug 2896377
7747 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
7748 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
7749 fnd_msg_pub.ADD;
7750 x_return_status := fnd_api.g_ret_sts_unexp_error;
7751 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7752 END;
7753
7754 PROCEDURE lock_task(
7755 p_api_version IN NUMBER
7759 , p_object_version_number IN NUMBER
7756 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
7757 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
7758 , p_task_id IN NUMBER
7760 , x_return_status OUT NOCOPY VARCHAR2
7761 , x_msg_data OUT NOCOPY VARCHAR2
7762 , x_msg_count OUT NOCOPY NUMBER
7763 ) IS
7764 l_api_version CONSTANT NUMBER := 1.0;
7765 l_api_name CONSTANT VARCHAR2(30) := 'LOCK_TASK';
7766 resource_locked EXCEPTION;
7767 PRAGMA EXCEPTION_INIT(resource_locked, -54);
7768 BEGIN
7769 SAVEPOINT lock_tasks_pub;
7770 x_return_status := fnd_api.g_ret_sts_success;
7771
7772 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
7773 RAISE fnd_api.g_exc_unexpected_error;
7774 END IF;
7775
7776 IF fnd_api.to_boolean(p_init_msg_list) THEN
7777 fnd_msg_pub.initialize;
7778 END IF;
7779
7780 x_return_status := fnd_api.g_ret_sts_success;
7781 jtf_tasks_pkg.lock_row(x_task_id => p_task_id
7782 , x_object_version_number => p_object_version_number);
7783 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7784 EXCEPTION
7785 WHEN resource_locked THEN
7786 ROLLBACK TO lock_tasks_pub;
7787 fnd_message.set_name('JTF', 'JTF_TASK_RESOURCE_LOCKED');
7788 fnd_message.set_token('P_LOCKED_RESOURCE', 'Task');
7789 x_return_status := fnd_api.g_ret_sts_unexp_error;
7790 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7791 WHEN fnd_api.g_exc_unexpected_error THEN
7792 ROLLBACK TO lock_tasks_pub;
7793 x_return_status := fnd_api.g_ret_sts_unexp_error;
7794 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7795 WHEN OTHERS THEN
7796 ROLLBACK TO lock_tasks_pub;
7797 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
7798 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
7799 x_return_status := fnd_api.g_ret_sts_unexp_error;
7800 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7801 END;
7802
7803 ------
7804 ------ This procedure updates the Task record with the source object
7805 ------ details. In the update_task API the source object details are
7806 ------ not allowed to be udpated.
7807 ------
7808 PROCEDURE update_task_source(
7809 p_api_version IN NUMBER
7810 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
7811 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
7812 , p_object_version_number IN OUT NOCOPY NUMBER
7813 , p_task_id IN NUMBER
7814 , p_source_object_type_code IN VARCHAR2 DEFAULT NULL
7815 , p_source_object_id IN NUMBER DEFAULT NULL
7816 , p_source_object_name IN VARCHAR2 DEFAULT NULL
7817 , x_return_status OUT NOCOPY VARCHAR2
7818 , x_msg_count OUT NOCOPY NUMBER
7819 , x_msg_data OUT NOCOPY VARCHAR2
7820 ) IS
7821 l_api_version CONSTANT NUMBER := 1.0;
7822 l_api_name CONSTANT VARCHAR2(30) := 'UPDATE_TASK_SOURCE';
7823 l_task_id NUMBER;
7824 l_source_object_name jtf_tasks_b.source_object_name%TYPE;
7825 BEGIN
7826 SAVEPOINT update_task_source;
7827 x_return_status := fnd_api.g_ret_sts_success;
7828
7829 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
7830 RAISE fnd_api.g_exc_unexpected_error;
7831 END IF;
7832
7833 IF fnd_api.to_boolean(p_init_msg_list) THEN
7834 fnd_msg_pub.initialize;
7835 END IF;
7836
7837 -------
7838 ------- Check for truncation of source object name
7839 -------
7840 l_source_object_name := jtf_task_utl.check_truncation(p_object_name => p_source_object_name);
7841 -------
7842 ------- Validate source object details
7843 -------
7844 jtf_task_utl.validate_source_object(
7845 p_object_code => p_source_object_type_code
7846 , p_object_id => p_source_object_id
7847 , p_object_name => l_source_object_name
7848 , x_return_status => x_return_status
7849 );
7850
7851 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
7852 x_return_status := fnd_api.g_ret_sts_unexp_error;
7853 RAISE fnd_api.g_exc_unexpected_error;
7854 END IF;
7855
7856 ------
7857 ------ Update the Task record with the source object details
7858 ------
7859 jtf_tasks_pub.lock_task(
7860 p_api_version => 1.0
7861 , p_init_msg_list => fnd_api.g_false
7862 , p_commit => fnd_api.g_false
7863 , p_task_id => p_task_id
7864 , p_object_version_number => p_object_version_number
7865 , x_return_status => x_return_status
7866 , x_msg_data => x_msg_data
7867 , x_msg_count => x_msg_count
7868 );
7869
7870 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
7871 x_return_status := fnd_api.g_ret_sts_unexp_error;
7872 RAISE fnd_api.g_exc_unexpected_error;
7873 END IF;
7874
7875 p_object_version_number := p_object_version_number + 1;
7876
7877 /* jtf_tasks_pkg.update_row (
7878 x_task_id => p_task_id,
7879 x_object_version_number => p_object_version_number,
7880 x_source_object_type_code => l_source_object_type_code,
7881 x_source_object_id => l_source_object_id,
7882 x_source_object_name => l_source_object_name,
7886 );
7883 x_last_update_date => SYSDATE,
7884 x_last_updated_by => jtf_task_utl.updated_by,
7885 x_last_update_login => jtf_task_utl.login_id,
7887 */
7888 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
7889 x_return_status := fnd_api.g_ret_sts_unexp_error;
7890 RAISE fnd_api.g_exc_unexpected_error;
7891 END IF;
7892
7893 IF fnd_api.to_boolean(p_commit) THEN
7894 COMMIT WORK;
7895 END IF;
7896
7897 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7898 EXCEPTION
7899 WHEN fnd_api.g_exc_unexpected_error THEN
7900 ROLLBACK TO update_task_source;
7901 x_return_status := fnd_api.g_ret_sts_unexp_error;
7902 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7903 WHEN OTHERS THEN
7904 ROLLBACK TO update_task_source;
7905 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
7906 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
7907 x_return_status := fnd_api.g_ret_sts_unexp_error;
7908 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
7909 END;
7910
7911 -- Function to check parameter length and throw error if length not in allowed limit bug # 3182170 Start
7912 FUNCTION check_param_length(
7913 p_task_name IN VARCHAR2
7914 , p_message_name IN VARCHAR2 DEFAULT NULL
7915 , p_length IN NUMBER DEFAULT 80
7916 )
7917 RETURN VARCHAR2 IS
7918 BEGIN
7919 IF LENGTH(p_task_name) > p_length THEN
7920 fnd_message.set_name('JTF', p_message_name);
7921 fnd_msg_pub.ADD;
7922 RAISE fnd_api.g_exc_unexpected_error;
7923 ELSE
7924 RETURN p_task_name;
7925 END IF;
7926 END;
7927
7928 -- Function to check parameter length and throw error if length not in allowed limit bug # 3182170 End
7929 PROCEDURE delete_split_tasks(
7930 p_api_version IN NUMBER
7931 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
7932 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
7933 , p_object_version_number IN NUMBER
7934 , p_task_id IN NUMBER DEFAULT NULL
7935 , p_task_split_flag IN VARCHAR2 DEFAULT NULL
7936 , p_try_to_reconnect_flag IN VARCHAR2 DEFAULT 'N'
7937 , p_template_flag IN VARCHAR2 DEFAULT 'N'
7938 , x_return_status OUT NOCOPY VARCHAR2
7939 , x_msg_count OUT NOCOPY NUMBER
7940 , x_msg_data OUT NOCOPY VARCHAR2
7941 ) IS
7942 CURSOR c_task_info(i_task_id jtf_tasks_b.task_id%TYPE) IS
7943 SELECT a.task_id
7944 , b.object_version_number
7945 FROM jtf_task_depends a, jtf_tasks_b b
7946 WHERE a.task_id = i_task_id AND a.task_id = b.task_id
7947 AND b.task_split_flag = p_task_split_flag;
7948
7949 -- Cursor for finding all the tasks depend on the master task
7950 CURSOR c_mass_tasks_info IS
7951 SELECT task_id
7952 , dependent_on_task_id
7953 FROM jtf_task_depends
7954 START WITH dependent_on_task_id = p_task_id
7955 CONNECT BY PRIOR task_id = dependent_on_task_id;
7956
7957 -- changed the parameter name by SBARAT on 19/01/2006 for bug# 4888496
7958 CURSOR c_task_validate(p_task_id jtf_tasks_b.task_id%TYPE) IS
7959 SELECT object_version_number
7960 , task_split_flag
7961 FROM jtf_tasks_b
7962 WHERE task_id = p_task_id;
7963
7964 l_api_version CONSTANT NUMBER := 1.0;
7965 l_api_name CONSTANT VARCHAR2(30) := 'DELETE_SPLIT_TASKS';
7966 p_delete_future_recurrences VARCHAR2(1) := 'S';
7967 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
7968 l_msg_data VARCHAR2(2000);
7969 l_msg_count NUMBER;
7970 l_ovn NUMBER;
7971 l_task_info c_task_info%ROWTYPE;
7972 l_mass_tasks_info c_mass_tasks_info%ROWTYPE;
7973 l_task_id jtf_tasks_b.task_id%TYPE;
7974 task_val c_task_validate%ROWTYPE;
7975 BEGIN
7976 SAVEPOINT delete_split_tasks_pub;
7977 x_return_status := fnd_api.g_ret_sts_success;
7978
7979 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
7980 RAISE fnd_api.g_exc_unexpected_error;
7981 END IF;
7982
7983 IF fnd_api.to_boolean(p_init_msg_list) THEN
7984 fnd_msg_pub.initialize;
7985 END IF;
7986
7987 OPEN c_task_validate(p_task_id);
7988
7989 FETCH c_task_validate
7990 INTO task_val;
7991
7992 IF c_task_validate%NOTFOUND THEN
7993 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_TASK_ID');
7994 fnd_message.set_token('P_TASK_ID', p_task_id);
7995 fnd_msg_pub.ADD;
7996 RAISE fnd_api.g_exc_unexpected_error;
7997 END IF;
7998
7999 CLOSE c_task_validate;
8000
8001 IF (p_task_split_flag IS NULL) THEN
8002 fnd_message.set_name('JTF', 'JTF_TASK_SPLIT_FLAG_NULL');
8003 fnd_msg_pub.ADD;
8004 RAISE fnd_api.g_exc_unexpected_error;
8005 END IF;
8006
8007 IF (task_val.task_split_flag IS NULL) THEN
8008 fnd_message.set_name('JTF', 'JTF_TASK_SPLIT_FLAG_NOT_EXIST');
8009 fnd_msg_pub.ADD;
8010 RAISE fnd_api.g_exc_unexpected_error;
8011 END IF;
8012
8013 IF (task_val.task_split_flag <> 'D' OR task_val.task_split_flag <> 'M') THEN
8014 fnd_message.set_name('JTF', 'JTF_TASK_SPLIT_FLAG_NOT_VALID');
8015 fnd_message.set_token('P_TASK_ID', p_task_id);
8016 fnd_message.set_token('P_TASK_SPLIT_FLAG', task_val.task_split_flag);
8017 fnd_msg_pub.ADD;
8021 IF (task_val.task_split_flag <> p_task_split_flag) THEN
8018 RAISE fnd_api.g_exc_unexpected_error;
8019 END IF;
8020
8022 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_SPLIT_FLAG');
8023 fnd_message.set_token('P_TASK_SPLIT_FLAG', p_task_split_flag);
8024 fnd_message.set_token('P_TASK_ID', p_task_id);
8025 fnd_msg_pub.ADD;
8026 RAISE fnd_api.g_exc_unexpected_error;
8027 END IF;
8028
8029 IF (p_task_split_flag = 'D') THEN
8030 -- find all the tasks depend on the specific task
8031 OPEN c_task_info(p_task_id);
8032
8033 FETCH c_task_info
8034 INTO l_task_info;
8035
8036 IF c_task_info%NOTFOUND THEN
8037 RETURN;
8038 END IF;
8039
8040 CLOSE c_task_info;
8041
8042 -- if try_to_reconnect_flag is 'Y', reconnect dependencies then delete task.
8043 -- if try_to_reconnect_flag is 'N', just delete task.
8044 IF (p_try_to_reconnect_flag = 'Y') THEN
8045 jtf_task_dependency_pvt.reconnect_dependency(
8046 p_api_version => 1.0
8047 , p_init_msg_list => fnd_api.g_false
8048 , p_commit => fnd_api.g_false
8049 , p_task_id => l_task_info.task_id
8050 , p_template_flag => p_template_flag
8051 , x_return_status => x_return_status
8052 , x_msg_data => x_msg_data
8053 , x_msg_count => x_msg_count
8054 );
8055 END IF;
8056
8057 jtf_tasks_pvt.delete_task(
8058 p_api_version => 1.0
8059 , p_init_msg_list => fnd_api.g_false
8060 , p_commit => fnd_api.g_false
8061 , p_object_version_number => l_task_info.object_version_number
8062 , p_task_id => l_task_info.task_id
8063 , p_delete_future_recurrences => p_delete_future_recurrences
8064 , x_return_status => x_return_status
8065 , x_msg_count => x_msg_count
8066 , x_msg_data => x_msg_data
8067 );
8068 -- if task_split_flag is 'M'
8069 ELSIF(p_task_split_flag = 'M') THEN
8070 FOR l_mass_tasks_info IN c_mass_tasks_info LOOP
8071 OPEN c_task_validate(l_mass_tasks_info.dependent_on_task_id);
8072
8073 FETCH c_task_validate
8074 INTO task_val;
8075
8076 CLOSE c_task_validate;
8077
8078 IF (task_val.object_version_number IS NOT NULL) THEN
8079 jtf_tasks_pvt.delete_task(
8080 p_api_version => 1.0
8081 , p_init_msg_list => fnd_api.g_false
8082 , p_commit => fnd_api.g_false
8083 , p_object_version_number => task_val.object_version_number
8084 , p_task_id => l_mass_tasks_info.dependent_on_task_id
8085 , x_return_status => x_return_status
8086 , x_msg_count => x_msg_count
8087 , x_msg_data => x_msg_data
8088 );
8089
8090 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
8091 x_return_status := fnd_api.g_ret_sts_unexp_error;
8092 RAISE fnd_api.g_exc_unexpected_error;
8093 END IF;
8094 END IF;
8095
8096 OPEN c_task_validate(l_mass_tasks_info.task_id);
8097
8098 FETCH c_task_validate
8099 INTO task_val;
8100
8101 CLOSE c_task_validate;
8102
8103 IF (task_val.object_version_number IS NOT NULL) THEN
8104 jtf_tasks_pvt.delete_task(
8105 p_api_version => 1.0
8106 , p_init_msg_list => fnd_api.g_false
8107 , p_commit => fnd_api.g_false
8108 , p_object_version_number => task_val.object_version_number
8109 , p_task_id => l_mass_tasks_info.task_id
8110 , x_return_status => x_return_status
8111 , x_msg_count => x_msg_count
8112 , x_msg_data => x_msg_data
8113 );
8114
8115 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
8116 x_return_status := fnd_api.g_ret_sts_unexp_error;
8117 RAISE fnd_api.g_exc_unexpected_error;
8118 END IF;
8119 END IF;
8120 END LOOP;
8121
8122 IF fnd_api.to_boolean(p_commit) THEN
8123 COMMIT WORK;
8124 END IF;
8125
8126 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
8127 END IF;
8128 EXCEPTION
8129 WHEN fnd_api.g_exc_unexpected_error THEN
8130 ROLLBACK TO delete_split_tasks_pub;
8131 x_return_status := fnd_api.g_ret_sts_unexp_error;
8132 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
8133 WHEN OTHERS THEN
8134 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
8135 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
8136 fnd_msg_pub.ADD;
8137 ROLLBACK TO delete_split_tasks_pub;
8138 x_return_status := fnd_api.g_ret_sts_unexp_error;
8139 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
8140 END;
8141 END;