4 -- ----------------------------------------------------------------------------
1 Package Body hxc_map_bus as
2 /* $Header: hxcmaprhi.pkb 120.2 2005/09/23 08:17:59 nissharm noship $ */
3 --
8 g_package varchar2(33) := ' hxc_map_bus.'; -- Global package name
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
9
10 g_debug boolean := hr_utility.debug_enabled;
11 --
12 -- ----------------------------------------------------------------------------
13 -- |-----------------------< chk_non_updateable_args >------------------------|
14 -- ----------------------------------------------------------------------------
15 -- {Start Of Comments}
16 --
17 -- Description:
18 -- This procedure is used to ensure that non updateable attributes have
19 -- not been updated. If an attribute has been updated an error is generated.
20 --
21 -- Pre Conditions:
22 -- g_old_rec has been populated with details of the values currently in
23 -- the database.
24 --
25 -- In Arguments:
26 -- p_rec has been populated with the updated values the user would like the
27 -- record set to.
28 --
29 -- Post Success:
30 -- Processing continues if all the non updateable attributes have not
31 -- changed.
32 --
33 -- Post Failure:
34 -- An application error is raised if any of the non updatable attributes
35 -- have been altered.
36 --
37 -- {End Of Comments}
38 -- ----------------------------------------------------------------------------
39 Procedure chk_non_updateable_args
40 (p_rec in hxc_map_shd.g_rec_type
41 ) IS
42 --
43 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
44 l_error EXCEPTION;
45 l_argument varchar2(30);
46 --
47 Begin
48 --
49 -- Only proceed with the validation if a row exists for the current
50 -- record in the HR Schema.
51 --
52 IF NOT hxc_map_shd.api_updating
53 (p_mapping_id => p_rec.mapping_id
54 ,p_object_version_number => p_rec.object_version_number
55 ) THEN
56 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
57 fnd_message.set_token('PROCEDURE ', l_proc);
58 fnd_message.set_token('STEP ', '5');
59 fnd_message.raise_error;
60 END IF;
61 --
62 -- EDIT_HERE: Add checks to ensure non-updateable args have
63 -- not been updated.
64 --
65 EXCEPTION
66 WHEN l_error THEN
67 hr_api.argument_changed_error
68 (p_api_name => l_proc
69 ,p_argument => l_argument);
70 WHEN OTHERS THEN
71 RAISE;
72 End chk_non_updateable_args;
73 --
74 -- ----------------------------------------------------------------------------
75 -- |-----------------------< chk_name >---------------------------------------|
76 -- ----------------------------------------------------------------------------
77 -- {Start Of Comments}
78 --
79 -- Description:
80 --
81 -- SEE DESCRIPTION IN PACKAGE HEADER
82 --
83 -- Note:
84 -- This procedure is called from the client
85 --
86 -- {End Of Comments}
87 -- ----------------------------------------------------------------------------
88 Procedure chk_name
89 (
90 p_name in hxc_mappings.name%TYPE
91 ,p_mapping_id in hxc_mappings.mapping_id%TYPE
92 ) IS
93 --
94 l_proc varchar2(72);
95 --
96 -- cursor to check name does not overlap
97 --
98 CURSOR csr_chk_name IS
99 SELECT 'error'
100 FROM sys.dual
101 WHERE EXISTS (
102 SELECT 'x'
103 FROM hxc_mappings map
104 WHERE map.name = p_name AND
105 ( map.mapping_id <> p_mapping_id OR
106 p_mapping_id IS NULL ) );
107 --
108 l_dup_name varchar2(5) := NULL;
109 --
110 BEGIN
111 g_debug := hr_utility.debug_enabled;
112
113 if g_debug then
114 l_proc := g_package||'chk_name';
115 hr_utility.set_location('Entering:'||l_proc, 5);
116 end if;
117 --
118 -- check that the name has been entered
119 --
120 IF p_name IS NULL
121 THEN
122 --
123 hr_utility.set_message(809, 'HXC_0028_MAP_NAME_MAND');
124 hr_utility.raise_error;
125 --
126 END IF;
127 if g_debug then
128 hr_utility.set_location('Processing:'||l_proc, 10);
129 end if;
130 --
131 -- check that the name is unique
132 --
133 OPEN csr_chk_name;
134 FETCH csr_chk_name INTO l_dup_name;
135 CLOSE csr_chk_name;
136 --
137 IF l_dup_name IS NOT NULL
138 THEN
139 --
140 hr_utility.set_message(809, 'HXC_0029_MAP_DUP_NAME');
141 hr_utility.raise_error;
142 --
143 END IF;
144 --
145 if g_debug then
146 hr_utility.set_location('Leaving:'||l_proc, 20);
147 end if;
148 --
149 END chk_name;
150 --
151 -- ----------------------------------------------------------------------------
152 -- |-----------------------< chk_delete >-------------------------------------|
153 -- ----------------------------------------------------------------------------
154 -- {Start Of Comments}
155 --
156 -- Description:
157 --
158 -- SEE DESCRIPTION IN PACKAGE HEADER
159 --
160 -- Note:
161 -- This procedure is shared by hxc_mcu_bus
162 --
163 -- {End Of Comments}
164 -- ----------------------------------------------------------------------------
165 Procedure chk_delete
166 (
167 p_mapping_id in hxc_mappings.mapping_id%TYPE
168 ) IS
169 --
170 l_proc varchar2(72);
171 --
172 CURSOR csr_chk_dar IS
173 SELECT 'exists'
174 FROM sys.dual
175 WHERE EXISTS (
176 SELECT 'x'
177 FROM hxc_time_entry_rules dar
178 WHERE dar.mapping_id = p_mapping_id);
179 --
180 --
181 CURSOR csr_chk_dep IS
182 SELECT 'exists'
183 FROM sys.dual
184 WHERE EXISTS (
185 SELECT 'x'
186 FROM hxc_deposit_processes dep
187 WHERE dep.mapping_id = p_mapping_id);
188 --
189 --
190 CURSOR csr_chk_ret IS
191 SELECT 'exists'
192 FROM sys.dual
193 WHERE EXISTS (
194 SELECT 'x'
195 FROM hxc_retrieval_processes ret
196 WHERE ret.mapping_id = p_mapping_id);
197 --
198 l_exists VARCHAR2(6) := NULL;
199 --
200 BEGIN
201 g_debug := hr_utility.debug_enabled;
202
203 if g_debug then
204 l_proc := g_package||'chk_delete';
205 hr_utility.set_location('Entering:'||l_proc, 5);
206 end if;
207 --
208 -- check that mapping is not being used by data approval rule
209 --
210 OPEN csr_chk_dar;
211 FETCH csr_chk_dar INTO l_exists;
212 CLOSE csr_chk_dar;
213 --
214 if g_debug then
215 hr_utility.set_location('Processing: '||l_proc, 10);
216 end if;
217 --
218 IF l_exists IS NOT NULL
219 THEN
220 --
221 hr_utility.set_message(809, 'HXC_0030_MAPPING_USED');
222 hr_utility.raise_error;
223 --
224 END IF;
225 --
226 if g_debug then
227 hr_utility.set_location('Processing: '||l_proc, 20);
228 end if;
229 --
230 -- check that mapping is not being used by data approval rule
231 --
232 OPEN csr_chk_dep;
233 FETCH csr_chk_dep INTO l_exists;
234 CLOSE csr_chk_dep;
235 --
236 if g_debug then
237 hr_utility.set_location('Processing: '||l_proc, 30);
238 end if;
239 --
240 IF l_exists IS NOT NULL
241 THEN
242 --
243 hr_utility.set_message(809, 'HXC_0030_MAPPING_USED');
244 hr_utility.raise_error;
245 --
246 END IF;
247 --
248 if g_debug then
249 hr_utility.set_location('Processing: '||l_proc, 40);
250 end if;
251 --
252 -- check that mapping is not being used by data approval rule
253 --
254 OPEN csr_chk_ret;
255 FETCH csr_chk_ret INTO l_exists;
256 CLOSE csr_chk_ret;
257 --
258 if g_debug then
259 hr_utility.set_location('Processing: '||l_proc, 50);
260 end if;
261 --
262 IF l_exists IS NOT NULL
263 THEN
264 --
265 hr_utility.set_message(809, 'HXC_0030_MAPPING_USED');
266 hr_utility.raise_error;
267 --
268 END IF;
269 --
270 if g_debug then
271 hr_utility.set_location('Processing: '||l_proc, 60);
272 end if;
273 --
274 END chk_delete;
275 --
276 -- ----------------------------------------------------------------------------
277 -- |---------------------------< insert_validate >----------------------------|
278 -- ----------------------------------------------------------------------------
279 Procedure insert_validate
280 (p_rec in hxc_map_shd.g_rec_type
281 ) is
282 --
283 l_proc varchar2(72);
284 --
285 Begin
286 g_debug := hr_utility.debug_enabled;
287
288 if g_debug then
289 l_proc := g_package||'insert_validate';
290 hr_utility.set_location('Entering:'||l_proc, 5);
291 end if;
292 --
293 -- Call all supporting business operations
294 --
295 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
296 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
297 --
298 chk_name (
299 p_name => p_rec.name
300 ,p_mapping_id => p_rec.mapping_id );
301 --
302 if g_debug then
303 hr_utility.set_location(' Leaving:'||l_proc, 10);
304 end if;
305 End insert_validate;
306 --
307 -- ----------------------------------------------------------------------------
308 -- |---------------------------< update_validate >----------------------------|
309 -- ----------------------------------------------------------------------------
310 Procedure update_validate
311 (p_rec in hxc_map_shd.g_rec_type
312 ) is
313 --
314 l_proc varchar2(72);
315 --
316 Begin
317 g_debug := hr_utility.debug_enabled;
318
319 if g_debug then
320 l_proc := g_package||'update_validate';
321 hr_utility.set_location('Entering:'||l_proc, 5);
322 end if;
323 --
324 -- Call all supporting business operations
325 --
326 --
330 chk_name (
327 -- "-- No business group context. HR_STANDARD_LOOKUPS used for validation."
328 -- "-- CLIENT_INFO not set. No lookup validation or joins to HR_LOOKUPS."
329 --
331 p_name => p_rec.name
332 ,p_mapping_id => p_rec.mapping_id );
333 --
334 chk_non_updateable_args
335 (p_rec => p_rec
336 );
337 --
338 --
339 if g_debug then
340 hr_utility.set_location(' Leaving:'||l_proc, 10);
341 end if;
342 End update_validate;
343 --
344 -- ----------------------------------------------------------------------------
345 -- |---------------------------< delete_validate >----------------------------|
346 -- ----------------------------------------------------------------------------
347 Procedure delete_validate
348 (p_rec in hxc_map_shd.g_rec_type
349 ) is
350 --
351 l_proc varchar2(72);
352 --
353 Begin
354 g_debug := hr_utility.debug_enabled;
355
356 if g_debug then
357 l_proc := g_package||'delete_validate';
358 hr_utility.set_location('Entering:'||l_proc, 5);
359 end if;
360 --
361 -- Call all supporting business operations
362 --
363 chk_delete ( p_mapping_id => p_rec.mapping_id );
364 --
365 if g_debug then
366 hr_utility.set_location(' Leaving:'||l_proc, 10);
367 end if;
368 End delete_validate;
369 --
370 end hxc_map_bus;