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