1 Package Body pay_urt_bus as
2 /* $Header: pyurtrhi.pkb 120.0 2005/05/29 09:13 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_urt_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_user_row_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_user_row_id in number
23 ,p_associated_column1 in varchar2 default null
24 ) is
25 cursor csr_sec_grp is
26 select pbg.security_group_id,
27 pbg.legislation_code
28 from per_business_groups_perf pbg
29 , pay_user_rows_f_tl prt
30 , pay_user_rows_f pur
31 where prt.user_row_id = p_user_row_id
32 and pbg.business_group_id =pur.business_group_id;
33 --
34 -- Declare local variables
35 --
36 l_security_group_id number;
37 l_proc varchar2(72) := g_package||'set_security_group_id';
38 l_legislation_code varchar2(150);
39 --
40 begin
41 --
42 hr_utility.set_location('Entering:'|| l_proc, 10);
43 --
44 -- Ensure that all the mandatory parameter are not null
45 --
46 hr_api.mandatory_arg_error
47 (p_api_name => l_proc
48 ,p_argument => 'user_row_id'
49 ,p_argument_value => p_user_row_id
50 );
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,'USER_ROW_ID')
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_user_row_id in number
93 ,p_language in varchar2
94 )
95 Return Varchar2 Is
96 cursor csr_leg_code is
97 select pbg.legislation_code
98 from per_business_groups_perf pbg
99 , pay_user_rows_f_tl prt
100 , pay_user_rows_f pur
101 where prt.user_row_id = p_user_row_id
102 and prt.language = p_language
103 and pbg.business_group_id = pur.business_group_id;
104 --
105 -- Declare local variables
106 --
107 l_legislation_code varchar2(150);
108 l_proc varchar2(72) := g_package||'return_legislation_code';
109 --
110 Begin
111 --
112 hr_utility.set_location('Entering:'|| l_proc, 10);
113 --
114 -- Ensure that all the mandatory parameter are not null
115 --
116 hr_api.mandatory_arg_error
117 (p_api_name => l_proc
118 ,p_argument => 'user_row_id'
119 ,p_argument_value => p_user_row_id
120 );
121 --
122 --
123 if (( nvl(pay_urt_bus.g_user_row_id, hr_api.g_number)
124 = p_user_row_id)
125 and ( nvl(pay_urt_bus.g_language, hr_api.g_varchar2)
126 = p_language)) then
127 --
128 -- The legislation code has already been found with a previous
129 -- call to this function. Just return the value in the global
130 -- variable.
131 --
132 l_legislation_code := pay_urt_bus.g_legislation_code;
133 hr_utility.set_location(l_proc, 20);
134 else
135 --
136 -- The ID is different to the last call to this function
137 -- or this is the first call to this function.
138 --
139 open csr_leg_code;
140 fetch csr_leg_code into l_legislation_code;
141 --
142 if csr_leg_code%notfound then
143 --
144 -- The primary key is invalid therefore we must error
145 --
146 close csr_leg_code;
147 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
148 fnd_message.raise_error;
149 end if;
150 hr_utility.set_location(l_proc,30);
151 --
152 -- Set the global variables so the values are
153 -- available for the next call to this function.
154 --
155 close csr_leg_code;
156 pay_urt_bus.g_user_row_id := p_user_row_id;
157 pay_urt_bus.g_language := p_language;
158 pay_urt_bus.g_legislation_code := l_legislation_code;
159 end if;
160 hr_utility.set_location(' Leaving:'|| l_proc, 40);
161 return l_legislation_code;
162 end return_legislation_code;
163 --
164 -- ----------------------------------------------------------------------------
165 -- |-----------------------< chk_non_updateable_args >------------------------|
166 -- ----------------------------------------------------------------------------
167 -- {Start Of Comments}
168 --
169 -- Description:
170 -- This procedure is used to ensure that non updateable attributes have
171 -- not been updated. If an attribute has been updated an error is generated.
172 --
173 -- Pre Conditions:
174 -- g_old_rec has been populated with details of the values currently in
175 -- the database.
176 --
177 -- In Arguments:
178 -- p_rec has been populated with the updated values the user would like the
179 -- record set to.
180 --
181 -- Post Success:
182 -- Processing continues if all the non updateable attributes have not
183 -- changed.
184 --
185 -- Post Failure:
186 -- An application error is raised if any of the non updatable attributes
187 -- have been altered.
188 --
189 -- {End Of Comments}
190 -- ----------------------------------------------------------------------------
191 Procedure chk_non_updateable_args
192 (p_rec in pay_urt_shd.g_rec_type
193 ) IS
194 --
195 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
196 --
197 Begin
198 --
199 -- Only proceed with the validation if a row exists for the current
200 -- record in the HR Schema.
201 --
202 IF NOT pay_urt_shd.api_updating
203 (p_user_row_id => p_rec.user_row_id
204 ,p_language => p_rec.language
205 ) THEN
206 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
207 fnd_message.set_token('PROCEDURE ', l_proc);
208 fnd_message.set_token('STEP ', '5');
209 fnd_message.raise_error;
210 END IF;
211 --
212 -- EDIT_HERE: Add checks to ensure non-updateable args have
213 -- not been updated.
214 --
215 End chk_non_updateable_args;
216 --
217 -- ----------------------------------------------------------------------------
218 -- |---------------------------< insert_validate >----------------------------|
219 -- ----------------------------------------------------------------------------
220 Procedure insert_validate
221 (p_rec in pay_urt_shd.g_rec_type
222 ) is
223 --
224 l_proc varchar2(72) := g_package||'insert_validate';
225 --
226 Begin
227 hr_utility.set_location('Entering:'||l_proc, 5);
228 --
229 -- Call all supporting business operations
230 --
231 --
232 -- EDIT_HERE: As this table does not have a mandatory business_group_id
233 -- column, ensure client_info is populated by calling a suitable
234 -- ???_???_bus.set_security_group_id procedure, or add one of the following
235 -- comments:
236 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
237 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
238 --
239 -- Validate Dependent Attributes
240 --
241 --
242 hr_utility.set_location(' Leaving:'||l_proc, 10);
243 End insert_validate;
244 --
245 -- ----------------------------------------------------------------------------
246 -- |---------------------------< update_validate >----------------------------|
247 -- ----------------------------------------------------------------------------
248 Procedure update_validate
249 (p_rec in pay_urt_shd.g_rec_type
250 ) is
251 --
252 l_proc varchar2(72) := g_package||'update_validate';
253 --
254 Begin
255 hr_utility.set_location('Entering:'||l_proc, 5);
256 --
257 -- Call all supporting business operations
258 --
259 --
260 -- EDIT_HERE: As this table does not have a mandatory business_group_id
261 -- column, ensure client_info is populated by calling a suitable
262 -- ???_???_bus.set_security_group_id procedure, or add one of the following
263 -- comments:
264 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
265 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
266 --
267 -- Validate Dependent Attributes
268 --
269 chk_non_updateable_args
270 (p_rec => p_rec
271 );
272 --
273 --
274 hr_utility.set_location(' Leaving:'||l_proc, 10);
275 End update_validate;
276 --
277 -- ----------------------------------------------------------------------------
278 -- |---------------------------< delete_validate >----------------------------|
279 -- ----------------------------------------------------------------------------
280 Procedure delete_validate
281 (p_rec in pay_urt_shd.g_rec_type
282 ) is
283 --
284 l_proc varchar2(72) := g_package||'delete_validate';
285 --
286 Begin
287 hr_utility.set_location('Entering:'||l_proc, 5);
288 --
289 -- Call all supporting business operations
290 --
291 hr_utility.set_location(' Leaving:'||l_proc, 10);
292 End delete_validate;
293 --
294 end pay_urt_bus;