DBA Data[Home] [Help]

PACKAGE BODY: APPS.CS_SR_LOG_PKG

Source


1 PACKAGE BODY  CS_SR_LOG_PKG AS
2 /* $Header: csvsrlgb.pls 115.2 2000/03/01 11:19:11 pkm ship      $ */
3 -- Start of Comments
4 -- Package name     :CS_SR_LOG_PKG
5 -- Purpose          :package has function SR_LOG that returns the log field
6 --                   for a given SR ( incident_id) for fulfillment report
7 -- History          :
8 -- NOTE             :
9 -- End of Comments
10 
11 --CREATE OR REPLACE PACKAGE BODY CS_SR_LOG_FUL IS
12 
13 FUNCTION SR_LOG (p_incident_id varchar2,
14 		  p_public_notes_only varchar2 DEFAULT 'Y',
15 		  p_order_by varchar2 DEFAULT 'Y')
16 		  Return varchar2 is
17 
18   Cursor C1 (c_public_notes_only varchar2) IS
19   select *
20   from cs_incidents_diary_v
21   where incident_id = p_incident_id
22   and ( note_status is null or
23 	   note_status <> decode(c_public_notes_only,'Y','P') or
24 	   note_status = decode(c_public_notes_only,'N',note_status,
25 						'Y','P',note_status))
26   order by last_update_date DESC;
27 
31   where incident_id = p_incident_id
28   Cursor C2(c_public_notes_only varchar2)  IS
29   select *
30   from cs_incidents_diary_v
32   and ( note_status is null or
33 	   note_status <> decode(c_public_notes_only,'Y','P',note_status) or
34 	   note_status = decode(c_public_notes_only,'N',note_status,
35 						'Y','P',note_status))
36   order by last_update_date ;
37 
38   Cursor c1log is
39   select meaning
40   from cs_lookups
41   where lookup_type = 'CS_LOG_PARAMETERS'
42   and   lookup_code = 'LOG_AUDIT'
43   and   enabled_flag = 'Y'
44   and   sysdate between NVL(start_date_active,sysdate) and
45 				    NVL(end_date_active,sysdate);
46 
47   Cursor c2log is
48   select meaning
49   from cs_lookups
50   where lookup_type = 'CS_LOG_PARAMETERS'
51   and   lookup_code = 'LOG_NOTES'
52   and   enabled_flag = 'Y'
53   and   sysdate between NVL(start_date_active,sysdate) and
54 				    NVL(end_date_active,sysdate);
55 
56   Cursor c3log is
57   select meaning
58   from cs_lookups
59   where lookup_type = 'CS_LOG_PARAMETERS'
60   and   lookup_code = 'LOG_TASKS'
61   and   enabled_flag = 'Y'
62   and   sysdate between NVL(start_date_active,sysdate) and
63 				    NVL(end_date_active,sysdate);
64 
65 
66   ls_concat_field varchar2(32000);
67   ls_source_type  varchar2(30);
68   ls_source_type_tr  varchar2(30);
69   ls_main_field   varchar2(32000);
70   ls_head_field   varchar2(32000);
71 
72   ls_audit_details varchar2(32000);
73 
74   ls_summary varchar2(32000);
75   ls_public_notes_only varchar2(1);
76 
77   l_audit VARCHAR2(30);
78   l_tasks VARCHAR2(30);
79   l_notes VARCHAR2(30);
80 
81 BEGIN
82 
83 
84   OPEN c1log;
85   fetch c1log into l_audit;
86   CLOSE c1log;
87 
88   OPEN c2log;
89   fetch c2log into l_notes;
90   CLOSE c2log;
91 
92   OPEN c3log;
93   fetch c3log into l_tasks;
94   CLOSE c3log;
95 
96   if NVL(p_public_notes_only,'N')  = 'N' then
97 	   ls_public_notes_only :=  'N';
98   elsif p_public_notes_only = 'Y' then
99 	   ls_public_notes_only := 'P';
100   else
101 	   ls_public_notes_only := 'N';
102   end if;
103 
104   if (p_order_by = 'Y') then
105    for i in c1(ls_public_notes_only)
106 
107    loop
108 
109 	if upper(i.source_type) = 'AUDIT' then
110 	   ls_source_type_tr := l_audit;
111 	elsif upper(i.source_type) = 'TASKS' then
112 	   ls_source_type_tr := l_tasks;
113 	elsif upper(i.source_type) = 'NOTES' then
114 	   ls_source_type_tr := l_notes;
115      end if;
116 
117      If upper(i.source_type) = 'AUDIT' And
118         (i.severity_old IS NOT NULL or
119          i.severity_new is NOT NULL or
120          i.type_old IS NOT NULL     or
121          i.type_new IS NOT NULL     or
122          i.status_old IS NOT NULL   or
123          i.status_new IS NOT NULL   or
124          i.urgency_new IS NOT NULL  or
125          i.urgency_old IS NOT NULL  or
126          i.group_new IS NOT NULL    or
127          i.group_old IS NOT NULL    or
128          i.owner_new IS NOT NULL    or
129          i.owner_old IS NOT NULL    or
130          i.date_new IS NOT NULL  or
131          i.date_old IS NOT NULL  or
132 	    i.obligation_date_new IS NOT NULL or
133 	    i.obligation_date_old IS NOT NULL or
134 	    i.site_id_new IS NOT NULL or
135 	    i.site_id_old IS NOT NULL or
136 	    i.old_bill_to_contact_name IS NOT NULL or
137 	    i.new_bill_to_contact_name IS NOT NULL or
138 	    i.old_ship_to_contact_name IS NOT NULL or
139 	    i.new_ship_to_contact_name IS NOT NULL or
140 	    i.old_platform_name IS NOT NULL or
141 	    i.new_platform_name IS NOT NULL or
142 	    i.old_platform_version_name IS NOT NULL or
143 	    i.new_platform_version_name IS NOT NULL or
144 	    i.old_description IS NOT NULL or
145 	    i.new_description IS NOT NULL or
146 	    i.old_language IS NOT NULL or
147 	    i.new_language IS NOT NULL
148         ) Then
149        CS_SR_LOG_PKG.audit_display(i.source_type ,
150                                     i.last_update_date ,
151                                     i.owner,
152                                     i.old_severity_name,
153 			                     i.new_severity_name ,
154 			                     i.old_type_name     ,
155 			                     i.new_type_name     ,
156 			                     i.old_status_name   ,
157                    	                i.new_status_name   ,
158                    	                i.old_urgency_name  ,
159                   	                i.new_urgency_name ,
160                    	                i.group_old   ,
161                    	                i.group_new  ,
162 			                     i.old_owner,
163 			                     i.new_owner,
164                    	                i.date_old  ,
165                    	                i.date_new   ,
166 							    i.obligation_date_new ,
167 	    						i.obligation_date_old,
168 	    						i.site_id_new ,
169 	    						i.site_id_old,
170 	    						i.old_bill_to_contact_name,
171 	    						i.new_bill_to_contact_name,
172 	    						i.old_ship_to_contact_name,
173 	    						i.new_ship_to_contact_name,
174 	    						i.old_platform_name ,
175 	    						i.new_platform_name,
176 	    						i.old_platform_version_name ,
177 	    						i.new_platform_version_name ,
178 	    						i.old_description ,
179 	    						i.new_description,
180 	    						i.old_language ,
181 	    						i.new_language,
185          ls_concat_field := ls_concat_field||ls_main_field||gs_newline;
182 			                     ls_audit_details );
183          ls_main_field := ls_audit_details;
184 
186          --ls_concat_field := ls_concat_field||ls_main_field||CHR(10);
187 
188      Elsif upper(i.source_type) <> 'AUDIT' Then
189 
190          ls_main_field := rpad(to_char(i.last_update_date,'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
191 					 rpad(i.owner,20,' ')||'  '||
192                           rpad(ls_source_type_tr,20,' ')||gs_newline||i.details;
193 
194          if upper(i.source_type) = 'TASKS' then
195 
196             CS_SR_LOG_PKG.task_notes(i.action_id,ls_audit_details);
197             ls_main_field := ls_main_field||gs_newline||ls_audit_details;
198          end if;
199 
200      ls_concat_field := ls_concat_field||ls_main_field||gs_newline;
201 
202      End If;
203 
204    end loop;
205 
206 
207    else
208 
209 
210    for i in c2(ls_public_notes_only)
211 
212    loop
213 
214 	if upper(i.source_type) = 'AUDIT' then
215 	   ls_source_type_tr := l_audit;
216 	elsif upper(i.source_type) = 'TASKS' then
217 	   ls_source_type_tr := l_tasks;
218 	elsif upper(i.source_type) = 'NOTES' then
219 	   ls_source_type_tr := l_notes;
220      end if;
221 
222      If upper(i.source_type) = 'AUDIT' And
223         (i.severity_old IS NOT NULL or
224          i.severity_new is NOT NULL or
225          i.type_old IS NOT NULL     or
226          i.type_new IS NOT NULL     or
227          i.status_old IS NOT NULL   or
228          i.status_new IS NOT NULL   or
229          i.urgency_new IS NOT NULL  or
230          i.urgency_old IS NOT NULL  or
231          i.group_new IS NOT NULL    or
232          i.group_old IS NOT NULL    or
233          i.owner_new IS NOT NULL    or
234          i.owner_old IS NOT NULL    or
235          i.date_new IS NOT NULL  or
236          i.date_old IS NOT NULL  or
237 	    i.obligation_date_new IS NOT NULL or
238 	    i.obligation_date_old IS NOT NULL or
239 	    i.site_id_new IS NOT NULL or
240 	    i.site_id_old IS NOT NULL or
241 	    i.old_bill_to_contact_name IS NOT NULL or
242 	    i.new_bill_to_contact_name IS NOT NULL or
243 	    i.old_ship_to_contact_name IS NOT NULL or
244 	    i.new_ship_to_contact_name IS NOT NULL or
245 	    i.old_platform_name IS NOT NULL or
246 	    i.new_platform_name IS NOT NULL or
247 	    i.old_platform_version_name IS NOT NULL or
248 	    i.new_platform_version_name IS NOT NULL or
249 	    i.old_description IS NOT NULL or
250 	    i.new_description IS NOT NULL or
251 	    i.old_language IS NOT NULL or
252 	    i.new_language IS NOT NULL
253         ) Then
254        CS_SR_LOG_PKG.audit_display(i.source_type ,
255                                     i.last_update_date ,
256                                     i.owner,
257                                     i.old_severity_name,
258 			                     i.new_severity_name ,
259 			                     i.old_type_name     ,
260 			                     i.new_type_name     ,
261 			                     i.old_status_name   ,
262                    	                i.new_status_name   ,
263                    	                i.old_urgency_name  ,
264                   	                i.new_urgency_name ,
265                    	                i.group_old   ,
266                    	                i.group_new  ,
267 			                     i.old_owner,
268 			                     i.new_owner,
269                    	                i.date_old  ,
270                    	                i.date_new   ,
271 							    i.obligation_date_new ,
272 	    						i.obligation_date_old,
273 	    						i.site_id_new ,
274 	    						i.site_id_old,
275 	    						i.old_bill_to_contact_name,
276 	    						i.new_bill_to_contact_name,
277 	    						i.old_ship_to_contact_name,
278 	    						i.new_ship_to_contact_name,
279 	    						i.old_platform_name ,
280 	    						i.new_platform_name,
281 	    						i.old_platform_version_name ,
282 	    						i.new_platform_version_name ,
283 	    						i.old_description ,
284 	    						i.new_description,
285 	    						i.old_language ,
286 	    						i.new_language,
287 			                     ls_audit_details );
288          ls_main_field := ls_audit_details;
289 
290          ls_concat_field := ls_concat_field||ls_main_field||gs_newline;
291          --ls_concat_field := ls_concat_field||ls_main_field||CHR(10);
292 
293      Elsif upper(i.source_type) <> 'AUDIT' Then
294 
295          ls_main_field := rpad(to_char(i.last_update_date,'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
296 					 rpad(i.owner,20,' ')||'  '||
297                           rpad(ls_source_type_tr,20,' ')||gs_newline||i.details;
298 
299          if upper(i.source_type) = 'TASKS' then
300 
301             CS_SR_LOG_PKG.task_notes(i.action_id,ls_audit_details);
302             ls_main_field := ls_main_field||gs_newline||ls_audit_details;
303          end if;
304 
305      ls_concat_field := ls_concat_field||ls_main_field||gs_newline;
306 
307      End If;
308 
309    end loop;
310 
311    end if;
312 
313 return SUBSTR(ls_concat_field,1,32000);
314 
315 Exception
316    When Value_Error Then
317 return SUBSTR(ls_concat_field,1,32000);
318 
319    When Others Then
320        return null;
321 END SR_LOG;
322 
323 PROCEDURE audit_display(x_source_type varchar2,
324                         x_last_update_date date,
325                         x_owner        varchar2,
326                         x_severity_old varchar2,
327 	                   x_severity_new varchar2,
328 			         x_type_old     varchar2,
329 			         x_type_new     varchar2,
333                         x_urgency_new  varchar2,
330 			         x_status_old   varchar2,
331                    	    x_status_new   varchar2,
332                    	    x_urgency_old  varchar2,
334                   	    x_group_old    varchar2,
335                    	    x_group_new    varchar2,
336                    	    x_owner_old    varchar2,
337                    	    x_owner_new    varchar2,
338                    	    x_date_old     varchar2,
339                    	    x_date_new     varchar2,
340 							    x_obligation_date_new   varchar2 ,
341 	    						x_obligation_date_old  varchar2 ,
342 	    						x_site_id_new   varchar2 ,
343 	    						x_site_id_old  varchar2 ,
344 	    						x_old_bill_to_contact_name  varchar2 ,
345 	    						x_new_bill_to_contact_name  varchar2 ,
346 	    						x_old_ship_to_contact_name  varchar2 ,
347 	    						x_new_ship_to_contact_name  varchar2 ,
348 	    						x_old_platform_name   varchar2 ,
349 	    						x_new_platform_name  varchar2 ,
350 	    						x_old_platform_version_name   varchar2 ,
351 	    						x_new_platform_version_name   varchar2 ,
352 	    						x_old_description   varchar2 ,
353 	    						x_new_description  varchar2 ,
354 	    						x_old_language   varchar2 ,
355 	    						x_new_language  varchar2 ,
356 			         x_details OUT VARCHAR2)
357 Is
358 
359   ls_details VARCHAR2(32767);
360 
361   Cursor c_status is
362   select meaning
363   from cs_lookups
364   where lookup_type = 'CS_LOG_PARAMETERS'
365   and   lookup_code = 'LOG_STATUS'
366   and   enabled_flag = 'Y'
367   and   sysdate between NVL(start_date_active,sysdate) and
368 				    NVL(end_date_active,sysdate);
369 
370   Cursor c_urgency is
371   select meaning
372   from cs_lookups
373   where lookup_type = 'CS_LOG_PARAMETERS'
374   and   lookup_code = 'LOG_URGENCY'
375   and   enabled_flag = 'Y'
376   and   sysdate between NVL(start_date_active,sysdate) and
377 				    NVL(end_date_active,sysdate);
378 
379 
380   Cursor c_severity is
381   select meaning
382   from cs_lookups
383   where lookup_type = 'CS_LOG_PARAMETERS'
384   and   lookup_code = 'LOG_SEVERITY'
385   and   enabled_flag = 'Y'
386   and   sysdate between NVL(start_date_active,sysdate) and
387 				    NVL(end_date_active,sysdate);
388 
389   Cursor c_date is
390   select meaning
391   from cs_lookups
392   where lookup_type = 'CS_LOG_PARAMETERS'
393   and   lookup_code = 'LOG_DATE'
394   and   enabled_flag = 'Y'
395   and   sysdate between NVL(start_date_active,sysdate) and
396 				    NVL(end_date_active,sysdate);
397 
398   Cursor c_obligation_date is
399   select meaning
400   from cs_lookups
401   where lookup_type = 'CS_LOG_PARAMETERS'
402   and   lookup_code = 'LOG_OBLIGATION_DATE'
403   and   enabled_flag = 'Y'
404   and   sysdate between NVL(start_date_active,sysdate) and
405 				    NVL(end_date_active,sysdate);
406 
407   Cursor c_owner is
408   select meaning
409   from cs_lookups
410   where lookup_type = 'CS_LOG_PARAMETERS'
411   and   lookup_code = 'LOG_OWNER'
412   and   enabled_flag = 'Y'
413   and   sysdate between NVL(start_date_active,sysdate) and
414 				    NVL(end_date_active,sysdate);
415 
416   Cursor c_bill_to_contact_name is
417   select meaning
418   from cs_lookups
419   where lookup_type = 'CS_LOG_PARAMETERS'
420   and   lookup_code = 'LOG_BILL_TO_CONTACT_NAME'
421   and   enabled_flag = 'Y'
422   and   sysdate between NVL(start_date_active,sysdate) and
423 				    NVL(end_date_active,sysdate);
424 
425   Cursor c_ship_to_contact_name is
426   select meaning
427   from cs_lookups
428   where lookup_type = 'CS_LOG_PARAMETERS'
429   and   lookup_code = 'LOG_SHIP_TO_CONTACT_NAME'
430   and   enabled_flag = 'Y'
431   and   sysdate between NVL(start_date_active,sysdate) and
432 				    NVL(end_date_active,sysdate);
433 
434   Cursor c_product is
435   select meaning
436   from cs_lookups
437   where lookup_type = 'CS_LOG_PARAMETERS'
438   and   lookup_code = 'LOG_PRODUCT'
439   and   enabled_flag = 'Y'
440   and   sysdate between NVL(start_date_active,sysdate) and
441 				    NVL(end_date_active,sysdate);
442 
443   Cursor c_type is
444   select meaning
445   from cs_lookups
446   where lookup_type = 'CS_LOG_PARAMETERS'
447   and   lookup_code = 'LOG_TYPE'
448   and   enabled_flag = 'Y'
449   and   sysdate between NVL(start_date_active,sysdate) and
450 				    NVL(end_date_active,sysdate);
451 
452   Cursor c_group is
453   select meaning
454   from cs_lookups
455   where lookup_type = 'CS_LOG_PARAMETERS'
456   and   lookup_code = 'LOG_GROUP'
457   and   enabled_flag = 'Y'
458   and   sysdate between NVL(start_date_active,sysdate) and
459 				    NVL(end_date_active,sysdate);
460 
461   Cursor c_language is
462   select meaning
463   from cs_lookups
464   where lookup_type = 'CS_LOG_PARAMETERS'
465   and   lookup_code = 'LOG_LANGUAGE'
466   and   enabled_flag = 'Y'
467   and   sysdate between NVL(start_date_active,sysdate) and
468 				    NVL(end_date_active,sysdate);
469 
470   Cursor c_platform is
471   select meaning
472   from cs_lookups
473   where lookup_type = 'CS_LOG_PARAMETERS'
474   and   lookup_code = 'LOG_PLATFORM'
475   and   enabled_flag = 'Y'
476   and   sysdate between NVL(start_date_active,sysdate) and
477 				    NVL(end_date_active,sysdate);
478 
479   Cursor c_platform_version is
480   select meaning
481   from cs_lookups
482   where lookup_type = 'CS_LOG_PARAMETERS'
483   and   lookup_code = 'LOG_PLATFORM_VERSION'
484   and   enabled_flag = 'Y'
485   and   sysdate between NVL(start_date_active,sysdate) and
489   select meaning
486 				    NVL(end_date_active,sysdate);
487 
488   Cursor c_site is
490   from cs_lookups
491   where lookup_type = 'CS_LOG_PARAMETERS'
492   and   lookup_code = 'LOG_SITE'
493   and   enabled_flag = 'Y'
494   and   sysdate between NVL(start_date_active,sysdate) and
495 				    NVL(end_date_active,sysdate);
496 
497   lrec cs_incidents_diary_v%rowtype;
498 
499 l_status VARCHAR2(240);
500 l_urgency VARCHAR2(240);
501 l_severity VARCHAR2(240);
502 l_date VARCHAR2(240);
503 l_obligation_date VARCHAR2(240);
504 l_owner VARCHAR2(240);
505 l_bill_to_contact_name VARCHAR2(240);
506 l_ship_to_contact_name VARCHAR2(240);
507 l_product VARCHAR2(240);
508 l_type VARCHAR2(240);
509 l_group VARCHAR2(240);
510 l_site VARCHAR2(240);
511 l_platform VARCHAR2(240);
512 l_platform_version VARCHAR2(240);
513 l_language VARCHAR2(240);
514 
515  Begin
516 
517 OPEN c_status;
518 FETCH c_status INTO l_status;
519 CLOSE c_status;
520 
521 OPEN c_urgency;
522 FETCH c_urgency INTO l_urgency;
523 CLOSE c_urgency;
524 
525 OPEN c_severity;
526 FETCH c_severity INTO l_severity;
527 CLOSE c_severity;
528 
529 OPEN c_date;
530 FETCH c_date INTO l_date;
531 CLOSE c_date;
532 
533 OPEN c_obligation_date;
534 FETCH c_obligation_date INTO l_obligation_date;
535 CLOSE c_obligation_date;
536 
537 OPEN c_owner;
538 FETCH c_owner INTO l_owner;
539 CLOSE c_owner;
540 
541 OPEN c_bill_to_contact_name;
542 FETCH c_bill_to_contact_name INTO l_bill_to_contact_name;
543 CLOSE c_bill_to_contact_name;
544 
545 OPEN c_ship_to_contact_name;
546 FETCH c_ship_to_contact_name INTO l_ship_to_contact_name;
547 CLOSE c_ship_to_contact_name;
548 
549 OPEN c_product;
550 FETCH c_product INTO l_product;
551 CLOSE c_product;
552 
553 OPEN c_type;
554 FETCH c_type INTO l_type;
555 CLOSE c_type;
556 
557 OPEN c_group;
558 FETCH c_group INTO l_group;
559 CLOSE c_group;
560 
561 OPEN c_site;
562 FETCH c_site INTO l_site;
563 CLOSE c_site;
564 
565 OPEN c_language;
566 FETCH c_language INTO l_language;
567 CLOSE c_language;
568 
569 OPEN c_platform;
570 FETCH c_platform INTO l_platform;
571 CLOSE c_platform;
572 
573 OPEN c_platform_version;
574 FETCH c_platform_version INTO l_platform_version;
575 CLOSE c_platform_version;
576 
577 
578  If X_severity_old is not null or x_severity_new is not null then
579     ls_details := ls_details||
580 			      rpad(to_char(X_last_update_date,
581 				 'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
582 				 rpad(X_owner,20,' ')||'  '||
583 				 rpad(l_severity||':',20,' ')||'  '||
584                   rpad(NVL(X_severity_old,' '),20,' ')||' -> '||
585 				 rpad(NVL(X_severity_new,' '),20,' ')||gs_newline;
586  End If;
587 
588  If X_status_old is not null or x_status_new is not null then
589     ls_details := ls_details||
590 			      rpad(to_char(X_last_update_date,
591 				 'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
592 				 rpad(X_owner,20,' ')||'  '||
593 				 rpad(l_status||':',20,' ')||'  '||
594                   rpad(NVL(X_status_old,' '),20,' ')||' -> '||
595 				 rpad(NVL(X_status_new,' '),20,' ')||gs_newline;
596  End If;
597 
598  If X_type_old is not null or x_type_new is not null then
599     ls_details := ls_details||
600 			      rpad(to_char(X_last_update_date,
601 				 'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
602 				 rpad(X_owner,20,' ')||'  '||
603 				 rpad(l_type||':',20,' ')||'  '||
604                   rpad(NVL(X_type_old,' '),20,' ')||' -> '||
605 				 rpad(NVL(X_type_new,' '),20,' ')||gs_newline;
606  End If;
607 
608  If X_urgency_old is not null or x_urgency_new is not null then
609     ls_details := ls_details||
610 			       rpad(to_char(X_last_update_date,
611 				  'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
612 				  rpad(X_owner,20,' ')||'  '||
613 				  rpad(l_urgency||':',20,' ')||'  '||
614                    rpad(NVL(X_urgency_old,' '),20,' ')||' -> '||
615 				  rpad(NVL(X_urgency_new,' '),20,' ')||gs_newline;
616  End If;
617 
618  If x_group_old is not null or x_group_new is not null then
619     ls_details := ls_details||
620 			      rpad(to_char(X_last_update_date,
621 				 'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
622 				 rpad(X_owner,20,' ')||'  '||
623 				 rpad(l_group||':',25,' ')||'  '||
624 				 rpad(NVL(X_Group_old,' '),20,' ')||' -> '||
625 				 rpad(NVL(X_Group_new,' '),20,' ')||gs_newline;
626  End if;
627 
628  If x_owner_old is not null or x_owner_new is not null then
629     ls_details := ls_details||
630 			   rpad(to_char(X_last_update_date,
631 			   'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
632 			   rpad(X_owner,20,' ')||'  '||
633 			   rpad(l_owner||':',25,' ')||'  '||
634                rpad(NVL(X_owner_old,' '),20,' ')||' -> '||
635 			   rpad(NVL(X_owner_new,' '),20,' ')||gs_newline;
636  End If;
637 
638  If x_date_old is not null or x_date_new is not null then
639      ls_details := ls_details||
640 				  rpad(to_char(X_last_update_date,
641 				  'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
642 				  rpad(X_owner,20,' ')||'  '||
643 				  rpad(l_date||':',25,' ')||'  '||
644                    rpad(NVL(X_Date_old,' '),20,' ')||' -> '||
645 				  rpad(NVL(X_Date_new,' '),20,' ')||gs_newline;
646  End If;
647 
648 
649  If x_obligation_date_old is not null or x_obligation_date_new is not null then
650      ls_details := ls_details||
651 			    rpad(to_char(X_last_update_date,
652 			    'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
653 			    rpad(X_owner,20,' ')||'  '||
654 			    rpad(l_obligation_date||
655 			    ':',25,' ')||'  '||
656                    rpad(NVL(X_obligation_Date_old,' '),20,' ')||' -> '||
657 			    rpad(NVL(X_obligation_Date_new,' '),20,' ')||gs_newline;
658  End If;
659 
660  If x_site_id_old is not null or x_site_id_old is not null then
661      ls_details := ls_details||
662 			    rpad(to_char(X_last_update_date,
663 			    'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
664 			    rpad(X_owner,20,' ')||'  '||
665 			    rpad(l_site||
666 			    ':',25,' ')||'  '||
667                    rpad(NVL(X_site_id_old,' '),20,' ')||' -> '||
668 			    rpad(NVL(X_site_id_old,' '),20,' ')||gs_newline;
669  End If;
670 
671  If x_old_bill_to_contact_name is not null or
672     x_new_bill_to_contact_name is not null then
673      ls_details := ls_details||
674 			    rpad(to_char(X_last_update_date,
675 			    'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
676 			    rpad(X_owner,20,' ')||'  '||
677 			    rpad(l_bill_to_contact_name||
678 			    ':',25,' ')||'  '||
679                 rpad(NVL(X_old_bill_to_contact_name,' '),20,' ')||' -> '||
680 			    rpad(NVL(X_new_bill_to_contact_name,' '),20,' ')||
681 			    gs_newline;
682  End If;
683 
684 
685  If x_old_ship_to_contact_name is not null or
686     x_old_ship_to_contact_name is not null then
687      ls_details := ls_details||
688 			    rpad(to_char(X_last_update_date,
689 			    'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
690 			    rpad(X_owner,20,' ')||'  '||
691 			    rpad(l_ship_to_contact_name||
692 			    ':',25,' ')||'  '||
693                    rpad(NVL(X_old_ship_to_contact_name,' '),20,' ')||' -> '||
694 			    rpad(NVL(X_new_ship_to_contact_name,' '),20,' ')||
695 			    gs_newline;
696  End If;
697 
698  If x_old_platform_name is not null or
699     x_new_platform_name is not null then
700      ls_details := ls_details||
701 			    rpad(to_char(X_last_update_date,
702 			    'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
703 			    rpad(X_owner,20,' ')||'  '||
704 			    rpad(l_platform||
705 			    ':',25,' ')||'  '||
706                 rpad(NVL(X_old_platform_name,' '),20,' ')||' -> '||
707 			    rpad(NVL(X_new_platform_name,' '),20,' ')||gs_newline;
708  End If;
709 
710  If x_old_platform_version_name is not null or
711     x_new_platform_version_name is not null then
712      ls_details := ls_details||
713 			    rpad(to_char(X_last_update_date,
714 			    'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
715 			    rpad(X_owner,20,' ')||'  '||
716 			    rpad(l_platform_version||
717 			    ':',25,' ')||'  '||
718                    rpad(NVL(X_old_platform_version_name,' '),20,' ')||' -> '||
719 			    rpad(NVL(X_new_platform_version_name,' '),20,' ')||
720 			    gs_newline;
721  End If;
722 
723 
724  If x_old_description is not null or
725     x_new_description is not null then
726      ls_details := ls_details||
727 			    rpad(to_char(X_last_update_date,
728 			    'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
729 			    rpad(X_owner,20,' ')||'  '||
730 			    rpad(l_product||
731 			    ':',25,' ')||'  '||
732                    rpad(NVL(X_old_description,' '),20,' ')||' -> '||
733 			    rpad(NVL(X_new_description,' '),20,' ')||
734 			    gs_newline;
735  End If;
736 
737  If x_old_language is not null or
738     x_new_language is not null then
739      ls_details := ls_details||
740 			    rpad(to_char(X_last_update_date,
741 			    'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||
742 			    rpad(X_owner,20,' ')||'  '||
743 			    rpad(l_language||
744 			    ':',25,' ')||'  '||
745                    rpad(NVL(X_old_language,' '),20,' ')||' -> '||
746 			    rpad(NVL(X_new_language,' '),20,' ')||
747 			    gs_newline;
748  End If;
749 
750   X_details := ls_details;
751 Exception
752  When Value_Error Then
753    X_details := SUBSTR(ls_details,1,32000);
754 END audit_display;
755 
756 PROCEDURE TASK_NOTES ( X_TASK_ID NUMBER,
757                        X_DETAILS OUT VARCHAR2) IS
758 
759 CURSOR CUR_NOTES IS
760 SELECT last_update_date,notes,entered_by_name owner
761 FROM   jtf_notes_vl
762 WHERE  source_object_id = X_TASK_ID
763 AND    source_object_code = 'TASK'
764 ORDER BY 1;
765 
766   Cursor c2log is
767   select meaning
768   from cs_lookups
769   where lookup_type = 'CS_LOG_PARAMETERS'
770   and   lookup_code = 'LOG_NOTES'
771   and   enabled_flag = 'Y'
772   and   sysdate between NVL(start_date_active,sysdate) and
773 				    NVL(end_date_active,sysdate);
774 
775 ls_details_ind VARCHAR2(32000);
776 ls_details     VARCHAR2(32000);
777 ls_heading     VARCHAR2(1000);
778 
779 
780 l_notes VARCHAR2(240);
781 BEGIN
782 
783 OPEN c2log;
784 FETCH c2log into l_notes;
785 CLOSE c2log;
786 
787 
788   for i in cur_notes
789 
790     Loop
791 
792       ls_details_ind := rpad(to_char(i.last_update_date,'MM/DD/YYYY HH:MI:SS'),20,' ')||'  '||rpad(i.owner,20,' ')||'  '||rpad(l_notes,20,' ')||gs_newline||i.notes||gs_newline;
793        ls_details := ls_details||ls_details_ind;
794      End Loop;
795 
796 X_details := ls_heading||ls_details;
797 
798 
799 END task_notes;
800 END cs_sr_log_pkg;