[Home] [Help]
PACKAGE BODY: APPS.BEN_XID_BUS
Source
1 Package Body ben_xid_bus as
2 /* $Header: bexidrhi.pkb 115.7 2002/12/16 07:24:29 rpgupta ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_xid_bus.'; -- Global package name
9 --
10 -- ---------------------------------------------------------------------------
11 -- |----------------------< set_security_group_id >--------------------------|
12 -- ---------------------------------------------------------------------------
13 --
14 Procedure set_security_group_id
15 (p_ext_incl_data_elmt_id in number
16 ) is
17 --
18 -- Declare cursor
19 --
20 cursor csr_sec_grp is
21 select pbg.security_group_id
22 from per_business_groups pbg
23 , ben_ext_incl_data_elmt xid
24 where xid.ext_incl_data_elmt_id = p_ext_incl_data_elmt_id
25 and pbg.business_group_id = xid.business_group_id;
26 --
27 -- Declare local variables
28 --
29 l_security_group_id number;
30 l_proc varchar2(72) := g_package||'set_security_group_id';
31 --
32 begin
33 --
34 hr_utility.set_location('Entering:'|| l_proc, 10);
35 --
36 -- Ensure that all the mandatory parameter are not null
37 --
38 hr_api.mandatory_arg_error
39 (p_api_name => l_proc
40 ,p_argument => 'ext_incl_data_elmt_id'
41 ,p_argument_value => p_ext_incl_data_elmt_id
42 );
43 --
44 open csr_sec_grp;
45 fetch csr_sec_grp into l_security_group_id;
46 --
47 if csr_sec_grp%notfound then
48 --
49 close csr_sec_grp;
50 --
51 -- The primary key is invalid therefore we must error
52 --
53 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
54 fnd_message.raise_error;
55 --
56 end if;
57 close csr_sec_grp;
58 --
59 -- Set the security_group_id in CLIENT_INFO
60 --
61 hr_api.set_security_group_id
62 (p_security_group_id => l_security_group_id
63 );
64 --
65 hr_utility.set_location(' Leaving:'|| l_proc, 20);
66 --
67 end set_security_group_id;
68 --
69 --
70 -- ----------------------------------------------------------------------------
71 -- |------< chk_ext_incl_data_elmt_id >------|
72 -- ----------------------------------------------------------------------------
73 --
74 -- Description
75 -- This procedure is used to check that the primary key for the table
76 -- is created properly. It should be null on insert and
77 -- should not be able to be updated.
78 --
79 -- Pre Conditions
80 -- None.
81 --
82 -- In Parameters
83 -- ext_incl_data_elmt_id PK of record being inserted or updated.
84 -- object_version_number Object version number of record being
85 -- inserted or updated.
86 --
87 -- Post Success
88 -- Processing continues
89 --
90 -- Post Failure
91 -- Errors handled by the procedure
92 --
93 -- Access Status
94 -- Internal table handler use only.
95 --
96 Procedure chk_ext_incl_data_elmt_id(p_ext_incl_data_elmt_id in number,
97 p_object_version_number in number) is
98 --
99 l_proc varchar2(72) := g_package||'chk_ext_incl_data_elmt_id';
100 l_api_updating boolean;
101 --
102 Begin
103 --
104 hr_utility.set_location('Entering:'||l_proc, 5);
105 --
106 l_api_updating := ben_xid_shd.api_updating
107 (p_ext_incl_data_elmt_id => p_ext_incl_data_elmt_id,
108 p_object_version_number => p_object_version_number);
109 --
110 if (l_api_updating
111 and nvl(p_ext_incl_data_elmt_id,hr_api.g_number)
112 <> ben_xid_shd.g_old_rec.ext_incl_data_elmt_id) then
113 --
114 -- raise error as PK has changed
115 --
116 ben_xid_shd.constraint_error('BEN_EXT_INCL_DATA_ELMT_PK');
117 --
118 elsif not l_api_updating then
119 --
120 -- check if PK is null
121 --
122 if p_ext_incl_data_elmt_id is not null then
123 --
124 -- raise error as PK is not null
125 --
126 ben_xid_shd.constraint_error('BEN_EXT_INCL_DATA_ELMT_PK');
127 --
128 end if;
129 --
130 end if;
131 --
132 hr_utility.set_location('Leaving:'||l_proc, 10);
133 --
134 End chk_ext_incl_data_elmt_id;
135 --
136 -- ----------------------------------------------------------------------------
137 -- |----------------------< chk_startup_action >------------------------------|
138 -- ----------------------------------------------------------------------------
139 --
140 -- Description:
141 -- This procedure will check that the current action is allowed according
142 -- to the current startup mode.
143 --
144 -- ----------------------------------------------------------------------------
145 PROCEDURE chk_startup_action
146 (p_insert IN boolean
147 ,p_business_group_id IN number
148 ,p_legislation_code IN varchar2
149 ,p_legislation_subgroup IN varchar2 DEFAULT NULL) IS
150 --
151 BEGIN
152 --
153 -- Call the supporting procedure to check startup mode
154 --
155 IF (p_insert) THEN
156 --
157 -- Call procedure to check startup_action for inserts.
158 --
159 hr_startup_data_api_support.chk_startup_action
160 (p_generic_allowed => TRUE
161 ,p_startup_allowed => TRUE
162 ,p_user_allowed => TRUE
163 ,p_business_group_id => p_business_group_id
164 ,p_legislation_code => p_legislation_code
165 ,p_legislation_subgroup => p_legislation_subgroup
166 );
167 ELSE
168 --
169 -- Call procedure to check startup_action for updates and deletes.
170 --
171 hr_startup_data_api_support.chk_upd_del_startup_action
172 (p_generic_allowed => TRUE
173 ,p_startup_allowed => TRUE
174 ,p_user_allowed => TRUE
175 ,p_business_group_id => p_business_group_id
176 ,p_legislation_code => p_legislation_code
177 ,p_legislation_subgroup => p_legislation_subgroup
178 );
179 END IF;
180 --
181 END chk_startup_action;
182 --
183 --
184 -- ----------------------------------------------------------------------------
185 -- |---------------------------< insert_validate >----------------------------|
186 -- ----------------------------------------------------------------------------
187 Procedure insert_validate(p_rec in ben_xid_shd.g_rec_type) is
188 --
189 l_proc varchar2(72) := g_package||'insert_validate';
190 --
191 Begin
192 hr_utility.set_location('Entering:'||l_proc, 5);
193 --
194 -- Call all supporting business operations
195 --
196 --
197 chk_startup_action(True
198 ,p_rec.business_group_id
199 ,p_rec.legislation_code);
200 IF hr_startup_data_api_support.g_startup_mode NOT IN ('GENERIC','STARTUP') THEN
201 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate bus_grp
202 END IF;
203 --
204 chk_ext_incl_data_elmt_id
205 (p_ext_incl_data_elmt_id => p_rec.ext_incl_data_elmt_id,
206 p_object_version_number => p_rec.object_version_number);
207 --
208 hr_utility.set_location(' Leaving:'||l_proc, 10);
209 End insert_validate;
210 --
211 -- ----------------------------------------------------------------------------
212 -- |---------------------------< update_validate >----------------------------|
213 -- ----------------------------------------------------------------------------
214 Procedure update_validate(p_rec in ben_xid_shd.g_rec_type) is
215 --
216 l_proc varchar2(72) := g_package||'update_validate';
217 --
218 Begin
219 hr_utility.set_location('Entering:'||l_proc, 5);
220 --
221 -- Call all supporting business operations
222 --
223 --
224 chk_startup_action(False
225 ,p_rec.business_group_id
226 ,p_rec.legislation_code);
227 IF hr_startup_data_api_support.g_startup_mode NOT IN ('GENERIC','STARTUP') THEN
228 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate bus_grp
229 END IF;
230 --
231 chk_ext_incl_data_elmt_id
232 (p_ext_incl_data_elmt_id => p_rec.ext_incl_data_elmt_id,
233 p_object_version_number => p_rec.object_version_number);
234 --
235 hr_utility.set_location(' Leaving:'||l_proc, 10);
236 End update_validate;
237 --
238 -- ----------------------------------------------------------------------------
239 -- |---------------------------< delete_validate >----------------------------|
240 -- ----------------------------------------------------------------------------
241 Procedure delete_validate(p_rec in ben_xid_shd.g_rec_type) is
242 --
243 l_proc varchar2(72) := g_package||'delete_validate';
244 --
245 Begin
246 hr_utility.set_location('Entering:'||l_proc, 5);
247 --
248 -- Call all supporting business operations
249 --
250 --
251 chk_startup_action(False
252 ,ben_xid_shd.g_old_rec.business_group_id
253 ,ben_xid_shd.g_old_rec.legislation_code);
254 --
255 hr_utility.set_location(' Leaving:'||l_proc, 10);
256 End delete_validate;
257 --
258 --
259 -- ---------------------------------------------------------------------------
260 -- |---------------------< return_legislation_code >-------------------------|
261 -- ---------------------------------------------------------------------------
262 --
263 function return_legislation_code
264 (p_ext_incl_data_elmt_id in number) return varchar2 is
265 --
266 -- Declare cursor
267 --
268 cursor csr_leg_code is
269 select a.legislation_code
270 from per_business_groups a,
271 ben_ext_incl_data_elmt b
272 where b.ext_incl_data_elmt_id = p_ext_incl_data_elmt_id
273 and a.business_group_id(+) = b.business_group_id;
274 --
275 -- Declare local variables
276 --
277 l_legislation_code varchar2(150);
278 l_proc varchar2(72) := g_package||'return_legislation_code';
279 --
280 begin
281 --
282 hr_utility.set_location('Entering:'|| l_proc, 10);
283 --
284 -- Ensure that all the mandatory parameter are not null
285 --
286 hr_api.mandatory_arg_error(p_api_name => l_proc,
287 p_argument => 'ext_incl_data_elmt_id',
288 p_argument_value => p_ext_incl_data_elmt_id);
289 --
290 open csr_leg_code;
291 --
292 fetch csr_leg_code into l_legislation_code;
293 --
294 if csr_leg_code%notfound then
295 --
296 close csr_leg_code;
297 --
298 -- The primary key is invalid therefore we must error
299 --
300 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
301 fnd_message.raise_error;
302 --
303 end if;
304 --
305 close csr_leg_code;
306 --
307 hr_utility.set_location(' Leaving:'|| l_proc, 20);
308 --
309 return l_legislation_code;
310 --
311 end return_legislation_code;
312 --
313 end ben_xid_bus;