DBA Data[Home] [Help]

PACKAGE BODY: APPS.FUN_KFF_VIEW_FUNC_PKG

Source


1 PACKAGE BODY FUN_KFF_VIEW_FUNC_PKG AS
2 /* $Header: funxtmkffvfcb.pls 120.4 2010/07/05 10:34:40 rveliche ship $ */
3 
4 function derive_format_attributes(p_value_set_id in number,
5                                   p_qualifiers in varchar2) return varchar2 as
6   cursor qual_csr is
7     select segment_attribute_type||'.'||value_attribute_type qual
8     from fnd_flex_validation_qualifiers
9     where flex_value_set_id = p_value_set_id order by assignment_date;
10 
11   l_qualifiers varchar2(1000);
12   l_n number;
13   l_begin number;
14   l_end number;
15   l_v varchar2(100);
16 
17 
18 --GL_GLOBAL.DETAIL_POSTING_ALLOWED=Y|GL_GLOBAL.DETAIL_BUDGETING_ALLOWED=N
19 --GL_GLOBAL.DETAIL_BUDGETING_ALLOWED=N|GL_GLOBAL.DETAIL_POSTING_ALLOWED=Y'
20 
21 
22 begin
23   for qual_rec in qual_csr loop
24 
25     l_n := instr(p_qualifiers, qual_rec.qual, 1, 1);
26 
27     if l_n <> 0 then
28       l_n := instr(p_qualifiers, '=', l_n, 1);
29       l_begin := l_n + 1;
30       l_end := instr(p_qualifiers, '|' , l_n + 1, 1);
31       if l_end <> 0 then
32         l_v := substr(p_qualifiers, l_begin, l_end-l_begin);
33       else
34         l_v := substr(p_qualifiers, l_begin);
35       end if;
36       l_v := ''''||l_v||'''';
37     else
38       l_v := '''%''';
39     end if;
40 
41     if l_qualifiers is null then
42       l_qualifiers := l_v;
43     else
44       l_qualifiers := l_qualifiers||'||'||'fnd_global.newline||'||l_v;
45     end if;
46 
47   end loop;
48   return l_qualifiers;
49 exception when others then
50   return null;
51 end;
52 
53 function format_attributes(p_value_set_id in number,
54                            p_compiled_value_attributes in varchar2) return varchar2 as
55   cursor c is
56     select count(*) from fnd_flex_validation_qualifiers where flex_value_set_id = p_value_set_id;
57 
58   num number;
59   l_compiled_value_attributes varchar2(200);
60   l_t number;
61 
62 begin
63   open c;
64   fetch c into num;
65   close c;
66 
67   l_compiled_value_attributes := p_compiled_value_attributes;
68 
69   for i in 1..num-1 loop
70     l_t := instr(p_compiled_value_attributes, fnd_global.newline, 1, i);
71     if l_t = 0 then
72       l_compiled_value_attributes := l_compiled_value_attributes || fnd_global.newline;
73     end if;
74   end loop;
75 
76   return l_compiled_value_attributes;
77 exception when others then
78   return null;
79 end;
80 
81 
82 /*
83  * Bug: 6900726 FP for 4455493
84  * Checks to see if the flex value is secured through security rules for the current
85  * responsibility.
86  * Added parent_value parameter for bug 4481650
87  * TODO: This function currently does not support dependent value sets.
88  *       Security rules for dependent value sets require the parent value.
89  *       Bug 4481634 loggged to track this issue.
90  *
91  * @param p_value_set_id Value set identifier
92  * @param p_flex_value   Segment value
93  * @return 'T' if the value is not secured by the current responsibility. 'F' otherwise.
94  */
95 function is_valid_on_security_rules(p_value_set_id in number,
96                                     p_flex_value in varchar2,
97                                     p_parent_value in varchar2 default null) return varchar2 as
98 
99   l_security_status varchar2(2048);
100   l_error_message varchar2(2048);
101 begin
102   fnd_flex_server.check_value_security(
103                 p_security_check_mode => 'Y',
104                 p_flex_value_set_id => p_value_set_id,
105                 p_parent_flex_value => p_parent_value,
106                 p_flex_value => p_flex_value,
107                 p_resp_application_id => fnd_global.resp_appl_id,
108                 p_responsibility_id => fnd_global.resp_id,
109                 x_security_status => l_security_status,
110                 x_error_message => l_error_message
111                                 );
112 
113 
114   if l_security_status = 'NOT-SECURED' then
115     return 'T';
116   else
117     return 'F';
118   end if;
119 exception when others then
120   return 'F';
121 end;
122 
123 END;