4 -- ----------------------------------------------------------------------------
1 Package Body per_fdl_bus as
2 /* $Header: pefdlrhi.pkb 120.0.12020000.1 2013/02/27 12:35:26 shpatro noship $ */
3 --
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_fdl_bus.'; -- Global package name
9
10 --
11 -- The following two global variables are only to be
12 -- used by the return_legislation_code function.
13 --
14 g_legislation_code varchar2(150) default null;
15 g_fnd_doc_link_id number default null;
16
17
18 --
19 -- ---------------------------------------------------------------------------
20 -- |----------------------< set_security_group_id >--------------------------|
21 -- ---------------------------------------------------------------------------
22 --
23 Procedure set_security_group_id
24 (p_fnd_doc_link_id in number
25 ,p_associated_column1 in varchar2 default null
26 ) is
27 --
28 -- Declare cursor
29 --
30 -- EDIT_HERE In the following cursor statement add join(s) between
31 -- per_fnd_doc_links and PER_BUSINESS_GROUPS_PERF
32 -- so that the security_group_id for
33 -- the current business group context can be derived.
34 -- Remove this comment when the edit has been completed.
35 cursor csr_sec_grp is
36 select pbg.security_group_id,
37 pbg.legislation_code
38 from per_business_groups_perf pbg
39 , per_fnd_doc_links fdl
40 -- , EDIT_HERE table_name(s) 333
41 where fdl.fnd_doc_link_id = p_fnd_doc_link_id;
42 -- and pbg.business_group_id = EDIT_HERE 333.business_group_id;
43
44 --
45 -- Declare local variables
46 --
47 l_security_group_id number;
48 l_proc varchar2(72) := g_package||'set_security_group_id';
49 l_legislation_code varchar2(150);
50 --
51 begin
52 --
53 hr_utility.set_location('Entering:'|| l_proc, 10);
54 --
55 -- Ensure that all the mandatory parameter are not null
56 --
57 hr_api.mandatory_arg_error
58 (p_api_name => l_proc
59 ,p_argument => 'fnd_doc_link_id'
60 ,p_argument_value => p_fnd_doc_link_id
61 );
62
63 --
64 open csr_sec_grp;
65 fetch csr_sec_grp into l_security_group_id
66 , l_legislation_code;
67 --
68 if csr_sec_grp%notfound then
69 --
70 close csr_sec_grp;
71 --
72 -- The primary key is invalid therefore we must error
73 --
74 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
75 hr_multi_message.add
76 (p_associated_column1
77 => nvl(p_associated_column1,'FND_DOC_LINK_ID')
78 );
79 --
80 else
81 close csr_sec_grp;
82 --
83 -- Set the security_group_id in CLIENT_INFO
84 --
85 hr_api.set_security_group_id
86 (p_security_group_id => l_security_group_id
87 );
88 --
89 -- Set the sessions legislation context in HR_SESSION_DATA
90 --
91 hr_api.set_legislation_context(l_legislation_code);
92 end if;
93 --
94 hr_utility.set_location(' Leaving:'|| l_proc, 20);
95 --
96 end set_security_group_id;
97
98 --
99 -- ---------------------------------------------------------------------------
100 -- |---------------------< return_legislation_code >-------------------------|
101 -- ---------------------------------------------------------------------------
102 --
103 Function return_legislation_code
104 (p_fnd_doc_link_id in number
105 )
106 Return Varchar2 Is
107 --
108 -- Declare cursor
109 --
110 -- EDIT_HERE In the following cursor statement add join(s) between
111 -- per_fnd_doc_links and PER_BUSINESS_GROUPS_PERF
112 -- so that the legislation_code for
113 -- the current business group context can be derived.
114 -- Remove this comment when the edit has been completed.
115 cursor csr_leg_code is
116 select pbg.legislation_code
117 from per_business_groups_perf pbg
118 , per_fnd_doc_links fdl
122
119 -- , EDIT_HERE table_name(s) 333
120 where fdl.fnd_doc_link_id = p_fnd_doc_link_id;
121 -- and pbg.business_group_id = EDIT_HERE 333.business_group_id;
123 --
124 -- Declare local variables
125 --
126 l_legislation_code varchar2(150);
127 l_proc varchar2(72) := g_package||'return_legislation_code';
128 --
129 Begin
130 --
131 hr_utility.set_location('Entering:'|| l_proc, 10);
132 --
133 -- Ensure that all the mandatory parameter are not null
134 --
135 hr_api.mandatory_arg_error
136 (p_api_name => l_proc
137 ,p_argument => 'fnd_doc_link_id'
138 ,p_argument_value => p_fnd_doc_link_id
139 );
140
141 --
142 if ( nvl(per_fdl_bus.g_fnd_doc_link_id, hr_api.g_number)
143 = p_fnd_doc_link_id) then
144 --
145 -- The legislation code has already been found with a previous
146 -- call to this function. Just return the value in the global
147 -- variable.
148 --
149 l_legislation_code := per_fdl_bus.g_legislation_code;
150 hr_utility.set_location(l_proc, 20);
151 else
152 --
153 -- The ID is different to the last call to this function
154 -- or this is the first call to this function.
155 --
156 open csr_leg_code;
157 fetch csr_leg_code into l_legislation_code;
158 --
159 if csr_leg_code%notfound then
160 --
161 -- The primary key is invalid therefore we must error
162 --
163 close csr_leg_code;
164 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
165 fnd_message.raise_error;
166 end if;
167 hr_utility.set_location(l_proc,30);
168 --
169 -- Set the global variables so the values are
170 -- available for the next call to this function.
171 --
172 close csr_leg_code;
173 per_fdl_bus.g_fnd_doc_link_id := p_fnd_doc_link_id;
174
175 per_fdl_bus.g_legislation_code := l_legislation_code;
176 end if;
177 hr_utility.set_location(' Leaving:'|| l_proc, 40);
178 return l_legislation_code;
179 end return_legislation_code;
180 --
181 -- ----------------------------------------------------------------------------
182 -- |-----------------------------< chk_ddf >----------------------------------|
183 -- ----------------------------------------------------------------------------
184 --
185 -- Description:
186 -- Validates all the Developer Descriptive Flexfield values.
187 --
188 -- Prerequisites:
189 -- All other columns have been validated. Must be called as the
190 -- last step from insert_validate and update_validate.
191 --
192 -- In Arguments:
193 -- p_rec
194 --
195 -- Post Success:
196 -- If the Developer Descriptive Flexfield structure column and data values
197 -- are all valid this procedure will end normally and processing will
198 -- continue.
199 --
200 -- Post Failure:
201 -- If the Developer Descriptive Flexfield structure column value or any of
202 -- the data values are invalid then an application error is raised as
203 -- a PL/SQL exception.
204 --
205 -- Access Status:
206 -- Internal Row Handler Use Only.
207 --
208 -- ----------------------------------------------------------------------------
209 procedure chk_ddf
210 (p_rec in per_fdl_shd.g_rec_type
211 ) is
212 --
213 l_proc varchar2(72) := g_package || 'chk_ddf';
214 --
215 begin
216 hr_utility.set_location('Entering:'||l_proc,10);
217 --
218 if ((p_rec.fnd_doc_link_id is not null) and (
219 nvl(per_fdl_shd.g_old_rec.fdl_information_category, hr_api.g_varchar2) <>
223 nvl(per_fdl_shd.g_old_rec.fdl_information2, hr_api.g_varchar2) <>
220 nvl(p_rec.fdl_information_category, hr_api.g_varchar2) or
221 nvl(per_fdl_shd.g_old_rec.fdl_information1, hr_api.g_varchar2) <>
222 nvl(p_rec.fdl_information1, hr_api.g_varchar2) or
224 nvl(p_rec.fdl_information2, hr_api.g_varchar2) or
225 nvl(per_fdl_shd.g_old_rec.fdl_information3, hr_api.g_varchar2) <>
226 nvl(p_rec.fdl_information3, hr_api.g_varchar2) or
227 nvl(per_fdl_shd.g_old_rec.fdl_information4, hr_api.g_varchar2) <>
228 nvl(p_rec.fdl_information4, hr_api.g_varchar2) or
229 nvl(per_fdl_shd.g_old_rec.fdl_information5, hr_api.g_varchar2) <>
230 nvl(p_rec.fdl_information5, hr_api.g_varchar2) or
231 nvl(per_fdl_shd.g_old_rec.fdl_information6, hr_api.g_varchar2) <>
232 nvl(p_rec.fdl_information6, hr_api.g_varchar2) or
233 nvl(per_fdl_shd.g_old_rec.fdl_information7, hr_api.g_varchar2) <>
234 nvl(p_rec.fdl_information7, hr_api.g_varchar2) or
235 nvl(per_fdl_shd.g_old_rec.fdl_information8, hr_api.g_varchar2) <>
236 nvl(p_rec.fdl_information8, hr_api.g_varchar2) or
237 nvl(per_fdl_shd.g_old_rec.fdl_information9, hr_api.g_varchar2) <>
238 nvl(p_rec.fdl_information9, hr_api.g_varchar2) or
239 nvl(per_fdl_shd.g_old_rec.fdl_information10, hr_api.g_varchar2) <>
240 nvl(p_rec.fdl_information10, hr_api.g_varchar2) ))
241 or (p_rec.fnd_doc_link_id is null) then
242 --
243 -- Only execute the validation if absolutely necessary:
244 -- a) During update, the structure column value or any
245 -- of the attribute values have actually changed.
246 -- b) During insert.
247 -- For Future Use
248 /*hr_dflex_utility.ins_or_upd_descflex_attribs
249 (p_appl_short_name => 'PER'
250 ,p_descflex_name => 'EDIT_HERE: Enter descflex name'
251 ,p_attribute_category => p_rec.fdl_information_category
252 ,p_attribute1_name => 'FDL_INFORMATION1'
253 ,p_attribute1_value => p_rec.fdl_information1
254 ,p_attribute2_name => 'FDL_INFORMATION2'
255 ,p_attribute2_value => p_rec.fdl_information2
256 ,p_attribute3_name => 'FDL_INFORMATION3'
257 ,p_attribute3_value => p_rec.fdl_information3
258 ,p_attribute4_name => 'FDL_INFORMATION4'
259 ,p_attribute4_value => p_rec.fdl_information4
260 ,p_attribute5_name => 'FDL_INFORMATION5'
261 ,p_attribute5_value => p_rec.fdl_information5
262 ,p_attribute6_name => 'FDL_INFORMATION6'
263 ,p_attribute6_value => p_rec.fdl_information6
264 ,p_attribute7_name => 'FDL_INFORMATION7'
265 ,p_attribute7_value => p_rec.fdl_information7
266 ,p_attribute8_name => 'FDL_INFORMATION8'
267 ,p_attribute8_value => p_rec.fdl_information8
268 ,p_attribute9_name => 'FDL_INFORMATION9'
269 ,p_attribute9_value => p_rec.fdl_information9
270 ,p_attribute10_name => 'FDL_INFORMATION10'
271 ,p_attribute10_value => p_rec.fdl_information10
272
273 );
274 */
275 Null;
276 end if;
277 --
278 hr_utility.set_location(' Leaving:'||l_proc,20);
279 end chk_ddf;
280
281
282 --
283 -- ----------------------------------------------------------------------------
284 -- |-----------------------< chk_non_updateable_args >------------------------|
285 -- ----------------------------------------------------------------------------
286 -- {Start Of Comments}
287 --
288 -- Description:
289 -- This procedure is used to ensure that non updateable attributes have
290 -- not been updated. If an attribute has been updated an error is generated.
291 --
292 -- Pre Conditions:
293 -- g_old_rec has been populated with details of the values currently in
294 -- the database.
295 --
296 -- In Arguments:
297 -- p_rec has been populated with the updated values the user would like the
298 -- record set to.
299 --
300 -- Post Success:
301 -- Processing continues if all the non updateable attributes have not
302 -- changed.
303 --
304 -- Post Failure:
305 -- An application error is raised if any of the non updatable attributes
306 -- have been altered.
307 --
308 -- {End Of Comments}
309 -- ----------------------------------------------------------------------------
310 Procedure chk_non_updateable_args
311 (p_rec in per_fdl_shd.g_rec_type
312 ) IS
313 --
314 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
315 --
316 Begin
317 --
318 -- Only proceed with the validation if a row exists for the current
319 -- record in the HR Schema.
320 --
321 IF NOT per_fdl_shd.api_updating
322 (p_fnd_doc_link_id => p_rec.fnd_doc_link_id
323 ,p_object_version_number => p_rec.object_version_number
324 ) THEN
325 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
326 fnd_message.set_token('PROCEDURE ', l_proc);
327 fnd_message.set_token('STEP ', '5');
328 fnd_message.raise_error;
329 END IF;
330 --
331 -- EDIT_HERE: Add checks to ensure non-updateable args have
332 -- not been updated.
333 --
334 End chk_non_updateable_args;
335
336
337 --
338 -- ----------------------------------------------------------------------------
339 -- |---------------------------< insert_validate >----------------------------|
340 -- ----------------------------------------------------------------------------
341 Procedure insert_validate
342 (p_rec in per_fdl_shd.g_rec_type
343 ) is
344 --
345 l_proc varchar2(72) := g_package||'insert_validate';
346 --
347 Begin
348 hr_utility.set_location('Entering:'||l_proc, 5);
349 --
350 -- Call all supporting business operations
351 --
352 --
353 -- EDIT_HERE: As this table does not have a mandatory business_group_id
354 -- column, ensure client_info is populated by calling a suitable
355 -- ???_???_bus.set_security_group_id procedure, or add one of the following
356 -- comments:
357 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
358 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
359
360 --
361 -- Validate Dependent Attributes
362 --
363 --
364 per_fdl_bus.chk_ddf(p_rec);
365
366
367 --
368 hr_utility.set_location(' Leaving:'||l_proc, 10);
369 End insert_validate;
370 --
371 -- ----------------------------------------------------------------------------
372 -- |---------------------------< update_validate >----------------------------|
373 -- ----------------------------------------------------------------------------
374 Procedure update_validate
375 (p_rec in per_fdl_shd.g_rec_type
376 ) is
377 --
378 l_proc varchar2(72) := g_package||'update_validate';
379 --
380 Begin
381 hr_utility.set_location('Entering:'||l_proc, 5);
382 --
383 -- Call all supporting business operations
384 --
385 --
386 -- EDIT_HERE: As this table does not have a mandatory business_group_id
387 -- column, ensure client_info is populated by calling a suitable
388 -- ???_???_bus.set_security_group_id procedure, or add one of the following
389 -- comments:
390 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
391 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
392
393 --
394 -- Validate Dependent Attributes
395 --
396 chk_non_updateable_args
397 (p_rec => p_rec
398 );
399
400 --
401 --
402 per_fdl_bus.chk_ddf(p_rec);
403
404
405 --
406 hr_utility.set_location(' Leaving:'||l_proc, 10);
407 End update_validate;
408
409 --
410 -- ----------------------------------------------------------------------------
411 -- |---------------------------< delete_validate >----------------------------|
412 -- ----------------------------------------------------------------------------
413 Procedure delete_validate
414 (p_rec in per_fdl_shd.g_rec_type
415 ) is
416 --
417 l_proc varchar2(72) := g_package||'delete_validate';
418 --
419 Begin
420 hr_utility.set_location('Entering:'||l_proc, 5);
421 --
422
423 -- Call all supporting business operations
424 --
425 hr_utility.set_location(' Leaving:'||l_proc, 10);
426 End delete_validate;
427
428 --
429 end per_fdl_bus;