[Home] [Help]
PACKAGE BODY: APPS.IEU_WP_UI_COMPONENTS_PKG
Source
1 package body IEU_WP_UI_COMPONENTS_PKG as
2 /* $Header: IEUVCOMB.pls 120.1 2005/06/20 01:10:20 appldev ship $ */
3
4 procedure insert_row(
5 x_rowid in out nocopy Varchar2,
6 p_ui_comp_id in number,
7 p_object_version_number in number,
8 p_created_by in number,
9 p_creation_date in date,
10 p_last_updated_by in number,
11 p_last_update_date in date,
12 p_last_update_login in number,
13 p_ui_comp_catg_code in varchar2,
14 p_form_comp_code in varchar2,
15 p_form_comp_avail_no in number,
16 p_property_class in varchar2,
17 p_ui_comp_label in varchar2,
18 p_ui_comp_desc in varchar2
19 ) is
20 cursor C is select ROWID from IEU_WP_UI_COMPONENTS_B
21 where UI_COMP_ID = P_UI_COMP_ID;
22
23 begin
24 insert into IEU_WP_UI_COMPONENTS_B (
25 UI_COMP_ID ,
26 OBJECT_VERSION_NUMBER,
27 CREATED_BY,
28 CREATION_DATE,
29 LAST_UPDATED_BY,
30 LAST_UPDATE_DATE,
31 LAST_UPDATE_LOGIN,
32 UI_COMP_CATG_CODE,
33 FORM_COMP_CODE,
34 FORM_COMP_AVAIL_NO,
35 PROPERTY_CLASS
36 )
37 VALUES(
38 p_ui_comp_id,
39 p_object_version_number,
40 p_created_by,
41 p_creation_date,
42 p_last_updated_by,
43 p_last_update_date,
44 p_last_update_login,
45 p_ui_comp_catg_code,
46 p_form_comp_code,
47 p_form_comp_avail_no,
48 p_property_class
49 );
50
51 insert into IEU_WP_UI_COMPONENTS_TL (
52 UI_COMP_ID,
53 OBJECT_VERSION_NUMBER,
54 CREATED_BY,
55 CREATION_DATE,
56 LAST_UPDATED_BY,
57 LAST_UPDATE_DATE,
58 LAST_UPDATE_LOGIN,
59 UI_COMP_LABEL,
60 UI_COMP_DESC,
61 LANGUAGE,
62 SOURCE_LANG
63 ) select
64 p_ui_comp_id,
65 p_object_version_number,
66 p_created_by,
67 p_creation_date,
68 p_last_updated_by,
69 p_last_update_date,
70 p_last_update_login,
71 p_ui_comp_label,
72 p_ui_comp_desc,
73 l.language_code,
74 userenv('LANG')
75 from fnd_languages l
76 where l.installed_flag in ('I', 'B')
77 and not exists
78 (select null from ieu_wp_ui_components_tl t
79 where t.ui_comp_id = p_ui_comp_id
80 and t.language = l.language_code);
81
82 open c;
83 fetch c into x_rowid;
84 if (c%notfound) then
85 close c;
86 raise no_data_found;
87 end if;
88 close c;
89
90 END INSERT_ROW;
91
92
93 procedure lock_row(
94 p_ui_comp_id in number,
95 p_object_version_number in number,
96 p_ui_comp_catg_code in varchar2,
97 p_form_comp_code in varchar2,
98 p_form_comp_avail_no in number,
99 p_property_class in varchar2,
100 p_ui_comp_label in varchar2,
101 p_ui_comp_desc in varchar2
102 ) is
103 cursor c is select
104 object_version_number,
105 ui_comp_catg_code,
106 form_comp_code,
107 form_comp_avail_no,
108 property_class
109 from ieu_wp_ui_components_b
110 where ui_comp_id = p_ui_comp_id
111 for update of ui_comp_id nowait;
112 recinfo c%rowtype;
113
114 cursor c1 is select
115 ui_comp_label,
116 ui_comp_desc,
117 decode(language, userenv('LANG'), 'Y', 'N') BASELANG
118 from ieu_wp_ui_components_tl
119 where ui_comp_id = p_ui_comp_id
120 and userenv('LANG') in (LANGUAGE, SOURCE_LANG)
121 for update of ui_comp_id nowait;
122
123 begin
124 open c;
125 fetch c into recinfo;
126 if (c%notfound) then
127 close c;
128 fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
129 app_exception.raise_exception;
130 end if;
131 close c;
132 if ((recinfo.object_version_number = p_object_version_number)
133 AND (recinfo.ui_comp_catg_code = p_ui_comp_catg_code)
134 AND (recinfo.form_comp_code = p_form_comp_code)
135 AND (recinfo.form_comp_avail_no = p_form_comp_avail_no)
136 AND (recinfo.property_class = p_property_class))
137 then
138 null;
139 else
140 fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
141 app_exception.raise_exception;
142 end if;
143
144 for tlinfo in c1 loop
145 if (tlinfo.BASELANG = 'Y') then
146 if ((tlinfo.ui_comp_label = p_ui_comp_label)
147 and (tlinfo.ui_comp_desc = p_ui_comp_desc))
148 then
149 null;
150 else
151 fnd_message.set_name('FND','FORM_RECORD_CHANGED');
152 app_exception.raise_exception;
153 end if;
154 end if;
155 end loop;
156 return;
157
158 END LOCK_ROW;
159
160 procedure update_row(
161 p_ui_comp_id in number,
162 p_last_updated_by in number,
163 p_last_update_date in date,
164 p_last_update_login in number,
165 p_ui_comp_catg_code in varchar2,
166 p_form_comp_code in varchar2,
167 p_form_comp_avail_no in number,
168 p_property_class in varchar2,
169 p_ui_comp_label in varchar2,
170 p_ui_comp_desc in varchar2
171 ) is
172 begin
173 update IEU_WP_UI_COMPONENTS_B set
174 object_version_number = object_version_number+1,
175 ui_comp_catg_code = p_ui_comp_catg_code,
176 form_comp_code = p_form_comp_code,
177 form_comp_avail_no = p_form_comp_avail_no,
178 property_class = p_property_class,
179 last_update_date = p_last_update_date,
180 last_updated_by = p_last_updated_by,
181 last_update_login = p_last_update_login
182 where ui_comp_id = p_ui_comp_id;
183
184 if (sql%notfound) then
185 raise no_data_found;
186 end if;
187
188 update IEU_WP_UI_COMPONENTS_TL set
189 ui_comp_label = p_ui_comp_label,
190 ui_comp_desc = p_ui_comp_desc,
191 last_update_date = p_last_update_date,
192 last_updated_by = p_last_updated_by,
193 last_update_login = p_last_update_login,
194 object_version_number = object_version_number+1,
195 source_lang = userenv('LANG')
196 where ui_comp_id = p_ui_comp_id
197 and userenv('LANG') in (LANGUAGE, SOURCE_LANG);
198
199 if (sql%notfound) then
200 raise no_data_found;
201 end if;
202
203 END UPDATE_ROW;
204
205
206 procedure delete_row(
207 p_ui_comp_id in number
208 ) is
209 begin
210 delete from IEU_WP_UI_COMPONENTS_TL
211 where ui_comp_id = p_ui_comp_id;
212
213 if (sql%notfound) then
214 raise no_data_found;
215 end if;
216
217 delete from ieu_wp_ui_components_b
218 where ui_comp_id = p_ui_comp_id;
219
220 if (sql%notfound) then
221 raise no_data_found;
222 end if;
223
224 END DELETE_ROW;
225
226
227 procedure add_language is
228
229 begin
230 delete from IEU_WP_UI_COMPONENTS_TL t
231 where not exists
232 (select null
233 from ieu_wp_ui_components_b b
234 where b.ui_comp_id = t.ui_comp_id);
235
236 update ieu_wp_ui_components_tl t
237 set (ui_comp_label, ui_comp_desc)
238 = (select b.ui_comp_label,
239 b.ui_comp_desc
240 from ieu_wp_ui_components_tl b
241 where b.ui_comp_id = t.ui_comp_id
242 and b.language= t.source_lang)
243 where ( t.ui_comp_id, t.language )
244 in (select subt.ui_comp_id, subt.language
245 from ieu_wp_ui_components_tl subb, ieu_wp_ui_components_tl subt
246 where subb.ui_comp_id = subt.ui_comp_id
247 and subb.language = subt.source_lang
248 and (subb.ui_comp_label <> subt.ui_comp_label
249 or subb.ui_comp_desc <> subt.ui_comp_desc));
250
251 insert into ieu_wp_ui_components_tl(
252 UI_COMP_ID,
253 OBJECT_VERSION_NUMBER,
254 CREATED_BY,
255 CREATION_DATE,
256 LAST_UPDATED_BY,
257 LAST_UPDATE_DATE,
258 LAST_UPDATE_LOGIN,
259 UI_COMP_LABEL,
260 UI_COMP_DESC,
261 LANGUAGE,
262 SOURCE_LANG
263 ) select /*+ ORDERED */
264 b.ui_comp_id,
265 b.object_version_number,
266 b.created_by,
267 b.creation_date,
268 b.last_updated_by,
269 b.last_update_date,
270 b.last_update_login,
271 b.ui_comp_label,
272 b.ui_comp_desc,
273 l.language_code,
274 b.source_lang
275 from ieu_wp_ui_components_tl b, fnd_languages l
276 where l.installed_flag in ('I', 'B')
277 and b.language= userenv('LANG')
278 and not exists
279 (select null from ieu_wp_ui_components_tl t
280 where t.ui_comp_id = b.ui_comp_id
281 and t.language = l.language_code);
282
283 END ADD_LANGUAGE;
284
285
286 procedure load_row(
287 p_ui_comp_id in number,
288 p_ui_comp_catg_code in varchar2,
289 p_form_comp_code in varchar2,
290 p_form_comp_avail_no in number,
291 p_property_class in varchar2,
292 p_ui_comp_label in varchar2,
293 p_ui_comp_desc in varchar2,
294 p_owner in varchar2
295 ) is
296
297 l_user_id number := 0;
298 l_rowid varchar2(50);
299
300 begin
301 if (p_owner = 'SEED') then
302 l_user_id := 1;
303 end if;
304
305 begin
306 update_row(
307 p_ui_comp_id => p_ui_comp_id,
308 --p_last_updated_by => l_user_id,
309 p_last_updated_by => fnd_load_util.owner_id(p_owner),
310 p_last_update_date => sysdate,
311 p_last_update_login => 0,
312 p_ui_comp_catg_code => p_ui_comp_catg_code,
313 p_form_comp_code => p_form_comp_code,
314 p_form_comp_avail_no => p_form_comp_avail_no,
315 p_property_class => p_property_class,
316 p_ui_comp_label => p_ui_comp_label,
317 p_ui_comp_desc => p_ui_comp_desc);
318
319 if (sql%notfound) then
320 raise no_data_found;
321 end if;
322
323 exception when no_data_found then
324 insert_row(
325 x_rowid => l_rowid,
326 p_ui_comp_id => p_ui_comp_id,
327 p_object_version_number => 1,
328 --p_created_by => l_user_id,
329 p_created_by => fnd_load_util.owner_id(p_owner),
330 p_creation_date => sysdate,
331 --p_last_updated_by => l_user_id,
332 p_last_updated_by => fnd_load_util.owner_id(p_owner),
333 p_last_update_date => sysdate,
334 p_last_update_login => 0,
335 p_ui_comp_catg_code => p_ui_comp_catg_code,
336 p_form_comp_code => p_form_comp_code,
337 p_form_comp_avail_no => p_form_comp_avail_no,
338 p_property_class => p_property_class,
339 p_ui_comp_label => p_ui_comp_label,
340 p_ui_comp_desc => p_ui_comp_desc);
341 end;
342
343 END LOAD_ROW;
344
345 procedure translate_row(
346 p_ui_comp_id in number,
347 p_ui_comp_label in varchar2,
348 p_ui_comp_desc in varchar2,
349 p_owner in varchar2
350 ) is
351 begin
352 update IEU_WP_UI_COMPONENTS_TL
353 set source_lang = userenv('LANG'),
354 ui_comp_label = p_ui_comp_label,
355 ui_comp_desc = p_ui_comp_desc,
356 last_update_date = sysdate,
357 --last_updated_by = decode(p_owner, 'SEED', 1, 0),
358 last_updated_by = fnd_load_util.owner_id(p_owner),
359 last_update_login = 0
360 where (ui_comp_id = p_ui_comp_id)
361 and (userenv('LANG') IN (LANGUAGE, SOURCE_LANG));
362
363 if (sql%notfound) then
364 raise no_data_found;
365 end if;
366
367 END TRANSLATE_ROW;
368
369 procedure load_seed_row(
370 p_upload_mode in varchar2,
371 p_ui_comp_id in number,
372 p_ui_comp_catg_code in varchar2,
373 p_form_comp_code in varchar2,
374 p_form_comp_avail_no in number,
375 p_property_class in varchar2,
376 p_ui_comp_label in varchar2,
377 p_ui_comp_desc in varchar2,
378 p_owner in varchar2
379 ) is
380 begin
381
382 if (p_upload_mode = 'NLS') then
383 translate_row(
384 p_ui_comp_id,
385 p_ui_comp_label,
386 p_ui_comp_desc,
387 p_owner);
388 else
389 load_row(
390 p_ui_comp_id,
391 p_ui_comp_catg_code,
392 p_form_comp_code,
393 p_form_comp_avail_no,
394 p_property_class,
395 p_ui_comp_label,
396 p_ui_comp_desc,
397 p_owner);
398 end if;
399
400 end load_seed_row;
401
402
403 END IEU_WP_UI_COMPONENTS_PKG;