[Home] [Help]
PACKAGE BODY: APPS.HR_WPT_BUS
Source
1 Package Body hr_wpt_bus as
2 /* $Header: hrwptrhi.pkb 115.4 2002/12/03 14:23:01 raranjan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_wpt_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_window_property_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_window_property_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_wnp_bus.set_security_group_id
32 (p_window_property_id => p_window_property_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_window_property_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 l_legislation_code := hr_wnp_bus.return_legislation_code
57 (p_window_property_id => p_window_property_id
58 );
59 --
60 hr_utility.set_location(' Leaving:'|| l_proc, 40);
61 return l_legislation_code;
62 end return_legislation_code;
63 --
64 -- ----------------------------------------------------------------------------
65 -- |-----------------------< chk_non_updateable_args >------------------------|
66 -- ----------------------------------------------------------------------------
67 -- {Start Of Comments}
68 --
69 -- Description:
70 -- This procedure is used to ensure that non updateable attributes have
71 -- not been updated. If an attribute has been updated an error is generated.
72 --
73 -- Pre Conditions:
74 -- g_old_rec has been populated with details of the values currently in
75 -- the database.
76 --
77 -- In Arguments:
78 -- p_rec has been populated with the updated values the user would like the
79 -- record set to.
80 --
81 -- Post Success:
82 -- Processing continues if all the non updateable attributes have not
83 -- changed.
84 --
85 -- Post Failure:
86 -- An application error is raised if any of the non updatable attributes
87 -- have been altered.
88 --
89 -- {End Of Comments}
90 -- ----------------------------------------------------------------------------
91 Procedure chk_non_updateable_args
92 (p_rec in hr_wpt_shd.g_rec_type
93 ) IS
94 --
95 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
96 l_error EXCEPTION;
97 l_argument varchar2(30);
98 --
99 Begin
100 --
101 -- Only proceed with the validation if a row exists for the current
102 -- record in the HR Schema.
103 --
104 IF NOT hr_wpt_shd.api_updating
105 (p_window_property_id => p_rec.window_property_id
106 ,p_language => p_rec.language
107 ) THEN
108 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
109 fnd_message.set_token('PROCEDURE ', l_proc);
110 fnd_message.set_token('STEP ', '5');
111 fnd_message.raise_error;
112 END IF;
113 --
114 -- No non-updateable arguments
115 --
116 EXCEPTION
117 WHEN l_error THEN
118 hr_api.argument_changed_error
119 (p_api_name => l_proc
120 ,p_argument => l_argument);
121 WHEN OTHERS THEN
122 RAISE;
123 End chk_non_updateable_args;
124 --
125 -- ----------------------------------------------------------------------------
126 -- |---------------------------< chk_source_lang >----------------------------|
127 -- ----------------------------------------------------------------------------
128 Procedure chk_source_lang
129 (p_window_property_id in number
130 ,p_language in varchar2
131 ,p_source_lang in varchar2
132 ) is
133 --
134 cursor csr_language is
135 select l.installed_flag
136 from fnd_languages l
137 where l.language_code = p_source_lang;
138 --
139 l_proc varchar2(72) := g_package || 'chk_source_lang';
140 l_api_updating boolean;
141 l_installed_flag varchar2(30);
142 --
143 Begin
144 hr_utility.set_location('Entering:'||l_proc, 10);
145 --
146 l_api_updating := hr_wpt_shd.api_updating
147 (p_window_property_id => p_window_property_id
148 ,p_language => p_language
149 );
150 hr_utility.set_location(l_proc,20);
151 --
152 -- Only proceed with SQL validation if absolutely necessary
153 --
154 if ( ( l_api_updating
155 and nvl(hr_wpt_shd.g_old_rec.source_lang,hr_api.g_varchar2) <>
156 nvl(p_source_lang,hr_api.g_varchar2))
157 or (NOT l_api_updating)) then
158 --
159 hr_utility.set_location(l_proc,30);
160 --
161 -- Check value has been passed
162 --
163 hr_api.mandatory_arg_error
164 (p_api_name => l_proc
165 ,p_argument => 'source_lang'
166 ,p_argument_value => p_source_lang
167 );
168 --
169 hr_utility.set_location(l_proc,40);
170 --
171 -- Check source language exists and is base or installed language
172 --
173 open csr_language;
174 fetch csr_language into l_installed_flag;
175 if csr_language%notfound then
176 close csr_language;
177 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
178 fnd_message.set_token('PROCEDURE', l_proc);
179 fnd_message.set_token('STEP','10');
180 fnd_message.raise_error;
181 end if;
182 close csr_language;
183 --
184 /* 1653358: Not necessary
185 if nvl(l_installed_flag,hr_api.g_varchar2) not in ('I','B') then
186 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
187 fnd_message.set_token('PROCEDURE', l_proc);
188 fnd_message.set_token('STEP','20');
189 fnd_message.raise_error;
190 end if;
191 */
192 --
193 end if;
194 --
195 hr_utility.set_location('Leaving:'||l_proc, 100);
196 End chk_source_lang;
197 --
198 -- ----------------------------------------------------------------------------
199 -- |------------------------------< chk_title >-------------------------------|
200 -- ----------------------------------------------------------------------------
201 Procedure chk_title
202 (p_window_property_id in number
203 ,p_language in varchar2
204 ,p_title in varchar2
205 ) is
206 --
207 l_proc varchar2(72) := g_package || 'chk_title';
208 l_api_updating boolean;
209 --
210 Begin
211 hr_utility.set_location('Entering:'||l_proc, 10);
212 --
213 -- No additional validation
214 --
215 null;
216 --
217 hr_utility.set_location('Leaving:'||l_proc, 100);
218 End chk_title;
219 --
220 -- ----------------------------------------------------------------------------
221 -- |------------------------------< chk_delete >------------------------------|
222 -- ----------------------------------------------------------------------------
223 Procedure chk_delete
224 (p_rec in hr_wpt_shd.g_rec_type
225 ) is
226 --
227 l_proc varchar2(72) := g_package||'chk_delete';
228 --
229 Begin
230 hr_utility.set_location('Entering:'||l_proc, 5);
231 --
232 -- No additional validation required
233 --
234 null;
235 --
236 hr_utility.set_location(' Leaving:'||l_proc, 10);
237 End chk_delete;
238 --
239 -- ----------------------------------------------------------------------------
240 -- |---------------------------< insert_validate >----------------------------|
241 -- ----------------------------------------------------------------------------
242 Procedure insert_validate
243 (p_rec in hr_wpt_shd.g_rec_type
244 ) is
245 --
246 l_proc varchar2(72) := g_package||'insert_validate';
247 --
248 Begin
249 hr_utility.set_location('Entering:'||l_proc, 5);
250 --
251 -- Call all supporting business operations
252 -- No business group context. HR_STANDARD_LOOKUPS used for validation.
253 --
254 chk_source_lang
255 (p_window_property_id => p_rec.window_property_id
256 ,p_language => p_rec.language
257 ,p_source_lang => p_rec.source_lang
258 );
259 --
260 chk_title
261 (p_window_property_id => p_rec.window_property_id
262 ,p_language => p_rec.language
263 ,p_title => p_rec.title
264 );
265 --
266 hr_utility.set_location(' Leaving:'||l_proc, 10);
267 End insert_validate;
268 --
269 -- ----------------------------------------------------------------------------
270 -- |---------------------------< update_validate >----------------------------|
271 -- ----------------------------------------------------------------------------
272 Procedure update_validate
273 (p_rec in hr_wpt_shd.g_rec_type
274 ) is
275 --
276 l_proc varchar2(72) := g_package||'update_validate';
277 --
278 Begin
279 hr_utility.set_location('Entering:'||l_proc, 5);
280 --
281 -- Call all supporting business operations
282 -- No business group context. HR_STANDARD_LOOKUPS used for validation.
283 --
284 chk_non_updateable_args
285 (p_rec => p_rec
286 );
287 --
288 chk_source_lang
289 (p_window_property_id => p_rec.window_property_id
290 ,p_language => p_rec.language
291 ,p_source_lang => p_rec.source_lang
292 );
293 --
294 chk_title
295 (p_window_property_id => p_rec.window_property_id
296 ,p_language => p_rec.language
297 ,p_title => p_rec.title
298 );
299 --
300 hr_utility.set_location(' Leaving:'||l_proc, 10);
301 End update_validate;
302 --
303 -- ----------------------------------------------------------------------------
304 -- |---------------------------< delete_validate >----------------------------|
305 -- ----------------------------------------------------------------------------
306 Procedure delete_validate
307 (p_rec in hr_wpt_shd.g_rec_type
308 ) is
309 --
310 l_proc varchar2(72) := g_package||'delete_validate';
311 --
312 Begin
313 hr_utility.set_location('Entering:'||l_proc, 5);
314 --
315 -- Call all supporting business operations
316 --
317 chk_delete
318 (p_rec => p_rec
319 );
320 --
321 hr_utility.set_location(' Leaving:'||l_proc, 10);
322 End delete_validate;
323 --
324 end hr_wpt_bus;