DBA Data[Home] [Help]

PACKAGE: APPS.CSF_TASKS_PUB

Source


1 PACKAGE csf_tasks_pub AS
2 /* $Header: CSFPTSKS.pls 120.21.12010000.2 2009/01/13 14:57:50 ramchint ship $ */
3 
4   -- Update Parent Task Actions
5   g_action_normal_to_parent   CONSTANT PLS_INTEGER := 1;
6   g_action_parent_to_normal   CONSTANT PLS_INTEGER := 2;
7 
8   -- Update Customer Confirmation Actions
9   g_action_conf_to_required   CONSTANT PLS_INTEGER := 1;
10   g_action_conf_to_received   CONSTANT PLS_INTEGER := 2;
11   g_action_conf_not_required  CONSTANT PLS_INTEGER := 3;
12 
13   -- Customer Confirmation Initiation
14   g_dispatcher_initiated      CONSTANT PLS_INTEGER := 1;
15   g_customer_initiated        CONSTANT PLS_INTEGER := 2;
16 
17 
18   -- Task Information - Important Information of Task from JTF_TASKS_B
19   TYPE tasks_rec_type IS RECORD (
20     row_id                    VARCHAR2 (18)
21   , task_id                   jtf_tasks_b.task_id%TYPE
22   , object_version_number     jtf_tasks_b.object_version_number%TYPE
23   , task_status_id            jtf_tasks_b.task_status_id%TYPE
24   , task_status               VARCHAR2 (30)
25   , scheduled_start_date      jtf_tasks_b.scheduled_start_date%TYPE
26   , scheduled_end_date        jtf_tasks_b.scheduled_end_date%TYPE
27   , status_schedulable_flag   VARCHAR2 (1)
28   , type_schedulable_flag     VARCHAR2 (1)
29   , status_assigned_flag      VARCHAR2 (1)
30   , resource_name             VARCHAR2 (4000)
31   , task_split_flag           jtf_tasks_b.task_split_flag%TYPE
32   , parent_task_id            jtf_tasks_b.parent_task_id%TYPE
33   , updated_flag              VARCHAR2 (1)
34   );
35 
36   TYPE tasks_tbl_type IS TABLE OF tasks_rec_type;
37 
38   /**
39    * Validates the Task Status Transition based on the Old Status and
40    * the Chosen Responsibility.
41    * <br>
42    * If Old Task Status is provided, then validation is done to check whether
43    * there exists a Transition from the given Old Status to the given New Status
44    * for the signed in responsibility (FND_GLOBAL.RESP_ID).
45    * <br>
46    * If Old Task Status is not provided, then check is made to find out whether
47    * the New Status as the Initial Status is allowed or not for the responsibility.
48    *
49    * @param   p_state_type      Type of Statuses API should deal with (Default TASK_STATUS)
50    * @param   p_old_status_id   Current Task Status ID from which Transition is initiated.
51    * @param   p_new_status_id   Proposed New Task Status ID.
52    * @return Returns FND_API.G_TRUE/G_FALSE depending on the possibility
53    */
54   FUNCTION validate_state_transition (
55     p_state_type      VARCHAR2 DEFAULT 'TASK_STATUS'
56   , p_old_status_id   NUMBER   DEFAULT NULL
57   , p_new_status_id   NUMBER
58   )
59     RETURN VARCHAR2;
60 
61   /**
62    * Returns the set of Valid Task Statuses possible from the given Old Task Statuses.
63    * <br>
64    * Always used in conjunction with VALIDATE_STATE_TRANSITION to find the valid
65    * statuses possible from the old status if the Task Status Transition to the proposed
66    * new status is not allowed.
67    * <br>
68    * If Old Status is given, then the possible New Task Statuses is returned separated
69    * by FND_GLOBAL.LOCAL_CHR(10). If Old Status is not given, then the possible New Task
70    * Statuses as the Initial Status is returned separated by FND_GLOBAL.LOCAL_CHR(10).
71    *
72    * @param   p_state_type      Type of Statuses API should deal with (Default TASK_STATUS)
73    * @param   p_old_status_id   Current Task Status ID from which Transition is initiated.
74    * @return List of Valid Statuses (VARCHAR2).
75    */
76   FUNCTION get_valid_statuses (
77     p_state_type      VARCHAR2 DEFAULT 'TASK_STATUS'
78   , p_old_status_id   NUMBER   DEFAULT NULL
79   )
80     RETURN VARCHAR2;
81 
82   /**
83    * Validates whether the transition from the given Old Status to the new
84    * Status is possible. If its not possible, it raises an error
85    * (FND_API.G_EXC_ERROR) after pushing the appropriate message into the
86    * stack. It leverages VALIDATE_STATE_TRANSITION and GET_VALID_STATUSES
87    * for the operation.
88    */
89   PROCEDURE validate_status_change(
90     p_old_status_id NUMBER
91   , p_new_status_id NUMBER
92   );
93 
94   /**
95    * Returns the Translated Task Status Name given the Task Status ID.
96    *
97    * @param    p_task_status_id   Task Status ID
98    * @return  Translated Task Status Name
99    */
100   FUNCTION get_task_status_name (p_task_status_id NUMBER)
101     RETURN VARCHAR2;
102 
103   /**
104    * Returns the constant Task Type ID used for Departure Tasks.
105    *
106    * @return  Departure Task Type ID (20)
107    */
108   FUNCTION get_dep_task_type_id
109     RETURN NUMBER;
110 
111   /**
112    * Returns the constant Task Type ID used for Arrival Tasks.
113    *
114    * @return  Arrival Task Type ID (21)
115    */
116   FUNCTION get_arr_task_type_id
117     RETURN NUMBER;
118 
119   /**
120    * Checks whether the given Task can be closed and returns True or False
121    * accordingly.
122    *
123    * A Task can be closed only when
124    *   1. There exists a Transition from the current Task Status to the Closed Status
125    *   2. There are no Active / Open Task Assignments ( In-Planning, Planned, Assigned, Working)
126    *   3. If the profile "CSFW: Update Schedulable Task" is set to Yes, then the Debrief if
127    *      any linked to any of the Task Assignments of the Task should be in COMPLETED status.
128    * <br>
129    * The message stack will be populated with the proper message to indicate the
130    * reason why the Task is not closable.
131    *
132    * @param    x_return_status           Return Status of the Procedure.
133    * @param    x_msg_count               Number of Messages in the Stack.
134    * @param    x_msg_data                Stack of Error Messages.
135    * @param    p_task_id                 Task ID of the Task to be checked
136    * @return  True / False
137    */
138   FUNCTION is_task_closable (
139     x_return_status   OUT NOCOPY      VARCHAR2
140   , x_msg_count       OUT NOCOPY      NUMBER
141   , x_msg_data        OUT NOCOPY      VARCHAR2
142   , p_task_id         IN              NUMBER
143   )
144     RETURN BOOLEAN;
145 
146   /**
147    * Checks whether the given Task can be closed and returns True or False
148    * accordingly.
149    * @deprecated Use IS_TASK_CLOSABLE (SR Team is still calling this version)
150    */
151   FUNCTION task_is_closable (
152     x_return_status   OUT NOCOPY      VARCHAR2
153   , x_msg_count       OUT NOCOPY      NUMBER
154   , x_msg_data        OUT NOCOPY      VARCHAR2
155   , p_task_id         IN              NUMBER
156   )
157     RETURN BOOLEAN;
158 
159   /**
160    * Checks whether the given parameters of a Task (created or not yet created)
161    * will make the task schedulable or not and returns True or False
162    * accordingly.
163    *
164    * A Task is schedulable only when
165    *   1. Task doesnt have Deleted Flag set to 'Y'.
166    *   2. Task has Planned Window set properly - both Planned Start and Planned End.
167    *   3. Task has Planned Effort.
168    *   4. Task Status is schedulable (Task Status should have SCHEDULE_FLAG = 'Y')
169    *   5. Task Type is schedulable (Task Type should have SCHEDULABLE_FLAG = 'Y')
170    *   6. Task Type belongs to the DISPATCH Rule.
171    * <br>
172    *
173    * @param    p_deleted_flag            Whether the Task is already deleted
174    * @param    p_planned_start_date      Planned Start date
175    * @param    p_planned_end_date        Planned End date
176    * @param    p_planned_effort          Planned Effort
177    * @param    p_task_type_id            Task Type ID
178    * @param    p_task_status_id          Task Status ID
179    * @param    x_reason_code             If the Task is not schedulable, WHY ?
180    *
181    * @return  True / False
182    */
183   FUNCTION check_schedulable(
184     p_deleted_flag       IN         VARCHAR2
185   , p_planned_start_date IN         DATE
186   , p_planned_end_date   IN         DATE
187   , p_planned_effort     IN         NUMBER
188   , p_task_type_id       IN         NUMBER
189   , p_task_status_id     IN         NUMBER
190   , x_reason_code        OUT NOCOPY VARCHAR2
191   ) RETURN BOOLEAN;
192 
193   /**
194    * Checks whether the given Task is schedulable or not and returns True or False
195    * accordingly.
196    *
197    * A Task is schedulable only when
198    *   1. Task doesnt have Deleted Flag set to 'Y'.
199    *   2. Task has Planned Window set properly - both Planned Start and Planned End.
200    *   3. Task has Planned Effort.
201    *   4. Task Status is schedulable (Task Status should have SCHEDULE_FLAG = 'Y')
202    *   5. Task Type is schedulable (Task Type should have SCHEDULABLE_FLAG = 'Y')
203    *   6. Task Type belongs to the DISPATCH Rule.
204    * <br>
205    * The message stack will be populated with the proper message to indicate the
206    * reason (one among the six) why the Task is not schedulable.
207    *
208    * @param    x_return_status           Return Status of the Procedure.
209    * @param    x_msg_count               Number of Messages in the Stack.
210    * @param    x_msg_data                Stack of Error Messages.
211    * @param    p_task_id                 Task ID of the Task to be checked
212    * @return  True / False
213    */
214   FUNCTION is_task_schedulable (
215     x_return_status   OUT NOCOPY      VARCHAR2
216   , x_msg_count       OUT NOCOPY      NUMBER
217   , x_msg_data        OUT NOCOPY      VARCHAR2
218   , p_task_id         IN              NUMBER
219   )
220     RETURN BOOLEAN;
221 
222   /**
223    * Checks whether the given Task is already scheduled or not.
224    *
225    * A Task is already scheduled when
226    *   1. Task has Scheduled Start and End Date stamped.
227    *   2. Task has Assignments which are not in Cancelled Status
228    *
229    * @param    x_return_status           Return Status of the Procedure.
230    * @param    x_msg_count               Number of Messages in the Stack.
231    * @param    x_msg_data                Stack of Error Messages.
232    * @param    p_task_id                 Task ID of the Task to be checked
233    * @return  True / False
234    */
235   FUNCTION is_task_scheduled (
236     x_return_status   OUT NOCOPY      VARCHAR2
237   , x_msg_count       OUT NOCOPY      NUMBER
238   , x_msg_data        OUT NOCOPY      VARCHAR2
239   , p_task_id         IN              NUMBER
240   )
241     RETURN BOOLEAN;
242 
243   /**
244    * Checks whether the given Task is escalated or not.
245    *
246    * A Task is escalated when
247    *   1. There exists a Task Reference in JTF_TASK_REFERENCES
248    *      linked to the given Task with Object Type as TASK and Reference Code as ESC.
249    *   2. The referred Task should have Task Type ID as 22 (Escalated Task Type) and
250    *       and should be open (Not Closed, Completed or Cancelled).
251    *
252    * @param    p_task_id                 Task ID of the Task to be checked
253    * @return  True / False
254    */
255   FUNCTION is_task_escalated(p_task_id NUMBER)
256     RETURN BOOLEAN;
257 
258 
259   /**
260    * Checks whether the given Task Type has Field Service Rule attached.
261    *
262    * @param    p_task_type_id         Task Type ID to be checked
263    * @return  FND_API.G_TRUE / FND_API.G_FALSE
264    */
265   FUNCTION has_field_service_rule (p_task_type_id NUMBER)
266     RETURN VARCHAR2;
267 
268   /**
269    * Create a new Field Service Task
270    *
271    * Create a new Task by calling JTF_TASKS_PUB API. The only difference is that
272    * the task to be created has to be Schedulable as per Field Service Standards.
273    * Uses the same logic as that of IS_TASK_SCHEDULABLE.
274    *
275    * Right now P_PARENT_TASK_ID, P_PARENT_TASK_NUMBER, P_TASK_SPLIT_FLAG,
276    * P_CHILD_SEQUENCE_NUM, P_CHILD_POSITION, P_ENABLE_WORKFLOW and P_ABORT_WORKFLOW
277    * wont be used and its just in the signature as JTF Task API hasnt exposed any
278    * API wherein all parameters can be passed in a single shot.
279    * Note that JTF_TASKS_PUB.UPDATE_TASK cant be invoked as the caller module always
280    * assumes that the OBJECT_VERSION_NUMBER of the newly created task is 1.
281    */
282   PROCEDURE create_task (
283     p_api_version               IN           NUMBER
284   , p_init_msg_list             IN           VARCHAR2  DEFAULT NULL
285   , p_commit                    IN           VARCHAR2  DEFAULT NULL
286   , x_return_status             OUT  NOCOPY  VARCHAR2
287   , x_msg_count                 OUT  NOCOPY  NUMBER
288   , x_msg_data                  OUT  NOCOPY  VARCHAR2
289   , p_task_id                   IN           NUMBER    DEFAULT NULL
290   , p_task_name                 IN           VARCHAR2
291   , p_description               IN           VARCHAR2  DEFAULT NULL
292   , p_task_type_name            IN           VARCHAR2  DEFAULT NULL
293   , p_task_type_id              IN           NUMBER    DEFAULT NULL
294   , p_task_status_name          IN           VARCHAR2  DEFAULT NULL
295   , p_task_status_id            IN           NUMBER    DEFAULT NULL
296   , p_task_priority_name        IN           VARCHAR2  DEFAULT NULL
297   , p_task_priority_id          IN           NUMBER    DEFAULT NULL
298   , p_owner_type_name           IN           VARCHAR2  DEFAULT NULL
299   , p_owner_type_code           IN           VARCHAR2  DEFAULT NULL
300   , p_owner_id                  IN           NUMBER    DEFAULT NULL
301   , p_owner_territory_id        IN           NUMBER    DEFAULT NULL
302   , p_owner_status_id           IN           NUMBER    DEFAULT NULL
303   , p_assigned_by_name          IN           VARCHAR2  DEFAULT NULL
304   , p_assigned_by_id            IN           NUMBER    DEFAULT NULL
305   , p_customer_number           IN           VARCHAR2  DEFAULT NULL
306   , p_customer_id               IN           NUMBER    DEFAULT NULL
307   , p_cust_account_number       IN           VARCHAR2  DEFAULT NULL
308   , p_cust_account_id           IN           NUMBER    DEFAULT NULL
309   , p_address_id                IN           NUMBER    DEFAULT NULL
310   , p_address_number            IN           VARCHAR2  DEFAULT NULL
311   , p_location_id               IN           NUMBER    DEFAULT NULL
312   , p_planned_start_date        IN           DATE      DEFAULT NULL
313   , p_planned_end_date          IN           DATE      DEFAULT NULL
314   , p_scheduled_start_date      IN           DATE      DEFAULT NULL
315   , p_scheduled_end_date        IN           DATE      DEFAULT NULL
316   , p_actual_start_date         IN           DATE      DEFAULT NULL
317   , p_actual_end_date           IN           DATE      DEFAULT NULL
318   , p_timezone_id               IN           NUMBER    DEFAULT NULL
319   , p_timezone_name             IN           VARCHAR2  DEFAULT NULL
320   , p_source_object_type_code   IN           VARCHAR2  DEFAULT NULL
321   , p_source_object_id          IN           NUMBER    DEFAULT NULL
322   , p_source_object_name        IN           VARCHAR2  DEFAULT NULL
323   , p_duration                  IN           NUMBER    DEFAULT NULL
324   , p_duration_uom              IN           VARCHAR2  DEFAULT NULL
325   , p_planned_effort            IN           NUMBER    DEFAULT NULL
326   , p_planned_effort_uom        IN           VARCHAR2  DEFAULT NULL
327   , p_actual_effort             IN           NUMBER    DEFAULT NULL
328   , p_actual_effort_uom         IN           VARCHAR2  DEFAULT NULL
329   , p_percentage_complete       IN           NUMBER    DEFAULT NULL
330   , p_reason_code               IN           VARCHAR2  DEFAULT NULL
331   , p_private_flag              IN           VARCHAR2  DEFAULT NULL
332   , p_publish_flag              IN           VARCHAR2  DEFAULT NULL
333   , p_restrict_closure_flag     IN           VARCHAR2  DEFAULT NULL
334   , p_multi_booked_flag         IN           VARCHAR2  DEFAULT NULL
335   , p_milestone_flag            IN           VARCHAR2  DEFAULT NULL
336   , p_holiday_flag              IN           VARCHAR2  DEFAULT NULL
337   , p_billable_flag             IN           VARCHAR2  DEFAULT NULL
338   , p_bound_mode_code           IN           VARCHAR2  DEFAULT NULL
339   , p_soft_bound_flag           IN           VARCHAR2  DEFAULT NULL
340   , p_workflow_process_id       IN           NUMBER    DEFAULT NULL
341   , p_notification_flag         IN           VARCHAR2  DEFAULT NULL
342   , p_notification_period       IN           NUMBER    DEFAULT NULL
343   , p_notification_period_uom   IN           VARCHAR2  DEFAULT NULL
347   , p_alarm_count               IN           NUMBER    DEFAULT NULL
344   , p_alarm_start               IN           NUMBER    DEFAULT NULL
345   , p_alarm_start_uom           IN           VARCHAR2  DEFAULT NULL
346   , p_alarm_on                  IN           VARCHAR2  DEFAULT NULL
348   , p_alarm_interval            IN           NUMBER    DEFAULT NULL
349   , p_alarm_interval_uom        IN           VARCHAR2  DEFAULT NULL
350   , p_palm_flag                 IN           VARCHAR2  DEFAULT NULL
351   , p_wince_flag                IN           VARCHAR2  DEFAULT NULL
352   , p_laptop_flag               IN           VARCHAR2  DEFAULT NULL
353   , p_device1_flag              IN           VARCHAR2  DEFAULT NULL
354   , p_device2_flag              IN           VARCHAR2  DEFAULT NULL
355   , p_device3_flag              IN           VARCHAR2  DEFAULT NULL
356   , p_costs                     IN           NUMBER    DEFAULT NULL
357   , p_currency_code             IN           VARCHAR2  DEFAULT NULL
358   , p_escalation_level          IN           VARCHAR2  DEFAULT NULL
359   , p_attribute1                IN           VARCHAR2  DEFAULT NULL
360   , p_attribute2                IN           VARCHAR2  DEFAULT NULL
361   , p_attribute3                IN           VARCHAR2  DEFAULT NULL
362   , p_attribute4                IN           VARCHAR2  DEFAULT NULL
363   , p_attribute5                IN           VARCHAR2  DEFAULT NULL
364   , p_attribute6                IN           VARCHAR2  DEFAULT NULL
365   , p_attribute7                IN           VARCHAR2  DEFAULT NULL
366   , p_attribute8                IN           VARCHAR2  DEFAULT NULL
367   , p_attribute9                IN           VARCHAR2  DEFAULT NULL
368   , p_attribute10               IN           VARCHAR2  DEFAULT NULL
369   , p_attribute11               IN           VARCHAR2  DEFAULT NULL
370   , p_attribute12               IN           VARCHAR2  DEFAULT NULL
371   , p_attribute13               IN           VARCHAR2  DEFAULT NULL
372   , p_attribute14               IN           VARCHAR2  DEFAULT NULL
373   , p_attribute15               IN           VARCHAR2  DEFAULT NULL
374   , p_attribute_category        IN           VARCHAR2  DEFAULT NULL
375   , p_date_selected             IN           VARCHAR2  DEFAULT NULL
376   , p_category_id               IN           NUMBER    DEFAULT NULL
377   , p_show_on_calendar          IN           VARCHAR2  DEFAULT NULL
378   , p_task_assign_tbl           IN           jtf_tasks_pub.task_assign_tbl   DEFAULT jtf_tasks_pub.g_miss_task_assign_tbl
379   , p_task_depends_tbl          IN           jtf_tasks_pub.task_depends_tbl  DEFAULT jtf_tasks_pub.g_miss_task_depends_tbl
380   , p_task_rsrc_req_tbl         IN           jtf_tasks_pub.task_rsrc_req_tbl DEFAULT jtf_tasks_pub.g_miss_task_rsrc_req_tbl
381   , p_task_refer_tbl            IN           jtf_tasks_pub.task_refer_tbl    DEFAULT jtf_tasks_pub.g_miss_task_refer_tbl
382   , p_task_dates_tbl            IN           jtf_tasks_pub.task_dates_tbl    DEFAULT jtf_tasks_pub.g_miss_task_dates_tbl
383   , p_task_notes_tbl            IN           jtf_tasks_pub.task_notes_tbl    DEFAULT jtf_tasks_pub.g_miss_task_notes_tbl
384   , p_task_recur_rec            IN           jtf_tasks_pub.task_recur_rec    DEFAULT jtf_tasks_pub.g_miss_task_recur_rec
385   , p_task_contacts_tbl         IN           jtf_tasks_pub.task_contacts_tbl DEFAULT jtf_tasks_pub.g_miss_task_contacts_tbl
386   , p_template_id               IN           NUMBER    DEFAULT NULL
387   , p_template_group_id         IN           NUMBER    DEFAULT NULL
388   , p_enable_workflow           IN           VARCHAR2  DEFAULT NULL
389   , p_abort_workflow            IN           VARCHAR2  DEFAULT NULL
390   , p_task_split_flag           IN           VARCHAR2  DEFAULT NULL
391   , p_parent_task_number        IN           VARCHAR2  DEFAULT NULL
392   , p_parent_task_id            IN           NUMBER    DEFAULT NULL
393   , p_child_position            IN           VARCHAR2  DEFAULT NULL
394   , p_child_sequence_num        IN           NUMBER    DEFAULT NULL
395   , x_task_id                   OUT  NOCOPY  NUMBER
396   );
397 
398   /**
399    * Update an existing Task with new Task Attributes
400    *
401    * Given the Task ID and Task Object Version Number, it calls JTF Task API
402    * to update the Task with the new Attributes. It is actually a two step
403    * process
404    *    1. Updating the Task with the new Task Attributes except Task Status
405    *    2. Updating the Task with the new Task Status (if not FND_API.G_MISS_NUM)
406    *       by calling UPDATE_TASK_STATUS.
407    * <br>
408    * Because of the two step process, the returned Task Object Version Number might
409    * be incremented by 2 when user might have expected an increment of only 1.
410    * <br>
411    * Except Task ID, Task Object Version Number, Task Split Flag, all other
412    * parameters are optional. Task Split Flag is also made mandatory to call
413    * this version of UPDATE_TASK so that there is some difference between this
414    * version and the other overloaded version of UPDATE_TASK which is required
415    * by Service Team. The overloaded version ends up calling this version only.
416    */
417   PROCEDURE update_task(
418     p_api_version               IN              NUMBER
419   , p_init_msg_list             IN              VARCHAR2 DEFAULT fnd_api.g_false
420   , p_commit                    IN              VARCHAR2 DEFAULT fnd_api.g_false
421   , p_validation_level          IN              NUMBER   DEFAULT NULL
422   , x_return_status             OUT    NOCOPY   VARCHAR2
423   , x_msg_count                 OUT    NOCOPY   NUMBER
424   , x_msg_data                  OUT    NOCOPY   VARCHAR2
425   , p_task_id                   IN              NUMBER
426   , p_object_version_number     IN OUT NOCOPY   NUMBER
427   , p_task_number               IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
431   , p_planned_end_date          IN              DATE     DEFAULT fnd_api.g_miss_date
428   , p_task_name                 IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
429   , p_description               IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
430   , p_planned_start_date        IN              DATE     DEFAULT fnd_api.g_miss_date
432   , p_scheduled_start_date      IN              DATE     DEFAULT fnd_api.g_miss_date
433   , p_scheduled_end_date        IN              DATE     DEFAULT fnd_api.g_miss_date
434   , p_actual_start_date         IN              DATE     DEFAULT fnd_api.g_miss_date
435   , p_actual_end_date           IN              DATE     DEFAULT fnd_api.g_miss_date
436   , p_timezone_id               IN              NUMBER   DEFAULT fnd_api.g_miss_num
437   , p_source_object_type_code   IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
438   , p_source_object_id          IN              NUMBER   DEFAULT fnd_api.g_miss_num
439   , p_source_object_name        IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
440   , p_task_status_id            IN              NUMBER   DEFAULT fnd_api.g_miss_num
441   , p_task_type_id              IN              NUMBER   DEFAULT fnd_api.g_miss_num
442   , p_task_priority_id          IN              NUMBER   DEFAULT fnd_api.g_miss_num
443   , p_owner_type_code           IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
444   , p_owner_id                  IN              NUMBER   DEFAULT fnd_api.g_miss_num
445   , p_owner_territory_id        IN              NUMBER   DEFAULT fnd_api.g_miss_num
446   , p_owner_status_id           IN              NUMBER   DEFAULT fnd_api.g_miss_num
447   , p_assigned_by_id            IN              NUMBER   DEFAULT fnd_api.g_miss_num
448   , p_customer_id               IN              NUMBER   DEFAULT fnd_api.g_miss_num
449   , p_cust_account_id           IN              NUMBER   DEFAULT fnd_api.g_miss_num
450   , p_address_id                IN              NUMBER   DEFAULT fnd_api.g_miss_num
451   , p_location_id               IN              NUMBER   DEFAULT fnd_api.g_miss_num
452   , p_duration                  IN              NUMBER   DEFAULT fnd_api.g_miss_num
453   , p_duration_uom              IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
454   , p_planned_effort            IN              NUMBER   DEFAULT fnd_api.g_miss_num
455   , p_planned_effort_uom        IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
456   , p_actual_effort             IN              NUMBER   DEFAULT fnd_api.g_miss_num
457   , p_actual_effort_uom         IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
458   , p_percentage_complete       IN              NUMBER   DEFAULT fnd_api.g_miss_num
459   , p_reason_code               IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
460   , p_private_flag              IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
461   , p_publish_flag              IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
462   , p_restrict_closure_flag     IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
463   , p_attribute1                IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
464   , p_attribute2                IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
465   , p_attribute3                IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
466   , p_attribute4                IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
467   , p_attribute5                IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
468   , p_attribute6                IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
469   , p_attribute7                IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
470   , p_attribute8                IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
471   , p_attribute9                IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
472   , p_attribute10               IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
473   , p_attribute11               IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
474   , p_attribute12               IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
475   , p_attribute13               IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
476   , p_attribute14               IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
477   , p_attribute15               IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
478   , p_attribute_category        IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
479   , p_date_selected             IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
480   , p_category_id               IN              NUMBER   DEFAULT fnd_api.g_miss_num
481   , p_multi_booked_flag         IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
482   , p_milestone_flag            IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
483   , p_holiday_flag              IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
484   , p_billable_flag             IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
485   , p_bound_mode_code           IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
486   , p_soft_bound_flag           IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
487   , p_workflow_process_id       IN              NUMBER   DEFAULT fnd_api.g_miss_num
488   , p_notification_flag         IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
489   , p_notification_period       IN              NUMBER   DEFAULT fnd_api.g_miss_num
490   , p_notification_period_uom   IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
491   , p_alarm_start               IN              NUMBER   DEFAULT fnd_api.g_miss_num
492   , p_alarm_start_uom           IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
493   , p_alarm_on                  IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
494   , p_alarm_count               IN              NUMBER   DEFAULT fnd_api.g_miss_num
495   , p_alarm_fired_count         IN              NUMBER   DEFAULT fnd_api.g_miss_num
496   , p_alarm_interval            IN              NUMBER   DEFAULT fnd_api.g_miss_num
500   , p_laptop_flag               IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
497   , p_alarm_interval_uom        IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
498   , p_palm_flag                 IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
499   , p_wince_flag                IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
501   , p_device1_flag              IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
502   , p_device2_flag              IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
503   , p_device3_flag              IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
504   , p_show_on_calendar          IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
505   , p_costs                     IN              NUMBER   DEFAULT fnd_api.g_miss_num
506   , p_currency_code             IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
507   , p_escalation_level          IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
508   , p_parent_task_id            IN              NUMBER   DEFAULT fnd_api.g_miss_num
509   , p_parent_task_number        IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
510   , p_task_split_flag           IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
511   , p_child_position            IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
512   , p_child_sequence_num        IN              NUMBER   DEFAULT fnd_api.g_miss_num
513   , p_enable_workflow           IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
514   , p_abort_workflow            IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
515   , p_find_overlap              IN              VARCHAR2 DEFAULT NULL
516   );
517 
518   /**
519    *  Delete an existing Task given the Task ID.
520    * <br>
521    * Doesnt do anything extra except for calling JTF Task API. Is existing just for the
522    * sake of making this package complete and may be for future uses.
523    * <br>
524    * Either Task ID or Task Number has to be provided for it to be successful.
525    * <br>
526    * @param  p_api_version               API Version (1.0)
527    * @param  p_init_msg_list             Initialize Message List
528    * @param  p_commit                    Commit the Work
529    * @param  x_return_status             Return Status of the Procedure.
530    * @param  x_msg_count                 Number of Messages in the Stack.
531    * @param  x_msg_data                  Stack of Error Messages.
532    * @param  p_task_id                   Task ID of the Task to be deleted
533    * @param  p_task_number               Task Number of the Task to be deleted
534    * @param  p_object_version_number     Object Version of the Task to be deleted
535    * @param  p_delete_future_recurrences Delete all Tasks following the same recurrence rule as this one.
536 
537    */
538   PROCEDURE delete_task (
539     p_api_version                 IN              NUMBER
540   , p_init_msg_list               IN              VARCHAR2 DEFAULT fnd_api.g_false
541   , p_commit                      IN              VARCHAR2 DEFAULT fnd_api.g_false
542   , x_return_status               OUT NOCOPY      VARCHAR2
543   , x_msg_count                   OUT NOCOPY      NUMBER
544   , x_msg_data                    OUT NOCOPY      VARCHAR2
545   , p_task_id                     IN              NUMBER   DEFAULT NULL
546   , p_task_number                 IN              VARCHAR2 DEFAULT NULL
547   , p_object_version_number       IN              NUMBER   DEFAULT NULL
548   , p_delete_future_recurrences   IN              VARCHAR2 DEFAULT fnd_api.g_false
549   );
550 
551   /**
552    * Close an existing Task
553    *
554    * Closes an existing Task by updating the Task Status to be Closed as defined by
555    * the profile "CSF: Default Auto Close Task Status (CSF_DFLT_AUTO_CLOSE_TASK_STATUS)"
556    *
557    * @param  p_api_version               API Version (1.0)
558    * @param  p_init_msg_list             Initialize Message List
559    * @param  p_commit                    Commit the Work
560    * @param  x_return_status             Return Status of the Procedure.
561    * @param  x_msg_count                 Number of Messages in the Stack.
562    * @param  x_msg_data                  Stack of Error Messages.
563    * @param  p_task_id                   Task ID of the Task to be closed
564    */
565   PROCEDURE close_task (
566     p_api_version     IN           NUMBER
567   , p_init_msg_list   IN           VARCHAR2 DEFAULT fnd_api.g_false
568   , p_commit          IN           VARCHAR2 DEFAULT fnd_api.g_false
569   , x_return_status   OUT  NOCOPY  VARCHAR2
570   , x_msg_count       OUT  NOCOPY  NUMBER
571   , x_msg_data        OUT  NOCOPY  VARCHAR2
572   , p_task_id         IN           NUMBER
573   );
574 
575   /**
576    * Update the Task Status with the given Status and propagate to the
577    * Task Assignments also if required.
578    * <br>
579    * Task is updated with the new Status if the Transition from the current status
580    * to the new status is allowed as determined by VALIDATE_STATE_TRANSITION.
581    * Transition validation is done only when Validation Level is passed as FULL.
582    *
583    * If the new Status of the Task is CANCELLED, then all Assignments which are open
584    * (Working, Accepted, Assigned, In-Planning, Planned, On-Hold) needs to be
585    * cancelled too. Other Assignments of the Task will not be updated.
586    * <br>
587    * If the new Status of the Task is CLOSED, then we have to validate if the Task
588    * can be closed. For this, there should not be any Open Task Assignments linked
589    * to the Task. Moreover, if the Profile "CSFW: Update Schedulable Task" is set to
590    * Yes, then the debrief linked with the Assignments should have been COMPLETED.
594    *
591    * Otherwise Task cant be closed. If all verifications passes, then Task and the
592    * open Assignments are closed. Same logic as that of TASK_IS_CLOSABLE. Have to
593    * make it one.
595    * @param  p_api_version               API Version (1.0)
596    * @param  p_init_msg_list             Initialize Message List
597    * @param  p_commit                    Commit the Work
598    * @param  p_validation_level          Validate the given Parameters
599    * @param  x_return_status             Return Status of the Procedure.
600    * @param  x_msg_count                 Number of Messages in the Stack.
601    * @param  x_msg_data                  Stack of Error Messages.
602    * @param  p_task_id                   Task ID of the Task to be Updated
603    * @param  p_task_status_id            New Task Status ID for the Task.
604    * @param  p_object_version_number     Current Task Version and also container for new one.
605    */
606   PROCEDURE update_task_status (
607     p_api_version             IN              NUMBER
608   , p_init_msg_list           IN              VARCHAR2 DEFAULT NULL
609   , p_commit                  IN              VARCHAR2 DEFAULT NULL
610   , p_validation_level        IN              NUMBER   DEFAULT NULL
611   , x_return_status           OUT NOCOPY      VARCHAR2
612   , x_msg_count               OUT NOCOPY      NUMBER
613   , x_msg_data                OUT NOCOPY      VARCHAR2
614   , p_task_id                 IN              NUMBER
615   , p_task_status_id          IN              NUMBER
616   , p_object_version_number   IN OUT NOCOPY   NUMBER
617   );
618 
619 
620   /**
621    * Commits the Tasks as per the given the Query Criteria or only the given Task.
622    *
623    * This API can be used in three different ways
624    *   1. <b> Giving Query ID </b> to be used to retrieve the Tasks which should be
625    *      validated and committed. For this, pass only P_QUERY_ID which will identify the
626    *      query to be used from CSF_DC_QUERIES_B. Auto Commit Task Concurrent Program uses it.
627    *
628    *   2. <b> Giving Resource and Dates </b> which will be used to get the valid Task Assignments
629    *      and committing them. Pass P_RESOURCE_ID, P_RESOURCE_TYPE, P_SCHEDULED_START_DATE
630    *      and P_SCHEDULED_END_DATE to implement this feature of getting the candidates.
631    *      Plan Board and Gantt uses this when a Resource is clicked and Committed.
632    *
633    *   3. <b> A single Task </b> can be committed too. Use P_TASK_ID to implement this feature.
634    *      Planboard / Gantt / Task List Right Click on a Task uses this feature.
635    * <br>
636    * Whenever a Task in the candidate list is a Parent Task, then the Child Tasks of the
637    * Parent Task are processed in place of the Parent Task. Parent Task will be committed
638    * thru the Automatic Task Propagation Mechanism.
639    * <br>
640    * Each Task is validated before it is committed
641    *   1. There should be a valid Status Transition from the current status to Assigned Status.
642    *   2. If the Task requires Customer Confirmation, it should be set to RECEIVED ('R').
643    *   3. If the Task Assignment belongs to a Trip, the Trip shouldnt be blocked.
644    *   4. The Task should have Scheduled Dates stamped.
645    *
646    * <br>
647    * If a Task is not committed, then the stack will have the proper reason why it is committed.
648    * Even if the Task is committed, then the stack is populated with the success message.
649    *
650    * @param  p_api_version               API Version (1.0)
651    * @param  p_init_msg_list             Initialize Message List
652    * @param  p_commit                    Commit the Work
653    * @param  x_return_status             Return Status of the Procedure.
654    * @param  x_msg_count                 Number of Messages in the Stack.
655    * @param  x_msg_data                  Stack of Error Messages.
656    * @param  p_resource_id               Resource ID
657    * @param  p_resource_type             Resource Type
658    * @param  p_scheduled_start_date      Scheduled Start Date of Tasks to be considered
659    * @param  p_scheduled_end_date        Scheduled End Date of Tasks to be considered
660    * @param  p_query_id                  Query ID to be used to pick up Tasks
661    * @param  p_trip_id                   Trip containing the Tasks to be committed.
662    * @param  p_task_id                   Task ID for one single task.
663    */
664   PROCEDURE commit_schedule (
665     p_api_version            IN           NUMBER
666   , p_init_msg_list          IN           VARCHAR2  DEFAULT NULL
667   , p_commit                 IN           VARCHAR2  DEFAULT NULL
668   , x_return_status          OUT  NOCOPY  VARCHAR2
669   , x_msg_count              OUT  NOCOPY  NUMBER
670   , x_msg_data               OUT  NOCOPY  VARCHAR2
671   , p_resource_id            IN           NUMBER    DEFAULT NULL
672   , p_resource_type          IN           VARCHAR2  DEFAULT NULL
673   , p_scheduled_start_date   IN           DATE      DEFAULT NULL
674   , p_scheduled_end_date     IN           DATE      DEFAULT NULL
675   , p_query_id               IN           NUMBER    DEFAULT NULL
676   , p_trip_id                IN           NUMBER    DEFAULT NULL
677   , p_task_id                IN           NUMBER    DEFAULT NULL
678   );
679 
680   /**
681    * Given a set of Tasks, the API identifies the tasks which have been modified and
682    * which are not by comparing the values in the collection with that in DB.
683    *
684    * The passed collection of Task Data itself will be updated with the new Task
685    * Data and Updated Flag as 'Y' corresponding to the modified Task Record.
686    *
687    * @param  p_api_version               API Version (1.0)
688    * @param  p_init_msg_list             Initialize Message List
692    * @param  x_collection                A Table of Tasks and its data
689    * @param  x_return_status             Return Status of the Procedure.
690    * @param  x_msg_count                 Number of Messages in the Stack.
691    * @param  x_msg_data                  Stack of Error Messages.
693    * @param  x_count                     Number of Tasks modified.
694    */
695   PROCEDURE identify_modified_tasks (
696     p_api_version     IN               NUMBER
697   , p_init_msg_list   IN               VARCHAR2 DEFAULT fnd_api.g_false
698   , x_return_status   OUT      NOCOPY  VARCHAR2
699   , x_msg_count       OUT      NOCOPY  NUMBER
700   , x_msg_data        OUT      NOCOPY  VARCHAR2
701   , x_collection      IN  OUT  NOCOPY  tasks_tbl_type
702   , x_count           OUT      NOCOPY  NUMBER
703   );
704 
705   /**
706    * Validates the passed dates against System Date.
707    * If Start Date is less than System Date or NULL, then it is set to System Date.
708    * If End Date is less than System Date or NULL, it is set to System Date + Planscope.
709    *
710    * @param x_start   Start Date of the Plan Window
711    * @param x_end     End Date of the Plan Window.
712    */
713   PROCEDURE validate_planned_dates (x_start IN OUT NOCOPY DATE, x_end IN OUT NOCOPY DATE);
714 
715   /**
716    * Moves the given Task to Scheduled Status by updating the Task and also
717    * creating an Assignment with the given Resource Details.
718    *
719    * Suppose Old Task Assignment ID is provided, then the Old Task Assignment
720    * is automatically cancelled.
721    * <br>
722    * Tries to validate the new Task Status by checking whether there exists any Transition
723    * from the old status to tbe new one. After that updates the Task with the given
724    * Status and Scheduled Timings. After that creates a new Task Assignment (or reuses Cancelled
725    * Task Assignments for the Task) with the given Resource and Travel Information.
726    *
727    * @param  p_api_version                 API Version (1.0)
728    * @param  p_init_msg_list               Initialize Message List
729    * @param  p_commit                      Commit the Work
730    * @param  x_return_status               Return Status of the Procedure.
731    * @param  x_msg_count                   Number of Messages in the Stack.
732    * @param  x_msg_data                    Stack of Error Messages.
733    * @param  p_task_id                     Task ID of the Task to be Updated
734    * @param  p_object_version_number       Current Task Version and also container for new one.
735    * @param  p_task_status_id              New Task Status ID
736    * @param  p_scheduled_start_date        New Scheduled Start Date (NULL if change not needed).
737    * @param  p_scheduled_end_date          New Scheduled End Date (NULL if change not needed).
738    * @param  p_planned_start_date          Planned Start Date of task.
739    * @param  p_planned_end_date            Planned End Date of task.
740    * @param  p_old_task_assignment_id      Old Task Assignment to be Cancelled.
741    * @param  p_old_ta_object_version       Object Version of Old Task Assignment to be Cancelled.
742    * @param  p_assignment_status_id        New Task Assignment Status ID
743    * @param  p_resource_id                 Resource ID who will perform the Task
744    * @param  p_resource_type               Type of the Resource who will perform the Task
745    * @param  p_object_capacity_id          Trip ID
746    * @param  p_sched_travel_distance       Scheduled Travel Distance
747    * @param  p_sched_travel_duration       Scheduled Travel Duration
748    * @param  p_sched_travel_duration_uom   Scheduled Travel Duration UOM
749    * @param  x_task_assignment_id          Task Assignment created for the Task
750    * @param  x_ta_object_version_number    Object Version Number of Task Assignment created
751    */
752   PROCEDURE assign_task(
753     p_api_version                 IN              NUMBER
754   , p_init_msg_list               IN              VARCHAR2 DEFAULT NULL
755   , p_commit                      IN              VARCHAR2 DEFAULT NULL
756   , x_return_status               OUT    NOCOPY   VARCHAR2
757   , x_msg_count                   OUT    NOCOPY   NUMBER
758   , x_msg_data                    OUT    NOCOPY   VARCHAR2
759   , p_task_id                     IN              NUMBER
760   , p_object_version_number       IN OUT NOCOPY   NUMBER
761   , p_task_status_id              IN              NUMBER
762   , p_scheduled_start_date        IN              DATE
763   , p_scheduled_end_date          IN              DATE
764   , p_planned_start_date          IN              DATE     DEFAULT FND_API.G_MISS_DATE
765   , p_planned_end_date            IN              DATE     DEFAULT FND_API.G_MISS_DATE
766   , p_old_task_assignment_id      IN              NUMBER   DEFAULT NULL
767   , p_old_ta_object_version       IN              NUMBER   DEFAULT NULL
768   , p_assignment_status_id        IN              NUMBER
769   , p_resource_id                 IN              NUMBER
770   , p_resource_type               IN              VARCHAR2
771   , p_object_capacity_id          IN              NUMBER
772   , p_sched_travel_distance       IN              NUMBER
773   , p_sched_travel_duration       IN              NUMBER
774   , p_sched_travel_duration_uom   IN              VARCHAR2
775   , p_planned_effort              IN              NUMBER   DEFAULT fnd_api.g_miss_num
776   , p_planned_effort_uom          IN              VARCHAR2 DEFAULT fnd_api.g_miss_char
777   , x_task_assignment_id          OUT NOCOPY      NUMBER
778   , x_ta_object_version_number    OUT NOCOPY      NUMBER
779   );
780 
781   /**
782    * Unschedules the Task by moving the Task to the given Task Status ID and also cancels
786    * Suppose Assignment Status is passed as NULL, then the default Cancelled Status is used.
783    * the given Assignment by moving it to the given Assignment Status ID.
784    *
785    * Suppose Task Status is passed as NULL, then the Task Status is not updated.
787    * <br>
788    * validates the given Task Status by checking the Transition. Also if the new Task Status
789    * has Cancelled Flag checked, and if the Task is a Child Task, then Parent Task ID and
790    * Task Split Flag column of the Task is cleared.
791    *
792    * @param  p_api_version                 API Version (1.0)
793    * @param  p_init_msg_list               Initialize Message List
794    * @param  p_commit                      Commit the Work
795    * @param  x_return_status               Return Status of the Procedure.
796    * @param  x_msg_count                   Number of Messages in the Stack.
797    * @param  x_msg_data                    Stack of Error Messages.
798    * @param  p_task_id                     Task ID of the Task to be Updated
799    * @param  p_object_version_number       Current Task Version and also container for new one.
800    * @param  p_task_status_id              New Task Status ID
801    * @param  p_task_assignment_id          Task Assignment to be cancelled
802    * @param  p_ta_object_version_number    Object Version Number of Task Assignment to be cancelled
803    * @param  p_assignment_status_id        New Assignment Status to be used to cancel the Assignments
804    */
805   PROCEDURE unassign_task(
806     p_api_version                IN              NUMBER
807   , p_init_msg_list              IN              VARCHAR2 DEFAULT NULL
808   , p_commit                     IN              VARCHAR2 DEFAULT NULL
809   , x_return_status              OUT    NOCOPY   VARCHAR2
810   , x_msg_count                  OUT    NOCOPY   NUMBER
811   , x_msg_data                   OUT    NOCOPY   VARCHAR2
812   , p_task_id                    IN              NUMBER
813   , p_object_version_number      IN OUT NOCOPY   NUMBER
814   , p_task_status_id             IN              NUMBER
815   , p_task_assignment_id         IN              NUMBER
816   , p_ta_object_version_number   IN OUT NOCOPY   NUMBER
817   , p_assignment_status_id       IN              NUMBER
818   );
819 
820   /**
821    * Updates the affected Task along with the Assignment.
822    *
823    * When Tasks in a Trip are affected by Scheduling / Unscheduling a
824    * Task into/from the Trip, the Task's Scheduled Dates and Travel
825    * Data are updated as specified. Trip Data is not touched and Task
826    * Assignment still resides in the same Trip.
827    *
828    * <b> Parameters and the optionality of the parameter. </b>
829    *    Parameter                     NULL        FND_MISS_%   other
830    *    ---------------------------   ---------   ----------   ------
831    *    p_scheduled_start_date        No Change   NA           Update
832    *    p_scheduled_end_date          No Change   NA           Update
833    *    p_sched_travel_distance       No Change   NA           Update
834    *    p_sched_travel_duration       No Change   NA           Update
835    *    p_sched_travel_duration_uom   No Change   NA           Update
836    *
837    * <b>Key</b>
838    *    NA        - Not Applicable (Value should be passed)
839    *    No Change - Whatever value is there in DB for the column is retained.
840    *    Update    - Column is updated with the new value in the DB
841    *
842    * @param  p_api_version                 API Version (1.0)
843    * @param  p_init_msg_list               Initialize Message List
844    * @param  p_commit                      Commit the Work
845    * @param  x_return_status               Return Status of the Procedure.
846    * @param  x_msg_count                   Number of Messages in the Stack.
847    * @param  x_msg_data                    Stack of Error Messages.
848    * @param  p_task_id                     Task ID of the Task to be Updated
849    * @param  p_object_version_number       Current Task Version and also container for new one.
850    * @param  p_scheduled_start_date        New Scheduled Start Date (NULL if change not needed).
851    * @param  p_scheduled_end_date          New Scheduled End Date (NULL if change not needed).
852    * @param  p_task_assignment_id          Task Assignment ID to be updated
853    * @param  p_ta_object_version_number    Current Assignment Version and also container for new one.
854    * @param  p_sched_travel_distance       Travel Distance (NULL if change not needed).
855    * @param  p_sched_travel_duration       Travel Duration (NULL if change not needed).
856    * @param  p_sched_travel_duration_uom   Travel Duration UOM (NULL if change not needed).
857    */
858   PROCEDURE update_task_and_assignment(
859     p_api_version                 IN              NUMBER
860   , p_init_msg_list               IN              VARCHAR2 DEFAULT NULL
861   , p_commit                      IN              VARCHAR2 DEFAULT NULL
862   , x_return_status               OUT    NOCOPY   VARCHAR2
863   , x_msg_count                   OUT    NOCOPY   NUMBER
864   , x_msg_data                    OUT    NOCOPY   VARCHAR2
865   , p_task_id                     IN              NUMBER
866   , p_object_version_number       IN OUT NOCOPY   NUMBER
867   , p_scheduled_start_date        IN              DATE
868   , p_scheduled_end_date          IN              DATE
869   , p_task_assignment_id          IN              NUMBER
870   , p_ta_object_version_number    IN OUT NOCOPY   NUMBER
871   , p_sched_travel_distance       IN              NUMBER
872   , p_sched_travel_duration       IN              NUMBER
873   , p_sched_travel_duration_uom   IN              VARCHAR2
874   );
875 
876   /**
880    *
877    * Updates the given Task with the given information or Transforms the task
878    * so that it becomes a Normal Task from a Parent Task or a Parent Task
879    * from a Normal Task.
881    * <b> Transforming a Normal Task into a Parent Task (ScheduleOption) </b>
882    *    Action should be passed as <b> CSF_TASKS_PUB.G_ACTION_NORMAL_TO_PARENT </b>
883    *    Task Split Flag is changed as 'M'.
884    *
885    *    Parameter                     NULL        FND_MISS_%   other
886    *    ---------------------------   ---------   ----------   ------
887    *    p_action                      NA          NA           Process Action
888    *    p_task_status_id              No Change   NA           Update
889    *    p_scheduled_start_date        NA          NA           Update
890    *    p_scheduled_end_date          NA          NA           Update
891    *
892    * <b> Updating a Parent Task </b>
893    *    Action should be passed as <b> CSF_TASKS_PUB.G_ACTION_UPDATE_PARENT </b>
894    *    Task Split Flag is not updated.
895    *
896    *    Parameter                     NULL        FND_MISS_%   other
897    *    ---------------------------   ---------   ----------   ------
898    *    p_action                      NA          NA           Process Action
899    *    p_task_status_id              No Change   NA           Update
900    *    p_scheduled_start_date        No Change   NA           Update
901    *    p_scheduled_end_date          No Change   NA           Update
902    *
903    * <b> Transforming a Parent Task into a Normal Task (UnscheduleTask) </b>
904    *    Action should be passed as <b> CSF_TASKS_PUB.G_ACTION_PARENT_TO_NORMAL </b>
905    *    Task Split Flag of the Task will be cleared.
906    *
907    *    Parameter                     NULL        FND_MISS_%   other
908    *    ---------------------------   ---------   ----------   ------
909    *    p_action                      NA          NA           Process Action
910    *    p_task_status_id              No Change   NA           Update
911    *    p_scheduled_start_date        ** Parameter not used. Column Cleared **
912    *    p_scheduled_end_date          ** Parameter not used. Column Cleared **
913    *
914    * <b>Key</b>
915    *    NA        - Not Applicable (Value should be passed)
916    *    No Change - Whatever value is there in DB for the column is retained.
917    *    Update    - Column is updated with the new value in the DB
918    *
919    * @param  p_api_version                 API Version (1.0)
920    * @param  p_init_msg_list               Initialize Message List
921    * @param  p_commit                      Commit the Work
922    * @param  x_return_status               Return Status of the Procedure.
923    * @param  x_msg_count                   Number of Messages in the Stack.
924    * @param  x_msg_data                    Stack of Error Messages.
925    * @param  p_task_id                     Task ID of the Task to be Updated
926    * @param  p_object_version_number       Current Task Version and also container for new one.
927    * @param  p_action                      Action to be processed
928    * @param  p_task_status_id              New Task Status ID
929    * @param  p_planned_start_date          Planned Start Date
930    * @param  p_planned_end_date            Planned End Date
931    */
932   PROCEDURE update_task_longer_than_shift (
933     p_api_version             IN              NUMBER
934   , p_init_msg_list           IN              VARCHAR2 DEFAULT NULL
935   , p_commit                  IN              VARCHAR2 DEFAULT NULL
936   , x_return_status           OUT    NOCOPY   VARCHAR2
937   , x_msg_count               OUT    NOCOPY   NUMBER
938   , x_msg_data                OUT    NOCOPY   VARCHAR2
939   , p_task_id                 IN              NUMBER
940   , p_object_version_number   IN OUT NOCOPY   NUMBER
941   , p_planned_start_date      IN              DATE     DEFAULT FND_API.G_MISS_DATE
942   , p_planned_end_date        IN              DATE     DEFAULT FND_API.G_MISS_DATE
943   , p_action                  IN              PLS_INTEGER
944   , p_task_status_id          IN              NUMBER   DEFAULT fnd_api.g_miss_num
945   );
946 
947   /**
948    * Creates a Child Task (and Assignment) from the given Parent Task
949    * with the given Scheduled Timings and Duration in the given Trip.
950    *
951    * Creates a Child Task by copying most of the attributes from the given
952    * Parent Task and also an assignment. Moreover the Confirmation and Confirmation
953    * Counter is copied from the Parent Task.
954    *
955    * @param  p_api_version               API Version (1.0)
956    * @param  p_init_msg_list             Initialize Message List
957    * @param  p_commit                    Commit the Work
958    * @param  x_return_status             Return Status of the Procedure.
959    * @param  x_msg_count                 Number of Messages in the Stack.
960    * @param  x_msg_data                  Stack of Error Messages.
961    * @param  p_parent_task_id            Parent Task Identifier
962    * @param  p_task_status_id            Task Status ID of the Child Task
963    * @param  p_planned_effort            Planned Effort of the Child Task
964    * @param  p_planned_effort_uom        Planned Effort UOM of the Child Task
965    * @param  p_bound_mode_flag           Bound Mode
966    * @param  p_soft_bound_flag           Soft Bound
967    * @param  p_scheduled_start_date      Scheduled Start Date of Child Task
968    * @param  p_scheduled_end_date        Scheduled End Date of Child Task
969    * @param  p_assignment_status_id      Task Assignment Status
973    * @param  p_sched_travel_distance     Scheduled Travel Distance of Child Task
970    * @param  p_resource_id               Resource ID of the Child Task
971    * @param  p_resource_type_code        Resource Type of the Child Task
972    * @param  p_object_capacity_id        Trip ID of the Child Task
974    * @param  p_sched_travel_duration     Scheduled Travel Duration of Child Task
975    * @param  p_sched_travel_duration_uom Scheduled Travel Duration UOM of Child Task
976    * @param  x_task_id                   New Task Identifier of the Child Task
977    * @param  x_object_version_number     Object Version of the Task created.
978    * @param  x_task_assignment_id        Task Assignment created
979    * @param  p_child_position            Position of the Child Task ('F', 'M', 'L', 'N')
980    * @param  p_child_sequence_num        Sequence Number among the Child Tasks
981    * @param  x_task_id                   The Task Id of the created Task
982    * @param  x_object_version_number     Object Version Number of created task
983    * @param  x_task_assignment_id        Task Assignment ID of the created Assignment
984    */
985   PROCEDURE create_child_task(
986     p_api_version                 IN              NUMBER
987   , p_init_msg_list               IN              VARCHAR2 DEFAULT NULL
988   , p_commit                      IN              VARCHAR2 DEFAULT NULL
989   , x_return_status               OUT NOCOPY      VARCHAR2
990   , x_msg_count                   OUT NOCOPY      NUMBER
991   , x_msg_data                    OUT NOCOPY      VARCHAR2
992   , p_parent_task_id              IN              NUMBER
993   , p_task_status_id              IN              NUMBER
994   , p_planned_effort              IN              NUMBER
995   , p_planned_effort_uom          IN              VARCHAR2
996   , p_bound_mode_code             IN              VARCHAR2
997   , p_soft_bound_flag             IN              VARCHAR2
998   , p_scheduled_start_date        IN              DATE
999   , p_scheduled_end_date          IN              DATE
1000   , p_assignment_status_id        IN              NUMBER
1001   , p_resource_id                 IN              NUMBER
1002   , p_resource_type               IN              VARCHAR2
1003   , p_object_capacity_id          IN              NUMBER
1004   , p_sched_travel_distance       IN              NUMBER
1005   , p_sched_travel_duration       IN              NUMBER
1006   , p_sched_travel_duration_uom   IN              VARCHAR2
1007   , p_child_position              IN              VARCHAR2 DEFAULT NULL
1008   , p_child_sequence_num          IN              NUMBER   DEFAULT NULL
1009   , x_task_id                     OUT NOCOPY      NUMBER
1010   , x_object_version_number       OUT NOCOPY      NUMBER
1011   , x_task_assignment_id          OUT NOCOPY      NUMBER
1012   );
1013 
1014   /**
1015    * Updates the customer confirmation for normal/child/parent task
1016    *
1017    * @param  p_api_version                   API Version (1.0)
1018    * @param  p_init_msg_list                 Initialize Message List
1019    * @param  p_commit                        Commit the Work
1020    * @param  x_return_status                 Return Status of the Procedure
1021    * @param  x_msg_count                     Number of Messages in the Stack
1022    * @param  x_msg_data                      Stack of Error Messages
1023    * @param  p_task_id                       Task to be processed
1024    * @param  p_object_version_number         Object version of input task
1025    * @param  p_action                        Whether Required/Received/Not Required
1026    * @param  p_initiated                     Whether Customer or Dispatcher
1027    */
1028   PROCEDURE update_cust_confirmation(
1029     p_api_version                 IN              NUMBER
1030   , p_init_msg_list               IN              VARCHAR2 DEFAULT NULL
1031   , p_commit                      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   , p_task_id                     IN              NUMBER
1036   , p_object_version_number       IN OUT NOCOPY   NUMBER
1037   , p_action                      IN              PLS_INTEGER
1038   , p_initiated                   IN              PLS_INTEGER
1039   );
1040 
1041   /**
1042    * Gets the Location ID of the Task given the Task ID / Party Site ID / Location ID
1043    * <br>
1044    * 1. If Location ID is passed, the function just returns the value.
1045    * 2. If Party Site ID is passed, then the function returns the Location ID tied to the
1046    *    Party Site.
1047    * 3. If Task ID alone is given, then the function finds out whether the Task's Location
1048    *    ID is stamped. If yes, then returns it.. otherwise returns the Location ID tied
1049    *    to the Task's Party Site.
1050    *
1051    * @param  p_task_id          Task ID
1052    * @param  p_party_site_id    Party Site ID of the Task
1053    * @param  p_location_id      Location ID of the Task
1054    */
1055   FUNCTION get_task_location_id (
1056     p_task_id       IN NUMBER
1057   , p_party_site_id IN NUMBER DEFAULT NULL
1058   , p_location_id   IN NUMBER DEFAULT NULL
1059   )
1060     RETURN NUMBER;
1061 
1062   /**
1063    * Gets the Address of the Task given the Task ID / Party Site ID / Location ID
1064    * <br>
1065    * 1. If Location ID is passed, it will be directly used.
1066    * 2. If Party Site ID is passed, then the function retrieves the Location ID tied to the
1067    *    Party Site and returns the Address.
1068    * 3. If Task ID alone is given, then the function finds out whether the Task's Location
1069    *    ID is stamped. If yes, then returns the address of the Location.. Otherwise
1070    *    returns the address of the location tied to the Task's Party Site.
1071    *
1072    * @param  p_task_id          Task ID
1073    * @param  p_party_site_id    Party Site ID of the Task
1074    * @param  p_location_id      Location ID of the Task
1075    * @param  p_short_flag       Address Format - Short Format / Long Format
1076    */
1077   FUNCTION get_task_address (
1078     p_task_id       IN NUMBER
1079   , p_party_site_id IN NUMBER   DEFAULT NULL
1080   , p_location_id   IN NUMBER   DEFAULT NULL
1081   , p_short_flag    IN VARCHAR2 DEFAULT 'Y'
1082   )
1083     RETURN VARCHAR2;
1084 
1085   /**
1086    * Gets the Task Effort conditionally converted to the Default UOM as given by
1087    * the profile CSF: Default Effort UOM by calling
1088    * CSF_UTIL_PVT.GET_EFFORT_IN_DEFAULT_UOM function.
1089    * <br>
1090    * All parameters are optional. If Planned Effort, Planned Effort UOM and Task
1091    * Split Flag are passed, then it helps in better performance as JTF_TASKS_B
1092    * wont be queried to get those information. In case of better flexibility,
1093    * the caller can just pass the Task ID and the API will fetch the required
1094    * information. If case none of the required parameters are passed, the API returns
1095    * NULL.
1096    * <br>
1097    * Parent Task / Normal Tasks are created by the Teleservice Operators and therefore
1098    * its always better to represent them in the UOM they had given initially. Tasks
1099    * created as part of the Background processes like Child Tasks are always created
1100    * in Minutes by Scheduler and therefore it is incumbent upon us to represent
1101    * them in a proper UOM. Thus this API will convert the Planned Effort to the default
1102    * UOM only for Child Tasks and will merely act as a Concatenation Operator for
1103    * other Tasks. If you want to overrule this and want conversion to Default UOM
1104    * to take place for all Tasks, pass p_always_convert as FND_API.G_TRUE
1105    *
1109    * @param p_planned_effort      Planned Effort to be converted
1106    * Also refer to the documentation on CSF_UTIL_PVT.GET_EFFORT_IN_DEFAULT_UOM.
1107    * <br>
1108    *
1110    * @param p_planned_effort_uom  UOM of the above Effort
1111    * @param p_task_split_flag     Determines whether the Task is Child / Other
1112    * @param p_task_id             Task ID of the Task whose effort is to be converted
1113    * @param p_always_convert      Overrule the condition and convert for all Tasks.
1114    *
1115    * @result Planned Effort appro converted to Default UOM.
1116    */
1117   FUNCTION get_task_effort_in_default_uom(
1118     p_planned_effort       NUMBER     DEFAULT NULL
1119   , p_planned_effort_uom   VARCHAR2   DEFAULT NULL
1120   , p_task_split_flag      VARCHAR2   DEFAULT '@' -- NULL not used as NULL is a valid value
1121   , p_task_id              NUMBER     DEFAULT NULL
1122   , p_always_convert       VARCHAR2   DEFAULT NULL
1123   )
1124     RETURN VARCHAR2;
1125 
1126   /**
1127    * Given the Service Request Incident ID or Task ID, Contact
1128    * Details are fetched. If the profile CSF: Default Source for
1129    * Contact is set to SR, then SR is queried. Otherwise Task is
1130    * queried.
1131    *
1132    * @param p_incident_id   Service Request ID
1133    * @param p_task_id       Task Id
1134    * @param x_last_name     Last Name
1135    * @param x_first_name    First Name
1136    * @param x_title         Title
1137    * @param x_phone         Phone Number of the Contact Person
1138    * @param x_phone_ext     Phone Extension
1139    * @param x_email_address Email Address of the Contact Person
1140    */
1141   PROCEDURE get_contact_details(
1142     p_incident_id    IN        NUMBER
1143   , p_task_id        IN        NUMBER    DEFAULT NULL
1144   , x_last_name     OUT NOCOPY VARCHAR2
1145   , x_first_name    OUT NOCOPY VARCHAR2
1146   , x_title         OUT NOCOPY VARCHAR2
1147   , x_phone         OUT NOCOPY VARCHAR2
1148   , x_phone_ext     OUT NOCOPY VARCHAR2
1149   , x_email_address OUT NOCOPY VARCHAR2
1150   );
1151 
1152     procedure update_personal_task(
1153 	      	p_api_version               in number
1154 	      , p_init_msg_list              in varchar2
1155         , p_commit                     in varchar2
1156         , p_task_id                    in varchar2
1157         , p_task_name                  in varchar2
1158         , x_version     in out nocopy number
1159 	      , p_description                in number
1160 	      , p_task_type_id             in number
1161 	      , p_task_status_id           in number
1162 	      , p_task_priority_id    in number
1163 	      , p_owner_id                   in number
1164 	      , p_owner_type_code            in varchar2
1165 	      , p_address_id                 in number
1166 	      , p_customer_id               in number
1167 	      , p_planned_start_date         in date
1168 	      , p_planned_end_date          in date
1169 	      , p_scheduled_start_date       in date
1170 	      , p_scheduled_end_date         in date
1171 	      , p_source_object_type_code   in varchar2
1172 	      , p_planned_effort             in number
1173 	      , p_planned_effort_uom         in varchar2
1174 	      , p_bound_mode_code            in varchar2
1175 	      , p_soft_bound_flag           in varchar2
1176 	      , p_type                       in varchar2
1177         , p_trip                     in number
1178 	      , x_return_status              out nocopy varchar2
1179 	      , x_msg_count                  out nocopy number
1180 	      , x_msg_data                   out nocopy varchar2
1181         );
1182 
1183 procedure  create_personal_task(
1184 		      p_api_version                   in number
1185 	      , p_init_msg_list        in varchar2
1186         , p_commit             in varchar2
1187         , p_task_name                in varchar2
1188 	      , p_description               in varchar2
1189 	      , p_task_type_name           in varchar2
1190 	      , p_task_type_id              in number
1191 	      , p_task_status_name          in varchar2
1192 	      , p_task_status_id              in number
1193 	      , p_task_priority_name        in varchar2
1194 	      , p_task_priority_id            in number
1195 	      , p_owner_id                   in number
1196 	      , p_owner_type_code           in varchar2
1197 	      , p_address_id                  in number
1198 	      , p_customer_id                 in number
1199 	      , p_planned_start_date         in date
1200 	      , p_planned_end_date           in date
1201 	      , p_scheduled_start_date      in date
1202 	      , p_scheduled_end_date         in date
1203 	      , p_source_object_type_code    in varchar2
1204 	      , p_planned_effort             in number
1205 	      , p_planned_effort_uom        in varchar2
1206 	      , p_bound_mode_code            in varchar2
1207 	      , p_soft_bound_flag            in varchar2
1208 	      , p_task_assign_tbl           jtf_tasks_pub.task_assign_tbl
1209 	      , p_type                     in varchar2
1210         , p_trip                     in number
1211 	      , x_return_status             out nocopy varchar2
1212 	      , x_msg_count                 out nocopy number
1213 	      , x_msg_data                  out nocopy varchar2
1214 	      , x_task_id                    out nocopy number
1215 	      );
1216 
1217 
1218   /**
1219    * Given the Service Request Incident ID or the Task ID, Contact
1220    * Person Name and Phone are fetched. The Name and Phone are
1221    * separated by @@
1222    *
1223    * @param p_incident_id  Service Request ID
1224    * @param p_task_id      Task ID
1225    */
1226   FUNCTION get_contact_details(
1227     p_incident_id  NUMBER
1228   , p_task_id      NUMBER    DEFAULT NULL
1229   ) RETURN VARCHAR2;
1230 
1231 END csf_tasks_pub;