1 Package Body ben_ctk_bus as
2 /* $Header: bectkrhi.pkb 120.0 2005/05/28 01:25 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_ctk_bus.'; -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
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_group_per_in_ler_id number default null;
16 g_task_id number default null;
17 --
18 /* Commenting the following procedures thinking that they are not required.
19 If these are required, this could should be un-commented and modified
20 to fetch the right values.
21 --
22 -- ---------------------------------------------------------------------------
23 -- |----------------------< set_security_group_id >--------------------------|
24 -- ---------------------------------------------------------------------------
25 --
26 Procedure set_security_group_id
27 (p_group_per_in_ler_id in number
28 ,p_task_id in number
29 ,p_associated_column1 in varchar2 default null
30 ,p_associated_column2 in varchar2 default null
31 ) is
32 --
33 -- Declare cursor
34 --
35 -- EDIT_HERE In the following cursor statement add join(s) between
36 -- ben_cwb_person_tasks and PER_BUSINESS_GROUPS_PERF
37 -- so that the security_group_id for
38 -- the current business group context can be derived.
39 -- Remove this comment when the edit has been completed.
40 cursor csr_sec_grp is
41 select pbg.security_group_id,
42 pbg.legislation_code
43 from per_business_groups_perf pbg
44 , ben_cwb_person_tasks ctk
45 -- , EDIT_HERE table_name(s) 333
46 where ctk.group_per_in_ler_id = p_group_per_in_ler_id
47 and ctk.task_id = p_task_id;
48 -- and pbg.business_group_id = EDIT_HERE 333.business_group_id;
49 --
50 -- Declare local variables
51 --
52 l_security_group_id number;
53 l_proc varchar2(72) := g_package||'set_security_group_id';
54 l_legislation_code varchar2(150);
55 --
56 begin
57 --
58 if g_debug then
59 hr_utility.set_location('Entering:'|| l_proc, 10);
60 end if;
61 --
62 -- Ensure that all the mandatory parameter are not null
63 --
64 hr_api.mandatory_arg_error
65 (p_api_name => l_proc
66 ,p_argument => 'group_per_in_ler_id'
67 ,p_argument_value => p_group_per_in_ler_id
68 );
69 hr_api.mandatory_arg_error
70 (p_api_name => l_proc
71 ,p_argument => 'task_id'
72 ,p_argument_value => p_task_id
73 );
74 --
75 open csr_sec_grp;
76 fetch csr_sec_grp into l_security_group_id
77 , l_legislation_code;
78 --
79 if csr_sec_grp%notfound then
80 --
81 close csr_sec_grp;
82 --
83 -- The primary key is invalid therefore we must error
84 --
85 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
86 hr_multi_message.add
87 (p_associated_column1
88 => nvl(p_associated_column1,'GROUP_PER_IN_LER_ID')
89 ,p_associated_column2
90 => nvl(p_associated_column2,'TASK_ID')
91 );
92 --
93 else
94 close csr_sec_grp;
95 --
96 -- Set the security_group_id in CLIENT_INFO
97 --
98 hr_api.set_security_group_id
99 (p_security_group_id => l_security_group_id
100 );
101 --
102 -- Set the sessions legislation context in HR_SESSION_DATA
103 --
104 hr_api.set_legislation_context(l_legislation_code);
105 end if;
106 --
107 if g_debug then
108 hr_utility.set_location(' Leaving:'|| l_proc, 20);
109 end if;
110 --
111 end set_security_group_id;
112 --
113 -- ---------------------------------------------------------------------------
114 -- |---------------------< return_legislation_code >-------------------------|
115 -- ---------------------------------------------------------------------------
116 --
117 Function return_legislation_code
118 (p_group_per_in_ler_id in number
119 ,p_task_id in number
120 )
121 Return Varchar2 Is
122 --
123 -- Declare cursor
124 --
125 -- EDIT_HERE In the following cursor statement add join(s) between
126 -- ben_cwb_person_tasks and PER_BUSINESS_GROUPS_PERF
127 -- so that the legislation_code for
128 -- the current business group context can be derived.
129 -- Remove this comment when the edit has been completed.
130 cursor csr_leg_code is
131 select pbg.legislation_code
132 from per_business_groups_perf pbg
133 , ben_cwb_person_tasks ctk
134 -- , EDIT_HERE table_name(s) 333
135 where ctk.group_per_in_ler_id = p_group_per_in_ler_id
136 and ctk.task_id = p_task_id;
137 -- and pbg.business_group_id = EDIT_HERE 333.business_group_id;
138 --
139 -- Declare local variables
140 --
141 l_legislation_code varchar2(150);
142 l_proc varchar2(72) := g_package||'return_legislation_code';
143 --
144 Begin
145 --
146 if g_debug then
147 hr_utility.set_location('Entering:'|| l_proc, 10);
148 end if;
149 --
150 -- Ensure that all the mandatory parameter are not null
151 --
152 hr_api.mandatory_arg_error
153 (p_api_name => l_proc
154 ,p_argument => 'group_per_in_ler_id'
155 ,p_argument_value => p_group_per_in_ler_id
156 );
157 hr_api.mandatory_arg_error
158 (p_api_name => l_proc
159 ,p_argument => 'task_id'
160 ,p_argument_value => p_task_id
161 );
162 --
163 if (( nvl(ben_ctk_bus.g_group_per_in_ler_id, hr_api.g_number)
164 = p_group_per_in_ler_id)
165 and ( nvl(ben_ctk_bus.g_task_id, hr_api.g_number)
166 = p_task_id)) then
167 --
168 -- The legislation code has already been found with a previous
169 -- call to this function. Just return the value in the global
170 -- variable.
171 --
172 l_legislation_code := ben_ctk_bus.g_legislation_code;
173 if g_debug then
174 hr_utility.set_location(l_proc, 20);
175 end if;
176 else
177 --
178 -- The ID is different to the last call to this function
179 -- or this is the first call to this function.
180 --
181 open csr_leg_code;
182 fetch csr_leg_code into l_legislation_code;
183 --
184 if csr_leg_code%notfound then
185 --
186 -- The primary key is invalid therefore we must error
187 --
188 close csr_leg_code;
189 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
190 fnd_message.raise_error;
191 end if;
192 if g_debug then
193 hr_utility.set_location(l_proc,30);
194 end if;
195 --
196 -- Set the global variables so the values are
197 -- available for the next call to this function.
198 --
199 close csr_leg_code;
200 ben_ctk_bus.g_group_per_in_ler_id := p_group_per_in_ler_id;
201 ben_ctk_bus.g_task_id := p_task_id;
202 ben_ctk_bus.g_legislation_code := l_legislation_code;
203 end if;
204 if g_debug then
205 hr_utility.set_location(' Leaving:'|| l_proc, 40);
206 end if;
207 return l_legislation_code;
208 end return_legislation_code;
209 */
210 --
211 -- ----------------------------------------------------------------------------
212 -- |-----------------------< chk_non_updateable_args >------------------------|
213 -- ----------------------------------------------------------------------------
214 -- {Start Of Comments}
215 --
216 -- Description:
217 -- This procedure is used to ensure that non updateable attributes have
218 -- not been updated. If an attribute has been updated an error is generated.
219 --
220 -- Pre Conditions:
221 -- g_old_rec has been populated with details of the values currently in
222 -- the database.
223 --
224 -- In Arguments:
225 -- p_rec has been populated with the updated values the user would like the
226 -- record set to.
227 --
228 -- Post Success:
229 -- Processing continues if all the non updateable attributes have not
230 -- changed.
231 --
232 -- Post Failure:
233 -- An application error is raised if any of the non updatable attributes
234 -- have been altered.
235 --
236 -- {End Of Comments}
237 -- ----------------------------------------------------------------------------
238 Procedure chk_non_updateable_args
239 (p_rec in ben_ctk_shd.g_rec_type
240 ) IS
241 --
242 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
243 --
244 Begin
245 --
246 -- Only proceed with the validation if a row exists for the current
247 -- record in the HR Schema.
248 --
249 IF NOT ben_ctk_shd.api_updating
250 (p_group_per_in_ler_id => p_rec.group_per_in_ler_id
251 ,p_task_id => p_rec.task_id
252 ,p_object_version_number => p_rec.object_version_number
253 ) THEN
254 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
255 fnd_message.set_token('PROCEDURE ', l_proc);
256 fnd_message.set_token('STEP ', '5');
257 fnd_message.raise_error;
258 END IF;
259 --
260 if nvl(p_rec.group_per_in_ler_id, hr_api.g_number) <>
261 ben_ctk_shd.g_old_rec.group_per_in_ler_id then
262 hr_api.argument_changed_error
263 (p_api_name => l_proc
264 ,p_argument => 'GROUP_PER_IN_LER_ID'
265 ,p_base_table => ben_ctk_shd.g_tab_nam
266 );
267 end if;
268 --
269 if nvl(p_rec.task_id, hr_api.g_number) <>
270 ben_ctk_shd.g_old_rec.task_id then
271 hr_api.argument_changed_error
272 (p_api_name => l_proc
273 ,p_argument => 'TASK_ID'
274 ,p_base_table => ben_ctk_shd.g_tab_nam
275 );
276 end if;
277 --
278 End chk_non_updateable_args;
279 --
280 -- ----------------------------------------------------------------------------
281 -- |---------------------------< insert_validate >----------------------------|
282 -- ----------------------------------------------------------------------------
283 Procedure insert_validate
284 (p_rec in ben_ctk_shd.g_rec_type
285 ) is
286 --
287 l_proc varchar2(72) := g_package||'insert_validate';
288 --
289 Begin
290 if g_debug then
291 hr_utility.set_location('Entering:'||l_proc, 5);
292 end if;
293 --
294 -- No Validation required.
295 --
296 if g_debug then
297 hr_utility.set_location(' Leaving:'||l_proc, 10);
298 end if;
299 End insert_validate;
300 --
301 -- ----------------------------------------------------------------------------
302 -- |---------------------------< update_validate >----------------------------|
303 -- ----------------------------------------------------------------------------
304 Procedure update_validate
305 (p_rec in ben_ctk_shd.g_rec_type
306 ) is
307 --
308 l_proc varchar2(72) := g_package||'update_validate';
309 --
310 Begin
311 if g_debug then
312 hr_utility.set_location('Entering:'||l_proc, 5);
313 end if;
314 --
315 chk_non_updateable_args
316 (p_rec => p_rec
317 );
318 --
319 --
320 if g_debug then
321 hr_utility.set_location(' Leaving:'||l_proc, 10);
322 end if;
323 End update_validate;
324 --
325 -- ----------------------------------------------------------------------------
326 -- |---------------------------< delete_validate >----------------------------|
327 -- ----------------------------------------------------------------------------
328 Procedure delete_validate
329 (p_rec in ben_ctk_shd.g_rec_type
330 ) is
331 --
332 l_proc varchar2(72) := g_package||'delete_validate';
333 --
334 Begin
335 if g_debug then
336 hr_utility.set_location('Entering:'||l_proc, 5);
337 end if;
338 --
339 -- No Validation Required
340 --
341 if g_debug then
342 hr_utility.set_location(' Leaving:'||l_proc, 10);
343 end if;
344 End delete_validate;
345 --
346 end ben_ctk_bus;