DBA Data[Home] [Help]

PACKAGE BODY: APPS.IMC_UTILITY_PVT

Source


1 PACKAGE BODY IMC_UTILITY_PVT AS
2 /* $Header: imcvutlb.pls 120.2 2006/02/20 23:39:48 vnama noship $ */
3 -- Start of Comments
4 -- Package name     : IMC_UTILITY_PVT
5 -- Purpose          :
6 -- History          :
7 -- NOTE             :
8 -- Changes:
9 --    Colathur Vijayan (VJN) -- 1/4/2002 : Fixing Bug 2167071
10 --    Colathur Vijayan (VJN) -- 1/7/2002, included function that would return
11 --    a html link tag which will contain the address formatted for Yahoo Maps.
12 --    Colathur Vijayan (VJN) -- 2/7/2002 : Increased the size of the arrays
13 --    url and html_tagged_url
14 --    Colathur Vijayan (VJN) -- 4/15/2002 : Added code to catch exception
15 --                         when the AR Package function that returns the
16 --                         formatted address goes berserk(a bug in AR).
17 --    Colathur Vijayan (VJN) -- 4/18/2002,defined global variable for doing
18 --                              the fnd profile for default country and called
19 --                              the AR Package using this value.
20 --    Vivek Nama             -- Bug 4915127: stubbing apis
21 --                              GET_OVRW_MENU_PARAM()
22 --                              GET_EMP_MENU_PARAM()
23 --                              GET_ADMIN_FUNCTION_ID()
24 -- End of Comments
25 ----------------------------------------------------
26 
27 amp VARCHAR2(01) := '&';
28 staticURL VARCHAR2(100) := 'http://maps.yahoo.com/py/maps.py?BFCat=' || amp || 'Pyt=Tmap' || amp || 'newFL=Use+Address+Below' || amp || 'Get%A0Map=Get+Map';
29 countryProfileValue  VARCHAR2(25) := FND_PROFILE.Value ('ASF_DEFAULT_COUNTRY');
30 
31   type num_tab_ibbi is table of number index by binary_integer;
32 
33 -- Returns a URL of the form,
34 --
35 FUNCTION GET_YAHOO_MAP_URL(address1                IN VARCHAR2,
36                            address2                IN VARCHAR2,
37                            address3                IN VARCHAR2,
38                            address4                IN VARCHAR2,
39                            city                    IN VARCHAR2,
40                            country                 IN VARCHAR2,
41                            state                   IN VARCHAR2,
42                            postal_code             IN VARCHAR2)
43 RETURN VARCHAR2 AS
44     url VARCHAR2(300);
45     country_code VARCHAR2(20);
46 BEGIN
47 -- Since TCA validates the country code of UK to GB and Yahoo Maps expects 'uk'
48 -- we resort to this work around
49     IF upper(rtrim(country)) = 'GB'
50     THEN
51        country_code := 'uk';
52     ELSE
53        country_code := rtrim(country);
54     END IF;
55 
56     URL := staticURL ||
57            amp || 'addr=' || REPLACE(SUBSTRB(RTRIM(address1),1,60), ' ', '+') ||
58            amp || 'csz=' || REPLACE(SUBSTRB(RTRIM(city),1,50), ' ', '+') || '%2C+' || SUBSTRB(RTRIM(state),1,20) || '+' || SUBSTRB(RTRIM(postal_code),1,20) ||
59            amp || 'Country=' || country_code;
60 
61     RETURN url;
62 END GET_YAHOO_MAP_URL;
63 --
64 
65 ------------------------------------------------------------------------------------------------------------
66 -- This function will return a html link tag which will contain the address formatted for Yahoo Maps.
67 ------------------------------------------------------------------------------------------------------------
68 FUNCTION GET_YAHOO_ADDRESS_LINK_TAG(       address_style           IN VARCHAR2,
69                                            address1                IN VARCHAR2,
70                                            address2                IN VARCHAR2,
71                                            address3                IN VARCHAR2,
72                                            address4                IN VARCHAR2,
73                                            city                    IN VARCHAR2,
74                                            county                  IN VARCHAR2,
75                                            state                   IN VARCHAR2,
76                                            province                IN VARCHAR2,
77                                            postal_code             IN VARCHAR2,
78                                            territory_short_name    IN VARCHAR2,
79                                            country_code            IN VARCHAR2,
80                                            customer_name           IN VARCHAR2,
81                                            bill_to_location        IN VARCHAR2,
82                                            first_name              IN VARCHAR2,
83                                            last_name               IN VARCHAR2,
84                                            mail_stop               IN VARCHAR2,
85                                            default_country_code    IN VARCHAR2,
86                                            default_country_desc    IN VARCHAR2,
87                                            print_home_country_flag IN VARCHAR2,
88                                            width                   IN NUMBER,
89                                            height_min              IN NUMBER,
90                                            height_max              IN NUMBER
91                                           )
92 RETURN VARCHAR2 AS
93     url VARCHAR2(526);
94     validated_country_code VARCHAR2(10);
95     formatted_address VARCHAR2(200);
96     html_tagged_url VARCHAR2(1000);
97 BEGIN
98     IF upper(rtrim(country_code)) = 'GB'
99     THEN
100        validated_country_code := 'uk';
101     ELSE
102        validated_country_code := rtrim(country_code);
103     END IF;
104 
105     URL := staticURL ||
106            amp || 'addr=' || REPLACE(address1, ' ', '+') ||
107            amp || 'csz=' || REPLACE(city, ' ', '+') || '%2C+' || RTRIM(state) || '+' || RTRIM(postal_code) ||
108            amp || 'Country=' || validated_country_code ;
109 
110     formatted_address := ARP_ADDR_LABEL_PKG.FORMAT_ADDRESS_LABEL(null,address1,address2,address3,address4,
111                                                                 city,county,state,province,postal_code,
112                                                                 country_code,country_code, null,null,null,null,null,
113                                                                 countryProfileValue,
114                                                                 null,    null,    2000,    1,    1);
115 
116     html_tagged_url := '<a href="' || URL || '", target="_blank">' || formatted_address || '</a>';
117     RETURN html_tagged_url;
118 
119 EXCEPTION
120         WHEN OTHERS
121         THEN
122            html_tagged_url := '<a href="' || 'www.errorhappened.com' || '", targ
123 et="_blank">' || formatted_address || '</a>';
124            RETURN html_tagged_url;
125 
126 
127 END GET_YAHOO_ADDRESS_LINK_TAG ;
128 --
129 
130 ------------------------------------------------------------------------------
131 -- Bug 4915127: stubbing api
132 ------------------------------------------------------------------------------
133 FUNCTION GET_OVRW_MENU_PARAM(resp_id IN NUMBER,
134                              type IN VARCHAR2)
135 RETURN VARCHAR2 AS
136 BEGIN
137  RETURN '';
138 END GET_OVRW_MENU_PARAM;
139 
140 
141 ------------------------------------------------------------------------------
142 -- Bug 4915127: stubbing api
143 ------------------------------------------------------------------------------
144 FUNCTION GET_EMP_MENU_PARAM(resp_id IN NUMBER)
145 RETURN VARCHAR2 AS
146 BEGIN
147   RETURN '';
148 END GET_EMP_MENU_PARAM;
149 
150 
151 ------------------------------------------------------------------------------
152 -- This procedure is an internal procedure called by GET_ADMIN_FUNCTION_ID.
153 -- It obtains menu structure recursively through in order recursion.
154 ------------------------------------------------------------------------------
155 
156   procedure get_excl_menu_tree_recurs_tl(p_lang varchar2, p_menu_id number,
157     p_respid number, p_appid number,
158     p_kids_menu_ids in out nocopy jtf_menu_pub.number_table,
159     p_kids_menu_data in out nocopy jtf_menu_pub.menu_table)
160   is
161     t_new_ids num_tab_ibbi;
162     t_mt jtf_menu_pub.menu_table;
163     cnt number;
164     loc number;
165   begin
166     jtf_menu_pub.get_excluded_menu_entries_tl(p_lang, p_menu_id, p_respid, p_appid, t_mt);
167 
168     if t_mt is null or t_mt.count = 0 then return; end if;
169 
170     cnt := t_mt.first;
171     while true loop
172       -- put the p_menu_id in the p_kids_menu_ids, and the new menu_data
173       -- from t_mt into the p_kids_menu_data
174       loc := p_kids_menu_ids.count+1;
175       p_kids_menu_ids(loc) := p_menu_id;
176       p_kids_menu_data(loc) := t_mt(cnt);
177 
178       -- if this child also points at a menu, then recurse
179       if t_mt(cnt).sub_menu_id is not null then
180           get_excl_menu_tree_recurs_tl(p_lang, t_mt(cnt).sub_menu_id, p_respid, p_appid,
181             p_kids_menu_ids, p_kids_menu_data);
182       end if;
183 
184       -- next...
185       if cnt = t_mt.last then exit; end if;
186       cnt := t_mt.next(cnt);
187     end loop;
188 
189   end get_excl_menu_tree_recurs_tl;
190 
191 ------------------------------------------------------------------------------
192 -- Bug 4915127: stubbing api
193 ------------------------------------------------------------------------------
194 FUNCTION GET_ADMIN_FUNCTION_ID(p_lang IN VARCHAR2, p_respid in number, p_appid in number)
195 RETURN NUMBER IS
196 BEGIN
197   RETURN 0;
198 END GET_ADMIN_FUNCTION_ID;
199 
200 End IMC_UTILITY_PVT;