DBA Data[Home] [Help]

PACKAGE BODY: APPS.IEU_WPACTIONS_PVT

Source


1 PACKAGE BODY IEU_WPACTIONS_PVT AS
2 /* $Header: IEUTKWPB.pls 120.3 2005/10/28 05:02:03 msathyan noship $ */
3 
4 
5 PROCEDURE WP_TASK
6 ( P_RESOURCE_ID       IN NUMBER,
7   P_LANGUAGE          IN VARCHAR2,
8   P_SOURCE_LANG       IN VARCHAR2,
9   P_ACTION_KEY        IN VARCHAR2,
10   P_ACTION_INPUT_DATA IN SYSTEM.ACTION_INPUT_DATA_NST,
11   P_Action_Type       IN Varchar2,
12   X_UWQ_ACTION_LIST   OUT NOCOPY SYSTEM.IEU_UWQ_WORK_ACTIONS_NST,
13   X_MSG_COUNT         OUT NOCOPY NUMBER,
14   X_MSG_DATA          OUT NOCOPY VARCHAR2,
15   X_RETURN_STATUS     OUT NOCOPY VARCHAR2
16 )
17 IS
18     l_api_version           CONSTANT NUMBER      := 1.0;
19     l_valid_level_full      NUMBER      := 100;
20     l_note_status           VARCHAR2(3);
21 
22     -- only TASK from below is used for anything right now.
23     l_src_task              CONSTANT VARCHAR2(30) := 'TASK';
24     l_src_sr                CONSTANT VARCHAR2(30) := 'SR';
25     l_src_lead              CONSTANT VARCHAR2(30) := 'LEAD';
26     l_src_opp               CONSTANT VARCHAR2(30) := 'OPPORTUNITY';
27     l_src_rel1              CONSTANT VARCHAR2(30) := 'PARTY_RELATIONSHIP';
28     l_src_rel2              CONSTANT VARCHAR2(30) := 'PARTY_PERSON_RELATIONSHIP';
29 
30     -- for work to be done in uwq
31     l_uwq_actions_list      IEU_UWQ_WORK_PANEL_PUB.UWQ_ACTION_REC_LIST;
32 
33     --work action data items
34     l_dataSetType           VARCHAR2(50);
35     l_set_id                NUMBER;
36     l_name                  VARCHAR2(500);
37     l_value                 VARCHAR2(4000);  -- Niraj, 07-08-05, Bug 4482399: Increased from 500 to 4000
38 
39     -- parameters from the work item
40     l_task_rec_tbl          TASK_REC_TBL;
41     l_count                 NUMBER;
42     l_continue              NUMBER :=0;
43     -- parameters from the work panel
44     l_task_name             VARCHAR2(80);
45     l_type                  VARCHAR2(30); --NUMBER;
46     l_priority              VARCHAR2(30); --NUMBER;
47     l_status                VARCHAR2(30); --NUMBER;
48     l_date_type             VARCHAR2(30);   -- lookup code
49     l_planned_start         DATE;
50     l_planned_end           DATE;
51     l_actual_start          DATE;
52     l_actual_end            DATE;
53     l_sched_start           DATE;
54     l_sched_end             DATE;
55     l_description           VARCHAR2(4000);
56     l_note                  VARCHAR2(4000);
57     l_owner                 VARCHAR2(4000);
58     l_owner_tmp             VARCHAR2(4000);
59     l_assignee              VARCHAR2(4000);
60     l_auto_relate_note      NUMBER;
61     l_p_task_name             VARCHAR2(80);-- := g_miss_char;
62     l_p_type                  VARCHAR2(30);--  := g_miss_char;
63     l_p_priority              VARCHAR2(30);--  := g_miss_char;
64     l_p_status                VARCHAR2(30);--  := g_miss_char;
65     l_p_date_type             VARCHAR2(30) ;   -- lookup code
66     l_p_planned_start         DATE;--  := g_miss_date;
67     l_p_planned_end           DATE;--  := g_miss_date;
68     l_p_actual_start          DATE;--  := g_miss_date;
69     l_p_actual_end            DATE;--  := g_miss_date;
70     l_p_sched_start           DATE;--  := g_miss_date;
71     l_p_sched_end             DATE;--  := g_miss_date;
72     l_p_description           VARCHAR2(4000);--  := g_miss_char;
73     l_p_note                  VARCHAR2(4000);--  := g_miss_char;
74     l_p_owner                 VARCHAR2(4000) ;
75     l_p_owner_tmp             VARCHAR2(4000) ;
76     l_p_assignee              VARCHAR2(4000) ;
77     l_p_auto_relate_note      NUMBER;
78 
79 
80 
81     -- misc variables required for calling api
82     l_obj_type_code         VARCHAR2(60); -- Niraj, 07-08-05, Bug 4482399: Increased from 30 to 60
83     l_obj_id                NUMBER;
84     l_obj_name              VARCHAR2(80);
85     l_object_version_number NUMBER;
86     l_return_status         VARCHAR2(1);
87     l_msg_count             NUMBER;
88     l_msg_data              VARCHAR2(2000);
89     l_owner_id              NUMBER;
90     l_owner_type_code       VARCHAR2(30);
91     l_owner_id_tmp              NUMBER;
92     l_owner_type_code_tmp       VARCHAR2(30);
93 
94     l_assignee_id           NUMBER;
95     l_assignee_type_code    VARCHAR2(30);
96     l_idx                   NUMBER;
97     l_idx2                  NUMBER;
98     l_exist_assign_id       NUMBER;
99     l_new_assign_id         NUMBER;
100     l_exist_assign_ver      NUMBER;
101     l_new_assign_status     NUMBER := 3;      -- ACCEPTED status id
102     l_note_context_type_id  NUMBER;
103     l_source_object_id      NUMBER;
104 
105     CURSOR c_task_ass (b_task_id NUMBER) IS
106       SELECT task_assignment_id, object_version_number
107       FROM jtf_task_all_assignments
108       WHERE task_id = b_task_id AND
109             assignee_role <> 'OWNER';
110 
111     -- notes related parameters
112     l_note_id               NUMBER;
113     l_context_id            NUMBER;
114     l_note_ctxt_tbl         jtf_notes_pub.jtf_note_contexts_tbl_type;
115     l_note_ctxt_idx         NUMBER;
116 
117     cursor C_note_context_id(p_object_id NUMBER) is
118       select contact_id
119       from jtf_task_contacts
120       where task_id =  p_object_id
121       and (primary_flag is null or primary_flag = 'Y')
122       order by primary_flag;
123 
124 
125     CURSOR c_task_src (b_task_id NUMBER) IS
126       SELECT tb.source_object_type_code
127       FROM jtf_object_usages ou,
128            jtf_tasks_b tb
129       WHERE
130         tb.task_id = b_task_id and
131         ou.object_user_code = 'NOTES' and
132         ou.object_code = tb.source_object_type_code;
133 
134     -- exceptions raised in this procedure
135     null_fail_exception EXCEPTION;
136     fail_exception        EXCEPTION;
137     name_fail_exception        EXCEPTION;
138 
139     -- cheating GSCC
140     l_date_fmt             CONSTANT VARCHAR2(30) := 'DD-MON-RRRR HH24:MI:SS';
141 
142 
143 BEGIN
144 
145  l_note_status := nvl(fnd_profile.value('JTF_NTS_NOTE_STATUS'),'I');
146  --DELETE FROM msista_tmp;
147  --commit;
148  --INSERT INTO msista_Tmp values (11, 'P_Action_Type is '|| P_Action_Type);
149  --commit;
150 
151  SAVEPOINT update_task_savepoint;
152 
153  -- initialize fnd's message list
154  fnd_msg_pub.initialize();
155 
156  -- Get all the required parameters from Action Input List
157  -- required parameters are TBD.
158 
159   /*
160     To Do -
161     a. loop through the work_action_Data
162     b. identify 'work_item_data'
163     c. collect the task_id for each DataSetID that comes through into l_task_rec_tbl
164     d. collect the 'action_param_data' that comes through into the set of params
165     e. if task_Rec_tbl.count > 1 => multi-select mode
166     f. if multi-select mode, we should ignore some of the parameters (per reqmnt).
167     g. loop through l_task_rec_tbl and call update_task for each task_id - do not --commit.
168     g1. break out of loop if any update_task fails.
169     h. if all task items were updated successfully - --commit.
170     i. if any task update fails, roll back and return error message.
171   */
172   --INSERT  INTO msista_Tmp values (20, 'entering for(p_action_input_data) loop');
173   --commit;
174   --** These default values have been added as part of bug #4706930 - MS **---
175       l_p_task_name             := FND_API.G_MISS_CHAR;
176       l_p_type                  := FND_API.G_MISS_CHAR;
177       l_p_priority              := FND_API.G_MISS_CHAR;
178       l_p_status                := FND_API.G_MISS_CHAR;
179 
180       l_p_planned_start         := FND_API.G_MISS_DATE;
181       l_p_planned_end           := FND_API.G_MISS_DATE;
182       l_p_actual_start          := FND_API.G_MISS_DATE;
183       l_p_actual_end            := FND_API.G_MISS_DATE;
184       l_p_sched_start           := FND_API.G_MISS_DATE;
185       l_p_sched_end             := FND_API.G_MISS_DATE;
186       l_p_description           := FND_API.G_MISS_CHAR;
187       l_p_note                  := FND_API.G_MISS_CHAR;
188 
189   for i in 1..p_action_input_data.COUNT LOOP
190 
191       l_dataSetType := p_action_input_data(i).dataSetType;
192       if (l_dataSetType = 'WORK_ITEM_DATA')      then
193 
194         l_set_id := p_action_input_data(i).dataSetId;
195         l_name  := p_action_input_data (i).name;
196         l_value := p_action_input_data (i).value;
197 
198         --INSERT INTO msista_Tmp values (30, 'found WORK_ITEM_DATA, set_id = ' || l_set_id || ', name - ''' || l_name || ''', value = ''' || l_value || '''');
199         --commit;
200         if (l_name = 'TASK_ID') then
201           l_task_rec_tbl(l_set_id).id := l_value;
202         ELSIF (l_name = 'SOURCE_OBJECT_ID') THEN
203           l_task_rec_tbl(l_set_id).source_id := l_value;
204         ELSIF (l_name = 'IEU_ACTION_OBJECT_CODE') THEN
205           l_task_rec_tbl(l_set_id).source_type_code := l_value;
206 --        ELSIF (l_name = 'TASK_PRIORITY') THEN    ---- getting this value for reassign, reschedule, and transfer owner actions.
207 --          l_task_rec_tbl(l_set_id).priority_name := l_value;
208         ELSIF (l_name = 'OBJECT_VERSION_NUMBER') THEN
209           l_task_rec_tbl(l_set_id).object_version_number := l_value;
210          end if;
211 
212 
213       elsif (l_dataSetType = 'ACTION_PARAM_DATA')
214       then
215 
216         --don't care for l_set_id for action parameter data
217         l_name  := p_action_input_data (i).name;
218         l_value := p_action_input_data (i).value;
219 
220         --INSERT INTO msista_Tmp values (40, 'found ACTION_PARAM_DATA, name - ''' || l_name || ''', value = ''' || l_value || '''');
221         --commit;
222 
223         IF (l_name = 'TASK_NAME') THEN
224           l_p_task_name := l_value;
225         ELSIF (l_name = 'TASK_TYPE') THEN
226           l_p_type := l_value;
227         ELSIF (l_name = 'TASK_PRIORITY') THEN
228           l_p_priority := l_value;
229         ELSIF (l_name = 'TASK_STATUS') THEN
230           l_p_status := l_value;
231         ELSIF (l_name = 'PLANNED_START_DATE') THEN
232           l_p_planned_start := TO_DATE(l_value, l_date_fmt);
233         ELSIF (l_name = 'PLANNED_END_DATE') THEN
234           l_p_planned_end := TO_DATE(l_value, l_date_fmt);
235         ELSIF (l_name = 'ACTUAL_START_DATE') THEN
236           l_p_actual_start := TO_DATE(l_value, l_date_fmt);
237         ELSIF (l_name = 'ACTUAL_END_DATE') THEN
238           l_p_actual_end := TO_DATE(l_value, l_date_fmt);
239         ELSIF (l_name = 'SCHED_START_DATE') THEN
240           l_p_sched_start := TO_DATE(l_value, l_date_fmt);
241         ELSIF (l_name = 'SCHEDULED_END') THEN
242           l_p_sched_end := TO_DATE(l_value, l_date_fmt);
243         ELSIF (l_name = 'DESCRIPTION') THEN
244           l_p_description := l_value;
245         ELSIF (l_name = 'NEW_NOTE') THEN
246           l_p_note := l_value;
247         ELSIF (l_name = 'OWNER') THEN
248           l_p_owner := l_value;
249         ELSIF (l_name = 'ASSIGNEE') THEN
250           l_p_assignee := l_value;
251         END IF;
252       end if;
253   end loop;
254 
255   -- parameters validations
256   -- number of tasks selected in uwq
257   l_count := l_task_rec_tbl.COUNT;
258   if (l_count = 1) then -- single mode
259       -- single mode requires task type, priority, and status
260       /*
261       Update Task:
262         Checked by Form:N/A
263         Checked by API:Task Status, Task Type
264 
265        Close Task
266         Checked by Form: N/A
267         Checked by API:Task Status,Task Type
268 
269        Reassign  Task:
270         Checked by Form:Task Assignee
271         Checked by API: N/A
272 
273        Reschedule Task:
274         Checked by Form: N/A
275         Checked by API: N/A
276 
277        Transfer Task:
278         Checked by Form: Task Owner
279         Checked by API: N/A
280       */
281       if (l_p_task_name is null) then
282          RAISE name_fail_exception;
283       end if;
284       if ((p_Action_Type = 'UPDATE_TASK' or p_Action_TYPE = 'CLOSE_TASK')
285            and (l_p_type is null  or l_p_status is null)) then
286          -- ROLLBACK TO update_task_savepoint;
287           --INSERT INTO msista_Tmp values (45, 'null_fail_exception');
288           --commit;
289 
290           RAISE null_fail_exception;
291       end if;
292    END if;
293 
294   /*
295     e. if task_Rec_tbl.count > 1 => multi-select mode
296     f. if multi-select mode, we should ignore some of the parameters (per reqmnt).
297     g. loop through l_task_rec_tbl and call update_task for each task_id - do not --commit.
298     g1. break out of loop if any update_task fails.
299     h. if all task items were updated successfully - --commit.
300     i. if any task update fails, roll back and return error message.
301   */
302 
303    -- task api uses g_miss* values for defaults
304   IF (l_p_task_name is NULL) THEN
305       --INSERT INTO msista_Tmp values (42, 'l_task_name is null');
306       --commit;
307 
308       l_task_name := FND_API.G_MISS_CHAR;
309   ELSE
310       --INSERT INTO msista_Tmp values (42, 'l_task_name <> null');
311       --commit;
312 
313       l_task_name := l_p_task_name;
314   END IF;
315   IF ( l_p_type is NULL ) THEN
316       --INSERT INTO msista_Tmp values (42, 'l_type is null');
317       --commit;
318 
319       l_type := FND_API.G_MISS_CHAR;    --G_MISS_NUM;
320   ELSE
321       --INSERT INTO msista_Tmp values (42, 'l_type <> null');
322       --commit;
323 
324       l_type := l_p_type;
325   END IF;
326   IF (l_p_description is NULL ) THEN
327       --INSERT INTO msista_Tmp values (42, 'l_description is null');
328       --commit;
329         l_description := FND_API.G_MISS_CHAR;
330   ELSE
331       --INSERT INTO msista_Tmp values (42, 'l_description <> null');
332       --commit;
333 
334       l_description := l_p_description;
335   END IF;
336   IF (l_p_status is NULL ) THEN
337       --INSERT INTO msista_Tmp values (42, 'l_status is null');
338       --commit;
339 
340       l_status := FND_API.G_MISS_CHAR;    --g_miss_num;
341   ELSE
342       --INSERT INTO msista_Tmp values (42, 'l_status <> null');
343       --commit;
344 
345       l_status := l_p_status;
346   END IF;
347   IF ((l_count > 1 AND l_p_priority is NULL ) or
348       (l_count = 1 AND l_p_priority is NULL )) THEN
349       --INSERT INTO msista_Tmp values (42, 'l_priority is null');
350       --commit;
351 
352       l_priority := FND_API.G_MISS_CHAR;    --g_miss_num;
353   ELSE
354       --INSERT INTO msista_Tmp values (42, 'l_count is '||l_count||',l_priority <> null and it is '||l_p_priority);
355       --commit;
356 
357       l_priority := l_p_priority;
358   END IF;
359   IF (l_p_owner is NULL) THEN
360       --INSERT INTO msista_Tmp values (42, 'l_owner is null');
361       --commit;
362 
363       l_owner_id := FND_API.G_MISS_NUM;
364       l_owner_type_code := FND_API.G_MISS_CHAR;
365   ELSE
366       --INSERT INTO msista_Tmp values (42, 'l_owner <> null, parsing l_owner='||l_owner);
367       --commit;
368 
369       -- owner type code is bundled with owner code, need to break them apart
370       l_owner := l_p_owner;
371       l_idx := INSTR(l_owner, G_OPEN_SQBR, 1, 1);
372       l_idx2 := INSTR(l_owner, G_CLOSE_SQBR, -1, 1);
373       l_owner_id := TO_NUMBER(SUBSTR(l_owner, 1, l_idx-1));
374       l_owner_type_code := SUBSTR(l_owner, l_idx+1, l_idx2-l_idx-1);
375       --INSERT INTO msista_Tmp values (42, 'l_owner_id - ''' || l_owner_id || ''', l_owner_type_code - ''' || l_owner_type_code || '''');
376       --commit;
377 
378   END IF;
379   IF (l_p_assignee is NULL) THEN
380       --INSERT INTO msista_Tmp values (42, 'l_assignee is null');
381       --commit;
382 
383       l_assignee_id := FND_API.G_MISS_NUM;
384       l_assignee_type_code := FND_API.G_MISS_CHAR;
385   ELSE
386       --INSERT  INTO msista_Tmp values (42, 'l_assignee <> null, parsing');
387       --commit;
388 
389       -- assignee type code is bundled with assignee code, break them apart
390       l_assignee := l_p_assignee;
391       l_idx := INSTR(l_assignee, G_OPEN_SQBR, 1, 1);
392       l_idx2 := INSTR(l_assignee, G_CLOSE_SQBR, -1, 1);
393       l_assignee_id := TO_NUMBER(SUBSTR(l_assignee, 1, l_idx-1));
394       l_assignee_type_code := SUBSTR(l_assignee, l_idx+1, l_idx2-l_idx-1);
395       --INSERT  INTO msista_Tmp values (42, 'l_assignee_id - ''' || l_assignee_id || ''', l_assignee_type_code - ''' || l_assignee_type_code || '''');
396       --commit;
397 
398   END IF;
399   IF (l_count > 1 AND l_p_planned_start is NULL) THEN
400       --INSERT  INTO msista_Tmp values (42, 'l_planned_start is null');
401       --commit;
402 
403       l_planned_start := FND_API.G_MISS_DATE;
404   ELSE
405       --INSERT  INTO msista_Tmp values (42, 'l_planned_start <> null');
406       --commit;
407 
408       l_planned_start := l_p_planned_start;
409   END IF;
410   IF (l_count > 1 AND l_p_planned_end is NULL) THEN
411       --INSERT  INTO msista_Tmp values (42, 'l_planned_end is null');
412       --commit;
413 
414       l_planned_end := FND_API.G_MISS_DATE;
415   ELSE
416       --INSERT  INTO msista_Tmp values (42, 'l_planned_end <> null');
417       --commit;
418 
419       l_planned_end :=l_p_planned_end;
420   END IF;
421   IF (l_count > 1 AND l_p_actual_start is NULL) THEN
422       --INSERT  INTO msista_Tmp values (42, 'l_actual_start is null');
423       --commit;
424 
425       l_actual_start := FND_API.G_MISS_DATE;
426   ELSE
427       --INSERT  INTO msista_Tmp values (42, 'l_actual_start <> null');
428       --commit;
429 
430       l_actual_start := l_p_actual_start;
431   END IF;
432   IF (l_count > 1 AND l_p_actual_end is NULL) THEN
433       --INSERT  INTO msista_Tmp values (42, 'l_actual_end is null');
434       --commit;
435 
436       l_actual_end := FND_API.G_MISS_DATE;
437   ELSE
438       --INSERT  INTO msista_Tmp values (42, 'l_actual_end <> null');
439       --commit;
440 
441       l_actual_end := l_p_actual_end;
442   END IF;
443   IF (l_count > 1 AND l_p_sched_start is NULL) THEN
444       --INSERT  INTO msista_Tmp values (42, 'l_sched_start is null');
445       --commit;
446 
447       l_sched_start := FND_API.G_MISS_DATE;
448   ELSE
449       --INSERT  INTO msista_Tmp values (42, 'l_sched_start <> null');
450       --commit;
451 
452       l_sched_start := l_p_sched_start;
453   END IF;
454   IF (l_count > 1 AND l_p_sched_end is NULL) THEN
455 
456       --INSERT  INTO msista_Tmp values (42, 'l_sched_end is null');
457       --commit;
458 
459       l_sched_end := FND_API.G_MISS_DATE;
460   ELSE
461       --INSERT  INTO msista_Tmp values (42, 'l_sched_end <> null');
462       --commit;
463 
464       l_sched_end := l_p_sched_end;
465   END IF;
466 
467 
468   FOR i IN 1..l_count LOOP
469 
470     /* if actions are Reassign, Reschedule or Transfer Owner then get the priority name from work_item_data
471        else get the priority name from action_param_data
472 
473     if (p_action_type = 'REASSIGN_TASK' or p_action_type = 'RESCHEDULE_TASK'
474         or p_action_type = 'TRANSFER_TASK_OWNER_TASK') then
475        l_priority := l_task_rec_tbl(i).priority_name;
476     else
477        l_priority := l_p_priority;
478     end if;
479 
480     -- This code is not required because these changes now, update/close task actions in multi select mode
481     -- throws an error.
482 
483    */
484 
485     --INSERT  INTO msista_Tmp values (49, 'inside update task loop '|| i);
486     --  --commit;
487     -- get current object_version_number of task to updated
488 
489     -- 09/24/03 commented this code because getting the object_version_number from p_action_input_data. (fix bug 3127477)
490 /*
491     SELECT object_version_number INTO l_object_version_number
492     FROM jtf_tasks_b WHERE task_id = l_task_rec_tbl(i).id;
493 */
494 
495     -- call the update_task api to update the task object
496     --INSERT  INTO msista_Tmp values (50, 'calling update_task, with params :- ');
497     --INSERT  INTO msista_Tmp values (51, 'p_api_version                       => ''' || l_api_version || '''');
498     --INSERT  INTO msista_Tmp values (51, 'p_init_msg_list                     => ''' || G_FALSE || '''');
499     --INSERT  INTO msista_Tmp values (51, 'p_--commit                            => ''' || G_FALSE || '''');
500     --INSERT  INTO msista_Tmp values (51, 'p_object_version_number             => ''' || l_object_version_number || '''');
501     --INSERT  INTO msista_Tmp values (51, 'p_task_id                           => ''' || l_task_rec_tbl(i).id || '''');
502     --INSERT  INTO msista_Tmp values (51, 'p_task_name                         => ''' || l_task_name || '''');
503     --INSERT  INTO msista_Tmp values (51, 'p_task_type_name                    => ''' || l_type || '''');
504     --INSERT  INTO msista_Tmp values (51, 'p_description                       => ''' || l_description || '''');
505     --INSERT  INTO msista_Tmp values (51, 'p_task_status_name                  => ''' || l_status || '''');
506     --INSERT  INTO msista_Tmp values (51, 'p_task_priority_name                => ''' || l_priority || '''');
507     --INSERT  INTO msista_Tmp values (51, 'p_owner_type_code                   => ''' || l_owner_type_code || '''');
508     --INSERT  INTO msista_Tmp values (51, 'p_owner_id                          => ''' || l_owner_id || '''');
509     --INSERT  INTO msista_Tmp values (51, 'p_assigned_by_id                    => ''' || l_assignee_id || '''');
510     --INSERT  INTO msista_Tmp values (51, 'p_planned_start_date                => ''' || l_planned_start || '''');
511     --INSERT  INTO msista_Tmp values (51, 'p_planned_end_date                  => ''' || l_planned_end || '''');
512     --INSERT  INTO msista_Tmp values (51, 'p_scheduled_start_date              => ''' || l_actual_start || '''');
513     --INSERT  INTO msista_Tmp values (51, 'p_scheduled_end_date                => ''' || l_actual_end || '''');
514     --INSERT  INTO msista_Tmp values (51, 'p_actual_start_date                 => ''' || l_sched_start || '''');
515     --INSERT  INTO msista_Tmp values (51, 'p_actual_end_date                   => ''' || l_sched_end || '''');
516     --INSERT  INTO msista_Tmp values (51, 'x_return_status                     => ''' || l_return_status || '''');
517     --INSERT  INTO msista_Tmp values (51, 'x_msg_count                         => ''' || l_msg_count || '''');
518     --INSERT  INTO msista_Tmp values (51, 'x_msg_data                          => ''' || l_msg_data || '''');
519     --commit;
520 
521     jtf_tasks_pub.update_task(
522       p_api_version                       => l_api_version,
523       p_init_msg_list                     => G_FALSE,
524       p_commit                            => G_FALSE,
525       p_object_version_number             => l_task_rec_tbl(i).object_version_number,
526       p_task_id                           => l_task_rec_tbl(i).id,
527       p_task_name                         => l_task_name,
528       p_task_type_name                    => l_type,
529       p_description                       => l_description,
530       p_task_status_name                  => l_status,
531       p_task_priority_name                => l_priority,
532       p_owner_type_code                   => l_owner_type_code,
533       p_owner_id                          => l_owner_id,
534       p_planned_start_date                => l_planned_start,
535       p_planned_end_date                  => l_planned_end,
536       p_scheduled_start_date              => l_sched_start,
537       p_scheduled_end_date                => l_sched_end,
538       p_actual_start_date                 => l_actual_start,
539       p_actual_end_date                   => l_actual_end,
540       x_return_status                     => l_return_status,
541       x_msg_count                         => l_msg_count,
542       x_msg_data                          => l_msg_data
543     );
544 
545     --if call fails, break out of loop
546     IF NOT (l_return_status = G_SUCCESS) THEN
547       --INSERT  INTO msista_Tmp values (60, 'update_task failed, ret_status - ' || l_return_status);
548       --INSERT  INTO msista_Tmp values (60, 'update_task failed, msg_count - ' || l_msg_count);
549       --INSERT  INTO msista_Tmp values (60, 'update_task failed, msg_data - ' || l_msg_data);
550       --commit;
551 
552       --fnd_msg_pub.count_and_get (
553       --  p_count => l_msg_count,
554       --  p_data => l_msg_data
555       --);
556       --INSERT  INTO msista_Tmp values (60, 'update_task failed, msg_count - ' || l_msg_count);
557       --INSERT  INTO msista_Tmp values (60, 'update_task failed, msg_data - ' || l_msg_data);
558       --commit;
559 
560       RAISE fail_exception;
561     ELSE
562       --INSERT  INTO msista_Tmp values (60, 'update_task OK, ret_status - ' || l_return_status);
563       --commit;
564 
565       NULL;
566     END IF;
567 
568     -- if task assignment is being modified, it has to be dealt with separately
569     IF (l_assignee IS NOT NULL) THEN
570       /*
571        to do
572        a. delete all existing assignments
573        b. assign task to specified assignee
574        c. --commit
575       */
576       -- a
577       OPEN c_task_ass (l_task_rec_tbl(i).id);
578       LOOP
579         FETCH c_task_ass INTO l_exist_assign_id, l_exist_assign_ver;
580 
581         -- not a problem if task is not currently assigned, exit loop.
582         IF c_task_ass%FOUND THEN
583 
584           --INSERT  INTO msista_Tmp values (62, 'deleting task_assignment - ' || l_exist_assign_id);
585           --commit;
586 
587           -- delete assignments one by one
588           jtf_task_assignments_pub.delete_task_assignment(
589             p_api_version             => l_api_version,
590             p_object_version_number   => l_exist_assign_ver,
591             p_init_msg_list           => G_FALSE,
592             p_commit                  => G_FALSE,
593             p_task_assignment_id      => l_exist_assign_id,
594             x_return_status           => l_return_status,
595             x_msg_count               => l_msg_count,
596             x_msg_data                => l_msg_data
597           );
598 
599           IF NOT (l_return_status = G_SUCCESS) THEN
600             --INSERT  INTO msista_Tmp values (62, 'delete_task_assignment failed, ret_status - ' || l_return_status);
601             --INSERT  INTO msista_Tmp values (62, 'delete_task_assignment failed, msg_count - ' || l_msg_count);
602             --INSERT  INTO msista_Tmp values (62, 'delete_task_assignment failed, msg_data - ' || l_msg_data);
603             --commit;
604 
605             RAISE fail_exception;
606           ELSE
607             --INSERT  INTO msista_Tmp values (62, 'delete_task_assignment OK, ret_status - ' || l_return_status);
608             --commit;
609 
610 	    NULL;
611           END IF;
612         ELSE
613           EXIT;
614         END IF;
615       END LOOP;
616 
617       IF (c_task_ass%ISOPEN) THEN
618         CLOSE c_task_ass;
619       END IF;
620 
621       -- b
622       jtf_task_assignments_pub.create_task_assignment(
623         p_api_version                 => l_api_version,
624         p_init_msg_list               => G_FALSE,
625         p_commit                      => G_FALSE,
626         p_task_id                     => l_task_rec_tbl(i).id,
627         p_resource_type_code          => l_assignee_type_code,
628         p_resource_id                 => l_assignee_id,
629         p_assignment_status_id        => l_new_assign_status,
630         x_return_status               => l_return_status,
631         x_msg_count                   => l_msg_count,
632         x_msg_data                    => l_msg_data,
633         x_task_assignment_id          => l_new_assign_id,
634         p_show_on_calendar            => G_YES
635       );
636 
637       IF NOT (l_return_status = G_SUCCESS) THEN
638         --INSERT  INTO msista_Tmp values (64, 'create_task_assignment failed, ret_status - ' || l_return_status);
639         --INSERT  INTO msista_Tmp values (64, 'create_task_assignment failed, msg_count - ' || l_msg_count);
640         --INSERT  INTO msista_Tmp values (64, 'create_task_assignment failed, msg_data - ' || l_msg_data);
641         --commit;
642 
643         RAISE fail_exception;
644       ELSE
645         --INSERT  INTO msista_Tmp values (64, 'create_task_assignment OK, ret_status - ' || l_return_status);
646         --commit;
647 
648 	NULL;
649       END IF;
650     END IF;
651 
652     -- next, if there is note data to be applied
653     -- call note creation api
654     IF (l_p_note IS NOT NULL) THEN
655       -- by default the note has to be related to the task
656       l_note_ctxt_idx := 1;
657       l_note_ctxt_tbl(l_note_ctxt_idx).NOTE_CONTEXT_TYPE := l_src_task;
658       l_note_ctxt_tbl(l_note_ctxt_idx).NOTE_CONTEXT_TYPE_ID := l_task_rec_tbl(i).id;
659       l_note_ctxt_idx := l_note_ctxt_idx+1;
660 
661       jtf_notes_pub.create_note(
662           -- p_parent_note_id    => fnd_api.g_miss_num,
663           -- p_jtf_note_id            => fnd_api.g_miss_num,
664           p_api_version           => l_api_version,
665           p_init_msg_list         => G_FALSE,
666           p_commit                => G_FALSE,
667           p_validation_level      =>  l_valid_level_full,
668           x_return_status         => l_return_status,
669           x_msg_count             => l_msg_count,
670           x_msg_data              => l_msg_data,
671           -- p_org_id               =>   NULL,
672           p_source_object_id      => l_task_rec_tbl(i).id,
673           p_source_object_code    => l_src_task,
674           p_notes                 => l_p_note
675           --, p_notes_detail          => NULL
676           , p_note_status           => 'I'
677           ,p_entered_date          => TO_DATE('1','j'),
678           x_jtf_note_id           => l_note_id
679           , p_last_update_date      => TO_DATE('1','j')
680           , p_last_updated_by       => fnd_global.user_id
681           , p_creation_date         => TO_DATE('1','j')
682           --, p_created_by            => fnd_global.user_id
683           --, p_last_update_login     => fnd_global.login_id
684           /*, p_attribute1            => NULL
685           , p_attribute2            => NULL
686           , p_attribute3            => NULL
687           , p_attribute4            => NULL
688           , p_attribute5            => NULL
689           , p_attribute6            => NULL
690           , p_attribute7            => NULL
691           , p_attribute8            => NULL
692           , p_attribute9            => NULL
693           , p_attribute10           => NULL
694           , p_attribute11           => NULL
695           , p_attribute12           => NULL
696           , p_attribute13           => NULL
697           , p_attribute14           => NULL
698           , p_attribute15           => NULL
699           , p_context               => NULL
700           , p_note_type             => NULL*/,
701           p_jtf_note_contexts_tab => l_note_ctxt_tbl
702           ,        p_entered_by            => G_USER_ID
703       );
704 
705       IF NOT (l_return_status = G_SUCCESS) THEN
706         RAISE fail_exception;
707       ELSE
708         -- we have to do some additional work if 'auto-relate note' is true
709         IF (FND_PROFILE.VALUE('IEU_AUTO_RELATED') = 'Y') THEN -- this is for source document
710 	  l_continue := 0;
711 	  select count(source_object_id) into l_continue
712 	  from jtf_tasks_b
713 	  where task_id = l_task_rec_tbl(i).id;
714 
715           if (l_continue > 0) then
716 		  select source_object_id into l_note_context_type_id
717 		  from jtf_tasks_b
718 		  where task_id = l_task_rec_tbl(i).id;
719           else l_note_context_type_id := null;
720           end if;
721 
722           OPEN c_task_src(l_task_rec_tbl(i).id);
723           FETCH c_task_src INTO l_obj_type_code;
724 
725           -- if the source object type of the task is registered for notes usage,
726           -- create a note context for
727           IF (c_task_src%FOUND) THEN
728            if (l_note_context_type_id is not null) then
729 		    jtf_notes_pub.Create_note_context
730 		    ( p_validation_level     => l_valid_level_full,
731 		      p_jtf_note_id          => l_note_id,
732 		      p_last_update_date     => FND_API.G_MISS_DATE,
733 		      p_last_updated_by      => G_USER_ID,
734 		      p_creation_date        => FND_API.G_MISS_DATE,
735 		      p_note_context_type_id => l_note_context_type_id,
736 		      p_note_context_type    => l_obj_type_code,
737 		      x_return_status        => l_return_status,
738 		      x_note_context_id      => l_context_id
739 		    );
740 
741 
742 		    IF NOT (l_return_status = G_SUCCESS) THEN
743 		      RAISE fail_exception;
744 		    ELSE
745 		      NULL;
746 		    END IF;
747 	   end if;
748           END IF; -- if cursor%found
749 
750           IF (c_task_src%ISOPEN) THEN
751             CLOSE c_task_src;
752           END IF;
753 
754         END IF; -- auto_relate = 1
755 
756 	IF (FND_PROFILE.VALUE('AS_NOTES_LEAD_CUSTOMER') = 'Y') THEN
757 	  l_continue := 0;
758 	  select count(customer_id) into l_continue
759 	  from jtf_tasks_b
760 	  where task_id = l_task_rec_tbl(i).id;
761 
762           if (l_continue > 0) then
763 		  select customer_id into l_note_context_type_id
764 		  from jtf_tasks_b
765 		  where task_id = l_task_rec_tbl(i).id;
766           else l_note_context_type_id := null;
767           end if;
768 
769           OPEN c_task_src(l_task_rec_tbl(i).id);
770           FETCH c_task_src INTO l_obj_type_code;
771 
772           -- if the source object type of the task is registered for notes usage,
773           -- create a note context for
774 	  if (l_obj_type_code = 'LEAD'  ) then
775 		  IF (c_task_src%FOUND) THEN
776 			  if (l_note_context_type_id is not null) then
777 				    jtf_notes_pub.Create_note_context
778 				    ( p_validation_level     => l_valid_level_full,
779 				      p_jtf_note_id          => l_note_id,
780 				      p_last_update_date     => FND_API.G_MISS_DATE,
781 				      p_last_updated_by      => G_USER_ID,
782 				      p_creation_date        => FND_API.G_MISS_DATE,
783 				      p_note_context_type_id => l_note_context_type_id,
784 				      p_note_context_type    => 'PARTY',
785 				      x_return_status        => l_return_status,
786 				      x_note_context_id      => l_context_id
787 				    );
788 
789 
790 				    IF NOT (l_return_status = G_SUCCESS) THEN
791 				      RAISE fail_exception;
792 				    ELSE
793 				      NULL;
794 				    END IF;
795 			  end if;
796 		   end if;-- if c_task_src%FOUND
797           END IF; -- l_obj_type_code = 'LEAD'
798 
799           IF (c_task_src%ISOPEN) THEN
800             CLOSE c_task_src;
801           END IF;
802 
803         END IF; -- if AS_NOTES_LEAD_CUSTOMER
804 
805 
806 	IF (FND_PROFILE.VALUE('AS_NOTES_LEAD_CONTACT') = 'Y') THEN
807           --INSERT  INTO msista_Tmp values (70, 'auto related profile is YES' );
808           --commit;
809           l_continue := 0;
810 	  for c2_rec in  C_note_context_id (l_task_rec_tbl(i).id)
811 		LOOP
812                     if l_continue = 0 then
813 		       l_note_context_type_id := c2_rec.contact_id;
814 		       l_continue := l_continue +1;
815 		    end if;
816 	  end loop;
817 
818           OPEN c_task_src(l_task_rec_tbl(i).id);
819           FETCH c_task_src INTO l_obj_type_code;
820 
821           -- if the source object type of the task is registered for notes usage,
822           -- create a note context for
823 	  if ( l_obj_type_code = 'LEAD'  ) then
824 		  IF (c_task_src%FOUND) THEN
825 			  if (l_note_context_type_id is not null) then
826 				    jtf_notes_pub.Create_note_context
827 				    ( p_validation_level     => l_valid_level_full,
828 				      p_jtf_note_id          => l_note_id,
829 				      p_last_update_date     => FND_API.G_MISS_DATE,
830 				      p_last_updated_by      => G_USER_ID,
831 				      p_creation_date        => FND_API.G_MISS_DATE,
832 				      p_note_context_type_id => l_note_context_type_id,
833 				      p_note_context_type    => 'PARTY',
834 				      x_return_status        => l_return_status,
835 				      x_note_context_id      => l_context_id
836 				    );
837 
838 
839 				    IF NOT (l_return_status = G_SUCCESS) THEN
840 				      RAISE fail_exception;
841 				    ELSE
842 				      NULL;
843 				    END IF;
844 			   end if;
845 		   end if;-- if c_task_src%FOUND
846           END IF; -- if  l_obj_type_code = 'LEAD'
847 
848           IF (c_task_src%ISOPEN) THEN
849             CLOSE c_task_src;
850           END IF;
851 
852         END IF; -- IF (FND_PROFILE.VALUE('AS_NOTES_LEAD_CONTACT') = 'Y')
853 
854 	IF (FND_PROFILE.VALUE('AS_NOTES_OPP_CUSTOMER') = 'Y') THEN
855           --INSERT  INTO msista_Tmp values (70, 'auto related profile is YES' );
856           --commit;
857           l_continue := 0;
858           select count(customer_id) into l_continue
859 	  from jtf_tasks_b
860           where task_id = l_task_rec_tbl(i).id;
861 
862 	  if (l_continue > 0) then
863               select customer_id into l_note_context_type_id
864               from jtf_tasks_b
865               where task_id = l_task_rec_tbl(i).id;
866           else l_note_context_type_id := null;
867           end if;
868 
869           OPEN c_task_src(l_task_rec_tbl(i).id);
870           FETCH c_task_src INTO l_obj_type_code;
871 
872           -- if the source object type of the task is registered for notes usage,
873           -- create a note context for
874 	  if (l_obj_type_code = 'OPPORTUNITY'  ) then
875 		  IF (c_task_src%FOUND) THEN
876 			  if (l_note_context_type_id is not null) then
877 			    jtf_notes_pub.Create_note_context
878 			    ( p_validation_level     => l_valid_level_full,
879 			      p_jtf_note_id          => l_note_id,
880 			      p_last_update_date     => FND_API.G_MISS_DATE,
881 			      p_last_updated_by      => G_USER_ID,
882 			      p_creation_date        => FND_API.G_MISS_DATE,
883 			      p_note_context_type_id => l_note_context_type_id,
884 			      p_note_context_type    => 'PARTY',
885 			      x_return_status        => l_return_status,
886 			      x_note_context_id      => l_context_id
887 			    );
888 
889 
890 			    IF NOT (l_return_status = G_SUCCESS) THEN
891 			      --INSERT  INTO msista_Tmp values (74, 'create_note_context failed, ret_status - ' || l_return_status);
892 			      --INSERT  INTO msista_Tmp values (74, 'create_note_context failed, msg_count - ' || l_msg_count);
893 			      --INSERT  INTO msista_Tmp values (74, 'create_note_context failed, msg_data - ' || l_msg_data);
894 			      --commit;
895 
896 			      RAISE fail_exception;
897 			    ELSE
898 			      NULL;
899 			    END IF;
900 			  end if;
901 		  end if;-- if c_task_src%FOUND.
902           END IF; -- if l_obj_type_code = 'OPPORTUNITY'
903 
904           IF (c_task_src%ISOPEN) THEN
905             CLOSE c_task_src;
906           END IF;
907 
908         END IF; -- IF (FND_PROFILE.VALUE('AS_NOTES_OPP_CUSTOMER') = 'Y')
909 
910 
911 	IF (FND_PROFILE.VALUE('AS_NOTES_OPP_CONTACT') = 'Y') THEN
912           --INSERT  INTO msista_Tmp values (70, 'auto related profile is YES' );
913           --commit;
914           l_continue := 0;
915 	  for c2_rec in  C_note_context_id (l_task_rec_tbl(i).id)
916 		LOOP
917                     if l_continue = 0 then
918 		       l_note_context_type_id := c2_rec.contact_id;
919 		       l_continue := l_continue +1;
920 		    end if;
921 		end loop;
922 
923           OPEN c_task_src(l_task_rec_tbl(i).id);
924           FETCH c_task_src INTO l_obj_type_code;
925 
926           -- if the source object type of the task is registered for notes usage,
927           -- create a note context for
928 	  if ( l_obj_type_code = 'OPPORTUNITY'  ) then
929 		  IF (c_task_src%FOUND) THEN
930 			  if (l_note_context_type_id is not null) then
931 			    jtf_notes_pub.Create_note_context
932 			    ( p_validation_level     => l_valid_level_full,
933 			      p_jtf_note_id          => l_note_id,
934 			      p_last_update_date     => FND_API.G_MISS_DATE,
935 			      p_last_updated_by      => G_USER_ID,
936 			      p_creation_date        => FND_API.G_MISS_DATE,
937 			      p_note_context_type_id => l_note_context_type_id,
938 			      p_note_context_type    => 'PARTY',
939 			      x_return_status        => l_return_status,
940 			      x_note_context_id      => l_context_id
941 			    );
942 
943 
944 			    IF NOT (l_return_status = G_SUCCESS) THEN
945 
946 			      RAISE fail_exception;
947 			    ELSE
948 			      NULL;
949 			    END IF;
950 			  end if;
951 		  end if;-- if lead...
952           END IF; -- if cursor%found
953 
954           IF (c_task_src%ISOPEN) THEN
955             CLOSE c_task_src;
956           END IF;
957         END IF; -- IF (FND_PROFILE.VALUE('AS_NOTES_OPP_CONTACT') = 'Y')
958 
959 	IF (FND_PROFILE.VALUE('AS_NOTES_REL_OBJECT') = 'Y') THEN
960 		l_continue := 0;
961 		select count(a.object_id) into l_continue
962 		from hz_relationships a, hz_parties b
963 		where b.party_type = 'PARTY_RELATIONSHIP'
964 		      and a.party_id in (select source_object_id
965 						from jtf_tasks_b
966 						where task_id = l_task_rec_tbl(i).id)
967 		      and a.party_id = b.party_id
968 		      and a.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
969 		      AND a.OBJECT_TABLE_NAME = 'HZ_PARTIES'
970 		      AND DIRECTIONAL_FLAG = 'F';
971 
972 		if (l_continue > 0) then
973 		 select a.object_id into l_note_context_type_id
974 		 from hz_relationships a, hz_parties b
975 		 where b.party_type = 'PARTY_RELATIONSHIP'
976 		       and a.party_id  in (select source_object_id
977 						from jtf_tasks_b
978 						where task_id = l_task_rec_tbl(i).id)
979 		       and a.party_id = b.party_id
980       		       and a.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
981 		       AND a.OBJECT_TABLE_NAME = 'HZ_PARTIES'
982 		       AND DIRECTIONAL_FLAG = 'F';
983 
984 		else l_note_context_type_id :=null;
985 		end if ;
986 
987 	        OPEN c_task_src(l_task_rec_tbl(i).id);
988 		FETCH c_task_src INTO l_obj_type_code;
989 
990 		-- if the source object type of the task is registered for notes usage,
991 		-- create a note context for
992 		if (l_obj_type_code = 'PARTY'  ) then
993 			  IF (c_task_src%FOUND) THEN
994 				  if (l_note_context_type_id is not null) then
995 				   jtf_notes_pub.Create_note_context
996 				    ( p_validation_level     => l_valid_level_full,
997 				      p_jtf_note_id          => l_note_id,
998 				      p_last_update_date     => FND_API.G_MISS_DATE,
999 				      p_last_updated_by      => G_USER_ID,
1000 				      p_creation_date        => FND_API.G_MISS_DATE,
1001 				      p_note_context_type_id => l_note_context_type_id,
1002 				      p_note_context_type    => 'PARTY',
1003 				      x_return_status        => l_return_status,
1004 				      x_note_context_id      => l_context_id
1005 				    );
1006 
1007 
1008 				    IF NOT (l_return_status = G_SUCCESS) THEN
1009 				      RAISE fail_exception;
1010 				    ELSE
1011 				      NULL;
1012 				    END IF;
1013 				  end if;
1014 		          end if;-- if lead...
1015                 END IF; -- if cursor%found
1016 
1017 		IF (c_task_src%ISOPEN) THEN
1018 		    CLOSE c_task_src;
1019 		END IF;
1020         END IF; --IF (FND_PROFILE.VALUE('AS_NOTES_REL_OBJECT') = 'Y')
1021 
1022 
1023 	IF (FND_PROFILE.VALUE('AS_NOTES_REL_SUBJECT') = 'Y') THEN
1024 	 l_continue := 0;
1025 	 select count(a.subject_id) into l_continue
1026          from hz_relationships a, hz_parties b
1027          where b.party_type = 'PARTY_RELATIONSHIP'
1028 	            and a.party_id = (select source_object_id
1029 	                        from jtf_tasks_b
1030 				where task_id = l_task_rec_tbl(i).id)
1031 		    and a.party_id = b.party_id
1032 		    and a.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
1033 		    AND a.OBJECT_TABLE_NAME = 'HZ_PARTIES'
1034 		    AND DIRECTIONAL_FLAG = 'F';
1035 
1036          if (l_continue > 0) then
1037            select a.subject_id into l_note_context_type_id
1038            from hz_relationships a, hz_parties b
1039            where b.party_type = 'PARTY_RELATIONSHIP'
1040 	            and a.party_id = (select source_object_id
1041 	                        from jtf_tasks_b
1042 				where task_id = l_task_rec_tbl(i).id)
1043 		    and a.party_id = b.party_id
1044 		    and a.SUBJECT_TABLE_NAME = 'HZ_PARTIES'
1045 		    AND a.OBJECT_TABLE_NAME = 'HZ_PARTIES'
1046 		    AND DIRECTIONAL_FLAG = 'F';
1047 
1048           else l_note_context_type_id := null;
1049           end if;
1050 
1051           OPEN c_task_src(l_task_rec_tbl(i).id);
1052           FETCH c_task_src INTO l_obj_type_code;
1053 
1054           -- if the source object type of the task is registered for notes usage,
1055           -- create a note context for
1056 	  if ( l_obj_type_code = 'PARTY'  ) then
1057 		  IF (c_task_src%FOUND) THEN
1058 			  if (l_note_context_type_id is not null) then
1059 			   jtf_notes_pub.Create_note_context
1060 			    ( p_validation_level     => l_valid_level_full,
1061 			      p_jtf_note_id          => l_note_id,
1062 			      p_last_update_date     => FND_API.G_MISS_DATE,
1063 			      p_last_updated_by      => G_USER_ID,
1064 			      p_creation_date        => FND_API.G_MISS_DATE,
1065 			      p_note_context_type_id => l_note_context_type_id,
1066 			      p_note_context_type    => 'PARTY',
1067 			      x_return_status        => l_return_status,
1068 			      x_note_context_id      => l_context_id
1069 			    );
1070 
1071 
1072 			    IF NOT (l_return_status = G_SUCCESS) THEN
1073 			      RAISE fail_exception;
1074 			    ELSE
1075 			      NULL;
1076 			    END IF;
1077 		          end if;
1078 		  end if;-- if lead...
1079           END IF; -- if cursor%found
1080 
1081           IF (c_task_src%ISOPEN) THEN
1082             CLOSE c_task_src;
1083           END IF;
1084         END IF; -- if FND_PROFILE.VALUE('AS_NOTES_REL_SUBJECT') = 'Y')
1085       END IF; -- if create_note ok
1086     END IF; -- IF (l_note IS NOT NULL)
1087 
1088     -- continue with rest of task items
1089   END LOOP; -- FOR i IN 1..l_count
1090 
1091   -- Set UWQ Actions Data if all is OK
1092   l_uwq_actions_list(1).uwq_action_key := 'UWQ_WORK_DETAILS_REFRESH';
1093   l_uwq_actions_list(1).Action_data := '' ;
1094   l_uwq_actions_list(1).dialog_style := 1 ;
1095   l_uwq_actions_list(1).message := '' ;
1096 
1097   IEU_UWQ_WORK_PANEL_PUB.SET_UWQ_ACTIONS(l_uwq_actions_list,
1098                                          x_uwq_action_list) ;
1099 
1100   x_return_status := G_SUCCESS;
1101 
1102   -- everything went A-OK
1103   commit WORK;
1104 
1105   EXCEPTION
1106 
1107     -- all exceptions are the same for now
1108     WHEN null_fail_exception THEN
1109       x_return_status := G_UNEXP_ERROR;
1110 
1111       fnd_message.set_name ('IEU', 'IEU_STATUS_TYPE_FAIL');
1112       fnd_msg_pub.add;
1113       x_return_status := fnd_api.g_ret_sts_unexp_error;
1114       fnd_msg_pub.count_and_get (
1115         p_count => x_msg_count,
1116         p_data => x_msg_data
1117       );
1118 
1119     WHEN name_fail_exception THEN
1120       x_return_status := G_UNEXP_ERROR;
1121 
1122       fnd_message.set_name ('IEU', 'IEU_TASK_NAME_FAIL');
1123       fnd_msg_pub.add;
1124       x_return_status := fnd_api.g_ret_sts_unexp_error;
1125       fnd_msg_pub.count_and_get (
1126         p_count => x_msg_count,
1127         p_data => x_msg_data
1128       );
1129 
1130     WHEN fail_exception THEN
1131       x_return_status := G_UNEXP_ERROR;
1132       --fnd_message.set_name ('IEU', 'IEU_STATUS_TYPE_FAIL');
1133       if (l_msg_count is null) or (l_msg_count < 1) then
1134       fnd_message.set_name ('IEU', 'IEU_UPDATE_TASK_FAIL');
1135       fnd_msg_pub.add;
1136       x_return_status := fnd_api.g_ret_sts_unexp_error;
1137       fnd_msg_pub.count_and_get (
1138         p_count => x_msg_count,
1139         p_data => x_msg_data
1140       );
1141    end if;
1142     WHEN OTHERS THEN
1143 
1144       -- rollback disabled until this works right, there is a --commit at the end
1145       -- roll back always
1146       ROLLBACK TO update_task_savepoint;
1147 
1148       x_return_status := G_UNEXP_ERROR;
1149 
1150       fnd_message.set_name ('IEU', 'IEU_UPDATE_TASK_FAIL');
1151       fnd_msg_pub.add;
1152 
1153       fnd_msg_pub.count_and_get (
1154         p_count => x_msg_count,
1155         p_data => x_msg_data
1156       );
1157 
1158 END WP_TASK; -- PROCEDURE WP_TASK
1159 
1160 PROCEDURE CLOSE_TASK
1161 ( P_RESOURCE_ID       IN NUMBER,
1162   P_LANGUAGE          IN VARCHAR2,
1163   P_SOURCE_LANG       IN VARCHAR2,
1164   P_ACTION_KEY        IN VARCHAR2,
1165   P_ACTION_INPUT_DATA IN SYSTEM.ACTION_INPUT_DATA_NST,
1166   X_UWQ_ACTION_LIST   OUT NOCOPY SYSTEM.IEU_UWQ_WORK_ACTIONS_NST,
1167   X_MSG_COUNT         OUT NOCOPY NUMBER,
1168   X_MSG_DATA          OUT NOCOPY VARCHAR2,
1169   X_RETURN_STATUS     OUT NOCOPY VARCHAR2
1170 )
1171 IS
1172 BEGIN
1173   IEU_WPACTIONS_PVT.WP_TASK(P_RESOURCE_ID,
1174 			P_LANGUAGE   ,
1175 			P_SOURCE_LANG,
1176 			P_ACTION_KEY ,
1177 			P_ACTION_INPUT_DATA ,
1178 			'CLOSE_TASK',
1179 			X_UWQ_ACTION_LIST  ,
1180 			X_MSG_COUNT        ,
1181 			X_MSG_DATA         ,
1182 			X_RETURN_STATUS);
1183 
1184 END CLOSE_TASK; -- PROCEDURE CLOSE_TASK
1185 
1186 
1187 PROCEDURE UPDATE_TASK
1188 ( P_RESOURCE_ID       IN NUMBER,
1189   P_LANGUAGE          IN VARCHAR2,
1190   P_SOURCE_LANG       IN VARCHAR2,
1191   P_ACTION_KEY        IN VARCHAR2,
1192   P_ACTION_INPUT_DATA IN SYSTEM.ACTION_INPUT_DATA_NST,
1193   X_UWQ_ACTION_LIST   OUT NOCOPY SYSTEM.IEU_UWQ_WORK_ACTIONS_NST,
1194   X_MSG_COUNT         OUT NOCOPY NUMBER,
1195   X_MSG_DATA          OUT NOCOPY VARCHAR2,
1196   X_RETURN_STATUS     OUT NOCOPY VARCHAR2
1197 )
1198 IS
1199 BEGIN
1200   IEU_WPACTIONS_PVT.WP_TASK(P_RESOURCE_ID,
1201 			P_LANGUAGE   ,
1202 			P_SOURCE_LANG,
1203 			P_ACTION_KEY ,
1204 			P_ACTION_INPUT_DATA ,
1205 			'UPDATE_TASK',
1206 			X_UWQ_ACTION_LIST  ,
1207 			X_MSG_COUNT        ,
1208 			X_MSG_DATA         ,
1209 			X_RETURN_STATUS);
1210 
1211 END UPDATE_TASK; -- PROCEDURE UPDATE_TASK
1212 
1213 PROCEDURE REASSIGN_TASK
1214 ( P_RESOURCE_ID       IN NUMBER,
1215   P_LANGUAGE          IN VARCHAR2,
1216   P_SOURCE_LANG       IN VARCHAR2,
1217   P_ACTION_KEY        IN VARCHAR2,
1218   P_ACTION_INPUT_DATA IN SYSTEM.ACTION_INPUT_DATA_NST,
1219   X_UWQ_ACTION_LIST   OUT NOCOPY SYSTEM.IEU_UWQ_WORK_ACTIONS_NST,
1220   X_MSG_COUNT         OUT NOCOPY NUMBER,
1221   X_MSG_DATA          OUT NOCOPY VARCHAR2,
1222   X_RETURN_STATUS     OUT NOCOPY VARCHAR2
1223 )
1224 IS
1225 BEGIN
1226   IEU_WPACTIONS_PVT.WP_TASK(P_RESOURCE_ID,
1227 			P_LANGUAGE   ,
1228 			P_SOURCE_LANG,
1229 			P_ACTION_KEY ,
1230 			P_ACTION_INPUT_DATA ,
1231 			'REASSIGN_TASK',
1232 			X_UWQ_ACTION_LIST  ,
1233 			X_MSG_COUNT        ,
1234 			X_MSG_DATA         ,
1235 			X_RETURN_STATUS);
1236 
1237 END REASSIGN_TASK; -- PROCEDURE REASSIGN_TASK
1238 
1239 PROCEDURE RESCHEDULE_TASK
1240 ( P_RESOURCE_ID       IN NUMBER,
1241   P_LANGUAGE          IN VARCHAR2,
1242   P_SOURCE_LANG       IN VARCHAR2,
1243   P_ACTION_KEY        IN VARCHAR2,
1244   P_ACTION_INPUT_DATA IN SYSTEM.ACTION_INPUT_DATA_NST,
1245   X_UWQ_ACTION_LIST   OUT NOCOPY SYSTEM.IEU_UWQ_WORK_ACTIONS_NST,
1246   X_MSG_COUNT         OUT NOCOPY NUMBER,
1247   X_MSG_DATA          OUT NOCOPY VARCHAR2,
1248   X_RETURN_STATUS     OUT NOCOPY VARCHAR2
1249 )
1250 IS
1251 BEGIN
1252   IEU_WPACTIONS_PVT.WP_TASK(P_RESOURCE_ID,
1253 			P_LANGUAGE   ,
1254 			P_SOURCE_LANG,
1255 			P_ACTION_KEY ,
1256 			P_ACTION_INPUT_DATA ,
1257 			'RESCHEDULE_TASK',
1258 			X_UWQ_ACTION_LIST  ,
1259 			X_MSG_COUNT        ,
1260 			X_MSG_DATA         ,
1261 			X_RETURN_STATUS);
1262 
1263 END RESCHEDULE_TASK; -- PROCEDURE RESCHEDULE_TASK
1264 
1265 PROCEDURE TRANSFER_TASK_OWNER_TASK
1266 ( P_RESOURCE_ID       IN NUMBER,
1267   P_LANGUAGE          IN VARCHAR2,
1268   P_SOURCE_LANG       IN VARCHAR2,
1269   P_ACTION_KEY        IN VARCHAR2,
1270   P_ACTION_INPUT_DATA IN SYSTEM.ACTION_INPUT_DATA_NST,
1271   X_UWQ_ACTION_LIST   OUT NOCOPY SYSTEM.IEU_UWQ_WORK_ACTIONS_NST,
1272   X_MSG_COUNT         OUT NOCOPY NUMBER,
1273   X_MSG_DATA          OUT NOCOPY VARCHAR2,
1274   X_RETURN_STATUS     OUT NOCOPY VARCHAR2
1275 )
1276 IS
1277 BEGIN
1278   IEU_WPACTIONS_PVT.WP_TASK(P_RESOURCE_ID,
1279 			P_LANGUAGE   ,
1280 			P_SOURCE_LANG,
1281 			P_ACTION_KEY ,
1282 			P_ACTION_INPUT_DATA ,
1283 			'TRANSFER_TASK_OWNER_TASK',
1284 			X_UWQ_ACTION_LIST  ,
1285 			X_MSG_COUNT        ,
1286 			X_MSG_DATA         ,
1287 			X_RETURN_STATUS);
1288 
1289 END TRANSFER_TASK_OWNER_TASK; -- PROCEDURE TRANSFER_TASK_OWNER_TASK
1290 
1291 end IEU_WPACTIONS_PVT;