1 Package Body per_sst_bus as
2 /* $Header: pesstrhi.pkb 120.1 2005/06/01 12:05:44 ndorai noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_sst_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_setup_sub_task_code varchar2(60) default null;
15 --
16 -- ---------------------------------------------------------------------------
17 -- |----------------------< set_security_group_id >--------------------------|
18 -- ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21 (p_setup_sub_task_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_setup_sub_tasks_tl sst
32 -- , EDIT_HERE table_name(s) 333
33 where sst.setup_sub_task_code = p_setup_sub_task_code;
34 -- and pbg.business_group_id = EDIT_HERE 333.business_group_id;
35 --
36 -- Declare local variables
37 --
38 l_security_group_id number;
39 l_proc varchar2(72) := g_package||'set_security_group_id';
40 l_legislation_code varchar2(150);
41 --
42 begin
43 --
44 hr_utility.set_location('Entering:'|| l_proc, 10);
45 --
46 -- Ensure that all the mandatory parameter are not null
47 --
48 hr_api.mandatory_arg_error
49 (p_api_name => l_proc
50 ,p_argument => 'setup_sub_task_code'
51 ,p_argument_value => p_setup_sub_task_code
52 );
53 --
54 open csr_sec_grp;
55 fetch csr_sec_grp into l_security_group_id ;
56 -- , l_legislation_code;
57 --
58 if csr_sec_grp%notfound then
59 --
60 close csr_sec_grp;
61 --
62 -- The primary key is invalid therefore we must error
63 --
64 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
65 hr_multi_message.add
66 (p_associated_column1
67 => nvl(p_associated_column1,'SETUP_SUB_TASK_CODE')
68 );
69 --
70 else
71 close csr_sec_grp;
72 --
73 -- Set the security_group_id in CLIENT_INFO
74 --
75 hr_api.set_security_group_id
76 (p_security_group_id => l_security_group_id
77 );
78 --
79 -- Set the sessions legislation context in HR_SESSION_DATA
80 --
81 hr_api.set_legislation_context(l_legislation_code);
82 end if;
83 --
84 hr_utility.set_location(' Leaving:'|| l_proc, 20);
85 --
86 end set_security_group_id;
87 --
88 -- ---------------------------------------------------------------------------
89 -- |---------------------< return_legislation_code >-------------------------|
90 -- ---------------------------------------------------------------------------
91 --
92 Function return_legislation_code
93 (p_setup_sub_task_code in varchar2
94 )
95 Return Varchar2 Is
96 --
97 -- Declare cursor
98
99
100 cursor csr_leg_code is
101 select null --pbg.legislation_code
102 from -- per_business_groups_perf pbg
103 per_ri_setup_sub_tasks_tl sst
104 -- , EDIT_HERE table_name(s) 333
105 where sst.setup_sub_task_code = p_setup_sub_task_code;
106 -- and pbg.business_group_id = EDIT_HERE 333.business_group_id;
107 --
108 -- Declare local variables
109 --
110 l_legislation_code varchar2(150);
111 l_proc varchar2(72) := g_package||'return_legislation_code';
112 --
113 Begin
114 --
115 hr_utility.set_location('Entering:'|| l_proc, 10);
116 --
117 -- Ensure that all the mandatory parameter are not null
118 --
119 hr_api.mandatory_arg_error
120 (p_api_name => l_proc
121 ,p_argument => 'setup_sub_task_code'
122 ,p_argument_value => p_setup_sub_task_code
123 );
124 --
125 if ( nvl(per_sst_bus.g_setup_sub_task_code, hr_api.g_varchar2)
126 = p_setup_sub_task_code) 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 := per_sst_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 per_sst_bus.g_setup_sub_task_code := p_setup_sub_task_code;
157 per_sst_bus.g_legislation_code := l_legislation_code;
158 end if;
159 hr_utility.set_location(' Leaving:'|| l_proc, 40);
160 return l_legislation_code;
161 end return_legislation_code;
162 --
163 -- ----------------------------------------------------------------------------
164 -- |-----------------------< chk_non_updateable_args >------------------------|
165 -- ----------------------------------------------------------------------------
166 -- {Start Of Comments}
167 --
168 -- Description:
169 -- This procedure is used to ensure that non updateable attributes have
170 -- not been updated. If an attribute has been updated an error is generated.
171 --
172 -- Pre Conditions:
173 -- g_old_rec has been populated with details of the values currently in
174 -- the database.
175 --
176 -- In Arguments:
177 -- p_rec has been populated with the updated values the user would like the
178 -- record set to.
179 --
180 -- Post Success:
181 -- Processing continues if all the non updateable attributes have not
182 -- changed.
183 --
184 -- Post Failure:
185 -- An application error is raised if any of the non updatable attributes
186 -- have been altered.
187 --
188 -- {End Of Comments}
189 -- ----------------------------------------------------------------------------
190 Procedure chk_non_updateable_args
191 (p_rec in per_sst_shd.g_rec_type
192 ) IS
193 --
194 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
195 --
196 Begin
197 --
198 -- Only proceed with the validation if a row exists for the current
199 -- record in the HR Schema.
200 --
201 IF NOT per_sst_shd.api_updating
202 (p_setup_sub_task_code => p_rec.setup_sub_task_code
203 ) THEN
204 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
205 fnd_message.set_token('PROCEDURE ', l_proc);
206 fnd_message.set_token('STEP ', '5');
207 fnd_message.raise_error;
208 END IF;
209 --
210 -- EDIT_HERE: Add checks to ensure non-updateable args have
211 -- not been updated.
212 --
213 End chk_non_updateable_args;
214 --
215 -- ----------------------------------------------------------------------------
216 -- |---------------------------< insert_validate >----------------------------|
217 -- ----------------------------------------------------------------------------
218 Procedure insert_validate
219 (p_rec in per_sst_shd.g_rec_type
220 ) is
221 --
222 l_proc varchar2(72) := g_package||'insert_validate';
223 --
224 Begin
225 hr_utility.set_location('Entering:'||l_proc, 5);
226 --
227 -- Call all supporting business operations
228 --
229 --
230 -- EDIT_HERE: As this table does not have a mandatory business_group_id
231 -- column, ensure client_info is populated by calling a suitable
232 -- ???_???_bus.set_security_group_id procedure, or add one of the following
233 -- comments:
234 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
235 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
236 --
237 -- Validate Dependent Attributes
238 --
239 --
240 hr_utility.set_location(' Leaving:'||l_proc, 10);
241 End insert_validate;
242 --
243 -- ----------------------------------------------------------------------------
244 -- |---------------------------< update_validate >----------------------------|
245 -- ----------------------------------------------------------------------------
246 Procedure update_validate
247 (p_rec in per_sst_shd.g_rec_type
248 ) is
249 --
250 l_proc varchar2(72) := g_package||'update_validate';
251 --
252 Begin
253 hr_utility.set_location('Entering:'||l_proc, 5);
254 --
255 -- Call all supporting business operations
256 --
257 --
258 -- EDIT_HERE: As this table does not have a mandatory business_group_id
259 -- column, ensure client_info is populated by calling a suitable
260 -- ???_???_bus.set_security_group_id procedure, or add one of the following
261 -- comments:
262 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
263 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
264 --
265 -- Validate Dependent Attributes
266 --
267 chk_non_updateable_args
268 (p_rec => p_rec
269 );
270 --
271 --
272 hr_utility.set_location(' Leaving:'||l_proc, 10);
273 End update_validate;
274 --
275 -- ----------------------------------------------------------------------------
276 -- |---------------------------< delete_validate >----------------------------|
277 -- ----------------------------------------------------------------------------
278 Procedure delete_validate
279 (p_rec in per_sst_shd.g_rec_type
280 ) is
281 --
282 l_proc varchar2(72) := g_package||'delete_validate';
283 --
284 Begin
285 hr_utility.set_location('Entering:'||l_proc, 5);
286 --
287 -- Call all supporting business operations
288 --
289 hr_utility.set_location(' Leaving:'||l_proc, 10);
290 End delete_validate;
291 --
292 end per_sst_bus;