[Home] [Help]
PACKAGE BODY: APPS.HR_TMT_BUS
Source
1 Package Body hr_tmt_bus as
2 /* $Header: hrtmtrhi.pkb 115.4 2002/12/03 12:10:08 raranjan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_tmt_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_template_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_template_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_tmp_bus.set_security_group_id
32 (p_form_template_id => p_form_template_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_template_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_tmp_bus.return_legislation_code
57 (p_form_template_id => p_form_template_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_tmt_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_tmt_shd.api_updating
105 (p_form_template_id => p_rec.form_template_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_form_template_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_tmt_shd.api_updating
147 (p_form_template_id => p_form_template_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_tmt_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_user_template_name >------------------------|
200 -- ----------------------------------------------------------------------------
201 Procedure chk_user_template_name
202 (p_form_template_id in number
203 ,p_language in varchar2
204 ,p_user_template_name in varchar2
205 ) is
206 --
207 l_proc varchar2(72) := g_package || 'chk_user_template_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_template_name'
218 ,p_argument_value => p_user_template_name
219 );
220 --
221 hr_utility.set_location('Leaving:'||l_proc, 100);
222 End chk_user_template_name;
223 --
224 -- ----------------------------------------------------------------------------
225 -- |---------------------------< chk_description >----------------------------|
226 -- ----------------------------------------------------------------------------
227 Procedure chk_description
228 (p_form_template_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_tmt_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_tmt_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_template_id => p_rec.form_template_id
282 ,p_language => p_rec.language
283 ,p_source_lang => p_rec.source_lang
284 );
285 --
286 chk_user_template_name
287 (p_form_template_id => p_rec.form_template_id
288 ,p_language => p_rec.language
289 ,p_user_template_name => p_rec.user_template_name
290 );
291 --
292 chk_description
293 (p_form_template_id => p_rec.form_template_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_tmt_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_template_id => p_rec.form_template_id
322 ,p_language => p_rec.language
323 ,p_source_lang => p_rec.source_lang
324 );
325 --
326 chk_user_template_name
327 (p_form_template_id => p_rec.form_template_id
328 ,p_language => p_rec.language
329 ,p_user_template_name => p_rec.user_template_name
330 );
331 --
332 chk_description
333 (p_form_template_id => p_rec.form_template_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_tmt_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_tmt_bus;