[Home] [Help]
PACKAGE BODY: APPS.JTF_TASKS_PVT
Source
1 PACKAGE BODY jtf_tasks_pvt AS
2 /* $Header: jtfvtktb.pls 120.18.12010000.2 2008/09/08 06:28:58 lokumar ship $ */
3 g_pkg_name CONSTANT VARCHAR2(30) := 'JTF_TASKS_PVT';
4 g_entity CONSTANT jtf_tasks_b.entity%TYPE := 'TASK';
5 g_free_busy_type CONSTANT jtf_task_all_assignments.free_busy_type%TYPE := 'FREE';
6 v_select VARCHAR2(6000);
7 -- table for query_task
8 v_tbl jtf_tasks_pub.task_table_type;
9 -- table for query_task
10 v_n_tbl jtf_tasks_pub.task_table_type;
11
12 -- original version to call the new version which has a workflow enhancement
13 PROCEDURE create_task(
14 p_api_version IN NUMBER
15 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
16 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
17 , p_task_id IN NUMBER DEFAULT NULL
18 , p_task_name IN VARCHAR2
19 , p_task_type_id IN NUMBER DEFAULT NULL
20 , p_description IN VARCHAR2 DEFAULT NULL
21 , p_task_status_id IN NUMBER DEFAULT NULL
22 , p_task_priority_id IN NUMBER DEFAULT NULL
23 , p_owner_type_code IN VARCHAR2 DEFAULT NULL
24 , p_owner_id IN NUMBER DEFAULT NULL
25 , p_owner_territory_id IN NUMBER DEFAULT NULL
26 , p_assigned_by_id IN NUMBER DEFAULT NULL
27 , p_customer_id IN NUMBER DEFAULT NULL
28 , p_cust_account_id IN NUMBER DEFAULT NULL
29 , p_address_id IN NUMBER DEFAULT NULL
30 , ---- hz_party_sites
31 p_planned_start_date IN DATE DEFAULT NULL
32 , p_planned_end_date IN DATE DEFAULT NULL
33 , p_scheduled_start_date IN DATE DEFAULT NULL
34 , p_scheduled_end_date IN DATE DEFAULT NULL
35 , p_actual_start_date IN DATE DEFAULT NULL
36 , p_actual_end_date IN DATE DEFAULT NULL
37 , p_timezone_id IN NUMBER DEFAULT NULL
38 , p_source_object_type_code IN VARCHAR2 DEFAULT NULL
39 , p_source_object_id IN NUMBER DEFAULT NULL
40 , p_source_object_name IN VARCHAR2 DEFAULT NULL
41 , p_duration IN NUMBER DEFAULT NULL
42 , p_duration_uom IN VARCHAR2 DEFAULT NULL
43 , p_planned_effort IN NUMBER DEFAULT NULL
44 , p_planned_effort_uom IN VARCHAR2 DEFAULT NULL
45 , p_actual_effort IN NUMBER DEFAULT NULL
46 , p_actual_effort_uom IN VARCHAR2 DEFAULT NULL
47 , p_percentage_complete IN NUMBER DEFAULT NULL
48 , p_reason_code IN VARCHAR2 DEFAULT NULL
49 , p_private_flag IN VARCHAR2 DEFAULT NULL
50 , p_publish_flag IN VARCHAR2 DEFAULT NULL
51 , p_restrict_closure_flag IN VARCHAR2 DEFAULT NULL
52 , p_multi_booked_flag IN VARCHAR2 DEFAULT NULL
53 , p_milestone_flag IN VARCHAR2 DEFAULT NULL
54 , p_holiday_flag IN VARCHAR2 DEFAULT NULL
55 , p_billable_flag IN VARCHAR2 DEFAULT NULL
56 , p_bound_mode_code IN VARCHAR2 DEFAULT NULL
57 , p_soft_bound_flag IN VARCHAR2 DEFAULT NULL
58 , p_workflow_process_id IN NUMBER DEFAULT NULL
59 , p_notification_flag IN VARCHAR2 DEFAULT NULL
60 , p_notification_period IN NUMBER DEFAULT NULL
61 , p_notification_period_uom IN VARCHAR2 DEFAULT NULL
62 , p_parent_task_id IN NUMBER DEFAULT NULL
63 , p_alarm_start IN NUMBER DEFAULT NULL
64 , p_alarm_start_uom IN VARCHAR2 DEFAULT NULL
65 , p_alarm_on IN VARCHAR2 DEFAULT NULL
66 , p_alarm_count IN NUMBER DEFAULT NULL
67 , p_alarm_interval IN NUMBER DEFAULT NULL
68 , p_alarm_interval_uom IN VARCHAR2 DEFAULT NULL
69 , p_palm_flag IN VARCHAR2 DEFAULT NULL
70 , p_wince_flag IN VARCHAR2 DEFAULT NULL
71 , p_laptop_flag IN VARCHAR2 DEFAULT NULL
72 , p_device1_flag IN VARCHAR2 DEFAULT NULL
73 , p_device2_flag IN VARCHAR2 DEFAULT NULL
74 , p_device3_flag IN VARCHAR2 DEFAULT NULL
75 , p_costs IN NUMBER DEFAULT NULL
76 , p_currency_code IN VARCHAR2 DEFAULT NULL
77 , p_escalation_level IN VARCHAR2 DEFAULT NULL
78 , x_return_status OUT NOCOPY VARCHAR2
79 , x_msg_count OUT NOCOPY NUMBER
80 , x_msg_data OUT NOCOPY VARCHAR2
81 , x_task_id OUT NOCOPY NUMBER
82 , p_attribute1 IN VARCHAR2 DEFAULT NULL
83 , p_attribute2 IN VARCHAR2 DEFAULT NULL
84 , p_attribute3 IN VARCHAR2 DEFAULT NULL
85 , p_attribute4 IN VARCHAR2 DEFAULT NULL
86 , p_attribute5 IN VARCHAR2 DEFAULT NULL
87 , p_attribute6 IN VARCHAR2 DEFAULT NULL
88 , p_attribute7 IN VARCHAR2 DEFAULT NULL
89 , p_attribute8 IN VARCHAR2 DEFAULT NULL
90 , p_attribute9 IN VARCHAR2 DEFAULT NULL
91 , p_attribute10 IN VARCHAR2 DEFAULT NULL
92 , p_attribute11 IN VARCHAR2 DEFAULT NULL
93 , p_attribute12 IN VARCHAR2 DEFAULT NULL
94 , p_attribute13 IN VARCHAR2 DEFAULT NULL
95 , p_attribute14 IN VARCHAR2 DEFAULT NULL
96 , p_attribute15 IN VARCHAR2 DEFAULT NULL
97 , p_attribute_category IN VARCHAR2 DEFAULT NULL
98 , p_date_selected IN VARCHAR2 DEFAULT NULL
99 , p_category_id IN NUMBER DEFAULT NULL
100 , p_show_on_calendar IN VARCHAR2 DEFAULT NULL
101 , p_owner_status_id IN NUMBER DEFAULT NULL
102 , p_template_id IN NUMBER DEFAULT NULL
103 , p_template_group_id IN NUMBER DEFAULT NULL
104 ) IS
105 l_api_version CONSTANT NUMBER := 1.0;
106 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_TASK';
107 BEGIN
108 SAVEPOINT create_task_pvt2;
109 x_return_status := fnd_api.g_ret_sts_success;
110
111 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
112 RAISE fnd_api.g_exc_unexpected_error;
113 END IF;
114
115 IF fnd_api.to_boolean(p_init_msg_list) THEN
116 fnd_msg_pub.initialize;
117 END IF;
118
119 -- call new version, passing defaults for new functionality
120 create_task(
121 p_api_version => p_api_version
122 , p_init_msg_list => p_init_msg_list
123 , p_commit => fnd_api.g_false
124 , p_task_id => p_task_id
125 , p_task_name => p_task_name
126 , p_task_type_id => p_task_type_id
127 , p_description => p_description
128 , p_task_status_id => p_task_status_id
129 , p_task_priority_id => p_task_priority_id
130 , p_owner_type_code => p_owner_type_code
131 , p_owner_id => p_owner_id
132 , p_owner_territory_id => p_owner_territory_id
133 , p_assigned_by_id => p_assigned_by_id
134 , p_customer_id => p_customer_id
135 , p_cust_account_id => p_cust_account_id
136 , p_address_id => p_address_id
137 , p_planned_start_date => p_planned_start_date
138 , p_planned_end_date => p_planned_end_date
139 , p_scheduled_start_date => p_scheduled_start_date
140 , p_scheduled_end_date => p_scheduled_end_date
141 , p_actual_start_date => p_actual_start_date
142 , p_actual_end_date => p_actual_end_date
143 , p_timezone_id => p_timezone_id
144 , p_source_object_type_code => p_source_object_type_code
145 , p_source_object_id => p_source_object_id
146 , p_source_object_name => p_source_object_name
147 , p_duration => p_duration
148 , p_duration_uom => p_duration_uom
149 , p_planned_effort => p_planned_effort
150 , p_planned_effort_uom => p_planned_effort_uom
151 , p_actual_effort => p_actual_effort
152 , p_actual_effort_uom => p_actual_effort_uom
153 , p_percentage_complete => p_percentage_complete
154 , p_reason_code => p_reason_code
155 , p_private_flag => p_private_flag
156 , p_publish_flag => p_publish_flag
157 , p_restrict_closure_flag => p_restrict_closure_flag
158 , p_multi_booked_flag => p_multi_booked_flag
159 , p_milestone_flag => p_milestone_flag
160 , p_holiday_flag => p_holiday_flag
161 , p_billable_flag => p_billable_flag
162 , p_bound_mode_code => p_bound_mode_code
163 , p_soft_bound_flag => p_soft_bound_flag
164 , p_workflow_process_id => p_workflow_process_id
165 , p_notification_flag => p_notification_flag
166 , p_notification_period => p_notification_period
167 , p_notification_period_uom => p_notification_period_uom
168 , p_parent_task_id => p_parent_task_id
169 , p_alarm_start => p_alarm_start
170 , p_alarm_start_uom => p_alarm_start_uom
171 , p_alarm_on => p_alarm_on
172 , p_alarm_count => p_alarm_count
173 , p_alarm_interval => p_alarm_interval
174 , p_alarm_interval_uom => p_alarm_interval_uom
175 , p_palm_flag => p_palm_flag
176 , p_wince_flag => p_wince_flag
177 , p_laptop_flag => p_laptop_flag
178 , p_device1_flag => p_device1_flag
179 , p_device2_flag => p_device2_flag
180 , p_device3_flag => p_device3_flag
181 , p_costs => p_costs
182 , p_currency_code => p_currency_code
183 , p_escalation_level => p_escalation_level
184 , x_return_status => x_return_status
185 , x_msg_count => x_msg_count
186 , x_msg_data => x_msg_data
187 , x_task_id => x_task_id
188 , p_attribute1 => p_attribute1
189 , p_attribute2 => p_attribute2
190 , p_attribute3 => p_attribute3
191 , p_attribute4 => p_attribute4
192 , p_attribute5 => p_attribute5
193 , p_attribute6 => p_attribute6
194 , p_attribute7 => p_attribute7
195 , p_attribute8 => p_attribute8
196 , p_attribute9 => p_attribute9
197 , p_attribute10 => p_attribute10
198 , p_attribute11 => p_attribute11
199 , p_attribute12 => p_attribute12
200 , p_attribute13 => p_attribute13
201 , p_attribute14 => p_attribute14
202 , p_attribute15 => p_attribute15
203 , p_attribute_category => p_attribute_category
204 , p_date_selected => p_date_selected
205 , p_category_id => p_category_id
206 , p_show_on_calendar => p_show_on_calendar
207 , p_owner_status_id => p_owner_status_id
208 , p_template_id => p_template_id
209 , p_template_group_id => p_template_group_id
210 , p_enable_workflow => fnd_profile.VALUE('JTF_TASK_ENABLE_WORKFLOW')
211 , p_abort_workflow => fnd_profile.VALUE('JTF_TASK_ABORT_PREV_WF')
212 , p_entity => g_entity
213 , p_free_busy_type => NULL
214 , p_task_confirmation_status => 'N'
215 , p_task_confirmation_counter => NULL
216 , p_task_split_flag => NULL
217 , p_reference_flag => NULL
218 , p_child_position => NULL
219 , p_child_sequence_num => NULL
220 );
221
222 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
223 x_return_status := fnd_api.g_ret_sts_unexp_error;
224 RAISE fnd_api.g_exc_unexpected_error;
225 END IF;
226
227 IF fnd_api.to_boolean(p_commit) THEN
228 COMMIT WORK;
229 END IF;
230
231 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
232 EXCEPTION
233 WHEN fnd_api.g_exc_unexpected_error THEN
234 ROLLBACK TO create_task_pvt2;
235 x_return_status := fnd_api.g_ret_sts_unexp_error;
236 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
237 WHEN OTHERS THEN
238 ROLLBACK TO create_task_pvt2;
239 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
240 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
241 fnd_msg_pub.ADD;
242 x_return_status := fnd_api.g_ret_sts_unexp_error;
243 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
244 END;
245
246 -- new version which has a workflow enhancement
247 PROCEDURE create_task(
248 p_api_version IN NUMBER
249 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
250 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
251 , p_task_id IN NUMBER DEFAULT NULL
252 , p_task_name IN VARCHAR2
253 , p_task_type_id IN NUMBER DEFAULT NULL
254 , p_description IN VARCHAR2 DEFAULT NULL
255 , p_task_status_id IN NUMBER DEFAULT NULL
256 , p_task_priority_id IN NUMBER DEFAULT NULL
257 , p_owner_type_code IN VARCHAR2 DEFAULT NULL
258 , p_owner_id IN NUMBER DEFAULT NULL
259 , p_owner_territory_id IN NUMBER DEFAULT NULL
260 , p_assigned_by_id IN NUMBER DEFAULT NULL
261 , p_customer_id IN NUMBER DEFAULT NULL
262 , p_cust_account_id IN NUMBER DEFAULT NULL
263 , p_address_id IN NUMBER DEFAULT NULL
264 , ---- hz_party_sites
265 p_planned_start_date IN DATE DEFAULT NULL
266 , p_planned_end_date IN DATE DEFAULT NULL
267 , p_scheduled_start_date IN DATE DEFAULT NULL
268 , p_scheduled_end_date IN DATE DEFAULT NULL
269 , p_actual_start_date IN DATE DEFAULT NULL
270 , p_actual_end_date IN DATE DEFAULT NULL
271 , p_timezone_id IN NUMBER DEFAULT NULL
272 , p_source_object_type_code IN VARCHAR2 DEFAULT NULL
273 , p_source_object_id IN NUMBER DEFAULT NULL
274 , p_source_object_name IN VARCHAR2 DEFAULT NULL
275 , p_duration IN NUMBER DEFAULT NULL
276 , p_duration_uom IN VARCHAR2 DEFAULT NULL
277 , p_planned_effort IN NUMBER DEFAULT NULL
278 , p_planned_effort_uom IN VARCHAR2 DEFAULT NULL
279 , p_actual_effort IN NUMBER DEFAULT NULL
280 , p_actual_effort_uom IN VARCHAR2 DEFAULT NULL
281 , p_percentage_complete IN NUMBER DEFAULT NULL
282 , p_reason_code IN VARCHAR2 DEFAULT NULL
283 , p_private_flag IN VARCHAR2 DEFAULT NULL
284 , p_publish_flag IN VARCHAR2 DEFAULT NULL
285 , p_restrict_closure_flag IN VARCHAR2 DEFAULT NULL
286 , p_multi_booked_flag IN VARCHAR2 DEFAULT NULL
287 , p_milestone_flag IN VARCHAR2 DEFAULT NULL
288 , p_holiday_flag IN VARCHAR2 DEFAULT NULL
289 , p_billable_flag IN VARCHAR2 DEFAULT NULL
290 , p_bound_mode_code IN VARCHAR2 DEFAULT NULL
291 , p_soft_bound_flag IN VARCHAR2 DEFAULT NULL
292 , p_workflow_process_id IN NUMBER DEFAULT NULL
293 , p_notification_flag IN VARCHAR2 DEFAULT NULL
294 , p_notification_period IN NUMBER DEFAULT NULL
295 , p_notification_period_uom IN VARCHAR2 DEFAULT NULL
296 , p_parent_task_id IN NUMBER DEFAULT NULL
297 , p_alarm_start IN NUMBER DEFAULT NULL
298 , p_alarm_start_uom IN VARCHAR2 DEFAULT NULL
299 , p_alarm_on IN VARCHAR2 DEFAULT NULL
300 , p_alarm_count IN NUMBER DEFAULT NULL
301 , p_alarm_interval IN NUMBER DEFAULT NULL
302 , p_alarm_interval_uom IN VARCHAR2 DEFAULT NULL
303 , p_palm_flag IN VARCHAR2 DEFAULT NULL
304 , p_wince_flag IN VARCHAR2 DEFAULT NULL
305 , p_laptop_flag IN VARCHAR2 DEFAULT NULL
306 , p_device1_flag IN VARCHAR2 DEFAULT NULL
307 , p_device2_flag IN VARCHAR2 DEFAULT NULL
308 , p_device3_flag IN VARCHAR2 DEFAULT NULL
309 , p_costs IN NUMBER DEFAULT NULL
310 , p_currency_code IN VARCHAR2 DEFAULT NULL
311 , p_escalation_level IN VARCHAR2 DEFAULT NULL
312 , x_return_status OUT NOCOPY VARCHAR2
313 , x_msg_count OUT NOCOPY NUMBER
314 , x_msg_data OUT NOCOPY VARCHAR2
315 , x_task_id OUT NOCOPY NUMBER
316 , p_attribute1 IN VARCHAR2 DEFAULT NULL
317 , p_attribute2 IN VARCHAR2 DEFAULT NULL
318 , p_attribute3 IN VARCHAR2 DEFAULT NULL
319 , p_attribute4 IN VARCHAR2 DEFAULT NULL
320 , p_attribute5 IN VARCHAR2 DEFAULT NULL
321 , p_attribute6 IN VARCHAR2 DEFAULT NULL
322 , p_attribute7 IN VARCHAR2 DEFAULT NULL
323 , p_attribute8 IN VARCHAR2 DEFAULT NULL
324 , p_attribute9 IN VARCHAR2 DEFAULT NULL
325 , p_attribute10 IN VARCHAR2 DEFAULT NULL
326 , p_attribute11 IN VARCHAR2 DEFAULT NULL
327 , p_attribute12 IN VARCHAR2 DEFAULT NULL
328 , p_attribute13 IN VARCHAR2 DEFAULT NULL
329 , p_attribute14 IN VARCHAR2 DEFAULT NULL
330 , p_attribute15 IN VARCHAR2 DEFAULT NULL
331 , p_attribute_category IN VARCHAR2 DEFAULT NULL
332 , p_date_selected IN VARCHAR2 DEFAULT NULL
333 , p_category_id IN NUMBER DEFAULT NULL
334 , p_show_on_calendar IN VARCHAR2 DEFAULT NULL
335 , p_owner_status_id IN NUMBER DEFAULT NULL
336 , p_template_id IN NUMBER DEFAULT NULL
337 , p_template_group_id IN NUMBER DEFAULT NULL
338 , p_enable_workflow IN VARCHAR2
339 , p_abort_workflow IN VARCHAR2
340 ) IS
341 l_api_version CONSTANT NUMBER := 1.0;
342 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_TASK';
343 BEGIN
344 SAVEPOINT create_task_pvt3;
345 x_return_status := fnd_api.g_ret_sts_success;
346
347 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
348 RAISE fnd_api.g_exc_unexpected_error;
349 END IF;
350
351 IF fnd_api.to_boolean(p_init_msg_list) THEN
352 fnd_msg_pub.initialize;
353 END IF;
354
355 -- call new version, passing defaults for new functionality
356 create_task(
357 p_api_version => p_api_version
358 , p_init_msg_list => p_init_msg_list
359 ,
360 -- passing FALSE so we can commit after processing the table parameters
361 p_commit => fnd_api.g_false
362 , p_task_id => p_task_id
363 , p_task_name => p_task_name
364 , p_task_type_id => p_task_type_id
365 , p_description => p_description
366 , p_task_status_id => p_task_status_id
367 , p_task_priority_id => p_task_priority_id
368 , p_owner_type_code => p_owner_type_code
369 , p_owner_id => p_owner_id
370 , p_owner_territory_id => p_owner_territory_id
371 , p_assigned_by_id => p_assigned_by_id
372 , p_customer_id => p_customer_id
373 , p_cust_account_id => p_cust_account_id
374 , p_address_id => p_address_id
375 , p_planned_start_date => p_planned_start_date
376 , p_planned_end_date => p_planned_end_date
377 , p_scheduled_start_date => p_scheduled_start_date
378 , p_scheduled_end_date => p_scheduled_end_date
379 , p_actual_start_date => p_actual_start_date
380 , p_actual_end_date => p_actual_end_date
381 , p_timezone_id => p_timezone_id
382 , p_source_object_type_code => p_source_object_type_code
383 , p_source_object_id => p_source_object_id
384 , p_source_object_name => p_source_object_name
385 , p_duration => p_duration
386 , p_duration_uom => p_duration_uom
387 , p_planned_effort => p_planned_effort
388 , p_planned_effort_uom => p_planned_effort_uom
389 , p_actual_effort => p_actual_effort
390 , p_actual_effort_uom => p_actual_effort_uom
391 , p_percentage_complete => p_percentage_complete
392 , p_reason_code => p_reason_code
393 , p_private_flag => p_private_flag
394 , p_publish_flag => p_publish_flag
395 , p_restrict_closure_flag => p_restrict_closure_flag
396 , p_multi_booked_flag => p_multi_booked_flag
397 , p_milestone_flag => p_milestone_flag
398 , p_holiday_flag => p_holiday_flag
399 , p_billable_flag => p_billable_flag
400 , p_bound_mode_code => p_bound_mode_code
401 , p_soft_bound_flag => p_soft_bound_flag
402 , p_workflow_process_id => p_workflow_process_id
403 , p_notification_flag => p_notification_flag
404 , p_notification_period => p_notification_period
405 , p_notification_period_uom => p_notification_period_uom
406 , p_parent_task_id => p_parent_task_id
407 , p_alarm_start => p_alarm_start
408 , p_alarm_start_uom => p_alarm_start_uom
409 , p_alarm_on => p_alarm_on
410 , p_alarm_count => p_alarm_count
411 , p_alarm_interval => p_alarm_interval
412 , p_alarm_interval_uom => p_alarm_interval_uom
413 , p_palm_flag => p_palm_flag
414 , p_wince_flag => p_wince_flag
415 , p_laptop_flag => p_laptop_flag
416 , p_device1_flag => p_device1_flag
417 , p_device2_flag => p_device2_flag
418 , p_device3_flag => p_device3_flag
419 , p_costs => p_costs
420 , p_currency_code => p_currency_code
421 , p_escalation_level => p_escalation_level
422 , x_return_status => x_return_status
423 , x_msg_count => x_msg_count
424 , x_msg_data => x_msg_data
425 , x_task_id => x_task_id
426 , p_attribute1 => p_attribute1
427 , p_attribute2 => p_attribute2
428 , p_attribute3 => p_attribute3
429 , p_attribute4 => p_attribute4
430 , p_attribute5 => p_attribute5
431 , p_attribute6 => p_attribute6
432 , p_attribute7 => p_attribute7
433 , p_attribute8 => p_attribute8
434 , p_attribute9 => p_attribute9
435 , p_attribute10 => p_attribute10
436 , p_attribute11 => p_attribute11
437 , p_attribute12 => p_attribute12
438 , p_attribute13 => p_attribute13
439 , p_attribute14 => p_attribute14
440 , p_attribute15 => p_attribute15
441 , p_attribute_category => p_attribute_category
442 , p_date_selected => p_date_selected
443 , p_category_id => p_category_id
444 , p_show_on_calendar => p_show_on_calendar
445 , p_owner_status_id => p_owner_status_id
446 , p_template_id => p_template_id
447 , p_template_group_id => p_template_group_id
448 , p_enable_workflow => p_enable_workflow
449 , p_abort_workflow => p_abort_workflow
450 , p_entity => g_entity
451 , p_free_busy_type => NULL
452 , p_task_confirmation_status => 'N'
453 , p_task_confirmation_counter => NULL
454 , p_task_split_flag => NULL
455 , p_reference_flag => NULL
456 , p_child_position => NULL
457 , p_child_sequence_num => NULL
458 );
459
460 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
461 x_return_status := fnd_api.g_ret_sts_unexp_error;
462 RAISE fnd_api.g_exc_unexpected_error;
463 END IF;
464
465 IF fnd_api.to_boolean(p_commit) THEN
466 COMMIT WORK;
467 END IF;
468
469 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
470 EXCEPTION
471 WHEN fnd_api.g_exc_unexpected_error THEN
472 ROLLBACK TO create_task_pvt3;
473 x_return_status := fnd_api.g_ret_sts_unexp_error;
474 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
475 WHEN OTHERS THEN
476 ROLLBACK TO create_task_pvt3;
477 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
478 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
479 fnd_msg_pub.ADD;
480 x_return_status := fnd_api.g_ret_sts_unexp_error;
481 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
482 END;
483
484 -- overloaded version to add p_entity and p_free_busy_type..
485 PROCEDURE create_task(
486 p_api_version IN NUMBER
487 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
488 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
489 , p_task_id IN NUMBER DEFAULT NULL
490 , p_task_name IN VARCHAR2
491 , p_task_type_id IN NUMBER DEFAULT NULL
492 , p_description IN VARCHAR2 DEFAULT NULL
493 , p_task_status_id IN NUMBER DEFAULT NULL
494 , p_task_priority_id IN NUMBER DEFAULT NULL
495 , p_owner_type_code IN VARCHAR2 DEFAULT NULL
496 , p_owner_id IN NUMBER DEFAULT NULL
497 , p_owner_territory_id IN NUMBER DEFAULT NULL
498 , p_assigned_by_id IN NUMBER DEFAULT NULL
499 , p_customer_id IN NUMBER DEFAULT NULL
500 , p_cust_account_id IN NUMBER DEFAULT NULL
501 , p_address_id IN NUMBER DEFAULT NULL
502 , p_planned_start_date IN DATE DEFAULT NULL
503 , p_planned_end_date IN DATE DEFAULT NULL
504 , p_scheduled_start_date IN DATE DEFAULT NULL
505 , p_scheduled_end_date IN DATE DEFAULT NULL
506 , p_actual_start_date IN DATE DEFAULT NULL
507 , p_actual_end_date IN DATE DEFAULT NULL
508 , p_timezone_id IN NUMBER DEFAULT NULL
509 , p_source_object_type_code IN VARCHAR2 DEFAULT NULL
510 , p_source_object_id IN NUMBER DEFAULT NULL
511 , p_source_object_name IN VARCHAR2 DEFAULT NULL
512 , p_duration IN NUMBER DEFAULT NULL
513 , p_duration_uom IN VARCHAR2 DEFAULT NULL
514 , p_planned_effort IN NUMBER DEFAULT NULL
515 , p_planned_effort_uom IN VARCHAR2 DEFAULT NULL
516 , p_actual_effort IN NUMBER DEFAULT NULL
517 , p_actual_effort_uom IN VARCHAR2 DEFAULT NULL
518 , p_percentage_complete IN NUMBER DEFAULT NULL
519 , p_reason_code IN VARCHAR2 DEFAULT NULL
520 , p_private_flag IN VARCHAR2 DEFAULT NULL
521 , p_publish_flag IN VARCHAR2 DEFAULT NULL
522 , p_restrict_closure_flag IN VARCHAR2 DEFAULT NULL
523 , p_multi_booked_flag IN VARCHAR2 DEFAULT NULL
524 , p_milestone_flag IN VARCHAR2 DEFAULT NULL
525 , p_holiday_flag IN VARCHAR2 DEFAULT NULL
526 , p_billable_flag IN VARCHAR2 DEFAULT NULL
527 , p_bound_mode_code IN VARCHAR2 DEFAULT NULL
528 , p_soft_bound_flag IN VARCHAR2 DEFAULT NULL
529 , p_workflow_process_id IN NUMBER DEFAULT NULL
530 , p_notification_flag IN VARCHAR2 DEFAULT NULL
531 , p_notification_period IN NUMBER DEFAULT NULL
532 , p_notification_period_uom IN VARCHAR2 DEFAULT NULL
533 , p_parent_task_id IN NUMBER DEFAULT NULL
534 , p_alarm_start IN NUMBER DEFAULT NULL
535 , p_alarm_start_uom IN VARCHAR2 DEFAULT NULL
536 , p_alarm_on IN VARCHAR2 DEFAULT NULL
537 , p_alarm_count IN NUMBER DEFAULT NULL
538 , p_alarm_interval IN NUMBER DEFAULT NULL
539 , p_alarm_interval_uom IN VARCHAR2 DEFAULT NULL
540 , p_palm_flag IN VARCHAR2 DEFAULT NULL
541 , p_wince_flag IN VARCHAR2 DEFAULT NULL
542 , p_laptop_flag IN VARCHAR2 DEFAULT NULL
543 , p_device1_flag IN VARCHAR2 DEFAULT NULL
544 , p_device2_flag IN VARCHAR2 DEFAULT NULL
545 , p_device3_flag IN VARCHAR2 DEFAULT NULL
546 , p_costs IN NUMBER DEFAULT NULL
547 , p_currency_code IN VARCHAR2 DEFAULT NULL
548 , p_escalation_level IN VARCHAR2 DEFAULT NULL
549 , x_return_status OUT NOCOPY VARCHAR2
550 , x_msg_count OUT NOCOPY NUMBER
551 , x_msg_data OUT NOCOPY VARCHAR2
552 , x_task_id OUT NOCOPY NUMBER
553 , p_attribute1 IN VARCHAR2 DEFAULT NULL
554 , p_attribute2 IN VARCHAR2 DEFAULT NULL
555 , p_attribute3 IN VARCHAR2 DEFAULT NULL
556 , p_attribute4 IN VARCHAR2 DEFAULT NULL
557 , p_attribute5 IN VARCHAR2 DEFAULT NULL
558 , p_attribute6 IN VARCHAR2 DEFAULT NULL
559 , p_attribute7 IN VARCHAR2 DEFAULT NULL
560 , p_attribute8 IN VARCHAR2 DEFAULT NULL
561 , p_attribute9 IN VARCHAR2 DEFAULT NULL
562 , p_attribute10 IN VARCHAR2 DEFAULT NULL
563 , p_attribute11 IN VARCHAR2 DEFAULT NULL
564 , p_attribute12 IN VARCHAR2 DEFAULT NULL
565 , p_attribute13 IN VARCHAR2 DEFAULT NULL
566 , p_attribute14 IN VARCHAR2 DEFAULT NULL
567 , p_attribute15 IN VARCHAR2 DEFAULT NULL
568 , p_attribute_category IN VARCHAR2 DEFAULT NULL
569 , p_date_selected IN VARCHAR2 DEFAULT NULL
570 , p_category_id IN NUMBER DEFAULT NULL
571 , p_show_on_calendar IN VARCHAR2 DEFAULT NULL
572 , p_owner_status_id IN NUMBER DEFAULT NULL
573 , p_template_id IN NUMBER DEFAULT NULL
574 , p_template_group_id IN NUMBER DEFAULT NULL
575 , p_enable_workflow IN VARCHAR2
576 , p_abort_workflow IN VARCHAR2
577 , p_entity IN VARCHAR2
578 , p_free_busy_type IN VARCHAR2
579 ) IS
580 l_api_version CONSTANT NUMBER := 1.0;
581 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_TASK';
582 BEGIN
583 SAVEPOINT create_task_pvt1;
584 x_return_status := fnd_api.g_ret_sts_success;
585
586 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
587 RAISE fnd_api.g_exc_unexpected_error;
588 END IF;
589
590 IF fnd_api.to_boolean(p_init_msg_list) THEN
591 fnd_msg_pub.initialize;
592 END IF;
593
594 -- call new version, passing defaults for new functionality
595 create_task(
596 p_api_version => p_api_version
597 , p_init_msg_list => p_init_msg_list
598 , p_commit => fnd_api.g_false
599 , p_task_id => p_task_id
600 , p_task_name => p_task_name
601 , p_task_type_id => p_task_type_id
602 , p_description => p_description
603 , p_task_status_id => p_task_status_id
604 , p_task_priority_id => p_task_priority_id
605 , p_owner_type_code => p_owner_type_code
606 , p_owner_id => p_owner_id
607 , p_owner_territory_id => p_owner_territory_id
608 , p_assigned_by_id => p_assigned_by_id
609 , p_customer_id => p_customer_id
610 , p_cust_account_id => p_cust_account_id
611 , p_address_id => p_address_id
612 , p_planned_start_date => p_planned_start_date
613 , p_planned_end_date => p_planned_end_date
614 , p_scheduled_start_date => p_scheduled_start_date
615 , p_scheduled_end_date => p_scheduled_end_date
616 , p_actual_start_date => p_actual_start_date
617 , p_actual_end_date => p_actual_end_date
618 , p_timezone_id => p_timezone_id
619 , p_source_object_type_code => p_source_object_type_code
620 , p_source_object_id => p_source_object_id
621 , p_source_object_name => p_source_object_name
622 , p_duration => p_duration
623 , p_duration_uom => p_duration_uom
624 , p_planned_effort => p_planned_effort
625 , p_planned_effort_uom => p_planned_effort_uom
626 , p_actual_effort => p_actual_effort
627 , p_actual_effort_uom => p_actual_effort_uom
628 , p_percentage_complete => p_percentage_complete
629 , p_reason_code => p_reason_code
630 , p_private_flag => p_private_flag
631 , p_publish_flag => p_publish_flag
632 , p_restrict_closure_flag => p_restrict_closure_flag
633 , p_multi_booked_flag => p_multi_booked_flag
634 , p_milestone_flag => p_milestone_flag
635 , p_holiday_flag => p_holiday_flag
636 , p_billable_flag => p_billable_flag
637 , p_bound_mode_code => p_bound_mode_code
638 , p_soft_bound_flag => p_soft_bound_flag
639 , p_workflow_process_id => p_workflow_process_id
640 , p_notification_flag => p_notification_flag
641 , p_notification_period => p_notification_period
642 , p_notification_period_uom => p_notification_period_uom
643 , p_parent_task_id => p_parent_task_id
644 , p_alarm_start => p_alarm_start
645 , p_alarm_start_uom => p_alarm_start_uom
646 , p_alarm_on => p_alarm_on
647 , p_alarm_count => p_alarm_count
648 , p_alarm_interval => p_alarm_interval
649 , p_alarm_interval_uom => p_alarm_interval_uom
650 , p_palm_flag => p_palm_flag
651 , p_wince_flag => p_wince_flag
652 , p_laptop_flag => p_laptop_flag
653 , p_device1_flag => p_device1_flag
654 , p_device2_flag => p_device2_flag
655 , p_device3_flag => p_device3_flag
656 , p_costs => p_costs
657 , p_currency_code => p_currency_code
658 , p_escalation_level => p_escalation_level
659 , x_return_status => x_return_status
660 , x_msg_count => x_msg_count
661 , x_msg_data => x_msg_data
662 , x_task_id => x_task_id
663 , p_attribute1 => p_attribute1
664 , p_attribute2 => p_attribute2
665 , p_attribute3 => p_attribute3
666 , p_attribute4 => p_attribute4
667 , p_attribute5 => p_attribute5
668 , p_attribute6 => p_attribute6
669 , p_attribute7 => p_attribute7
670 , p_attribute8 => p_attribute8
671 , p_attribute9 => p_attribute9
672 , p_attribute10 => p_attribute10
673 , p_attribute11 => p_attribute11
674 , p_attribute12 => p_attribute12
675 , p_attribute13 => p_attribute13
676 , p_attribute14 => p_attribute14
677 , p_attribute15 => p_attribute15
678 , p_attribute_category => p_attribute_category
679 , p_date_selected => p_date_selected
680 , p_category_id => p_category_id
681 , p_show_on_calendar => p_show_on_calendar
682 , p_owner_status_id => p_owner_status_id
683 , p_template_id => p_template_id
684 , p_template_group_id => p_template_group_id
685 , p_enable_workflow => p_enable_workflow
686 , p_abort_workflow => p_abort_workflow
687 , p_entity => p_entity
688 , p_free_busy_type => p_free_busy_type
689 , p_task_confirmation_status => 'N'
690 , p_task_confirmation_counter => NULL
691 , p_task_split_flag => NULL
692 , p_reference_flag => NULL
693 , p_child_position => NULL
694 , p_child_sequence_num => NULL
695 );
696
697 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
698 x_return_status := fnd_api.g_ret_sts_unexp_error;
699 RAISE fnd_api.g_exc_unexpected_error;
700 END IF;
701
702 IF fnd_api.to_boolean(p_commit) THEN
703 COMMIT WORK;
704 END IF;
705
706 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
707 EXCEPTION
708 WHEN fnd_api.g_exc_unexpected_error THEN
709 ROLLBACK TO create_task_pvt1;
710 x_return_status := fnd_api.g_ret_sts_unexp_error;
711 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
712 WHEN OTHERS THEN
713 ROLLBACK TO create_task_pvt1;
714 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
715 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
716 fnd_msg_pub.ADD;
717 x_return_status := fnd_api.g_ret_sts_unexp_error;
718 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
719 END;
720
721 -- Overloaded version for Simplex Changes..
722 PROCEDURE create_task(
723 p_api_version IN NUMBER
724 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
725 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
726 , p_task_id IN NUMBER DEFAULT NULL
727 , p_task_name IN VARCHAR2
728 , p_task_type_id IN NUMBER DEFAULT NULL
729 , p_description IN VARCHAR2 DEFAULT NULL
730 , p_task_status_id IN NUMBER DEFAULT NULL
731 , p_task_priority_id IN NUMBER DEFAULT NULL
732 , p_owner_type_code IN VARCHAR2 DEFAULT NULL
733 , p_owner_id IN NUMBER DEFAULT NULL
734 , p_owner_territory_id IN NUMBER DEFAULT NULL
735 , p_assigned_by_id IN NUMBER DEFAULT NULL
736 , p_customer_id IN NUMBER DEFAULT NULL
737 , p_cust_account_id IN NUMBER DEFAULT NULL
738 , p_address_id IN NUMBER DEFAULT NULL
739 , ---- hz_party_sites
740 p_planned_start_date IN DATE DEFAULT NULL
741 , p_planned_end_date IN DATE DEFAULT NULL
742 , p_scheduled_start_date IN DATE DEFAULT NULL
743 , p_scheduled_end_date IN DATE DEFAULT NULL
744 , p_actual_start_date IN DATE DEFAULT NULL
745 , p_actual_end_date IN DATE DEFAULT NULL
746 , p_timezone_id IN NUMBER DEFAULT NULL
747 , p_source_object_type_code IN VARCHAR2 DEFAULT NULL
748 , p_source_object_id IN NUMBER DEFAULT NULL
749 , p_source_object_name IN VARCHAR2 DEFAULT NULL
750 , p_duration IN NUMBER DEFAULT NULL
751 , p_duration_uom IN VARCHAR2 DEFAULT NULL
752 , p_planned_effort IN NUMBER DEFAULT NULL
753 , p_planned_effort_uom IN VARCHAR2 DEFAULT NULL
754 , p_actual_effort IN NUMBER DEFAULT NULL
755 , p_actual_effort_uom IN VARCHAR2 DEFAULT NULL
756 , p_percentage_complete IN NUMBER DEFAULT NULL
757 , p_reason_code IN VARCHAR2 DEFAULT NULL
758 , p_private_flag IN VARCHAR2 DEFAULT NULL
759 , p_publish_flag IN VARCHAR2 DEFAULT NULL
760 , p_restrict_closure_flag IN VARCHAR2 DEFAULT NULL
761 , p_multi_booked_flag IN VARCHAR2 DEFAULT NULL
762 , p_milestone_flag IN VARCHAR2 DEFAULT NULL
763 , p_holiday_flag IN VARCHAR2 DEFAULT NULL
764 , p_billable_flag IN VARCHAR2 DEFAULT NULL
765 , p_bound_mode_code IN VARCHAR2 DEFAULT NULL
766 , p_soft_bound_flag IN VARCHAR2 DEFAULT NULL
767 , p_workflow_process_id IN NUMBER DEFAULT NULL
768 , p_notification_flag IN VARCHAR2 DEFAULT NULL
769 , p_notification_period IN NUMBER DEFAULT NULL
770 , p_notification_period_uom IN VARCHAR2 DEFAULT NULL
771 , p_parent_task_id IN NUMBER DEFAULT NULL
772 , p_alarm_start IN NUMBER DEFAULT NULL
773 , p_alarm_start_uom IN VARCHAR2 DEFAULT NULL
774 , p_alarm_on IN VARCHAR2 DEFAULT NULL
775 , p_alarm_count IN NUMBER DEFAULT NULL
776 , p_alarm_interval IN NUMBER DEFAULT NULL
777 , p_alarm_interval_uom IN VARCHAR2 DEFAULT NULL
778 , p_palm_flag IN VARCHAR2 DEFAULT NULL
779 , p_wince_flag IN VARCHAR2 DEFAULT NULL
780 , p_laptop_flag IN VARCHAR2 DEFAULT NULL
781 , p_device1_flag IN VARCHAR2 DEFAULT NULL
782 , p_device2_flag IN VARCHAR2 DEFAULT NULL
783 , p_device3_flag IN VARCHAR2 DEFAULT NULL
784 , p_costs IN NUMBER DEFAULT NULL
785 , p_currency_code IN VARCHAR2 DEFAULT NULL
786 , p_escalation_level IN VARCHAR2 DEFAULT NULL
787 , x_return_status OUT NOCOPY VARCHAR2
788 , x_msg_count OUT NOCOPY NUMBER
789 , x_msg_data OUT NOCOPY VARCHAR2
790 , x_task_id OUT NOCOPY NUMBER
791 , p_attribute1 IN VARCHAR2 DEFAULT NULL
792 , p_attribute2 IN VARCHAR2 DEFAULT NULL
793 , p_attribute3 IN VARCHAR2 DEFAULT NULL
794 , p_attribute4 IN VARCHAR2 DEFAULT NULL
795 , p_attribute5 IN VARCHAR2 DEFAULT NULL
796 , p_attribute6 IN VARCHAR2 DEFAULT NULL
797 , p_attribute7 IN VARCHAR2 DEFAULT NULL
798 , p_attribute8 IN VARCHAR2 DEFAULT NULL
799 , p_attribute9 IN VARCHAR2 DEFAULT NULL
800 , p_attribute10 IN VARCHAR2 DEFAULT NULL
801 , p_attribute11 IN VARCHAR2 DEFAULT NULL
802 , p_attribute12 IN VARCHAR2 DEFAULT NULL
803 , p_attribute13 IN VARCHAR2 DEFAULT NULL
804 , p_attribute14 IN VARCHAR2 DEFAULT NULL
805 , p_attribute15 IN VARCHAR2 DEFAULT NULL
806 , p_attribute_category IN VARCHAR2 DEFAULT NULL
807 , p_date_selected IN VARCHAR2 DEFAULT NULL
808 , p_category_id IN NUMBER DEFAULT NULL
809 , p_show_on_calendar IN VARCHAR2 DEFAULT NULL
810 , p_owner_status_id IN NUMBER DEFAULT NULL
811 , p_template_id IN NUMBER DEFAULT NULL
812 , p_template_group_id IN NUMBER DEFAULT NULL
813 , p_enable_workflow IN VARCHAR2
814 , p_abort_workflow IN VARCHAR2
815 , p_entity IN VARCHAR2
816 , p_free_busy_type IN VARCHAR2
817 , p_task_confirmation_status IN VARCHAR2
818 , p_task_confirmation_counter IN NUMBER
819 , p_task_split_flag IN VARCHAR2
820 , p_reference_flag IN VARCHAR2 DEFAULT NULL
821 , p_child_position IN VARCHAR2 DEFAULT NULL
822 , p_child_sequence_num IN NUMBER DEFAULT NULL
823 ) IS
824 l_api_version CONSTANT NUMBER := 1.0;
825 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_TASK';
826 BEGIN
827 SAVEPOINT create_task_pvt4;
828 x_return_status := fnd_api.g_ret_sts_success;
829
830 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
831 RAISE fnd_api.g_exc_unexpected_error;
832 END IF;
833
834 IF fnd_api.to_boolean(p_init_msg_list) THEN
835 fnd_msg_pub.initialize;
836 END IF;
837
838 -- call new version, passing defaults for new functionality
839 create_task(
840 p_api_version => p_api_version
841 , p_init_msg_list => p_init_msg_list
842 , p_commit => fnd_api.g_false
843 , p_task_id => p_task_id
844 , p_task_name => p_task_name
845 , p_task_type_id => p_task_type_id
846 , p_description => p_description
847 , p_task_status_id => p_task_status_id
848 , p_task_priority_id => p_task_priority_id
849 , p_owner_type_code => p_owner_type_code
850 , p_owner_id => p_owner_id
851 , p_owner_territory_id => p_owner_territory_id
852 , p_assigned_by_id => p_assigned_by_id
853 , p_customer_id => p_customer_id
854 , p_cust_account_id => p_cust_account_id
855 , p_address_id => p_address_id
856 , ---- hz_party_sites
857 p_planned_start_date => p_planned_start_date
858 , p_planned_end_date => p_planned_end_date
859 , p_scheduled_start_date => p_scheduled_start_date
860 , p_scheduled_end_date => p_scheduled_end_date
861 , p_actual_start_date => p_actual_start_date
862 , p_actual_end_date => p_actual_end_date
863 , p_timezone_id => p_timezone_id
864 , p_source_object_type_code => p_source_object_type_code
865 , p_source_object_id => p_source_object_id
866 , p_source_object_name => p_source_object_name
867 , p_duration => p_duration
868 , p_duration_uom => p_duration_uom
869 , p_planned_effort => p_planned_effort
870 , p_planned_effort_uom => p_planned_effort_uom
871 , p_actual_effort => p_actual_effort
872 , p_actual_effort_uom => p_actual_effort_uom
873 , p_percentage_complete => p_percentage_complete
874 , p_reason_code => p_reason_code
875 , p_private_flag => p_private_flag
876 , p_publish_flag => p_publish_flag
877 , p_restrict_closure_flag => p_restrict_closure_flag
878 , p_multi_booked_flag => p_multi_booked_flag
879 , p_milestone_flag => p_milestone_flag
880 , p_holiday_flag => p_holiday_flag
881 , p_billable_flag => p_billable_flag
882 , p_bound_mode_code => p_bound_mode_code
883 , p_soft_bound_flag => p_soft_bound_flag
884 , p_workflow_process_id => p_workflow_process_id
885 , p_notification_flag => p_notification_flag
886 , p_notification_period => p_notification_period
887 , p_notification_period_uom => p_notification_period_uom
888 , p_parent_task_id => p_parent_task_id
889 , p_alarm_start => p_alarm_start
890 , p_alarm_start_uom => p_alarm_start_uom
891 , p_alarm_on => p_alarm_on
892 , p_alarm_count => p_alarm_count
893 , p_alarm_interval => p_alarm_interval
894 , p_alarm_interval_uom => p_alarm_interval_uom
895 , p_palm_flag => p_palm_flag
896 , p_wince_flag => p_wince_flag
897 , p_laptop_flag => p_laptop_flag
898 , p_device1_flag => p_device1_flag
899 , p_device2_flag => p_device2_flag
900 , p_device3_flag => p_device3_flag
901 , p_costs => p_costs
902 , p_currency_code => p_currency_code
903 , p_escalation_level => p_escalation_level
904 , x_return_status => x_return_status
905 , x_msg_count => x_msg_count
906 , x_msg_data => x_msg_data
907 , x_task_id => x_task_id
908 , p_attribute1 => p_attribute1
909 , p_attribute2 => p_attribute2
910 , p_attribute3 => p_attribute3
911 , p_attribute4 => p_attribute4
912 , p_attribute5 => p_attribute5
913 , p_attribute6 => p_attribute6
914 , p_attribute7 => p_attribute7
915 , p_attribute8 => p_attribute8
916 , p_attribute9 => p_attribute9
917 , p_attribute10 => p_attribute10
918 , p_attribute11 => p_attribute11
919 , p_attribute12 => p_attribute12
920 , p_attribute13 => p_attribute13
921 , p_attribute14 => p_attribute14
922 , p_attribute15 => p_attribute15
923 , p_attribute_category => p_attribute_category
924 , p_date_selected => p_date_selected
925 , p_category_id => p_category_id
926 , p_show_on_calendar => p_show_on_calendar
927 , p_owner_status_id => p_owner_status_id
928 , p_template_id => p_template_id
929 , p_template_group_id => p_template_group_id
930 , p_enable_workflow => p_enable_workflow
931 , p_abort_workflow => p_abort_workflow
932 , p_entity => p_entity
933 , p_free_busy_type => p_free_busy_type
934 , p_task_confirmation_status => p_task_confirmation_status
935 , p_task_confirmation_counter => p_task_confirmation_counter
936 , p_task_split_flag => p_task_split_flag
937 , p_reference_flag => p_reference_flag
938 , p_child_position => p_child_position
939 , p_child_sequence_num => p_child_sequence_num
940 , p_location_id => NULL
941 );
942
943 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
944 x_return_status := fnd_api.g_ret_sts_unexp_error;
945 RAISE fnd_api.g_exc_unexpected_error;
946 END IF;
947
948 IF fnd_api.to_boolean(p_commit) THEN
949 COMMIT WORK;
950 END IF;
951
952 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
953 EXCEPTION
954 WHEN fnd_api.g_exc_unexpected_error THEN
955 ROLLBACK TO create_task_pvt4;
956 x_return_status := fnd_api.g_ret_sts_unexp_error;
957 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
958 WHEN OTHERS THEN
959 ROLLBACK TO create_task_pvt4;
960 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
961 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
962 fnd_msg_pub.ADD;
963 x_return_status := fnd_api.g_ret_sts_unexp_error;
964 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
965 END;
966
967 -- Overloaded version for Location Id..
968 PROCEDURE create_task(
969 p_api_version IN NUMBER
970 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
971 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
972 , p_task_id IN NUMBER DEFAULT NULL
973 , p_task_name IN VARCHAR2
974 , p_task_type_id IN NUMBER DEFAULT NULL
975 , p_description IN VARCHAR2 DEFAULT NULL
976 , p_task_status_id IN NUMBER DEFAULT NULL
977 , p_task_priority_id IN NUMBER DEFAULT NULL
978 , p_owner_type_code IN VARCHAR2 DEFAULT NULL
979 , p_owner_id IN NUMBER DEFAULT NULL
980 , p_owner_territory_id IN NUMBER DEFAULT NULL
981 , p_assigned_by_id IN NUMBER DEFAULT NULL
982 , p_customer_id IN NUMBER DEFAULT NULL
983 , p_cust_account_id IN NUMBER DEFAULT NULL
984 , p_address_id IN NUMBER DEFAULT NULL
985 , p_planned_start_date IN DATE DEFAULT NULL
986 , p_planned_end_date IN DATE DEFAULT NULL
987 , p_scheduled_start_date IN DATE DEFAULT NULL
988 , p_scheduled_end_date IN DATE DEFAULT NULL
989 , p_actual_start_date IN DATE DEFAULT NULL
990 , p_actual_end_date IN DATE DEFAULT NULL
991 , p_timezone_id IN NUMBER DEFAULT NULL
992 , p_source_object_type_code IN VARCHAR2 DEFAULT NULL
993 , p_source_object_id IN NUMBER DEFAULT NULL
994 , p_source_object_name IN VARCHAR2 DEFAULT NULL
995 , p_duration IN NUMBER DEFAULT NULL
996 , p_duration_uom IN VARCHAR2 DEFAULT NULL
997 , p_planned_effort IN NUMBER DEFAULT NULL
998 , p_planned_effort_uom IN VARCHAR2 DEFAULT NULL
999 , p_actual_effort IN NUMBER DEFAULT NULL
1000 , p_actual_effort_uom IN VARCHAR2 DEFAULT NULL
1001 , p_percentage_complete IN NUMBER DEFAULT NULL
1002 , p_reason_code IN VARCHAR2 DEFAULT NULL
1003 , p_private_flag IN VARCHAR2 DEFAULT NULL
1004 , p_publish_flag IN VARCHAR2 DEFAULT NULL
1005 , p_restrict_closure_flag IN VARCHAR2 DEFAULT NULL
1006 , p_multi_booked_flag IN VARCHAR2 DEFAULT NULL
1007 , p_milestone_flag IN VARCHAR2 DEFAULT NULL
1008 , p_holiday_flag IN VARCHAR2 DEFAULT NULL
1009 , p_billable_flag IN VARCHAR2 DEFAULT NULL
1010 , p_bound_mode_code IN VARCHAR2 DEFAULT NULL
1011 , p_soft_bound_flag IN VARCHAR2 DEFAULT NULL
1012 , p_workflow_process_id IN NUMBER DEFAULT NULL
1013 , p_notification_flag IN VARCHAR2 DEFAULT NULL
1014 , p_notification_period IN NUMBER DEFAULT NULL
1015 , p_notification_period_uom IN VARCHAR2 DEFAULT NULL
1016 , p_parent_task_id IN NUMBER DEFAULT NULL
1017 , p_alarm_start IN NUMBER DEFAULT NULL
1018 , p_alarm_start_uom IN VARCHAR2 DEFAULT NULL
1019 , p_alarm_on IN VARCHAR2 DEFAULT NULL
1020 , p_alarm_count IN NUMBER DEFAULT NULL
1021 , p_alarm_interval IN NUMBER DEFAULT NULL
1022 , p_alarm_interval_uom IN VARCHAR2 DEFAULT NULL
1023 , p_palm_flag IN VARCHAR2 DEFAULT NULL
1024 , p_wince_flag IN VARCHAR2 DEFAULT NULL
1025 , p_laptop_flag IN VARCHAR2 DEFAULT NULL
1026 , p_device1_flag IN VARCHAR2 DEFAULT NULL
1027 , p_device2_flag IN VARCHAR2 DEFAULT NULL
1028 , p_device3_flag IN VARCHAR2 DEFAULT NULL
1029 , p_costs IN NUMBER DEFAULT NULL
1030 , p_currency_code IN VARCHAR2 DEFAULT NULL
1031 , p_escalation_level IN VARCHAR2 DEFAULT NULL
1032 , x_return_status OUT NOCOPY VARCHAR2
1033 , x_msg_count OUT NOCOPY NUMBER
1034 , x_msg_data OUT NOCOPY VARCHAR2
1035 , x_task_id OUT NOCOPY NUMBER
1036 , p_attribute1 IN VARCHAR2 DEFAULT NULL
1037 , p_attribute2 IN VARCHAR2 DEFAULT NULL
1038 , p_attribute3 IN VARCHAR2 DEFAULT NULL
1039 , p_attribute4 IN VARCHAR2 DEFAULT NULL
1040 , p_attribute5 IN VARCHAR2 DEFAULT NULL
1041 , p_attribute6 IN VARCHAR2 DEFAULT NULL
1042 , p_attribute7 IN VARCHAR2 DEFAULT NULL
1043 , p_attribute8 IN VARCHAR2 DEFAULT NULL
1044 , p_attribute9 IN VARCHAR2 DEFAULT NULL
1045 , p_attribute10 IN VARCHAR2 DEFAULT NULL
1046 , p_attribute11 IN VARCHAR2 DEFAULT NULL
1047 , p_attribute12 IN VARCHAR2 DEFAULT NULL
1048 , p_attribute13 IN VARCHAR2 DEFAULT NULL
1049 , p_attribute14 IN VARCHAR2 DEFAULT NULL
1050 , p_attribute15 IN VARCHAR2 DEFAULT NULL
1051 , p_attribute_category IN VARCHAR2 DEFAULT NULL
1052 , p_date_selected IN VARCHAR2 DEFAULT NULL
1053 , p_category_id IN NUMBER DEFAULT NULL
1054 , p_show_on_calendar IN VARCHAR2 DEFAULT NULL
1055 , p_owner_status_id IN NUMBER DEFAULT NULL
1056 , p_template_id IN NUMBER DEFAULT NULL
1057 , p_template_group_id IN NUMBER DEFAULT NULL
1058 , p_enable_workflow IN VARCHAR2
1059 , p_abort_workflow IN VARCHAR2
1060 , p_entity IN VARCHAR2
1061 , p_free_busy_type IN VARCHAR2
1062 , p_task_confirmation_status IN VARCHAR2
1063 , p_task_confirmation_counter IN NUMBER
1064 , p_task_split_flag IN VARCHAR2
1065 , p_reference_flag IN VARCHAR2 DEFAULT NULL
1066 , p_child_position IN VARCHAR2 DEFAULT NULL
1067 , p_child_sequence_num IN NUMBER DEFAULT NULL
1068 , p_location_id IN NUMBER
1069 , p_copied_from_task_id IN NUMBER DEFAULT NULL
1070 ) IS
1071 l_api_version CONSTANT NUMBER := 1.0;
1072 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_TASK';
1073
1074 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
1075 l_rowid ROWID;
1076 l_task_number jtf_tasks_b.task_number%TYPE;
1077 l_owner_id jtf_tasks_b.owner_id%TYPE := p_owner_id;
1078 l_owner_type_code jtf_tasks_b.owner_type_code%TYPE := p_owner_type_code;
1079 l_task_type_id jtf_tasks_b.task_type_id%TYPE := p_task_type_id;
1080 l_task_status_id jtf_tasks_b.task_status_id%TYPE := p_task_status_id;
1081 l_task_priority_id jtf_tasks_b.task_priority_id%TYPE := p_task_priority_id;
1082 l_source_object_id jtf_tasks_b.source_object_id%TYPE := p_source_object_id;
1083 ---
1084 --- to fix bug #2224949
1085 ---
1086 l_source_object_name jtf_tasks_b.source_object_name%TYPE := jtf_task_utl.check_truncation(p_object_name => p_source_object_name);
1087 l_source_object_type_code jtf_tasks_b.source_object_type_code%TYPE := p_source_object_type_code;
1088 l_duration jtf_tasks_b.DURATION%TYPE := p_duration;
1089 l_duration_uom jtf_tasks_b.duration_uom%TYPE := p_duration_uom;
1090 l_planned_effort jtf_tasks_b.planned_effort%TYPE := p_planned_effort;
1091 l_planned_effort_uom jtf_tasks_b.planned_effort_uom%TYPE := p_planned_effort_uom;
1092 l_actual_effort jtf_tasks_b.actual_effort%TYPE := p_actual_effort;
1093 l_actual_effort_uom jtf_tasks_b.actual_effort_uom%TYPE := p_actual_effort_uom;
1094 l_percentage_complete jtf_tasks_b.percentage_complete%TYPE := p_percentage_complete;
1095 l_reason_code jtf_tasks_b.reason_code%TYPE := p_reason_code;
1096 l_date_selected jtf_tasks_b.date_selected%TYPE;
1097 l_calendar_start_date jtf_tasks_b.calendar_start_date%TYPE;
1098 l_calendar_end_date jtf_tasks_b.calendar_end_date%TYPE;
1099 l_planned_start_date jtf_tasks_b.planned_start_date%TYPE := p_planned_start_date;
1100 l_planned_end_date jtf_tasks_b.planned_end_date%TYPE := p_planned_end_date;
1101 l_scheduled_start_date jtf_tasks_b.scheduled_start_date%TYPE := p_scheduled_start_date;
1102 l_scheduled_end_date jtf_tasks_b.scheduled_end_date%TYPE := p_scheduled_end_date;
1103 l_actual_start_date jtf_tasks_b.actual_start_date%TYPE := p_actual_start_date;
1104 l_actual_end_date jtf_tasks_b.actual_end_date%TYPE := p_actual_end_date;
1105 l_task_assignment_id jtf_task_assignments.task_assignment_id%TYPE;
1106 l_category_id jtf_task_assignments.category_id%TYPE := p_category_id;
1107 l_owner_status_id jtf_task_assignments.assignment_status_id%TYPE;
1108 l_show_on_calendar jtf_task_assignments.show_on_calendar%TYPE;
1109 l_task_reference_id jtf_task_references_b.task_reference_id%TYPE;
1110 l_enable_workflow VARCHAR2(1) := p_enable_workflow;
1111 l_abort_workflow VARCHAR2(1) := p_abort_workflow;
1112 x_event_return_status VARCHAR2(100);
1113 -- Booking enhancement
1114 l_entity jtf_tasks_b.entity%TYPE := p_entity;
1115 l_free_busy_type jtf_task_all_assignments.free_busy_type%TYPE := p_free_busy_type;
1116 l_open_flag VARCHAR2(1);
1117 l_task_confirmation_status jtf_tasks_b.task_confirmation_status%TYPE := p_task_confirmation_status;
1118 l_res_type jtf_task_rsc_reqs.resource_type_code%TYPE;
1119 l_req_units jtf_task_rsc_reqs.required_units%TYPE;
1120 l_enabled_flag jtf_task_rsc_reqs.enabled_flag%TYPE;
1121 l_resource_req_id jtf_task_rsc_reqs.resource_req_id%TYPE;
1122
1123 CURSOR c_type_reqs IS
1124 SELECT resource_type_code, required_units, enabled_flag
1125 FROM jtf_task_rsc_reqs
1126 WHERE task_type_id = l_task_type_id;
1127
1128 CURSOR c_jtf_tasks IS
1129 SELECT 'Y'
1130 FROM jtf_tasks_b
1131 WHERE task_id = p_task_id;
1132
1133 l_task_id_duplicate VARCHAR2(1);
1134 l_task_rec_type jtf_tasks_pvt.task_rec_type;
1135 BEGIN
1136 SAVEPOINT create_task_pvt;
1137
1138 x_return_status := fnd_api.g_ret_sts_success;
1139
1140 IF fnd_api.to_boolean(p_init_msg_list) THEN
1141 fnd_msg_pub.initialize;
1142 END IF;
1143
1144 IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1145 RAISE fnd_api.g_exc_unexpected_error;
1146 END IF;
1147
1148 IF p_task_name IS NULL THEN
1149 fnd_message.set_name('JTF', 'JTF_TASK_MISSING_NAME');
1150 fnd_msg_pub.ADD;
1151 RAISE fnd_api.g_exc_unexpected_error;
1152 END IF;
1153
1154 IF p_task_split_flag IS NOT NULL THEN
1155 IF NOT p_task_split_flag IN('M', 'D') THEN
1156 fnd_message.set_name('JTF', 'JTF_TASK_CONSTRUCT_ID');
1157 fnd_message.set_token('%P_SHITF_CONSTRUCT_ID', 'task split flag');
1158 fnd_msg_pub.ADD;
1159 RAISE fnd_api.g_exc_unexpected_error;
1160 END IF;
1161 END IF;
1162
1163 IF NOT p_task_confirmation_status IN('N', 'R', 'C') THEN
1164 fnd_message.set_name('JTF', 'JTF_TASK_CONSTRUCT_ID');
1165 fnd_message.set_token('P_SHITF_CONSTRUCT_ID', 'task confirmation status');
1166 fnd_msg_pub.ADD;
1167 RAISE fnd_api.g_exc_unexpected_error;
1168 END IF;
1169
1170 IF p_enable_workflow IS NULL OR p_enable_workflow = fnd_api.g_miss_char THEN
1171 l_enable_workflow := g_enable_workflow;
1172 END IF;
1173
1174 IF p_abort_workflow IS NULL OR p_abort_workflow = fnd_api.g_miss_char THEN
1175 l_abort_workflow := g_abort_workflow;
1176 END IF;
1177
1178 IF p_task_id IS NOT NULL THEN
1179 IF p_task_id > jtf_task_utl_ext.get_last_number('JTF_TASKS_S') AND p_task_id < 1e+12 THEN
1180 fnd_message.set_name('JTF', 'JTF_TASK_OUT_OF_RANGE');
1181 fnd_msg_pub.ADD;
1182 x_return_status := fnd_api.g_ret_sts_unexp_error;
1183 RAISE fnd_api.g_exc_unexpected_error;
1184 END IF;
1185
1186 OPEN c_jtf_tasks;
1187 FETCH c_jtf_tasks INTO l_task_id_duplicate;
1188 CLOSE c_jtf_tasks;
1189
1190 IF l_task_id_duplicate = 'Y' THEN
1191 fnd_message.set_name('JTF', 'JTF_TASK_DUPLICATE_TASK_ID');
1192 fnd_message.set_token('P_TASK_ID', p_task_id);
1193 fnd_msg_pub.ADD;
1194 x_return_status := fnd_api.g_ret_sts_unexp_error;
1195 RAISE fnd_api.g_exc_unexpected_error;
1196 END IF;
1197
1198 SELECT jtf_task_number_s.NEXTVAL
1199 INTO l_task_number
1200 FROM DUAL;
1201
1202 x_task_id := p_task_id;
1203 ELSE
1204 SELECT jtf_tasks_s.NEXTVAL
1205 INTO x_task_id
1206 FROM DUAL;
1207
1208 SELECT jtf_task_number_s.NEXTVAL
1209 INTO l_task_number
1210 FROM DUAL;
1211 END IF;
1212
1213 -- ------------------------------------------------------------------------
1214 -- Call jtf_task_utl procedure to set calendar_start_date and
1215 -- calendar_end_date
1216 -- ------------------------------------------------------------------------
1217 jtf_task_utl_ext.set_calendar_dates(
1218 p_show_on_calendar => p_show_on_calendar
1219 , p_date_selected => p_date_selected
1220 , p_planned_start_date => l_planned_start_date
1221 , p_planned_end_date => l_planned_end_date
1222 , p_scheduled_start_date => l_scheduled_start_date
1223 , p_scheduled_end_date => l_scheduled_end_date
1224 , p_actual_start_date => l_actual_start_date
1225 , p_actual_end_date => l_actual_end_date
1226 , x_show_on_calendar => l_show_on_calendar
1227 , x_date_selected => l_date_selected
1228 , x_calendar_start_date => l_calendar_start_date
1229 , x_calendar_end_date => l_calendar_end_date
1230 , x_return_status => x_return_status
1231 , p_task_status_id => l_task_status_id-- Enhancement 2683868: new parameter
1232 , p_creation_date => SYSDATE -- Enhancement 2683868: new parameter
1233 );
1234
1235 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1236 x_return_status := fnd_api.g_ret_sts_unexp_error;
1237 RAISE fnd_api.g_exc_unexpected_error;
1238 END IF;
1239
1240 -- ------------------------------------------------------------------------
1241 -- If date_selected was not present then set the appropriate dates
1242 -- depending on date_selected returned from set_calendar_dates, to fix
1243 -- bug #1889371
1244 -- ------------------------------------------------------------------------
1245 IF p_date_selected IS NULL OR p_date_selected = fnd_api.g_miss_char THEN
1246 IF l_date_selected = 'P' THEN
1247 l_planned_start_date := l_calendar_start_date;
1248 l_planned_end_date := l_calendar_end_date;
1249 ELSIF l_date_selected = 'S' THEN
1250 l_scheduled_start_date := l_calendar_start_date;
1251 l_scheduled_end_date := l_calendar_end_date;
1252 ELSIF l_date_selected = 'A' THEN
1253 l_actual_start_date := l_calendar_start_date;
1254 l_actual_end_date := l_calendar_end_date;
1255 END IF;
1256 END IF;
1257
1258 -- ------------------------------------------------------------------------
1259 -- If type is Appointment then set scheduled dates to the value of the
1260 -- planned dates, to fix bug #1889178
1261 -- ------------------------------------------------------------------------
1262 IF p_source_object_type_code = 'APPOINTMENT' THEN
1263 l_scheduled_start_date := l_planned_start_date;
1264 l_scheduled_end_date := l_planned_end_date;
1265 END IF;
1266
1267 -- ------------------------------------------------------------------------
1268 -- If source is Task or Appointment then set source_id to task_id and
1269 -- source_name to task_number
1270 -- ------------------------------------------------------------------------
1271 IF p_source_object_type_code IN('TASK', 'APPOINTMENT', fnd_api.g_miss_char)
1272 OR p_source_object_type_code IS NULL THEN
1273 l_source_object_id := x_task_id;
1274 l_source_object_name := l_task_number;
1275
1276 IF p_source_object_type_code IS NOT NULL AND p_source_object_type_code <> fnd_api.g_miss_char THEN
1277 l_source_object_type_code := p_source_object_type_code;
1278 ELSE
1279 l_source_object_type_code := 'TASK';
1280 END IF;
1281 ELSE
1282 l_source_object_type_code := p_source_object_type_code;
1283 l_source_object_id := p_source_object_id;
1284 --- to fix bug #2224949 and 2384479
1285 -- Bug 2602732
1286 l_source_object_name := jtf_task_utl.check_truncation(jtf_task_utl.get_owner(l_source_object_type_code, l_source_object_id));
1287 --Chanaged For Bug # 2573617
1288 END IF;
1289
1290 -- Enhancement for booking--
1291 IF (l_task_type_id = 22) THEN
1292 l_entity := 'ESCALATION';
1293 ELSIF(l_source_object_type_code = 'APPOINTMENT') THEN
1294 l_entity := 'APPOINTMENT';
1295 END IF;
1296
1297 --- Validate Priority... Bug 3342819
1298 IF (l_task_priority_id = fnd_api.g_miss_num) OR(l_task_priority_id IS NULL) THEN
1299 l_task_priority_id := 8;
1300 END IF;
1301
1302 l_open_flag := jtf_task_utl_ext.get_open_flag(l_task_status_id);
1303 jtf_tasks_pub.p_task_user_hooks.task_id := x_task_id;
1304 jtf_tasks_pub.p_task_user_hooks.task_number := l_task_number;
1305 jtf_tasks_pub.p_task_user_hooks.task_name := p_task_name;
1306 jtf_tasks_pub.p_task_user_hooks.task_type_id := l_task_type_id;
1307 jtf_tasks_pub.p_task_user_hooks.description := p_description;
1308 jtf_tasks_pub.p_task_user_hooks.task_status_id := l_task_status_id;
1309 jtf_tasks_pub.p_task_user_hooks.task_priority_id := l_task_priority_id;
1310 jtf_tasks_pub.p_task_user_hooks.owner_type_code := l_owner_type_code;
1311 jtf_tasks_pub.p_task_user_hooks.owner_id := l_owner_id;
1312 jtf_tasks_pub.p_task_user_hooks.owner_territory_id := p_owner_territory_id;
1313 jtf_tasks_pub.p_task_user_hooks.assigned_by_id := p_assigned_by_id;
1314 jtf_tasks_pub.p_task_user_hooks.customer_id := p_customer_id;
1315 jtf_tasks_pub.p_task_user_hooks.cust_account_id := p_cust_account_id;
1316 jtf_tasks_pub.p_task_user_hooks.address_id := p_address_id;
1317 jtf_tasks_pub.p_task_user_hooks.planned_start_date := l_planned_start_date;
1318 jtf_tasks_pub.p_task_user_hooks.planned_end_date := l_planned_end_date;
1319 jtf_tasks_pub.p_task_user_hooks.scheduled_start_date := l_scheduled_start_date;
1320 jtf_tasks_pub.p_task_user_hooks.scheduled_end_date := l_scheduled_end_date;
1321 jtf_tasks_pub.p_task_user_hooks.actual_start_date := l_actual_start_date;
1322 jtf_tasks_pub.p_task_user_hooks.actual_end_date := l_actual_end_date;
1323 jtf_tasks_pub.p_task_user_hooks.timezone_id := p_timezone_id;
1324 jtf_tasks_pub.p_task_user_hooks.source_object_type_code := l_source_object_type_code;
1325 jtf_tasks_pub.p_task_user_hooks.source_object_id := l_source_object_id;
1326 jtf_tasks_pub.p_task_user_hooks.source_object_name := l_source_object_name;
1327 jtf_tasks_pub.p_task_user_hooks.DURATION := l_duration;
1328 jtf_tasks_pub.p_task_user_hooks.duration_uom := l_duration_uom;
1329 jtf_tasks_pub.p_task_user_hooks.planned_effort := l_planned_effort;
1330 jtf_tasks_pub.p_task_user_hooks.planned_effort_uom := l_planned_effort_uom;
1331 jtf_tasks_pub.p_task_user_hooks.actual_effort := l_actual_effort;
1332 jtf_tasks_pub.p_task_user_hooks.actual_effort_uom := l_actual_effort_uom;
1333 jtf_tasks_pub.p_task_user_hooks.percentage_complete := l_percentage_complete;
1334 jtf_tasks_pub.p_task_user_hooks.reason_code := l_reason_code;
1335 jtf_tasks_pub.p_task_user_hooks.private_flag := p_private_flag;
1336 jtf_tasks_pub.p_task_user_hooks.publish_flag := p_publish_flag;
1337 jtf_tasks_pub.p_task_user_hooks.restrict_closure_flag := p_restrict_closure_flag;
1338 jtf_tasks_pub.p_task_user_hooks.multi_booked_flag := p_multi_booked_flag;
1339 jtf_tasks_pub.p_task_user_hooks.milestone_flag := p_milestone_flag;
1340 jtf_tasks_pub.p_task_user_hooks.holiday_flag := p_holiday_flag;
1341 jtf_tasks_pub.p_task_user_hooks.billable_flag := p_billable_flag;
1342 jtf_tasks_pub.p_task_user_hooks.bound_mode_code := p_bound_mode_code;
1343 jtf_tasks_pub.p_task_user_hooks.soft_bound_flag := p_soft_bound_flag;
1344 jtf_tasks_pub.p_task_user_hooks.workflow_process_id := p_workflow_process_id;
1345 jtf_tasks_pub.p_task_user_hooks.notification_flag := p_notification_flag;
1346 jtf_tasks_pub.p_task_user_hooks.notification_period := p_notification_period;
1347 jtf_tasks_pub.p_task_user_hooks.notification_period_uom := p_notification_period_uom;
1348 jtf_tasks_pub.p_task_user_hooks.parent_task_id := p_parent_task_id;
1349 jtf_tasks_pub.p_task_user_hooks.alarm_start := p_alarm_start;
1350 jtf_tasks_pub.p_task_user_hooks.alarm_start_uom := p_alarm_start_uom;
1351 jtf_tasks_pub.p_task_user_hooks.alarm_on := p_alarm_on;
1352 jtf_tasks_pub.p_task_user_hooks.alarm_count := p_alarm_count;
1353 jtf_tasks_pub.p_task_user_hooks.alarm_interval := p_alarm_interval;
1354 jtf_tasks_pub.p_task_user_hooks.alarm_interval_uom := p_alarm_interval_uom;
1355 jtf_tasks_pub.p_task_user_hooks.palm_flag := p_palm_flag;
1356 jtf_tasks_pub.p_task_user_hooks.wince_flag := p_wince_flag;
1357 jtf_tasks_pub.p_task_user_hooks.laptop_flag := p_laptop_flag;
1358 jtf_tasks_pub.p_task_user_hooks.device1_flag := p_device1_flag;
1359 jtf_tasks_pub.p_task_user_hooks.device2_flag := p_device2_flag;
1360 jtf_tasks_pub.p_task_user_hooks.device3_flag := p_device3_flag;
1361 jtf_tasks_pub.p_task_user_hooks.costs := p_costs;
1362 jtf_tasks_pub.p_task_user_hooks.currency_code := p_currency_code;
1363 jtf_tasks_pub.p_task_user_hooks.escalation_level := p_escalation_level;
1364 jtf_tasks_pub.p_task_user_hooks.date_selected := l_date_selected;
1365 jtf_tasks_pub.p_task_user_hooks.template_id := p_template_id;
1366 jtf_tasks_pub.p_task_user_hooks.template_group_id := p_template_group_id;
1367 jtf_tasks_pub.p_task_user_hooks.attribute1 := p_attribute1;
1368 jtf_tasks_pub.p_task_user_hooks.attribute2 := p_attribute2;
1369 jtf_tasks_pub.p_task_user_hooks.attribute3 := p_attribute3;
1370 jtf_tasks_pub.p_task_user_hooks.attribute4 := p_attribute4;
1371 jtf_tasks_pub.p_task_user_hooks.attribute5 := p_attribute5;
1372 jtf_tasks_pub.p_task_user_hooks.attribute6 := p_attribute6;
1373 jtf_tasks_pub.p_task_user_hooks.attribute7 := p_attribute7;
1374 jtf_tasks_pub.p_task_user_hooks.attribute8 := p_attribute8;
1375 jtf_tasks_pub.p_task_user_hooks.attribute9 := p_attribute9;
1376 jtf_tasks_pub.p_task_user_hooks.attribute10 := p_attribute10;
1377 jtf_tasks_pub.p_task_user_hooks.attribute11 := p_attribute11;
1378 jtf_tasks_pub.p_task_user_hooks.attribute12 := p_attribute12;
1379 jtf_tasks_pub.p_task_user_hooks.attribute13 := p_attribute13;
1380 jtf_tasks_pub.p_task_user_hooks.attribute14 := p_attribute14;
1381 jtf_tasks_pub.p_task_user_hooks.attribute15 := p_attribute15;
1382 jtf_tasks_pub.p_task_user_hooks.attribute_category := p_attribute_category;
1383 jtf_tasks_pub.p_task_user_hooks.entity := l_entity;
1384 jtf_tasks_pub.p_task_user_hooks.task_confirmation_status := l_task_confirmation_status;
1385 jtf_tasks_pub.p_task_user_hooks.task_confirmation_counter := p_task_confirmation_counter;
1386 jtf_tasks_pub.p_task_user_hooks.task_split_flag := p_task_split_flag;
1387 jtf_tasks_pub.p_task_user_hooks.child_position := p_child_position;
1388 jtf_tasks_pub.p_task_user_hooks.child_sequence_num := p_child_sequence_num;
1389 jtf_tasks_pub.p_task_user_hooks.open_flag := l_open_flag;
1390 jtf_tasks_pub.p_task_user_hooks.location_id := p_location_id;
1391 jtf_tasks_pub.p_task_user_hooks.copied_from_task_id := p_copied_from_task_id;
1392
1393 jtf_tasks_iuhk.create_task_pre(x_return_status);
1394
1395 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1396 x_return_status := fnd_api.g_ret_sts_unexp_error;
1397 RAISE fnd_api.g_exc_unexpected_error;
1398 END IF;
1399
1400 jtf_tasks_pkg.insert_row(
1401 x_rowid => l_rowid
1402 , x_task_id => x_task_id
1403 , x_source_object_id => l_source_object_id
1404 , x_source_object_name => l_source_object_name
1405 , x_duration => l_duration
1406 , x_duration_uom => l_duration_uom
1407 , x_planned_effort => l_planned_effort
1408 , x_planned_effort_uom => l_planned_effort_uom
1409 , x_actual_effort => l_actual_effort
1410 , x_actual_effort_uom => l_actual_effort_uom
1411 , x_percentage_complete => l_percentage_complete
1412 , x_reason_code => l_reason_code
1413 , x_private_flag => p_private_flag
1414 , x_publish_flag => p_publish_flag
1415 , x_restrict_closure_flag => p_restrict_closure_flag
1416 , x_multi_booked_flag => p_multi_booked_flag
1417 , x_milestone_flag => p_milestone_flag
1418 , x_holiday_flag => p_holiday_flag
1419 , x_billable_flag => p_billable_flag
1420 , x_bound_mode_code => p_bound_mode_code
1421 , x_soft_bound_flag => p_soft_bound_flag
1422 , x_workflow_process_id => p_workflow_process_id
1423 , x_costs => p_costs
1424 , x_currency_code => p_currency_code
1425 , x_notification_flag => p_notification_flag
1426 , x_notification_period => p_notification_period
1427 , x_notification_period_uom => p_notification_period_uom
1428 , x_parent_task_id => p_parent_task_id
1429 , x_recurrence_rule_id => NULL
1430 , x_alarm_start => p_alarm_start
1431 , x_alarm_start_uom => p_alarm_start_uom
1432 , x_alarm_on => p_alarm_on
1433 , x_alarm_count => p_alarm_count
1434 , x_alarm_fired_count => NULL
1435 , x_alarm_interval => p_alarm_interval
1436 , x_alarm_interval_uom => p_alarm_interval_uom
1437 , x_deleted_flag => 'N'
1438 , x_palm_flag => p_palm_flag
1439 , x_wince_flag => p_wince_flag
1440 , x_laptop_flag => p_laptop_flag
1441 , x_device1_flag => p_device1_flag
1442 , x_device2_flag => p_device2_flag
1443 , x_device3_flag => p_device3_flag
1444 , x_attribute1 => p_attribute1
1445 , x_attribute2 => p_attribute2
1446 , x_attribute3 => p_attribute3
1447 , x_attribute4 => p_attribute4
1448 , x_attribute5 => p_attribute5
1449 , x_attribute6 => p_attribute6
1450 , x_attribute7 => p_attribute7
1451 , x_attribute8 => p_attribute8
1452 , x_attribute9 => p_attribute9
1453 , x_attribute10 => p_attribute10
1454 , x_attribute11 => p_attribute11
1455 , x_attribute12 => p_attribute12
1456 , x_attribute13 => p_attribute13
1457 , x_attribute14 => p_attribute14
1458 , x_attribute15 => p_attribute15
1459 , x_attribute_category => p_attribute_category
1460 , x_task_number => l_task_number
1461 , x_task_type_id => l_task_type_id
1462 , x_task_status_id => l_task_status_id
1463 , x_task_priority_id => l_task_priority_id
1464 , x_owner_id => l_owner_id
1465 , x_owner_type_code => l_owner_type_code
1466 , x_owner_territory_id => p_owner_territory_id
1467 , x_assigned_by_id => p_assigned_by_id
1468 , x_cust_account_id => p_cust_account_id
1469 , x_customer_id => p_customer_id
1470 , x_address_id => p_address_id
1471 , x_planned_start_date => l_planned_start_date
1472 , x_planned_end_date => l_planned_end_date
1473 , x_scheduled_start_date => l_scheduled_start_date
1474 , x_scheduled_end_date => l_scheduled_end_date
1475 , x_actual_start_date => l_actual_start_date
1476 , x_actual_end_date => l_actual_end_date
1477 , x_source_object_type_code => l_source_object_type_code
1478 , x_timezone_id => p_timezone_id
1479 , x_task_name => p_task_name
1480 , x_description => p_description
1481 , x_creation_date => SYSDATE
1482 , x_created_by => jtf_task_utl.created_by
1483 , x_last_update_date => SYSDATE
1484 , x_last_updated_by => jtf_task_utl.updated_by
1485 , x_last_update_login => jtf_task_utl.login_id
1486 , x_escalation_level => p_escalation_level
1487 , x_calendar_start_date => l_calendar_start_date
1488 , x_calendar_end_date => l_calendar_end_date
1489 , x_date_selected => l_date_selected
1490 , x_template_id => p_template_id
1491 , x_template_group_id => p_template_group_id
1492 , x_open_flag => jtf_task_utl_ext.get_open_flag(l_task_status_id) -- Enhancement# 2666995
1493 , x_entity => l_entity -- enh# 3535354
1494 , x_task_confirmation_status => l_task_confirmation_status
1495 , x_task_confirmation_counter => p_task_confirmation_counter
1496 , x_task_split_flag => p_task_split_flag
1497 , x_child_position => p_child_position
1498 , x_child_sequence_num => p_child_sequence_num
1499 , x_location_id => p_location_id
1500 );
1501
1502 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1503 x_return_status := fnd_api.g_ret_sts_unexp_error;
1504 RAISE fnd_api.g_exc_unexpected_error;
1505 END IF;
1506
1507 -- ------------------------------------------------------------------------
1508 -- Create task assignment for Owner
1509 -- ------------------------------------------------------------------------
1510
1511 -- ------------------------------------------------------------------------
1512 -- Set owner_status_id from profile if not supplied
1513 -- ------------------------------------------------------------------------
1514 IF p_owner_status_id IS NULL OR p_owner_status_id = fnd_api.g_miss_num THEN
1515 -- Added NVL on 04/08/2006 for bug# 5408967
1516 l_owner_status_id := NVL(fnd_profile.VALUE(NAME => 'JTF_TASK_DEFAULT_ASSIGNEE_STATUS'), 3);
1517 ELSE
1518 l_owner_status_id := p_owner_status_id;
1519 END IF;
1520
1521 jtf_task_assignments_pvt.create_task_assignment(
1522 p_api_version => l_api_version
1523 , p_init_msg_list => fnd_api.g_false
1524 , p_commit => fnd_api.g_false
1525 , p_task_assignment_id => l_task_assignment_id
1526 , p_task_id => x_task_id
1527 , p_resource_type_code => l_owner_type_code
1528 , p_resource_id => l_owner_id
1529 , p_actual_effort => l_actual_effort
1530 , p_actual_effort_uom => l_actual_effort_uom
1531 , p_actual_start_date => p_actual_start_date
1532 , p_actual_end_date => p_actual_end_date
1533 , p_palm_flag => p_palm_flag
1534 , p_wince_flag => p_wince_flag
1535 , p_laptop_flag => p_laptop_flag
1536 , p_device1_flag => p_device1_flag
1537 , p_device2_flag => p_device2_flag
1538 , p_device3_flag => p_device3_flag
1539 , p_resource_territory_id => p_owner_territory_id
1540 , p_assignment_status_id => l_owner_status_id
1541 , x_return_status => x_return_status
1542 , x_msg_count => x_msg_count
1543 , x_msg_data => x_msg_data
1544 , x_task_assignment_id => l_task_assignment_id
1545 , p_assignee_role => 'OWNER'
1546 , p_show_on_calendar => l_show_on_calendar
1547 , p_category_id => l_category_id
1548 , p_enable_workflow => l_enable_workflow
1549 , p_abort_workflow => l_abort_workflow
1550 , p_add_option => jtf_task_repeat_appt_pvt.g_one
1551 , p_free_busy_type => l_free_busy_type
1552 );
1553
1554 IF (x_return_status = fnd_api.g_ret_sts_error) THEN
1555 RAISE fnd_api.g_exc_error;
1556 ELSIF(x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
1557 RAISE fnd_api.g_exc_unexpected_error;
1558 END IF;
1559
1560 IF ((p_reference_flag = 'Y') OR(p_reference_flag IS NULL)) THEN
1561 -- ------------------------------------------------------------------------
1562 -- Create reference to source document
1563 -- ------------------------------------------------------------------------
1564 IF l_source_object_type_code IS NOT NULL
1565 AND l_source_object_type_code <> fnd_api.g_miss_char
1566 AND l_source_object_type_code NOT IN('TASK', 'APPOINTMENT', 'EXTERNAL APPOINTMENT') THEN
1567 -- 2102281 -- If condition added to invoke jtf_task_utl.create_party_reference only for type 'PARTY'
1568 IF l_source_object_type_code IN('PARTY') THEN
1569 jtf_task_utl.create_party_reference(
1570 p_reference_from => 'TASK'
1571 , p_task_id => x_task_id
1572 , p_party_id => l_source_object_id
1573 , x_msg_count => x_msg_count
1574 , x_msg_data => x_msg_data
1575 , x_return_status => x_return_status
1576 );
1577 ELSE
1578 jtf_task_utl.g_show_error_for_dup_reference := FALSE;
1579 jtf_task_references_pvt.create_references(
1580 p_api_version => l_api_version
1581 , p_init_msg_list => fnd_api.g_false
1582 , p_commit => fnd_api.g_false
1583 , p_task_id => x_task_id
1584 , p_object_type_code => l_source_object_type_code
1585 , p_object_name => l_source_object_name
1586 , p_object_id => l_source_object_id
1587 , x_return_status => x_return_status
1588 , x_msg_count => x_msg_count
1589 , x_msg_data => x_msg_data
1590 , x_task_reference_id => l_task_reference_id
1591 );
1592 END IF;
1593 END IF;
1594
1595 IF (x_return_status = fnd_api.g_ret_sts_error) THEN
1596 RAISE fnd_api.g_exc_error;
1597 ELSIF(x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
1598 RAISE fnd_api.g_exc_unexpected_error;
1599 END IF;
1600
1601 -- ------------------------------------------------------------------------
1602 -- Create reference to customer, fix for enh #1845501
1603 -- ------------------------------------------------------------------------
1604 jtf_task_utl.create_party_reference(
1605 p_reference_from => 'TASK'
1606 , p_task_id => x_task_id
1607 , p_party_id => p_customer_id
1608 , x_msg_count => x_msg_count
1609 , x_msg_data => x_msg_data
1610 , x_return_status => x_return_status
1611 );
1612
1613 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1614 x_return_status := fnd_api.g_ret_sts_unexp_error;
1615 RAISE fnd_api.g_exc_unexpected_error;
1616 END IF;
1617 END IF; -- of if condition on p_reference_flag
1618
1619 jtf_tasks_iuhk.create_task_post(x_return_status);
1620
1621 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1622 x_return_status := fnd_api.g_ret_sts_unexp_error;
1623 RAISE fnd_api.g_exc_unexpected_error;
1624 END IF;
1625
1626 --BES enh 2391065
1627 IF (l_entity = 'TASK') THEN
1628 l_task_rec_type.task_id := x_task_id;
1629 l_task_rec_type.enable_workflow := l_enable_workflow;
1630 l_task_rec_type.abort_workflow := l_abort_workflow;
1631 l_task_rec_type.source_object_type_code := p_source_object_type_code;
1632 l_task_rec_type.source_object_id := l_source_object_id;
1633 jtf_task_wf_events_pvt.publish_create_task(
1634 p_task_rec => l_task_rec_type
1635 , x_return_status => x_event_return_status
1636 );
1637
1638 IF (x_event_return_status = 'WARNING') THEN
1639 fnd_message.set_name('JTF', 'JTF_TASK_EVENT_WARNING');
1640 fnd_message.set_token('P_TASK_ID', x_task_id);
1641 fnd_msg_pub.ADD;
1642 ELSIF(x_event_return_status = 'ERROR') THEN
1643 fnd_message.set_name('JTF', 'JTF_TASK_EVENT_ERROR');
1644 fnd_message.set_token('P_TASK_ID', x_task_id);
1645 fnd_msg_pub.ADD;
1646 x_return_status := fnd_api.g_ret_sts_unexp_error;
1647 RAISE fnd_api.g_exc_unexpected_error;
1648 END IF;
1649 END IF;
1650
1651 --BES enh 2391065
1652
1653 --Create Task Resource Requirements
1654 OPEN c_type_reqs;
1655
1656 LOOP
1657 FETCH c_type_reqs INTO l_res_type, l_req_units, l_enabled_flag;
1658 EXIT WHEN c_type_reqs%NOTFOUND;
1659 jtf_task_resources_pub.create_task_rsrc_req(
1660 p_api_version => 1.0
1661 , p_init_msg_list => fnd_api.g_false
1662 , p_commit => fnd_api.g_false
1663 , p_task_id => x_task_id
1664 , p_task_template_id => NULL
1665 , p_resource_type_code => l_res_type
1666 , p_required_units => l_req_units
1667 , p_enabled_flag => l_enabled_flag
1668 , x_return_status => x_return_status
1669 , x_msg_count => x_msg_count
1670 , x_msg_data => x_msg_data
1671 , x_resource_req_id => l_resource_req_id
1672 );
1673
1674 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1675 x_return_status := fnd_api.g_ret_sts_unexp_error;
1676 RAISE fnd_api.g_exc_unexpected_error;
1677 END IF;
1678 END LOOP;
1679
1680 CLOSE c_type_reqs;
1681
1682 IF fnd_api.to_boolean(p_commit) THEN
1683 COMMIT WORK;
1684 END IF;
1685
1686 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1687 EXCEPTION
1688 WHEN fnd_api.g_exc_unexpected_error THEN
1689 ROLLBACK TO create_task_pvt;
1690 x_return_status := fnd_api.g_ret_sts_unexp_error;
1691 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1692 WHEN OTHERS THEN
1693 ROLLBACK TO create_task_pvt;
1694 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
1695 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
1696 fnd_msg_pub.ADD;
1697 x_return_status := fnd_api.g_ret_sts_unexp_error;
1698 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1699 END;
1700
1701 -----------------
1702 -----------------
1703 -- old version
1704 PROCEDURE update_task(
1705 p_api_version IN NUMBER
1706 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
1707 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
1708 , p_object_version_number IN OUT NOCOPY NUMBER
1709 , p_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
1710 , p_task_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1711 , p_task_type_id IN NUMBER DEFAULT fnd_api.g_miss_num
1712 , p_description IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1713 , p_task_status_id IN NUMBER DEFAULT fnd_api.g_miss_num
1714 , p_task_priority_id IN NUMBER DEFAULT fnd_api.g_miss_num
1715 , p_owner_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1716 , p_owner_id IN NUMBER DEFAULT fnd_api.g_miss_num
1717 , p_owner_territory_id IN NUMBER DEFAULT fnd_api.g_miss_num
1718 , p_assigned_by_id IN NUMBER DEFAULT fnd_api.g_miss_num
1719 , p_customer_id IN NUMBER DEFAULT fnd_api.g_miss_num
1720 , p_cust_account_id IN NUMBER DEFAULT fnd_api.g_miss_num
1721 , p_address_id IN NUMBER DEFAULT fnd_api.g_miss_num
1722 , ---- hz_party_sites
1723 p_planned_start_date IN DATE DEFAULT fnd_api.g_miss_date
1724 , p_planned_end_date IN DATE DEFAULT fnd_api.g_miss_date
1725 , p_scheduled_start_date IN DATE DEFAULT fnd_api.g_miss_date
1726 , p_scheduled_end_date IN DATE DEFAULT fnd_api.g_miss_date
1727 , p_actual_start_date IN DATE DEFAULT fnd_api.g_miss_date
1728 , p_actual_end_date IN DATE DEFAULT fnd_api.g_miss_date
1729 , p_timezone_id IN NUMBER DEFAULT fnd_api.g_miss_num
1730 , p_source_object_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1731 , p_source_object_id IN NUMBER DEFAULT fnd_api.g_miss_num
1732 , p_source_object_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1733 , p_duration IN NUMBER DEFAULT fnd_api.g_miss_num
1734 , p_duration_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1735 , p_planned_effort IN NUMBER DEFAULT fnd_api.g_miss_num
1736 , p_planned_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1737 , p_actual_effort IN NUMBER DEFAULT fnd_api.g_miss_num
1738 , p_actual_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1739 , p_percentage_complete IN NUMBER DEFAULT fnd_api.g_miss_num
1740 , p_reason_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1741 , p_private_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1742 , p_publish_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1743 , p_restrict_closure_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1744 , p_multi_booked_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1745 , p_milestone_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1746 , p_holiday_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1747 , p_billable_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1748 , p_bound_mode_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1749 , p_soft_bound_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1750 , p_workflow_process_id IN NUMBER DEFAULT fnd_api.g_miss_num
1751 , p_notification_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1752 , p_notification_period IN NUMBER DEFAULT fnd_api.g_miss_num
1753 , p_notification_period_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1754 , p_parent_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
1755 , p_alarm_start IN NUMBER DEFAULT fnd_api.g_miss_num
1756 , p_alarm_start_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1757 , p_alarm_on IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1758 , p_alarm_count IN NUMBER DEFAULT fnd_api.g_miss_num
1759 , p_alarm_fired_count IN NUMBER DEFAULT fnd_api.g_miss_num
1760 , p_alarm_interval IN NUMBER DEFAULT fnd_api.g_miss_num
1761 , p_alarm_interval_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1762 , p_palm_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1763 , p_wince_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1764 , p_laptop_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1765 , p_device1_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1766 , p_device2_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1767 , p_device3_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1768 , p_costs IN NUMBER DEFAULT fnd_api.g_miss_num
1769 , p_currency_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1770 , p_escalation_level IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1771 , x_return_status OUT NOCOPY VARCHAR2
1772 , x_msg_count OUT NOCOPY NUMBER
1773 , x_msg_data OUT NOCOPY VARCHAR2
1774 , p_attribute1 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1775 , p_attribute2 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1776 , p_attribute3 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1777 , p_attribute4 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1778 , p_attribute5 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1779 , p_attribute6 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1780 , p_attribute7 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1781 , p_attribute8 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1782 , p_attribute9 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1783 , p_attribute10 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1784 , p_attribute11 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1785 , p_attribute12 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1786 , p_attribute13 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1787 , p_attribute14 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1788 , p_attribute15 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1789 , p_attribute_category IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1790 , p_date_selected IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1791 , p_category_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
1792 , p_show_on_calendar IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1793 , p_owner_status_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
1794 ) IS
1795 BEGIN
1796 SAVEPOINT update_task_pvt1;
1797 x_return_status := fnd_api.g_ret_sts_success;
1798
1799 IF fnd_api.to_boolean(p_init_msg_list) THEN
1800 fnd_msg_pub.initialize;
1801 END IF;
1802
1803 -- Call the new version
1804 update_task(
1805 p_api_version => p_api_version
1806 , p_init_msg_list => p_init_msg_list
1807 , p_commit => fnd_api.g_false
1808 , -- FALSE
1809 p_object_version_number => p_object_version_number
1810 , p_task_id => p_task_id
1811 , p_task_name => p_task_name
1812 , p_task_type_id => p_task_type_id
1813 , p_description => p_description
1814 , p_task_status_id => p_task_status_id
1815 , p_task_priority_id => p_task_priority_id
1816 , p_owner_type_code => p_owner_type_code
1817 , p_owner_id => p_owner_id
1818 , p_owner_territory_id => p_owner_territory_id
1819 , p_assigned_by_id => p_assigned_by_id
1820 , p_customer_id => p_customer_id
1821 , p_cust_account_id => p_cust_account_id
1822 , p_address_id => p_address_id
1823 , p_planned_start_date => p_planned_start_date
1824 , p_planned_end_date => p_planned_end_date
1825 , p_scheduled_start_date => p_scheduled_start_date
1826 , p_scheduled_end_date => p_scheduled_end_date
1827 , p_actual_start_date => p_actual_start_date
1828 , p_actual_end_date => p_actual_end_date
1829 , p_timezone_id => p_timezone_id
1830 , p_source_object_type_code => p_source_object_type_code
1831 , p_source_object_id => p_source_object_id
1832 , p_source_object_name => p_source_object_name
1833 , p_duration => p_duration
1834 , p_duration_uom => p_duration_uom
1835 , p_planned_effort => p_planned_effort
1836 , p_planned_effort_uom => p_planned_effort_uom
1837 , p_actual_effort => p_actual_effort
1838 , p_actual_effort_uom => p_actual_effort_uom
1839 , p_percentage_complete => p_percentage_complete
1840 , p_reason_code => p_reason_code
1841 , p_private_flag => p_private_flag
1842 , p_publish_flag => p_publish_flag
1843 , p_restrict_closure_flag => p_restrict_closure_flag
1844 , p_multi_booked_flag => p_multi_booked_flag
1845 , p_milestone_flag => p_milestone_flag
1846 , p_holiday_flag => p_holiday_flag
1847 , p_billable_flag => p_billable_flag
1848 , p_bound_mode_code => p_bound_mode_code
1849 , p_soft_bound_flag => p_soft_bound_flag
1850 , p_workflow_process_id => p_workflow_process_id
1851 , p_notification_flag => p_notification_flag
1852 , p_notification_period => p_notification_period
1853 , p_notification_period_uom => p_notification_period_uom
1854 , p_parent_task_id => p_parent_task_id
1855 , p_alarm_start => p_alarm_start
1856 , p_alarm_start_uom => p_alarm_start_uom
1857 , p_alarm_on => p_alarm_on
1858 , p_alarm_count => p_alarm_count
1859 , p_alarm_fired_count => p_alarm_fired_count
1860 , p_alarm_interval => p_alarm_interval
1861 , p_alarm_interval_uom => p_alarm_interval_uom
1862 , p_palm_flag => p_palm_flag
1863 , p_wince_flag => p_wince_flag
1864 , p_laptop_flag => p_laptop_flag
1865 , p_device1_flag => p_device1_flag
1866 , p_device2_flag => p_device2_flag
1867 , p_device3_flag => p_device3_flag
1868 , p_costs => p_costs
1869 , p_currency_code => p_currency_code
1870 , p_escalation_level => p_escalation_level
1871 , x_return_status => x_return_status
1872 , x_msg_count => x_msg_count
1873 , x_msg_data => x_msg_data
1874 , p_attribute1 => p_attribute1
1875 , p_attribute2 => p_attribute2
1876 , p_attribute3 => p_attribute3
1877 , p_attribute4 => p_attribute4
1878 , p_attribute5 => p_attribute5
1879 , p_attribute6 => p_attribute6
1880 , p_attribute7 => p_attribute7
1881 , p_attribute8 => p_attribute8
1882 , p_attribute9 => p_attribute9
1883 , p_attribute10 => p_attribute10
1884 , p_attribute11 => p_attribute11
1885 , p_attribute12 => p_attribute12
1886 , p_attribute13 => p_attribute13
1887 , p_attribute14 => p_attribute14
1888 , p_attribute15 => p_attribute15
1889 , p_attribute_category => p_attribute_category
1890 , p_date_selected => p_date_selected
1891 , p_category_id => p_category_id
1892 , p_show_on_calendar => p_show_on_calendar
1893 , p_owner_status_id => p_owner_status_id
1894 , p_enable_workflow => fnd_profile.VALUE('JTF_TASK_ENABLE_WORKFLOW')
1895 , p_abort_workflow => fnd_profile.VALUE('JTF_TASK_ABORT_PREV_WF')
1896 , p_change_mode => jtf_task_repeat_appt_pvt.g_one
1897 , p_free_busy_type => jtf_task_utl.g_miss_char
1898 );
1899
1900 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
1901 x_return_status := fnd_api.g_ret_sts_unexp_error;
1902 RAISE fnd_api.g_exc_unexpected_error;
1903 END IF;
1904
1905 IF fnd_api.to_boolean(p_commit) THEN
1906 COMMIT WORK;
1907 END IF;
1908
1909 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1910 EXCEPTION
1911 WHEN fnd_api.g_exc_unexpected_error THEN
1912 ROLLBACK TO update_task_pvt1;
1913 x_return_status := fnd_api.g_ret_sts_unexp_error;
1914 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1915 WHEN OTHERS THEN
1916 ROLLBACK TO update_task_pvt1;
1917 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
1918 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
1919 fnd_msg_pub.ADD;
1920 x_return_status := fnd_api.g_ret_sts_unexp_error;
1921 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1922 END;
1923
1924 -- old version
1925 PROCEDURE update_task(
1926 p_api_version IN NUMBER
1927 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
1928 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
1929 , p_object_version_number IN OUT NOCOPY NUMBER
1930 , p_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
1931 , p_task_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1932 , p_task_type_id IN NUMBER DEFAULT fnd_api.g_miss_num
1933 , p_description IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1934 , p_task_status_id IN NUMBER DEFAULT fnd_api.g_miss_num
1935 , p_task_priority_id IN NUMBER DEFAULT fnd_api.g_miss_num
1936 , p_owner_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1937 , p_owner_id IN NUMBER DEFAULT fnd_api.g_miss_num
1938 , p_owner_territory_id IN NUMBER DEFAULT fnd_api.g_miss_num
1939 , p_assigned_by_id IN NUMBER DEFAULT fnd_api.g_miss_num
1940 , p_customer_id IN NUMBER DEFAULT fnd_api.g_miss_num
1941 , p_cust_account_id IN NUMBER DEFAULT fnd_api.g_miss_num
1942 , p_address_id IN NUMBER DEFAULT fnd_api.g_miss_num
1943 , ---- hz_party_sites
1944 p_planned_start_date IN DATE DEFAULT fnd_api.g_miss_date
1945 , p_planned_end_date IN DATE DEFAULT fnd_api.g_miss_date
1946 , p_scheduled_start_date IN DATE DEFAULT fnd_api.g_miss_date
1947 , p_scheduled_end_date IN DATE DEFAULT fnd_api.g_miss_date
1948 , p_actual_start_date IN DATE DEFAULT fnd_api.g_miss_date
1949 , p_actual_end_date IN DATE DEFAULT fnd_api.g_miss_date
1950 , p_timezone_id IN NUMBER DEFAULT fnd_api.g_miss_num
1951 , p_source_object_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1952 , p_source_object_id IN NUMBER DEFAULT fnd_api.g_miss_num
1953 , p_source_object_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1954 , p_duration IN NUMBER DEFAULT fnd_api.g_miss_num
1955 , p_duration_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1956 , p_planned_effort IN NUMBER DEFAULT fnd_api.g_miss_num
1957 , p_planned_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1958 , p_actual_effort IN NUMBER DEFAULT fnd_api.g_miss_num
1959 , p_actual_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1960 , p_percentage_complete IN NUMBER DEFAULT fnd_api.g_miss_num
1961 , p_reason_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1962 , p_private_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1963 , p_publish_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1964 , p_restrict_closure_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1965 , p_multi_booked_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1966 , p_milestone_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1967 , p_holiday_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1968 , p_billable_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1969 , p_bound_mode_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1970 , p_soft_bound_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1971 , p_workflow_process_id IN NUMBER DEFAULT fnd_api.g_miss_num
1972 , p_notification_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1973 , p_notification_period IN NUMBER DEFAULT fnd_api.g_miss_num
1974 , p_notification_period_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1975 , p_parent_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
1976 , p_alarm_start IN NUMBER DEFAULT fnd_api.g_miss_num
1977 , p_alarm_start_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1978 , p_alarm_on IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1979 , p_alarm_count IN NUMBER DEFAULT fnd_api.g_miss_num
1980 , p_alarm_fired_count IN NUMBER DEFAULT fnd_api.g_miss_num
1981 , p_alarm_interval IN NUMBER DEFAULT fnd_api.g_miss_num
1982 , p_alarm_interval_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1983 , p_palm_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1984 , p_wince_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1985 , p_laptop_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1986 , p_device1_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1987 , p_device2_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1988 , p_device3_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1989 , p_costs IN NUMBER DEFAULT fnd_api.g_miss_num
1990 , p_currency_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1991 , p_escalation_level IN VARCHAR2 DEFAULT fnd_api.g_miss_char
1992 , x_return_status OUT NOCOPY VARCHAR2
1993 , x_msg_count OUT NOCOPY NUMBER
1994 , x_msg_data OUT NOCOPY VARCHAR2
1995 , p_attribute1 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1996 , p_attribute2 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1997 , p_attribute3 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1998 , p_attribute4 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
1999 , p_attribute5 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2000 , p_attribute6 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2001 , p_attribute7 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2002 , p_attribute8 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2003 , p_attribute9 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2004 , p_attribute10 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2005 , p_attribute11 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2006 , p_attribute12 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2007 , p_attribute13 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2008 , p_attribute14 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2009 , p_attribute15 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2010 , p_attribute_category IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2011 , p_date_selected IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2012 , p_category_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2013 , p_show_on_calendar IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2014 , p_owner_status_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2015 , p_enable_workflow IN VARCHAR2
2016 , p_abort_workflow IN VARCHAR2
2017 ) IS
2018 BEGIN
2019 SAVEPOINT update_task_pvt2;
2020 x_return_status := fnd_api.g_ret_sts_success;
2021
2022 IF fnd_api.to_boolean(p_init_msg_list) THEN
2023 fnd_msg_pub.initialize;
2024 END IF;
2025
2026 -- Call the new version
2027 update_task(
2028 p_api_version => p_api_version
2029 , p_init_msg_list => p_init_msg_list
2030 , p_commit => fnd_api.g_false
2031 , -- FALSE
2032 p_object_version_number => p_object_version_number
2033 , p_task_id => p_task_id
2034 , p_task_name => p_task_name
2035 , p_task_type_id => p_task_type_id
2036 , p_description => p_description
2037 , p_task_status_id => p_task_status_id
2038 , p_task_priority_id => p_task_priority_id
2039 , p_owner_type_code => p_owner_type_code
2040 , p_owner_id => p_owner_id
2041 , p_owner_territory_id => p_owner_territory_id
2042 , p_assigned_by_id => p_assigned_by_id
2043 , p_customer_id => p_customer_id
2044 , p_cust_account_id => p_cust_account_id
2045 , p_address_id => p_address_id
2046 , p_planned_start_date => p_planned_start_date
2047 , p_planned_end_date => p_planned_end_date
2048 , p_scheduled_start_date => p_scheduled_start_date
2049 , p_scheduled_end_date => p_scheduled_end_date
2050 , p_actual_start_date => p_actual_start_date
2051 , p_actual_end_date => p_actual_end_date
2052 , p_timezone_id => p_timezone_id
2053 , p_source_object_type_code => p_source_object_type_code
2054 , p_source_object_id => p_source_object_id
2055 , p_source_object_name => p_source_object_name
2056 , p_duration => p_duration
2057 , p_duration_uom => p_duration_uom
2058 , p_planned_effort => p_planned_effort
2059 , p_planned_effort_uom => p_planned_effort_uom
2060 , p_actual_effort => p_actual_effort
2061 , p_actual_effort_uom => p_actual_effort_uom
2062 , p_percentage_complete => p_percentage_complete
2063 , p_reason_code => p_reason_code
2064 , p_private_flag => p_private_flag
2065 , p_publish_flag => p_publish_flag
2066 , p_restrict_closure_flag => p_restrict_closure_flag
2067 , p_multi_booked_flag => p_multi_booked_flag
2068 , p_milestone_flag => p_milestone_flag
2069 , p_holiday_flag => p_holiday_flag
2070 , p_billable_flag => p_billable_flag
2071 , p_bound_mode_code => p_bound_mode_code
2072 , p_soft_bound_flag => p_soft_bound_flag
2073 , p_workflow_process_id => p_workflow_process_id
2074 , p_notification_flag => p_notification_flag
2075 , p_notification_period => p_notification_period
2076 , p_notification_period_uom => p_notification_period_uom
2077 , p_parent_task_id => p_parent_task_id
2078 , p_alarm_start => p_alarm_start
2079 , p_alarm_start_uom => p_alarm_start_uom
2080 , p_alarm_on => p_alarm_on
2081 , p_alarm_count => p_alarm_count
2082 , p_alarm_fired_count => p_alarm_fired_count
2083 , p_alarm_interval => p_alarm_interval
2084 , p_alarm_interval_uom => p_alarm_interval_uom
2085 , p_palm_flag => p_palm_flag
2086 , p_wince_flag => p_wince_flag
2087 , p_laptop_flag => p_laptop_flag
2088 , p_device1_flag => p_device1_flag
2089 , p_device2_flag => p_device2_flag
2090 , p_device3_flag => p_device3_flag
2091 , p_costs => p_costs
2092 , p_currency_code => p_currency_code
2093 , p_escalation_level => p_escalation_level
2094 , x_return_status => x_return_status
2095 , x_msg_count => x_msg_count
2096 , x_msg_data => x_msg_data
2097 , p_attribute1 => p_attribute1
2098 , p_attribute2 => p_attribute2
2099 , p_attribute3 => p_attribute3
2100 , p_attribute4 => p_attribute4
2101 , p_attribute5 => p_attribute5
2102 , p_attribute6 => p_attribute6
2103 , p_attribute7 => p_attribute7
2104 , p_attribute8 => p_attribute8
2105 , p_attribute9 => p_attribute9
2106 , p_attribute10 => p_attribute10
2107 , p_attribute11 => p_attribute11
2108 , p_attribute12 => p_attribute12
2109 , p_attribute13 => p_attribute13
2110 , p_attribute14 => p_attribute14
2111 , p_attribute15 => p_attribute15
2112 , p_attribute_category => p_attribute_category
2113 , p_date_selected => p_date_selected
2114 , p_category_id => p_category_id
2115 , p_show_on_calendar => p_show_on_calendar
2116 , p_owner_status_id => p_owner_status_id
2117 , p_enable_workflow => p_enable_workflow
2118 , p_abort_workflow => p_abort_workflow
2119 , p_change_mode => jtf_task_repeat_appt_pvt.g_one
2120 , p_free_busy_type => jtf_task_utl.g_miss_char
2121 );
2122
2123 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
2124 x_return_status := fnd_api.g_ret_sts_unexp_error;
2125 RAISE fnd_api.g_exc_unexpected_error;
2126 END IF;
2127
2128 IF fnd_api.to_boolean(p_commit) THEN
2129 COMMIT WORK;
2130 END IF;
2131
2132 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2133 EXCEPTION
2134 WHEN fnd_api.g_exc_unexpected_error THEN
2135 ROLLBACK TO update_task_pvt2;
2136 x_return_status := fnd_api.g_ret_sts_unexp_error;
2137 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2138 WHEN OTHERS THEN
2139 ROLLBACK TO update_task_pvt2;
2140 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
2141 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
2142 fnd_msg_pub.ADD;
2143 x_return_status := fnd_api.g_ret_sts_unexp_error;
2144 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2145 END;
2146
2147 -- New version which has a workflow enhancement (p_enable_workflow, p_abort_workflow)
2148 PROCEDURE update_task(
2149 p_api_version IN NUMBER
2150 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
2151 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
2152 , p_object_version_number IN OUT NOCOPY NUMBER
2153 , p_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
2154 , p_task_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2155 , p_task_type_id IN NUMBER DEFAULT fnd_api.g_miss_num
2156 , p_description IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2157 , p_task_status_id IN NUMBER DEFAULT fnd_api.g_miss_num
2158 , p_task_priority_id IN NUMBER DEFAULT fnd_api.g_miss_num
2159 , p_owner_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2160 , p_owner_id IN NUMBER DEFAULT fnd_api.g_miss_num
2161 , p_owner_territory_id IN NUMBER DEFAULT fnd_api.g_miss_num
2162 , p_assigned_by_id IN NUMBER DEFAULT fnd_api.g_miss_num
2163 , p_customer_id IN NUMBER DEFAULT fnd_api.g_miss_num
2164 , p_cust_account_id IN NUMBER DEFAULT fnd_api.g_miss_num
2165 , p_address_id IN NUMBER DEFAULT fnd_api.g_miss_num
2166 , ---- hz_party_sites
2167 p_planned_start_date IN DATE DEFAULT fnd_api.g_miss_date
2168 , p_planned_end_date IN DATE DEFAULT fnd_api.g_miss_date
2169 , p_scheduled_start_date IN DATE DEFAULT fnd_api.g_miss_date
2170 , p_scheduled_end_date IN DATE DEFAULT fnd_api.g_miss_date
2171 , p_actual_start_date IN DATE DEFAULT fnd_api.g_miss_date
2172 , p_actual_end_date IN DATE DEFAULT fnd_api.g_miss_date
2173 , p_timezone_id IN NUMBER DEFAULT fnd_api.g_miss_num
2174 , p_source_object_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2175 , p_source_object_id IN NUMBER DEFAULT fnd_api.g_miss_num
2176 , p_source_object_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2177 , p_duration IN NUMBER DEFAULT fnd_api.g_miss_num
2178 , p_duration_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2179 , p_planned_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2180 , p_planned_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2181 , p_actual_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2182 , p_actual_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2183 , p_percentage_complete IN NUMBER DEFAULT fnd_api.g_miss_num
2184 , p_reason_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2185 , p_private_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2186 , p_publish_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2187 , p_restrict_closure_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2188 , p_multi_booked_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2189 , p_milestone_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2190 , p_holiday_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2191 , p_billable_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2192 , p_bound_mode_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2193 , p_soft_bound_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2194 , p_workflow_process_id IN NUMBER DEFAULT fnd_api.g_miss_num
2195 , p_notification_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2196 , p_notification_period IN NUMBER DEFAULT fnd_api.g_miss_num
2197 , p_notification_period_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2198 , p_parent_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
2199 , p_alarm_start IN NUMBER DEFAULT fnd_api.g_miss_num
2200 , p_alarm_start_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2201 , p_alarm_on IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2202 , p_alarm_count IN NUMBER DEFAULT fnd_api.g_miss_num
2203 , p_alarm_fired_count IN NUMBER DEFAULT fnd_api.g_miss_num
2204 , p_alarm_interval IN NUMBER DEFAULT fnd_api.g_miss_num
2205 , p_alarm_interval_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2206 , p_palm_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2207 , p_wince_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2208 , p_laptop_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2209 , p_device1_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2210 , p_device2_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2211 , p_device3_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2212 , p_costs IN NUMBER DEFAULT fnd_api.g_miss_num
2213 , p_currency_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2214 , p_escalation_level IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2215 , x_return_status OUT NOCOPY VARCHAR2
2216 , x_msg_count OUT NOCOPY NUMBER
2217 , x_msg_data OUT NOCOPY VARCHAR2
2218 , p_attribute1 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2219 , p_attribute2 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2220 , p_attribute3 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2221 , p_attribute4 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2222 , p_attribute5 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2223 , p_attribute6 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2224 , p_attribute7 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2225 , p_attribute8 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2226 , p_attribute9 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2227 , p_attribute10 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2228 , p_attribute11 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2229 , p_attribute12 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2230 , p_attribute13 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2231 , p_attribute14 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2232 , p_attribute15 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2233 , p_attribute_category IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2234 , p_date_selected IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2235 , p_category_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2236 , p_show_on_calendar IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2237 , p_owner_status_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2238 , p_enable_workflow IN VARCHAR2
2239 , p_abort_workflow IN VARCHAR2
2240 , p_change_mode IN VARCHAR2
2241 ) IS
2242 BEGIN
2243 SAVEPOINT update_task_pvt3;
2244 x_return_status := fnd_api.g_ret_sts_success;
2245
2246 IF fnd_api.to_boolean(p_init_msg_list) THEN
2247 fnd_msg_pub.initialize;
2248 END IF;
2249
2250 -- Call the new version
2251 update_task(
2252 p_api_version => p_api_version
2253 , p_init_msg_list => p_init_msg_list
2254 , p_commit => fnd_api.g_false
2255 , -- FALSE
2256 p_object_version_number => p_object_version_number
2257 , p_task_id => p_task_id
2258 , p_task_name => p_task_name
2259 , p_task_type_id => p_task_type_id
2260 , p_description => p_description
2261 , p_task_status_id => p_task_status_id
2262 , p_task_priority_id => p_task_priority_id
2263 , p_owner_type_code => p_owner_type_code
2264 , p_owner_id => p_owner_id
2265 , p_owner_territory_id => p_owner_territory_id
2266 , p_assigned_by_id => p_assigned_by_id
2267 , p_customer_id => p_customer_id
2268 , p_cust_account_id => p_cust_account_id
2269 , p_address_id => p_address_id
2270 , p_planned_start_date => p_planned_start_date
2271 , p_planned_end_date => p_planned_end_date
2272 , p_scheduled_start_date => p_scheduled_start_date
2273 , p_scheduled_end_date => p_scheduled_end_date
2274 , p_actual_start_date => p_actual_start_date
2275 , p_actual_end_date => p_actual_end_date
2276 , p_timezone_id => p_timezone_id
2277 , p_source_object_type_code => p_source_object_type_code
2278 , p_source_object_id => p_source_object_id
2279 , p_source_object_name => p_source_object_name
2280 , p_duration => p_duration
2281 , p_duration_uom => p_duration_uom
2282 , p_planned_effort => p_planned_effort
2283 , p_planned_effort_uom => p_planned_effort_uom
2284 , p_actual_effort => p_actual_effort
2285 , p_actual_effort_uom => p_actual_effort_uom
2286 , p_percentage_complete => p_percentage_complete
2287 , p_reason_code => p_reason_code
2288 , p_private_flag => p_private_flag
2289 , p_publish_flag => p_publish_flag
2290 , p_restrict_closure_flag => p_restrict_closure_flag
2291 , p_multi_booked_flag => p_multi_booked_flag
2292 , p_milestone_flag => p_milestone_flag
2293 , p_holiday_flag => p_holiday_flag
2294 , p_billable_flag => p_billable_flag
2295 , p_bound_mode_code => p_bound_mode_code
2296 , p_soft_bound_flag => p_soft_bound_flag
2297 , p_workflow_process_id => p_workflow_process_id
2298 , p_notification_flag => p_notification_flag
2299 , p_notification_period => p_notification_period
2300 , p_notification_period_uom => p_notification_period_uom
2301 , p_parent_task_id => p_parent_task_id
2302 , p_alarm_start => p_alarm_start
2303 , p_alarm_start_uom => p_alarm_start_uom
2304 , p_alarm_on => p_alarm_on
2305 , p_alarm_count => p_alarm_count
2306 , p_alarm_fired_count => p_alarm_fired_count
2307 , p_alarm_interval => p_alarm_interval
2308 , p_alarm_interval_uom => p_alarm_interval_uom
2309 , p_palm_flag => p_palm_flag
2310 , p_wince_flag => p_wince_flag
2311 , p_laptop_flag => p_laptop_flag
2312 , p_device1_flag => p_device1_flag
2313 , p_device2_flag => p_device2_flag
2314 , p_device3_flag => p_device3_flag
2315 , p_costs => p_costs
2316 , p_currency_code => p_currency_code
2317 , p_escalation_level => p_escalation_level
2318 , x_return_status => x_return_status
2319 , x_msg_count => x_msg_count
2320 , x_msg_data => x_msg_data
2321 , p_attribute1 => p_attribute1
2322 , p_attribute2 => p_attribute2
2323 , p_attribute3 => p_attribute3
2324 , p_attribute4 => p_attribute4
2325 , p_attribute5 => p_attribute5
2326 , p_attribute6 => p_attribute6
2327 , p_attribute7 => p_attribute7
2328 , p_attribute8 => p_attribute8
2329 , p_attribute9 => p_attribute9
2330 , p_attribute10 => p_attribute10
2331 , p_attribute11 => p_attribute11
2332 , p_attribute12 => p_attribute12
2333 , p_attribute13 => p_attribute13
2334 , p_attribute14 => p_attribute14
2335 , p_attribute15 => p_attribute15
2336 , p_attribute_category => p_attribute_category
2337 , p_date_selected => p_date_selected
2338 , p_category_id => p_category_id
2339 , p_show_on_calendar => p_show_on_calendar
2340 , p_owner_status_id => p_owner_status_id
2341 , p_enable_workflow => p_enable_workflow
2342 , p_abort_workflow => p_abort_workflow
2343 , p_change_mode => p_change_mode
2344 , p_free_busy_type => jtf_task_utl.g_miss_char
2345 );
2346
2347 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
2348 x_return_status := fnd_api.g_ret_sts_unexp_error;
2349 RAISE fnd_api.g_exc_unexpected_error;
2350 END IF;
2351
2352 IF fnd_api.to_boolean(p_commit) THEN
2353 COMMIT WORK;
2354 END IF;
2355
2356 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2357 EXCEPTION
2358 WHEN fnd_api.g_exc_unexpected_error THEN
2359 ROLLBACK TO update_task_pvt3;
2360 x_return_status := fnd_api.g_ret_sts_unexp_error;
2361 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2362 WHEN OTHERS THEN
2363 ROLLBACK TO update_task_pvt3;
2364 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
2365 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
2366 fnd_msg_pub.ADD;
2367 x_return_status := fnd_api.g_ret_sts_unexp_error;
2368 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2369 END;
2370
2371 -- New version which has a workflow enhancement (p_enable_workflow, p_abort_workflow)
2372 PROCEDURE update_task(
2373 p_api_version IN NUMBER
2374 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
2375 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
2376 , p_object_version_number IN OUT NOCOPY NUMBER
2377 , p_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
2378 , p_task_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2379 , p_task_type_id IN NUMBER DEFAULT fnd_api.g_miss_num
2380 , p_description IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2381 , p_task_status_id IN NUMBER DEFAULT fnd_api.g_miss_num
2382 , p_task_priority_id IN NUMBER DEFAULT fnd_api.g_miss_num
2383 , p_owner_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2384 , p_owner_id IN NUMBER DEFAULT fnd_api.g_miss_num
2385 , p_owner_territory_id IN NUMBER DEFAULT fnd_api.g_miss_num
2386 , p_assigned_by_id IN NUMBER DEFAULT fnd_api.g_miss_num
2387 , p_customer_id IN NUMBER DEFAULT fnd_api.g_miss_num
2388 , p_cust_account_id IN NUMBER DEFAULT fnd_api.g_miss_num
2389 , p_address_id IN NUMBER DEFAULT fnd_api.g_miss_num
2390 , ---- hz_party_sites
2391 p_planned_start_date IN DATE DEFAULT fnd_api.g_miss_date
2392 , p_planned_end_date IN DATE DEFAULT fnd_api.g_miss_date
2393 , p_scheduled_start_date IN DATE DEFAULT fnd_api.g_miss_date
2394 , p_scheduled_end_date IN DATE DEFAULT fnd_api.g_miss_date
2395 , p_actual_start_date IN DATE DEFAULT fnd_api.g_miss_date
2396 , p_actual_end_date IN DATE DEFAULT fnd_api.g_miss_date
2397 , p_timezone_id IN NUMBER DEFAULT fnd_api.g_miss_num
2398 , p_source_object_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2399 , p_source_object_id IN NUMBER DEFAULT fnd_api.g_miss_num
2400 , p_source_object_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2401 , p_duration IN NUMBER DEFAULT fnd_api.g_miss_num
2402 , p_duration_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2403 , p_planned_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2404 , p_planned_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2405 , p_actual_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2406 , p_actual_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2407 , p_percentage_complete IN NUMBER DEFAULT fnd_api.g_miss_num
2408 , p_reason_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2409 , p_private_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2410 , p_publish_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2411 , p_restrict_closure_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2412 , p_multi_booked_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2413 , p_milestone_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2414 , p_holiday_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2415 , p_billable_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2416 , p_bound_mode_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2417 , p_soft_bound_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2418 , p_workflow_process_id IN NUMBER DEFAULT fnd_api.g_miss_num
2419 , p_notification_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2420 , p_notification_period IN NUMBER DEFAULT fnd_api.g_miss_num
2421 , p_notification_period_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2422 , p_parent_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
2423 , p_alarm_start IN NUMBER DEFAULT fnd_api.g_miss_num
2424 , p_alarm_start_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2425 , p_alarm_on IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2426 , p_alarm_count IN NUMBER DEFAULT fnd_api.g_miss_num
2427 , p_alarm_fired_count IN NUMBER DEFAULT fnd_api.g_miss_num
2428 , p_alarm_interval IN NUMBER DEFAULT fnd_api.g_miss_num
2429 , p_alarm_interval_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2430 , p_palm_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2431 , p_wince_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2432 , p_laptop_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2433 , p_device1_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2434 , p_device2_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2435 , p_device3_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2436 , p_costs IN NUMBER DEFAULT fnd_api.g_miss_num
2437 , p_currency_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2438 , p_escalation_level IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2439 , x_return_status OUT NOCOPY VARCHAR2
2440 , x_msg_count OUT NOCOPY NUMBER
2441 , x_msg_data OUT NOCOPY VARCHAR2
2442 , p_attribute1 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2443 , p_attribute2 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2444 , p_attribute3 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2445 , p_attribute4 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2446 , p_attribute5 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2447 , p_attribute6 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2448 , p_attribute7 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2449 , p_attribute8 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2450 , p_attribute9 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2451 , p_attribute10 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2452 , p_attribute11 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2453 , p_attribute12 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2454 , p_attribute13 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2455 , p_attribute14 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2456 , p_attribute15 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2457 , p_attribute_category IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2458 , p_date_selected IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2459 , p_category_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2460 , p_show_on_calendar IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2461 , p_owner_status_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2462 , p_enable_workflow IN VARCHAR2
2463 , p_abort_workflow IN VARCHAR2
2464 , p_change_mode IN VARCHAR2
2465 , p_free_busy_type IN VARCHAR2
2466 ) IS
2467 BEGIN
2468 SAVEPOINT update_task_pvt4;
2469 x_return_status := fnd_api.g_ret_sts_success;
2470
2471 IF fnd_api.to_boolean(p_init_msg_list) THEN
2472 fnd_msg_pub.initialize;
2473 END IF;
2474
2475 -- Call the new version
2476 update_task(
2477 p_api_version => p_api_version
2478 , p_init_msg_list => p_init_msg_list
2479 , p_commit => fnd_api.g_false
2480 , -- FALSE
2481 p_object_version_number => p_object_version_number
2482 , p_task_id => p_task_id
2483 , p_task_name => p_task_name
2484 , p_task_type_id => p_task_type_id
2485 , p_description => p_description
2486 , p_task_status_id => p_task_status_id
2487 , p_task_priority_id => p_task_priority_id
2488 , p_owner_type_code => p_owner_type_code
2489 , p_owner_id => p_owner_id
2490 , p_owner_territory_id => p_owner_territory_id
2491 , p_assigned_by_id => p_assigned_by_id
2492 , p_customer_id => p_customer_id
2493 , p_cust_account_id => p_cust_account_id
2494 , p_address_id => p_address_id
2495 , p_planned_start_date => p_planned_start_date
2496 , p_planned_end_date => p_planned_end_date
2497 , p_scheduled_start_date => p_scheduled_start_date
2498 , p_scheduled_end_date => p_scheduled_end_date
2499 , p_actual_start_date => p_actual_start_date
2500 , p_actual_end_date => p_actual_end_date
2501 , p_timezone_id => p_timezone_id
2502 , p_source_object_type_code => p_source_object_type_code
2503 , p_source_object_id => p_source_object_id
2504 , p_source_object_name => p_source_object_name
2505 , p_duration => p_duration
2506 , p_duration_uom => p_duration_uom
2507 , p_planned_effort => p_planned_effort
2508 , p_planned_effort_uom => p_planned_effort_uom
2509 , p_actual_effort => p_actual_effort
2510 , p_actual_effort_uom => p_actual_effort_uom
2511 , p_percentage_complete => p_percentage_complete
2512 , p_reason_code => p_reason_code
2513 , p_private_flag => p_private_flag
2514 , p_publish_flag => p_publish_flag
2515 , p_restrict_closure_flag => p_restrict_closure_flag
2516 , p_multi_booked_flag => p_multi_booked_flag
2517 , p_milestone_flag => p_milestone_flag
2518 , p_holiday_flag => p_holiday_flag
2519 , p_billable_flag => p_billable_flag
2520 , p_bound_mode_code => p_bound_mode_code
2521 , p_soft_bound_flag => p_soft_bound_flag
2522 , p_workflow_process_id => p_workflow_process_id
2523 , p_notification_flag => p_notification_flag
2524 , p_notification_period => p_notification_period
2525 , p_notification_period_uom => p_notification_period_uom
2526 , p_parent_task_id => p_parent_task_id
2527 , p_alarm_start => p_alarm_start
2528 , p_alarm_start_uom => p_alarm_start_uom
2529 , p_alarm_on => p_alarm_on
2530 , p_alarm_count => p_alarm_count
2531 , p_alarm_fired_count => p_alarm_fired_count
2532 , p_alarm_interval => p_alarm_interval
2533 , p_alarm_interval_uom => p_alarm_interval_uom
2534 , p_palm_flag => p_palm_flag
2535 , p_wince_flag => p_wince_flag
2536 , p_laptop_flag => p_laptop_flag
2537 , p_device1_flag => p_device1_flag
2538 , p_device2_flag => p_device2_flag
2539 , p_device3_flag => p_device3_flag
2540 , p_costs => p_costs
2541 , p_currency_code => p_currency_code
2542 , p_escalation_level => p_escalation_level
2543 , x_return_status => x_return_status
2544 , x_msg_count => x_msg_count
2545 , x_msg_data => x_msg_data
2546 , p_attribute1 => p_attribute1
2547 , p_attribute2 => p_attribute2
2548 , p_attribute3 => p_attribute3
2549 , p_attribute4 => p_attribute4
2550 , p_attribute5 => p_attribute5
2551 , p_attribute6 => p_attribute6
2552 , p_attribute7 => p_attribute7
2553 , p_attribute8 => p_attribute8
2554 , p_attribute9 => p_attribute9
2555 , p_attribute10 => p_attribute10
2556 , p_attribute11 => p_attribute11
2557 , p_attribute12 => p_attribute12
2558 , p_attribute13 => p_attribute13
2559 , p_attribute14 => p_attribute14
2560 , p_attribute15 => p_attribute15
2561 , p_attribute_category => p_attribute_category
2562 , p_date_selected => p_date_selected
2563 , p_category_id => p_category_id
2564 , p_show_on_calendar => p_show_on_calendar
2565 , p_owner_status_id => p_owner_status_id
2566 , p_enable_workflow => p_enable_workflow
2567 , p_abort_workflow => p_abort_workflow
2568 , p_change_mode => p_change_mode
2569 , p_free_busy_type => p_free_busy_type
2570 , --Bug# 3606783.
2571 p_task_confirmation_status => jtf_task_utl.g_miss_char
2572 , p_task_confirmation_counter => jtf_task_utl.g_miss_number
2573 , p_task_split_flag => jtf_task_utl.g_miss_char
2574 , p_child_position => jtf_task_utl.g_miss_char
2575 , p_child_sequence_num => jtf_task_utl.g_miss_number
2576 );
2577
2578 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
2579 x_return_status := fnd_api.g_ret_sts_unexp_error;
2580 RAISE fnd_api.g_exc_unexpected_error;
2581 END IF;
2582
2583 IF fnd_api.to_boolean(p_commit) THEN
2584 COMMIT WORK;
2585 END IF;
2586
2587 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2588 EXCEPTION
2589 WHEN fnd_api.g_exc_unexpected_error THEN
2590 ROLLBACK TO update_task_pvt4;
2591 x_return_status := fnd_api.g_ret_sts_unexp_error;
2592 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2593 WHEN OTHERS THEN
2594 ROLLBACK TO update_task_pvt4;
2595 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
2596 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
2597 fnd_msg_pub.ADD;
2598 x_return_status := fnd_api.g_ret_sts_unexp_error;
2599 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2600 END;
2601
2602 -- Simplex Changes..
2603 PROCEDURE update_task(
2604 p_api_version IN NUMBER
2605 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
2606 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
2607 , p_object_version_number IN OUT NOCOPY NUMBER
2608 , p_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
2609 , p_task_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2610 , p_task_type_id IN NUMBER DEFAULT fnd_api.g_miss_num
2611 , p_description IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2612 , p_task_status_id IN NUMBER DEFAULT fnd_api.g_miss_num
2613 , p_task_priority_id IN NUMBER DEFAULT fnd_api.g_miss_num
2614 , p_owner_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2615 , p_owner_id IN NUMBER DEFAULT fnd_api.g_miss_num
2616 , p_owner_territory_id IN NUMBER DEFAULT fnd_api.g_miss_num
2617 , p_assigned_by_id IN NUMBER DEFAULT fnd_api.g_miss_num
2618 , p_customer_id IN NUMBER DEFAULT fnd_api.g_miss_num
2619 , p_cust_account_id IN NUMBER DEFAULT fnd_api.g_miss_num
2620 , p_address_id IN NUMBER DEFAULT fnd_api.g_miss_num
2621 , ---- hz_party_sites
2622 p_planned_start_date IN DATE DEFAULT fnd_api.g_miss_date
2623 , p_planned_end_date IN DATE DEFAULT fnd_api.g_miss_date
2624 , p_scheduled_start_date IN DATE DEFAULT fnd_api.g_miss_date
2625 , p_scheduled_end_date IN DATE DEFAULT fnd_api.g_miss_date
2626 , p_actual_start_date IN DATE DEFAULT fnd_api.g_miss_date
2627 , p_actual_end_date IN DATE DEFAULT fnd_api.g_miss_date
2628 , p_timezone_id IN NUMBER DEFAULT fnd_api.g_miss_num
2629 , p_source_object_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2630 , p_source_object_id IN NUMBER DEFAULT fnd_api.g_miss_num
2631 , p_source_object_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2632 , p_duration IN NUMBER DEFAULT fnd_api.g_miss_num
2633 , p_duration_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2634 , p_planned_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2635 , p_planned_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2636 , p_actual_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2637 , p_actual_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2638 , p_percentage_complete IN NUMBER DEFAULT fnd_api.g_miss_num
2639 , p_reason_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2640 , p_private_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2641 , p_publish_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2642 , p_restrict_closure_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2643 , p_multi_booked_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2644 , p_milestone_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2645 , p_holiday_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2646 , p_billable_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2647 , p_bound_mode_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2648 , p_soft_bound_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2649 , p_workflow_process_id IN NUMBER DEFAULT fnd_api.g_miss_num
2650 , p_notification_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2651 , p_notification_period IN NUMBER DEFAULT fnd_api.g_miss_num
2652 , p_notification_period_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2653 , p_parent_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
2654 , p_alarm_start IN NUMBER DEFAULT fnd_api.g_miss_num
2655 , p_alarm_start_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2656 , p_alarm_on IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2657 , p_alarm_count IN NUMBER DEFAULT fnd_api.g_miss_num
2658 , p_alarm_fired_count IN NUMBER DEFAULT fnd_api.g_miss_num
2659 , p_alarm_interval IN NUMBER DEFAULT fnd_api.g_miss_num
2660 , p_alarm_interval_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2661 , p_palm_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2662 , p_wince_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2663 , p_laptop_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2664 , p_device1_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2665 , p_device2_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2666 , p_device3_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2667 , p_costs IN NUMBER DEFAULT fnd_api.g_miss_num
2668 , p_currency_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2669 , p_escalation_level IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2670 , x_return_status OUT NOCOPY VARCHAR2
2671 , x_msg_count OUT NOCOPY NUMBER
2672 , x_msg_data OUT NOCOPY VARCHAR2
2673 , p_attribute1 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2674 , p_attribute2 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2675 , p_attribute3 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2676 , p_attribute4 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2677 , p_attribute5 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2678 , p_attribute6 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2679 , p_attribute7 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2680 , p_attribute8 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2681 , p_attribute9 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2682 , p_attribute10 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2683 , p_attribute11 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2684 , p_attribute12 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2685 , p_attribute13 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2686 , p_attribute14 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2687 , p_attribute15 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2688 , p_attribute_category IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2689 , p_date_selected IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2690 , p_category_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2691 , p_show_on_calendar IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2692 , p_owner_status_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2693 , p_enable_workflow IN VARCHAR2
2694 , p_abort_workflow IN VARCHAR2
2695 , p_change_mode IN VARCHAR2
2696 , p_free_busy_type IN VARCHAR2
2697 , p_task_confirmation_status IN VARCHAR2
2698 , p_task_confirmation_counter IN NUMBER
2699 , p_task_split_flag IN VARCHAR2
2700 , p_child_position IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2701 , p_child_sequence_num IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2702 ) IS
2703 BEGIN
2704 SAVEPOINT update_task_pvt5;
2705 x_return_status := fnd_api.g_ret_sts_success;
2706
2707 IF fnd_api.to_boolean(p_init_msg_list) THEN
2708 fnd_msg_pub.initialize;
2709 END IF;
2710
2711 -- Call the new version
2712 update_task(
2713 p_api_version => p_api_version
2714 , p_init_msg_list => p_init_msg_list
2715 , p_commit => fnd_api.g_false
2716 , p_object_version_number => p_object_version_number
2717 , p_task_id => p_task_id
2718 , p_task_name => p_task_name
2719 , p_task_type_id => p_task_type_id
2720 , p_description => p_description
2721 , p_task_status_id => p_task_status_id
2722 , p_task_priority_id => p_task_priority_id
2723 , p_owner_type_code => p_owner_type_code
2724 , p_owner_id => p_owner_id
2725 , p_owner_territory_id => p_owner_territory_id
2726 , p_assigned_by_id => p_assigned_by_id
2727 , p_customer_id => p_customer_id
2728 , p_cust_account_id => p_cust_account_id
2729 , p_address_id => p_address_id
2730 , ---- hz_party_sites
2731 p_planned_start_date => p_planned_start_date
2732 , p_planned_end_date => p_planned_end_date
2733 , p_scheduled_start_date => p_scheduled_start_date
2734 , p_scheduled_end_date => p_scheduled_end_date
2735 , p_actual_start_date => p_actual_start_date
2736 , p_actual_end_date => p_actual_end_date
2737 , p_timezone_id => p_timezone_id
2738 , p_source_object_type_code => p_source_object_type_code
2739 , p_source_object_id => p_source_object_id
2740 , p_source_object_name => p_source_object_name
2741 , p_duration => p_duration
2742 , p_duration_uom => p_duration_uom
2743 , p_planned_effort => p_planned_effort
2744 , p_planned_effort_uom => p_planned_effort_uom
2745 , p_actual_effort => p_actual_effort
2746 , p_actual_effort_uom => p_actual_effort_uom
2747 , p_percentage_complete => p_percentage_complete
2748 , p_reason_code => p_reason_code
2749 , p_private_flag => p_private_flag
2750 , p_publish_flag => p_publish_flag
2751 , p_restrict_closure_flag => p_restrict_closure_flag
2752 , p_multi_booked_flag => p_multi_booked_flag
2753 , p_milestone_flag => p_milestone_flag
2754 , p_holiday_flag => p_holiday_flag
2755 , p_billable_flag => p_billable_flag
2756 , p_bound_mode_code => p_bound_mode_code
2757 , p_soft_bound_flag => p_soft_bound_flag
2758 , p_workflow_process_id => p_workflow_process_id
2759 , p_notification_flag => p_notification_flag
2760 , p_notification_period => p_notification_period
2761 , p_notification_period_uom => p_notification_period_uom
2762 , p_parent_task_id => p_parent_task_id
2763 , p_alarm_start => p_alarm_start
2764 , p_alarm_start_uom => p_alarm_start_uom
2765 , p_alarm_on => p_alarm_on
2766 , p_alarm_count => p_alarm_count
2767 , p_alarm_fired_count => p_alarm_fired_count
2768 , p_alarm_interval => p_alarm_interval
2769 , p_alarm_interval_uom => p_alarm_interval_uom
2770 , p_palm_flag => p_palm_flag
2771 , p_wince_flag => p_wince_flag
2772 , p_laptop_flag => p_laptop_flag
2773 , p_device1_flag => p_device1_flag
2774 , p_device2_flag => p_device2_flag
2775 , p_device3_flag => p_device3_flag
2776 , p_costs => p_costs
2777 , p_currency_code => p_currency_code
2778 , p_escalation_level => p_escalation_level
2779 , x_return_status => x_return_status
2780 , x_msg_count => x_msg_count
2781 , x_msg_data => x_msg_data
2782 , p_attribute1 => p_attribute1
2783 , p_attribute2 => p_attribute2
2784 , p_attribute3 => p_attribute3
2785 , p_attribute4 => p_attribute4
2786 , p_attribute5 => p_attribute5
2787 , p_attribute6 => p_attribute6
2788 , p_attribute7 => p_attribute7
2789 , p_attribute8 => p_attribute8
2790 , p_attribute9 => p_attribute9
2791 , p_attribute10 => p_attribute10
2792 , p_attribute11 => p_attribute11
2793 , p_attribute12 => p_attribute12
2794 , p_attribute13 => p_attribute13
2795 , p_attribute14 => p_attribute14
2796 , p_attribute15 => p_attribute15
2797 , p_attribute_category => p_attribute_category
2798 , p_date_selected => p_date_selected
2799 , p_category_id => p_category_id
2800 , p_show_on_calendar => p_show_on_calendar
2801 , p_owner_status_id => p_owner_status_id
2802 , p_enable_workflow => p_enable_workflow
2803 , p_abort_workflow => p_abort_workflow
2804 , p_change_mode => p_change_mode
2805 , p_free_busy_type => p_free_busy_type
2806 , p_task_confirmation_status => p_task_confirmation_status
2807 , p_task_confirmation_counter => p_task_confirmation_counter
2808 , p_task_split_flag => p_task_split_flag
2809 , p_child_position => p_child_position
2810 , p_child_sequence_num => p_child_sequence_num
2811 , p_location_id => NULL
2812 );
2813
2814 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
2815 x_return_status := fnd_api.g_ret_sts_unexp_error;
2816 RAISE fnd_api.g_exc_unexpected_error;
2817 END IF;
2818
2819 IF fnd_api.to_boolean(p_commit) THEN
2820 COMMIT WORK;
2821 END IF;
2822
2823 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2824 EXCEPTION
2825 WHEN fnd_api.g_exc_unexpected_error THEN
2826 ROLLBACK TO update_task_pvt5;
2827 x_return_status := fnd_api.g_ret_sts_unexp_error;
2828 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2829 WHEN OTHERS THEN
2830 ROLLBACK TO update_task_pvt5;
2831 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
2832 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
2833 fnd_msg_pub.ADD;
2834 x_return_status := fnd_api.g_ret_sts_unexp_error;
2835 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
2836 END;
2837
2838 -- Location Id..
2839 PROCEDURE update_task(
2840 p_api_version IN NUMBER
2841 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
2842 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
2843 , p_object_version_number IN OUT NOCOPY NUMBER
2844 , p_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
2845 , p_task_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2846 , p_task_type_id IN NUMBER DEFAULT fnd_api.g_miss_num
2847 , p_description IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2848 , p_task_status_id IN NUMBER DEFAULT fnd_api.g_miss_num
2849 , p_task_priority_id IN NUMBER DEFAULT fnd_api.g_miss_num
2850 , p_owner_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2851 , p_owner_id IN NUMBER DEFAULT fnd_api.g_miss_num
2852 , p_owner_territory_id IN NUMBER DEFAULT fnd_api.g_miss_num
2853 , p_assigned_by_id IN NUMBER DEFAULT fnd_api.g_miss_num
2854 , p_customer_id IN NUMBER DEFAULT fnd_api.g_miss_num
2855 , p_cust_account_id IN NUMBER DEFAULT fnd_api.g_miss_num
2856 , p_address_id IN NUMBER DEFAULT fnd_api.g_miss_num
2857 , p_planned_start_date IN DATE DEFAULT fnd_api.g_miss_date
2858 , p_planned_end_date IN DATE DEFAULT fnd_api.g_miss_date
2859 , p_scheduled_start_date IN DATE DEFAULT fnd_api.g_miss_date
2860 , p_scheduled_end_date IN DATE DEFAULT fnd_api.g_miss_date
2861 , p_actual_start_date IN DATE DEFAULT fnd_api.g_miss_date
2862 , p_actual_end_date IN DATE DEFAULT fnd_api.g_miss_date
2863 , p_timezone_id IN NUMBER DEFAULT fnd_api.g_miss_num
2864 , p_source_object_type_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2865 , p_source_object_id IN NUMBER DEFAULT fnd_api.g_miss_num
2866 , p_source_object_name IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2867 , p_duration IN NUMBER DEFAULT fnd_api.g_miss_num
2868 , p_duration_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2869 , p_planned_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2870 , p_planned_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2871 , p_actual_effort IN NUMBER DEFAULT fnd_api.g_miss_num
2872 , p_actual_effort_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2873 , p_percentage_complete IN NUMBER DEFAULT fnd_api.g_miss_num
2874 , p_reason_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2875 , p_private_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2876 , p_publish_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2877 , p_restrict_closure_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2878 , p_multi_booked_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2879 , p_milestone_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2880 , p_holiday_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2881 , p_billable_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2882 , p_bound_mode_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2883 , p_soft_bound_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2884 , p_workflow_process_id IN NUMBER DEFAULT fnd_api.g_miss_num
2885 , p_notification_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2886 , p_notification_period IN NUMBER DEFAULT fnd_api.g_miss_num
2887 , p_notification_period_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2888 , p_parent_task_id IN NUMBER DEFAULT fnd_api.g_miss_num
2889 , p_alarm_start IN NUMBER DEFAULT fnd_api.g_miss_num
2890 , p_alarm_start_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2891 , p_alarm_on IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2892 , p_alarm_count IN NUMBER DEFAULT fnd_api.g_miss_num
2893 , p_alarm_fired_count IN NUMBER DEFAULT fnd_api.g_miss_num
2894 , p_alarm_interval IN NUMBER DEFAULT fnd_api.g_miss_num
2895 , p_alarm_interval_uom IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2896 , p_palm_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2897 , p_wince_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2898 , p_laptop_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2899 , p_device1_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2900 , p_device2_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2901 , p_device3_flag IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2902 , p_costs IN NUMBER DEFAULT fnd_api.g_miss_num
2903 , p_currency_code IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2904 , p_escalation_level IN VARCHAR2 DEFAULT fnd_api.g_miss_char
2905 , x_return_status OUT NOCOPY VARCHAR2
2906 , x_msg_count OUT NOCOPY NUMBER
2907 , x_msg_data OUT NOCOPY VARCHAR2
2908 , p_attribute1 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2909 , p_attribute2 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2910 , p_attribute3 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2911 , p_attribute4 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2912 , p_attribute5 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2913 , p_attribute6 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2914 , p_attribute7 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2915 , p_attribute8 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2916 , p_attribute9 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2917 , p_attribute10 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2918 , p_attribute11 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2919 , p_attribute12 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2920 , p_attribute13 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2921 , p_attribute14 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2922 , p_attribute15 IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2923 , p_attribute_category IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2924 , p_date_selected IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2925 , p_category_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2926 , p_show_on_calendar IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2927 , p_owner_status_id IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2928 , p_enable_workflow IN VARCHAR2
2929 , p_abort_workflow IN VARCHAR2
2930 , p_change_mode IN VARCHAR2
2931 , p_free_busy_type IN VARCHAR2
2932 , p_task_confirmation_status IN VARCHAR2
2933 , p_task_confirmation_counter IN NUMBER
2934 , p_task_split_flag IN VARCHAR2
2935 , p_child_position IN VARCHAR2 DEFAULT jtf_task_utl.g_miss_char
2936 , p_child_sequence_num IN NUMBER DEFAULT jtf_task_utl.g_miss_number
2937 , p_location_id IN NUMBER
2938 ) IS
2939 l_task_id jtf_tasks_b.task_id%TYPE;
2940 l_task_number jtf_tasks_b.task_number%TYPE;
2941 l_task_type_id jtf_tasks_b.task_type_id%TYPE;
2942 l_task_status_id jtf_tasks_b.task_status_id%TYPE;
2943 l_task_priority_id jtf_tasks_b.task_priority_id%TYPE;
2944 l_owner_id jtf_tasks_b.owner_id%TYPE;
2945 l_owner_type_code jtf_tasks_b.owner_type_code%TYPE;
2946 l_assigned_by_id jtf_tasks_b.assigned_by_id%TYPE;
2947 l_cust_account_id jtf_tasks_b.cust_account_id%TYPE;
2948 l_customer_id jtf_tasks_b.customer_id%TYPE;
2949 l_address_id jtf_tasks_b.address_id%TYPE;
2950 l_location_id hz_locations.location_id%TYPE;
2951 l_planned_start_date jtf_tasks_b.planned_start_date%TYPE;
2952 l_planned_end_date jtf_tasks_b.planned_end_date%TYPE;
2953 l_scheduled_start_date jtf_tasks_b.scheduled_start_date%TYPE;
2954 l_scheduled_end_date jtf_tasks_b.scheduled_end_date%TYPE;
2955 l_actual_start_date jtf_tasks_b.actual_start_date%TYPE;
2956 l_actual_end_date jtf_tasks_b.actual_end_date%TYPE;
2957 l_source_object_type_code jtf_tasks_b.source_object_type_code%TYPE;
2958 l_timezone_id jtf_tasks_b.timezone_id%TYPE;
2959 l_source_object_id jtf_tasks_b.source_object_id%TYPE;
2960 l_source_object_name jtf_tasks_b.source_object_name%TYPE;
2961 l_duration jtf_tasks_b.DURATION%TYPE;
2962 l_duration_uom jtf_tasks_b.duration_uom%TYPE;
2963 l_planned_effort jtf_tasks_b.planned_effort%TYPE;
2964 l_planned_effort_uom jtf_tasks_b.planned_effort_uom%TYPE;
2965 l_actual_effort jtf_tasks_b.actual_effort%TYPE;
2966 l_actual_effort_uom jtf_tasks_b.actual_effort_uom%TYPE;
2967 l_percentage_complete jtf_tasks_b.percentage_complete%TYPE;
2968 l_reason_code jtf_tasks_b.reason_code%TYPE;
2969 l_private_flag jtf_tasks_b.private_flag%TYPE;
2970 l_publish_flag jtf_tasks_b.publish_flag%TYPE;
2971 l_restrict_closure_flag jtf_tasks_b.restrict_closure_flag%TYPE;
2972 l_multi_booked_flag jtf_tasks_b.multi_booked_flag%TYPE;
2973 l_milestone_flag jtf_tasks_b.milestone_flag%TYPE;
2974 l_holiday_flag jtf_tasks_b.holiday_flag%TYPE;
2975 l_billable_flag jtf_tasks_b.billable_flag%TYPE;
2976 l_bound_mode_code jtf_tasks_b.bound_mode_code%TYPE;
2977 l_soft_bound_flag jtf_tasks_b.soft_bound_flag%TYPE;
2978 l_workflow_process_id jtf_tasks_b.workflow_process_id%TYPE;
2979 l_notification_flag jtf_tasks_b.notification_flag%TYPE;
2980 l_notification_period jtf_tasks_b.notification_period%TYPE;
2981 l_notification_period_uom jtf_tasks_b.notification_period_uom%TYPE;
2982 l_parent_task_id jtf_tasks_b.parent_task_id%TYPE;
2983 l_alarm_start jtf_tasks_b.alarm_start%TYPE;
2984 l_alarm_start_uom jtf_tasks_b.alarm_start_uom%TYPE;
2985 l_alarm_on jtf_tasks_b.alarm_on%TYPE;
2986 l_alarm_count jtf_tasks_b.alarm_count%TYPE;
2987 l_alarm_fired_count jtf_tasks_b.alarm_fired_count%TYPE;
2988 l_alarm_interval jtf_tasks_b.alarm_interval%TYPE;
2989 l_alarm_interval_uom jtf_tasks_b.alarm_interval_uom%TYPE;
2990 l_palm_flag jtf_tasks_b.palm_flag%TYPE;
2991 l_wince_flag jtf_tasks_b.wince_flag%TYPE;
2992 l_laptop_flag jtf_tasks_b.laptop_flag%TYPE;
2993 l_device1_flag jtf_tasks_b.device1_flag%TYPE;
2994 l_device2_flag jtf_tasks_b.device2_flag%TYPE;
2995 l_device3_flag jtf_tasks_b.device3_flag%TYPE;
2996 l_currency_code jtf_tasks_b.currency_code%TYPE;
2997 l_costs jtf_tasks_b.costs%TYPE;
2998 l_org_id jtf_tasks_b.org_id%TYPE;
2999 l_task_name jtf_tasks_tl.task_name%TYPE;
3000 l_description jtf_tasks_tl.description%TYPE;
3001 l_escalation_level jtf_tasks_b.escalation_level%TYPE;
3002 l_calendar_start_date jtf_tasks_b.calendar_start_date%TYPE;
3003 l_calendar_end_date jtf_tasks_b.calendar_end_date%TYPE;
3004 l_date_selected jtf_tasks_b.date_selected%TYPE;
3005 l_owner_status_id jtf_task_assignments.assignment_status_id%TYPE;
3006 l_show_on_calendar jtf_task_assignments.show_on_calendar%TYPE;
3007 l_free_busy_type jtf_task_all_assignments.free_busy_type%TYPE;
3008 l_task_confirmation_status jtf_tasks_b.task_confirmation_status%TYPE;
3009 l_task_confirmation_counter jtf_tasks_b.task_confirmation_counter%TYPE;
3010 l_task_split_flag jtf_tasks_b.task_split_flag%TYPE;
3011 l_enable_workflow VARCHAR2(1) := p_enable_workflow;
3012 l_abort_workflow VARCHAR2(1) := p_abort_workflow;
3013 l_child_position jtf_tasks_b.child_position%TYPE;
3014 l_child_sequence_num jtf_tasks_b.child_sequence_num%TYPE;
3015
3016 CURSOR c_task IS
3017 SELECT task_number
3018 , recurrence_rule_id
3019 , DECODE(p_task_name, fnd_api.g_miss_char, task_name, p_task_name) task_name
3020 , DECODE(p_task_type_id, fnd_api.g_miss_num, task_type_id, p_task_type_id) task_type_id
3021 , DECODE(p_description, fnd_api.g_miss_char, description, p_description) description
3022 , DECODE(p_task_status_id, fnd_api.g_miss_num, task_status_id, p_task_status_id)
3023 task_status_id
3024 , DECODE(p_task_priority_id, fnd_api.g_miss_num, task_priority_id, p_task_priority_id)
3025 task_priority_id
3026 , DECODE(p_owner_type_code, fnd_api.g_miss_char, owner_type_code, p_owner_type_code)
3027 owner_type_code
3028 , DECODE(p_owner_id, fnd_api.g_miss_num, owner_id, p_owner_id) owner_id
3029 , DECODE(
3030 p_owner_territory_id
3031 , fnd_api.g_miss_num, owner_territory_id
3032 , p_owner_territory_id
3033 ) owner_territory_id
3034 , DECODE(p_assigned_by_id, fnd_api.g_miss_num, assigned_by_id, p_assigned_by_id)
3035 assigned_by_id
3036 , DECODE(p_customer_id, fnd_api.g_miss_num, customer_id, p_customer_id) customer_id
3037 , DECODE(p_cust_account_id, fnd_api.g_miss_num, cust_account_id, p_cust_account_id)
3038 cust_account_id
3039 , DECODE(p_address_id, fnd_api.g_miss_num, address_id, p_address_id) address_id
3040 , DECODE(
3041 p_planned_start_date
3042 , fnd_api.g_miss_date, planned_start_date
3043 , p_planned_start_date
3044 ) planned_start_date
3045 , DECODE(p_planned_end_date, fnd_api.g_miss_date, planned_end_date, p_planned_end_date)
3046 planned_end_date
3047 , DECODE(
3048 p_scheduled_start_date
3049 , fnd_api.g_miss_date, scheduled_start_date
3050 , p_scheduled_start_date
3051 ) scheduled_start_date
3052 , DECODE(
3053 p_scheduled_end_date
3054 , fnd_api.g_miss_date, scheduled_end_date
3055 , p_scheduled_end_date
3056 ) scheduled_end_date
3057 , DECODE(
3058 p_actual_start_date
3059 , fnd_api.g_miss_date, actual_start_date
3060 , p_actual_start_date
3061 ) actual_start_date
3062 , DECODE(p_actual_end_date, fnd_api.g_miss_date, actual_end_date, p_actual_end_date)
3063 actual_end_date
3064 , DECODE(p_timezone_id, fnd_api.g_miss_num, timezone_id, p_timezone_id) timezone_id
3065 , DECODE(
3066 p_workflow_process_id
3067 , fnd_api.g_miss_num, workflow_process_id
3068 , p_workflow_process_id
3069 ) workflow_process_id
3070 ,
3071 ---
3072 --- handle NULL like g_miss_value for these three parameters, to fix bug #2002639
3073 ---
3074 DECODE(
3075 p_source_object_type_code
3076 , fnd_api.g_miss_char, source_object_type_code
3077 , NULL, source_object_type_code
3078 , p_source_object_type_code
3079 ) source_object_type_code
3080 , DECODE(
3081 p_source_object_id
3082 , fnd_api.g_miss_num, source_object_id
3083 , NULL, source_object_id
3084 , p_source_object_id
3085 ) source_object_id
3086 ,
3087 ---
3088 --- to fix bug #2224949
3089 ---
3090 DECODE(
3091 p_source_object_name
3092 , fnd_api.g_miss_char, source_object_name
3093 , NULL, source_object_name
3094 , jtf_task_utl.check_truncation(p_source_object_name)
3095 ) source_object_name
3096 , DECODE(p_duration, fnd_api.g_miss_num, DURATION, p_duration) DURATION
3097 , DECODE(p_duration_uom, fnd_api.g_miss_char, duration_uom, p_duration_uom) duration_uom
3098 , DECODE(p_planned_effort, fnd_api.g_miss_num, planned_effort, p_planned_effort)
3099 planned_effort
3100 , DECODE(
3101 p_planned_effort_uom
3102 , fnd_api.g_miss_char, planned_effort_uom
3103 , p_planned_effort_uom
3104 ) planned_effort_uom
3105 , DECODE(p_actual_effort, fnd_api.g_miss_num, actual_effort, p_actual_effort)
3106 actual_effort
3107 , DECODE(
3108 p_actual_effort_uom
3109 , fnd_api.g_miss_char, actual_effort_uom
3110 , p_actual_effort_uom
3111 ) actual_effort_uom
3112 , DECODE(
3113 p_percentage_complete
3114 , fnd_api.g_miss_num, percentage_complete
3115 , p_percentage_complete
3116 ) percentage_complete
3117 , DECODE(p_reason_code, fnd_api.g_miss_char, reason_code, p_reason_code) reason_code
3118 , DECODE(p_private_flag, fnd_api.g_miss_char, private_flag, p_private_flag) private_flag
3119 , DECODE(p_publish_flag, fnd_api.g_miss_char, publish_flag, p_publish_flag) publish_flag
3120 , DECODE(
3121 p_restrict_closure_flag
3122 , fnd_api.g_miss_char, restrict_closure_flag
3123 , p_restrict_closure_flag
3124 ) restrict_closure_flag
3125 , DECODE(
3126 p_multi_booked_flag
3127 , fnd_api.g_miss_char, multi_booked_flag
3128 , p_multi_booked_flag
3129 ) multi_booked_flag
3130 , DECODE(p_milestone_flag, fnd_api.g_miss_char, milestone_flag, p_milestone_flag)
3131 milestone_flag
3132 , DECODE(p_holiday_flag, fnd_api.g_miss_char, holiday_flag, p_holiday_flag) holiday_flag
3133 , DECODE(p_billable_flag, fnd_api.g_miss_char, billable_flag, p_billable_flag)
3134 billable_flag
3135 , DECODE(p_bound_mode_code, fnd_api.g_miss_char, bound_mode_code, p_bound_mode_code)
3136 bound_mode_code
3137 , DECODE(p_soft_bound_flag, fnd_api.g_miss_char, soft_bound_flag, p_soft_bound_flag)
3138 soft_bound_flag
3139 , DECODE(
3140 p_notification_flag
3141 , fnd_api.g_miss_char, notification_flag
3142 , p_notification_flag
3143 ) notification_flag
3144 , DECODE(
3145 p_notification_period
3146 , fnd_api.g_miss_num, notification_period
3147 , p_notification_period
3148 ) notification_period
3149 , DECODE(
3150 p_notification_period_uom
3151 , fnd_api.g_miss_char, notification_period_uom
3152 , p_notification_period_uom
3153 ) notification_period_uom
3154 , DECODE(p_parent_task_id, fnd_api.g_miss_num, parent_task_id, p_parent_task_id)
3155 parent_task_id
3156 , DECODE(p_alarm_start, fnd_api.g_miss_num, alarm_start, p_alarm_start) alarm_start
3157 , DECODE(p_alarm_start_uom, fnd_api.g_miss_char, alarm_start_uom, p_alarm_start_uom)
3158 alarm_start_uom
3159 , DECODE(p_alarm_on, fnd_api.g_miss_char, alarm_on, p_alarm_on) alarm_on
3160 , DECODE(p_alarm_count, fnd_api.g_miss_num, alarm_count, p_alarm_count) alarm_count
3161 , DECODE(
3162 p_alarm_fired_count
3163 , fnd_api.g_miss_num, alarm_fired_count
3164 , p_alarm_fired_count
3165 ) alarm_fired_count
3166 , DECODE(p_alarm_interval, fnd_api.g_miss_num, alarm_interval, p_alarm_interval)
3167 alarm_interval
3168 , DECODE(
3169 p_alarm_interval_uom
3170 , fnd_api.g_miss_char, alarm_interval_uom
3171 , p_alarm_interval_uom
3172 ) alarm_interval_uom
3173 , DECODE(p_palm_flag, fnd_api.g_miss_char, palm_flag, p_palm_flag) palm_flag
3174 , DECODE(p_wince_flag, fnd_api.g_miss_char, wince_flag, p_wince_flag) wince_flag
3175 , DECODE(p_laptop_flag, fnd_api.g_miss_char, laptop_flag, p_laptop_flag) laptop_flag
3176 , DECODE(p_device1_flag, fnd_api.g_miss_char, device1_flag, p_device1_flag) device1_flag
3177 , DECODE(p_device2_flag, fnd_api.g_miss_char, device2_flag, p_device2_flag) device2_flag
3178 , DECODE(p_device3_flag, fnd_api.g_miss_char, device3_flag, p_device3_flag) device3_flag
3179 , DECODE(p_costs, fnd_api.g_miss_num, costs, p_costs) costs
3180 , DECODE(p_currency_code, fnd_api.g_miss_char, currency_code, p_currency_code)
3181 currency_code
3182 , DECODE(p_escalation_level, fnd_api.g_miss_char, escalation_level, p_escalation_level)
3183 escalation_level
3184 , DECODE(p_attribute1, fnd_api.g_miss_char, attribute1, p_attribute1) attribute1
3185 , DECODE(p_attribute2, fnd_api.g_miss_char, attribute2, p_attribute2) attribute2
3186 , DECODE(p_attribute3, fnd_api.g_miss_char, attribute3, p_attribute3) attribute3
3187 , DECODE(p_attribute4, fnd_api.g_miss_char, attribute4, p_attribute4) attribute4
3188 , DECODE(p_attribute5, fnd_api.g_miss_char, attribute5, p_attribute5) attribute5
3189 , DECODE(p_attribute6, fnd_api.g_miss_char, attribute6, p_attribute6) attribute6
3190 , DECODE(p_attribute7, fnd_api.g_miss_char, attribute7, p_attribute7) attribute7
3191 , DECODE(p_attribute8, fnd_api.g_miss_char, attribute8, p_attribute8) attribute8
3192 , DECODE(p_attribute9, fnd_api.g_miss_char, attribute9, p_attribute9) attribute9
3193 , DECODE(p_attribute10, fnd_api.g_miss_char, attribute10, p_attribute10) attribute10
3194 , DECODE(p_attribute11, fnd_api.g_miss_char, attribute11, p_attribute11) attribute11
3195 , DECODE(p_attribute12, fnd_api.g_miss_char, attribute12, p_attribute12) attribute12
3196 , DECODE(p_attribute13, fnd_api.g_miss_char, attribute13, p_attribute13) attribute13
3197 , DECODE(p_attribute14, fnd_api.g_miss_char, attribute14, p_attribute14) attribute14
3198 , DECODE(p_attribute15, fnd_api.g_miss_char, attribute15, p_attribute15) attribute15
3199 , DECODE(
3200 p_attribute_category
3201 , fnd_api.g_miss_char, attribute_category
3202 , p_attribute_category
3203 ) attribute_category
3204 , calendar_start_date
3205 , calendar_end_date
3206 , DURATION duration_orig
3207 , -- XY Story #140
3208 DECODE(p_date_selected, fnd_api.g_miss_char, date_selected, p_date_selected)
3209 date_selected
3210 , creation_date
3211 , DECODE(
3212 p_task_confirmation_status
3213 , jtf_task_utl.g_miss_char, task_confirmation_status
3214 , p_task_confirmation_status
3215 ) task_confirmation_status
3216 , DECODE(
3217 p_task_confirmation_counter
3218 , jtf_task_utl.g_miss_number, task_confirmation_counter
3219 , p_task_confirmation_counter
3220 ) task_confirmation_counter
3221 , DECODE(
3222 p_task_split_flag
3223 , jtf_task_utl.g_miss_char, task_split_flag
3224 , p_task_split_flag
3225 ) task_split_flag
3226 , DECODE(p_child_position, jtf_task_utl.g_miss_char, child_position, p_child_position)
3227 child_position
3228 , DECODE(
3229 p_child_sequence_num
3230 , jtf_task_utl.g_miss_number, child_sequence_num
3231 , p_child_sequence_num
3232 ) child_sequence_num
3233 , DECODE(p_location_id, fnd_api.g_miss_num, location_id, p_location_id) location_id
3234 FROM jtf_tasks_vl
3235 WHERE task_id = p_task_id;
3236
3237 tasks c_task%ROWTYPE;
3238 x NUMBER;
3239
3240 CURSOR task_ass_u(b_task_id IN NUMBER) IS
3241 SELECT task_id
3242 , task_assignment_id
3243 , object_version_number
3244 , DECODE(p_owner_id, fnd_api.g_miss_num, resource_id, p_owner_id) resource_id
3245 , DECODE(p_owner_type_code, fnd_api.g_miss_char, resource_type_code, p_owner_type_code) resource_type_code
3246 , DECODE(
3247 p_owner_territory_id
3248 , fnd_api.g_miss_num, resource_territory_id
3249 , p_owner_territory_id
3250 ) resource_territory_id
3251 , DECODE(l_owner_status_id, fnd_api.g_miss_num, assignment_status_id, l_owner_status_id) assignment_status_id
3252 , DECODE(l_show_on_calendar, fnd_api.g_miss_char, show_on_calendar, l_show_on_calendar) show_on_calendar
3253 , DECODE(p_category_id, jtf_task_utl.g_miss_number, category_id, p_category_id) category_id
3254 , DECODE(p_free_busy_type, jtf_task_utl.g_miss_char, free_busy_type, p_free_busy_type) free_busy_type
3255 FROM jtf_task_all_assignments
3256 WHERE assignee_role = 'OWNER' AND task_id = b_task_id;
3257
3258 task_ass_rec task_ass_u%ROWTYPE;
3259
3260 -- Modified on 19/06/2006 for bug# 5210853
3261 CURSOR task_ass_orig(b_task_id IN NUMBER) IS
3262 SELECT task_id
3263 , assignment_status_id
3264 , show_on_calendar
3265 , category_id
3266 , resource_id
3267 , free_busy_type
3268 , booking_start_date
3269 , booking_end_date
3270 , task_assignment_id
3271 , object_version_number
3272 , actual_start_date
3273 , actual_end_date
3274 , actual_effort
3275 , actual_effort_uom
3276 , actual_travel_duration
3277 , actual_travel_duration_uom
3278 , assignee_role
3279 FROM jtf_task_all_assignments
3280 WHERE task_id = b_task_id
3281 ORDER BY assignee_role DESC;
3282
3283 task_ass_orig_rec task_ass_orig%ROWTYPE;
3284 -- added for Bug 6031383
3285 l_booking_start_date jtf_task_all_assignments.booking_start_date%TYPE;
3286 l_booking_end_date jtf_task_all_assignments.booking_end_date%TYPE;
3287
3288 CURSOR task_cust_orig(b_task_id IN NUMBER) IS
3289 SELECT customer_id
3290 FROM jtf_tasks_b
3291 WHERE task_id = b_task_id;
3292
3293 l_orig_cust_id jtf_tasks_b.customer_id%TYPE;
3294
3295 -- 2102281
3296 CURSOR task_source_orig(b_task_id IN NUMBER) IS
3297 SELECT source_object_id
3298 , source_object_type_code
3299 , entity
3300 , open_flag
3301 FROM jtf_tasks_b
3302 WHERE task_id = b_task_id;
3303
3304 CURSOR c_ref(b_task_id jtf_tasks_b.task_id%TYPE, b_source_id hz_parties.party_id%TYPE) IS
3305 SELECT task_reference_id
3306 , object_version_number
3307 FROM jtf_task_references_b
3308 WHERE task_id = b_task_id AND object_id = b_source_id;
3309
3310 l_orig_source_id jtf_tasks_b.source_object_id%TYPE;
3311 l_orig_source_object_type_code jtf_tasks_b.source_object_type_code%TYPE;
3312 l_entity jtf_tasks_b.entity%TYPE;
3313 l_orig_open_flag jtf_tasks_b.open_flag%TYPE;
3314 l_obj_version_number jtf_task_references_b.object_version_number%TYPE;
3315 l_task_ref_id jtf_task_references_b.task_reference_id%TYPE;
3316
3317 CURSOR c_del_contacts(c_task_id jtf_tasks_b.task_id%TYPE) IS
3318 SELECT task_contact_id
3319 , contact_id
3320 , object_version_number
3321 FROM jtf_task_contacts
3322 WHERE task_id = c_task_id;
3323
3324 l_updated_field_rec jtf_task_repeat_appt_pvt.updated_field_rec;
3325 l_assignee_rec jtf_task_utl.c_assignee_or_owner%ROWTYPE;
3326 --BES enh 2391065
3327 l_task_rec_type_old jtf_tasks_pvt.task_rec_type;
3328 l_task_rec_type_new jtf_tasks_pvt.task_rec_type;
3329 x_task_upd_rec jtf_tasks_pkg.task_upd_rec; --BES enh
3330 x_task_audit_id jtf_task_audits_b.task_audit_id%TYPE;
3331 x_event_return_status VARCHAR2(100);
3332 --BES enh 2391065
3333 BEGIN
3334 SAVEPOINT update_task_pvt;
3335 x_return_status := fnd_api.g_ret_sts_success;
3336
3337 IF fnd_api.to_boolean(p_init_msg_list) THEN
3338 fnd_msg_pub.initialize;
3339 END IF;
3340
3341 IF p_task_name IS NULL THEN
3342 fnd_message.set_name('JTF', 'JTF_TASK_MISSING_NAME');
3343 fnd_msg_pub.ADD;
3344 RAISE fnd_api.g_exc_unexpected_error;
3345 END IF;
3346
3347 IF p_task_split_flag IS NOT NULL THEN
3348 IF NOT p_task_split_flag IN('M', 'D', fnd_api.g_miss_char) THEN
3349 fnd_message.set_name('JTF', 'JTF_TASK_CONSTRUCT_ID');
3350 fnd_message.set_token('%P_SHITF_CONSTRUCT_ID', 'task split flag');
3351 fnd_msg_pub.ADD;
3352 RAISE fnd_api.g_exc_unexpected_error;
3353 END IF;
3354 END IF;
3355
3356 IF NOT p_task_confirmation_status IN('N', 'C', 'R', fnd_api.g_miss_char) THEN
3357 fnd_message.set_name('JTF', 'JTF_TASK_CONSTRUCT_ID');
3358 fnd_message.set_token('%P_SHITF_CONSTRUCT_ID', 'task confirmation status');
3359 fnd_msg_pub.ADD;
3360 RAISE fnd_api.g_exc_unexpected_error;
3361 END IF;
3362
3363 OPEN c_task;
3364 FETCH c_task INTO tasks;
3365 IF c_task%NOTFOUND THEN
3366 CLOSE c_task;
3367 fnd_message.set_name('JTF', 'JTF_TASK_INVALID_TASK_ID');
3368 fnd_message.set_token('P_TASK_ID', p_task_id);
3369 fnd_msg_pub.ADD;
3370 x_return_status := fnd_api.g_ret_sts_unexp_error;
3371 RAISE fnd_api.g_exc_unexpected_error;
3372 END IF;
3373 CLOSE c_task;
3374
3375 -- ------------------------------------------------------------------------
3376 -- Check that the user has the correct security privilege
3377 -- ------------------------------------------------------------------------
3378 jtf_task_utl.check_security_privilege(
3379 p_task_id => p_task_id
3380 , p_session => 'UPDATE'
3381 , x_return_status => x_return_status
3382 );
3383
3384 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3385 x_return_status := fnd_api.g_ret_sts_unexp_error;
3386 RAISE fnd_api.g_exc_unexpected_error;
3387 END IF;
3388
3389 l_task_id := p_task_id;
3390 l_task_name := tasks.task_name;
3391 l_task_number := tasks.task_number;
3392 l_task_type_id := tasks.task_type_id;
3393 l_description := tasks.description;
3394 l_task_status_id := tasks.task_status_id;
3395 l_task_priority_id := tasks.task_priority_id;
3396 l_owner_type_code := tasks.owner_type_code;
3397 l_owner_id := tasks.owner_id;
3398 l_assigned_by_id := tasks.assigned_by_id;
3399 l_customer_id := tasks.customer_id;
3400 l_cust_account_id := tasks.cust_account_id;
3401 l_address_id := tasks.address_id;
3402 l_planned_start_date := tasks.planned_start_date;
3403 l_planned_end_date := tasks.planned_end_date;
3404 l_scheduled_start_date := tasks.scheduled_start_date;
3405 l_scheduled_end_date := tasks.scheduled_end_date;
3406 l_actual_start_date := tasks.actual_start_date;
3407 l_actual_end_date := tasks.actual_end_date;
3408 l_timezone_id := tasks.timezone_id;
3409 l_duration := tasks.DURATION;
3410 l_duration_uom := tasks.duration_uom;
3411 l_planned_effort := tasks.planned_effort;
3412 l_planned_effort_uom := tasks.planned_effort_uom;
3413 l_actual_effort := tasks.actual_effort;
3414 l_actual_effort_uom := tasks.actual_effort_uom;
3415 l_percentage_complete := tasks.percentage_complete;
3416 l_reason_code := tasks.reason_code;
3417 l_private_flag := tasks.private_flag;
3418 l_publish_flag := tasks.publish_flag;
3419 l_restrict_closure_flag := tasks.restrict_closure_flag;
3420 l_multi_booked_flag := tasks.multi_booked_flag;
3421 l_milestone_flag := tasks.milestone_flag;
3422 l_holiday_flag := tasks.holiday_flag;
3423 l_billable_flag := tasks.billable_flag;
3424 l_bound_mode_code := tasks.bound_mode_code;
3425 l_soft_bound_flag := tasks.soft_bound_flag;
3426 l_notification_flag := tasks.notification_flag;
3427 l_notification_period := tasks.notification_period;
3428 l_notification_period_uom := tasks.notification_period_uom;
3429 l_parent_task_id := tasks.parent_task_id;
3430 l_alarm_start := tasks.alarm_start;
3431 l_alarm_start_uom := tasks.alarm_start_uom;
3432 l_alarm_on := tasks.alarm_on;
3433 l_alarm_count := tasks.alarm_count;
3434 l_alarm_fired_count := tasks.alarm_fired_count;
3435 l_alarm_interval := tasks.alarm_interval;
3436 l_alarm_interval_uom := tasks.alarm_interval_uom;
3437 l_palm_flag := tasks.palm_flag;
3438 l_wince_flag := tasks.wince_flag;
3439 l_laptop_flag := tasks.laptop_flag;
3440 l_device1_flag := tasks.device1_flag;
3441 l_device2_flag := tasks.device2_flag;
3442 l_device3_flag := tasks.device3_flag;
3443 l_costs := tasks.costs;
3444 l_currency_code := tasks.currency_code;
3445 l_workflow_process_id := tasks.workflow_process_id;
3446 l_escalation_level := tasks.escalation_level;
3447 l_date_selected := tasks.date_selected;
3448 l_free_busy_type := p_free_busy_type; --Bug No 4269468
3449 l_task_confirmation_status := tasks.task_confirmation_status;
3450 l_task_confirmation_counter := tasks.task_confirmation_counter;
3451 l_task_split_flag := tasks.task_split_flag;
3452 l_child_position := tasks.child_position;
3453 l_child_sequence_num := tasks.child_sequence_num;
3454 l_location_id := tasks.location_id;
3455 -- ------------------------------------------------------------------------
3456 -- Call jtf_task_utl procedure to set calendar_start_date and
3457 -- calendar_end_date
3458 -- ------------------------------------------------------------------------
3459 jtf_task_utl_ext.set_calendar_dates(
3460 p_show_on_calendar => p_show_on_calendar
3461 , p_date_selected => tasks.date_selected
3462 , p_planned_start_date => tasks.planned_start_date
3463 , p_planned_end_date => tasks.planned_end_date
3464 , p_scheduled_start_date => tasks.scheduled_start_date
3465 , p_scheduled_end_date => tasks.scheduled_end_date
3466 , p_actual_start_date => tasks.actual_start_date
3467 , p_actual_end_date => tasks.actual_end_date
3468 , x_show_on_calendar => l_show_on_calendar
3469 , x_date_selected => l_date_selected
3470 , x_calendar_start_date => l_calendar_start_date
3471 , x_calendar_end_date => l_calendar_end_date
3472 , x_return_status => x_return_status
3473 , p_task_status_id => l_task_status_id
3474 , p_creation_date => tasks.creation_date
3475 );
3476
3477 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3478 x_return_status := fnd_api.g_ret_sts_unexp_error;
3479 RAISE fnd_api.g_exc_unexpected_error;
3480 END IF;
3481
3482
3483 -- Bug 2786689 : Fixing Cyclic Task Issue
3484 IF (p_parent_task_id IS NOT NULL AND p_parent_task_id <> fnd_api.g_miss_num) THEN
3485 jtf_task_utl.validate_task(
3486 p_task_id => l_parent_task_id
3487 , p_task_number => NULL
3488 , x_task_id => l_parent_task_id
3489 , x_return_status => x_return_status
3490 );
3491
3492 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3493 x_return_status := fnd_api.g_ret_sts_unexp_error;
3494 RAISE fnd_api.g_exc_unexpected_error;
3495 END IF;
3496
3497 jtf_task_utl_ext.validate_cyclic_task(
3498 p_task_id => l_task_id
3499 , p_parent_task_id => l_parent_task_id
3500 , x_return_status => x_return_status
3501 );
3502
3503 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3504 x_return_status := fnd_api.g_ret_sts_unexp_error;
3505 RAISE fnd_api.g_exc_unexpected_error;
3506 END IF;
3507 END IF;
3508
3509 --- Validate Priority... Bug 3342819
3510 IF (l_task_priority_id = fnd_api.g_miss_num) OR(l_task_priority_id IS NULL) THEN
3511 l_task_priority_id := 8;
3512 END IF;
3513
3514 -- If workflow parameters is either NULL or fnd_api.g_miss_char,
3515 -- profile value for workflow will be used instead
3516 IF p_enable_workflow IS NULL OR p_enable_workflow = fnd_api.g_miss_char THEN
3517 l_enable_workflow := g_enable_workflow;
3518 END IF;
3519
3520 IF p_abort_workflow IS NULL OR p_abort_workflow = fnd_api.g_miss_char THEN
3521 l_abort_workflow := g_abort_workflow;
3522 END IF;
3523
3524 ------------------------------------------------------------
3525 -- Check if this is a repeating appointment
3526 ------------------------------------------------------------
3527 IF tasks.recurrence_rule_id IS NOT NULL
3528 AND (
3529 tasks.source_object_type_code = 'APPOINTMENT'
3530 OR tasks.source_object_type_code = 'EXTERNAL APPOINTMENT'
3531 )
3532 AND NVL(p_change_mode, jtf_task_repeat_appt_pvt.g_skip) <> jtf_task_repeat_appt_pvt.g_skip THEN
3533 l_updated_field_rec.task_id := p_task_id;
3534 l_updated_field_rec.task_name := p_task_name;
3535 l_updated_field_rec.task_type_id := p_task_type_id;
3536 l_updated_field_rec.description := p_description;
3537 l_updated_field_rec.task_status_id := p_task_status_id;
3538 l_updated_field_rec.task_priority_id := p_task_priority_id;
3539 l_updated_field_rec.owner_type_code := p_owner_type_code;
3540 l_updated_field_rec.owner_id := p_owner_id;
3541 l_updated_field_rec.owner_territory_id := p_owner_territory_id;
3542 l_updated_field_rec.assigned_by_id := p_assigned_by_id;
3543 l_updated_field_rec.customer_id := p_customer_id;
3544 l_updated_field_rec.cust_account_id := p_cust_account_id;
3545 l_updated_field_rec.address_id := p_address_id;
3546 l_updated_field_rec.planned_start_date := p_planned_start_date;
3547 l_updated_field_rec.planned_end_date := p_planned_end_date;
3548 l_updated_field_rec.scheduled_start_date := p_scheduled_start_date;
3549 l_updated_field_rec.scheduled_end_date := p_scheduled_end_date;
3550 l_updated_field_rec.actual_start_date := p_actual_start_date;
3551 l_updated_field_rec.actual_end_date := p_actual_end_date;
3552 l_updated_field_rec.timezone_id := p_timezone_id;
3553 l_updated_field_rec.source_object_type_code := p_source_object_type_code;
3554 l_updated_field_rec.source_object_id := p_source_object_id;
3555 l_updated_field_rec.source_object_name := p_source_object_name;
3556 l_updated_field_rec.DURATION := p_duration;
3557 l_updated_field_rec.duration_uom := p_duration_uom;
3558 l_updated_field_rec.planned_effort := p_planned_effort;
3559 l_updated_field_rec.planned_effort_uom := p_planned_effort_uom;
3560 l_updated_field_rec.actual_effort := p_actual_effort;
3561 l_updated_field_rec.actual_effort_uom := p_actual_effort_uom;
3562 l_updated_field_rec.percentage_complete := p_percentage_complete;
3563 l_updated_field_rec.reason_code := p_reason_code;
3564 l_updated_field_rec.private_flag := p_private_flag;
3565 l_updated_field_rec.publish_flag := p_publish_flag;
3566 l_updated_field_rec.restrict_closure_flag := p_restrict_closure_flag;
3567 l_updated_field_rec.multi_booked_flag := p_multi_booked_flag;
3568 l_updated_field_rec.milestone_flag := p_milestone_flag;
3569 l_updated_field_rec.holiday_flag := p_holiday_flag;
3570 l_updated_field_rec.billable_flag := p_billable_flag;
3571 l_updated_field_rec.bound_mode_code := p_bound_mode_code;
3572 l_updated_field_rec.soft_bound_flag := p_soft_bound_flag;
3573 l_updated_field_rec.workflow_process_id := p_workflow_process_id;
3574 l_updated_field_rec.notification_flag := p_notification_flag;
3575 l_updated_field_rec.notification_period := p_notification_period;
3576 l_updated_field_rec.notification_period_uom := p_notification_period_uom;
3577 l_updated_field_rec.parent_task_id := p_parent_task_id;
3578 l_updated_field_rec.alarm_start := p_alarm_start;
3579 l_updated_field_rec.alarm_start_uom := p_alarm_start_uom;
3580 l_updated_field_rec.alarm_on := p_alarm_on;
3581 l_updated_field_rec.alarm_count := p_alarm_count;
3582 l_updated_field_rec.alarm_fired_count := p_alarm_fired_count;
3583 l_updated_field_rec.alarm_interval := p_alarm_interval;
3584 l_updated_field_rec.alarm_interval_uom := p_alarm_interval_uom;
3585 l_updated_field_rec.palm_flag := p_palm_flag;
3586 l_updated_field_rec.wince_flag := p_wince_flag;
3587 l_updated_field_rec.laptop_flag := p_laptop_flag;
3588 l_updated_field_rec.device1_flag := p_device1_flag;
3589 l_updated_field_rec.device2_flag := p_device2_flag;
3590 l_updated_field_rec.device3_flag := p_device3_flag;
3591 l_updated_field_rec.costs := p_costs;
3592 l_updated_field_rec.currency_code := p_currency_code;
3593 l_updated_field_rec.escalation_level := p_escalation_level;
3594 l_updated_field_rec.attribute1 := p_attribute1;
3595 l_updated_field_rec.attribute2 := p_attribute2;
3596 l_updated_field_rec.attribute3 := p_attribute3;
3597 l_updated_field_rec.attribute4 := p_attribute4;
3598 l_updated_field_rec.attribute5 := p_attribute5;
3599 l_updated_field_rec.attribute6 := p_attribute6;
3600 l_updated_field_rec.attribute7 := p_attribute7;
3601 l_updated_field_rec.attribute8 := p_attribute8;
3602 l_updated_field_rec.attribute9 := p_attribute9;
3603 l_updated_field_rec.attribute10 := p_attribute10;
3604 l_updated_field_rec.attribute11 := p_attribute11;
3605 l_updated_field_rec.attribute12 := p_attribute12;
3606 l_updated_field_rec.attribute13 := p_attribute13;
3607 l_updated_field_rec.attribute14 := p_attribute14;
3608 l_updated_field_rec.attribute15 := p_attribute15;
3609 l_updated_field_rec.attribute_category := p_attribute_category;
3610 l_updated_field_rec.date_selected := p_date_selected;
3611 l_updated_field_rec.category_id := p_category_id;
3612 l_updated_field_rec.show_on_calendar := p_show_on_calendar;
3613 l_updated_field_rec.owner_status_id := p_owner_status_id;
3614 l_updated_field_rec.enable_workflow := l_enable_workflow;
3615 l_updated_field_rec.abort_workflow := l_abort_workflow;
3616 l_updated_field_rec.change_mode := p_change_mode;
3617 l_updated_field_rec.recurrence_rule_id := tasks.recurrence_rule_id;
3618 l_updated_field_rec.old_calendar_start_date := tasks.calendar_start_date;
3619 l_updated_field_rec.new_calendar_start_date := l_calendar_start_date;
3620 l_updated_field_rec.new_calendar_end_date := l_calendar_end_date;
3621 l_updated_field_rec.free_busy_type := l_free_busy_type; -- Bug No 4269468
3622 l_updated_field_rec.location_id := p_location_id;
3623 jtf_task_repeat_appt_pvt.update_repeat_appointment
3624 (
3625 p_api_version => 1.0
3626 , p_init_msg_list => fnd_api.g_false
3627 , p_commit => fnd_api.g_false
3628 , p_object_version_number => p_object_version_number
3629 , p_updated_field_rec => l_updated_field_rec
3630 , x_return_status => x_return_status
3631 , x_msg_count => x_msg_count
3632 , x_msg_data => x_msg_data
3633 );
3634
3635 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3636 x_return_status := fnd_api.g_ret_sts_unexp_error;
3637 --RAISE fnd_api.g_exc_unexpected_error;
3638 END IF;
3639
3640 RETURN;
3641 END IF;
3642
3643 -- ------------------------------------------------------------------------
3644 -- If date_selected was not present then set the appropriate dates
3645 -- depending on date_selected returned from set_calendar_dates, to fix
3646 -- bug #1889371
3647 -- ------------------------------------------------------------------------
3648 IF tasks.date_selected IS NULL OR tasks.date_selected = fnd_api.g_miss_char THEN
3649 IF l_date_selected = 'P' THEN
3650 l_planned_start_date := l_calendar_start_date;
3651 l_planned_end_date := l_calendar_end_date;
3652 ELSIF l_date_selected = 'S' THEN
3653 l_scheduled_start_date := l_calendar_start_date;
3654 l_scheduled_end_date := l_calendar_end_date;
3655 ELSIF l_date_selected = 'A' THEN
3656 l_actual_start_date := l_calendar_start_date;
3657 l_actual_end_date := l_calendar_end_date;
3658 END IF;
3659 END IF;
3660
3661 -- ------------------------------------------------------------------------
3662 -- If type is Appointment then set scheduled dates to the value of the
3663 -- planned dates, to fix bug #1889178
3664 -- ------------------------------------------------------------------------
3665 IF p_source_object_type_code = 'APPOINTMENT' THEN
3666 l_scheduled_start_date := l_planned_start_date;
3667 l_scheduled_end_date := l_planned_end_date;
3668 END IF;
3669
3670 -- ------------------------------------------------------------------------
3671 -- If source is Task or Appointment then set source_id to task_id and
3672 -- source_name to task_number
3673 -- Do not update these values if source_object_type_code is not supplied as
3674 -- a parameter to the update, to fix bug #1935825
3675 -- Also retain original values if source_object_type_code is NULL - this is
3676 -- handled in the DECODE above, so no need to check for it here as
3677 -- tasks.source_object_type_code will always have a value.
3678 -- ------------------------------------------------------------------------
3679 IF tasks.source_object_type_code IN('TASK', 'APPOINTMENT') THEN
3680 l_source_object_id := l_task_id;
3681 l_source_object_name := tasks.task_number;
3682 ELSE
3683 l_source_object_id := tasks.source_object_id;
3684 -- Bug 2602732
3685 l_source_object_name :=
3686 jtf_task_utl.check_truncation(jtf_task_utl.get_owner(tasks.source_object_type_code
3687 , l_source_object_id));
3688 END IF;
3689
3690 -- ------------------------------------------------------------------------
3691 -- Get the original customer_id so we can update the reference details if
3692 -- necessary
3693 -- ------------------------------------------------------------------------
3694 OPEN task_cust_orig(l_task_id);
3695 FETCH task_cust_orig INTO l_orig_cust_id;
3696 IF task_cust_orig%NOTFOUND THEN
3697 CLOSE task_cust_orig;
3698 RAISE fnd_api.g_exc_unexpected_error;
3699 END IF;
3700 CLOSE task_cust_orig;
3701
3702 -- 2102281
3703 OPEN task_source_orig(l_task_id);
3704 FETCH task_source_orig INTO l_orig_source_id, l_orig_source_object_type_code, l_entity, l_orig_open_flag;
3705 IF task_source_orig%NOTFOUND THEN
3706 CLOSE task_source_orig;
3707 RAISE fnd_api.g_exc_unexpected_error;
3708 END IF;
3709 CLOSE task_source_orig;
3710
3711 jtf_tasks_pub.p_task_user_hooks.task_id := l_task_id;
3712 jtf_tasks_pub.p_task_user_hooks.task_number := l_task_number;
3713 jtf_tasks_pub.p_task_user_hooks.task_name := l_task_name;
3714 jtf_tasks_pub.p_task_user_hooks.task_type_id := l_task_type_id;
3715 jtf_tasks_pub.p_task_user_hooks.description := l_description;
3716 jtf_tasks_pub.p_task_user_hooks.task_status_id := l_task_status_id;
3717 jtf_tasks_pub.p_task_user_hooks.task_priority_id := l_task_priority_id;
3718 jtf_tasks_pub.p_task_user_hooks.owner_type_code := l_owner_type_code;
3719 jtf_tasks_pub.p_task_user_hooks.owner_id := l_owner_id;
3720 jtf_tasks_pub.p_task_user_hooks.owner_territory_id := tasks.owner_territory_id;
3721 jtf_tasks_pub.p_task_user_hooks.assigned_by_id := l_assigned_by_id;
3722 jtf_tasks_pub.p_task_user_hooks.customer_id := l_customer_id;
3723 jtf_tasks_pub.p_task_user_hooks.cust_account_id := l_cust_account_id;
3724 jtf_tasks_pub.p_task_user_hooks.address_id := l_address_id;
3725 jtf_tasks_pub.p_task_user_hooks.planned_start_date := l_planned_start_date;
3726 jtf_tasks_pub.p_task_user_hooks.planned_end_date := l_planned_end_date;
3727 jtf_tasks_pub.p_task_user_hooks.scheduled_start_date := l_scheduled_start_date;
3728 jtf_tasks_pub.p_task_user_hooks.scheduled_end_date := l_scheduled_end_date;
3729 jtf_tasks_pub.p_task_user_hooks.actual_start_date := l_actual_start_date;
3730 jtf_tasks_pub.p_task_user_hooks.actual_end_date := l_actual_end_date;
3731 jtf_tasks_pub.p_task_user_hooks.timezone_id := l_timezone_id;
3732 jtf_tasks_pub.p_task_user_hooks.source_object_type_code := tasks.source_object_type_code;
3733 jtf_tasks_pub.p_task_user_hooks.source_object_id := l_source_object_id;
3734 jtf_tasks_pub.p_task_user_hooks.source_object_name := l_source_object_name;
3735 jtf_tasks_pub.p_task_user_hooks.DURATION := l_duration;
3736 jtf_tasks_pub.p_task_user_hooks.duration_uom := l_duration_uom;
3737 jtf_tasks_pub.p_task_user_hooks.planned_effort := l_planned_effort;
3738 jtf_tasks_pub.p_task_user_hooks.planned_effort_uom := l_planned_effort_uom;
3739 jtf_tasks_pub.p_task_user_hooks.actual_effort := l_actual_effort;
3740 jtf_tasks_pub.p_task_user_hooks.actual_effort_uom := l_actual_effort_uom;
3741 jtf_tasks_pub.p_task_user_hooks.percentage_complete := l_percentage_complete;
3742 jtf_tasks_pub.p_task_user_hooks.reason_code := l_reason_code;
3743 jtf_tasks_pub.p_task_user_hooks.private_flag := l_private_flag;
3744 jtf_tasks_pub.p_task_user_hooks.publish_flag := l_publish_flag;
3745 jtf_tasks_pub.p_task_user_hooks.restrict_closure_flag := l_restrict_closure_flag;
3746 jtf_tasks_pub.p_task_user_hooks.multi_booked_flag := l_multi_booked_flag;
3747 jtf_tasks_pub.p_task_user_hooks.milestone_flag := l_milestone_flag;
3748 jtf_tasks_pub.p_task_user_hooks.holiday_flag := l_holiday_flag;
3749 jtf_tasks_pub.p_task_user_hooks.billable_flag := l_billable_flag;
3750 jtf_tasks_pub.p_task_user_hooks.bound_mode_code := l_bound_mode_code;
3751 jtf_tasks_pub.p_task_user_hooks.soft_bound_flag := l_soft_bound_flag;
3752 jtf_tasks_pub.p_task_user_hooks.workflow_process_id := l_workflow_process_id;
3753 jtf_tasks_pub.p_task_user_hooks.notification_flag := l_notification_flag;
3754 jtf_tasks_pub.p_task_user_hooks.notification_period := l_notification_period;
3755 jtf_tasks_pub.p_task_user_hooks.notification_period_uom := l_notification_period_uom;
3756 jtf_tasks_pub.p_task_user_hooks.parent_task_id := l_parent_task_id;
3757 jtf_tasks_pub.p_task_user_hooks.alarm_start := l_alarm_start;
3758 jtf_tasks_pub.p_task_user_hooks.alarm_start_uom := l_alarm_start_uom;
3759 jtf_tasks_pub.p_task_user_hooks.alarm_on := l_alarm_on;
3760 jtf_tasks_pub.p_task_user_hooks.alarm_count := l_alarm_count;
3761 jtf_tasks_pub.p_task_user_hooks.alarm_interval := l_alarm_interval;
3762 jtf_tasks_pub.p_task_user_hooks.alarm_interval_uom := l_alarm_interval_uom;
3763 jtf_tasks_pub.p_task_user_hooks.palm_flag := l_palm_flag;
3764 jtf_tasks_pub.p_task_user_hooks.wince_flag := l_wince_flag;
3765 jtf_tasks_pub.p_task_user_hooks.laptop_flag := l_laptop_flag;
3766 jtf_tasks_pub.p_task_user_hooks.device1_flag := l_device1_flag;
3767 jtf_tasks_pub.p_task_user_hooks.device2_flag := l_device2_flag;
3768 jtf_tasks_pub.p_task_user_hooks.device3_flag := l_device3_flag;
3769 jtf_tasks_pub.p_task_user_hooks.costs := l_costs;
3770 jtf_tasks_pub.p_task_user_hooks.currency_code := l_currency_code;
3771 jtf_tasks_pub.p_task_user_hooks.escalation_level := l_escalation_level;
3772 jtf_tasks_pub.p_task_user_hooks.date_selected := l_date_selected;
3773 jtf_tasks_pub.p_task_user_hooks.attribute1 := tasks.attribute1;
3774 jtf_tasks_pub.p_task_user_hooks.attribute2 := tasks.attribute2;
3775 jtf_tasks_pub.p_task_user_hooks.attribute3 := tasks.attribute3;
3776 jtf_tasks_pub.p_task_user_hooks.attribute4 := tasks.attribute4;
3777 jtf_tasks_pub.p_task_user_hooks.attribute5 := tasks.attribute5;
3778 jtf_tasks_pub.p_task_user_hooks.attribute6 := tasks.attribute6;
3779 jtf_tasks_pub.p_task_user_hooks.attribute7 := tasks.attribute7;
3780 jtf_tasks_pub.p_task_user_hooks.attribute8 := tasks.attribute8;
3781 jtf_tasks_pub.p_task_user_hooks.attribute9 := tasks.attribute9;
3782 jtf_tasks_pub.p_task_user_hooks.attribute10 := tasks.attribute10;
3783 jtf_tasks_pub.p_task_user_hooks.attribute11 := tasks.attribute11;
3784 jtf_tasks_pub.p_task_user_hooks.attribute12 := tasks.attribute12;
3785 jtf_tasks_pub.p_task_user_hooks.attribute13 := tasks.attribute13;
3786 jtf_tasks_pub.p_task_user_hooks.attribute14 := tasks.attribute14;
3787 jtf_tasks_pub.p_task_user_hooks.attribute15 := tasks.attribute15;
3788 jtf_tasks_pub.p_task_user_hooks.attribute_category := tasks.attribute_category;
3789 jtf_tasks_pub.p_task_user_hooks.entity := l_entity;
3790 jtf_tasks_pub.p_task_user_hooks.task_confirmation_status := l_task_confirmation_status;
3791 jtf_tasks_pub.p_task_user_hooks.task_confirmation_counter := l_task_confirmation_counter;
3792 jtf_tasks_pub.p_task_user_hooks.task_split_flag := l_task_split_flag;
3793 jtf_tasks_pub.p_task_user_hooks.child_position := l_child_position;
3794 jtf_tasks_pub.p_task_user_hooks.child_sequence_num := l_child_sequence_num;
3795 jtf_tasks_pub.p_task_user_hooks.open_flag := l_orig_open_flag;
3796 jtf_tasks_pub.p_task_user_hooks.location_id := l_location_id;
3797 jtf_tasks_iuhk.update_task_pre(x_return_status);
3798
3799 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3800 x_return_status := fnd_api.g_ret_sts_unexp_error;
3801 RAISE fnd_api.g_exc_unexpected_error;
3802 END IF;
3803
3804 jtf_tasks_pub.lock_task(
3805 p_api_version => 1.0
3806 , p_init_msg_list => fnd_api.g_false
3807 , p_commit => fnd_api.g_false
3808 , p_task_id => l_task_id
3809 , p_object_version_number => p_object_version_number
3810 , x_return_status => x_return_status
3811 , x_msg_data => x_msg_data
3812 , x_msg_count => x_msg_count
3813 );
3814
3815 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
3816 x_return_status := fnd_api.g_ret_sts_unexp_error;
3817 RAISE fnd_api.g_exc_unexpected_error;
3818 END IF;
3819
3820 ---------------------------------------------------------
3821 -- When a user update repeating task for all the future
3822 -- appointment, then we create a new recurrence rule.
3823 -- In this case we need to update the recurrence_rule_id
3824 -- for all the future appointment.
3825 ---------------------------------------------------------
3826 --BES changes to call the new jtf_tasks_pkg.update_row
3827 x_task_upd_rec.task_id := l_task_id;
3828 x_task_upd_rec.object_version_number := p_object_version_number + 1;
3829 x_task_upd_rec.laptop_flag := l_laptop_flag;
3830 x_task_upd_rec.device1_flag := l_device1_flag;
3831 x_task_upd_rec.device2_flag := l_device2_flag;
3832 x_task_upd_rec.device3_flag := l_device3_flag;
3833 x_task_upd_rec.currency_code := l_currency_code;
3834 x_task_upd_rec.costs := l_costs;
3835 x_task_upd_rec.attribute1 := tasks.attribute1;
3836 x_task_upd_rec.attribute2 := tasks.attribute2;
3837 x_task_upd_rec.attribute3 := tasks.attribute3;
3838 x_task_upd_rec.attribute4 := tasks.attribute4;
3839 x_task_upd_rec.attribute5 := tasks.attribute5;
3840 x_task_upd_rec.attribute6 := tasks.attribute6;
3841 x_task_upd_rec.attribute7 := tasks.attribute7;
3842 x_task_upd_rec.attribute8 := tasks.attribute8;
3843 x_task_upd_rec.attribute9 := tasks.attribute9;
3844 x_task_upd_rec.attribute10 := tasks.attribute10;
3845 x_task_upd_rec.attribute11 := tasks.attribute11;
3846 x_task_upd_rec.attribute12 := tasks.attribute12;
3847 x_task_upd_rec.attribute13 := tasks.attribute13;
3848 x_task_upd_rec.attribute14 := tasks.attribute14;
3849 x_task_upd_rec.attribute15 := tasks.attribute15;
3850 x_task_upd_rec.attribute_category := tasks.attribute_category;
3851 x_task_upd_rec.task_number := l_task_number;
3852 x_task_upd_rec.task_type_id := l_task_type_id;
3853 x_task_upd_rec.task_status_id := l_task_status_id;
3854 x_task_upd_rec.task_priority_id := l_task_priority_id;
3855 x_task_upd_rec.owner_id := l_owner_id;
3856 x_task_upd_rec.owner_type_code := l_owner_type_code;
3857 x_task_upd_rec.owner_territory_id := tasks.owner_territory_id;
3858 x_task_upd_rec.assigned_by_id := l_assigned_by_id;
3859 x_task_upd_rec.cust_account_id := l_cust_account_id;
3860 x_task_upd_rec.customer_id := l_customer_id;
3861 x_task_upd_rec.address_id := l_address_id;
3862 x_task_upd_rec.planned_start_date := l_planned_start_date;
3863 x_task_upd_rec.planned_end_date := l_planned_end_date;
3864 x_task_upd_rec.scheduled_start_date := l_scheduled_start_date;
3865 x_task_upd_rec.scheduled_end_date := l_scheduled_end_date;
3866 x_task_upd_rec.actual_start_date := l_actual_start_date;
3867 x_task_upd_rec.actual_end_date := l_actual_end_date;
3868 x_task_upd_rec.source_object_type_code := tasks.source_object_type_code;
3869 x_task_upd_rec.timezone_id := l_timezone_id;
3870 x_task_upd_rec.source_object_id := l_source_object_id;
3871 x_task_upd_rec.source_object_name := l_source_object_name;
3872 x_task_upd_rec.DURATION := l_duration;
3873 x_task_upd_rec.duration_uom := l_duration_uom;
3874 x_task_upd_rec.planned_effort := l_planned_effort;
3875 x_task_upd_rec.planned_effort_uom := l_planned_effort_uom;
3876 x_task_upd_rec.actual_effort := l_actual_effort;
3877 x_task_upd_rec.actual_effort_uom := l_actual_effort_uom;
3878 x_task_upd_rec.percentage_complete := l_percentage_complete;
3879 x_task_upd_rec.reason_code := l_reason_code;
3880 x_task_upd_rec.private_flag := l_private_flag;
3881 x_task_upd_rec.publish_flag := l_publish_flag;
3882 x_task_upd_rec.restrict_closure_flag := l_restrict_closure_flag;
3883 x_task_upd_rec.multi_booked_flag := l_multi_booked_flag;
3884 x_task_upd_rec.milestone_flag := l_milestone_flag;
3885 x_task_upd_rec.holiday_flag := l_holiday_flag;
3886 x_task_upd_rec.billable_flag := l_billable_flag;
3887 x_task_upd_rec.bound_mode_code := l_bound_mode_code;
3888 x_task_upd_rec.soft_bound_flag := l_soft_bound_flag;
3889 x_task_upd_rec.workflow_process_id := l_workflow_process_id;
3890 x_task_upd_rec.notification_flag := l_notification_flag;
3891 x_task_upd_rec.notification_period := l_notification_period;
3892 x_task_upd_rec.notification_period_uom := l_notification_period_uom;
3893 x_task_upd_rec.parent_task_id := l_parent_task_id;
3894 x_task_upd_rec.recurrence_rule_id := tasks.recurrence_rule_id;
3895 x_task_upd_rec.alarm_start := l_alarm_start;
3896 x_task_upd_rec.alarm_start_uom := l_alarm_start_uom;
3897 x_task_upd_rec.alarm_on := l_alarm_on;
3898 x_task_upd_rec.alarm_count := l_alarm_count;
3899 x_task_upd_rec.alarm_fired_count := l_alarm_fired_count;
3900 x_task_upd_rec.alarm_interval := l_alarm_interval;
3901 x_task_upd_rec.alarm_interval_uom := l_alarm_interval_uom;
3902 x_task_upd_rec.deleted_flag := 'N';
3903 x_task_upd_rec.palm_flag := l_palm_flag;
3904 x_task_upd_rec.wince_flag := l_wince_flag;
3905 x_task_upd_rec.task_name := l_task_name;
3906 x_task_upd_rec.description := l_description;
3907 x_task_upd_rec.last_update_date := SYSDATE;
3908 x_task_upd_rec.last_updated_by := jtf_task_utl.updated_by;
3909 x_task_upd_rec.last_update_login := jtf_task_utl.login_id;
3910 x_task_upd_rec.escalation_level := l_escalation_level;
3911 x_task_upd_rec.calendar_start_date := l_calendar_start_date;
3912 x_task_upd_rec.calendar_end_date := l_calendar_end_date;
3913 x_task_upd_rec.date_selected := l_date_selected;
3914 x_task_upd_rec.open_flag := jtf_task_utl_ext.get_open_flag(l_task_status_id);
3915 x_task_upd_rec.task_confirmation_status := l_task_confirmation_status;
3916 x_task_upd_rec.task_confirmation_counter := l_task_confirmation_counter;
3917 x_task_upd_rec.task_split_flag := l_task_split_flag;
3918 x_task_upd_rec.child_position := l_child_position;
3919 x_task_upd_rec.child_sequence_num := l_child_sequence_num;
3920 x_task_upd_rec.location_id := l_location_id;
3921 jtf_tasks_pkg.update_row(p_task_upd_rec => x_task_upd_rec, p_task_audit_id => x_task_audit_id);
3922
3923 l_owner_status_id := p_owner_status_id;
3924
3925 -- ------------------------------------------------------------------------
3926 -- Update task assignment for Owner if changed
3927 -- ------------------------------------------------------------------------
3928 OPEN task_ass_orig(l_task_id);
3929 FETCH task_ass_orig INTO task_ass_orig_rec;
3930 IF ((task_ass_orig%NOTFOUND) OR(task_ass_orig_rec.assignee_role <> 'OWNER')) THEN
3931 CLOSE task_ass_orig; -- Fix a missing CLOSE on 4/18/2002
3932
3933 fnd_message.set_name('JTF', 'JTF_TASK_MISSING_OWNER_ASG');
3934 fnd_msg_pub.ADD;
3935 x_return_status := fnd_api.g_ret_sts_unexp_error;
3936 RAISE fnd_api.g_exc_unexpected_error;
3937 END IF;
3938
3939 -- CLOSE task_ass_orig; -- Fix a missing CLOSE on 4/18/2002 -- Commented out on 19/06/2006 for bug# 5210853
3940 IF (
3941 NVL(p_owner_id, 0) <> fnd_api.g_miss_num
3942 AND NVL(p_owner_id, 0) <> task_ass_orig_rec.resource_id
3943 )
3944 OR (
3945 NVL(p_category_id, 0) <> jtf_task_utl.g_miss_number
3946 AND NVL(p_category_id, 0) <> NVL(task_ass_orig_rec.category_id, 0)
3947 )
3948 OR (
3949 NVL(l_show_on_calendar, 'X') <> fnd_api.g_miss_char
3950 AND NVL(l_show_on_calendar, 'X') <> NVL(task_ass_orig_rec.show_on_calendar, 'X')
3951 )
3952 OR (
3953 NVL(x_task_upd_rec.open_flag, 'X') <> fnd_api.g_miss_char
3954 AND NVL(x_task_upd_rec.open_flag, 'X') <> NVL(l_orig_open_flag, 'X')
3955 )
3956 OR (
3957 NVL(l_free_busy_type, 'X') <> jtf_task_utl.g_miss_char
3958 AND NVL(l_free_busy_type, 'X') <> NVL(task_ass_orig_rec.free_busy_type, 'X')
3959 )
3960 OR
3961 -- Commented out this part of the code since it's no more required after fixing bug# 5210853
3962 /* --Added by SBARAT on 26/04/2005 for Bug# 4122322
3963 (nvl(p_scheduled_start_date, sysdate) <> fnd_api.g_miss_date and
3964 nvl(p_scheduled_start_date, sysdate) <> nvl(task_ass_orig_rec.booking_start_date, sysdate)) or
3965 (nvl(p_scheduled_end_date, sysdate) <> fnd_api.g_miss_date and
3966 nvl(p_scheduled_end_date, sysdate) <> nvl(task_ass_orig_rec.booking_end_date, sysdate)) or
3967 --End of addition by SBARAT on 26/04/2005 for Bug# 4122322 */
3968
3969 -- Start of addition on 19/06/2006 for bug# 5210853
3970 (
3971 (
3972 (NVL(l_calendar_start_date, SYSDATE) <> NVL(tasks.calendar_start_date, SYSDATE))
3973 OR (NVL(l_calendar_end_date, SYSDATE) <> NVL(tasks.calendar_end_date, SYSDATE))
3974 )
3975 AND (
3976 (task_ass_orig_rec.actual_start_date IS NULL)
3977 OR (task_ass_orig_rec.actual_end_date IS NULL)
3978 )
3979 )
3980 OR (NVL(l_actual_start_date, SYSDATE) <> NVL(task_ass_orig_rec.actual_start_date, SYSDATE))
3981 OR (NVL(l_actual_end_date, SYSDATE) <> NVL(task_ass_orig_rec.actual_end_date, SYSDATE))
3982 OR
3983 -- End of addition on 19/06/2006 for bug# 5210853
3984 (
3985 NVL(l_owner_status_id, 0) <> fnd_api.g_miss_num
3986 AND NVL(l_owner_status_id, 0) <> NVL(task_ass_orig_rec.assignment_status_id, 0)
3987 ) THEN
3988 OPEN task_ass_u(l_task_id);
3989
3990 FETCH task_ass_u
3991 INTO task_ass_rec;
3992
3993 IF task_ass_u%NOTFOUND THEN
3994 CLOSE task_ass_orig;
3995
3996 CLOSE task_ass_u; -- Fix a missing CLOSE on 4/18/2002
3997
3998 fnd_message.set_name('JTF', 'JTF_TASK_MISSING_OWNER_ASG');
3999 fnd_msg_pub.ADD;
4000 x_return_status := fnd_api.g_ret_sts_unexp_error;
4001 RAISE fnd_api.g_exc_unexpected_error;
4002 END IF;
4003
4004 CLOSE task_ass_u; -- Fix a missing CLOSE on 4/18/2002
4005
4006 jtf_task_assignments_pvt.g_response_flag := jtf_task_utl.g_yes_char; -- Fix bug# 2375153
4007 jtf_task_assignments_pvt.update_task_assignment(
4008 p_api_version => p_api_version
4009 , p_object_version_number => task_ass_rec.object_version_number
4010 , p_init_msg_list => fnd_api.g_false
4011 , p_commit => fnd_api.g_false
4012 , p_task_assignment_id => task_ass_rec.task_assignment_id
4013 , p_actual_start_date => l_actual_start_date
4014 , p_actual_end_date => l_actual_end_date
4015 , p_palm_flag => l_palm_flag
4016 , p_wince_flag => l_wince_flag
4017 , p_laptop_flag => l_laptop_flag
4018 , p_device1_flag => l_device1_flag
4019 , p_device2_flag => l_device2_flag
4020 , p_device3_flag => l_device3_flag
4021 , p_resource_id => task_ass_rec.resource_id
4022 , p_actual_effort => l_actual_effort
4023 , p_actual_effort_uom => l_actual_effort_uom
4024 , p_resource_type_code => task_ass_rec.resource_type_code
4025 , p_resource_territory_id => task_ass_rec.resource_territory_id
4026 , p_assignment_status_id => task_ass_rec.assignment_status_id
4027 , x_msg_data => x_msg_data
4028 , x_msg_count => x_msg_count
4029 , x_return_status => x_return_status
4030 , p_assignee_role => 'OWNER'
4031 , p_show_on_calendar => task_ass_rec.show_on_calendar
4032 , p_category_id => task_ass_rec.category_id
4033 , p_enable_workflow => l_enable_workflow
4034 , p_abort_workflow => l_abort_workflow
4035 , p_free_busy_type => task_ass_rec.free_busy_type
4036 );
4037 /*************************************************************************
4038 -- Bug 2467222 for assignee category update
4039 OPEN jtf_task_utl.c_assignee_or_owner (l_task_id,p_category_id);
4040 FETCH jtf_task_utl.c_assignee_or_owner INTO l_assignee_rec;
4041 CLOSE jtf_task_utl.c_assignee_or_owner;
4042
4043 jtf_task_utl.update_task_category(
4044 p_api_version => p_api_version,
4045 p_object_version_number => l_assignee_rec.object_version_number,
4046 p_task_assignment_id => l_assignee_rec.task_assignment_id,
4047 p_category_id => p_category_id,
4048 x_msg_data => x_msg_data,
4049 x_msg_count => x_msg_count,
4050 x_return_status => x_return_status);
4051 ***************************************************************************/
4052 jtf_task_assignments_pvt.g_response_flag := jtf_task_utl.g_no_char; -- Fix bug# 2375153
4053
4054 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4055 CLOSE task_ass_orig;
4056
4057 x_return_status := fnd_api.g_ret_sts_unexp_error;
4058 RAISE fnd_api.g_exc_unexpected_error;
4059 END IF;
4060 END IF;
4061
4062 -- Start of addition on 19/06/2006 for bug# 5210853
4063 LOOP
4064 task_ass_orig_rec := NULL;
4065
4066 FETCH task_ass_orig INTO task_ass_orig_rec;
4067
4068 IF task_ass_orig%NOTFOUND THEN
4069 CLOSE task_ass_orig;
4070 EXIT;
4071 END IF;
4072
4073 IF (
4074 (task_ass_orig_rec.assignee_role = 'ASSIGNEE')
4075 AND (
4076 (NVL(l_calendar_start_date, SYSDATE) <> NVL(tasks.calendar_start_date, SYSDATE))
4077 OR (NVL(l_calendar_end_date, SYSDATE) <> NVL(tasks.calendar_end_date, SYSDATE))
4078 )
4079 AND (
4080 (task_ass_orig_rec.actual_start_date IS NULL)
4081 OR (task_ass_orig_rec.actual_end_date IS NULL)
4082 )
4083 ) THEN
4084 -- Added for Bug 6031383 . Directly updating the assignment to avoid
4085 -- object version number change of the assignment.
4086 jtf_task_assignments_pvt.populate_booking_dates
4087 (
4088 p_calendar_start_date => l_calendar_start_date
4089 , p_calendar_end_date => l_calendar_end_date
4090 , p_actual_start_date => task_ass_orig_rec.actual_start_date
4091 , p_actual_end_date => task_ass_orig_rec.actual_end_date
4092 , p_actual_travel_duration => task_ass_orig_rec.actual_travel_duration
4093 , p_actual_travel_duration_uom => task_ass_orig_rec.actual_travel_duration_uom
4094 , p_planned_effort => l_planned_effort
4095 , p_planned_effort_uom => l_planned_effort_uom
4096 , p_actual_effort => task_ass_orig_rec.actual_effort
4097 , p_actual_effort_uom => task_ass_orig_rec.actual_effort_uom
4098 , x_booking_start_date => l_booking_start_date
4099 , x_booking_end_date => l_booking_end_date
4100 );
4101
4102 UPDATE jtf_task_all_assignments
4103 SET booking_start_date = l_booking_start_date
4104 , booking_end_date = l_booking_end_date
4105 WHERE task_assignment_id = task_ass_orig_rec.task_assignment_id;
4106 END IF;
4107 END LOOP;
4108
4109 -- End of addition on 19/06/2006 for bug# 5210853
4110
4111 -- 2102281
4112 --------------------------------------------------------------
4113 -- ------------------------------------------------------------------------
4114 -- Update reference to source if changed, fix enh # 2102281
4115 -- ------------------------------------------------------------------------
4116 jtf_task_utl_ext.update_object_code(
4117 p_task_id => l_task_id
4118 , p_old_object_code => l_orig_source_object_type_code
4119 , p_new_object_code => tasks.source_object_type_code
4120 , p_old_object_id => l_orig_source_id
4121 , p_new_object_id => l_source_object_id
4122 , p_new_object_name => l_source_object_name
4123 , x_return_status => x_return_status
4124 , x_msg_count => x_msg_count
4125 , x_msg_data => x_msg_data
4126 );
4127
4128 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4129 RAISE fnd_api.g_exc_unexpected_error;
4130 END IF;
4131
4132 --------------------------------------------------------------
4133
4134 -- ------------------------------------------------------------------------
4135 -- Update reference to customer if changed, fix enh #1845501
4136 -- ------------------------------------------------------------------------
4137 IF (
4138 NVL(l_customer_id, 0) <> fnd_api.g_miss_num
4139 AND NVL(l_customer_id, 0) <> NVL(l_orig_cust_id, 0)
4140 ) THEN
4141 -- Added for Bug# 2593974
4142 -------------------------------------------------
4143 ------ delete contacts and related contact points
4144 -------------------------------------------------
4145 FOR c IN c_del_contacts(l_task_id) LOOP
4146 jtf_task_contacts_pub.delete_task_contacts
4147 (
4148 p_api_version => 1.0
4149 , p_init_msg_list => fnd_api.g_false
4150 , p_commit => fnd_api.g_false
4151 , p_object_version_number => c.object_version_number
4152 , p_task_contact_id => c.task_contact_id
4153 , x_return_status => x_return_status
4154 , x_msg_data => x_msg_data
4155 , x_msg_count => x_msg_count
4156 , p_delete_cascade => jtf_task_utl.g_yes_char
4157 );
4158
4159 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4160 x_return_status := fnd_api.g_ret_sts_unexp_error;
4161 RAISE fnd_api.g_exc_unexpected_error;
4162 END IF;
4163 END LOOP;
4164
4165 -- End Add
4166
4167 -- delete the old one
4168 jtf_task_utl.delete_party_reference(
4169 p_reference_from => 'TASK'
4170 , p_task_id => l_task_id
4171 , p_party_id => l_orig_cust_id
4172 , x_msg_count => x_msg_count
4173 , x_msg_data => x_msg_data
4174 , x_return_status => x_return_status
4175 );
4176
4177 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4178 x_return_status := fnd_api.g_ret_sts_unexp_error;
4179 RAISE fnd_api.g_exc_unexpected_error;
4180 END IF;
4181
4182 -- create a new one
4183 jtf_task_utl.create_party_reference(
4184 p_reference_from => 'TASK'
4185 , p_task_id => l_task_id
4186 , p_party_id => l_customer_id
4187 , x_msg_count => x_msg_count
4188 , x_msg_data => x_msg_data
4189 , x_return_status => x_return_status
4190 );
4191
4192 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4193 x_return_status := fnd_api.g_ret_sts_unexp_error;
4194 RAISE fnd_api.g_exc_unexpected_error;
4195 END IF;
4196 END IF;
4197
4198 jtf_tasks_iuhk.update_task_post(x_return_status);
4199
4200 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4201 x_return_status := fnd_api.g_ret_sts_unexp_error;
4202 RAISE fnd_api.g_exc_unexpected_error;
4203 END IF;
4204
4205 IF fnd_api.to_boolean(p_commit) THEN
4206 COMMIT WORK;
4207 END IF;
4208
4209 -- Increment the object version number to be returned
4210 p_object_version_number := p_object_version_number + 1;
4211 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4212
4213 --BES enh 2391065
4214 IF (l_entity = 'TASK') THEN
4215 l_task_rec_type_old.source_object_type_code := l_orig_source_object_type_code;
4216 l_task_rec_type_old.source_object_id := l_orig_source_id;
4217 l_task_rec_type_new.task_id := l_task_id;
4218 l_task_rec_type_new.task_audit_id := x_task_audit_id;
4219 l_task_rec_type_new.source_object_type_code := tasks.source_object_type_code;
4220 l_task_rec_type_new.source_object_id := l_source_object_id;
4221 l_task_rec_type_new.enable_workflow := l_enable_workflow;
4222 l_task_rec_type_new.abort_workflow := l_abort_workflow;
4223 jtf_task_wf_events_pvt.publish_update_task(
4224 p_task_rec_old => l_task_rec_type_old
4225 , p_task_rec_new => l_task_rec_type_new
4226 , x_return_status => x_event_return_status
4227 );
4228
4229 IF (x_event_return_status = 'WARNING') THEN
4230 fnd_message.set_name('JTF', 'JTF_TASK_EVENT_WARNING');
4231 fnd_message.set_token('P_TASK_ID', l_task_id);
4232 fnd_msg_pub.ADD;
4233 ELSIF(x_event_return_status = 'ERROR') THEN
4234 fnd_message.set_name('JTF', 'JTF_TASK_EVENT_ERROR');
4235 fnd_message.set_token('P_TASK_ID', l_task_id);
4236 fnd_msg_pub.ADD;
4237 x_return_status := fnd_api.g_ret_sts_unexp_error;
4238 RAISE fnd_api.g_exc_unexpected_error;
4239 END IF;
4240 END IF;
4241 --BES enh 2391065
4242 EXCEPTION
4243 WHEN fnd_api.g_exc_unexpected_error THEN
4244 ROLLBACK TO update_task_pvt;
4245 x_return_status := fnd_api.g_ret_sts_unexp_error;
4246 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4247 WHEN OTHERS THEN
4248 ROLLBACK TO update_task_pvt;
4249 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
4250 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
4251 fnd_msg_pub.ADD;
4252 x_return_status := fnd_api.g_ret_sts_unexp_error;
4253 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4254 END; ---- End of private Update Task
4255
4256 -- Old version
4257 PROCEDURE delete_task(
4258 p_api_version IN NUMBER
4259 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
4260 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
4261 , p_object_version_number IN NUMBER
4262 , p_task_id IN NUMBER
4263 , p_delete_future_recurrences IN VARCHAR2 DEFAULT fnd_api.g_false
4264 , x_return_status OUT NOCOPY VARCHAR2
4265 , x_msg_count OUT NOCOPY NUMBER
4266 , x_msg_data OUT NOCOPY VARCHAR2
4267 ) IS
4268 BEGIN
4269 SAVEPOINT delete_task_pvt2;
4270 x_return_status := fnd_api.g_ret_sts_success;
4271
4272 -- Added by lokumar for bug#6598081
4273 IF fnd_api.to_boolean(p_init_msg_list) THEN
4274 fnd_msg_pub.initialize;
4275 END IF;
4276
4277 -- Call the new version
4278 delete_task(
4279 p_api_version => p_api_version
4280 , p_init_msg_list => p_init_msg_list
4281 , p_commit => p_commit
4282 , p_object_version_number => p_object_version_number
4283 , p_task_id => p_task_id
4284 , p_delete_future_recurrences => p_delete_future_recurrences
4285 , x_return_status => x_return_status
4286 , x_msg_count => x_msg_count
4287 , x_msg_data => x_msg_data
4288 , p_enable_workflow => fnd_profile.VALUE('JTF_TASK_ENABLE_WORKFLOW')
4289 , p_abort_workflow => fnd_profile.VALUE('JTF_TASK_ABORT_PREV_WF')
4290 );
4291
4292 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4293 x_return_status := fnd_api.g_ret_sts_unexp_error;
4294 RAISE fnd_api.g_exc_unexpected_error;
4295 END IF;
4296
4297 IF fnd_api.to_boolean(p_commit) THEN
4298 COMMIT WORK;
4299 END IF;
4300
4301 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4302 EXCEPTION
4303 WHEN fnd_api.g_exc_unexpected_error THEN
4304 ROLLBACK TO delete_task_pvt2;
4305 x_return_status := fnd_api.g_ret_sts_unexp_error;
4306 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4307 WHEN OTHERS THEN
4308 ROLLBACK TO delete_task_pvt2;
4309 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
4310 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
4311 fnd_msg_pub.ADD;
4312 x_return_status := fnd_api.g_ret_sts_unexp_error;
4313 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4314 END;
4315
4316 -- New version
4317 PROCEDURE delete_task(
4318 p_api_version IN NUMBER
4319 , p_init_msg_list IN VARCHAR2 DEFAULT fnd_api.g_false
4320 , p_commit IN VARCHAR2 DEFAULT fnd_api.g_false
4321 , p_object_version_number IN NUMBER
4322 , p_task_id IN NUMBER
4323 , p_delete_future_recurrences IN VARCHAR2 DEFAULT fnd_api.g_false
4324 , x_return_status OUT NOCOPY VARCHAR2
4325 , x_msg_count OUT NOCOPY NUMBER
4326 , x_msg_data OUT NOCOPY VARCHAR2
4327 , p_enable_workflow IN VARCHAR2
4328 , p_abort_workflow IN VARCHAR2
4329 ) IS
4330 l_task_id jtf_tasks_b.task_id%TYPE := p_task_id;
4331 l_recur_rule jtf_task_recur_rules.recurrence_rule_id%TYPE;
4332 l_date_selected jtf_task_recur_rules.date_selected%TYPE;
4333 l_planned_date jtf_tasks_b.planned_start_date%TYPE;
4334 l_scheduled_date jtf_tasks_b.scheduled_start_date%TYPE;
4335 l_actual_date jtf_tasks_b.actual_start_date%TYPE;
4336 l_obj_version jtf_tasks_b.object_version_number%TYPE;
4337 l_source_object_type_code jtf_tasks_b.source_object_type_code%TYPE;
4338 l_source_object_id jtf_tasks_b.source_object_id%TYPE;
4339 l_calendar_start_date DATE;
4340 l_task_exclusion_id NUMBER;
4341 l_parent_child_count NUMBER;
4342
4343 -- ------------------------------------------------------------------------
4344 -- Retrieve recurrence rule id for the selected task, plus the start dates
4345 -- for that task, to fix bug #1975337
4346 -- ------------------------------------------------------------------------
4347 CURSOR c_recur_rule(b_task_id jtf_tasks_b.task_id%TYPE) IS
4348 SELECT recurrence_rule_id
4349 , planned_start_date
4350 , scheduled_start_date
4351 , actual_start_date
4352 FROM jtf_tasks_b
4353 WHERE task_id = b_task_id;
4354
4355 -- ------------------------------------------------------------------------
4356 -- Retrieve date used in recurrence rule
4357 -- ------------------------------------------------------------------------
4358 CURSOR c_recur_date(b_rule_id jtf_tasks_b.recurrence_rule_id%TYPE) IS
4359 SELECT date_selected
4360 FROM jtf_task_recur_rules
4361 WHERE recurrence_rule_id = b_rule_id;
4362
4363 -- ------------------------------------------------------------------------
4364 -- Capture all future recurrences if p_delete_future_recurrences is TRUE,
4365 -- or all past and future recurrences if p_delete_future_recurrences is 'A'
4366 -- ------------------------------------------------------------------------
4367 CURSOR c_delete_task(b_date_selected jtf_task_recur_rules.date_selected%TYPE) IS
4368 SELECT task_id
4369 , object_version_number
4370 , source_object_type_code
4371 , -- Added for XP Sync Story #58
4372 calendar_start_date -- Added for XP Sync Story #58
4373 FROM jtf_tasks_b
4374 WHERE task_id = p_task_id
4375 UNION ALL
4376 SELECT task_id
4377 , object_version_number
4378 , source_object_type_code
4379 , -- Added for XP Sync Story #58
4380 calendar_start_date -- Added for XP Sync Story #58
4381 FROM jtf_tasks_b
4382 WHERE recurrence_rule_id = l_recur_rule
4383 AND (
4384 (
4385 p_delete_future_recurrences = fnd_api.g_true
4386 AND (
4387
4388 ---------------------------
4389 ---- 'P' use planned date
4390 ---- null (existing data)
4391 ---- also use planned date
4392 ---------------------------
4393 (NVL(b_date_selected, 'P') = 'P' AND planned_start_date >= l_planned_date)
4394 OR
4395 ---------------------------
4396 ---- 'S' use scheduled date
4397 ---------------------------
4398 (b_date_selected = 'S' AND scheduled_start_date >= l_scheduled_date)
4399 OR
4400 ---------------------------
4401 ---- 'A' use actual date
4402 ---------------------------
4403 (b_date_selected = 'A' AND actual_start_date >= l_actual_date)
4404 )
4405 )
4406 OR p_delete_future_recurrences = 'A'
4407 )
4408 AND NVL(deleted_flag, 'N') = 'N'
4409 AND task_id <> p_task_id;
4410
4411 CURSOR c_dependencies IS
4412 SELECT dependency_id
4413 , object_version_number
4414 FROM jtf_task_depends
4415 WHERE task_id = l_task_id OR dependent_on_task_id = l_task_id;
4416
4417 CURSOR c_references IS
4418 SELECT task_reference_id
4419 , object_version_number
4420 FROM jtf_task_references_vl
4421 WHERE task_id = l_task_id;
4422
4423 CURSOR c_dates IS
4424 SELECT task_date_id
4425 , object_version_number
4426 FROM jtf_task_dates
4427 WHERE task_id = l_task_id;
4428
4429 CURSOR c_rsc_reqs IS
4430 SELECT resource_req_id
4431 , object_version_number
4432 FROM jtf_task_rsc_reqs
4433 WHERE task_id = l_task_id;
4434
4435 CURSOR c_assignments IS
4436 SELECT task_assignment_id
4437 , object_version_number
4438 FROM jtf_task_all_assignments
4439 WHERE task_id = l_task_id;
4440
4441 -- Added to fix Bug # 2503657
4442 CURSOR c_contacts IS
4443 SELECT task_contact_id
4444 , object_version_number
4445 FROM jtf_task_contacts
4446 WHERE task_id = l_task_id;
4447
4448 -- Added to fix Bug # 2585935
4449 CURSOR c_contact_points IS
4450 SELECT a.object_version_number
4451 , a.task_phone_id
4452 FROM jtf_task_phones a, jtf_tasks_b c
4453 WHERE a.owner_table_name = 'JTF_TASKS_B'
4454 AND a.task_contact_id = c.task_id
4455 AND c.task_id = l_task_id;
4456
4457 --BES enh 2391065
4458 l_task_rec_type jtf_tasks_pvt.task_rec_type;
4459 x_event_return_status VARCHAR2(100);
4460
4461 CURSOR task_source_orig(b_task_id IN NUMBER) IS
4462 SELECT source_object_id
4463 , source_object_type_code
4464 , entity
4465 FROM jtf_tasks_b
4466 WHERE task_id = b_task_id;
4467
4468 CURSOR c_parent_child(b_date_selected jtf_task_recur_rules.date_selected%TYPE) IS
4469 SELECT count(*) FROM
4470 (SELECT task_number
4471 from jtf_tasks_b
4472 where parent_task_id = p_task_id
4473 AND NVL(deleted_flag, 'N') = 'N'
4474 UNION ALL
4475 SELECT task_number
4476 FROM jtf_tasks_b
4477 WHERE recurrence_rule_id = l_recur_rule
4478 AND (
4479 (
4480 p_delete_future_recurrences = fnd_api.g_true
4481 AND (
4482
4483 ---------------------------
4484 ---- 'P' use planned date
4485 ---- null (existing data)
4486 ---- also use planned date
4487 ---------------------------
4488 (NVL(b_date_selected, 'P') = 'P' AND planned_start_date >= l_planned_date)
4489 OR
4490 ---------------------------
4491 ---- 'S' use scheduled date
4492 ---------------------------
4493 (b_date_selected = 'S' AND scheduled_start_date >= l_scheduled_date)
4494 OR
4495 ---------------------------
4496 ---- 'A' use actual date
4497 ---------------------------
4498 (b_date_selected = 'A' AND actual_start_date >= l_actual_date)
4499 )
4500 )
4501 OR p_delete_future_recurrences = 'A'
4502 )
4503 AND NVL(deleted_flag, 'N') = 'N'
4504 AND task_id <> p_task_id
4505 AND exists ( select *
4506 from jtf_tasks_b
4507 where parent_task_id = task_id ) );
4508
4509 l_orig_source_object_id jtf_tasks_b.source_object_id%TYPE;
4510 l_orig_source_object_type_code jtf_tasks_b.source_object_type_code%TYPE;
4511 l_entity jtf_tasks_b.entity%TYPE;
4512 BEGIN
4513 SAVEPOINT delete_task_pvt;
4514 x_return_status := fnd_api.g_ret_sts_success;
4515
4516 -- Added by lokumar for bug#6598081
4517 IF fnd_api.to_boolean(p_init_msg_list) THEN
4518 fnd_msg_pub.initialize;
4519 END IF;
4520
4521 -- ------------------------------------------------------------------------
4522 -- Check that the user has the correct security privilege
4523 -- ------------------------------------------------------------------------
4524 jtf_task_utl.check_security_privilege(p_task_id => p_task_id, p_session => 'DELETE'
4525 , x_return_status => x_return_status);
4526
4527 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4528 x_return_status := fnd_api.g_ret_sts_unexp_error;
4529 RAISE fnd_api.g_exc_unexpected_error;
4530 END IF;
4531
4532
4533 -------------------------------------------------------------------
4534 ---------------------- Workflow Enhancement -----------------------
4535 -------------------------------------------------------------------
4536 -- !!! moved this code to before all the deletes so the data is !!!
4537 -- !!! complete when the WF is sent !!!
4538 -------------------------------------------------------------------
4539 /* Moved the code to subscription ER# 2797666
4540 IF p_enable_workflow = jtf_task_utl.g_yes
4541 THEN
4542 IF JTF_Task_WF_Util.Do_Notification(l_task_id)
4543 THEN
4544 JTF_Task_WF_Util.Create_Notification(
4545 p_event => 'DELETE_TASK',
4546 p_task_id => l_task_id,
4547 p_abort_workflow => p_abort_workflow,
4548 x_return_status => x_return_status,
4549 x_msg_count => x_msg_count,
4550 x_msg_data => x_msg_data
4551 );
4552
4553 IF NOT (x_return_status = fnd_api.g_ret_sts_success)
4554 THEN
4555 x_return_status := fnd_api.g_ret_sts_unexp_error;
4556 RAISE fnd_api.g_exc_unexpected_error;
4557 END IF;
4558 END IF; -- Check JTF_Task_WF_Util.Do_Notification
4559 END IF; -- Check p_enable_workflow
4560 */
4561 -------------------------------------------------------------------
4562
4563 ---------------------------
4564 ---- get recurrence rule id
4565 ---------------------------
4566 OPEN c_recur_rule(p_task_id);
4567
4568 FETCH c_recur_rule
4569 INTO l_recur_rule
4570 , l_planned_date
4571 , l_scheduled_date
4572 , l_actual_date;
4573
4574 CLOSE c_recur_rule;
4575
4576 ---------------------------
4577 ---- get date_selected from
4578 ---- the recurrence rule
4579 ---------------------------
4580 IF l_recur_rule IS NOT NULL THEN
4581 OPEN c_recur_date(l_recur_rule);
4582
4583 FETCH c_recur_date
4584 INTO l_date_selected;
4585
4586 IF c_recur_date%NOTFOUND THEN
4587 CLOSE c_recur_date;
4588
4589 x_return_status := fnd_api.g_ret_sts_unexp_error;
4590 RAISE fnd_api.g_exc_unexpected_error;
4591 END IF;
4592
4593 CLOSE c_recur_date;
4594 END IF;
4595
4596 OPEN c_parent_child(l_date_selected);
4597 FETCH c_parent_child into l_parent_child_count;
4598
4599 IF l_parent_child_count>0 THEN
4600 fnd_message.set_name('JTF', 'JTF_TASK_DELETING_PARENT_CHILD');
4601 fnd_msg_pub.ADD;
4602 x_return_status := fnd_api.g_ret_sts_unexp_error;
4603 RAISE fnd_api.g_exc_unexpected_error;
4604 END IF;
4605
4606
4607
4608
4609 jtf_tasks_pub.p_task_user_hooks.task_id := p_task_id;
4610 jtf_tasks_iuhk.delete_task_pre(x_return_status);
4611
4612 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4613 x_return_status := fnd_api.g_ret_sts_unexp_error;
4614 RAISE fnd_api.g_exc_unexpected_error;
4615 END IF;
4616
4617
4618 FOR i IN c_delete_task(l_date_selected) LOOP
4619 l_task_id := i.task_id;
4620 l_obj_version := i.object_version_number;
4621 l_source_object_type_code := i.source_object_type_code; -- For XP Sync, Story #58
4622 l_calendar_start_date := i.calendar_start_date; -- For XP Sync, Story #58
4623
4624 ---------------------------
4625 ---- delete dependencies
4626 ---------------------------
4627 FOR a IN c_dependencies LOOP
4628 jtf_task_dependency_pub.delete_task_dependency
4629 (
4630 p_api_version => 1.0
4631 , p_init_msg_list => fnd_api.g_false
4632 , p_commit => fnd_api.g_false
4633 , p_object_version_number => a.object_version_number
4634 , p_dependency_id => a.dependency_id
4635 , x_return_status => x_return_status
4636 , x_msg_count => x_msg_count
4637 , x_msg_data => x_msg_data
4638 );
4639
4640 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4641 x_return_status := fnd_api.g_ret_sts_unexp_error;
4642 RAISE fnd_api.g_exc_unexpected_error;
4643 END IF;
4644 END LOOP;
4645
4646 ---------------------------
4647 ---- delete references. Changed the call from public to private as this
4648 ---- removes the additional overhead of calling private api through public.
4649 ---------------------------
4650 FOR b IN c_references LOOP
4651 jtf_task_references_pvt.delete_references
4652 (
4653 p_api_version => 1.0
4654 , p_init_msg_list => fnd_api.g_false
4655 , p_commit => fnd_api.g_false
4656 , p_object_version_number => b.object_version_number
4657 , p_task_reference_id => b.task_reference_id
4658 , x_return_status => x_return_status
4659 , x_msg_count => x_msg_count
4660 , x_msg_data => x_msg_data
4661 , p_from_task_api => 'Y'
4662 );
4663
4664 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4665 x_return_status := fnd_api.g_ret_sts_unexp_error;
4666 RAISE fnd_api.g_exc_unexpected_error;
4667 END IF;
4668 END LOOP;
4669
4670 ---------------------------
4671 ---- delete dates
4672 ---------------------------
4673 FOR c IN c_dates LOOP
4674 jtf_task_dates_pub.delete_task_dates(
4675 p_api_version => 1.0
4676 , p_init_msg_list => fnd_api.g_false
4677 , p_commit => fnd_api.g_false
4678 , p_object_version_number => c.object_version_number
4679 , p_task_date_id => c.task_date_id
4680 , x_return_status => x_return_status
4681 , x_msg_count => x_msg_count
4682 , x_msg_data => x_msg_data
4683 );
4684
4685 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4686 x_return_status := fnd_api.g_ret_sts_unexp_error;
4687 RAISE fnd_api.g_exc_unexpected_error;
4688 END IF;
4689 END LOOP;
4690
4691 ---------------------------
4692 ---- delete resource reqs.
4693 ---------------------------
4694 FOR c IN c_rsc_reqs LOOP
4695 jtf_task_resources_pub.delete_task_rsrc_req
4696 (
4697 p_api_version => 1.0
4698 , p_init_msg_list => fnd_api.g_false
4699 , p_commit => fnd_api.g_false
4700 , p_object_version_number => c.object_version_number
4701 , p_resource_req_id => c.resource_req_id
4702 , x_return_status => x_return_status
4703 , x_msg_count => x_msg_count
4704 , x_msg_data => x_msg_data
4705 );
4706
4707 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4708 x_return_status := fnd_api.g_ret_sts_unexp_error;
4709 RAISE fnd_api.g_exc_unexpected_error;
4710 END IF;
4711 END LOOP;
4712
4713 ---------------------------------------------------------------
4714 -- For XP Sync Story #58
4715 -- When a user updates one of occurrences in Outlook/Palm,
4716 -- This deletes it and insert it into JTA_TASK_EXCLUSIONS
4717 -- When a user deletes one of occurrences in Server,
4718 -- This deletes it and insert it into JTA_TASK_EXCLUSIONS
4719 -- We support this only for Appointment
4720 -- and p_delete_future_recurrences <> 'A'
4721 -- If the deleted task is the first task of the series,
4722 -- then update task_id with the next min of task_id
4723 -- into mapping table
4724 -- Added 'EXTERNAL APPOINTMENT' to fix bug# 5255363 on 09/06/2006
4725 ---------------------------------------------------------------
4726 IF (
4727 (NVL(p_delete_future_recurrences, fnd_api.g_false) <> 'A')
4728 AND (l_recur_rule IS NOT NULL)
4729 AND (l_source_object_type_code IN('APPOINTMENT', 'EXTERNAL APPOINTMENT'))
4730 ) THEN
4731 SELECT jta_task_exclusions_s.NEXTVAL
4732 INTO l_task_exclusion_id
4733 FROM DUAL;
4734
4735 jta_task_exclusions_pkg.insert_row(
4736 p_task_exclusion_id => l_task_exclusion_id
4737 , p_task_id => l_task_id
4738 , p_recurrence_rule_id => l_recur_rule
4739 , p_exclusion_date => l_calendar_start_date
4740 );
4741
4742 -- Modify task_id in the sync mapping table
4743 IF p_task_id = l_task_id THEN
4744 jta_sync_task_utl.update_mapping(p_task_id => p_task_id);
4745 END IF;
4746 END IF;
4747
4748 ---------------------------------------------------------------
4749
4750 ---------------------------
4751 ---- delete assignments
4752 ---------------------------
4753 FOR c IN c_assignments LOOP
4754 jtf_task_assignments_pvt.delete_task_assignment
4755 (
4756 p_api_version => 1.0
4757 , p_init_msg_list => fnd_api.g_false
4758 , p_commit => fnd_api.g_false
4759 , p_object_version_number => c.object_version_number
4760 , p_task_assignment_id => c.task_assignment_id
4761 , x_return_status => x_return_status
4762 , x_msg_count => x_msg_count
4763 , x_msg_data => x_msg_data
4764 , p_enable_workflow => fnd_profile.VALUE('JTF_TASK_ENABLE_WORKFLOW')
4765 , p_abort_workflow => fnd_profile.VALUE('JTF_TASK_ABORT_PREV_WF')
4766 , p_delete_option => jtf_task_repeat_appt_pvt.g_skip
4767 );
4768
4769 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4770 x_return_status := fnd_api.g_ret_sts_unexp_error;
4771 RAISE fnd_api.g_exc_unexpected_error;
4772 END IF;
4773 END LOOP;
4774
4775 jtf_tasks_pub.lock_task(
4776 p_api_version => 1.0
4777 , p_init_msg_list => fnd_api.g_false
4778 , p_commit => fnd_api.g_false
4779 , p_task_id => l_task_id
4780 , p_object_version_number => l_obj_version
4781 , x_return_status => x_return_status
4782 , x_msg_data => x_msg_data
4783 , x_msg_count => x_msg_count
4784 );
4785
4786 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4787 x_return_status := fnd_api.g_ret_sts_unexp_error;
4788 RAISE fnd_api.g_exc_unexpected_error;
4789 END IF;
4790
4791 UPDATE jtf_tasks_b
4792 SET deleted_flag = 'Y'
4793 , last_update_date = SYSDATE
4794 , last_updated_by = fnd_global.user_id
4795 , object_changed_date = SYSDATE
4796 WHERE task_id = l_task_id;
4797
4798 IF SQL%NOTFOUND THEN
4799 fnd_message.set_name('JTF', 'JTF_TASK_ERROR_DELETING_TASK');
4800 fnd_msg_pub.ADD;
4801 x_return_status := fnd_api.g_ret_sts_unexp_error;
4802 RAISE fnd_api.g_exc_unexpected_error;
4803 END IF;
4804
4805 --- Moving the business event code here to fix bug 3363174 ..
4806 --BES enh 2391065
4807 OPEN task_source_orig(l_task_id);
4808
4809 FETCH task_source_orig
4810 INTO l_orig_source_object_id
4811 , l_orig_source_object_type_code
4812 , l_entity;
4813
4814 IF task_source_orig%NOTFOUND THEN
4815 CLOSE task_source_orig;
4816
4817 RAISE fnd_api.g_exc_unexpected_error;
4818 END IF;
4819
4820 CLOSE task_source_orig;
4821
4822 IF (l_entity = 'TASK') THEN
4823 l_task_rec_type.task_id := l_task_id;
4824 l_task_rec_type.enable_workflow := p_enable_workflow;
4825 l_task_rec_type.abort_workflow := p_abort_workflow;
4826 l_task_rec_type.source_object_type_code := l_orig_source_object_type_code;
4827 l_task_rec_type.source_object_id := l_orig_source_object_id;
4828 jtf_task_wf_events_pvt.publish_delete_task(p_task_rec => l_task_rec_type
4829 , x_return_status => x_event_return_status);
4830
4831 IF (x_event_return_status = 'WARNING') THEN
4832 fnd_message.set_name('JTF', 'JTF_TASK_EVENT_WARNING');
4833 fnd_message.set_token('P_TASK_ID', l_task_id);
4834 fnd_msg_pub.ADD;
4835 ELSIF(x_event_return_status = 'ERROR') THEN
4836 fnd_message.set_name('JTF', 'JTF_TASK_EVENT_ERROR');
4837 fnd_message.set_token('P_TASK_ID', l_task_id);
4838 fnd_msg_pub.ADD;
4839 x_return_status := fnd_api.g_ret_sts_unexp_error;
4840 RAISE fnd_api.g_exc_unexpected_error;
4841 END IF;
4842 END IF;
4843
4844 --BES enh 2391065
4845
4846 -- Added to fix Bug # 2503657
4847 ---------------------------
4848 ---- delete contacts
4849 ---------------------------
4850 FOR cc IN c_contacts LOOP
4851 jtf_task_contacts_pub.delete_task_contacts
4852 (
4853 p_api_version => 1.0
4854 , p_init_msg_list => fnd_api.g_false
4855 , p_commit => fnd_api.g_false
4856 , p_object_version_number => cc.object_version_number
4857 , p_task_contact_id => cc.task_contact_id
4858 , x_return_status => x_return_status
4859 , x_msg_data => x_msg_data
4860 , x_msg_count => x_msg_count
4861 , p_delete_cascade => jtf_task_utl.g_yes_char
4862 );
4863
4864 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4865 x_return_status := fnd_api.g_ret_sts_unexp_error;
4866 RAISE fnd_api.g_exc_unexpected_error;
4867 END IF;
4868 END LOOP; -- End of delete contacts
4869
4870 -- Added to fix Bug # 2585935
4871 ----------------------------
4872 ------ delete contact points
4873 ----------------------------
4874 FOR cp IN c_contact_points LOOP
4875 jtf_task_phones_pub.delete_task_phones
4876 (
4877 p_api_version => 1.0
4878 , p_init_msg_list => fnd_api.g_false
4879 , p_commit => fnd_api.g_false
4880 , p_object_version_number => cp.object_version_number
4881 , p_task_phone_id => cp.task_phone_id
4882 , x_return_status => x_return_status
4883 , x_msg_count => x_msg_count
4884 , x_msg_data => x_msg_data
4885 );
4886
4887 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4888 x_return_status := fnd_api.g_ret_sts_unexp_error;
4889 RAISE fnd_api.g_exc_unexpected_error;
4890 END IF;
4891 END LOOP; -- End of delete contact points
4892 END LOOP; --- loop for the task;.
4893
4894 jtf_tasks_iuhk.delete_task_post(x_return_status);
4895
4896 IF NOT(x_return_status = fnd_api.g_ret_sts_success) THEN
4897 x_return_status := fnd_api.g_ret_sts_unexp_error;
4898 RAISE fnd_api.g_exc_unexpected_error;
4899 END IF;
4900
4901 -------------------------------------------------------------------
4902 ---------------------- Workflow Enhancement -----------------------
4903 -------------------------------------------------------------------
4904 -- !!! moved this code to before all the deletes so the data is !!!
4905 -- !!! complete when the WF is sent !!!
4906 -------------------------------------------------------------------
4907 IF fnd_api.to_boolean(p_commit) THEN
4908 COMMIT WORK;
4909 END IF;
4910
4911 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4912 EXCEPTION
4913 WHEN fnd_api.g_exc_unexpected_error THEN
4914 ROLLBACK TO delete_task_pvt;
4915 x_return_status := fnd_api.g_ret_sts_unexp_error;
4916 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4917 WHEN OTHERS THEN
4918 ROLLBACK TO delete_task_pvt;
4919 fnd_message.set_name('JTF', 'JTF_TASK_UNKNOWN_ERROR');
4920 fnd_message.set_token('P_TEXT', SQLCODE || SQLERRM);
4921 fnd_msg_pub.ADD;
4922 x_return_status := fnd_api.g_ret_sts_unexp_error;
4923 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
4924 END;
4925
4926 PROCEDURE export_file(
4927 p_path IN VARCHAR2
4928 , p_file_name IN VARCHAR2
4929 , p_task_table IN jtf_tasks_pub.task_table_type
4930 , x_return_status OUT NOCOPY VARCHAR2
4931 , x_msg_count OUT NOCOPY NUMBER
4932 , x_msg_data OUT NOCOPY VARCHAR2
4933 ) IS
4934 -- variables
4935 l_api_name VARCHAR2(30) := 'EXPORT_FILE';
4936 v_file UTL_FILE.file_type; -- output file handle
4937 v_start NUMBER := p_task_table.FIRST;
4938 v_end NUMBER := p_task_table.LAST;
4939 v_cnt NUMBER;
4940 v_tab CONSTANT VARCHAR2(1) := fnd_global.local_chr(9); --tab value 9 in ascii
4941
4942 PROCEDURE put_f_out(p_str IN VARCHAR2) IS
4943 BEGIN
4944 UTL_FILE.putf(v_file, p_str || v_tab);
4945 END put_f_out;
4946
4947 PROCEDURE put_f(p_in IN VARCHAR2) IS
4948 BEGIN
4949 put_f_out(p_in);
4950 END put_f;
4951
4952 PROCEDURE put_f(p_in IN NUMBER) IS
4953 BEGIN
4954 put_f_out(TO_CHAR(p_in));
4955 END put_f;
4956
4957 PROCEDURE put_f(p_in IN DATE) IS
4958 BEGIN
4959 ---
4960 --- hbucksey 13-Feb-2002
4961 --- Replaced 'dd-mon-rrrr' format mask with 'dd-mm-rrrr' in order to ensure
4962 --- NLS compliance
4963 --- This is to resolve GSCC warning File.Sql.24
4964 --- 2688 - TO_DATE should not use month/day names
4965 ---
4966 put_f_out(TO_DATE(p_in, 'dd-mm-rrrr'));
4967 -- put_f_out (to_date(p_in, 'dd-mon-rrrr'));
4968 END put_f;
4969 BEGIN -- export file
4970 x_return_status := fnd_api.g_ret_sts_success;
4971
4972 -- close file if its open
4973 IF (UTL_FILE.is_open(v_file)) THEN
4974 UTL_FILE.fclose(v_file);
4975 END IF;
4976
4977 -- open file for write only
4978 v_file := UTL_FILE.fopen(p_path, p_file_name, 'w');
4979
4980 FOR v_cnt IN v_start .. v_end LOOP
4981 put_f(p_task_table(v_cnt).task_id);
4982 put_f(p_task_table(v_cnt).task_number);
4983 put_f(p_task_table(v_cnt).task_name);
4984 put_f(p_task_table(v_cnt).task_type);
4985 put_f(p_task_table(v_cnt).task_status);
4986 put_f(p_task_table(v_cnt).task_priority);
4987 put_f(p_task_table(v_cnt).planned_start_date);
4988 put_f(p_task_table(v_cnt).planned_end_date);
4989 put_f(p_task_table(v_cnt).actual_start_date);
4990 put_f(p_task_table(v_cnt).actual_end_date);
4991 put_f(p_task_table(v_cnt).scheduled_start_date);
4992 put_f(p_task_table(v_cnt).scheduled_end_date);
4993 put_f(p_task_table(v_cnt).DURATION);
4994 put_f(p_task_table(v_cnt).duration_uom);
4995 put_f(p_task_table(v_cnt).planned_effort);
4996 put_f(p_task_table(v_cnt).planned_effort_uom);
4997 UTL_FILE.new_line(v_file, 1);
4998 END LOOP;
4999
5000 -- close file
5001 UTL_FILE.fclose(v_file);
5002 EXCEPTION
5003 WHEN fnd_api.g_exc_error THEN
5004 IF (UTL_FILE.is_open(v_file)) THEN
5005 UTL_FILE.fclose(v_file);
5006 END IF;
5007
5008 x_return_status := fnd_api.g_ret_sts_error;
5009 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5010 WHEN fnd_api.g_exc_unexpected_error THEN
5011 IF (UTL_FILE.is_open(v_file)) THEN
5012 UTL_FILE.fclose(v_file);
5013 END IF;
5014
5015 x_return_status := fnd_api.g_ret_sts_unexp_error;
5016 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5017 WHEN OTHERS THEN
5018 IF (UTL_FILE.is_open(v_file)) THEN
5019 UTL_FILE.fclose(v_file);
5020 END IF;
5021
5022 x_return_status := fnd_api.g_ret_sts_unexp_error;
5023
5024 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
5025 fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
5026 END IF;
5027
5028 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5029 END export_file;
5030
5031 PROCEDURE dump_long_line(txt IN VARCHAR2, v_str IN VARCHAR2) IS
5032 LN INTEGER := LENGTH(v_str);
5033 st INTEGER := 1;
5034 BEGIN
5035 LOOP
5036 st := st + 72;
5037 EXIT WHEN(st >= LN);
5038 END LOOP;
5039 END dump_long_line;
5040
5041 PROCEDURE query_task(
5042 p_object_version_number IN NUMBER
5043 , p_task_id IN jtf_tasks_v.task_id%TYPE
5044 , p_description IN jtf_tasks_v.description%TYPE
5045 , p_task_type_id IN jtf_tasks_v.task_type_id%TYPE
5046 , p_task_status_id IN jtf_tasks_v.task_status_id%TYPE
5047 , p_task_priority_id IN jtf_tasks_v.task_priority_id%TYPE
5048 , p_owner_type_code IN jtf_tasks_v.owner_type_code%TYPE
5049 , p_owner_id IN jtf_tasks_v.owner_id%TYPE
5050 , p_assigned_by_id IN jtf_tasks_v.assigned_by_id%TYPE
5051 , p_address_id IN jtf_tasks_v.address_id%TYPE
5052 , p_owner_territory_id IN jtf_tasks_v.owner_territory_id%TYPE DEFAULT NULL
5053 , p_customer_id IN jtf_tasks_v.customer_id%TYPE DEFAULT NULL
5054 , p_cust_account_id IN jtf_tasks_v.cust_account_id%TYPE DEFAULT NULL
5055 , p_planned_start_date IN jtf_tasks_v.planned_start_date%TYPE
5056 , p_planned_end_date IN jtf_tasks_v.planned_end_date%TYPE
5057 , p_scheduled_start_date IN jtf_tasks_v.scheduled_start_date%TYPE
5058 , p_scheduled_end_date IN jtf_tasks_v.scheduled_end_date%TYPE
5059 , p_actual_start_date IN jtf_tasks_v.actual_start_date%TYPE
5060 , p_actual_end_date IN jtf_tasks_v.actual_end_date%TYPE
5061 , p_object_type_code IN jtf_tasks_v.source_object_type_code%TYPE
5062 , p_source_object_id IN jtf_tasks_v.source_object_id%TYPE
5063 , p_percentage_complete IN jtf_tasks_v.percentage_complete%TYPE
5064 , p_reason_code IN jtf_tasks_v.reason_code%TYPE
5065 , p_private_flag IN jtf_tasks_v.private_flag%TYPE
5066 , p_restrict_closure_flag IN jtf_tasks_v.restrict_closure_flag%TYPE
5067 , p_multi_booked_flag IN jtf_tasks_v.multi_booked_flag%TYPE
5068 , p_milestone_flag IN jtf_tasks_v.milestone_flag%TYPE
5069 , p_holiday_flag IN jtf_tasks_v.holiday_flag%TYPE
5070 , p_workflow_process_id IN jtf_tasks_v.workflow_process_id%TYPE
5071 , p_notification_flag IN jtf_tasks_v.notification_flag%TYPE
5072 , p_parent_task_id IN jtf_tasks_v.parent_task_id%TYPE
5073 , p_alarm_on IN jtf_tasks_v.alarm_on%TYPE
5074 , p_alarm_count IN jtf_tasks_v.alarm_count%TYPE
5075 , p_alarm_fired_count IN jtf_tasks_v.alarm_fired_count%TYPE
5076 , p_ref_object_id IN NUMBER
5077 , p_ref_object_type_code IN VARCHAR2
5078 , p_task_name IN jtf_tasks_v.task_name%TYPE
5079 , p_sort_data IN jtf_tasks_pub.sort_data
5080 , p_start_pointer IN NUMBER
5081 , p_rec_wanted IN NUMBER
5082 , p_show_all IN VARCHAR2
5083 , p_query_or_next_code IN VARCHAR2 DEFAULT 'Q'
5084 , x_task_table OUT NOCOPY jtf_tasks_pub.task_table_type
5085 , x_total_retrieved OUT NOCOPY NUMBER
5086 , x_total_returned OUT NOCOPY NUMBER
5087 , x_return_status OUT NOCOPY VARCHAR2
5088 , x_msg_count OUT NOCOPY NUMBER
5089 , x_msg_data OUT NOCOPY VARCHAR2
5090 ) IS
5091 -- declare variables
5092 l_api_name VARCHAR2(30) := 'QUERY_TASK';
5093 BEGIN
5094 x_return_status := fnd_api.g_ret_sts_success;
5095 query_task(
5096 p_object_version_number => p_object_version_number
5097 , p_task_id => p_task_id
5098 , p_description => p_description
5099 , p_task_type_id => p_task_type_id
5100 , p_task_status_id => p_task_status_id
5101 , p_task_priority_id => p_task_priority_id
5102 , p_owner_type_code => p_owner_type_code
5103 , p_owner_id => p_owner_id
5104 , p_assigned_by_id => p_assigned_by_id
5105 , p_address_id => p_address_id
5106 , p_owner_territory_id => p_owner_territory_id
5107 , p_customer_id => p_customer_id
5108 , p_cust_account_id => p_cust_account_id
5109 , p_planned_start_date => p_planned_start_date
5110 , p_planned_end_date => p_planned_end_date
5111 , p_scheduled_start_date => p_scheduled_start_date
5112 , p_scheduled_end_date => p_scheduled_end_date
5113 , p_actual_start_date => p_actual_start_date
5114 , p_actual_end_date => p_actual_end_date
5115 , p_object_type_code => p_object_type_code
5116 , p_source_object_id => p_source_object_id
5117 , p_percentage_complete => p_percentage_complete
5118 , p_reason_code => p_reason_code
5119 , p_private_flag => p_private_flag
5120 , p_restrict_closure_flag => p_restrict_closure_flag
5121 , p_multi_booked_flag => p_multi_booked_flag
5122 , p_milestone_flag => p_milestone_flag
5123 , p_holiday_flag => p_holiday_flag
5124 , p_workflow_process_id => p_workflow_process_id
5125 , p_notification_flag => p_notification_flag
5126 , p_parent_task_id => p_parent_task_id
5127 , p_alarm_on => p_alarm_on
5128 , p_alarm_count => p_alarm_count
5129 , p_alarm_fired_count => p_alarm_fired_count
5130 , p_ref_object_id => p_ref_object_id
5131 , p_ref_object_type_code => p_ref_object_type_code
5132 , p_task_name => p_task_name
5133 , p_sort_data => p_sort_data
5134 , p_start_pointer => p_start_pointer
5135 , p_rec_wanted => p_rec_wanted
5136 , p_show_all => p_show_all
5137 , p_query_or_next_code => p_query_or_next_code
5138 , x_task_table => x_task_table
5139 , x_total_retrieved => x_total_retrieved
5140 , x_total_returned => x_total_returned
5141 , x_return_status => x_return_status
5142 , x_msg_count => x_msg_count
5143 , x_msg_data => x_msg_data
5144 , p_location_id => NULL
5145 );
5146 EXCEPTION
5147 WHEN fnd_api.g_exc_error THEN
5148 x_return_status := fnd_api.g_ret_sts_error;
5149 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5150 WHEN fnd_api.g_exc_unexpected_error THEN
5151 x_return_status := fnd_api.g_ret_sts_unexp_error;
5152 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5153 WHEN OTHERS THEN
5154 x_return_status := fnd_api.g_ret_sts_unexp_error;
5155
5156 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
5157 fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
5158 END IF;
5159
5160 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5161 END query_task;
5162
5163 PROCEDURE query_task(
5164 p_object_version_number IN NUMBER
5165 , p_task_id IN jtf_tasks_v.task_id%TYPE
5166 , p_description IN jtf_tasks_v.description%TYPE
5167 , p_task_type_id IN jtf_tasks_v.task_type_id%TYPE
5168 , p_task_status_id IN jtf_tasks_v.task_status_id%TYPE
5169 , p_task_priority_id IN jtf_tasks_v.task_priority_id%TYPE
5170 , p_owner_type_code IN jtf_tasks_v.owner_type_code%TYPE
5171 , p_owner_id IN jtf_tasks_v.owner_id%TYPE
5172 , p_assigned_by_id IN jtf_tasks_v.assigned_by_id%TYPE
5173 , p_address_id IN jtf_tasks_v.address_id%TYPE
5174 , p_owner_territory_id IN jtf_tasks_v.owner_territory_id%TYPE DEFAULT NULL
5175 , p_customer_id IN jtf_tasks_v.customer_id%TYPE DEFAULT NULL
5176 , p_cust_account_id IN jtf_tasks_v.cust_account_id%TYPE DEFAULT NULL
5177 , p_planned_start_date IN jtf_tasks_v.planned_start_date%TYPE
5178 , p_planned_end_date IN jtf_tasks_v.planned_end_date%TYPE
5179 , p_scheduled_start_date IN jtf_tasks_v.scheduled_start_date%TYPE
5180 , p_scheduled_end_date IN jtf_tasks_v.scheduled_end_date%TYPE
5181 , p_actual_start_date IN jtf_tasks_v.actual_start_date%TYPE
5182 , p_actual_end_date IN jtf_tasks_v.actual_end_date%TYPE
5183 , p_object_type_code IN jtf_tasks_v.source_object_type_code%TYPE
5184 , p_source_object_id IN jtf_tasks_v.source_object_id%TYPE
5185 , p_percentage_complete IN jtf_tasks_v.percentage_complete%TYPE
5186 , p_reason_code IN jtf_tasks_v.reason_code%TYPE
5187 , p_private_flag IN jtf_tasks_v.private_flag%TYPE
5188 , p_restrict_closure_flag IN jtf_tasks_v.restrict_closure_flag%TYPE
5189 , p_multi_booked_flag IN jtf_tasks_v.multi_booked_flag%TYPE
5190 , p_milestone_flag IN jtf_tasks_v.milestone_flag%TYPE
5191 , p_holiday_flag IN jtf_tasks_v.holiday_flag%TYPE
5192 , p_workflow_process_id IN jtf_tasks_v.workflow_process_id%TYPE
5193 , p_notification_flag IN jtf_tasks_v.notification_flag%TYPE
5194 , p_parent_task_id IN jtf_tasks_v.parent_task_id%TYPE
5195 , p_alarm_on IN jtf_tasks_v.alarm_on%TYPE
5196 , p_alarm_count IN jtf_tasks_v.alarm_count%TYPE
5197 , p_alarm_fired_count IN jtf_tasks_v.alarm_fired_count%TYPE
5198 , p_ref_object_id IN NUMBER
5199 , p_ref_object_type_code IN VARCHAR2
5200 , p_task_name IN jtf_tasks_v.task_name%TYPE
5201 , p_sort_data IN jtf_tasks_pub.sort_data
5202 , p_start_pointer IN NUMBER
5203 , p_rec_wanted IN NUMBER
5204 , p_show_all IN VARCHAR2
5205 , p_query_or_next_code IN VARCHAR2 DEFAULT 'Q'
5206 , x_task_table OUT NOCOPY jtf_tasks_pub.task_table_type
5207 , x_total_retrieved OUT NOCOPY NUMBER
5208 , x_total_returned OUT NOCOPY NUMBER
5209 , x_return_status OUT NOCOPY VARCHAR2
5210 , x_msg_count OUT NOCOPY NUMBER
5211 , x_msg_data OUT NOCOPY VARCHAR2
5212 , p_location_id IN NUMBER
5213 ) IS
5214 -- declare variables
5215 l_api_name VARCHAR2(30) := 'QUERY_TASK';
5216 v_cursor_id INTEGER;
5217 v_dummy INTEGER;
5218 v_cnt INTEGER;
5219 v_end INTEGER;
5220 v_start INTEGER;
5221 v_type jtf_tasks_pub.task_rec;
5222
5223 PROCEDURE create_sql_statement IS
5224 v_index INTEGER;
5225 v_first INTEGER;
5226 v_comma VARCHAR2(5);
5227 v_where VARCHAR2(2000);
5228 v_and CHAR(1) := 'N';
5229
5230 PROCEDURE add_to_sql_str(
5231 p_in VARCHAR2
5232 , --value in parameter
5233 p_bind VARCHAR2
5234 , --bind variable to use
5235 p_field VARCHAR2 --field associated with parameter
5236 ) IS
5237 v_str VARCHAR2(10);
5238 BEGIN -- add_to_sql
5239 IF (p_in IS NOT NULL) THEN
5240 IF (v_and = 'N') THEN
5241 v_str := ' ';
5242 v_and := 'Y';
5243 ELSE
5244 v_str := ' and ';
5245 END IF;
5246
5247 v_where := v_where || v_str || p_field || ' = :' || p_bind;
5248 END IF;
5249 END add_to_sql_str;
5250
5251 PROCEDURE add_to_sql(
5252 p_in NUMBER
5253 , --value in parameter
5254 p_bind VARCHAR2
5255 , --bind variable to use
5256 p_field VARCHAR2 --field associated with parameter
5257 ) IS
5258 BEGIN
5259 add_to_sql_str(TO_CHAR(p_in), p_bind, p_field);
5260 END;
5261
5262 PROCEDURE add_to_sql(
5263 p_in DATE
5264 , --value in parameter
5265 p_bind VARCHAR2
5266 , --bind variable to use
5267 p_field VARCHAR2 --field associated with parameter
5268 ) IS
5269 BEGIN
5270 add_to_sql_str(TO_CHAR(p_in, 'dd-mon-rrrr'), p_bind, p_field);
5271 END;
5272
5273 PROCEDURE add_to_sql(
5274 p_in VARCHAR2
5275 , --value in parameter
5276 p_bind VARCHAR2
5277 , --bind variable to use
5278 p_field VARCHAR2 --field associated with parameter
5279 ) IS
5280 BEGIN
5281 add_to_sql_str(p_in, p_bind, p_field);
5282 END;
5283 BEGIN --create_sql_statement
5284 v_select :=
5285 'select '
5286 || 'task_id,'
5287 || 'task_number,'
5288 || 'task_name,'
5289 || 'description,'
5290 || 'task_type_id,'
5291 || 'task_type,'
5292 || 'task_status_id,'
5293 || 'task_status,'
5294 || 'task_priority_id,'
5295 || 'task_priority,'
5296 || 'owner_type_code,'
5297 || 'owner_id,'
5298 || 'assigned_by_id,'
5299 || 'assigned_by_name,'
5300 || 'customer_id,'
5301 || 'customer_name,'
5302 || 'customer_number,'
5303 || 'address_id,'
5304 || 'planned_start_date,'
5305 || 'planned_end_date,'
5306 || 'scheduled_start_date,'
5307 || 'scheduled_end_date,'
5308 || 'actual_start_date,'
5309 || 'actual_end_date,'
5310 || 'source_object_type_code,'
5311 || 'source_object_id,'
5312 || 'source_object_name,'
5313 || 'duration,'
5314 || 'duration_uom,'
5315 || 'planned_effort,'
5316 || 'planned_effort_uom,'
5317 || 'actual_effort,'
5318 || 'actual_effort_uom,'
5319 || 'percentage_complete,'
5320 || 'reason_code,'
5321 || 'private_flag,'
5322 || 'publish_flag,'
5323 || 'multi_booked_flag,'
5324 || 'milestone_flag,'
5325 || 'holiday_flag,'
5326 || 'workflow_process_id,'
5327 || 'notification_flag,'
5328 || 'notification_period,'
5329 || 'notification_period_uom,'
5330 || 'parent_task_id,'
5331 || 'alarm_start,'
5332 || 'alarm_start_uom,'
5333 || 'alarm_on,'
5334 || 'alarm_count,'
5335 || 'alarm_fired_count,'
5336 || 'alarm_interval,'
5337 || 'alarm_interval_uom,'
5338 || 'attribute1,'
5339 || 'attribute2,'
5340 || 'attribute3,'
5341 || 'attribute4,'
5342 || 'attribute5,'
5343 || 'attribute6,'
5344 || 'attribute7,'
5345 || 'attribute8,'
5346 || 'attribute9,'
5347 || 'attribute10,'
5348 || 'attribute11,'
5349 || 'attribute12,'
5350 || 'attribute13,'
5351 || 'attribute14,'
5352 || 'attribute15,'
5353 || 'attribute_category,'
5354 || 'owner,'
5355 || 'cust_account_number,'
5356 || 'cust_account_id,'
5357 || 'owner_territory_id,'
5358 || 'creation_date, '
5359 || 'escalation_level, '
5360 || 'object_version_number, '
5361 || 'location_id '
5362 || 'from jtf_tasks_v ';
5363 add_to_sql(p_task_id, 'b1', 'task_id');
5364 add_to_sql(p_description, 'b2', 'description');
5365 add_to_sql(p_task_status_id, 'b3', 'task_status_id');
5366 add_to_sql(p_task_priority_id, 'b4', 'task_priority_id');
5367 add_to_sql(p_owner_type_code, 'b5', 'owner_type_code');
5368 add_to_sql(p_owner_id, 'b6', 'owner_id');
5369 add_to_sql(p_assigned_by_id, 'b7', 'assigned_by_id');
5370 add_to_sql(p_address_id, 'b8', 'address_id');
5371 add_to_sql(p_planned_start_date, 'b9', 'planned_start_date');
5372 add_to_sql(p_planned_end_date, 'b10', 'planned_end_date');
5373 add_to_sql(p_scheduled_start_date, 'b11', 'scheduled_start_date');
5374 add_to_sql(p_scheduled_end_date, 'b12', 'scheduled_end_date');
5375 add_to_sql(p_actual_start_date, 'b13', 'actual_start_date');
5376 add_to_sql(p_actual_end_date, 'b14', 'actual_end_date');
5377 add_to_sql(p_object_type_code, 'b15', 'source_object_type_code');
5378 add_to_sql(p_percentage_complete, 'b16', 'percentage_complete');
5379 add_to_sql(p_reason_code, 'b17', 'reason_code');
5380 add_to_sql(p_private_flag, 'b18', 'private_flag');
5381 add_to_sql(p_restrict_closure_flag, 'b19', 'restrict_closure_flag');
5382 add_to_sql(p_multi_booked_flag, 'b20', 'multi_booked_flag');
5383 add_to_sql(p_milestone_flag, 'b21', 'milestone_flag');
5384 add_to_sql(p_holiday_flag, 'b22', 'holiday_flag');
5385 add_to_sql(p_workflow_process_id, 'b23', 'workflow_process_id');
5386 add_to_sql(p_notification_flag, 'b27', 'notification_flag');
5387 add_to_sql(p_parent_task_id, 'b28', 'parent_task_id');
5388 add_to_sql(p_alarm_on, 'b29', 'alarm_on');
5389 add_to_sql(p_alarm_count, 'b30', 'alarm_count');
5390 add_to_sql(p_alarm_fired_count, 'b31', 'alarm_fired_count');
5391 add_to_sql(p_task_name, 'b32', 'task_name');
5392 add_to_sql(p_owner_territory_id, 'b33', 'owner_territory_id');
5393 add_to_sql(p_customer_id, 'b34', 'customer_id');
5394 add_to_sql(p_cust_account_id, 'b35', 'cust_account_id');
5395 add_to_sql(p_task_type_id, 'b36', 'task_type_id');
5396 add_to_sql(p_source_object_id, 'b37', 'source_object_id');
5397 add_to_sql(p_location_id, 'b38', 'location_id');
5398
5399 -- jtf_task_references table if object code given
5400 IF (p_ref_object_type_code IS NOT NULL) AND(p_ref_object_id IS NOT NULL) THEN
5401 IF (v_where IS NOT NULL) THEN
5402 v_where := v_where || ' and';
5403 END IF;
5404
5405 v_where :=
5406 v_where
5407 || ' exists '
5408 || '(select * from jtf_task_references_vl r '
5409 || ' where r.task_id = jtf_tasks_v.task_id '
5410 || ' and r.object_id = :b100 '
5411 || ' and r.object_type_code = :b101 ) ';
5412 END IF;
5413
5414 IF (v_where IS NOT NULL) THEN
5415 v_select := v_select || ' where ' || v_where;
5416 END IF;
5417
5418 IF (p_sort_data.COUNT > 0) THEN --there is a sort preference
5419 v_select := v_select || ' order by ';
5420 v_index := p_sort_data.FIRST;
5421 v_first := v_index;
5422
5423 LOOP
5424 IF (v_first = v_index) THEN
5425 v_comma := ' ';
5426 ELSE
5427 v_comma := ', ';
5428 END IF;
5429
5430 v_select := v_select || v_comma || p_sort_data(v_index).field_name || ' ';
5431
5432 -- ascending or descending order
5433 IF (p_sort_data(v_index).asc_dsc_flag = 'A') THEN
5434 v_select := v_select || 'asc ';
5435 ELSIF(p_sort_data(v_index).asc_dsc_flag = 'D') THEN
5436 v_select := v_select || 'desc ';
5437 END IF;
5438
5439 EXIT WHEN v_index = p_sort_data.LAST;
5440 v_index := p_sort_data.NEXT(v_index);
5441 END LOOP;
5442 END IF;
5443 END create_sql_statement;
5444 BEGIN -- query task
5445 x_return_status := fnd_api.g_ret_sts_success;
5446 x_task_table.DELETE;
5447
5448 IF (p_query_or_next_code = 'Q') THEN
5449 v_tbl.DELETE;
5450 create_sql_statement;
5451 --dump_long_line('v_sel:',v_select);
5452 v_cursor_id := DBMS_SQL.open_cursor;
5453 DBMS_SQL.parse(v_cursor_id, v_select, DBMS_SQL.v7);
5454
5455 -- bind variables only if they added to the sql statement
5456 IF (p_task_id IS NOT NULL) THEN
5457 DBMS_SQL.bind_variable(v_cursor_id, ':b1', p_task_id);
5458 END IF;
5459
5460 IF (p_description IS NOT NULL) THEN
5461 DBMS_SQL.bind_variable(v_cursor_id, ':b2', p_description);
5462 END IF;
5463
5464 IF (p_task_status_id IS NOT NULL) THEN
5465 DBMS_SQL.bind_variable(v_cursor_id, ':b3', p_task_status_id);
5466 END IF;
5467
5468 IF (p_task_priority_id IS NOT NULL) THEN
5469 DBMS_SQL.bind_variable(v_cursor_id, ':b4', p_task_priority_id);
5470 END IF;
5471
5472 IF (p_owner_type_code IS NOT NULL) THEN
5473 DBMS_SQL.bind_variable(v_cursor_id, ':b5', p_owner_type_code);
5474 END IF;
5475
5476 IF (p_owner_id IS NOT NULL) THEN
5477 DBMS_SQL.bind_variable(v_cursor_id, ':b6', p_owner_id);
5478 END IF;
5479
5480 IF (p_assigned_by_id IS NOT NULL) THEN
5481 DBMS_SQL.bind_variable(v_cursor_id, ':b7', p_assigned_by_id);
5482 END IF;
5483
5484 IF (p_address_id IS NOT NULL) THEN
5485 DBMS_SQL.bind_variable(v_cursor_id, ':b8', p_address_id);
5486 END IF;
5487
5488 IF (p_planned_start_date IS NOT NULL) THEN
5489 DBMS_SQL.bind_variable(v_cursor_id, ':b9', p_planned_start_date);
5490 END IF;
5491
5492 IF (p_planned_end_date IS NOT NULL) THEN
5493 DBMS_SQL.bind_variable(v_cursor_id, ':b10', p_planned_end_date);
5494 END IF;
5495
5496 IF (p_scheduled_start_date IS NOT NULL) THEN
5497 DBMS_SQL.bind_variable(v_cursor_id, ':b11', p_scheduled_start_date);
5498 END IF;
5499
5500 IF (p_scheduled_end_date IS NOT NULL) THEN
5501 DBMS_SQL.bind_variable(v_cursor_id, ':b12', p_scheduled_end_date);
5502 END IF;
5503
5504 IF (p_actual_start_date IS NOT NULL) THEN
5505 DBMS_SQL.bind_variable(v_cursor_id, ':b13', p_actual_start_date);
5506 END IF;
5507
5508 IF (p_actual_end_date IS NOT NULL) THEN
5509 DBMS_SQL.bind_variable(v_cursor_id, ':b14', p_actual_end_date);
5510 END IF;
5511
5512 IF (p_object_type_code IS NOT NULL) THEN
5513 DBMS_SQL.bind_variable(v_cursor_id, ':b15', p_object_type_code);
5514 END IF;
5515
5516 IF (p_percentage_complete IS NOT NULL) THEN
5517 DBMS_SQL.bind_variable(v_cursor_id, ':b16', p_percentage_complete);
5518 END IF;
5519
5520 IF (p_reason_code IS NOT NULL) THEN
5521 DBMS_SQL.bind_variable(v_cursor_id, ':b17', p_reason_code);
5522 END IF;
5523
5524 IF (p_private_flag IS NOT NULL) THEN
5525 DBMS_SQL.bind_variable(v_cursor_id, ':b18', p_private_flag);
5526 END IF;
5527
5528 IF (p_restrict_closure_flag IS NOT NULL) THEN
5529 DBMS_SQL.bind_variable(v_cursor_id, ':b19', p_restrict_closure_flag);
5530 END IF;
5531
5532 IF (p_multi_booked_flag IS NOT NULL) THEN
5533 DBMS_SQL.bind_variable(v_cursor_id, ':b20', p_multi_booked_flag);
5534 END IF;
5535
5536 IF (p_milestone_flag IS NOT NULL) THEN
5537 DBMS_SQL.bind_variable(v_cursor_id, ':b21', p_milestone_flag);
5538 END IF;
5539
5540 IF (p_holiday_flag IS NOT NULL) THEN
5541 DBMS_SQL.bind_variable(v_cursor_id, ':b22', p_holiday_flag);
5542 END IF;
5543
5544 IF (p_workflow_process_id IS NOT NULL) THEN
5545 DBMS_SQL.bind_variable(v_cursor_id, ':b23', p_workflow_process_id);
5546 END IF;
5547
5548 IF (p_notification_flag IS NOT NULL) THEN
5549 DBMS_SQL.bind_variable(v_cursor_id, ':b27', p_notification_flag);
5550 END IF;
5551
5552 IF (p_parent_task_id IS NOT NULL) THEN
5553 DBMS_SQL.bind_variable(v_cursor_id, ':b28', p_parent_task_id);
5554 END IF;
5555
5556 IF (p_alarm_on IS NOT NULL) THEN
5557 DBMS_SQL.bind_variable(v_cursor_id, ':b29', p_alarm_on);
5558 END IF;
5559
5560 IF (p_alarm_count IS NOT NULL) THEN
5561 DBMS_SQL.bind_variable(v_cursor_id, ':b30', p_alarm_count);
5562 END IF;
5563
5564 IF (p_alarm_fired_count IS NOT NULL) THEN
5565 DBMS_SQL.bind_variable(v_cursor_id, ':b31', p_alarm_fired_count);
5566 END IF;
5567
5568 IF (p_task_name IS NOT NULL) THEN
5569 DBMS_SQL.bind_variable(v_cursor_id, ':b32', p_task_name);
5570 END IF;
5571
5572 IF (p_owner_territory_id IS NOT NULL) THEN
5573 DBMS_SQL.bind_variable(v_cursor_id, ':b33', p_owner_territory_id);
5574 END IF;
5575
5576 IF (p_customer_id IS NOT NULL) THEN
5577 DBMS_SQL.bind_variable(v_cursor_id, ':b34', p_customer_id);
5578 END IF;
5579
5580 IF (p_cust_account_id IS NOT NULL) THEN
5581 DBMS_SQL.bind_variable(v_cursor_id, ':b35', p_cust_account_id);
5582 END IF;
5583
5584 IF (p_task_type_id IS NOT NULL) THEN
5585 DBMS_SQL.bind_variable(v_cursor_id, ':b36', p_task_type_id);
5586 END IF;
5587
5588 IF (p_source_object_id IS NOT NULL) THEN
5589 DBMS_SQL.bind_variable(v_cursor_id, ':b37', p_source_object_id);
5590 END IF;
5591
5592 IF (p_location_id IS NOT NULL) THEN
5593 DBMS_SQL.bind_variable(v_cursor_id, ':b38', p_location_id);
5594 END IF;
5595
5596 IF (p_ref_object_type_code IS NOT NULL) AND(p_ref_object_id IS NOT NULL) THEN
5597 DBMS_SQL.bind_variable(v_cursor_id, ':b100', p_ref_object_id);
5598 DBMS_SQL.bind_variable(v_cursor_id, ':b101', p_ref_object_type_code);
5599 END IF;
5600
5601 -- define the output columns
5602 DBMS_SQL.define_column(v_cursor_id, 1, v_type.task_id);
5603 DBMS_SQL.define_column(v_cursor_id, 2, v_type.task_number, 30);
5604 DBMS_SQL.define_column(v_cursor_id, 3, v_type.task_name, 80);
5605 DBMS_SQL.define_column(v_cursor_id, 4, v_type.description, 4000);
5606 DBMS_SQL.define_column(v_cursor_id, 5, v_type.task_type_id);
5607 DBMS_SQL.define_column(v_cursor_id, 6, v_type.task_type, 30);
5608 DBMS_SQL.define_column(v_cursor_id, 7, v_type.task_status_id);
5609 DBMS_SQL.define_column(v_cursor_id, 8, v_type.task_status, 30);
5610 DBMS_SQL.define_column(v_cursor_id, 9, v_type.task_priority_id);
5611 DBMS_SQL.define_column(v_cursor_id, 10, v_type.task_priority, 30);
5612 DBMS_SQL.define_column(v_cursor_id, 11, v_type.owner_type_code, 20);
5613 DBMS_SQL.define_column(v_cursor_id, 12, v_type.owner_id);
5614 DBMS_SQL.define_column(v_cursor_id, 13, v_type.assigned_by_id);
5615 DBMS_SQL.define_column(v_cursor_id, 14, v_type.assigned_by_name, 100);
5616 DBMS_SQL.define_column(v_cursor_id, 15, v_type.customer_id);
5617 DBMS_SQL.define_column(v_cursor_id, 16, v_type.customer_name, 255);
5618 DBMS_SQL.define_column(v_cursor_id, 17, v_type.customer_number, 30);
5619 DBMS_SQL.define_column(v_cursor_id, 18, v_type.address_id);
5620 DBMS_SQL.define_column(v_cursor_id, 19, v_type.planned_start_date);
5621 DBMS_SQL.define_column(v_cursor_id, 20, v_type.planned_end_date);
5622 DBMS_SQL.define_column(v_cursor_id, 21, v_type.scheduled_start_date);
5623 DBMS_SQL.define_column(v_cursor_id, 22, v_type.scheduled_end_date);
5624 DBMS_SQL.define_column(v_cursor_id, 23, v_type.actual_start_date);
5625 DBMS_SQL.define_column(v_cursor_id, 24, v_type.actual_end_date);
5626 DBMS_SQL.define_column(v_cursor_id, 25, v_type.object_type_code, 30);
5627 DBMS_SQL.define_column(v_cursor_id, 26, v_type.object_id);
5628 DBMS_SQL.define_column(v_cursor_id, 27, v_type.obect_name, 30);
5629 DBMS_SQL.define_column(v_cursor_id, 28, v_type.DURATION);
5630 DBMS_SQL.define_column(v_cursor_id, 29, v_type.duration_uom, 3);
5631 DBMS_SQL.define_column(v_cursor_id, 30, v_type.planned_effort);
5632 DBMS_SQL.define_column(v_cursor_id, 31, v_type.planned_effort_uom, 3);
5633 DBMS_SQL.define_column(v_cursor_id, 32, v_type.actual_effort);
5634 DBMS_SQL.define_column(v_cursor_id, 33, v_type.actual_effort_uom, 3);
5635 DBMS_SQL.define_column(v_cursor_id, 34, v_type.percentage_complete);
5636 DBMS_SQL.define_column(v_cursor_id, 35, v_type.reason_code, 30);
5637 DBMS_SQL.define_column(v_cursor_id, 36, v_type.private_flag, 1);
5638 DBMS_SQL.define_column(v_cursor_id, 37, v_type.publish_flag, 1);
5639 DBMS_SQL.define_column(v_cursor_id, 38, v_type.multi_booked_flag, 1);
5640 DBMS_SQL.define_column(v_cursor_id, 39, v_type.milestone_flag, 1);
5641 DBMS_SQL.define_column(v_cursor_id, 40, v_type.holiday_flag, 1);
5642 DBMS_SQL.define_column(v_cursor_id, 41, v_type.workflow_process_id);
5643 DBMS_SQL.define_column(v_cursor_id, 42, v_type.notification_flag, 1);
5644 DBMS_SQL.define_column(v_cursor_id, 43, v_type.notification_period);
5645 DBMS_SQL.define_column(v_cursor_id, 44, v_type.notification_period_uom, 3);
5646 DBMS_SQL.define_column(v_cursor_id, 45, v_type.parent_task_id);
5647 DBMS_SQL.define_column(v_cursor_id, 46, v_type.alarm_start);
5648 DBMS_SQL.define_column(v_cursor_id, 47, v_type.alarm_start_uom, 3);
5649 DBMS_SQL.define_column(v_cursor_id, 48, v_type.alarm_on, 1);
5650 DBMS_SQL.define_column(v_cursor_id, 49, v_type.alarm_count);
5651 DBMS_SQL.define_column(v_cursor_id, 50, v_type.alarm_fired_count);
5652 DBMS_SQL.define_column(v_cursor_id, 51, v_type.alarm_interval);
5653 DBMS_SQL.define_column(v_cursor_id, 52, v_type.alarm_interval_uom, 3);
5654 DBMS_SQL.define_column(v_cursor_id, 53, v_type.attribute1, 150);
5655 DBMS_SQL.define_column(v_cursor_id, 54, v_type.attribute2, 150);
5656 DBMS_SQL.define_column(v_cursor_id, 55, v_type.attribute3, 150);
5657 DBMS_SQL.define_column(v_cursor_id, 56, v_type.attribute4, 150);
5658 DBMS_SQL.define_column(v_cursor_id, 57, v_type.attribute5, 150);
5659 DBMS_SQL.define_column(v_cursor_id, 58, v_type.attribute6, 150);
5660 DBMS_SQL.define_column(v_cursor_id, 59, v_type.attribute7, 150);
5661 DBMS_SQL.define_column(v_cursor_id, 60, v_type.attribute8, 150);
5662 DBMS_SQL.define_column(v_cursor_id, 61, v_type.attribute9, 150);
5663 DBMS_SQL.define_column(v_cursor_id, 62, v_type.attribute10, 150);
5664 DBMS_SQL.define_column(v_cursor_id, 63, v_type.attribute11, 150);
5665 DBMS_SQL.define_column(v_cursor_id, 64, v_type.attribute12, 150);
5666 DBMS_SQL.define_column(v_cursor_id, 65, v_type.attribute13, 150);
5667 DBMS_SQL.define_column(v_cursor_id, 66, v_type.attribute14, 150);
5668 DBMS_SQL.define_column(v_cursor_id, 67, v_type.attribute15, 150);
5669 DBMS_SQL.define_column(v_cursor_id, 68, v_type.attribute_category, 150);
5670 DBMS_SQL.define_column(v_cursor_id, 69, v_type.owner, 100);
5671 DBMS_SQL.define_column(v_cursor_id, 70, v_type.cust_account_number, 30);
5672 DBMS_SQL.define_column(v_cursor_id, 71, v_type.cust_account_id);
5673 DBMS_SQL.define_column(v_cursor_id, 72, v_type.owner_territory_id);
5674 DBMS_SQL.define_column(v_cursor_id, 73, v_type.creation_date);
5675 DBMS_SQL.define_column(v_cursor_id, 74, v_type.escalation_level, 30);
5676 DBMS_SQL.define_column(v_cursor_id, 75, v_type.object_version_number);
5677 DBMS_SQL.define_column(v_cursor_id, 76, v_type.location_id);
5678 v_dummy := DBMS_SQL.EXECUTE(v_cursor_id);
5679 v_cnt := 0;
5680
5681 LOOP
5682 EXIT WHEN(DBMS_SQL.fetch_rows(v_cursor_id) = 0);
5683 v_cnt := v_cnt + 1;
5684 -- retrieve the rows from the buffer
5685 DBMS_SQL.column_value(v_cursor_id, 1, v_type.task_id);
5686 DBMS_SQL.column_value(v_cursor_id, 2, v_type.task_number);
5687 DBMS_SQL.column_value(v_cursor_id, 3, v_type.task_name);
5688 DBMS_SQL.column_value(v_cursor_id, 4, v_type.description);
5689 DBMS_SQL.column_value(v_cursor_id, 5, v_type.task_type_id);
5690 DBMS_SQL.column_value(v_cursor_id, 6, v_type.task_type);
5691 DBMS_SQL.column_value(v_cursor_id, 7, v_type.task_status_id);
5692 DBMS_SQL.column_value(v_cursor_id, 8, v_type.task_status);
5693 DBMS_SQL.column_value(v_cursor_id, 9, v_type.task_priority_id);
5694 DBMS_SQL.column_value(v_cursor_id, 10, v_type.task_priority);
5695 DBMS_SQL.column_value(v_cursor_id, 11, v_type.owner_type_code);
5696 DBMS_SQL.column_value(v_cursor_id, 12, v_type.owner_id);
5697 DBMS_SQL.column_value(v_cursor_id, 13, v_type.assigned_by_id);
5698 DBMS_SQL.column_value(v_cursor_id, 14, v_type.assigned_by_name);
5699 DBMS_SQL.column_value(v_cursor_id, 15, v_type.customer_id);
5700 DBMS_SQL.column_value(v_cursor_id, 16, v_type.customer_name);
5701 DBMS_SQL.column_value(v_cursor_id, 17, v_type.customer_number);
5702 DBMS_SQL.column_value(v_cursor_id, 18, v_type.address_id);
5703 DBMS_SQL.column_value(v_cursor_id, 19, v_type.planned_start_date);
5704 DBMS_SQL.column_value(v_cursor_id, 20, v_type.planned_end_date);
5705 DBMS_SQL.column_value(v_cursor_id, 21, v_type.scheduled_start_date);
5706 DBMS_SQL.column_value(v_cursor_id, 22, v_type.scheduled_end_date);
5707 DBMS_SQL.column_value(v_cursor_id, 23, v_type.actual_start_date);
5708 DBMS_SQL.column_value(v_cursor_id, 24, v_type.actual_end_date);
5709 DBMS_SQL.column_value(v_cursor_id, 25, v_type.object_type_code);
5710 DBMS_SQL.column_value(v_cursor_id, 26, v_type.object_id);
5711 DBMS_SQL.column_value(v_cursor_id, 27, v_type.obect_name);
5712 DBMS_SQL.column_value(v_cursor_id, 28, v_type.DURATION);
5713 DBMS_SQL.column_value(v_cursor_id, 29, v_type.duration_uom);
5714 DBMS_SQL.column_value(v_cursor_id, 30, v_type.planned_effort);
5715 DBMS_SQL.column_value(v_cursor_id, 31, v_type.planned_effort_uom);
5716 DBMS_SQL.column_value(v_cursor_id, 32, v_type.actual_effort);
5717 DBMS_SQL.column_value(v_cursor_id, 33, v_type.actual_effort_uom);
5718 DBMS_SQL.column_value(v_cursor_id, 34, v_type.percentage_complete);
5719 DBMS_SQL.column_value(v_cursor_id, 35, v_type.reason_code);
5720 DBMS_SQL.column_value(v_cursor_id, 36, v_type.private_flag);
5721 DBMS_SQL.column_value(v_cursor_id, 37, v_type.publish_flag);
5722 DBMS_SQL.column_value(v_cursor_id, 38, v_type.multi_booked_flag);
5723 DBMS_SQL.column_value(v_cursor_id, 39, v_type.milestone_flag);
5724 DBMS_SQL.column_value(v_cursor_id, 40, v_type.holiday_flag);
5725 DBMS_SQL.column_value(v_cursor_id, 41, v_type.workflow_process_id);
5726 DBMS_SQL.column_value(v_cursor_id, 42, v_type.notification_flag);
5727 DBMS_SQL.column_value(v_cursor_id, 43, v_type.notification_period);
5728 DBMS_SQL.column_value(v_cursor_id, 44, v_type.notification_period_uom);
5729 DBMS_SQL.column_value(v_cursor_id, 45, v_type.parent_task_id);
5730 DBMS_SQL.column_value(v_cursor_id, 46, v_type.alarm_start);
5731 DBMS_SQL.column_value(v_cursor_id, 47, v_type.alarm_start_uom);
5732 DBMS_SQL.column_value(v_cursor_id, 48, v_type.alarm_on);
5733 DBMS_SQL.column_value(v_cursor_id, 49, v_type.alarm_count);
5734 DBMS_SQL.column_value(v_cursor_id, 50, v_type.alarm_fired_count);
5735 DBMS_SQL.column_value(v_cursor_id, 51, v_type.alarm_interval);
5736 DBMS_SQL.column_value(v_cursor_id, 52, v_type.alarm_interval_uom);
5737 DBMS_SQL.column_value(v_cursor_id, 53, v_type.attribute1);
5738 DBMS_SQL.column_value(v_cursor_id, 54, v_type.attribute2);
5739 DBMS_SQL.column_value(v_cursor_id, 55, v_type.attribute3);
5740 DBMS_SQL.column_value(v_cursor_id, 56, v_type.attribute4);
5741 DBMS_SQL.column_value(v_cursor_id, 57, v_type.attribute5);
5742 DBMS_SQL.column_value(v_cursor_id, 58, v_type.attribute6);
5743 DBMS_SQL.column_value(v_cursor_id, 59, v_type.attribute7);
5744 DBMS_SQL.column_value(v_cursor_id, 60, v_type.attribute8);
5745 DBMS_SQL.column_value(v_cursor_id, 61, v_type.attribute9);
5746 DBMS_SQL.column_value(v_cursor_id, 62, v_type.attribute10);
5747 DBMS_SQL.column_value(v_cursor_id, 63, v_type.attribute11);
5748 DBMS_SQL.column_value(v_cursor_id, 64, v_type.attribute12);
5749 DBMS_SQL.column_value(v_cursor_id, 65, v_type.attribute13);
5750 DBMS_SQL.column_value(v_cursor_id, 66, v_type.attribute14);
5751 DBMS_SQL.column_value(v_cursor_id, 67, v_type.attribute15);
5752 DBMS_SQL.column_value(v_cursor_id, 68, v_type.attribute_category);
5753 DBMS_SQL.column_value(v_cursor_id, 69, v_type.owner);
5754 DBMS_SQL.column_value(v_cursor_id, 70, v_type.cust_account_number);
5755 DBMS_SQL.column_value(v_cursor_id, 71, v_type.cust_account_id);
5756 DBMS_SQL.column_value(v_cursor_id, 72, v_type.owner_territory_id);
5757 DBMS_SQL.column_value(v_cursor_id, 73, v_type.creation_date);
5758 DBMS_SQL.column_value(v_cursor_id, 74, v_type.escalation_level);
5759 DBMS_SQL.column_value(v_cursor_id, 75, v_type.object_version_number);
5760 DBMS_SQL.column_value(v_cursor_id, 76, v_type.location_id);
5761 -- 'v_type.task_id:'||
5762 -- to_char(v_type.task_id));
5763 v_tbl(v_cnt) := v_type;
5764 END LOOP;
5765
5766 DBMS_SQL.close_cursor(v_cursor_id);
5767 END IF; --p_query_or_next_code;
5768
5769 -- copy records to be returned back
5770 x_total_retrieved := v_tbl.COUNT;
5771
5772 -- if table is empty do nothing
5773 IF (x_total_retrieved > 0) THEN
5774 IF (p_show_all = 'Y') THEN -- return all the rows
5775 v_start := v_tbl.FIRST;
5776 v_end := v_tbl.LAST;
5777 ELSE
5778 v_start := p_start_pointer;
5779 v_end := p_start_pointer + p_rec_wanted - 1;
5780
5781 IF (v_end > v_tbl.LAST) THEN
5782 v_end := v_tbl.LAST;
5783 END IF;
5784 END IF;
5785
5786 FOR v_cnt IN v_start .. v_end LOOP
5787 x_task_table(v_cnt) := v_tbl(v_cnt);
5788 END LOOP;
5789 END IF;
5790
5791 x_total_returned := x_task_table.COUNT;
5792 EXCEPTION
5793 WHEN fnd_api.g_exc_error THEN
5794 x_return_status := fnd_api.g_ret_sts_error;
5795 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5796 WHEN fnd_api.g_exc_unexpected_error THEN
5797 x_return_status := fnd_api.g_ret_sts_unexp_error;
5798 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5799 WHEN OTHERS THEN
5800 x_return_status := fnd_api.g_ret_sts_unexp_error;
5801
5802 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
5803 fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
5804 END IF;
5805
5806 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
5807 END query_task;
5808
5809 PROCEDURE query_next_task(
5810 p_object_version_number IN NUMBER
5811 , p_task_id IN jtf_tasks_v.task_id%TYPE
5812 , -- current task id
5813 p_query_type IN VARCHAR2 DEFAULT 'Dependency'
5814 , -- values Dependency or Date
5815 p_date_type IN VARCHAR2 DEFAULT NULL
5816 , p_date_start_or_end IN VARCHAR2 DEFAULT NULL
5817 , -- start or end
5818 p_owner_id IN jtf_tasks_v.owner_id%TYPE DEFAULT NULL
5819 , p_owner_type_code IN jtf_tasks_v.owner_type_code%TYPE DEFAULT NULL
5820 , p_assigned_by IN jtf_tasks_v.assigned_by_id%TYPE DEFAULT NULL
5821 , p_sort_data IN jtf_tasks_pub.sort_data
5822 , p_start_pointer IN NUMBER
5823 , p_rec_wanted IN NUMBER
5824 , p_show_all IN VARCHAR2 DEFAULT 'Y'
5825 , p_query_or_next_code IN VARCHAR2 DEFAULT 'Q'
5826 , x_task_table OUT NOCOPY jtf_tasks_pub.task_table_type
5827 , x_total_retrieved OUT NOCOPY NUMBER
5828 , x_total_returned OUT NOCOPY NUMBER
5829 , x_return_status OUT NOCOPY VARCHAR2
5830 , x_msg_count OUT NOCOPY NUMBER
5831 , x_msg_data OUT NOCOPY VARCHAR2
5832 ) IS
5833 -- declare variables
5834 l_api_name VARCHAR2(30) := 'QUERY_NEXT_TASK';
5835 v_cursor_id INTEGER;
5836 v_dummy INTEGER;
5837 v_cnt INTEGER;
5838 v_end INTEGER;
5839 v_start INTEGER;
5840 v_key_date DATE; -- stores date for query string
5841 v_find_date DATE;
5842 v_type jtf_tasks_pub.task_rec;
5843
5844 PROCEDURE create_sql_statement IS
5845 v_index INTEGER;
5846 v_first INTEGER;
5847 v_comma VARCHAR2(5);
5848 v_where VARCHAR2(2000);
5849 v_and CHAR(1) := 'N';
5850 v_date_sql VARCHAR2(500);
5851 -- build the date field we are going to key on
5852 v_select_date VARCHAR2(50) := UPPER(p_date_type || '_' || p_date_start_or_end || '_date');
5853 -- build the date field for the sub-query, always a 'start'
5854 v_start_date VARCHAR2(50) := UPPER(p_date_type || '_start_date');
5855
5856 PROCEDURE add_to_sql_str(
5857 p_in VARCHAR2
5858 , --value in parameter
5859 p_bind VARCHAR2
5860 , --bind variable to use
5861 p_field VARCHAR2 --field associated with parameter
5862 ) IS
5863 v_str VARCHAR2(10);
5864 BEGIN -- add_to_sql
5865 IF (p_in IS NOT NULL) THEN
5866 IF (v_and = 'N') THEN
5867 v_str := ' ';
5868 v_and := 'Y';
5869 ELSE
5870 v_str := ' and ';
5871 END IF;
5872
5873 v_where := v_where || v_str || p_field || ' = :' || p_bind;
5874 END IF;
5875 END add_to_sql_str;
5876
5877 PROCEDURE add_to_sql(
5878 p_in NUMBER
5879 , --value in parameter
5880 p_bind VARCHAR2
5881 , --bind variable to use
5882 p_field VARCHAR2 --field associated with parameter
5883 ) IS
5884 BEGIN
5885 add_to_sql_str(TO_CHAR(p_in), p_bind, p_field);
5886 END;
5887
5888 PROCEDURE add_to_sql(
5889 p_in DATE
5890 , --value in parameter
5891 p_bind VARCHAR2
5892 , --bind variable to use
5893 p_field VARCHAR2 --field associated with parameter
5894 ) IS
5895 BEGIN
5896 add_to_sql_str(TO_CHAR(p_in, 'dd-mon-rrrr'), p_bind, p_field);
5897 END;
5898
5899 PROCEDURE add_to_sql(
5900 p_in VARCHAR2
5901 , --value in parameter
5902 p_bind VARCHAR2
5903 , --bind variable to use
5904 p_field VARCHAR2 --field associated with parameter
5905 ) IS
5906 BEGIN
5907 add_to_sql_str(p_in, p_bind, p_field);
5908 END;
5909
5910 FUNCTION get_date(p_date_field IN VARCHAR2, p_task_id IN NUMBER)
5911 RETURN DATE IS
5912 -- Commented out by SBARAT on 30/05/2006 for perf bug# 5213367
5913 /*cursor c_get_date is
5914 select decode (p_date_field,
5915 'PLANNED_START_DATE', planned_start_date,
5916 'PLANNED_END_DATE', planned_end_date,
5917 'SCHEDULED_START_DATE', scheduled_start_date,
5918 'SCHEDULED_END_DATE', scheduled_end_date,
5919 'ACTUAL_START_DATE', actual_start_date,
5920 'ACTUAL_END_DATE', actual_end_date, null)
5921 from jtf_tasks_v
5922 where task_id = p_task_id;*/
5923
5924 -- Added by SBARAT on 30/05/2006 for perf bug# 5213367
5925 -- This query takea less sharable memory compared to previous one.
5926 CURSOR c_get_date IS
5927 SELECT DECODE(
5928 p_date_field
5929 , 'PLANNED_START_DATE', planned_start_date
5930 , 'PLANNED_END_DATE', planned_end_date
5931 , 'SCHEDULED_START_DATE', scheduled_start_date
5932 , 'SCHEDULED_END_DATE', scheduled_end_date
5933 , 'ACTUAL_START_DATE', actual_start_date
5934 , 'ACTUAL_END_DATE', actual_end_date
5935 , NULL
5936 )
5937 FROM jtf_tasks_vl jta
5938 , jtf_task_types_tl jttt
5939 , jtf_task_types_b jttb
5940 , jtf_task_statuses_tl jtst
5941 , jtf_task_statuses_b jtsb
5942 , jtf_task_priorities_tl jtpt
5943 , jtf_objects_tl jtot
5944 , jtf_objects_b jtob
5945 , jtf_objects_tl jto2
5946 WHERE jta.task_id = p_task_id
5947 AND jta.task_type_id = jttb.task_type_id
5948 AND jta.task_status_id = jtsb.task_status_id
5949 AND (jta.deleted_flag <> 'Y' OR jta.deleted_flag IS NULL)
5950 AND jta.task_priority_id = jtpt.task_priority_id(+)
5951 AND jta.source_object_type_code = jtob.object_code
5952 AND jta.owner_type_code = jto2.object_code
5953 AND jttb.task_type_id <> 22
5954 AND NVL(jtpt.LANGUAGE, USERENV('lang')) = USERENV('lang')
5955 AND jttt.LANGUAGE = USERENV('lang')
5956 AND jttt.task_type_id = jta.task_type_id
5957 AND jtst.LANGUAGE = USERENV('lang')
5958 AND jtst.task_status_id = jta.task_status_id
5959 AND jtot.LANGUAGE = USERENV('lang')
5960 AND jtot.object_code = jtob.object_code
5961 AND jto2.LANGUAGE = USERENV('lang');
5962
5963 v_return_date DATE;
5964 BEGIN
5965 OPEN c_get_date;
5966
5967 FETCH c_get_date
5968 INTO v_return_date;
5969
5970 IF (c_get_date%NOTFOUND) THEN
5971 CLOSE c_get_date;
5972
5973 fnd_message.set_name('JTF', 'JTF_TK_NO_DATE');
5974 fnd_msg_pub.ADD;
5975 RAISE fnd_api.g_exc_error;
5976 ELSE
5977 CLOSE c_get_date;
5978 END IF;
5979
5980 RETURN(v_return_date);
5981 END get_date;
5982 BEGIN --create_sql_statement
5983 v_select :=
5984 'select '
5985 || 'v.task_id,'
5986 || 'v.task_number,'
5987 || 'v.task_name,'
5988 || 'v.description,'
5989 || 'v.task_type_id,'
5990 || 'v.task_type,'
5991 || 'v.task_status_id,'
5992 || 'v.task_status,'
5993 || 'v.task_priority_id,'
5994 || 'v.task_priority,'
5995 || 'v.owner_type_code,'
5996 || 'v.owner_id,'
5997 || 'v.assigned_by_id,'
5998 || 'v.assigned_by_name,'
5999 || 'v.customer_id,'
6000 || 'v.customer_name,'
6001 || 'v.customer_number,'
6002 || 'v.address_id,'
6003 || 'v.planned_start_date,'
6004 || 'v.planned_end_date,'
6005 || 'v.scheduled_start_date,'
6006 || 'v.scheduled_end_date,'
6007 || 'v.actual_start_date,'
6008 || 'v.actual_end_date,'
6009 || 'v.source_object_type_code,'
6010 || 'v.source_object_id,'
6011 || 'v.source_object_name,'
6012 || 'v.duration,'
6013 || 'v.duration_uom,'
6014 || 'v.planned_effort,'
6015 || 'v.planned_effort_uom,'
6016 || 'v.actual_effort,'
6017 || 'v.actual_effort_uom,'
6018 || 'v.percentage_complete,'
6019 || 'v.reason_code,'
6020 || 'v.private_flag,'
6021 || 'v.publish_flag,'
6022 || 'v.multi_booked_flag,'
6023 || 'v.milestone_flag,'
6024 || 'v.holiday_flag,'
6025 || 'v.workflow_process_id,'
6026 || 'v.notification_flag,'
6027 || 'v.notification_period,'
6028 || 'v.notification_period_uom,'
6029 || 'v.parent_task_id,'
6030 || 'v.alarm_start,'
6031 || 'v.alarm_start_uom,'
6032 || 'v.alarm_on,'
6033 || 'v.alarm_count,'
6034 || 'v.alarm_fired_count,'
6035 || 'v.alarm_interval,'
6036 || 'v.alarm_interval_uom,'
6037 || 'v.attribute1,'
6038 || 'v.attribute2,'
6039 || 'v.attribute3,'
6040 || 'v.attribute4,'
6041 || 'v.attribute5,'
6042 || 'v.attribute6,'
6043 || 'v.attribute7,'
6044 || 'v.attribute8,'
6045 || 'v.attribute9,'
6046 || 'v.attribute10,'
6047 || 'v.attribute11,'
6048 || 'v.attribute12,'
6049 || 'v.attribute13,'
6050 || 'v.attribute14,'
6051 || 'v.attribute15,'
6052 || 'v.attribute_category '
6053 || 'from jtf_tasks_v v ';
6054
6055 IF (p_query_type = 'DEPENDENCY') THEN
6056 v_select := v_select || ', jtf_task_depends d ';
6057 add_to_sql(p_task_id, 'b1', 'd.dependent_on_task_id');
6058
6059 IF (v_where IS NOT NULL) THEN
6060 v_select := v_select || ' where v.task_id = d.task_id and ' || v_where;
6061 END IF;
6062 ELSE -- must be assigned or owner
6063 v_key_date := get_date(v_select_date, p_task_id);
6064
6065 IF (p_query_type = 'ASSIGNED') THEN
6066 v_date_sql :=
6067 'select min('
6068 || v_start_date
6069 || ') from jtf_tasks_v where assigned_by_id = '
6070 || TO_CHAR(p_assigned_by)
6071 || ' and '
6072 || v_start_date
6073 || ' > :1 ';
6074
6075 EXECUTE IMMEDIATE v_date_sql
6076 INTO v_find_date
6077 USING v_key_date;
6078
6079 add_to_sql(p_assigned_by, 'b10', 'assigned_by_id');
6080 v_where := v_where || ' and ' || v_start_date || ' = :b11 ';
6081 ELSIF(p_query_type = 'OWNER') THEN
6082 v_date_sql :=
6083 'select min('
6084 || v_start_date
6085 || ') from jtf_tasks_v where owner_type_code = '''
6086 || p_owner_type_code
6087 || ''' and '
6088 || 'owner_id = '
6089 || TO_CHAR(p_owner_id)
6090 || ' and '
6091 || v_start_date
6092 || ' > :1 ';
6093
6094 EXECUTE IMMEDIATE v_date_sql
6095 INTO v_find_date
6096 USING v_key_date;
6097
6098 add_to_sql(p_owner_type_code, 'b100', 'owner_type_code');
6099 add_to_sql(p_owner_id, 'b101', 'owner_id');
6100 v_where := v_where || ' and ' || v_start_date || ' = :b102 ';
6101 END IF;
6102
6103 IF (v_where IS NOT NULL) THEN
6104 v_select := v_select || ' where ' || v_where;
6105 END IF;
6106 END IF;
6107
6108 IF (p_sort_data.COUNT > 0) THEN --there is a sort preference
6109 v_select := v_select || ' order by ';
6110 v_index := p_sort_data.FIRST;
6111 v_first := v_index;
6112
6113 LOOP
6114 IF (v_first = v_index) THEN
6115 v_comma := ' ';
6116 ELSE
6117 v_comma := ', ';
6118 END IF;
6119
6120 v_select := v_select || v_comma || p_sort_data(v_index).field_name || ' ';
6121
6122 -- ascending or descending order
6123 IF (p_sort_data(v_index).asc_dsc_flag = 'A') THEN
6124 v_select := v_select || 'asc ';
6125 ELSIF(p_sort_data(v_index).asc_dsc_flag = 'D') THEN
6126 v_select := v_select || 'desc ';
6127 END IF;
6128
6129 EXIT WHEN v_index = p_sort_data.LAST;
6130 v_index := p_sort_data.NEXT(v_index);
6131 END LOOP;
6132 END IF;
6133 END create_sql_statement;
6134 BEGIN -- query task
6135 x_return_status := fnd_api.g_ret_sts_success;
6136 x_task_table.DELETE;
6137
6138 IF (p_query_or_next_code = 'Q') THEN
6139 v_n_tbl.DELETE;
6140 create_sql_statement;
6141 --dump_long_line('v_sel:',v_select);
6142 v_cursor_id := DBMS_SQL.open_cursor;
6143 DBMS_SQL.parse(v_cursor_id, v_select, DBMS_SQL.v7);
6144
6145 -- bind variables only if they added to the sql statement
6146 IF (p_query_type = 'DEPENDENCY') THEN
6147 IF (p_task_id IS NOT NULL) THEN
6148 DBMS_SQL.bind_variable(v_cursor_id, ':b1', p_task_id);
6149 END IF;
6150 ELSIF(p_query_type = 'ASSIGNED') THEN
6151 DBMS_SQL.bind_variable(v_cursor_id, ':b10', p_assigned_by);
6152 DBMS_SQL.bind_variable(v_cursor_id, ':b11', v_find_date);
6153 ELSIF(p_query_type = 'OWNER') THEN
6154 DBMS_SQL.bind_variable(v_cursor_id, ':b100', p_owner_type_code);
6155 DBMS_SQL.bind_variable(v_cursor_id, ':b101', p_owner_id);
6156 DBMS_SQL.bind_variable(v_cursor_id, ':b102', v_find_date);
6157 END IF;
6158
6159 -- define the output columns
6160 DBMS_SQL.define_column(v_cursor_id, 1, v_type.task_id);
6161 DBMS_SQL.define_column(v_cursor_id, 2, v_type.task_number, 30);
6162 DBMS_SQL.define_column(v_cursor_id, 3, v_type.task_name, 80);
6163 DBMS_SQL.define_column(v_cursor_id, 4, v_type.description, 4000);
6164 DBMS_SQL.define_column(v_cursor_id, 5, v_type.task_type_id);
6165 DBMS_SQL.define_column(v_cursor_id, 6, v_type.task_type, 30);
6166 DBMS_SQL.define_column(v_cursor_id, 7, v_type.task_status_id);
6167 DBMS_SQL.define_column(v_cursor_id, 8, v_type.task_status, 30);
6168 DBMS_SQL.define_column(v_cursor_id, 9, v_type.task_priority_id);
6169 DBMS_SQL.define_column(v_cursor_id, 10, v_type.task_priority, 30);
6170 DBMS_SQL.define_column(v_cursor_id, 11, v_type.owner_type_code, 10);
6171 DBMS_SQL.define_column(v_cursor_id, 12, v_type.owner_id);
6172 DBMS_SQL.define_column(v_cursor_id, 13, v_type.assigned_by_id);
6173 DBMS_SQL.define_column(v_cursor_id, 14, v_type.assigned_by_name, 100);
6174 DBMS_SQL.define_column(v_cursor_id, 15, v_type.customer_id);
6175 DBMS_SQL.define_column(v_cursor_id, 16, v_type.customer_name, 255);
6176 DBMS_SQL.define_column(v_cursor_id, 17, v_type.customer_number, 30);
6177 DBMS_SQL.define_column(v_cursor_id, 18, v_type.address_id);
6178 DBMS_SQL.define_column(v_cursor_id, 19, v_type.planned_start_date);
6179 DBMS_SQL.define_column(v_cursor_id, 20, v_type.planned_end_date);
6180 DBMS_SQL.define_column(v_cursor_id, 21, v_type.scheduled_start_date);
6181 DBMS_SQL.define_column(v_cursor_id, 22, v_type.scheduled_end_date);
6182 DBMS_SQL.define_column(v_cursor_id, 23, v_type.actual_start_date);
6183 DBMS_SQL.define_column(v_cursor_id, 24, v_type.actual_end_date);
6184 DBMS_SQL.define_column(v_cursor_id, 25, v_type.object_type_code, 30);
6185 DBMS_SQL.define_column(v_cursor_id, 26, v_type.object_id);
6186 DBMS_SQL.define_column(v_cursor_id, 27, v_type.obect_name, 30);
6187 DBMS_SQL.define_column(v_cursor_id, 28, v_type.DURATION);
6188 DBMS_SQL.define_column(v_cursor_id, 29, v_type.duration_uom, 3);
6189 DBMS_SQL.define_column(v_cursor_id, 30, v_type.planned_effort);
6190 DBMS_SQL.define_column(v_cursor_id, 31, v_type.planned_effort_uom, 3);
6191 DBMS_SQL.define_column(v_cursor_id, 32, v_type.actual_effort);
6192 DBMS_SQL.define_column(v_cursor_id, 33, v_type.actual_effort_uom, 3);
6193 DBMS_SQL.define_column(v_cursor_id, 34, v_type.percentage_complete);
6194 DBMS_SQL.define_column(v_cursor_id, 35, v_type.reason_code, 30);
6195 DBMS_SQL.define_column(v_cursor_id, 36, v_type.private_flag, 1);
6196 DBMS_SQL.define_column(v_cursor_id, 37, v_type.publish_flag, 1);
6197 DBMS_SQL.define_column(v_cursor_id, 38, v_type.multi_booked_flag, 1);
6198 DBMS_SQL.define_column(v_cursor_id, 39, v_type.milestone_flag, 1);
6199 DBMS_SQL.define_column(v_cursor_id, 40, v_type.holiday_flag, 1);
6200 DBMS_SQL.define_column(v_cursor_id, 41, v_type.workflow_process_id);
6201 DBMS_SQL.define_column(v_cursor_id, 46, v_type.notification_flag, 1);
6202 DBMS_SQL.define_column(v_cursor_id, 47, v_type.notification_period);
6203 DBMS_SQL.define_column(v_cursor_id, 48, v_type.notification_period_uom, 3);
6204 DBMS_SQL.define_column(v_cursor_id, 49, v_type.parent_task_id);
6205 DBMS_SQL.define_column(v_cursor_id, 50, v_type.alarm_start);
6206 DBMS_SQL.define_column(v_cursor_id, 51, v_type.alarm_start_uom, 3);
6207 DBMS_SQL.define_column(v_cursor_id, 52, v_type.alarm_on, 1);
6208 DBMS_SQL.define_column(v_cursor_id, 53, v_type.alarm_count);
6209 DBMS_SQL.define_column(v_cursor_id, 54, v_type.alarm_fired_count);
6210 DBMS_SQL.define_column(v_cursor_id, 55, v_type.alarm_interval);
6211 DBMS_SQL.define_column(v_cursor_id, 56, v_type.alarm_interval_uom, 3);
6212 DBMS_SQL.define_column(v_cursor_id, 57, v_type.attribute1, 150);
6213 DBMS_SQL.define_column(v_cursor_id, 58, v_type.attribute2, 150);
6214 DBMS_SQL.define_column(v_cursor_id, 59, v_type.attribute3, 150);
6215 DBMS_SQL.define_column(v_cursor_id, 60, v_type.attribute4, 150);
6216 DBMS_SQL.define_column(v_cursor_id, 61, v_type.attribute5, 150);
6217 DBMS_SQL.define_column(v_cursor_id, 62, v_type.attribute6, 150);
6218 DBMS_SQL.define_column(v_cursor_id, 63, v_type.attribute7, 150);
6219 DBMS_SQL.define_column(v_cursor_id, 64, v_type.attribute8, 150);
6220 DBMS_SQL.define_column(v_cursor_id, 65, v_type.attribute9, 150);
6221 DBMS_SQL.define_column(v_cursor_id, 66, v_type.attribute10, 150);
6222 DBMS_SQL.define_column(v_cursor_id, 67, v_type.attribute11, 150);
6223 DBMS_SQL.define_column(v_cursor_id, 68, v_type.attribute12, 150);
6224 DBMS_SQL.define_column(v_cursor_id, 69, v_type.attribute13, 150);
6225 DBMS_SQL.define_column(v_cursor_id, 70, v_type.attribute14, 150);
6226 DBMS_SQL.define_column(v_cursor_id, 71, v_type.attribute15, 150);
6227 DBMS_SQL.define_column(v_cursor_id, 72, v_type.attribute_category, 150);
6228 v_dummy := DBMS_SQL.EXECUTE(v_cursor_id);
6229 v_cnt := 0;
6230
6231 LOOP
6232 EXIT WHEN(DBMS_SQL.fetch_rows(v_cursor_id) = 0);
6233 v_cnt := v_cnt + 1;
6234 -- retrieve the rows from the buffer
6235 DBMS_SQL.column_value(v_cursor_id, 1, v_type.task_id);
6236 DBMS_SQL.column_value(v_cursor_id, 2, v_type.task_number);
6237 DBMS_SQL.column_value(v_cursor_id, 3, v_type.task_name);
6238 DBMS_SQL.column_value(v_cursor_id, 4, v_type.description);
6239 DBMS_SQL.column_value(v_cursor_id, 5, v_type.task_type_id);
6240 DBMS_SQL.column_value(v_cursor_id, 6, v_type.task_type);
6241 DBMS_SQL.column_value(v_cursor_id, 7, v_type.task_status_id);
6242 DBMS_SQL.column_value(v_cursor_id, 8, v_type.task_status);
6243 DBMS_SQL.column_value(v_cursor_id, 9, v_type.task_priority_id);
6244 DBMS_SQL.column_value(v_cursor_id, 10, v_type.task_priority);
6245 DBMS_SQL.column_value(v_cursor_id, 11, v_type.owner_type_code);
6246 DBMS_SQL.column_value(v_cursor_id, 12, v_type.owner_id);
6247 DBMS_SQL.column_value(v_cursor_id, 13, v_type.assigned_by_id);
6248 DBMS_SQL.column_value(v_cursor_id, 14, v_type.assigned_by_name);
6249 DBMS_SQL.column_value(v_cursor_id, 15, v_type.customer_id);
6250 DBMS_SQL.column_value(v_cursor_id, 16, v_type.customer_name);
6251 DBMS_SQL.column_value(v_cursor_id, 17, v_type.customer_number);
6252 DBMS_SQL.column_value(v_cursor_id, 18, v_type.address_id);
6253 DBMS_SQL.column_value(v_cursor_id, 19, v_type.planned_start_date);
6254 DBMS_SQL.column_value(v_cursor_id, 20, v_type.planned_end_date);
6255 DBMS_SQL.column_value(v_cursor_id, 21, v_type.scheduled_start_date);
6256 DBMS_SQL.column_value(v_cursor_id, 22, v_type.scheduled_end_date);
6257 DBMS_SQL.column_value(v_cursor_id, 23, v_type.actual_start_date);
6258 DBMS_SQL.column_value(v_cursor_id, 24, v_type.actual_end_date);
6259 DBMS_SQL.column_value(v_cursor_id, 25, v_type.object_type_code);
6260 DBMS_SQL.column_value(v_cursor_id, 26, v_type.object_id);
6261 DBMS_SQL.column_value(v_cursor_id, 27, v_type.obect_name);
6262 DBMS_SQL.column_value(v_cursor_id, 28, v_type.DURATION);
6263 DBMS_SQL.column_value(v_cursor_id, 29, v_type.duration_uom);
6264 DBMS_SQL.column_value(v_cursor_id, 30, v_type.planned_effort);
6265 DBMS_SQL.column_value(v_cursor_id, 31, v_type.planned_effort_uom);
6266 DBMS_SQL.column_value(v_cursor_id, 32, v_type.actual_effort);
6267 DBMS_SQL.column_value(v_cursor_id, 33, v_type.actual_effort_uom);
6268 DBMS_SQL.column_value(v_cursor_id, 34, v_type.percentage_complete);
6269 DBMS_SQL.column_value(v_cursor_id, 35, v_type.reason_code);
6270 DBMS_SQL.column_value(v_cursor_id, 36, v_type.private_flag);
6271 DBMS_SQL.column_value(v_cursor_id, 37, v_type.publish_flag);
6272 DBMS_SQL.column_value(v_cursor_id, 38, v_type.multi_booked_flag);
6273 DBMS_SQL.column_value(v_cursor_id, 39, v_type.milestone_flag);
6274 DBMS_SQL.column_value(v_cursor_id, 40, v_type.holiday_flag);
6275 DBMS_SQL.column_value(v_cursor_id, 41, v_type.workflow_process_id);
6276 DBMS_SQL.column_value(v_cursor_id, 46, v_type.notification_flag);
6277 DBMS_SQL.column_value(v_cursor_id, 47, v_type.notification_period);
6278 DBMS_SQL.column_value(v_cursor_id, 48, v_type.notification_period_uom);
6279 DBMS_SQL.column_value(v_cursor_id, 49, v_type.parent_task_id);
6280 DBMS_SQL.column_value(v_cursor_id, 50, v_type.alarm_start);
6281 DBMS_SQL.column_value(v_cursor_id, 51, v_type.alarm_start_uom);
6282 DBMS_SQL.column_value(v_cursor_id, 52, v_type.alarm_on);
6283 DBMS_SQL.column_value(v_cursor_id, 53, v_type.alarm_count);
6284 DBMS_SQL.column_value(v_cursor_id, 54, v_type.alarm_fired_count);
6285 DBMS_SQL.column_value(v_cursor_id, 55, v_type.alarm_interval);
6286 DBMS_SQL.column_value(v_cursor_id, 56, v_type.alarm_interval_uom);
6287 DBMS_SQL.column_value(v_cursor_id, 57, v_type.attribute1);
6288 DBMS_SQL.column_value(v_cursor_id, 58, v_type.attribute2);
6289 DBMS_SQL.column_value(v_cursor_id, 59, v_type.attribute3);
6290 DBMS_SQL.column_value(v_cursor_id, 60, v_type.attribute4);
6291 DBMS_SQL.column_value(v_cursor_id, 61, v_type.attribute5);
6292 DBMS_SQL.column_value(v_cursor_id, 62, v_type.attribute6);
6293 DBMS_SQL.column_value(v_cursor_id, 63, v_type.attribute7);
6294 DBMS_SQL.column_value(v_cursor_id, 64, v_type.attribute8);
6295 DBMS_SQL.column_value(v_cursor_id, 65, v_type.attribute9);
6296 DBMS_SQL.column_value(v_cursor_id, 66, v_type.attribute10);
6297 DBMS_SQL.column_value(v_cursor_id, 67, v_type.attribute11);
6298 DBMS_SQL.column_value(v_cursor_id, 68, v_type.attribute12);
6299 DBMS_SQL.column_value(v_cursor_id, 69, v_type.attribute13);
6300 DBMS_SQL.column_value(v_cursor_id, 70, v_type.attribute14);
6301 DBMS_SQL.column_value(v_cursor_id, 71, v_type.attribute15);
6302 DBMS_SQL.column_value(v_cursor_id, 72, v_type.attribute_category);
6303 -- 'v_type.task_id:'||
6304 -- to_char(v_type.task_id));
6305 v_n_tbl(v_cnt) := v_type;
6306 END LOOP;
6307 --dbms_sql.close_cursor(v_cursor_id);
6308 END IF; --p_query_or_next_code;
6309
6310 -- copy records to be returned back
6311 x_total_retrieved := v_n_tbl.COUNT;
6312
6313 -- if table is empty do nothing
6314 IF (x_total_retrieved > 0) THEN
6315 IF (p_show_all = 'Y') THEN -- return all the rows
6316 v_start := v_n_tbl.FIRST;
6317 v_end := v_n_tbl.LAST;
6318 ELSE
6319 v_start := p_start_pointer;
6320 v_end := p_start_pointer + p_rec_wanted - 1;
6321
6322 IF (v_end > v_n_tbl.LAST) THEN
6323 v_end := v_n_tbl.LAST;
6324 END IF;
6325 END IF;
6326
6327 FOR v_cnt IN v_start .. v_end LOOP
6328 x_task_table(v_cnt) := v_n_tbl(v_cnt);
6329 END LOOP;
6330 END IF;
6331
6332 x_total_returned := x_task_table.COUNT;
6333 EXCEPTION
6334 WHEN fnd_api.g_exc_error THEN
6335 x_return_status := fnd_api.g_ret_sts_error;
6336 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
6337 WHEN fnd_api.g_exc_unexpected_error THEN
6338 x_return_status := fnd_api.g_ret_sts_unexp_error;
6339 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
6340 WHEN OTHERS THEN
6341 x_return_status := fnd_api.g_ret_sts_unexp_error;
6342
6343 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
6344 fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
6345 END IF;
6346
6347 fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
6348 END query_next_task;
6349 END;