DBA Data[Home] [Help]

PACKAGE BODY: APPS.ICX_PAGES_PKG

Source


1 package body icx_pages_pkg as
2 /* $Header: ICXPAGHB.pls 115.2 1999/11/23 18:44:46 pkm ship      $ */
3 
4 --  ***********************************************
5 --	procedure INSERT_ROW
6 --  ***********************************************
7 
8 procedure INSERT_ROW (
9   x_rowid		in out varchar2,
10   x_page_id		in number,
11   x_page_code		in varchar2,
12   x_main_region_id	in number,
13   x_sequence_number	in number,
14   x_page_type		in varchar2,
15   x_user_id		in number,
16   x_refresh_rate	in number,
17   x_page_name		in varchar2,
18   x_page_description	in varchar2,
19   x_creation_date	in date,
20   x_created_by		in number,
21   x_last_update_date	in date,
22   x_last_updated_by	in number,
23   x_last_update_login	in number
24 ) is
25 
26   cursor C is select ROWID from ICX_PAGES
27     where PAGE_ID = X_PAGE_ID;
28 
29 begin
30   insert into ICX_PAGES (
31     page_code,
32     main_region_id,
33     sequence_number,
34     page_type,
35     page_id,
36     user_id,
37     refresh_rate,
38 	page_name,
39     creation_date,
40     created_by,
41     last_update_date,
42     last_updated_by,
43     last_update_login
44   ) values (
45     x_page_code,
46     x_main_region_id,
47     x_sequence_number,
48     x_page_type,
49     x_page_id,
50     x_user_id,
51     x_refresh_rate,
52 	x_page_name,
53     x_creation_date,
54     x_created_by,
55     x_last_update_date,
56     x_last_updated_by,
57     x_last_update_login
58   );
59 
60   insert into ICX_PAGES_TL (
61     page_id,
62     page_name,
63     page_description,
64     last_update_date,
65     last_updated_by,
66     creation_date,
67     created_by,
68     last_update_login,
69     language,
70     source_lang
71   ) select
72     x_page_id,
73     x_page_name,
74     x_page_description,
75     x_last_update_date,
76     x_last_updated_by,
77     x_creation_date,
78     x_created_by,
79     x_last_update_login,
80     l.language_code,
81     userenv('LANG')
82   from fnd_languages l
83   where L.INSTALLED_FLAG in ('I', 'B')
84   and not exists
85     (select NULL
86     from ICX_PAGES_TL T
87     where T.PAGE_ID = X_PAGE_ID
88     and T.LANGUAGE = L.LANGUAGE_CODE);
89 
90   open c;
91   fetch c into X_ROWID;
92   if (c%notfound) then
93     close c;
94     raise no_data_found;
95   end if;
96   close c;
97 
98 end INSERT_ROW;
99 
100 --  ***********************************************
101 --	procedure UPDATE_ROW
102 --  ***********************************************
103 
104 procedure UPDATE_ROW (
105   x_page_id		in number,
106   x_page_code		in varchar2,
107   x_main_region_id	in number,
108   x_sequence_number	in number,
109   x_page_type		in varchar2,
110   x_user_id		in number,
111   x_refresh_rate	in number,
112   x_page_name		in varchar2,
113   x_page_description	in varchar2,
114   x_last_update_date	in date,
115   x_last_updated_by	in number,
116   x_last_update_login	in number
117 ) is
118 begin
119   update icx_pages set
120     page_code		= x_page_code,
121     main_region_id	= x_main_region_id,
122     sequence_number	= x_sequence_number,
123     page_type		= x_page_type,
124     user_id		= x_user_id,
125     refresh_rate	= x_refresh_rate,
126     last_update_date	= x_last_update_date,
127     last_updated_by	= x_last_updated_by,
128     last_update_login	= x_last_update_login
129   where page_id = x_page_id;
130 
131   if (sql%notfound) then
132     raise no_data_found;
133   end if;
134 
135   update icx_pages_tl set
136     page_name		= x_page_name,
137     page_description	= x_page_description,
138     last_update_date	= x_last_update_date,
139     last_updated_by	= x_last_updated_by,
140     last_update_login	= x_last_update_login,
141     source_lang		= userenv('LANG')
142   where page_id = x_page_id
143   and userenv('LANG') in (language, source_lang);
144 
145   if (sql%notfound) then
146     raise no_data_found;
147   end if;
148 end UPDATE_ROW;
149 
150 
151 --  ***********************************************
152 --	procedure ADD_LANGUAGE
153 --  ***********************************************
154 
155 procedure ADD_LANGUAGE
156 is
157 begin
158   delete from ICX_PAGES_TL T
159   where not exists
160     (select NULL
161     from ICX_PAGES B
162     where B.PAGE_ID = T.PAGE_ID
163     );
164 
165   update icx_pages_tl t set (
166       page_name,
167       page_description
168     ) = (select
169       b.page_name,
170       b.page_description
171     from icx_pages_tl b
172     where b.page_id = t.page_id
173     and b.language = t.source_lang)
174   where (
175       t.page_id,
176       t.language
177   ) in (select
178       subt.page_id,
179       subt.language
180     from icx_pages_tl subb, icx_pages_tl subt
181     where subb.page_id = subt.page_id
182     and subb.language = subt.source_lang
183     and (subb.page_name <> subt.page_name
184       or (subb.page_name is null and subt.page_name is not null)
185       or (subb.page_name is not null and subt.page_name is null)
186       or subb.page_description <> subt.page_description
187       or (subb.page_description is null and subt.page_description is not null)
188       or (subb.page_description is not null and subt.page_description is null)
189   ));
190 
191   insert into ICX_PAGES_TL (
192     page_id,
193     page_name,
194     page_description,
195     last_update_date,
196     last_updated_by,
197     creation_date,
198     created_by,
199     last_update_login,
200     language,
201     source_lang
202   ) select
203     b.page_id,
204     b.page_name,
205     b.page_description,
206     b.last_update_date,
207     b.last_updated_by,
208     b.creation_date,
209     b.created_by,
210     b.last_update_login,
211     l.language_code,
212     b.source_lang
213   from ICX_PAGES_TL b, FND_LANGUAGES l
214   where l.installed_flag in ('I', 'B')
215   and b.language = userenv('LANG')
216   and not exists
217     (select NULL
218     from icx_pages_tl t
219     where t.page_id = b.page_id
220     and t.language = l.language_code);
221 end ADD_LANGUAGE;
222 
223 procedure TRANSLATE_ROW (
224   x_page_id			in varchar2,
225   x_page_name		in varchar2,
226   x_page_description	in varchar2
227 ) is
228 begin
229 
230   update ICX_PAGES_tl set
231     page_name			= X_PAGE_NAME,
232 	page_description	= X_PAGE_DESCRIPTION,
233     SOURCE_LANG		     = userenv('LANG'),
234     last_update_date         = sysdate,
235     last_updated_by          = 1,
236     last_update_login        = 0
237   where page_id = X_PAGE_ID
238   and userenv('LANG') in (language, source_lang);
239 
240 end TRANSLATE_ROW;
241 
242 procedure LOAD_ROW (
243   X_PAGE_ID		in	number,
244   X_PAGE_CODE		in 	VARCHAR2,
245   x_main_region_id	in number,
246   x_sequence_number	in number,
247   x_page_type		in varchar2,
248   x_user_id		in number,
249   x_refresh_rate	in number,
250   x_page_name		in varchar2,
251   x_page_description	in varchar2
252 ) is
253 begin
254 
255   declare
256      l_page_id    number := 0;
257      row_id 	varchar2(64);
258 
259   begin
260 
261      select PAGE_ID into l_page_id
262      from   ICX_PAGES
263      where  PAGE_ID = X_PAGE_ID;
264 
265      icx_pages_pkg.UPDATE_ROW (
266 		x_page_id			=>	x_page_id,
267 		x_page_code			=>	x_page_code,
268 		x_main_region_id	=>	x_main_region_id,
269 		x_sequence_number	=>	x_sequence_number,
270 		x_page_type			=>	x_page_type,
271 		x_user_id			=>	x_user_id,
272 		x_refresh_rate		=>	x_refresh_rate,
273 		x_page_name			=>	x_page_name,
274 		x_page_description	=>	x_page_description,
275 		x_last_update_date	=>	sysdate,
276 		x_last_updated_by	=> 1,
277 		x_last_update_login	=> 0);
278 
279   exception
280      when NO_DATA_FOUND then
281 
282        icx_pages_pkg.INSERT_ROW (
283 		X_ROWID				=>	row_id,
284 		x_page_id			=>	x_page_id,
285 		x_page_code			=>	x_page_code,
286 		x_main_region_id	=>	x_main_region_id,
287 		x_sequence_number	=>	x_sequence_number,
288 		x_page_type			=>	x_page_type,
289 		x_user_id			=>	x_user_id,
290 		x_refresh_rate		=>	x_refresh_rate,
291 		x_page_name			=>	x_page_name,
292 		x_page_description	=>	x_page_description,
293 		x_creation_date		=>	sysdate,
294 		x_created_by		=>	1,
295 		x_last_update_date	=>	sysdate,
296 		x_last_updated_by	=>	1,
297 		x_last_update_login	=>	0);
298   end;
299 end LOAD_ROW;
300 
301 end ICX_PAGES_PKG;