[Home] [Help]
PACKAGE BODY: APPS.HR_FWT_BUS
Source
1 Package Body hr_fwt_bus as
2 /* $Header: hrfwtrhi.pkb 115.3 2002/12/03 13:46:29 hjonnala noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_fwt_bus.'; -- Global package name
9 --
10 -- The following two global variables are only to be
11 -- used by the return_legislation_code function.
12 --
13 g_legislation_code varchar2(150) default null;
14 g_form_window_id number default null;
15 g_language varchar2(4) default null;
16 --
17 -- ---------------------------------------------------------------------------
18 -- |----------------------< set_security_group_id >--------------------------|
19 -- ---------------------------------------------------------------------------
20 --
21 Procedure set_security_group_id
22 (p_form_window_id in number
23 ) is
24 --
25 l_proc varchar2(72) := g_package||'set_security_group_id';
26 --
27 begin
28 --
29 hr_utility.set_location('Entering:'|| l_proc, 10);
30 --
31 hr_fwn_bus.set_security_group_id
32 (p_form_window_id => p_form_window_id
33 );
34 --
35 hr_utility.set_location(' Leaving:'|| l_proc, 20);
36 --
37 end set_security_group_id;
38 --
39 -- ---------------------------------------------------------------------------
40 -- |---------------------< return_legislation_code >-------------------------|
41 -- ---------------------------------------------------------------------------
42 --
43 Function return_legislation_code
44 (p_form_window_id in number
45 ,p_language in varchar2
46 )
47 Return Varchar2 Is
48 --
49 l_legislation_code varchar2(150);
50 l_proc varchar2(72) := g_package||'return_legislation_code';
51 --
52 Begin
53 --
54 hr_utility.set_location('Entering:'|| l_proc, 10);
55 --
56 -- Legislation code not available for form windows
57 --
58 l_legislation_code := hr_fwn_bus.return_legislation_code
59 (p_form_window_id => p_form_window_id
60 );
61 --
62 hr_utility.set_location(' Leaving:'|| l_proc, 40);
63 return l_legislation_code;
64 end return_legislation_code;
65 --
66 -- ----------------------------------------------------------------------------
67 -- |-----------------------< chk_non_updateable_args >------------------------|
68 -- ----------------------------------------------------------------------------
69 -- {Start Of Comments}
70 --
71 -- Description:
72 -- This procedure is used to ensure that non updateable attributes have
73 -- not been updated. If an attribute has been updated an error is generated.
74 --
75 -- Pre Conditions:
76 -- g_old_rec has been populated with details of the values currently in
77 -- the database.
78 --
79 -- In Arguments:
80 -- p_rec has been populated with the updated values the user would like the
81 -- record set to.
82 --
83 -- Post Success:
84 -- Processing continues if all the non updateable attributes have not
85 -- changed.
86 --
87 -- Post Failure:
88 -- An application error is raised if any of the non updatable attributes
89 -- have been altered.
90 --
91 -- {End Of Comments}
92 -- ----------------------------------------------------------------------------
93 Procedure chk_non_updateable_args
94 (p_rec in hr_fwt_shd.g_rec_type
95 ) IS
96 --
97 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
98 l_error EXCEPTION;
99 l_argument varchar2(30);
100 --
101 Begin
102 --
103 -- Only proceed with the validation if a row exists for the current
104 -- record in the HR Schema.
105 --
106 IF NOT hr_fwt_shd.api_updating
107 (p_form_window_id => p_rec.form_window_id
108 ,p_language => p_rec.language
109 ) THEN
110 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
111 fnd_message.set_token('PROCEDURE ', l_proc);
112 fnd_message.set_token('STEP ', '5');
113 fnd_message.raise_error;
114 END IF;
115 --
116 -- No non-updateable arguments
117 --
118 EXCEPTION
119 WHEN l_error THEN
120 hr_api.argument_changed_error
121 (p_api_name => l_proc
122 ,p_argument => l_argument);
123 WHEN OTHERS THEN
124 RAISE;
125 End chk_non_updateable_args;
126 --
127 -- ----------------------------------------------------------------------------
128 -- |---------------------------< chk_source_lang >----------------------------|
129 -- ----------------------------------------------------------------------------
130 Procedure chk_source_lang
131 (p_form_window_id in number
132 ,p_language in varchar2
133 ,p_source_lang in varchar2
134 ) is
135 --
136 cursor csr_language is
137 select l.installed_flag
138 from fnd_languages l
139 where l.language_code = p_source_lang;
140 --
141 l_proc varchar2(72) := g_package || 'chk_source_lang';
142 l_api_updating boolean;
143 l_installed_flag varchar2(30);
144 --
145 Begin
146 hr_utility.set_location('Entering:'||l_proc, 10);
147 --
148 l_api_updating := hr_fwt_shd.api_updating
149 (p_form_window_id => p_form_window_id
150 ,p_language => p_language
151 );
152 hr_utility.set_location(l_proc,20);
153 --
154 -- Only proceed with SQL validation if absolutely necessary
155 --
156 if ( ( l_api_updating
157 and nvl(hr_fwt_shd.g_old_rec.source_lang,hr_api.g_varchar2) <>
158 nvl(p_source_lang,hr_api.g_varchar2))
159 or (NOT l_api_updating)) then
160 --
161 hr_utility.set_location(l_proc,30);
162 --
163 -- Check value has been passed
164 --
165 hr_api.mandatory_arg_error
166 (p_api_name => l_proc
167 ,p_argument => 'source_lang'
168 ,p_argument_value => p_source_lang
169 );
170 --
171 hr_utility.set_location(l_proc,40);
172 --
173 -- Check source language exists and is base or installed language
174 --
175 open csr_language;
176 fetch csr_language into l_installed_flag;
177 if csr_language%notfound then
178 close csr_language;
179 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
180 fnd_message.set_token('PROCEDURE', l_proc);
181 fnd_message.set_token('STEP','10');
182 fnd_message.raise_error;
183 end if;
184 close csr_language;
185 --
186 if nvl(l_installed_flag,hr_api.g_varchar2) not in ('I','B') then
187 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
188 fnd_message.set_token('PROCEDURE', l_proc);
189 fnd_message.set_token('STEP','20');
190 fnd_message.raise_error;
191 end if;
192 --
193 end if;
194 --
195 hr_utility.set_location('Leaving:'||l_proc, 100);
196 End chk_source_lang;
197 --
198 -- ----------------------------------------------------------------------------
199 -- |-------------------------< chk_user_window_name >-------------------------|
200 -- ----------------------------------------------------------------------------
201 Procedure chk_user_window_name
202 (p_form_window_id in number
203 ,p_language in varchar2
204 ,p_user_window_name in varchar2
205 ) is
206 --
207 l_proc varchar2(72) := g_package || 'chk_user_window_name';
208 l_api_updating boolean;
209 --
210 Begin
211 hr_utility.set_location('Entering:'||l_proc, 10);
212 --
213 -- Check value has been passed
214 --
215 hr_api.mandatory_arg_error
216 (p_api_name => l_proc
217 ,p_argument => 'user_window_name'
218 ,p_argument_value => p_user_window_name
219 );
220 --
221 hr_utility.set_location('Leaving:'||l_proc, 100);
222 End chk_user_window_name;
223 --
224 -- ----------------------------------------------------------------------------
225 -- |---------------------------< chk_description >----------------------------|
226 -- ----------------------------------------------------------------------------
227 Procedure chk_description
228 (p_form_window_id in number
229 ,p_language in varchar2
230 ,p_description in varchar2
231 ) is
232 --
233 l_proc varchar2(72) := g_package || 'chk_description';
234 l_api_updating boolean;
235 --
236 Begin
237 hr_utility.set_location('Entering:'||l_proc, 10);
238 --
239 -- No additional validation required
240 --
241 null;
242 --
243 hr_utility.set_location('Leaving:'||l_proc, 100);
244 End chk_description;
245 --
246 -- ----------------------------------------------------------------------------
247 -- |------------------------------< chk_delete >------------------------------|
248 -- ----------------------------------------------------------------------------
249 Procedure chk_delete
250 (p_rec in hr_fwt_shd.g_rec_type
251 ) is
252 --
253 l_proc varchar2(72) := g_package||'chk_delete';
254 --
255 Begin
256 hr_utility.set_location('Entering:'||l_proc, 5);
257 --
258 -- No additional validation required
259 --
260 null;
261 --
262 hr_utility.set_location(' Leaving:'||l_proc, 10);
263 End chk_delete;
264 --
265 -- ----------------------------------------------------------------------------
266 -- |---------------------------< insert_validate >----------------------------|
267 -- ----------------------------------------------------------------------------
268 Procedure insert_validate
269 (p_rec in hr_fwt_shd.g_rec_type
270 ) is
271 --
272 l_proc varchar2(72) := g_package||'insert_validate';
273 --
274 Begin
275 hr_utility.set_location('Entering:'||l_proc, 5);
276 --
277 -- Call all supporting business operations
278 -- No business group context. HR_STANDARD_LOOKUPS used for validation.
279 --
280 chk_source_lang
281 (p_form_window_id => p_rec.form_window_id
282 ,p_language => p_rec.language
283 ,p_source_lang => p_rec.source_lang
284 );
285 --
286 chk_user_window_name
287 (p_form_window_id => p_rec.form_window_id
288 ,p_language => p_rec.language
289 ,p_user_window_name => p_rec.user_window_name
290 );
291 --
292 chk_description
293 (p_form_window_id => p_rec.form_window_id
294 ,p_language => p_rec.language
295 ,p_description => p_rec.description
296 );
297 --
298 hr_utility.set_location(' Leaving:'||l_proc, 10);
299 End insert_validate;
300 --
301 -- ----------------------------------------------------------------------------
302 -- |---------------------------< update_validate >----------------------------|
303 -- ----------------------------------------------------------------------------
304 Procedure update_validate
305 (p_rec in hr_fwt_shd.g_rec_type
306 ) is
307 --
308 l_proc varchar2(72) := g_package||'update_validate';
309 --
310 Begin
311 hr_utility.set_location('Entering:'||l_proc, 5);
312 --
313 -- Call all supporting business operations
314 -- No business group context. HR_STANDARD_LOOKUPS used for validation.
315 --
316 chk_non_updateable_args
317 (p_rec => p_rec
318 );
319 --
320 chk_source_lang
321 (p_form_window_id => p_rec.form_window_id
322 ,p_language => p_rec.language
323 ,p_source_lang => p_rec.source_lang
324 );
325 --
326 chk_user_window_name
327 (p_form_window_id => p_rec.form_window_id
328 ,p_language => p_rec.language
329 ,p_user_window_name => p_rec.user_window_name
330 );
331 --
332 chk_description
333 (p_form_window_id => p_rec.form_window_id
334 ,p_language => p_rec.language
335 ,p_description => p_rec.description
336 );
337 --
338 hr_utility.set_location(' Leaving:'||l_proc, 10);
339 End update_validate;
340 --
341 -- ----------------------------------------------------------------------------
342 -- |---------------------------< delete_validate >----------------------------|
343 -- ----------------------------------------------------------------------------
344 Procedure delete_validate
345 (p_rec in hr_fwt_shd.g_rec_type
346 ) is
347 --
348 l_proc varchar2(72) := g_package||'delete_validate';
349 --
350 Begin
351 hr_utility.set_location('Entering:'||l_proc, 5);
352 --
353 -- Call all supporting business operations
354 --
355 chk_delete
356 (p_rec => p_rec
357 );
358 --
359 hr_utility.set_location(' Leaving:'||l_proc, 10);
360 End delete_validate;
361 --
362 end hr_fwt_bus;