[Home] [Help]
PACKAGE BODY: APPS.PA_CI_IMPACTS_UTIL
Source
1 PACKAGE BODY Pa_ci_impacts_util AS
2 /* $Header: PACIIPUB.pls 120.5.12020000.2 2012/07/19 09:30:33 admarath ship $ */
3
4 function is_any_impact_implemented (
5 p_ci_id IN NUMBER := null
6 ) RETURN boolean
7 IS
8 l_temp VARCHAR2(1);
9
10
11 BEGIN
12 SELECT 'X'
13 INTO l_temp from dual
14 WHERE exists(
15 SELECT ci_impact_id
16 FROM pa_ci_impacts
17 WHERE ci_id = p_ci_id
18 AND (implementation_date IS NOT NULL
19 OR implemented_by IS NOT NULL));
20
21 RETURN TRUE;
22 EXCEPTION
23 WHEN NO_DATA_FOUND THEN
24 RETURN FALSE;
25
26 END is_any_impact_implemented;
27
28
29 function is_render_true (
30 impact_type_code IN VARCHAR2,
31 project_id IN NUMBER := null
32 ) RETURN varchar2
33 IS
34 l_ret VARCHAR2(1) := 'Y';
35
36 BEGIN
37
38 IF impact_type_code = 'FINPLAN' THEN
39 l_ret:= pa_fp_control_items_utils.Is_Financial_Planning_Allowed(project_id);
40
41 END IF;
42
43 RETURN l_ret;
44
45 EXCEPTION
46 WHEN NO_DATA_FOUND THEN
47 RETURN 'N';
48
49 END ;
50
51
52 function is_impact_implemented (
53 p_ci_id IN NUMBER ,
54 p_impact_type_code IN VARCHAR2
55 ) RETURN boolean
56 IS
57 l_temp VARCHAR2(1);
58
59
60 BEGIN
61 SELECT 'X'
62 INTO l_temp from dual
63 WHERE exists(
64 SELECT ci_impact_id
65 FROM pa_ci_impacts
66 WHERE ci_id = p_ci_id
67 AND (implementation_date IS NOT NULL
68 OR implemented_by IS NOT NULL)
69 AND impact_type_code = p_impact_type_code);
70
71 RETURN TRUE;
72 EXCEPTION
73 WHEN NO_DATA_FOUND THEN
74 RETURN FALSE;
75
76 END is_impact_implemented;
77
78 function is_impact_exist (
79 p_ci_id IN NUMBER ,
80 p_impact_type_code IN VARCHAR2
81 ) RETURN boolean
82 IS
83 l_temp VARCHAR2(1);
84
85
86 BEGIN
87 SELECT 'X'
88 INTO l_temp from dual
89 WHERE exists(
90 SELECT ci_impact_id
91 FROM pa_ci_impacts
92 WHERE ci_id = p_ci_id
93 AND impact_type_code = p_impact_type_code);
94
95 RETURN TRUE;
96 EXCEPTION
97 WHEN NO_DATA_FOUND THEN
98 RETURN FALSE;
99
100 END is_impact_exist;
101
102 function is_all_impact_implemented (
103 p_ci_id IN NUMBER
104 ) RETURN boolean
105 IS
106 l_temp VARCHAR2(1);
107
108
109 BEGIN
110 SELECT 'X'
111 INTO l_temp from dual
112 WHERE exists(
113 SELECT ci_impact_id
114 FROM pa_ci_impacts
115 WHERE ci_id = p_ci_id
116 AND (implementation_date IS NULL
117 OR implemented_by IS NULL)
118 AND impact_type_code <> 'FINPLAN' /* Bug 4153868 */
119 );
120
121 RETURN FALSE;
122 EXCEPTION
123 WHEN NO_DATA_FOUND THEN
124 RETURN TRUE;
125
126 END is_all_impact_implemented;
127
128
129
130 procedure delete_all_impacts
131 (
132 p_api_version IN NUMBER := 1.0,
133 p_init_msg_list IN VARCHAR2 := 'T',
134 p_commit IN VARCHAR2 := 'F',
135 p_validate_only IN VARCHAR2 := 'T',
136 p_max_msg_count IN NUMBER := null,
137
138 p_ci_id IN NUMBER,
139 x_return_status OUT NOCOPY VARCHAR2,
140 x_msg_count OUT NOCOPY NUMBER,
141 x_msg_data OUT NOCOPY VARCHAR2
142 )
143 IS
144 BEGIN
145 -- Initialize the Error Stack
146 PA_DEBUG.init_err_stack('Pa_ci_impacts_util.delete_all_impacts');
147
148 -- Initialize the return status to success
149 x_return_status := FND_API.G_RET_STS_SUCCESS;
150
151 --Clear the global PL/SQL message table
152 IF FND_API.TO_BOOLEAN( p_init_msg_list ) THEN
153 FND_MSG_PUB.initialize;
154 END IF;
155
156 IF (p_validate_only = 'F') THEN
157 DELETE FROM pa_ci_impacts
158 WHERE ci_id = p_ci_id;
159 END IF;
160
161 -- Commit if the flag is set and there is no error
162 IF (p_commit = 'T' AND x_return_status = FND_API.G_RET_STS_SUCCESS ) THEN
163 COMMIT;
164 END IF;
165
166 -- Reset the error stack when returning to the calling program
167 PA_DEBUG.Reset_Err_Stack;
168
169
170 END delete_all_impacts;
171
172 procedure copy_impact
173 (
174 p_api_version IN NUMBER := 1.0,
175 p_init_msg_list IN VARCHAR2 := 'T',
176 p_commit IN VARCHAR2 := 'F',
177 p_validate_only IN VARCHAR2 := 'T',
178 p_max_msg_count IN NUMBER := null,
179
180 p_dest_ci_id IN NUMBER,
181 p_source_ci_id IN NUMBER,
182 p_include_flag IN VARCHAR2,
183 x_return_status OUT NOCOPY VARCHAR2,
184 x_msg_count OUT NOCOPY NUMBER,
185 x_msg_data OUT NOCOPY VARCHAR2
186 )
187 IS
188 l_impact_type_code VARCHAR2(30);
189 l_desp VARCHAR2(4000);
190 l_comment VARCHAR2(4000);
191 l_ci_impact_id NUMBER;
192 l_implementation_date DATE;
193 l_implemented_by NUMBER;
194 l_record_ver_number NUMBER;
195 l_temp VARCHAR2(1);
196 l_project_id pa_budget_versions.project_id%TYPE;
197 l_src_project_id pa_budget_versions.project_id%TYPE;
198
199 l_source PA_PLSQL_DATATYPES.idtabtyp;
200
201 -- get copy from CI impacts
202 -- Bug 3677924 Jul 07 2004 Raja
203 -- Modified the cursor such that finplan impact records are not selected
204 -- And also an impact record is selected only if destination ci type allows
205 -- the impact to be created
206 CURSOR get_include_impact_info
207 IS
208 SELECT sourceImpacts.*
209 FROM pa_ci_impacts sourceImpacts,
210 pa_control_items targetCi,
211 pa_ci_impact_type_usage targetUsage
212 WHERE sourceImpacts.ci_id = p_source_ci_id
213 AND sourceImpacts.impact_type_code NOT IN ('FINPLAN_COST','FINPLAN_REVENUE','FINPLAN')
214 AND targetCi.ci_id = p_dest_ci_id
215 AND targetCi.ci_type_id = targetUsage.ci_type_id
216 AND targetUsage.impact_type_code = sourceImpacts.impact_type_code;
217
218 -- Bug 9693010: to populate the source impacts for target
219 CURSOR get_impact_info
220 IS
221 SELECT sourceImpacts.*
222 FROM pa_ci_impacts sourceImpacts,
223 pa_control_items sourceCi,
224 pa_control_items targetCi
225 WHERE sourceImpacts.ci_id = p_source_ci_id
226 and sourceImpacts.impact_type_code in ('FINPLAN', 'FINPLAN_REVENUE')
227 and sourceImpacts.ci_id = sourceCi.ci_id
228 and targetCi.ci_id = p_dest_ci_id
229 and sourceCi.ci_type_id = targetCi.ci_type_id;
230
231 -- get the copy to CI impacts
232 CURSOR get_orig_info
233 is
234 SELECT ci_impact_id, description, implementation_comment,
235 implementation_date, implemented_by, record_version_number, impacted_task_id
236 FROM pa_ci_impacts
237 WHERE ci_id = p_dest_ci_id
238 AND impact_type_code = l_impact_type_code;
239
240 CURSOR is_ok_to_copy
241 IS
242 select 'N' from dual
243 where exists
244 (
245 select ci_impact_id from pa_ci_impacts pci
246 where pci.ci_id = p_source_ci_id
247 and pci.impact_type_code <> 'FINPLAN' /* Bug 3724520 */
248 and pci.impact_type_code <> 'SUPPLIER'
249 and not exists
250 (
251 select * from
252 pa_control_items pci2,
253 pa_ci_impact_type_usage pcit
254 where pci2.ci_type_id = pcit.ci_type_id
255 AND pci2.ci_id = p_dest_ci_id
256 and pcit.impact_type_code = pci.impact_type_code
257 )
258 );
259
260 CURSOR get_project_id is
261 select project_id from pa_control_items pci
262 where
263 pci.ci_id = p_dest_ci_id;
264
265 CURSOR get_src_project_id is
266 select project_id from pa_control_items pci
267 where
268 pci.ci_id = p_source_ci_id;
269
270 l_rowid VARCHAR(100);
271 l_new_ci_impact_id NUMBER;
272 l_task_id NUMBER;
273
274 -- talked to Selva, the warning flag is ignored for now
275 l_warning_flag VARCHAR2(20);
276
277 l_temp2 VARCHAR2(4000);
278 l_ret VARCHAR2(1) := 'Y';
279
280 BEGIN
281 -- Initialize the Error Stack
282 PA_DEBUG.init_err_stack('Pa_ci_impacts_util.copy_impact');
283
284 -- Initialize the return status to success
285 x_return_status := FND_API.G_RET_STS_SUCCESS;
286
287 --Clear the global PL/SQL message table
288 IF FND_API.TO_BOOLEAN( p_init_msg_list ) THEN
289 FND_MSG_PUB.initialize;
290 END IF;
291
292 IF p_include_flag = 'Y' THEN
293 -- in the case of including impact
294 -- we can not include the source impact if the it has
295 -- more impact type region
296 -- then the ones allowed in the dest impact
297 OPEN is_ok_to_copy;
298 FETCH is_ok_to_copy INTO l_temp;
299 IF is_ok_to_copy%found THEN
300 -- can not copy
301 PA_UTILS.Add_Message( p_app_short_name => 'PA'
302 ,p_msg_name => 'PA_CI_NO_IMP_INCLUDE_TYPE');
303
304 x_return_status := FND_API.G_RET_STS_ERROR;
305
306 CLOSE is_ok_to_copy;
307 RETURN;
308
309 END IF;
310 CLOSE is_ok_to_copy;
311 END IF;
312
313 IF (p_validate_only = 'F') THEN
314
315 -- copy and include financial impact
316 OPEN get_project_id;
317 FETCH get_project_id INTO l_project_id;
318 CLOSE get_project_id;
319
320 l_source.DELETE;
321 l_source(1) := p_source_ci_id;
322
323 OPEN get_src_project_id;
324 FETCH get_src_project_id INTO l_src_project_id;
325 CLOSE get_src_project_id;
326 -- Bug 13955691 added condition to check if the source and target projects
327 -- are same then copy the financial impact
328 IF l_project_id = l_src_project_id THEN
329 -- Bug 9693010: populate the target impact from source
330 -- to the target.
331 -- start of change.
332
333 FOR rec IN get_impact_info LOOP
334 l_impact_type_code := rec.impact_type_code;
335 OPEN get_orig_info;
336 FETCH get_orig_info INTO l_ci_impact_id, l_desp, l_comment,
337 l_implementation_date, l_implemented_by, l_record_ver_number, l_task_id;
338
339 IF get_orig_info%notfound THEN
340 -- insert a new record to the new impact
341 pa_ci_impacts_pkg.insert_row(
342 l_rowid,
343 l_new_ci_impact_id,
344 p_dest_ci_id,
345 rec.impact_type_code,
346 'CI_IMPACT_PENDING',
347 rec.description,
348 NULL,
349 NULL,
350 NULL,
351 rec.impacted_task_id,
352 sysdate,
353 fnd_global.user_id,
354 Sysdate,
355 fnd_global.user_id,
356 fnd_global.login_id
357 );
358 ELSE
359 l_temp2 := Substr(l_desp || ' ' || rec.description, 1, 4000);
360
361 -- update the existing one
362 pa_ci_impacts_pkg.update_row(
363 l_ci_impact_id,
364 p_dest_ci_id,
365 l_impact_type_code,
366 NULL,
367 l_temp2,
368 l_implementation_date,
369 l_implemented_by,
370 l_comment,
371 Nvl(l_task_id, rec.impacted_task_id),
372 sysdate,
373 fnd_global.user_id,
374 fnd_global.login_id,
375 l_record_ver_number
376 );
377 END IF;
378
379 CLOSE get_orig_info;
380 END loop;
381 -- end of changes for 9693010
382 END IF;
383
384
385 FOR rec IN get_include_impact_info LOOP
386 l_impact_type_code := rec.impact_type_code;
387 OPEN get_orig_info;
388 FETCH get_orig_info INTO l_ci_impact_id, l_desp, l_comment,
389 l_implementation_date, l_implemented_by, l_record_ver_number, l_task_id;
390
391 IF get_orig_info%notfound THEN
392 -- insert a new record to the new impact
393 pa_ci_impacts_pkg.insert_row(
394 l_rowid,
395 l_new_ci_impact_id,
396 p_dest_ci_id,
397 rec.impact_type_code,
398 'CI_IMPACT_PENDING',
399 rec.description,
400 NULL,
401 NULL,
402 NULL,
403 rec.impacted_task_id,
404 sysdate,
405 fnd_global.user_id,
406 Sysdate,
407 fnd_global.user_id,
408 fnd_global.login_id
409 );
410 ELSE
411 l_temp2 := Substr(l_desp || ' ' || rec.description, 1, 4000);
412
413 -- update the existing one
414 pa_ci_impacts_pkg.update_row(
415 l_ci_impact_id,
416 p_dest_ci_id,
417 l_impact_type_code,
418 NULL,
419 l_temp2,
420 l_implementation_date,
421 l_implemented_by,
422 l_comment,
423 Nvl(l_task_id, rec.impacted_task_id),
424 sysdate,
425 fnd_global.user_id,
426 fnd_global.login_id,
427 l_record_ver_number
428 );
429 END IF;
430
431 CLOSE get_orig_info;
432 END loop;
433
434 /* -- Bug 3677924 Jul 07 2004 Raja fp apis are to be called unconditionally
435 Pa_Fp_Control_Items_Utils.CHECK_FP_PLAN_VERSION_EXISTS
436 (
437 p_project_id => l_src_project_id,
438 p_ci_id => p_source_ci_id,
439 x_call_fp_api_flag => l_ret,
440 x_return_status => x_return_status,
441 x_msg_count => x_msg_count,
442 x_msg_data => x_msg_data
443 );
444
445 */
446
447 IF l_ret = 'Y' THEN
448
449 IF p_include_flag = 'Y' THEN
450 pa_fp_ci_include_pkg.fp_ci_copy_control_items
451 (
452 p_project_id => l_project_id,
453 p_source_ci_id_tbl => l_source,
454 p_target_ci_id => p_dest_ci_id,
455 p_calling_context => 'INCLUDE',
456 x_warning_flag => l_warning_flag,
457 x_msg_data => x_msg_data,
458 x_msg_count => x_msg_count,
459 x_return_status => x_return_status
460 );
461 ELSE
462 pa_fp_ci_include_pkg.fp_ci_copy_control_items
463 (
464 p_project_id => l_project_id,
465 p_source_ci_id_tbl => l_source,
466 p_target_ci_id => p_dest_ci_id,
467 p_calling_context => 'COPY',
468 x_warning_flag => l_warning_flag,
469 x_msg_data => x_msg_data,
470 x_msg_count => x_msg_count,
471 x_return_status => x_return_status
472 );
473 END IF;
474 END IF;
475
476
477 END IF;
478
479 -- Commit if the flag is set and there is no error
480 IF (p_commit = 'T' AND x_return_status = FND_API.G_RET_STS_SUCCESS ) THEN
481 COMMIT;
482 END IF;
483
484 -- Reset the error stack when returning to the calling program
485 PA_DEBUG.Reset_Err_Stack;
486
487
488 END copy_impact;
489
490 procedure is_delete_impact_ok
491 (
492 p_ci_impact_id IN NUMBER,
493
494 x_return_status OUT NOCOPY VARCHAR2,
495 x_msg_count OUT NOCOPY NUMBER,
496 x_msg_data OUT NOCOPY VARCHAR2
497 )
498 IS
499 CURSOR get_type_code
500 IS
501 select impact_type_code,ci_id
502 From pa_ci_impacts
503 WHERE ci_impact_id = p_ci_impact_id;
504
505 l_temp VARCHAR2(30);
506 l_ciid NUMBER;
507
508 BEGIN
509
510
511 -- Initialize the return status to success
512 x_return_status := FND_API.G_RET_STS_SUCCESS;
513
514 OPEN get_type_code;
515 FETCH get_type_code INTO l_temp,l_ciid;
516 CLOSE get_type_code;
517
518 IF l_temp = 'FINPLAN' THEN
519
520 NULL;
521 -- to be added
522
523 ELSIF l_temp = 'SUPPLIER' THEN
524 /** Added for Supplier Impact details This API returns error 'E' if there
525 ** detail transactions exists for the supplier impact
526 **/
527 PA_CI_SUPPLIER_UTILS.IS_SI_DELETE_OK
528 (p_ci_id => l_ciid
529 ,x_return_status => x_return_status
530 ,x_msg_data => x_msg_data
531 ,x_msg_count => x_msg_count
532 );
533
534 END IF;
535
536 END is_delete_impact_ok;
537
538 function get_edit_mode (
539 p_ci_id IN NUMBER := null
540 ) RETURN varchar2
541 IS
542 l_temp VARCHAR2(10) := 'NONE';
543 l_context VARCHAR2(30);
544
545
546 l_status_code VARCHAR2(30);
547 l_type_class VARCHAR2(30);
548 l_ret VARCHAR2(1);
549 l_ret2 VARCHAR2(1);
550
551
552 CURSOR get_ci_info
553 IS
554 select pci.status_code,
555 pctb.ci_type_class_code from pa_control_items pci,
556 pa_ci_types_b pctb
557 where pci.ci_type_id = pctb.ci_type_id
558 AND pci.ci_id = p_ci_id;
559
560 /*
561 CURSOR is_implement_ok
562 IS
563 SELECT
564 pa_control_items_utils.CheckCIActionAllowed('CONTROL_ITEM',l_status_code,'CI_ALLOW_IMPACT_IMPLEMENT') from dual;
565
566 CURSOR is_update_ok
567 IS
568 SELECT
569 pa_control_items_utils.CheckCIActionAllowed('CONTROL_ITEM',l_status_code,'CONTROL_ITEM_ALLOW_UPDATE') from dual;
570 */
571
572 BEGIN
573
574 OPEN get_ci_info;
575 FETCH get_ci_info INTO l_status_code, l_type_class;
576 CLOSE get_ci_info;
577
578 /*
579 OPEN is_update_ok;
580 FETCH is_update_ok INTO l_ret;
581 CLOSE is_update_ok;
582 */
583 l_ret := pa_control_items_utils.CheckCIActionAllowed('CONTROL_ITEM',l_status_code,'CONTROL_ITEM_ALLOW_UPDATE');
584
585 IF l_ret <>'Y' THEN
586 -- need to check whether we can implement it
587 IF l_type_class = 'CHANGE_ORDER' OR l_type_class = 'CHANGE_REQUEST' then
588 /* OPEN is_implement_ok;
589 FETCH is_implement_ok INTO l_ret;
590 CLOSE is_implement_ok;
591 */
592
593 l_ret2 := pa_control_items_utils.CheckCIActionAllowed('CONTROL_ITEM',l_status_code,'CI_ALLOW_IMPACT_IMPLEMENT');
594
595 IF l_ret2 <> 'Y' THEN
596 RETURN 'NONE';
597 END IF;
598 l_context := 'IMPLEMENT';
599 ELSE
600 -- not a change request
601 RETURN 'NONE';
602 END IF;
603
604 ELSE
605 l_context := 'DETAIL';
606 END IF;
607
608 IF l_context = 'DETAIL' THEN
609 l_ret := pa_ci_security_pkg.check_update_access(p_ci_id);
610 IF l_ret = 'T' THEN
611 l_temp := 'EDIT';
612 ELSE
613 l_temp := 'VIEW';
614 END IF;
615 ELSIF l_context = 'IMPLEMENT' THEN
616 l_ret := pa_ci_security_pkg.check_implement_impact_access(p_ci_id);
617 IF l_ret = 'T' THEN
618 l_temp := 'EDIT';
619 ELSE
620 l_temp := 'VIEW';
621 END IF;
622
623 END IF;
624
625 RETURN l_temp;
626
627 EXCEPTION
628 WHEN NO_DATA_FOUND THEN
629 RETURN 'NONE';
630
631 END get_edit_mode;
632
633
634 function get_update_impact_mode (
635 p_ci_id IN NUMBER := null
636 ) RETURN varchar2
637 IS
638 l_temp VARCHAR2(10) := 'NONE';
639 l_context VARCHAR2(30);
640
641
642 l_status_code pa_control_items.status_code%TYPE;
643 l_type_class pa_ci_types_b.ci_type_class_code%TYPE;
644 l_ret VARCHAR2(1);
645 l_ret2 VARCHAR2(1);
646
647
648 CURSOR get_ci_info
649 IS
650 select pci.status_code,
651 pctb.ci_type_class_code from pa_control_items pci,
652 pa_ci_types_b pctb
653 where pci.ci_type_id = pctb.ci_type_id
654 AND pci.ci_id = p_ci_id;
655
656 BEGIN
657 OPEN get_ci_info;
658 FETCH get_ci_info INTO l_status_code, l_type_class;
659 CLOSE get_ci_info;
660
661 l_ret := pa_control_items_utils.CheckCIActionAllowed('CONTROL_ITEM',l_status_code,'CONTROL_ITEM_ALLOW_UPDATE');
662
663 IF l_ret = 'Y' THEN
664 l_ret2 := pa_ci_security_pkg.check_update_access(p_ci_id);
665 IF l_ret2 = 'T' THEN /* Bug#3815040: Modified the variable l_ret to l_ret2 */
666 l_temp := 'EDIT';
667 ELSE
668 l_temp := 'VIEW';
669 END IF;
670 ELSE
671 RETURN 'NONE';
672 END IF;
673
674 RETURN l_temp;
675
676 EXCEPTION
677 WHEN NO_DATA_FOUND THEN
678 RETURN 'NONE';
679
680 END get_update_impact_mode;
681
682 function get_implement_impact_mode (
683 p_ci_id IN NUMBER := null
684 ) RETURN varchar2
685 IS
686 l_temp VARCHAR2(10) := 'NONE';
687 l_context VARCHAR2(30);
688
689
690 l_status_code pa_control_items.status_code%TYPE;
691 l_type_class pa_ci_types_b.ci_type_class_code%TYPE;
692 l_ret VARCHAR2(1);
693 l_ret2 VARCHAR2(1);
694
695
696 CURSOR get_ci_info
697 IS
698 select pci.status_code,
699 pctb.ci_type_class_code from pa_control_items pci,
700 pa_ci_types_b pctb
701 where pci.ci_type_id = pctb.ci_type_id
702 AND pci.ci_id = p_ci_id;
703
704 BEGIN
705 OPEN get_ci_info;
706 FETCH get_ci_info INTO l_status_code, l_type_class;
707 CLOSE get_ci_info;
708
709 IF l_type_class = 'CHANGE_ORDER' OR l_type_class = 'CHANGE_REQUEST' THEN
710 l_ret2 := pa_control_items_utils.CheckCIActionAllowed('CONTROL_ITEM',l_status_code,'CI_ALLOW_IMPACT_IMPLEMENT');
711
712 IF l_ret2 <> 'Y' THEN
713 RETURN 'NONE';
714 END IF;
715
716 l_context := 'IMPLEMENT';
717 ELSE
718 RETURN 'NONE';
719 END IF;
720
721 IF l_context = 'IMPLEMENT' THEN
722 l_ret := pa_ci_security_pkg.check_implement_impact_access(p_ci_id);
723 IF l_ret = 'T' THEN
724 l_temp := 'EDIT';
725 ELSE
726 l_temp := 'VIEW';
727 END IF;
728 END IF;
729
730 RETURN l_temp;
731
732 EXCEPTION
733 WHEN NO_DATA_FOUND THEN
734 RETURN 'NONE';
735
736 END get_implement_impact_mode;
737
738
739 function get_update_impact_mode (
740 p_ci_id IN NUMBER := null,
741 p_status_code IN VARCHAR2
742 ) RETURN varchar2
743 IS
744 l_temp VARCHAR2(10) := 'NONE';
745 l_context VARCHAR2(30);
746
747 l_status_code pa_control_items.status_code%TYPE;
748 l_type_class pa_ci_types_b.ci_type_class_code%TYPE;
749 l_ret VARCHAR2(1);
750 l_ret2 VARCHAR2(1);
751
752 BEGIN
753
754 l_status_code := p_status_code;
755 l_ret := pa_control_items_utils.CheckCIActionAllowed('CONTROL_ITEM',l_status_code,'CONTROL_ITEM_ALLOW_UPDATE');
756
757 IF l_ret = 'Y' THEN
758 l_ret2 := pa_ci_security_pkg.check_update_access(p_ci_id);
759 IF l_ret2 = 'T' THEN /* Bug#3815040: Modified the variable l_ret to l_ret2 */
760 l_temp := 'EDIT';
761 ELSE
762 l_temp := 'VIEW';
763 END IF;
764 ELSE
765 RETURN 'NONE';
766 END IF;
767
768 RETURN l_temp;
769
770 EXCEPTION
771 WHEN NO_DATA_FOUND THEN
772 RETURN 'NONE';
773
774 END get_update_impact_mode;
775
776 function get_implement_impact_mode (
777 p_ci_id IN NUMBER := null,
778 p_status_code IN VARCHAR2,
779 p_type_class VARCHAR2
780 ) RETURN varchar2
781 IS
782 l_temp VARCHAR2(10) := 'NONE';
783 l_context VARCHAR2(30);
784
785
786 l_status_code pa_control_items.status_code%TYPE;
787 l_type_class pa_ci_types_b.ci_type_class_code%TYPE;
788 l_ret VARCHAR2(1);
789 l_ret2 VARCHAR2(1);
790
791 BEGIN
792
793 l_status_code := p_status_code;
794 l_type_class := p_type_class;
795
796 IF l_type_class = 'CHANGE_ORDER' OR l_type_class = 'CHANGE_REQUEST' THEN
797 l_ret2 := pa_control_items_utils.CheckCIActionAllowed('CONTROL_ITEM',l_status_code,'CI_ALLOW_IMPACT_IMPLEMENT');
798
799 IF l_ret2 <> 'Y' THEN
800 RETURN 'NONE';
801 END IF;
802
803 l_context := 'IMPLEMENT';
804 ELSE
805 RETURN 'NONE';
806 END IF;
807
808 IF l_context = 'IMPLEMENT' THEN
809 l_ret := pa_ci_security_pkg.check_implement_impact_access(p_ci_id);
810 IF l_ret = 'T' THEN
811 l_temp := 'EDIT';
812 ELSE
813 l_temp := 'VIEW';
814 END IF;
815 END IF;
816
817 RETURN l_temp;
818
819 EXCEPTION
820 WHEN NO_DATA_FOUND THEN
821 RETURN 'NONE';
822
823 END get_implement_impact_mode;
824
825 END Pa_ci_impacts_util;