DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_TIME_CATEGORY_HOOK

Source


1 package body hxc_time_category_hook as
2 /* $Header: hxchtchk.pkb 120.5 2006/03/24 16:27:16 jdupont noship $ */
3 
4 g_debug boolean := hr_utility.debug_enabled;
5 
6 procedure maintain_pto_time_category (
7 		p_accrual_plan_id	  NUMBER default null
8 	,       p_net_calculation_rule_id NUMBER default null
9 	,	p_delete		BOOLEAN ) IS
10 
11 l_proc	VARCHAR2(72) ;
12 l_dummy VARCHAR2(1);
13 
14 CURSOR csr_get_time_category_info ( p_tc_name VARCHAR2 ) IS
15 SELECT
16 	tc.time_category_name
17 ,	tc.time_category_id
18 ,	tc.object_version_number
19 FROM
20 	hxc_time_categories tc
21 WHERE
22 	tc.time_Category_name like p_tc_name;
23 
24 CURSOR  csr_get_accrual_plan_name ( p_pap_id NUMBER) IS
25 SELECT  pap.accrual_plan_name
26 FROM	pay_accrual_plans pap
27 WHERE	pap.accrual_plan_id = p_pap_id;
28 
29 
30 CURSOR  csr_get_accrual_plan_id IS
31 SELECT  ncr.accrual_plan_id
32 FROM	pay_net_calculation_rules ncr
33 WHERE	ncr.net_calculation_rule_id = p_net_calculation_rule_id;
34 
35 
36 CURSOR csr_get_elements ( p_pap_id NUMBER, p_ncr_id NUMBER ) IS
37 SELECT
38 	ap.accrual_plan_name
39 ,	ncr.element_type_id
40 ,	ncr.element_type_name
41 ,	ncr.add_or_subtract
42 FROM
43 	pay_accrual_plans ap
44 ,	pay_net_calculation_rules_v ncr
45 WHERE
46 	ncr.accrual_plan_id         = p_pap_id AND
47 	ncr.net_calculation_rule_id = p_ncr_id
48 AND
49 	ap.accrual_plan_id  = ncr.accrual_plan_id
50 ORDER BY
51         ncr.net_calculation_rule_id;
52 
53 CURSOR	csr_get_mpc_id IS
54 SELECT	mpc.mapping_component_id
55 FROM	hxc_mapping_components mpc
56 WHERE	mpc.name = 'Dummy Element Context';
57 
58 CURSOR  csr_get_tc_comp ( p_tc_id NUMBER, p_mpc_id NUMBER, p_element_type_id NUMBER ) IS
59 SELECT	tcc.time_category_comp_id
60 ,	tcc.object_version_number
61 FROM	hxc_time_category_comps tcc
62 WHERE	tcc.time_category_id  = p_tc_id
63 AND	tcc.component_type_id = p_mpc_id
64 AND	tcc.value_id = TO_CHAR(p_element_type_id);
65 
66 CURSOR  csr_chk_tc_comps ( p_tc_id NUMBER ) IS
67 SELECT	'x'
68 FROM	hxc_time_categories tc
69 WHERE	tc.time_category_id = p_tc_id
70 AND	EXISTS ( select 'x'
71 		 FROM   hxc_time_category_comps tcc
72 		 WHERe  tcc.time_category_id = tc.time_category_id );
73 
74 CURSOR  csr_get_min_inc_ncr ( p_pap_id NUMBER ) IS
75 SELECT  MIN (net_calculation_rule_id)
76 FROM    pay_net_calculation_rules
77 WHERE   accrual_plan_id = p_pap_id
78 AND     add_or_subtract = 1;
79 
80 l_accrual_info	csr_get_elements%ROWTYPE;
81 l_dec_tc_name	hxc_time_categories.time_category_name%TYPE;
82 l_inc_tc_name	hxc_time_categories.time_category_name%TYPE;
83 l_tc_name	hxc_time_categories.time_category_name%TYPE;
84 
85 l_dec_tc_id	hxc_time_categories.time_category_id%TYPE;
86 l_dec_tc_ovn	hxc_time_categories.object_version_number%TYPE;
87 l_inc_tc_id	hxc_time_categories.time_category_id%TYPE;
88 l_inc_tc_ovn	hxc_time_categories.object_version_number%TYPE;
89 
90 l_tcc_id	hxc_time_category_comps.time_category_comp_id%TYPE;
91 l_tcc_ovn	hxc_time_category_comps.object_version_number%TYPE;
92 l_mpc_id	hxc_mapping_components.mapping_component_id%TYPE;
93 
94 l_tc_info	csr_get_time_category_info%ROWTYPE;
95 
96 l_pap_id	    pay_accrual_plans.accrual_plan_id%TYPE;
97 l_accrual_plan_name pay_accrual_plans.accrual_plan_name%TYPE;
98 l_min_inc_ncr_id    pay_net_calculation_rules.net_calculation_rule_id%TYPE;
99 
100 l_session_id number;
101 l_old_user_id number;
102 l_old_resp_id number;
103 l_old_resp_appl_id number;
104 l_old_security_group_id number;
105 l_old_login_id number;
106 
107 l_alter_Session varchar2(50) := 'alter session set sql_trace TRUE';
108 
109 BEGIN
110 
111 
112 l_old_user_id := fnd_global.user_id;
113 l_old_resp_id := fnd_global.resp_id;
114 l_old_resp_appl_id := fnd_global.resp_appl_id;
115 l_old_security_group_id := fnd_global.security_group_id;
116 l_old_login_id := fnd_global.login_id;
117 
118 hr_general2.init_fndload (p_resp_appl_id => 809 );
119 
120 if g_debug then
121 	l_proc := g_package||'maintain_pto_time_category';
122 	hr_utility.trace('********** Params ***********');
123 	hr_utility.trace('p_accrual_plan_id is  :'||to_char(p_accrual_plan_id));
124 	hr_utility.trace('p_net_calc_rule_id is :'||to_char(p_net_calculation_rule_id));
125 end if;
126 
127 IF ( p_delete )
128 THEN
129 	if g_debug then
130 		hr_utility.trace('Delete is TRUE');
131 	end if;
132 ELSE
133 	if g_debug then
134 		hr_utility.trace('Delete is FALSE');
135 	end if;
136 END IF;
137 
138 if g_debug then
139 	hr_utility.trace('******** ENd Params ********');
140 end if;
141 
142 if g_debug then
143 	hr_utility.set_location('Entering '||l_proc, 10);
144 end if;
145 
146 IF ( p_accrual_plan_id IS NULL )
147 THEN
148 
149 	OPEN  csr_get_accrual_plan_id;
150 	FETCH csr_get_accrual_plan_id INTO l_pap_id;
151 	CLOSE csr_get_accrual_plan_id;
152 
153 ELSE
154 
155 	l_pap_id := p_accrual_plan_id;
156 
157 END IF;
158 
159 OPEN  csr_get_accrual_plan_name ( l_pap_id);
160 FETCH csr_get_accrual_plan_name INTO l_accrual_plan_name;
161 CLOSE csr_get_accrual_plan_name;
162 
163 if g_debug then
164 	hr_utility.trace('l pap id is '||to_char(l_pap_id));
165 end if;
166 
167 
168 -- get the Dummy Element Context mapping component id
169 
170 OPEN  csr_get_mpc_id;
171 FETCH csr_get_mpc_id INTO l_mpc_id;
172 CLOSE csr_get_mpc_id;
173 
174 if g_debug then
175 	hr_utility.set_location('Processing '||l_proc, 10);
176 end if;
177 
178 -- set the Time Category name
179 
180 l_tc_name := SUBSTR('OTL_DEC_'||l_accrual_plan_name,1,90)||'%';
181 
182 OPEN  csr_get_time_category_info ( l_tc_name );
183 FETCH csr_get_time_category_info INTO l_tc_info;
184 
185 IF ( l_tc_info.time_category_name IS NOT NULL )
186 THEN
187 	l_dec_tc_name := l_tc_info.time_category_name;
188 	l_dec_tc_id   := l_tc_info.time_category_id;
189 	l_dec_tc_ovn  := l_tc_info.object_version_number;
190 
191 	if g_debug then
192 		hr_utility.trace('DEC TC NAME is '||l_dec_tc_name);
193 		hr_utility.trace('DEC TC ID   is '||to_char(l_dec_tc_id));
194 		hr_utility.trace('DEC TC OVN  is '||to_char(l_dec_tc_ovn));
195 	end if;
196 
197 END IF;
198 
199 CLOSE csr_get_time_category_info;
200 
201 l_tc_info.time_category_name := NULL;
202 
203 l_tc_name := SUBSTR('OTL_INC_'||l_accrual_plan_name,1,90)||'%';
204 
205 OPEN  csr_get_time_category_info ( l_tc_name );
206 FETCH csr_get_time_category_info INTO l_tc_info;
207 
208 IF ( l_tc_info.time_category_name IS NOT NULL )
209 THEN
210 
211 	l_inc_tc_name := l_tc_info.time_category_name;
212 	l_inc_tc_id   := l_tc_info.time_category_id;
213 	l_inc_tc_ovn  := l_tc_info.object_version_number;
214 
215 	if g_debug then
216 		hr_utility.trace('INC TC NAME is '||l_inc_tc_name);
217 		hr_utility.trace('INC TC ID   is '||to_char(l_inc_tc_id));
218 		hr_utility.trace('INC TC OVN  is '||to_char(l_inc_tc_ovn));
219 	end if;
220 
221 END IF;
222 
223 CLOSE csr_get_time_category_info;
224 
225 if g_debug then
226 	hr_utility.set_location('Processing '||l_proc, 20);
227 end if;
228 
229 
230 OPEN  csr_get_elements ( l_pap_id, p_net_calculation_rule_id );
231 FETCH csr_get_elements INTO l_accrual_info;
232 
233 if g_debug then
234 	hr_utility.set_location('Processing '||l_proc, 30);
235 end if;
236 
237 -- create the new time category name
238 
239 WHILE csr_get_elements%FOUND
240 LOOP
241 
242 	IF ( ( l_dec_tc_name IS NULL ) AND ( NOT p_delete ) AND ( l_accrual_info.add_or_subtract = -1 ) )
243 	THEN
244 
245 		-- create time categories
246 
247 		if g_debug then
248 			hr_utility.set_location('Processing '||l_proc, 40);
249 		end if;
250 
251 		-- we always create the DEC since there is always one DEC NCR
252 		-- which can never be deleted
253 
254 		l_dec_tc_name := SUBSTR('OTL_DEC_'||l_accrual_info.accrual_plan_name,1,90);
255 
256 		if g_debug then
257 			hr_utility.trace('creating DEC TC');
258 			hr_utility.trace('DEC TC NAME is '||l_dec_tc_name);
259 		end if;
260 
261 		hxc_time_category_api.create_time_category (
262 			 p_time_category_id      => l_dec_tc_id
263 			,p_object_version_number => l_dec_tc_ovn
264 			,p_time_category_name    => l_dec_tc_name
265                         ,p_operator              => 'OR'
266                         ,p_display               => 'Y'
267                         ,p_description           => 'System Generated Decrementing PTO Time Category' );
268 
269 			if g_debug then
270 				hr_utility.trace('DEC TC ID   is '||to_char(l_dec_tc_id));
271 				hr_utility.trace('DEC TC OVN  is '||to_char(l_dec_tc_ovn));
272 			end if;
273 
274 		-- CREATE time category comp
275 
276 		if g_debug then
277 			hr_utility.set_location('Processing '||l_proc, 50);
278 
279 			hr_utility.trace('Creating DEC time component');
280 		end if;
281 
282 		hxc_time_category_comp_api.create_time_category_comp (
283 			 p_time_category_comp_id => l_tcc_id
284 			,p_object_version_number => l_tcc_ovn
285 			,p_time_category_id      => l_dec_tc_id
286 			,p_ref_time_category_id  => NULL
287 			,p_component_type_id  => l_mpc_id
288 			,p_flex_value_set_id     => -1
289 			,p_value_id              => l_accrual_info.element_type_id
290                         ,p_is_null               => 'Y'
291                         ,p_equal_to              => 'Y'
292                         ,p_type                  => 'MC' );
293 
294 	ELSIF ( ( l_inc_tc_name IS NULL ) AND ( NOT p_delete ) AND ( l_accrual_info.add_or_subtract = 1 ) )
295 	THEN
296 
297 		if g_debug then
298 			hr_utility.trace('Creating INC time component');
299 
300 			hr_utility.trace('INC TC ID is null');
301 		end if;
302 
303 		-- check to see this isn't the first INC NCR
304 
305 		OPEN  csr_get_min_inc_ncr ( l_pap_id );
306 		FETCH csr_get_min_inc_ncr INTO l_min_inc_ncr_id;
307 		CLOSE csr_get_min_inc_ncr;
308 
309 		if g_debug then
310 			hr_utility.trace('MIN inc ncr is '||to_char(l_min_inc_ncr_id));
311 		end if;
312 
313 		IF ( p_net_calculation_rule_id > l_min_inc_ncr_id )
314 		THEN
315 
316 			l_inc_tc_name := SUBSTR('OTL_INC_'||l_accrual_info.accrual_plan_name,1,90);
317 
318 			if g_debug then
319 				hr_utility.trace('Creating INC TC');
320 				hr_utility.trace('INC TC NAME is '||l_inc_tc_name);
321 			end if;
322 
323 			hxc_time_category_api.create_time_category (
324 				 p_time_category_id      => l_inc_tc_id
325 				,p_object_version_number => l_inc_tc_ovn
326 				,p_time_category_name    => l_inc_tc_name
327 	                        ,p_operator              => 'OR'
328                                 ,p_display               => 'Y'
329                                 ,p_description           => 'System Generated Inccrementing PTO Time Category' );
330 
331 			if g_debug then
332 				hr_utility.trace('INC TC ID   is '||to_char(l_inc_tc_id));
333 				hr_utility.trace('INC TC OVN  is '||to_char(l_inc_tc_ovn));
334 
335 				hr_utility.trace('Creating INC time component');
336 			end if;
337 
338 			hxc_time_category_comp_api.create_time_category_comp (
339 				 p_time_category_comp_id => l_tcc_id
340 				,p_object_version_number => l_tcc_ovn
341 				,p_time_category_id      => l_inc_tc_id
342 				,p_ref_time_category_id  => NULL
343 				,p_component_type_id  => l_mpc_id
344 				,p_flex_value_set_id     => -1
345 				,p_value_id              => l_accrual_info.element_type_id
346 	                        ,p_is_null               => 'Y'
347                                 ,p_equal_to              => 'Y'
348                                 ,p_type                  => 'MC' );
349 
350 		END IF; -- ( p_net_calculation_rule_id > l_min_inc_ncr_id )
351 
352 		if g_debug then
353 			hr_utility.set_location('Processing '||l_proc, 60);
354 		end if;
355 
356 	ELSIF ( ( l_dec_tc_name IS NOT NULL ) AND ( NOT p_delete ) AND ( l_accrual_info.add_or_subtract = -1 ) )
357 	THEN
358 		-- updating existing time category
359 
360 		if g_debug then
361 			hr_utility.set_location('Processing '||l_proc, 70);
362 		end if;
363 
364 		-- check to see if this time category comp exists
365 
366 		OPEN  csr_get_tc_comp ( l_dec_tc_id, l_mpc_id, l_accrual_info.element_type_id );
367 		FETCH csr_get_tc_comp INTO l_tcc_id, l_tcc_ovn;
368 
369 		if g_debug then
370 			hr_utility.set_location('Processing '||l_proc, 90);
371 		end if;
372 
373 		IF ( csr_get_tc_comp%NOTFOUND )
374 		THEN
375 
376 			if g_debug then
377 				hr_utility.set_location('Processing '||l_proc, 130);
378 			end if;
379 
380 			hxc_time_category_comp_api.create_time_category_comp (
381 				 p_time_category_comp_id => l_tcc_id
382 				,p_object_version_number => l_tcc_ovn
383 				,p_time_category_id      => l_dec_tc_id
384 				,p_ref_time_category_id  => NULL
385 				,p_component_type_id  => l_mpc_id
386 				,p_flex_value_set_id     => -1
387 				,p_value_id              => l_accrual_info.element_type_id
388                                 ,p_is_null               => 'Y'
389                                 ,p_equal_to              => 'Y'
390                                 ,p_type                  => 'MC' );
391 
392 		ELSE
393 
394 			if g_debug then
395 				hr_utility.set_location('Processing '||l_proc, 140);
396 			end if;
397 
398 			hxc_time_category_comp_api.update_time_category_comp (
399 				 p_time_category_comp_id => l_tcc_id
400 				,p_object_version_number => l_tcc_ovn
401 				,p_time_category_id      => l_dec_tc_id
402 				,p_ref_time_category_id  => NULL
403 				,p_component_type_id  => l_mpc_id
404 				,p_flex_value_set_id     => -1
405 				,p_value_id              => l_accrual_info.element_type_id
406                                 ,p_is_null               => 'Y'
407                                 ,p_equal_to              => 'Y'
408                                 ,p_type                  => 'MC' );
409 
410 		END IF; -- csr_get_tc_comp%NOTFOUND
411 
412 		CLOSE csr_get_tc_comp;
413 
414 		if g_debug then
415 			hr_utility.set_location('Processing '||l_proc, 150);
416 		end if;
417 
418 
419 	ELSIF ( ( l_inc_tc_name IS NOT NULL ) AND ( NOT p_delete ) AND ( l_accrual_info.add_or_subtract = 1 ) )
420 	THEN
421 
422 		if g_debug then
423 			hr_utility.trace('INC TC ID   is '||to_char(l_inc_tc_id));
424 			hr_utility.trace('INC TC OVN  is '||to_char(l_inc_tc_ovn));
425 		end if;
426 
427 		OPEN  csr_get_tc_comp ( l_inc_tc_id, l_mpc_id, l_accrual_info.element_type_id );
428 		FETCH csr_get_tc_comp INTO l_tcc_id, l_tcc_ovn;
429 
430 		if g_debug then
431 			hr_utility.set_location('Processing '||l_proc, 160);
432 		end if;
433 
434 		IF ( csr_get_tc_comp%NOTFOUND )
435 		THEN
436 
437 			if g_debug then
438 				hr_utility.set_location('Processing '||l_proc, 170);
439 			end if;
440 
441 			hxc_time_category_comp_api.create_time_category_comp (
442 				 p_time_category_comp_id => l_tcc_id
443 				,p_object_version_number => l_tcc_ovn
444 				,p_time_category_id      => l_inc_tc_id
445 				,p_ref_time_category_id  => NULL
446 				,p_component_type_id  => l_mpc_id
447 				,p_flex_value_set_id     => -1
448 				,p_value_id              => l_accrual_info.element_type_id
449                                 ,p_is_null               => 'Y'
450                                 ,p_equal_to              => 'Y'
451                                 ,p_type                  => 'MC' );
452 
453 		ELSE
454 
455 			if g_debug then
456 				hr_utility.set_location('Processing '||l_proc, 180);
457 			end if;
458 
459 			hxc_time_category_comp_api.update_time_category_comp (
460 				 p_time_category_comp_id => l_tcc_id
461 				,p_object_version_number => l_tcc_ovn
462 				,p_time_category_id      => l_inc_tc_id
463 				,p_ref_time_category_id  => NULL
464 				,p_component_type_id  => l_mpc_id
465 				,p_flex_value_set_id     => -1
466 				,p_value_id              => l_accrual_info.element_type_id
467                                 ,p_is_null               => 'Y'
468                                 ,p_equal_to              => 'Y'
469                                 ,p_type                  => 'MC' );
470 
471 		END IF; -- csr_get_tc_comp%NOTFOUND
472 
473 		CLOSE csr_get_tc_comp;
474 
475 		if g_debug then
476 			hr_utility.set_location('Processing '||l_proc, 190);
477 		end if;
478 
479 	ELSE
480 
481 		if g_debug then
482 			hr_utility.trace('Deleting');
483 
484 			hr_utility.set_location('Processing '||l_proc, 210);
485 		end if;
486 
487 		-- delete an individual time category comp
488 
489 		-- get tc comp info
490 
491 		IF ( l_accrual_info.add_or_subtract = -1 )
492 		THEN
493 
494 			if g_debug then
495 				hr_utility.trace('delete dec tcc');
496 			end if;
497 
498 			OPEN  csr_get_tc_comp ( l_dec_tc_id, l_mpc_id, l_accrual_info.element_type_id );
499 			FETCH csr_get_tc_comp INTO l_tcc_id, l_tcc_ovn;
500 
501 			if g_debug then
502 				hr_utility.trace('tc id is '||to_char(l_dec_tc_id));
503 				hr_utility.trace('tc name is '||l_dec_tc_name);
504 				hr_utility.trace('tc ovn is '||to_char(l_dec_tc_ovn));
505 				hr_utility.trace('tcc id  is '||to_char(l_tcc_id));
506 				hr_utility.trace('tcc ovn is '||to_char(l_tcc_ovn));
507 				hr_utility.trace('element type id is '||to_char(l_accrual_info.element_type_id));
508 			end if;
509                         IF csr_get_tc_comp%FOUND THEN
510 			   hxc_time_category_comp_api.delete_time_category_comp(
511 				 p_time_category_comp_id => l_tcc_id
512 				,p_object_version_number => l_tcc_ovn );
513                         END IF;
514 			if g_debug then
515 				hr_utility.set_location('Processing '||l_proc, 220);
516 			end if;
517 
518 			CLOSE csr_get_tc_comp;
519 
520 			-- test that this is not the last NCR.
521 			-- if it is then delete the time category
522 
523 			OPEN  csr_chk_tc_comps ( l_dec_tc_id );
524 			FETCH csr_chk_tc_comps INTO l_dummy;
525 
526 			IF ( csr_chk_tc_comps%NOTFOUND )
527 			THEN
528 				if g_debug then
529 					hr_utility.set_location('Processing '||l_proc, 230);
530 				end if;
531 
532 				-- delete the whole time category
533                                 IF l_dec_tc_id is not null THEN
534 				hxc_time_category_api.delete_time_category (
535 						 p_time_category_id      => l_dec_tc_id
536 						,p_time_category_name    => l_dec_tc_name
537 						,p_object_version_number => l_dec_tc_ovn );
538                                 END IF;
539 
540 			END IF;
541 
542 			CLOSE csr_chk_tc_comps;
543 
544 		ELSIF ( l_accrual_info.add_or_subtract = 1 )
545 		THEN
546 
547 			-- check to see this isn't the first INC NCR
548 
549 			OPEN  csr_get_min_inc_ncr ( l_pap_id );
550 			FETCH csr_get_min_inc_ncr INTO l_min_inc_ncr_id;
551 			CLOSE csr_get_min_inc_ncr;
552 
553 			if g_debug then
554 				hr_utility.trace('MIN inc ncr is '||to_char(l_min_inc_ncr_id));
555 			end if;
556 
557 			IF ( p_net_calculation_rule_id > l_min_inc_ncr_id )
558 			THEN
559 
560 				if g_debug then
561 					hr_utility.trace('deleting inc tcc');
562 				end if;
563 
564 				OPEN  csr_get_tc_comp ( l_inc_tc_id, l_mpc_id, l_accrual_info.element_type_id );
565 				FETCH csr_get_tc_comp INTO l_tcc_id, l_tcc_ovn;
566 
567 				if g_debug then
568 					hr_utility.trace('tc id is '||to_char(l_inc_tc_id));
569 					hr_utility.trace('tc name is '||l_inc_tc_name);
570 					hr_utility.trace('tc ovn is '||to_char(l_inc_tc_ovn));
571 					hr_utility.trace('tcc id  is '||to_char(l_tcc_id));
572 					hr_utility.trace('tcc ovn is '||to_char(l_tcc_ovn));
573 					hr_utility.trace('element type id is '||to_char(l_accrual_info.element_type_id));
574 				end if;
575 
576 				IF csr_get_tc_comp%FOUND THEN
577 				   hxc_time_category_comp_api.delete_time_category_comp(
578 					 p_time_category_comp_id => l_tcc_id
579 					,p_object_version_number => l_tcc_ovn );
580                                 END IF;
581 				if g_debug then
582 					hr_utility.set_location('Processing '||l_proc, 240);
583 				end if;
584 
585 				CLOSE csr_get_tc_comp;
586 
587 			ELSIF ( l_inc_tc_id IS NOT NULL )
588 			THEN
589 				-- this must be deleting the PTO plan since the user
590 				-- cannot delete the last inc ncr and the inc tc exists
591 
592 				hxc_time_category_api.delete_time_category (
593 						 p_time_category_id      => l_inc_tc_id
594 						,p_time_category_name    => l_inc_tc_name
595 						,p_object_version_number => l_inc_tc_ovn );
596 
597 
598 			END IF; -- ( p_net_calculation_rule_id > l_min_inc_ncr_id )
599 
600 		END IF; -- ( l_accrual_info.add_or_subtract = -1 )
601 
602 	END IF; -- l_dec_tc_name IS NULL
603 
604 FETCH csr_get_elements INTO l_accrual_info;
605 
606 END LOOP;
607 
608 CLOSE csr_get_elements;
609 
610 
611 if g_debug then
612 	hr_utility.set_location('Leaving '||l_proc, 290);
613 end if;
614 
615 fnd_global.INITIALIZE(
616     session_id            => l_session_id,
617     user_id               => l_old_user_id,
618     resp_id               => l_old_resp_id,
619     resp_appl_id          => l_old_resp_appl_id,
620     security_group_id     => l_old_security_group_id,
621     site_id               => -1,
622     login_id              => l_old_login_id,
623     conc_login_id         => -1,
624     prog_appl_id          => -1,
625     conc_program_id       => -1,
626     conc_request_id       => -1,
627     conc_priority_request => null);
628 
629 EXCEPTION WHEN OTHERS THEN
630 
631 if g_debug then
632 	hr_utility.trace('exception');
633 end if;
634 
635 fnd_global.INITIALIZE(
636     session_id            => l_session_id,
637     user_id               => l_old_user_id,
638     resp_id               => l_old_resp_id,
639     resp_appl_id          => l_old_resp_appl_id,
640     security_group_id     => l_old_security_group_id,
641     site_id               => -1,
642     login_id              => l_old_login_id,
643     conc_login_id         => -1,
644     prog_appl_id          => -1,
645     conc_program_id       => -1,
646     conc_request_id       => -1,
647     conc_priority_request => null);
648 
649 raise;
650 
651 END maintain_pto_time_category;
652 
653 
654 
655 -- ******************************************
656 -- create application hook procedures for PTO
657 -- ******************************************
658 
659 procedure create_pto_time_category_a (
660 		p_accrual_plan_id	  NUMBER default null
661 	,	p_net_calculation_rule_id NUMBER default null ) IS
662 
663 BEGIN
664 
665 	maintain_pto_time_category (
666                    p_accrual_plan_id         => p_accrual_plan_id
667                  , p_net_calculation_rule_id => p_net_calculation_rule_id
668                  , p_delete                  => FALSE );
669 
670 END create_pto_time_category_a;
671 
672 
673 procedure update_pto_time_category_b (
674 		p_accrual_plan_id	  NUMBER default null
675 	,	p_net_calculation_rule_id NUMBER default null ) IS
676 
677 BEGIN
678 
679 	maintain_pto_time_category (
680                    p_accrual_plan_id         => p_accrual_plan_id
681                  , p_net_calculation_rule_id => p_net_calculation_rule_id
682                  , p_delete                  => TRUE );
683 
684 END update_pto_time_category_b;
685 
686 
687 procedure update_pto_time_category_a (
688 		p_accrual_plan_id	  NUMBER default null
689 	,	p_net_calculation_rule_id NUMBER default null ) IS
690 
691 BEGIN
692 
693 	maintain_pto_time_category (
694                    p_accrual_plan_id         => p_accrual_plan_id
695                  , p_net_calculation_rule_id => p_net_calculation_rule_id
696                  , p_delete                  => FALSE );
697 
698 END update_pto_time_category_a;
699 
700 procedure delete_pto_time_category_b (
701 		p_net_calculation_rule_id NUMBER default null ) IS
702 
703 BEGIN
704 
705 	maintain_pto_time_category (
706                    p_accrual_plan_id         => NULL
707                  , p_net_calculation_rule_id => p_net_calculation_rule_id
708                  , p_delete                  => TRUE );
709 
710 END delete_pto_time_category_b;
711 
712 
713 END hxc_time_category_hook;