[Home] [Help]
PACKAGE BODY: APPS.AME_AGL_BUS
Source
4 -- ----------------------------------------------------------------------------
1 Package Body ame_agl_bus as
2 /* $Header: amaglrhi.pkb 120.0 2005/09/02 03:49 mbocutt noship $ */
3 --
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ame_agl_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_approval_group_id number default null;
15 g_language varchar2(4) default null;
16
17 -- ----------------------------------------------------------------------------
18 -- |-------------------------< CHK_APPROVAL_GROUP_ID >------------|
19 -- ----------------------------------------------------------------------------
20 -- {Start Of Comments}
21 --
22 -- Description:
23 -- This procedure validates the approval_group_id.
24 --
25 -- Pre-Requisites:
26 -- None
27 --
28 -- In Parameters:
29 -- p_name
30 --
31 -- Post Success:
32 -- Processing continues if a valid approval_group_id is entered.
33 --
34 -- Post Failure:
35 -- An application error is raised approval_group_id is invalid.
36 --
37 -- Access Status:
38 -- Internal Row Handler Use Only.
39 --
40 -- {End Of Comments}
41 -- ----------------------------------------------------------------------------
42 procedure chk_approval_group_id(p_approval_group_id in number
43 ) IS
44 --
45 l_proc varchar2(72) := g_package || 'chk_approval_group_id';
46 l_count number;
47 cursor CSel1 is
48 select count(*)
49 from ame_approval_groups
50 where approval_group_id = p_approval_group_id
51 and sysdate >= start_date and sysdate < end_date;
52 Begin
53 hr_utility.set_location('Entering:'||l_proc,10);
54 hr_api.mandatory_arg_error(p_api_name => l_proc
55 ,p_argument => 'APPROVAL_GROUP_ID'
56 ,p_argument_value => p_approval_group_id
57 );
58 open CSel1;
59 fetch CSel1 into l_count;
60 close CSel1;
61 if l_count = 0 then
62 fnd_message.set_name('PER','AME_400557_INVALID_APG_ID');
63 fnd_message.raise_error;
64 end if;
65 hr_utility.set_location(' Leaving:'||l_proc,30);
66 exception
67 when app_exception.application_exception then
68 if hr_multi_message.exception_add
69 (p_associated_column1 =>
70 'AME_APPROVAL_GROUPS_TL.APPROVAL_GROUP_ID'
71 ) then
72 hr_utility.set_location(' Leaving:'||l_proc, 40);
73 raise;
74 end if;
75 hr_utility.set_location( ' Leaving:'||l_proc,50 );
76 End chk_approval_group_id;
77
78
79 -- ----------------------------------------------------------------------------
80 -- |-------------------------< CHK_USER_APPROVAL_GROUP_NAME >------------|
81 -- ----------------------------------------------------------------------------
82 -- {Start Of Comments}
83 --
84 -- Description:
85 -- This procedure ensures user_approval_group_name is not null.
86 --
87 -- Pre-Requisites:
88 -- None
89 --
90 -- In Parameters:
91 -- p_user_approval_group_name
92 --
93 -- Post Success:
94 -- Processing continues if a non null value is entered.
95 --
96 -- Post Failure:
97 -- An application error is raised if the name is null.
98 --
99 -- Access Status:
100 -- Internal Row Handler Use Only.
101 --
102 -- {End Of Comments}
103 -- ----------------------------------------------------------------------------
104 procedure chk_user_approval_group_name(p_user_approval_group_name in varchar2
105 ) IS
106 --
107 l_proc varchar2(72) := g_package || 'chk_user_approval_group_name';
108 Begin
109 hr_utility.set_location('Entering:'||l_proc,10);
110 hr_api.mandatory_arg_error(p_api_name => l_proc
111 ,p_argument => 'USER_APPROVAL_GROUP_NAME'
112 ,p_argument_value => p_user_approval_group_name
113 );
114 hr_utility.set_location(' Leaving:'||l_proc,30);
115 exception
116 when app_exception.application_exception then
117 if hr_multi_message.exception_add
118 (p_associated_column1 =>
119 'AME_APPROVAL_GROUPS_TL.USER_APPROVAL_GROUP_NAME'
120 ) then
121 hr_utility.set_location(' Leaving:'||l_proc, 40);
122 raise;
123 end if;
124 hr_utility.set_location( ' Leaving:'||l_proc,50 );
125 End chk_user_approval_group_name;
126
127
128 -- ----------------------------------------------------------------------------
129 -- |-------------------------< CHK_DESCRIPTION >------------|
130 -- ----------------------------------------------------------------------------
131 -- {Start Of Comments}
132 --
133 -- Description:
134 -- This procedure ensures group's description is not null.
135 --
136 -- Pre-Requisites:
137 -- None
138 --
139 -- In Parameters:
140 -- p_description
141 --
142 -- Post Success:
143 -- Processing continues if a non null description is entered.
144 --
145 -- Post Failure:
146 -- An application error is raised if description is null.
147 --
148 -- Access Status:
149 -- Internal Row Handler Use Only.
150 --
151 -- {End Of Comments}
152 -- ----------------------------------------------------------------------------
153 procedure chk_description(p_description in varchar2
154 ) IS
155 --
156 l_proc varchar2(72) := g_package || 'chk_description';
157 Begin
158 hr_utility.set_location('Entering:'||l_proc,10);
159 hr_api.mandatory_arg_error(p_api_name => l_proc
160 ,p_argument => 'DESCRIPTION'
161 ,p_argument_value => p_description
162 );
163 hr_utility.set_location(' Leaving:'||l_proc,30);
164 exception
165 when app_exception.application_exception then
166 if hr_multi_message.exception_add
167 (p_associated_column1 =>
168 'AME_APPROVAL_GROUPS_TL.DESCRIPTION'
169 ) then
170 hr_utility.set_location(' Leaving:'||l_proc, 40);
171 raise;
172 end if;
173 hr_utility.set_location( ' Leaving:'||l_proc,50 );
174 End chk_description;
175
176 --
177 -- ----------------------------------------------------------------------------
178 -- |-----------------------< chk_non_updateable_args >------------------------|
179 -- ----------------------------------------------------------------------------
180 -- {Start Of Comments}
181 --
182 -- Description:
183 -- This procedure is used to ensure that non updateable attributes have
184 -- not been updated. If an attribute has been updated an error is generated.
185 --
186 -- Pre Conditions:
187 -- g_old_rec has been populated with details of the values currently in
188 -- the database.
189 --
190 -- In Arguments:
191 -- p_rec has been populated with the updated values the user would like the
192 -- record set to.
193 --
194 -- Post Success:
195 -- Processing continues if all the non updateable attributes have not
196 -- changed.
197 --
198 -- Post Failure:
199 -- An application error is raised if any of the non updatable attributes
200 -- have been altered.
201 --
202 -- {End Of Comments}
203 -- ----------------------------------------------------------------------------
204 Procedure chk_non_updateable_args
205 (p_rec in ame_agl_shd.g_rec_type
206 ) IS
207 --
208 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
209 --
210 Begin
211 --
212 -- Only proceed with the validation if a row exists for the current
213 -- record in the HR Schema.
214 --
215 IF NOT ame_agl_shd.api_updating
216 (p_approval_group_id => p_rec.approval_group_id
217 ,p_language => p_rec.language
218 ) THEN
219 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
220 fnd_message.set_token('PROCEDURE ', l_proc);
221 fnd_message.set_token('STEP ', '5');
222 fnd_message.raise_error;
223 END IF;
224 --
225 -- EDIT_HERE: Add checks to ensure non-updateable args have
226 -- not been updated.
227 --
228 End chk_non_updateable_args;
229 --
230 -- ----------------------------------------------------------------------------
231 -- |---------------------------< insert_validate >----------------------------|
232 -- ----------------------------------------------------------------------------
233 Procedure insert_validate
234 (p_rec in ame_agl_shd.g_rec_type
235 ) is
236 --
237 l_proc varchar2(72) := g_package||'insert_validate';
238 --
239 Begin
240 hr_utility.set_location('Entering:'||l_proc, 5);
241 --
242 -- Call all supporting business operations
243 --
244 --
245 -- EDIT_HERE: As this table does not have a mandatory business_group_id
246 -- column, ensure client_info is populated by calling a suitable
247 -- ???_???_bus.set_security_group_id procedure, or add one of the following
248 -- comments:
249 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
250 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
251 --
252 -- Validate Dependent Attributes
253 --
254 --
255 chk_approval_group_id(
256 p_approval_group_id => p_rec.approval_group_id
257 );
258 chk_user_approval_group_name
259 (p_user_approval_group_name => p_rec.user_approval_group_name
260 );
261 chk_description (p_description => p_rec.description);
262
263 hr_utility.set_location(' Leaving:'||l_proc, 10);
264 End insert_validate;
265 --
266 -- ----------------------------------------------------------------------------
267 -- |---------------------------< update_validate >----------------------------|
268 -- ----------------------------------------------------------------------------
269 Procedure update_validate
270 (p_rec in ame_agl_shd.g_rec_type
271 ) is
272 --
273 l_proc varchar2(72) := g_package||'update_validate';
274 --
275 Begin
276 hr_utility.set_location('Entering:'||l_proc, 5);
277 --
278 -- Call all supporting business operations
279 --
280 --
281 -- EDIT_HERE: As this table does not have a mandatory business_group_id
282 -- column, ensure client_info is populated by calling a suitable
283 -- ???_???_bus.set_security_group_id procedure, or add one of the following
284 -- comments:
285 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
286 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
287 --
288 -- Validate Dependent Attributes
289 --
290 chk_user_approval_group_name
291 (p_user_approval_group_name => p_rec.user_approval_group_name
292 );
293 chk_description (p_description => p_rec.description);
294 chk_non_updateable_args
295 (p_rec => p_rec
296 );
297 --
298 --
299 hr_utility.set_location(' Leaving:'||l_proc, 10);
300 End update_validate;
301 --
302 -- ----------------------------------------------------------------------------
303 -- |---------------------------< delete_validate >----------------------------|
304 -- ----------------------------------------------------------------------------
305 Procedure delete_validate
306 (p_rec in ame_agl_shd.g_rec_type
307 ) is
308 --
309 l_proc varchar2(72) := g_package||'delete_validate';
310 --
311 Begin
312 hr_utility.set_location('Entering:'||l_proc, 5);
313 --
314 -- Call all supporting business operations
315 --
316 hr_utility.set_location(' Leaving:'||l_proc, 10);
317 End delete_validate;
318 --
319 end ame_agl_bus;