[Home] [Help]
PACKAGE BODY: APPS.PER_WBI_BUS
Source
1 Package Body per_wbi_bus as
2 /* $Header: pewbirhi.pkb 115.0 2003/07/03 05:55:25 kavenkat noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_wbi_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_workbench_item_code varchar2(60) default null;
15 --
16 -- ---------------------------------------------------------------------------
17 -- |----------------------< set_security_group_id >--------------------------|
18 -- ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21 (p_workbench_item_code in varchar2
22 ,p_associated_column1 in varchar2 default null
23 ) is
24 --
25 -- Declare cursor
26
27 cursor csr_sec_grp is
28 select NULL --pbg.security_group_id,
29 --pbg.legislation_code
30 from --per_business_groups_perf pbg
31 per_ri_workbench_items wbi
32 where wbi.workbench_item_code = p_workbench_item_code;
33 -- and pbg.business_group_id =
34 --
35 -- Declare local variables
36 --
37 l_security_group_id number;
38 l_proc varchar2(72) := g_package||'set_security_group_id';
39 l_legislation_code varchar2(150);
40 --
41 begin
42 --
43 hr_utility.set_location('Entering:'|| l_proc, 10);
44 --
45 -- Ensure that all the mandatory parameter are not null
46 --
47 hr_api.mandatory_arg_error
48 (p_api_name => l_proc
49 ,p_argument => 'workbench_item_code'
50 ,p_argument_value => p_workbench_item_code
51 );
52 --
53 open csr_sec_grp;
54 fetch csr_sec_grp into l_security_group_id ;
55 --, l_legislation_code;
56 --
57 if csr_sec_grp%notfound then
58 --
59 close csr_sec_grp;
60 --
61 -- The primary key is invalid therefore we must error
62 --
63 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
64 hr_multi_message.add
65 (p_associated_column1
66 => nvl(p_associated_column1,'WORKBENCH_ITEM_CODE')
67 );
68 --
69 else
70 close csr_sec_grp;
71 --
72 -- Set the security_group_id in CLIENT_INFO
73 --
74 hr_api.set_security_group_id
75 (p_security_group_id => l_security_group_id
76 );
77 --
78 -- Set the sessions legislation context in HR_SESSION_DATA
79 --
80 hr_api.set_legislation_context(l_legislation_code);
81 end if;
82 --
83 hr_utility.set_location(' Leaving:'|| l_proc, 20);
84 --
85 end set_security_group_id;
86 --
87 -- ---------------------------------------------------------------------------
88 -- |---------------------< return_legislation_code >-------------------------|
89 -- ---------------------------------------------------------------------------
90 --
91 Function return_legislation_code
92 (p_workbench_item_code in varchar2
93 )
94 Return Varchar2 Is
95 --
96
97 cursor csr_leg_code is
98 select NULL -- pbg.legislation_code
99 from --per_business_groups_perf pbg
100 per_ri_workbench_items wbi
101 where wbi.workbench_item_code = p_workbench_item_code;
102 -- and pbg.business_group_id =
103 --
104 -- Declare local variables
105 --
106 l_legislation_code varchar2(150);
107 l_proc varchar2(72) := g_package||'return_legislation_code';
108 --
109 Begin
110 --
111 hr_utility.set_location('Entering:'|| l_proc, 10);
112 --
113 -- Ensure that all the mandatory parameter are not null
114 --
115 hr_api.mandatory_arg_error
116 (p_api_name => l_proc
117 ,p_argument => 'workbench_item_code'
118 ,p_argument_value => p_workbench_item_code
119 );
120 --
121 if ( nvl(per_wbi_bus.g_workbench_item_code, hr_api.g_varchar2)
122 = p_workbench_item_code) then
123 --
124 -- The legislation code has already been found with a previous
125 -- call to this function. Just return the value in the global
126 -- variable.
127 --
128 l_legislation_code := per_wbi_bus.g_legislation_code;
129 hr_utility.set_location(l_proc, 20);
130 else
131 --
132 -- The ID is different to the last call to this function
133 -- or this is the first call to this function.
134 --
135 open csr_leg_code;
136 fetch csr_leg_code into l_legislation_code;
137 --
138 if csr_leg_code%notfound then
139 --
140 -- The primary key is invalid therefore we must error
141 --
142 close csr_leg_code;
143 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
144 fnd_message.raise_error;
145 end if;
146 hr_utility.set_location(l_proc,30);
147 --
148 -- Set the global variables so the values are
149 -- available for the next call to this function.
150 --
151 close csr_leg_code;
152 per_wbi_bus.g_workbench_item_code := p_workbench_item_code;
153 per_wbi_bus.g_legislation_code := l_legislation_code;
154 end if;
155 hr_utility.set_location(' Leaving:'|| l_proc, 40);
156 return l_legislation_code;
157 end return_legislation_code;
158 --
159 -- ----------------------------------------------------------------------------
160 -- |-----------------------< chk_non_updateable_args >------------------------|
161 -- ----------------------------------------------------------------------------
162 -- {Start Of Comments}
163 --
164 -- Description:
165 -- This procedure is used to ensure that non updateable attributes have
166 -- not been updated. If an attribute has been updated an error is generated.
167 --
168 -- Pre Conditions:
169 -- g_old_rec has been populated with details of the values currently in
170 -- the database.
171 --
172 -- In Arguments:
173 -- p_rec has been populated with the updated values the user would like the
174 -- record set to.
175 --
176 -- Post Success:
177 -- Processing continues if all the non updateable attributes have not
178 -- changed.
179 --
180 -- Post Failure:
181 -- An application error is raised if any of the non updatable attributes
182 -- have been altered.
183 --
184 -- {End Of Comments}
185 -- ----------------------------------------------------------------------------
186 Procedure chk_non_updateable_args
187 (p_effective_date in date
188 ,p_rec in per_wbi_shd.g_rec_type
189 ) IS
190 --
191 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
192 --
193 Begin
194 --
195 -- Only proceed with the validation if a row exists for the current
196 -- record in the HR Schema.
197 --
198 IF NOT per_wbi_shd.api_updating
199 (p_workbench_item_code => p_rec.workbench_item_code
200 ,p_object_version_number => p_rec.object_version_number
201 ) THEN
202 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
203 fnd_message.set_token('PROCEDURE ', l_proc);
204 fnd_message.set_token('STEP ', '5');
205 fnd_message.raise_error;
206 END IF;
207 --
208 -- EDIT_HERE: Add checks to ensure non-updateable args have
209 -- not been updated.
210 --
211 End chk_non_updateable_args;
212 --
213 --
214 --
215 -- ---------------------------------------------------------------------------
216 -- |-------------------------< chk_workbench_item_type >--------------------------|
217 -- ---------------------------------------------------------------------------
218 --
219 -- Description:
220 -- Validates that the following business rules are met:
221 -- a)Validate against HR_LOOKUPS.lookup_code
222 -- where LOOKUP_TYPE = 'PER_RI_WORKBENCH_ITEM_TYPE' (I,U)
223 --
224 -- Pre-conditions:
225 -- workbench_item_code must have been successfully validated.
226 --
227 -- In Arguments:
228 -- p_workbench_item_code
229 -- p_effective_date
230 -- p_object_version_number
231 -- p_workbench_item_type
232 --
233 -- Post Success:
234 -- If the above business rules are satisfied then processing continues.
235 --
236 -- Post Failure:
237 -- If the above business rules then an application error will be raised and
238 -- processing is terminated.
239 --
240 -- Access Status:
241 -- Internal Table Handler Use Only.
242 --
243 -- {End Of Comments}
244 -- ----------------------------------------------------------------------------
245
246 Procedure chk_workbench_item_type(p_workbench_item_code Varchar2
247 ,p_effective_date Varchar2
248 ,p_object_version_number Varchar2
249 ,p_workbench_item_type Varchar2
250 ) Is
251
252 l_proc varchar2(72) := g_package||'chk_workbench_item_type';
253
254 Begin
255 hr_utility.set_location('Entering:'|| l_proc, 1);
256
257
258 If p_workbench_item_type Is Not Null Then
259
260 hr_api.mandatory_arg_error
261 (p_api_name => l_proc
262 ,p_argument => 'EFFECTIVE_DATE'
263 ,p_argument_value => p_effective_date
264 );
265 If hr_api.not_exists_in_hr_lookups
266 (p_effective_date => p_effective_date
267 ,p_lookup_type => 'PER_RI_WORKBENCH_ITEM_TYPE'
268 ,p_lookup_code => p_workbench_item_type
269 ) Then
270 fnd_message.set_name('PER', 'HR_52966_INVALID_LOOKUP');
271 fnd_message.set_token('COLUMN ', p_workbench_item_type);
272 fnd_message.set_token('LOOKUP_TYPE ', 'PER_RI_WORKBENCH_ITEM_TYPE');
273 fnd_message.set_token('STEP ', '5');
274 fnd_message.raise_error;
275 End If;
276
277 End If;
278
279 hr_utility.set_location('Leaving:'|| l_proc, 1);
280
281 End chk_workbench_item_type;
282 --
283 -- ----------------------------------------------------------------------------
284 -- |---------------------------< insert_validate >----------------------------|
285 -- ----------------------------------------------------------------------------
286 Procedure insert_validate
287 (p_effective_date in date
288 ,p_rec in per_wbi_shd.g_rec_type
289 ) is
290 --
291 l_proc varchar2(72) := g_package||'insert_validate';
292 --
293 Begin
294 hr_utility.set_location('Entering:'||l_proc, 5);
295 --
296 -- Call all supporting business operations
297
298 -- Validate Dependent Attributes
299 --
300 --
301 chk_workbench_item_type(p_workbench_item_code =>p_rec.workbench_item_code
302 ,p_effective_date =>p_effective_date
303 ,p_object_version_number =>p_rec.object_version_number
304 ,p_workbench_item_type =>p_rec.workbench_item_type
305 ) ;
306
307 hr_utility.set_location(' Leaving:'||l_proc, 10);
308 End insert_validate;
309 --
310 -- ----------------------------------------------------------------------------
311 -- |---------------------------< update_validate >----------------------------|
312 -- ----------------------------------------------------------------------------
313 Procedure update_validate
314 (p_effective_date in date
315 ,p_rec in per_wbi_shd.g_rec_type
316 ) is
317 --
318 l_proc varchar2(72) := g_package||'update_validate';
319 --
320 Begin
321 hr_utility.set_location('Entering:'||l_proc, 5);
322 --
323 -- Call all supporting business operations
324 --
325 --
326 -- Validate Dependent Attributes
327 --
328 chk_non_updateable_args
329 ( p_effective_date => p_effective_date
330 ,p_rec => p_rec
331 );
332
333
334 chk_workbench_item_type(p_workbench_item_code =>p_rec.workbench_item_code
335 ,p_effective_date =>p_effective_date
336 ,p_object_version_number =>p_rec.object_version_number
337 ,p_workbench_item_type =>p_rec.workbench_item_type
338 ) ;
339 --
340 --
341 hr_utility.set_location(' Leaving:'||l_proc, 10);
342 End update_validate;
343 --
344 -- ----------------------------------------------------------------------------
345 -- |---------------------------< delete_validate >----------------------------|
346 -- ----------------------------------------------------------------------------
347 Procedure delete_validate
351 l_proc varchar2(72) := g_package||'delete_validate';
348 (p_rec in per_wbi_shd.g_rec_type
349 ) is
350 --
352 --
353 Begin
354 hr_utility.set_location('Entering:'||l_proc, 5);
355 --
356 -- Call all supporting business operations
357 --
358 hr_utility.set_location(' Leaving:'||l_proc, 10);
359 End delete_validate;
360 --
361 end per_wbi_bus;