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