DBA Data[Home] [Help]

PACKAGE BODY: APPS.ECE_TIMEZONE_API

Source


1 PACKAGE BODY ece_timezone_api AS
2 -- $Header: ECETZAPB.pls 120.3.12000000.2 2007/10/03 15:00:55 cpeixoto ship $
3 
4    PROCEDURE get_server_timezone_details(
5                                       p_date                 IN  DATE,
6                                       x_gmt_deviation        OUT NOCOPY NUMBER,
7                                       x_global_timezone_name OUT NOCOPY VARCHAR2) IS
8       st_tz_id number;
9       p_api_version number;
10       p_init_msg_list varchar2(32767) := FND_API.G_FALSE;
11       x_msg_data varchar2(2000);
12       x_msg_count number;
13       x_return_status varchar2(20);
14       x_name varchar2(80);
15       xProgress                  VARCHAR2(80);
16 
17       BEGIN
18          if ec_debug.G_debug_level >= 2 then
19          ec_debug.push('ECE_TIMEZONE_API.GET_SERVER_TIMEZONE_DETAILS');
20 	 end if;
21 	 xProgress := 'TZAPI-10-1000';
22 	 fnd_profile.get('SERVER_TIMEZONE_ID',st_tz_id);
23          xProgress := 'TZAPI-10-1010';
24          if p_date is not null then
25          hz_timezone_pub.get_timezone_gmt_deviation(
26 	                                            1.0,
27 						    p_init_msg_list,
28 						    st_tz_id,
29 						    p_date,
30 						    x_gmt_deviation,
31 						    x_global_timezone_name,
32 						    x_name,
33 						    x_return_status,
34 						    x_msg_count,
35 						    x_msg_data
36 						   );
37          end if;
38          if ec_debug.G_debug_level >= 2 then
39 	 ec_debug.pl(3,'gmt deviation: ',x_gmt_deviation);
40 	 ec_debug.pl(3,'Timezone Code: ',x_global_timezone_name);
41          ec_debug.pop('ECE_TIMEZONE_API.GET_SERVER_TIMEZONE_DETAILS');
42 	 end if;
43           EXCEPTION
44          WHEN OTHERS THEN
45             ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL',xProgress);
46             ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
47             if ec_debug.G_debug_level >= 2 then
48             ec_debug.pop('ECE_TIMEZONE_API.GET_SERVER_TIMEZONE_DETAILS');
49 	    end if;
50             app_exception.raise_exception;
51 
52 
53       END  get_server_timezone_details;
54 
55      PROCEDURE get_date(
56                        p_src_date      IN  DATE,
57                        p_timezone_name IN  VARCHAR2,
58                        x_dest_date     OUT NOCOPY DATE) IS
59            st_tz_id number;
60            ct_tz_id number;
61            p_api_version number;
62            p_init_msg_list varchar2(32767) := FND_API.G_FALSE ;
63            x_msg_data varchar2(2000);
64            x_msg_count number;
65            x_return_status varchar2(20);
66            xProgress                  VARCHAR2(80);
67 
68 /* fix for bug 6391170
69 	   CURSOR c_timezone(p_timezone_name IN varchar2
70 			     ) IS
71 	          select timezone_id
72 	          from hz_timezones_vl
73 		  where upper(name) = p_timezone_name; */
74 
75            CURSOR c_timezone(p_timezone_name IN varchar2
76                              ) IS
77                   select upgrade_tz_id timezone_id
78                   from fnd_timezones_vl
79                   where upper(timezone_code) = p_timezone_name;
80 
81       BEGIN
82           if ec_debug.G_debug_level >= 2 then
83           ec_debug.push('ECE_TIMEZONE_API.GET_DATE');
84 	  end if;
85 	  xProgress := 'TZAPI-20-1000';
86 	  if (p_timezone_name is not null) then
87           FOR i_timezone in c_timezone(upper(p_timezone_name))
88 	  LOOP
89 	   ct_tz_id := i_timezone.timezone_id;
90 	   exit;
91 	  END LOOP;
92 	  xProgress := 'TZAPI-20-1010';
93           fnd_profile.get('SERVER_TIMEZONE_ID',st_tz_id);
94 	  xProgress := 'TZAPI-20-1020';
95           hz_timezone_pub.get_time(
96 	                           1.0,
97 				   p_init_msg_list,
98 				   ct_tz_id,
99 				   st_tz_id,
100 				   p_src_date,
101 				   x_dest_date,
102 				   x_return_status,
103 				   x_msg_count,
104 				   x_msg_data);
105          else
106 	  x_dest_date := p_src_date;
107 	 end if;
108          if ec_debug.G_debug_level >= 2 then
109          ec_debug.pl(3,'x_dest_date: ',x_dest_date);
110          ec_debug.pop('ECE_TIMEZONE_API.GET_DATE');
111 	 end if;
112           EXCEPTION
113          WHEN OTHERS THEN
114             ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL',xProgress);
115             ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
116             if ec_debug.G_debug_level >= 2 then
117             ec_debug.pop('ECE_TIMEZONE_API.GET_DATE');
118 	    end if;
119             app_exception.raise_exception;
120 
121       END get_date;
122 END;