[Home] [Help]
PACKAGE BODY: APPS.HXC_RECURRING_PERIODS_API
Source
1 Package Body hxc_recurring_periods_api as
2 /* $Header: hxchrpapi.pkb 120.2 2005/09/23 10:43:08 sechandr noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' hxc_recurring_periods_api.';
7 g_debug boolean :=hr_utility.debug_enabled;
8 --
9 -- ----------------------------------------------------------------------------
10 -- |--------------------------< create_recurring_periods >--------------------|
11 -- ----------------------------------------------------------------------------
12 --
13 procedure create_recurring_periods
14 (p_validate in boolean default false
15 ,p_recurring_period_id in out nocopy number
16 ,p_object_version_number in out nocopy number
17 ,p_name in varchar2
18 ,p_period_type in varchar2 default null
19 ,p_duration_in_days in number default null
20 ,p_start_date in date
21 ,p_end_date in date default null
22 ,p_effective_date in date default null
23 ) is
24 --
25 -- Declare cursors and local variables
26 --
27
28 l_proc varchar2(72);
29 l_object_version_number hxc_recurring_periods.object_version_number%TYPE;
30 l_recurring_period_id hxc_recurring_periods.recurring_period_id%TYPE;
31 --
32 Begin
33 --
34
35 g_debug:=hr_utility.debug_enabled;
36 if g_debug then
37 l_proc := g_package||'create_recurring_periods';
38 hr_utility.set_location('Entering:'|| l_proc, 10);
39 end if;
40 --
41 -- Issue a savepoint
42 --
43 savepoint create_recurring_periods;
44 --
45 if g_debug then
46 hr_utility.set_location(l_proc, 20);
47 end if;
48 --
49 -- Truncate the time portion from all IN date parameters
50 --
51
52 --
53 -- Call Before Process User Hook
54 --
55 begin
56 hxc_recurring_periods_bk_1.create_recurring_periods_b
57 (p_recurring_period_id => p_recurring_period_id
58 ,p_object_version_number => p_object_version_number
59 ,p_name => p_name
60 ,p_period_type => p_period_type
61 ,p_duration_in_days => p_duration_in_days
62 ,p_start_date => p_start_date
63 ,p_end_date => p_end_date
64 ,p_effective_date => p_effective_date
65 );
66 exception
67 when hr_api.cannot_find_prog_unit then
68 hr_api.cannot_find_prog_unit_error
69 (p_module_name => 'create_recurring_periods'
70 ,p_hook_type => 'BP'
71 );
72 end;
73 --
74 if g_debug then
75 hr_utility.set_location(l_proc, 30);
76 end if;
77 --
78
79 --
80 -- Validation in addition to Row Handlers
81 --
82
83
84
85 --
86 -- Process Logic
87 --
88 if g_debug then
89 hr_utility.set_location(l_proc, 40);
90 end if;
91 --
92 -- call row handler
93 --
94 hxc_hrp_ins.ins
95 (p_effective_date => p_effective_date
96 ,p_name => p_name
97 ,p_period_type => p_period_type
98 ,p_duration_in_days => p_duration_in_days
99 ,p_start_date => p_start_date
100 ,p_end_date => p_end_date
101 ,p_recurring_period_id => l_recurring_period_id
102 ,p_object_version_number => l_object_version_number
103 );
104 --
105 if g_debug then
106 hr_utility.set_location(l_proc, 50);
107 end if;
108 --
109 -- Call After Process User Hook
110 --
111 begin
112 hxc_recurring_periods_bk_1.create_recurring_periods_a
113 (p_recurring_period_id => p_recurring_period_id
114 ,p_object_version_number => p_object_version_number
115 ,p_name => p_name
116 ,p_period_type => p_period_type
117 ,p_duration_in_days => p_duration_in_days
118 ,p_start_date => p_start_date
119 ,p_end_date => p_end_date
120 ,p_effective_date => p_effective_date
121 );
122 exception
123 when hr_api.cannot_find_prog_unit then
124 hr_api.cannot_find_prog_unit_error
125 (p_module_name => 'create_recurring_periods'
126 ,p_hook_type => 'AP'
127 );
128 end;
129 --
130 if g_debug then
131 hr_utility.set_location(l_proc, 60);
132 end if;
133 --
134 --
135 -- When in validation only mode raise the Validate_Enabled exception
136 --
137 if p_validate then
138 raise hr_api.validate_enabled;
139 end if;
140 --
141 --if g_debug then
142 --hr_utility.set_location(' Leaving:'||l_proc, 70);
143 --end if;
144 --
145 --
146 -- Set all output arguments
147 --
148 p_recurring_period_id := l_recurring_period_id;
149 p_object_version_number := l_object_version_number;
150 --
151 if g_debug then
152 hr_utility.set_location(' Leaving:'||l_proc, 70);
153 end if;
154 exception
155 when hr_api.validate_enabled then
156 --
157 -- As the Validate_Enabled exception has been raised
158 -- we must rollback to the savepoint
159 --
160 rollback to create_recurring_periods;
161 --
162 -- Only set output warning arguments
163 -- (Any key or derived arguments must be set to null
164 -- when validation only mode is being used.)
165 --
166 p_recurring_period_id := null;
167 p_object_version_number := null;
168 if g_debug then
169 hr_utility.set_location(' Leaving:'||l_proc, 80);
170 end if;
171 when others then
172 --
173 -- A validation or unexpected error has occured
174 --
175 rollback to create_recurring_periods;
176 if g_debug then
177 hr_utility.set_location(' Leaving:'||l_proc, 90);
178 end if;
179 raise;
180 --
181
182 end create_recurring_periods;
183 --
184 --
185 -- ----------------------------------------------------------------------------
186 -- |------------------------< update_recurring_periods>-----------------------|
187 -- ----------------------------------------------------------------------------
188 --
189 procedure update_recurring_periods
190 (p_validate in boolean default false
191 ,p_recurring_period_id in number
192 ,p_object_version_number in out nocopy number
193 ,p_name in varchar2
194 ,p_period_type in varchar2 default null
195 ,p_duration_in_days in number default null
196 ,p_start_date in date default null
197 ,p_end_date in date default null
198 ,p_effective_date in date default null
199 )is
200 --
201 -- Declare cursors and local variables
202 --
203 l_proc varchar2(72);
204 l_object_version_number hxc_recurring_periods.object_version_number%TYPE := p_object_version_number;
205 --
206 Begin
207 --
208 g_debug:=hr_utility.debug_enabled;
209 if g_debug then
210 l_proc := g_package||' update_recurring_periods';
211 hr_utility.set_location('Entering:'|| l_proc, 10);
212 end if;
213 --
214 -- Issue a savepoint if operating in validation only mode
215 --
216 savepoint update_recurring_periods;
217 --
218 if g_debug then
219 hr_utility.set_location(l_proc, 20);
220 end if;
221 --
222 -- Call Before Process User Hook
223 --
224 begin
225 hxc_recurring_periods_bk_1.update_recurring_periods_b
226 (p_recurring_period_id => p_recurring_period_id
227 ,p_object_version_number => p_object_version_number
228 ,p_name => p_name
229 ,p_start_date => p_start_date
230 ,p_end_date => p_end_date
231 ,p_period_type => p_period_type
232 ,p_duration_in_days => p_duration_in_days
233 ,p_effective_date => p_effective_date
234 );
235 exception
236 when hr_api.cannot_find_prog_unit then
237 hr_api.cannot_find_prog_unit_error
238 (p_module_name => 'update_recurring_periods'
239 ,p_hook_type => 'BP'
240 );
241 end;
242 --
243 --insert into mtemp values('out of comp_b');
244 --commit;
245 --if g_debug then
246 --hr_utility.set_location(l_proc, 30);
247 --end if;
248 --
249 -- Process Logic
250 --
251 -- call row handler
252 --
253 --insert into mtemp values('calling hxc_hac_upd.upd');
254 -- commit;
255 hxc_hrp_upd.upd
256 (
257 p_effective_date => p_effective_date
258 , p_recurring_period_id => p_recurring_period_id
259 ,p_object_version_number => l_object_version_number
260 ,p_name => p_name
261 -- ,p_period_type => p_period_type
262 -- ,p_duration_in_days => p_duration_in_days
263 -- ,p_start_date => p_start_date
264 -- ,p_end_date => p_end_date
265 );
266
267 --
268 --
269 --insert into mtemp values('out of hax_hac_upd');
270 --commit;
271
272 if g_debug then
273 hr_utility.set_location(l_proc, 40);
274 end if;
275 --
276 -- Call After Process User Hook
277 --
278 begin
279 hxc_recurring_periods_bk_1.update_recurring_periods_a
280 (p_recurring_period_id => p_recurring_period_id
281 ,p_object_version_number => p_object_version_number
282 ,p_name => p_name
283 ,p_period_type => p_period_type
284 ,p_duration_in_days => p_duration_in_days
285 ,p_start_date => p_start_date
286 ,p_end_date => p_end_date
287 ,p_effective_date => p_effective_date
288 );
289 exception
290 when hr_api.cannot_find_prog_unit then
291 hr_api.cannot_find_prog_unit_error
292 (p_module_name => 'update_recurring_periods'
293 ,p_hook_type => 'AP'
294 );
295 end;
296 --
297 --insert into mtemp values('out of comp_a');
298 --commit;
299
300 if g_debug then
301 hr_utility.set_location(l_proc, 50);
302 end if;
303 --
304 -- When in validation only mode raise the Validate_Enabled exception
305 --
306 if p_validate then
307 raise hr_api.validate_enabled;
308 end if;
309 --
310 if g_debug then
311 hr_utility.set_location(' Leaving:'||l_proc, 60);
312 end if;
313 --
314 -- Set all output arguments
315 --
316 --insert into mtemp values('setting OVN value ');
317 --commit;
318
319 p_object_version_number := l_object_version_number;
320 --
321 --insert into mtemp values('OVN value set');
322 --commit;
323
324 exception
325 --
326 when hr_api.validate_enabled then
327 --
328 -- As the Validate_Enabled exception has been raised
329 -- we must rollback to the savepoint
330 --
331 ROLLBACK TO update_recurring_periods;
332 --
333 -- Only set output warning arguments
334 -- (Any key or derived arguments must be set to null
335 -- when validation only mode is being used.)
336 --
337 p_object_version_number := null;
338 --
339 --insert into mtemp values('OVN set to null');
340 --commit;
341
342 if g_debug then
343 hr_utility.set_location(' Leaving:'||l_proc, 60);
344 end if;
345 --
346 when others then
347 --
348 -- A validation or unexpected error has occured
349 --
350 ROLLBACK TO update_recurring_periods;
351 if g_debug then
352 hr_utility.set_location(' Leaving:'||l_proc, 70);
353 end if;
354 raise;
355 --
356 END update_recurring_periods;
357 --
358 -- ----------------------------------------------------------------------------
359 -- |------------------------< delete_recurring_periods >----------------------|
360 -- ----------------------------------------------------------------------------
361 --
362 procedure delete_recurring_periods
363 (p_validate in boolean default false
364 ,p_recurring_period_id in number
365 ,p_object_version_number in number
366 ) is
367 --
368 -- Declare cursors and local variables
369 --
370 l_proc varchar2(72);
371 --
372 begin
373 --
374 g_debug:=hr_utility.debug_enabled;
375 if g_debug then
376 l_proc := g_package||'delete_recurring_periods';
377 hr_utility.set_location('Entering:'|| l_proc, 10);
378 end if;
379 --
380 -- Issue a savepoint if operating in validation only mode
381 --
382 savepoint delete_recurring_periods;
383 --
384 if g_debug then
385 hr_utility.set_location(l_proc, 20);
386 end if;
387 --
388 -- Call Before Process User Hook
389 --
390 begin
391 --
392 hxc_recurring_periods_bk_1.delete_recurring_periods_b
393 (p_recurring_period_id => p_recurring_period_id
394 ,p_object_version_number => p_object_version_number
395 );
396 exception
397 when hr_api.cannot_find_prog_unit then
398 hr_api.cannot_find_prog_unit_error
399 (p_module_name => 'delete_recurring_periods'
400 ,p_hook_type => 'BP'
401 );
402 end;
403 --
404 if g_debug then
405 hr_utility.set_location(l_proc, 30);
406 end if;
407 --
408 -- Process Logic
409 --
410 hr_utility.set_message(809, 'HXC_REC_PERIOD_DEL_NOT_ALLOWED');
411 hr_utility.raise_error;
412
413 /* hxc_hrp_del.del
414 (
415 p_recurring_period_id => p_recurring_period_id
416 ,p_object_version_number => p_object_version_number
417 );
418 --
419 */
420
421 --
422 if g_debug then
423 hr_utility.set_location(l_proc, 40);
424 end if;
425 --
426 -- Call After Process User Hook
427 --
428 begin
429 --
430 hxc_recurring_periods_bk_1.delete_recurring_periods_a
431 (p_recurring_period_id => p_recurring_period_id
432 ,p_object_version_number => p_object_version_number
433 );
434 exception
435 when hr_api.cannot_find_prog_unit then
436 hr_api.cannot_find_prog_unit_error
437 (p_module_name => 'delete_recurring_periods'
438 ,p_hook_type => 'AP'
439 );
440 end;
441 --
442 -- When in validation only mode raise the Validate_Enabled exception
443 --
444 if p_validate then
445 raise hr_api.validate_enabled;
446 end if;
447 --
448 if g_debug then
449 hr_utility.set_location(' Leaving:'||l_proc, 50);
450 end if;
451 --
452 exception
453 --
454 when hr_api.validate_enabled then
455 --
456 -- As the Validate_Enabled exception has been raised
457 -- we must rollback to the savepoint
458 --
459 ROLLBACK TO delete_recurring_periods;
460 --
461 when others then
462 --
463 -- A validation or unexpected error has occured
464 --
465 ROLLBACK TO delete_recurring_periods;
466 raise;
467 --
468 end delete_recurring_periods;
469 --
470 end hxc_recurring_periods_api;