2: /* $Header: hxcretutl.pkb 120.8.12010000.2 2008/10/16 17:27:47 asrajago ship $ */
3:
4: -- global package data type and variables
5:
6: g_debug boolean := hr_utility.debug_enabled;
7:
8: l_message_table HXC_MESSAGE_TABLE_TYPE;
9: l_rowid ROWID;
10: l_boolean boolean;
164:
165: l_overall_outcome_exists varchar2(1) ;
166:
167: BEGIN
168: g_debug := hr_utility.debug_enabled;
169:
170: IF ( g_debug ) THEN
171: l_proc := g_package||'populate_rtr_outcomes';
172: hr_utility.set_location('Processing '||l_proc, 10);
168: g_debug := hr_utility.debug_enabled;
169:
170: IF ( g_debug ) THEN
171: l_proc := g_package||'populate_rtr_outcomes';
172: hr_utility.set_location('Processing '||l_proc, 10);
173: END IF;
174:
175: l_cnt := p_ret_rules_start;
176:
178: LOOP
179: l_overall_outcome_exists := 'N';
180:
181: IF ( g_debug ) THEN
182: hr_utility.set_location('Processing '||l_proc, 20);
183: END IF;
184:
185: l_iter := p_ret_ranges.first;
186:
191:
192: -- convert to character to pass to the dyn SQL
193:
194: IF ( g_debug ) THEN
195: hr_utility.trace('Params for Get Valid Periods are ...');
196: hr_utility.trace('Start Time is '||to_char(p_ret_ranges(l_iter).start_date,'dd-mon-yy'));
197: hr_utility.trace('Stop Time is '||to_char(p_ret_ranges(l_iter).stop_date,'dd-mon-yy'));
198: hr_utility.trace('App Status is '||p_ret_rules_tab(l_cnt).status);
199: hr_utility.trace('Time Recip is '||p_ret_rules_tab(l_cnt).time_recipient_id);
192: -- convert to character to pass to the dyn SQL
193:
194: IF ( g_debug ) THEN
195: hr_utility.trace('Params for Get Valid Periods are ...');
196: hr_utility.trace('Start Time is '||to_char(p_ret_ranges(l_iter).start_date,'dd-mon-yy'));
197: hr_utility.trace('Stop Time is '||to_char(p_ret_ranges(l_iter).stop_date,'dd-mon-yy'));
198: hr_utility.trace('App Status is '||p_ret_rules_tab(l_cnt).status);
199: hr_utility.trace('Time Recip is '||p_ret_rules_tab(l_cnt).time_recipient_id);
200: END IF;
193:
194: IF ( g_debug ) THEN
195: hr_utility.trace('Params for Get Valid Periods are ...');
196: hr_utility.trace('Start Time is '||to_char(p_ret_ranges(l_iter).start_date,'dd-mon-yy'));
197: hr_utility.trace('Stop Time is '||to_char(p_ret_ranges(l_iter).stop_date,'dd-mon-yy'));
198: hr_utility.trace('App Status is '||p_ret_rules_tab(l_cnt).status);
199: hr_utility.trace('Time Recip is '||p_ret_rules_tab(l_cnt).time_recipient_id);
200: END IF;
201:
194: IF ( g_debug ) THEN
195: hr_utility.trace('Params for Get Valid Periods are ...');
196: hr_utility.trace('Start Time is '||to_char(p_ret_ranges(l_iter).start_date,'dd-mon-yy'));
197: hr_utility.trace('Stop Time is '||to_char(p_ret_ranges(l_iter).stop_date,'dd-mon-yy'));
198: hr_utility.trace('App Status is '||p_ret_rules_tab(l_cnt).status);
199: hr_utility.trace('Time Recip is '||p_ret_rules_tab(l_cnt).time_recipient_id);
200: END IF;
201:
202:
195: hr_utility.trace('Params for Get Valid Periods are ...');
196: hr_utility.trace('Start Time is '||to_char(p_ret_ranges(l_iter).start_date,'dd-mon-yy'));
197: hr_utility.trace('Stop Time is '||to_char(p_ret_ranges(l_iter).stop_date,'dd-mon-yy'));
198: hr_utility.trace('App Status is '||p_ret_rules_tab(l_cnt).status);
199: hr_utility.trace('Time Recip is '||p_ret_rules_tab(l_cnt).time_recipient_id);
200: END IF;
201:
202:
203: -- get valid periods
220:
221: IF ( l_overall_outcome_exists = 'N' )
222: THEN
223: IF ( g_debug ) THEN
224: hr_utility.set_location('Processing '||l_proc, 30);
225: END IF;
226:
227: p_ret_rules_tab(l_cnt).outcome_exists := 'Y';
228: p_ret_rules_tab(l_cnt).outcome_start := l_outcome_index;
236: WHILE l_ind IS NOT NULL
237: LOOP
238:
239: IF ( g_debug ) THEN
240: hr_utility.set_location('Processing '||l_proc, 50);
241: END IF;
242:
243: p_rtr_outcomes_tab(l_outcome_index).rtr_grp_id := p_ret_rules_tab(l_cnt).rtr_grp_id;
244: p_rtr_outcomes_tab(l_outcome_index).time_recipient_id := p_ret_rules_tab(l_cnt).time_recipient_id;
251:
252: END LOOP;
253:
254: IF ( g_debug ) THEN
255: hr_utility.set_location('Processing '||l_proc, 60);
256: END IF;
257:
258: l_period_tab.DELETE;
259:
276:
277: END LOOP;
278:
279: IF ( g_debug ) THEN
280: hr_utility.set_location('Processing '||l_proc, 70);
281: END IF;
282:
283: END populate_rtr_outcomes;
284:
396:
397:
398: BEGIN -- parse_resources
399:
400: g_debug := hr_utility.debug_enabled;
401:
402: IF ( g_debug ) THEN
403: l_proc := g_package||'parse_resources';
404: hr_utility.set_location('Processing '||l_proc, 10);
400: g_debug := hr_utility.debug_enabled;
401:
402: IF ( g_debug ) THEN
403: l_proc := g_package||'parse_resources';
404: hr_utility.set_location('Processing '||l_proc, 10);
405:
406: hr_utility.trace('');
407: hr_utility.trace('************** Params are: *****************');
408: hr_utility.trace('is p_process_id '||to_char(p_process_id));
402: IF ( g_debug ) THEN
403: l_proc := g_package||'parse_resources';
404: hr_utility.set_location('Processing '||l_proc, 10);
405:
406: hr_utility.trace('');
407: hr_utility.trace('************** Params are: *****************');
408: hr_utility.trace('is p_process_id '||to_char(p_process_id));
409: hr_utility.trace('is p_ret_tr_id '||to_char(p_ret_tr_id));
410: hr_utility.trace('');
403: l_proc := g_package||'parse_resources';
404: hr_utility.set_location('Processing '||l_proc, 10);
405:
406: hr_utility.trace('');
407: hr_utility.trace('************** Params are: *****************');
408: hr_utility.trace('is p_process_id '||to_char(p_process_id));
409: hr_utility.trace('is p_ret_tr_id '||to_char(p_ret_tr_id));
410: hr_utility.trace('');
411:
404: hr_utility.set_location('Processing '||l_proc, 10);
405:
406: hr_utility.trace('');
407: hr_utility.trace('************** Params are: *****************');
408: hr_utility.trace('is p_process_id '||to_char(p_process_id));
409: hr_utility.trace('is p_ret_tr_id '||to_char(p_ret_tr_id));
410: hr_utility.trace('');
411:
412: END IF;
405:
406: hr_utility.trace('');
407: hr_utility.trace('************** Params are: *****************');
408: hr_utility.trace('is p_process_id '||to_char(p_process_id));
409: hr_utility.trace('is p_ret_tr_id '||to_char(p_ret_tr_id));
410: hr_utility.trace('');
411:
412: END IF;
413:
406: hr_utility.trace('');
407: hr_utility.trace('************** Params are: *****************');
408: hr_utility.trace('is p_process_id '||to_char(p_process_id));
409: hr_utility.trace('is p_ret_tr_id '||to_char(p_ret_tr_id));
410: hr_utility.trace('');
411:
412: END IF;
413:
414: l_process_id := p_process_id;
450:
451: WHILE l_resource_index IS NOT NULL
452: LOOP
453: IF ( g_debug ) THEN
454: hr_utility.set_location('Processing '||l_proc, 15);
455: END IF;
456:
457: --delete the ret ranges table. This is because we maintain ret ranges table for each resource
458: l_ret_ranges.delete;
466: -- GPM v115.27
467:
468: IF ( g_debug ) THEN
469:
470: hr_utility.trace('************* NEW RESOURCE ********************');
471: hr_utility.trace('resource id is '||to_char(l_resource_index));
472: hr_utility.trace('resource start date is '||to_char(l_resource_start_time, 'dd-mon-yyyy hh24:mi:ss'));
473: hr_utility.trace('resource stop date is '||to_char(l_resource_stop_time, 'dd-mon-yyyy hh24:mi:ss'));
474: hr_utility.trace('************* NEW RESOURCE ********************');
467:
468: IF ( g_debug ) THEN
469:
470: hr_utility.trace('************* NEW RESOURCE ********************');
471: hr_utility.trace('resource id is '||to_char(l_resource_index));
472: hr_utility.trace('resource start date is '||to_char(l_resource_start_time, 'dd-mon-yyyy hh24:mi:ss'));
473: hr_utility.trace('resource stop date is '||to_char(l_resource_stop_time, 'dd-mon-yyyy hh24:mi:ss'));
474: hr_utility.trace('************* NEW RESOURCE ********************');
475:
468: IF ( g_debug ) THEN
469:
470: hr_utility.trace('************* NEW RESOURCE ********************');
471: hr_utility.trace('resource id is '||to_char(l_resource_index));
472: hr_utility.trace('resource start date is '||to_char(l_resource_start_time, 'dd-mon-yyyy hh24:mi:ss'));
473: hr_utility.trace('resource stop date is '||to_char(l_resource_stop_time, 'dd-mon-yyyy hh24:mi:ss'));
474: hr_utility.trace('************* NEW RESOURCE ********************');
475:
476: END IF;
469:
470: hr_utility.trace('************* NEW RESOURCE ********************');
471: hr_utility.trace('resource id is '||to_char(l_resource_index));
472: hr_utility.trace('resource start date is '||to_char(l_resource_start_time, 'dd-mon-yyyy hh24:mi:ss'));
473: hr_utility.trace('resource stop date is '||to_char(l_resource_stop_time, 'dd-mon-yyyy hh24:mi:ss'));
474: hr_utility.trace('************* NEW RESOURCE ********************');
475:
476: END IF;
477:
470: hr_utility.trace('************* NEW RESOURCE ********************');
471: hr_utility.trace('resource id is '||to_char(l_resource_index));
472: hr_utility.trace('resource start date is '||to_char(l_resource_start_time, 'dd-mon-yyyy hh24:mi:ss'));
473: hr_utility.trace('resource stop date is '||to_char(l_resource_stop_time, 'dd-mon-yyyy hh24:mi:ss'));
474: hr_utility.trace('************* NEW RESOURCE ********************');
475:
476: END IF;
477:
478:
507:
508: EXCEPTION
509: WHEN OTHERS THEN
510: IF ( g_debug ) THEN
511: hr_utility.trace('Error 1 : '||substr(sqlerrm,1,100));
512: END IF;
513: hr_utility.set_message(809, SUBSTR('HXC_NO_RESRC_DATES-'||to_char(l_resource_index),1,28));
514: p_errors(l_resource_index).exception_description := SUBSTR('HXC_NO_RESRC_DATES-'||to_char(l_resource_index),1,2000);
515: p_prefs(l_resource_index).prefs_ok := 'X';
509: WHEN OTHERS THEN
510: IF ( g_debug ) THEN
511: hr_utility.trace('Error 1 : '||substr(sqlerrm,1,100));
512: END IF;
513: hr_utility.set_message(809, SUBSTR('HXC_NO_RESRC_DATES-'||to_char(l_resource_index),1,28));
514: p_errors(l_resource_index).exception_description := SUBSTR('HXC_NO_RESRC_DATES-'||to_char(l_resource_index),1,2000);
515: p_prefs(l_resource_index).prefs_ok := 'X';
516: END;
517:
526: THEN
527: IF ( l_tmp_otm_tab.COUNT = 0 OR l_tmp_rtr_tab.COUNT = 0 )
528: THEN
529: IF ( g_debug ) THEN
530: hr_utility.trace('Error 2 : '||substr(sqlerrm,1,100));
531: END IF;
532: p_errors(l_resource_index).exception_description := 'HXC_NO_HIER_FOR_DATE';
533: p_prefs(l_resource_index).prefs_ok := 'X';
534: END IF;
535: ELSE
536: IF ( l_tmp_rtr_tab.COUNT = 0 )
537: THEN
538: IF ( g_debug ) THEN
539: hr_utility.trace('Error 3 : '||substr(sqlerrm,1,100));
540: END IF;
541: p_errors(l_resource_index).exception_description := 'HXC_NO_HIER_FOR_DATE';
542: p_prefs(l_resource_index).prefs_ok := 'X';
543: END IF;
550:
551: IF ( g_debug ) AND l_process_id IN (-1, l_bee_ret_id)
552: THEN
553:
554: hr_utility.trace('OTM prefs tab is');
555: hr_utility.trace('Preference Code ATT1 ATT2 Start Date End Date');
556: hr_utility.trace('--------------------- ------ ----- -------------------- ---------------------');
557:
558: FOR l_filter_ind IN 1 .. l_tmp_otm_tab.LAST
551: IF ( g_debug ) AND l_process_id IN (-1, l_bee_ret_id)
552: THEN
553:
554: hr_utility.trace('OTM prefs tab is');
555: hr_utility.trace('Preference Code ATT1 ATT2 Start Date End Date');
556: hr_utility.trace('--------------------- ------ ----- -------------------- ---------------------');
557:
558: FOR l_filter_ind IN 1 .. l_tmp_otm_tab.LAST
559: LOOP
552: THEN
553:
554: hr_utility.trace('OTM prefs tab is');
555: hr_utility.trace('Preference Code ATT1 ATT2 Start Date End Date');
556: hr_utility.trace('--------------------- ------ ----- -------------------- ---------------------');
557:
558: FOR l_filter_ind IN 1 .. l_tmp_otm_tab.LAST
559: LOOP
560:
557:
558: FOR l_filter_ind IN 1 .. l_tmp_otm_tab.LAST
559: LOOP
560:
561: hr_utility.trace(l_tmp_otm_tab(l_filter_ind).preference_code||' '||
562: l_tmp_otm_tab(l_filter_ind).attribute1||' '||
563: l_tmp_otm_tab(l_filter_ind).attribute2||' '||
564: to_char(l_tmp_otm_tab(l_filter_ind).start_date,'DD-MON-YYYY HH24:MI:SS')||' '||
565: to_char(l_tmp_otm_tab(l_filter_ind).end_date,'DD-MON-YYYY HH24:MI:SS'));
565: to_char(l_tmp_otm_tab(l_filter_ind).end_date,'DD-MON-YYYY HH24:MI:SS'));
566:
567: END LOOP;
568:
569: hr_utility.trace('--------------------- ------ ----- -------------------- ---------------------');
570:
571: hr_utility.trace('RTR prefs tab is');
572: hr_utility.trace('Preference Code ATT1 ATT2 Start Date End Date');
573: hr_utility.trace('--------------------- ------ ----- -------------------- ---------------------');
567: END LOOP;
568:
569: hr_utility.trace('--------------------- ------ ----- -------------------- ---------------------');
570:
571: hr_utility.trace('RTR prefs tab is');
572: hr_utility.trace('Preference Code ATT1 ATT2 Start Date End Date');
573: hr_utility.trace('--------------------- ------ ----- -------------------- ---------------------');
574:
575: FOR l_filter_ind IN 1 .. l_tmp_rtr_tab.LAST
568:
569: hr_utility.trace('--------------------- ------ ----- -------------------- ---------------------');
570:
571: hr_utility.trace('RTR prefs tab is');
572: hr_utility.trace('Preference Code ATT1 ATT2 Start Date End Date');
573: hr_utility.trace('--------------------- ------ ----- -------------------- ---------------------');
574:
575: FOR l_filter_ind IN 1 .. l_tmp_rtr_tab.LAST
576: LOOP
569: hr_utility.trace('--------------------- ------ ----- -------------------- ---------------------');
570:
571: hr_utility.trace('RTR prefs tab is');
572: hr_utility.trace('Preference Code ATT1 ATT2 Start Date End Date');
573: hr_utility.trace('--------------------- ------ ----- -------------------- ---------------------');
574:
575: FOR l_filter_ind IN 1 .. l_tmp_rtr_tab.LAST
576: LOOP
577:
574:
575: FOR l_filter_ind IN 1 .. l_tmp_rtr_tab.LAST
576: LOOP
577:
578: hr_utility.trace(l_tmp_rtr_tab(l_filter_ind).preference_code||' '||
579: l_tmp_rtr_tab(l_filter_ind).attribute1||' '||
580: l_tmp_rtr_tab(l_filter_ind).attribute2||' '||
581: to_char(l_tmp_rtr_tab(l_filter_ind).start_date,'DD-MON-YYYY HH24:MI:SS')||' '||
582: to_char(l_tmp_rtr_tab(l_filter_ind).end_date,'DD-MON-YYYY HH24:MI:SS'));
582: to_char(l_tmp_rtr_tab(l_filter_ind).end_date,'DD-MON-YYYY HH24:MI:SS'));
583:
584: END LOOP;
585:
586: hr_utility.trace('--------------------- ------ ----- -------------------- ---------------------');
587:
588: END IF; -- l debug
589:
590: --We have filtered the main pref table and populated the temporary tables we created.
597: --otherwise the l_tmp_rtr_tab table will be copied to ret_ranges table.
598: --Note : We dont need the merge logic in case the Application Process is not BEE or Apply Schedule Rules
599:
600: IF ( g_debug ) THEN
601: hr_utility.trace('Merge logic starts');
602: END IF;
603:
604: if (l_process_id = -1 or l_process_id = l_bee_ret_id) then
605: --merge logic
603:
604: if (l_process_id = -1 or l_process_id = l_bee_ret_id) then
605: --merge logic
606: IF ( g_debug ) THEN
607: hr_utility.trace('merge logic');
608: END IF;
609:
610: l_ret_range_iter :=1;
611: l_tmp_rtr_iter := l_tmp_rtr_tab.first;
643: l_tmp_rtr_iter := l_tmp_rtr_tab.next(l_tmp_rtr_iter);
644: END LOOP;
645:
646: IF ( g_debug ) THEN
647: hr_utility.trace('merge logic over');
648: END IF;
649:
650: --merge logic over
651: else
653: --process is neither Apply Schedule rules nor BEE. Hence we just copy
654: --l_tmp_rtr_tab to l_ret_ranges
655:
656: IF ( g_debug ) THEN
657: hr_utility.trace('not BEE or Apply thus copy RTR');
658: END IF;
659:
660: l_iter := 1;
661: l_tmp_rtr_iter := l_tmp_rtr_tab.first;
672:
673:
674: end if;
675: IF ( g_debug ) THEN
676: hr_utility.trace('Merge logic ends');
677: END IF;
678:
679: --we can delete the pref table and temporary tables to save space
680: l_tmp_otm_tab.DELETE;
690: --we shall have a temporary table that we can use to store the distinct
691: --rtr grp ids. It will be indexed on rtr grp id.
692:
693: IF ( g_debug ) THEN
694: hr_utility.trace('Sorting the unsorted ret ranges table');
695: END IF;
696: l_iter:= l_ret_ranges.first;
697:
698: WHILE l_iter is not null
733: l_ret_ranges1.delete;
734: l_ret_ranges_tmp_tab.delete;
735:
736: IF ( g_debug ) THEN
737: hr_utility.trace('Sorting the unsorted ret ranges table over');
738: END IF;
739:
740:
741: --Now we have the final ret ranges table in l_ret_ranges. We will use the ret ranges table to populate
747:
748:
749: IF ( g_debug ) THEN
750:
751: hr_utility.trace('Ret Ranges Table');
752: hr_utility.trace('Index RTR GRP ID Start Date End Date');
753: hr_utility.trace('------ ----------- -------------------- ---------------------');
754:
755: FOR l_filter_ind IN 1 .. l_ret_ranges.LAST
748:
749: IF ( g_debug ) THEN
750:
751: hr_utility.trace('Ret Ranges Table');
752: hr_utility.trace('Index RTR GRP ID Start Date End Date');
753: hr_utility.trace('------ ----------- -------------------- ---------------------');
754:
755: FOR l_filter_ind IN 1 .. l_ret_ranges.LAST
756: LOOP
749: IF ( g_debug ) THEN
750:
751: hr_utility.trace('Ret Ranges Table');
752: hr_utility.trace('Index RTR GRP ID Start Date End Date');
753: hr_utility.trace('------ ----------- -------------------- ---------------------');
754:
755: FOR l_filter_ind IN 1 .. l_ret_ranges.LAST
756: LOOP
757:
754:
755: FOR l_filter_ind IN 1 .. l_ret_ranges.LAST
756: LOOP
757:
758: hr_utility.trace(to_char(l_filter_ind)||' '||
759: to_char(l_ret_Ranges(l_filter_ind).rtr_grp_id)||' '||
760: to_char(l_ret_ranges(l_filter_ind).start_date,'DD-MON-YYYY HH24:MI:SS')||' '||
761: to_char(l_ret_ranges(l_filter_ind).stop_date,'DD-MON-YYYY HH24:MI:SS'));
762:
761: to_char(l_ret_ranges(l_filter_ind).stop_date,'DD-MON-YYYY HH24:MI:SS'));
762:
763: END LOOP;
764:
765: hr_utility.trace('----------- -------------------- ---------------------');
766:
767: END IF;
768:
769: l_resource_rtr.DELETE;
795:
796: l_resource_rtr(l_ret_ranges(ret_range_iter).rtr_grp_id).dummy := 'Y';
797:
798: IF ( g_debug ) THEN
799: hr_utility.set_location('Processing '||l_proc, 55);
800: END IF;
801:
802: -- check to see that we haven't got these rules before
803:
803:
804: IF ( l_rtr_exists.EXISTS(l_rtr_grp_id) )
805: THEN
806: IF ( g_debug ) THEN
807: hr_utility.trace('hitting PL/SQL table for rtr');
808: END IF;
809:
810: l_rr_index := NVL(p_ret_rules.LAST, 0) + 1;
811:
836:
837: -- get the retrieval rules for the given resource ids retrieval group
838:
839: IF ( g_debug ) THEN
840: hr_utility.trace('hitting db for rtr');
841: END IF;
842:
843: -- l_process_id is passed to the cursor csr_get_retrieval_rules. However
844: --for the 'Apply Schedule Rules' Process the process id is 1 and the
867: OPEN csr_get_emp ( l_resource_index);
868: FETCH csr_get_emp INTO l_emp;
869: CLOSE csr_get_emp;
870:
871: hr_utility.set_message(809, 'HXC_NO_RET_RULE_FOR_RET');
872: hr_utility.set_message_token('EMP', l_emp);
873:
874: p_errors(l_resource_index).exception_description := SUBSTR('HXC_NO_RET_RULE_FOR_RET: '||l_emp,1,2000);
875: p_prefs(l_resource_index).prefs_ok := 'X';
868: FETCH csr_get_emp INTO l_emp;
869: CLOSE csr_get_emp;
870:
871: hr_utility.set_message(809, 'HXC_NO_RET_RULE_FOR_RET');
872: hr_utility.set_message_token('EMP', l_emp);
873:
874: p_errors(l_resource_index).exception_description := SUBSTR('HXC_NO_RET_RULE_FOR_RET: '||l_emp,1,2000);
875: p_prefs(l_resource_index).prefs_ok := 'X';
876:
895:
896: END IF;
897:
898: IF ( g_debug ) THEN
899: hr_utility.set_location('Processing '||l_proc, 60);
900: END IF;
901:
902: WHILE csr_get_retrieval_rules%FOUND
903: LOOP
901:
902: WHILE csr_get_retrieval_rules%FOUND
903: LOOP
904: IF ( g_debug ) THEN
905: hr_utility.set_location('Processing '||l_proc, 70);
906: END IF;
907:
908: -- maintain table of retrieval rules
909:
925: l_rtr_exists(l_rtr_grp_id).rtr_stop := l_rr_index - 1;
926: p_prefs(l_resource_index).rtr_end := l_rr_index - 1;
927:
928: IF ( g_debug ) THEN
929: hr_utility.set_location('Processing '||l_proc, 80);
930: END IF;
931:
932: END IF; -- csr_get_retrieval_rules%NOTFOUND
933:
935:
936: -- now get the application period dates for these
937:
938: IF ( g_debug ) THEN
939: hr_utility.set_location('Processing '||l_proc, 90);
940: END IF;
941:
942: END IF; -- if not
943: --(l_resource_rtr.exists(p_ret_range(ret_range).rtr_grp_id) then
948:
949: IF NOT p_errors.EXISTS(l_resource_index)
950: THEN
951: IF ( g_debug ) THEN
952: hr_utility.set_location('Processing '||l_proc, 95);
953: END IF;
954:
955: populate_rtr_outcomes (
956: p_resource_id => l_resource_index
962:
963: END IF; --IF NOT p_errors.EXISTS(l_resource_index)
964:
965: IF ( g_debug ) THEN
966: hr_utility.set_location('Processing '||l_proc, 97);
967: END IF;
968:
969: ELSE
970:
975:
976: END IF; --IF (l_ret_ranges.COUNT > 0)
977:
978: IF ( g_debug ) THEN
979: hr_utility.set_location('Processing '||l_proc, 98);
980: END IF;
981:
982: END IF; -- NOT p_errors.EXISTS(l_resource_index) - hxc_no_hier_for_date check
983:
987:
988: END LOOP; -- g_resources loop
989:
990: IF ( g_debug ) THEN
991: hr_utility.set_location('Processing '||l_proc, 110);
992: END IF;
993:
994: EXCEPTION WHEN OTHERS
995: THEN
995: THEN
996: -- unhandled excpetion whilst processing resource table
997:
998: IF ( g_debug ) THEN
999: hr_utility.trace('in parse resources unhandled exception');
1000: hr_utility.trace('resource is '||to_char(l_resource_index));
1001: hr_utility.trace('error is '||SUBSTR(SQLERRM,1,150));
1002: END IF;
1003:
996: -- unhandled excpetion whilst processing resource table
997:
998: IF ( g_debug ) THEN
999: hr_utility.trace('in parse resources unhandled exception');
1000: hr_utility.trace('resource is '||to_char(l_resource_index));
1001: hr_utility.trace('error is '||SUBSTR(SQLERRM,1,150));
1002: END IF;
1003:
1004: p_errors(l_resource_index).exception_description := SUBSTR(l_proc||':'||SQLERRM,1,2000);
997:
998: IF ( g_debug ) THEN
999: hr_utility.trace('in parse resources unhandled exception');
1000: hr_utility.trace('resource is '||to_char(l_resource_index));
1001: hr_utility.trace('error is '||SUBSTR(SQLERRM,1,150));
1002: END IF;
1003:
1004: p_errors(l_resource_index).exception_description := SUBSTR(l_proc||':'||SQLERRM,1,2000);
1005: p_prefs(l_resource_index).prefs_ok := 'X';
1005: p_prefs(l_resource_index).prefs_ok := 'X';
1006: l_resource_index := hxc_generic_retrieval_utils.g_resources.NEXT(l_resource_index);
1007:
1008: IF ( g_debug ) THEN
1009: hr_utility.set_location('Processing '||l_proc, 150);
1010: END IF;
1011:
1012: END;
1013:
1014: END LOOP; -- master g_resources loop
1015:
1016: IF ( g_debug ) THEN
1017:
1018: hr_utility.trace('****** Resources ********');
1019:
1020: l_resource_index := hxc_generic_retrieval_utils.g_resources.FIRST;
1021:
1022: WHILE l_resource_index IS NOT NULL
1020: l_resource_index := hxc_generic_retrieval_utils.g_resources.FIRST;
1021:
1022: WHILE l_resource_index IS NOT NULL
1023: LOOP
1024: hr_utility.trace('');
1025: hr_utility.trace('index is '||to_char(l_resource_index));
1026: hr_utility.trace('start time is '||to_char(hxc_generic_retrieval_utils.g_resources(l_resource_index).start_time,'dd-mon-yyyy'));
1027: hr_utility.trace('stop time is '||to_char(hxc_generic_retrieval_utils.g_resources(l_resource_index).stop_time,'dd-mon-yyyy'));
1028: hr_utility.trace('');
1021:
1022: WHILE l_resource_index IS NOT NULL
1023: LOOP
1024: hr_utility.trace('');
1025: hr_utility.trace('index is '||to_char(l_resource_index));
1026: hr_utility.trace('start time is '||to_char(hxc_generic_retrieval_utils.g_resources(l_resource_index).start_time,'dd-mon-yyyy'));
1027: hr_utility.trace('stop time is '||to_char(hxc_generic_retrieval_utils.g_resources(l_resource_index).stop_time,'dd-mon-yyyy'));
1028: hr_utility.trace('');
1029:
1022: WHILE l_resource_index IS NOT NULL
1023: LOOP
1024: hr_utility.trace('');
1025: hr_utility.trace('index is '||to_char(l_resource_index));
1026: hr_utility.trace('start time is '||to_char(hxc_generic_retrieval_utils.g_resources(l_resource_index).start_time,'dd-mon-yyyy'));
1027: hr_utility.trace('stop time is '||to_char(hxc_generic_retrieval_utils.g_resources(l_resource_index).stop_time,'dd-mon-yyyy'));
1028: hr_utility.trace('');
1029:
1030: l_resource_index := hxc_generic_retrieval_utils.g_resources.NEXT(l_resource_index);
1023: LOOP
1024: hr_utility.trace('');
1025: hr_utility.trace('index is '||to_char(l_resource_index));
1026: hr_utility.trace('start time is '||to_char(hxc_generic_retrieval_utils.g_resources(l_resource_index).start_time,'dd-mon-yyyy'));
1027: hr_utility.trace('stop time is '||to_char(hxc_generic_retrieval_utils.g_resources(l_resource_index).stop_time,'dd-mon-yyyy'));
1028: hr_utility.trace('');
1029:
1030: l_resource_index := hxc_generic_retrieval_utils.g_resources.NEXT(l_resource_index);
1031:
1024: hr_utility.trace('');
1025: hr_utility.trace('index is '||to_char(l_resource_index));
1026: hr_utility.trace('start time is '||to_char(hxc_generic_retrieval_utils.g_resources(l_resource_index).start_time,'dd-mon-yyyy'));
1027: hr_utility.trace('stop time is '||to_char(hxc_generic_retrieval_utils.g_resources(l_resource_index).stop_time,'dd-mon-yyyy'));
1028: hr_utility.trace('');
1029:
1030: l_resource_index := hxc_generic_retrieval_utils.g_resources.NEXT(l_resource_index);
1031:
1032: END LOOP;
1030: l_resource_index := hxc_generic_retrieval_utils.g_resources.NEXT(l_resource_index);
1031:
1032: END LOOP;
1033:
1034: hr_utility.trace('****** Prefs ********');
1035:
1036: l_resource_index := p_prefs.FIRST;
1037:
1038: WHILE l_resource_index IS NOT NULL
1036: l_resource_index := p_prefs.FIRST;
1037:
1038: WHILE l_resource_index IS NOT NULL
1039: LOOP
1040: hr_utility.trace('');
1041: hr_utility.trace('index is '||to_char(l_resource_index));
1042: hr_utility.trace('prefs_ok flag is '||p_prefs(l_resource_index).prefs_ok);
1043: hr_utility.trace('rtr grp start is '||to_char(p_prefs(l_resource_index).rtr_start));
1044: hr_utility.trace('rtr grp end is '||to_char(p_prefs(l_resource_index).rtr_end));
1037:
1038: WHILE l_resource_index IS NOT NULL
1039: LOOP
1040: hr_utility.trace('');
1041: hr_utility.trace('index is '||to_char(l_resource_index));
1042: hr_utility.trace('prefs_ok flag is '||p_prefs(l_resource_index).prefs_ok);
1043: hr_utility.trace('rtr grp start is '||to_char(p_prefs(l_resource_index).rtr_start));
1044: hr_utility.trace('rtr grp end is '||to_char(p_prefs(l_resource_index).rtr_end));
1045: hr_utility.trace('');
1038: WHILE l_resource_index IS NOT NULL
1039: LOOP
1040: hr_utility.trace('');
1041: hr_utility.trace('index is '||to_char(l_resource_index));
1042: hr_utility.trace('prefs_ok flag is '||p_prefs(l_resource_index).prefs_ok);
1043: hr_utility.trace('rtr grp start is '||to_char(p_prefs(l_resource_index).rtr_start));
1044: hr_utility.trace('rtr grp end is '||to_char(p_prefs(l_resource_index).rtr_end));
1045: hr_utility.trace('');
1046:
1039: LOOP
1040: hr_utility.trace('');
1041: hr_utility.trace('index is '||to_char(l_resource_index));
1042: hr_utility.trace('prefs_ok flag is '||p_prefs(l_resource_index).prefs_ok);
1043: hr_utility.trace('rtr grp start is '||to_char(p_prefs(l_resource_index).rtr_start));
1044: hr_utility.trace('rtr grp end is '||to_char(p_prefs(l_resource_index).rtr_end));
1045: hr_utility.trace('');
1046:
1047: l_resource_index := p_prefs.NEXT(l_resource_index);
1040: hr_utility.trace('');
1041: hr_utility.trace('index is '||to_char(l_resource_index));
1042: hr_utility.trace('prefs_ok flag is '||p_prefs(l_resource_index).prefs_ok);
1043: hr_utility.trace('rtr grp start is '||to_char(p_prefs(l_resource_index).rtr_start));
1044: hr_utility.trace('rtr grp end is '||to_char(p_prefs(l_resource_index).rtr_end));
1045: hr_utility.trace('');
1046:
1047: l_resource_index := p_prefs.NEXT(l_resource_index);
1048:
1041: hr_utility.trace('index is '||to_char(l_resource_index));
1042: hr_utility.trace('prefs_ok flag is '||p_prefs(l_resource_index).prefs_ok);
1043: hr_utility.trace('rtr grp start is '||to_char(p_prefs(l_resource_index).rtr_start));
1044: hr_utility.trace('rtr grp end is '||to_char(p_prefs(l_resource_index).rtr_end));
1045: hr_utility.trace('');
1046:
1047: l_resource_index := p_prefs.NEXT(l_resource_index);
1048:
1049: END LOOP;
1047: l_resource_index := p_prefs.NEXT(l_resource_index);
1048:
1049: END LOOP;
1050:
1051: hr_utility.trace('****** RTR Rules ********');
1052:
1053: l_resource_index := p_ret_rules.FIRST;
1054:
1055: WHILE l_resource_index IS NOT NULL
1053: l_resource_index := p_ret_rules.FIRST;
1054:
1055: WHILE l_resource_index IS NOT NULL
1056: LOOP
1057: hr_utility.trace('');
1058: hr_utility.trace('index is '||to_char(l_resource_index));
1059: hr_utility.trace('rtr grp id is '||to_char(p_ret_rules(l_resource_index).rtr_grp_id));
1060: hr_utility.trace('time recipient id is '||to_char(p_ret_rules(l_resource_index).time_recipient_id));
1061: hr_utility.trace('status is :'||p_ret_rules(l_resource_index).status||':');
1054:
1055: WHILE l_resource_index IS NOT NULL
1056: LOOP
1057: hr_utility.trace('');
1058: hr_utility.trace('index is '||to_char(l_resource_index));
1059: hr_utility.trace('rtr grp id is '||to_char(p_ret_rules(l_resource_index).rtr_grp_id));
1060: hr_utility.trace('time recipient id is '||to_char(p_ret_rules(l_resource_index).time_recipient_id));
1061: hr_utility.trace('status is :'||p_ret_rules(l_resource_index).status||':');
1062: hr_utility.trace('outcome exists is '||p_ret_rules(l_resource_index).outcome_exists);
1055: WHILE l_resource_index IS NOT NULL
1056: LOOP
1057: hr_utility.trace('');
1058: hr_utility.trace('index is '||to_char(l_resource_index));
1059: hr_utility.trace('rtr grp id is '||to_char(p_ret_rules(l_resource_index).rtr_grp_id));
1060: hr_utility.trace('time recipient id is '||to_char(p_ret_rules(l_resource_index).time_recipient_id));
1061: hr_utility.trace('status is :'||p_ret_rules(l_resource_index).status||':');
1062: hr_utility.trace('outcome exists is '||p_ret_rules(l_resource_index).outcome_exists);
1063: hr_utility.trace('outcome start is '||to_char(p_ret_rules(l_resource_index).outcome_start));
1056: LOOP
1057: hr_utility.trace('');
1058: hr_utility.trace('index is '||to_char(l_resource_index));
1059: hr_utility.trace('rtr grp id is '||to_char(p_ret_rules(l_resource_index).rtr_grp_id));
1060: hr_utility.trace('time recipient id is '||to_char(p_ret_rules(l_resource_index).time_recipient_id));
1061: hr_utility.trace('status is :'||p_ret_rules(l_resource_index).status||':');
1062: hr_utility.trace('outcome exists is '||p_ret_rules(l_resource_index).outcome_exists);
1063: hr_utility.trace('outcome start is '||to_char(p_ret_rules(l_resource_index).outcome_start));
1064: hr_utility.trace('outcome stop is '||to_char(p_ret_rules(l_resource_index).outcome_stop));
1057: hr_utility.trace('');
1058: hr_utility.trace('index is '||to_char(l_resource_index));
1059: hr_utility.trace('rtr grp id is '||to_char(p_ret_rules(l_resource_index).rtr_grp_id));
1060: hr_utility.trace('time recipient id is '||to_char(p_ret_rules(l_resource_index).time_recipient_id));
1061: hr_utility.trace('status is :'||p_ret_rules(l_resource_index).status||':');
1062: hr_utility.trace('outcome exists is '||p_ret_rules(l_resource_index).outcome_exists);
1063: hr_utility.trace('outcome start is '||to_char(p_ret_rules(l_resource_index).outcome_start));
1064: hr_utility.trace('outcome stop is '||to_char(p_ret_rules(l_resource_index).outcome_stop));
1065: hr_utility.trace('');
1058: hr_utility.trace('index is '||to_char(l_resource_index));
1059: hr_utility.trace('rtr grp id is '||to_char(p_ret_rules(l_resource_index).rtr_grp_id));
1060: hr_utility.trace('time recipient id is '||to_char(p_ret_rules(l_resource_index).time_recipient_id));
1061: hr_utility.trace('status is :'||p_ret_rules(l_resource_index).status||':');
1062: hr_utility.trace('outcome exists is '||p_ret_rules(l_resource_index).outcome_exists);
1063: hr_utility.trace('outcome start is '||to_char(p_ret_rules(l_resource_index).outcome_start));
1064: hr_utility.trace('outcome stop is '||to_char(p_ret_rules(l_resource_index).outcome_stop));
1065: hr_utility.trace('');
1066:
1059: hr_utility.trace('rtr grp id is '||to_char(p_ret_rules(l_resource_index).rtr_grp_id));
1060: hr_utility.trace('time recipient id is '||to_char(p_ret_rules(l_resource_index).time_recipient_id));
1061: hr_utility.trace('status is :'||p_ret_rules(l_resource_index).status||':');
1062: hr_utility.trace('outcome exists is '||p_ret_rules(l_resource_index).outcome_exists);
1063: hr_utility.trace('outcome start is '||to_char(p_ret_rules(l_resource_index).outcome_start));
1064: hr_utility.trace('outcome stop is '||to_char(p_ret_rules(l_resource_index).outcome_stop));
1065: hr_utility.trace('');
1066:
1067: l_resource_index := p_ret_rules.NEXT(l_resource_index);
1060: hr_utility.trace('time recipient id is '||to_char(p_ret_rules(l_resource_index).time_recipient_id));
1061: hr_utility.trace('status is :'||p_ret_rules(l_resource_index).status||':');
1062: hr_utility.trace('outcome exists is '||p_ret_rules(l_resource_index).outcome_exists);
1063: hr_utility.trace('outcome start is '||to_char(p_ret_rules(l_resource_index).outcome_start));
1064: hr_utility.trace('outcome stop is '||to_char(p_ret_rules(l_resource_index).outcome_stop));
1065: hr_utility.trace('');
1066:
1067: l_resource_index := p_ret_rules.NEXT(l_resource_index);
1068:
1061: hr_utility.trace('status is :'||p_ret_rules(l_resource_index).status||':');
1062: hr_utility.trace('outcome exists is '||p_ret_rules(l_resource_index).outcome_exists);
1063: hr_utility.trace('outcome start is '||to_char(p_ret_rules(l_resource_index).outcome_start));
1064: hr_utility.trace('outcome stop is '||to_char(p_ret_rules(l_resource_index).outcome_stop));
1065: hr_utility.trace('');
1066:
1067: l_resource_index := p_ret_rules.NEXT(l_resource_index);
1068:
1069: END LOOP;
1067: l_resource_index := p_ret_rules.NEXT(l_resource_index);
1068:
1069: END LOOP;
1070:
1071: hr_utility.trace('****** RTR Outcome ********');
1072:
1073: l_resource_index := p_rtr_outcomes.FIRST;
1074:
1075: WHILE l_resource_index IS NOT NULL
1073: l_resource_index := p_rtr_outcomes.FIRST;
1074:
1075: WHILE l_resource_index IS NOT NULL
1076: LOOP
1077: hr_utility.trace('');
1078: hr_utility.trace('index is '||to_char(l_resource_index));
1079: hr_utility.trace('rtr grp id is '||to_char(p_rtr_outcomes(l_resource_index).rtr_grp_id));
1080: hr_utility.trace('time recipient id is '||to_char(p_rtr_outcomes(l_resource_index).time_recipient_id));
1081: hr_utility.trace('start time is '||to_char(p_rtr_outcomes(l_resource_index).start_time,'dd-mon-yyyy'));
1074:
1075: WHILE l_resource_index IS NOT NULL
1076: LOOP
1077: hr_utility.trace('');
1078: hr_utility.trace('index is '||to_char(l_resource_index));
1079: hr_utility.trace('rtr grp id is '||to_char(p_rtr_outcomes(l_resource_index).rtr_grp_id));
1080: hr_utility.trace('time recipient id is '||to_char(p_rtr_outcomes(l_resource_index).time_recipient_id));
1081: hr_utility.trace('start time is '||to_char(p_rtr_outcomes(l_resource_index).start_time,'dd-mon-yyyy'));
1082: hr_utility.trace('stop time is '||to_char(p_rtr_outcomes(l_resource_index).stop_time,'dd-mon-yyyy'));
1075: WHILE l_resource_index IS NOT NULL
1076: LOOP
1077: hr_utility.trace('');
1078: hr_utility.trace('index is '||to_char(l_resource_index));
1079: hr_utility.trace('rtr grp id is '||to_char(p_rtr_outcomes(l_resource_index).rtr_grp_id));
1080: hr_utility.trace('time recipient id is '||to_char(p_rtr_outcomes(l_resource_index).time_recipient_id));
1081: hr_utility.trace('start time is '||to_char(p_rtr_outcomes(l_resource_index).start_time,'dd-mon-yyyy'));
1082: hr_utility.trace('stop time is '||to_char(p_rtr_outcomes(l_resource_index).stop_time,'dd-mon-yyyy'));
1083: hr_utility.trace('');
1076: LOOP
1077: hr_utility.trace('');
1078: hr_utility.trace('index is '||to_char(l_resource_index));
1079: hr_utility.trace('rtr grp id is '||to_char(p_rtr_outcomes(l_resource_index).rtr_grp_id));
1080: hr_utility.trace('time recipient id is '||to_char(p_rtr_outcomes(l_resource_index).time_recipient_id));
1081: hr_utility.trace('start time is '||to_char(p_rtr_outcomes(l_resource_index).start_time,'dd-mon-yyyy'));
1082: hr_utility.trace('stop time is '||to_char(p_rtr_outcomes(l_resource_index).stop_time,'dd-mon-yyyy'));
1083: hr_utility.trace('');
1084:
1077: hr_utility.trace('');
1078: hr_utility.trace('index is '||to_char(l_resource_index));
1079: hr_utility.trace('rtr grp id is '||to_char(p_rtr_outcomes(l_resource_index).rtr_grp_id));
1080: hr_utility.trace('time recipient id is '||to_char(p_rtr_outcomes(l_resource_index).time_recipient_id));
1081: hr_utility.trace('start time is '||to_char(p_rtr_outcomes(l_resource_index).start_time,'dd-mon-yyyy'));
1082: hr_utility.trace('stop time is '||to_char(p_rtr_outcomes(l_resource_index).stop_time,'dd-mon-yyyy'));
1083: hr_utility.trace('');
1084:
1085: l_resource_index := p_rtr_outcomes.NEXT(l_resource_index);
1078: hr_utility.trace('index is '||to_char(l_resource_index));
1079: hr_utility.trace('rtr grp id is '||to_char(p_rtr_outcomes(l_resource_index).rtr_grp_id));
1080: hr_utility.trace('time recipient id is '||to_char(p_rtr_outcomes(l_resource_index).time_recipient_id));
1081: hr_utility.trace('start time is '||to_char(p_rtr_outcomes(l_resource_index).start_time,'dd-mon-yyyy'));
1082: hr_utility.trace('stop time is '||to_char(p_rtr_outcomes(l_resource_index).stop_time,'dd-mon-yyyy'));
1083: hr_utility.trace('');
1084:
1085: l_resource_index := p_rtr_outcomes.NEXT(l_resource_index);
1086:
1079: hr_utility.trace('rtr grp id is '||to_char(p_rtr_outcomes(l_resource_index).rtr_grp_id));
1080: hr_utility.trace('time recipient id is '||to_char(p_rtr_outcomes(l_resource_index).time_recipient_id));
1081: hr_utility.trace('start time is '||to_char(p_rtr_outcomes(l_resource_index).start_time,'dd-mon-yyyy'));
1082: hr_utility.trace('stop time is '||to_char(p_rtr_outcomes(l_resource_index).stop_time,'dd-mon-yyyy'));
1083: hr_utility.trace('');
1084:
1085: l_resource_index := p_rtr_outcomes.NEXT(l_resource_index);
1086:
1087: END LOOP;
1085: l_resource_index := p_rtr_outcomes.NEXT(l_resource_index);
1086:
1087: END LOOP;
1088:
1089: hr_utility.trace('****** Errors ********');
1090:
1091: l_resource_index := p_errors.FIRST;
1092:
1093: WHILE l_resource_index IS NOT NULL
1091: l_resource_index := p_errors.FIRST;
1092:
1093: WHILE l_resource_index IS NOT NULL
1094: LOOP
1095: hr_utility.trace('');
1096: hr_utility.trace('index is '||to_char(l_resource_index));
1097: hr_utility.trace('exception is '||SUBSTR(p_errors(l_resource_index).exception_description,1,60));
1098: hr_utility.trace('');
1099:
1092:
1093: WHILE l_resource_index IS NOT NULL
1094: LOOP
1095: hr_utility.trace('');
1096: hr_utility.trace('index is '||to_char(l_resource_index));
1097: hr_utility.trace('exception is '||SUBSTR(p_errors(l_resource_index).exception_description,1,60));
1098: hr_utility.trace('');
1099:
1100: l_resource_index := p_errors.NEXT(l_resource_index);
1093: WHILE l_resource_index IS NOT NULL
1094: LOOP
1095: hr_utility.trace('');
1096: hr_utility.trace('index is '||to_char(l_resource_index));
1097: hr_utility.trace('exception is '||SUBSTR(p_errors(l_resource_index).exception_description,1,60));
1098: hr_utility.trace('');
1099:
1100: l_resource_index := p_errors.NEXT(l_resource_index);
1101:
1094: LOOP
1095: hr_utility.trace('');
1096: hr_utility.trace('index is '||to_char(l_resource_index));
1097: hr_utility.trace('exception is '||SUBSTR(p_errors(l_resource_index).exception_description,1,60));
1098: hr_utility.trace('');
1099:
1100: l_resource_index := p_errors.NEXT(l_resource_index);
1101:
1102: END LOOP;
1160: l_rsn_failed_lock varchar2(50) := 'Failed to obtain LOCK';
1161:
1162: BEGIN
1163:
1164: g_debug := hr_utility.debug_enabled;
1165:
1166: -- check to see if we have tried to lock this timecard before
1167: -- or if the timecard is already locked
1168:
1314: IF ( NOT p_tc_locked )
1315: THEN
1316: IF ( g_debug ) THEN
1317: l_proc := g_package||'chk_retrieve';
1318: hr_utility.trace('not locked');
1319: hr_utility.trace('message is '||l_message_table(1).message_name);
1320: END IF;
1321:
1322: p_day_retrieve := FALSE;
1315: THEN
1316: IF ( g_debug ) THEN
1317: l_proc := g_package||'chk_retrieve';
1318: hr_utility.trace('not locked');
1319: hr_utility.trace('message is '||l_message_table(1).message_name);
1320: END IF;
1321:
1322: p_day_retrieve := FALSE;
1323: p_timecard_retrieve := FALSE;
1340: /*
1341: IF ( p_day_retrieve )
1342: THEN
1343: IF ( g_debug ) THEN
1344: hr_utility.trace('');
1345: hr_utility.trace('day retrieve is TRUE for resource '||to_char(p_resource_id));
1346: hr_utility.trace('day is '||to_char(p_bb_start_time, 'dd-mon-yyyy hh:mi:ss'));
1347: hr_utility.trace('');
1348: END IF;
1341: IF ( p_day_retrieve )
1342: THEN
1343: IF ( g_debug ) THEN
1344: hr_utility.trace('');
1345: hr_utility.trace('day retrieve is TRUE for resource '||to_char(p_resource_id));
1346: hr_utility.trace('day is '||to_char(p_bb_start_time, 'dd-mon-yyyy hh:mi:ss'));
1347: hr_utility.trace('');
1348: END IF;
1349: ELSE
1342: THEN
1343: IF ( g_debug ) THEN
1344: hr_utility.trace('');
1345: hr_utility.trace('day retrieve is TRUE for resource '||to_char(p_resource_id));
1346: hr_utility.trace('day is '||to_char(p_bb_start_time, 'dd-mon-yyyy hh:mi:ss'));
1347: hr_utility.trace('');
1348: END IF;
1349: ELSE
1350: IF ( g_debug ) THEN
1343: IF ( g_debug ) THEN
1344: hr_utility.trace('');
1345: hr_utility.trace('day retrieve is TRUE for resource '||to_char(p_resource_id));
1346: hr_utility.trace('day is '||to_char(p_bb_start_time, 'dd-mon-yyyy hh:mi:ss'));
1347: hr_utility.trace('');
1348: END IF;
1349: ELSE
1350: IF ( g_debug ) THEN
1351: hr_utility.trace('');
1347: hr_utility.trace('');
1348: END IF;
1349: ELSE
1350: IF ( g_debug ) THEN
1351: hr_utility.trace('');
1352: hr_utility.trace('day retrieve is FALSE for resource '||to_char(p_resource_id));
1353: hr_utility.trace('');
1354: END IF;
1355: END IF;
1348: END IF;
1349: ELSE
1350: IF ( g_debug ) THEN
1351: hr_utility.trace('');
1352: hr_utility.trace('day retrieve is FALSE for resource '||to_char(p_resource_id));
1353: hr_utility.trace('');
1354: END IF;
1355: END IF;
1356:
1349: ELSE
1350: IF ( g_debug ) THEN
1351: hr_utility.trace('');
1352: hr_utility.trace('day retrieve is FALSE for resource '||to_char(p_resource_id));
1353: hr_utility.trace('');
1354: END IF;
1355: END IF;
1356:
1357: IF ( p_timecard_retrieve )
1356:
1357: IF ( p_timecard_retrieve )
1358: THEN
1359: IF ( g_debug ) THEN
1360: hr_utility.trace('');
1361: hr_utility.trace('time retrieve is TRUE for resource '||to_char(p_resource_id));
1362: hr_utility.trace('');
1363: END IF;
1364: ELSE
1357: IF ( p_timecard_retrieve )
1358: THEN
1359: IF ( g_debug ) THEN
1360: hr_utility.trace('');
1361: hr_utility.trace('time retrieve is TRUE for resource '||to_char(p_resource_id));
1362: hr_utility.trace('');
1363: END IF;
1364: ELSE
1365: IF ( g_debug ) THEN
1358: THEN
1359: IF ( g_debug ) THEN
1360: hr_utility.trace('');
1361: hr_utility.trace('time retrieve is TRUE for resource '||to_char(p_resource_id));
1362: hr_utility.trace('');
1363: END IF;
1364: ELSE
1365: IF ( g_debug ) THEN
1366: hr_utility.trace('');
1362: hr_utility.trace('');
1363: END IF;
1364: ELSE
1365: IF ( g_debug ) THEN
1366: hr_utility.trace('');
1367: hr_utility.trace('time retrieve is FALSE for resource '||to_char(p_resource_id));
1368: hr_utility.trace('');
1369: END IF;
1370: END IF;
1363: END IF;
1364: ELSE
1365: IF ( g_debug ) THEN
1366: hr_utility.trace('');
1367: hr_utility.trace('time retrieve is FALSE for resource '||to_char(p_resource_id));
1368: hr_utility.trace('');
1369: END IF;
1370: END IF;
1371: */
1364: ELSE
1365: IF ( g_debug ) THEN
1366: hr_utility.trace('');
1367: hr_utility.trace('time retrieve is FALSE for resource '||to_char(p_resource_id));
1368: hr_utility.trace('');
1369: END IF;
1370: END IF;
1371: */
1372:
1389: THEN
1390: -- If you need adjustments, log it down.
1391: IF(g_debug)
1392: THEN
1393: hr_utility.trace('Resource '||p_resource_id||
1394: ' had a different Rules evaluation preference earlier and needs adjustment this time');
1395: END IF;
1396: END IF;
1397: END IF;
1421:
1422: l_overall_status hxc_transaction_details.status%TYPE;
1423:
1424: BEGIN
1425: g_debug := hr_utility.debug_enabled;
1426:
1427: IF ( g_debug ) THEN
1428: l_proc := g_package||'set_parent_statuses';
1429: hr_utility.set_location('Processing '||l_proc, 10);
1425: g_debug := hr_utility.debug_enabled;
1426:
1427: IF ( g_debug ) THEN
1428: l_proc := g_package||'set_parent_statuses';
1429: hr_utility.set_location('Processing '||l_proc, 10);
1430: END IF;
1431:
1432: IF ( ( hxc_generic_retrieval_pkg.t_tx_detail_bb_id.COUNT <> 0 )
1433: AND ( hxc_generic_retrieval_pkg.t_tx_time_bb_id.COUNT <> 0 )
1434: AND ( hxc_generic_retrieval_pkg.t_tx_day_bb_id.COUNT <> 0 ) )
1435: THEN
1436:
1437: IF ( g_debug ) THEN
1438: hr_utility.set_location('Processing '||l_proc, 20);
1439: END IF;
1440:
1441: -- loop through timecard statuses
1442:
1443: FOR time IN hxc_generic_retrieval_pkg.t_tx_time_bb_id.FIRST ..
1444: hxc_generic_retrieval_pkg.t_tx_time_bb_id.LAST
1445: LOOP
1446: IF ( g_debug ) THEN
1447: hr_utility.set_location('Processing '||l_proc, 30);
1448: END IF;
1449:
1450: l_day_parent := hxc_generic_retrieval_pkg.t_tx_time_bb_id(time);
1451: l_day_changed := TRUE;
1456:
1457: WHILE ( l_day_changed )
1458: LOOP
1459: IF ( g_debug ) THEN
1460: hr_utility.set_location('Processing '||l_proc, 40);
1461: END IF;
1462:
1463: -- store day index in day table indexed by day bb id
1464:
1468:
1469: IF ( l_day_index IS NOT NULL )
1470: THEN
1471: IF ( g_debug ) THEN
1472: hr_utility.set_location('Processing '||l_proc, 50);
1473: END IF;
1474:
1475: IF ( hxc_generic_retrieval_pkg.t_tx_day_parent_id(l_day_index) <> l_day_parent )
1476: THEN
1474:
1475: IF ( hxc_generic_retrieval_pkg.t_tx_day_parent_id(l_day_index) <> l_day_parent )
1476: THEN
1477: IF ( g_debug ) THEN
1478: hr_utility.set_location('Processing '||l_proc, 60);
1479: END IF;
1480:
1481: l_day_changed := FALSE;
1482: l_last_day_index := l_day_index;
1482: l_last_day_index := l_day_index;
1483: END IF;
1484: ELSE
1485: IF ( g_debug ) THEN
1486: hr_utility.set_location('Processing '||l_proc, 70);
1487: END IF;
1488:
1489: l_day_changed := FALSE;
1490: END IF;
1489: l_day_changed := FALSE;
1490: END IF;
1491:
1492: IF ( g_debug ) THEN
1493: hr_utility.set_location('Processing '||l_proc, 80);
1494: END IF;
1495:
1496: IF NOT ( l_day_changed )
1497: THEN
1495:
1496: IF NOT ( l_day_changed )
1497: THEN
1498: IF ( g_debug ) THEN
1499: hr_utility.set_location('Processing '||l_proc, 90);
1500: END IF;
1501:
1502: IF ( l_day_table.COUNT <> 0 )
1503: THEN
1501:
1502: IF ( l_day_table.COUNT <> 0 )
1503: THEN
1504: IF ( g_debug ) THEN
1505: hr_utility.set_location('Processing '||l_proc, 100);
1506: END IF;
1507:
1508: -- get detail statuses
1509:
1514:
1515: WHILE ( l_same_timecard )
1516: LOOP
1517: IF ( g_debug ) THEN
1518: hr_utility.set_location('Processing '||l_proc, 110);
1519: END IF;
1520:
1521: IF ( hxc_generic_retrieval_pkg.t_tx_detail_status(l_detail_index) = 'ERRORS' )
1522: THEN
1528: l_overall_status := 'SUCCESS';
1529: END IF;
1530:
1531: IF ( g_debug ) THEN
1532: hr_utility.set_location('Processing '||l_proc, 120);
1533: END IF;
1534:
1535: IF NOT ( l_day_table.EXISTS( hxc_generic_retrieval_pkg.t_tx_detail_parent_id(l_detail_index) ) )
1536: THEN
1534:
1535: IF NOT ( l_day_table.EXISTS( hxc_generic_retrieval_pkg.t_tx_detail_parent_id(l_detail_index) ) )
1536: THEN
1537: IF ( g_debug ) THEN
1538: hr_utility.set_location('Processing '||l_proc, 130);
1539: END IF;
1540:
1541: l_same_timecard := FALSE;
1542: l_last_detail_index := l_detail_index;
1543: hxc_generic_retrieval_pkg.t_tx_time_status(time) := l_overall_status;
1544: l_day_table.DELETE;
1545: ELSE
1546: IF ( g_debug ) THEN
1547: hr_utility.set_location('Processing '||l_proc, 140);
1548: END IF;
1549:
1550:
1551: hxc_generic_retrieval_pkg.t_tx_day_status(l_day_table(hxc_generic_retrieval_pkg.t_tx_detail_parent_id(l_detail_index)).ind)
1557:
1558: IF ( l_detail_index IS NULL )
1559: THEN
1560: IF ( g_debug ) THEN
1561: hr_utility.set_location('Processing '||l_proc, 150);
1562: END IF;
1563:
1564: hxc_generic_retrieval_pkg.t_tx_time_status(time) := l_overall_status;
1565: l_same_timecard := FALSE;
1578:
1579: END IF; -- hxc_generic_retrieval_pkg.t_tx_detail_bb_id.COUNT <> 0 )
1580:
1581: IF ( g_debug ) THEN
1582: hr_utility.set_location('Processing '||l_proc, 170);
1583: END IF;
1584:
1585: END set_parent_statuses;
1586:
1638: l_appl_id fnd_application.application_id%TYPE;
1639:
1640: BEGIN
1641:
1642: g_debug := hr_utility.debug_enabled;
1643:
1644: IF ( g_debug ) THEN
1645: l_proc := g_package||'recovery';
1646: hr_utility.set_location('Processing '||l_proc, 10);
1642: g_debug := hr_utility.debug_enabled;
1643:
1644: IF ( g_debug ) THEN
1645: l_proc := g_package||'recovery';
1646: hr_utility.set_location('Processing '||l_proc, 10);
1647:
1648: hr_utility.trace('process id is '||to_char(p_process_id));
1649: hr_utility.trace('process is '||p_process);
1650: END IF;
1644: IF ( g_debug ) THEN
1645: l_proc := g_package||'recovery';
1646: hr_utility.set_location('Processing '||l_proc, 10);
1647:
1648: hr_utility.trace('process id is '||to_char(p_process_id));
1649: hr_utility.trace('process is '||p_process);
1650: END IF;
1651:
1652: WHILE NOT l_cleaned_up
1645: l_proc := g_package||'recovery';
1646: hr_utility.set_location('Processing '||l_proc, 10);
1647:
1648: hr_utility.trace('process id is '||to_char(p_process_id));
1649: hr_utility.trace('process is '||p_process);
1650: END IF;
1651:
1652: WHILE NOT l_cleaned_up
1653: LOOP
1667: FETCH csr_chk_conc_request INTO l_req_date;
1668: CLOSE csr_chk_conc_request;
1669:
1670: IF ( g_debug ) THEN
1671: hr_utility.trace('Minimum Conc Date for PA is '||to_char(l_req_date,'DD-MON-YYYY HH24:MI:SS'));
1672: END IF;
1673:
1674: ELSIF ( p_process in ( 'BEE Retrieval Process', 'Apply Schedule Rules') )
1675: THEN
1682: FETCH csr_chk_conc_request INTO l_req_date;
1683: CLOSE csr_chk_conc_request;
1684:
1685: IF ( g_debug ) THEN
1686: hr_utility.trace('Minimum Conc Date for BEE is '||to_char(l_req_date,'DD-MON-YYYY HH24:MI:SS'));
1687: END IF;
1688:
1689: ELSIF ( p_process = 'Purchasing Retrieval Process' )
1690: THEN
1697: FETCH csr_chk_conc_request INTO l_req_date;
1698: CLOSE csr_chk_conc_request;
1699:
1700: IF ( g_debug ) THEN
1701: hr_utility.trace('Minimum Conc Date for PO is '||to_char(l_req_date,'DD-MON-YYYY HH24:MI:SS'));
1702: END IF;
1703:
1704: ELSIF ( p_process = 'Maintenance Retrieval Process' )
1705: THEN
1712: FETCH csr_chk_conc_request INTO l_req_date;
1713: CLOSE csr_chk_conc_request;
1714:
1715: IF ( g_debug ) THEN
1716: hr_utility.trace('Minimum Conc Date for EAM is '||to_char(l_req_date,'DD-MON-YYYY HH24:MI:SS'));
1717: END IF;
1718:
1719: END IF;
1720:
1718:
1719: END IF;
1720:
1721: IF ( g_debug ) THEN
1722: hr_utility.set_location('Processing '||l_proc, 20);
1723: END IF;
1724:
1725: -- chk to see if there are any IN PROGRESS transactions for this retrieval process
1726: -- which were created before the minimum process date - these MUST be rogue
1729: OPEN csr_chk_for_in_progress ( l_req_date );
1730: FETCH csr_chk_for_in_progress INTO l_tx_rec;
1731:
1732: IF ( g_debug ) THEN
1733: hr_utility.set_location('Processing '||l_proc, 25);
1734: END IF;
1735:
1736: IF ( csr_chk_for_in_progress%FOUND )
1737: THEN
1738: -- if we know there are outstanding transactions then lock the retrieval
1739: -- range table now to ensure no other processes are accessing it
1740:
1741: IF ( g_debug ) THEN
1742: hr_utility.trace('Locking table');
1743: END IF;
1744:
1745: l_locking_retrieval_ranges := TRUE;
1746:
1748:
1749: END IF;
1750:
1751: IF ( g_debug ) THEN
1752: hr_utility.set_location('Processing '||l_proc, 30);
1753: END IF;
1754:
1755: WHILE csr_chk_for_in_progress%FOUND
1756: LOOP
1755: WHILE csr_chk_for_in_progress%FOUND
1756: LOOP
1757:
1758: IF ( g_debug ) THEN
1759: hr_utility.trace('tx id is '||to_char(l_tx_rec.transaction_id));
1760: hr_utility.trace('tx date is '||to_char(l_tx_rec.transaction_date,'DD-MON-YYYY HH24:MI:SS'));
1761: END IF;
1762:
1763: l_tx_tab(l_tx_rec.transaction_id).run_date := l_tx_rec.transaction_date;
1756: LOOP
1757:
1758: IF ( g_debug ) THEN
1759: hr_utility.trace('tx id is '||to_char(l_tx_rec.transaction_id));
1760: hr_utility.trace('tx date is '||to_char(l_tx_rec.transaction_date,'DD-MON-YYYY HH24:MI:SS'));
1761: END IF;
1762:
1763: l_tx_tab(l_tx_rec.transaction_id).run_date := l_tx_rec.transaction_date;
1764:
1766:
1767: END LOOP;
1768:
1769: IF ( g_debug ) THEN
1770: hr_utility.set_location('Processing '||l_proc, 40);
1771: END IF;
1772:
1773: IF l_tx_tab.COUNT > 0
1774: THEN
1773: IF l_tx_tab.COUNT > 0
1774: THEN
1775:
1776: IF ( g_debug ) THEN
1777: hr_utility.set_location('Processing '||l_proc, 50);
1778: END IF;
1779:
1780: -- we have some rogue transactions - let's update them
1781:
1784: WHILE l_index IS NOT NULL
1785: LOOP
1786:
1787: IF ( g_debug ) THEN
1788: hr_utility.trace('Updating tx id '||to_char(l_index));
1789: END IF;
1790:
1791: UPDATE hxc_transactions tx
1792: SET tx.status = 'RECOVERED'
1806:
1807: -- COMMIT;
1808:
1809: IF ( g_debug ) THEN
1810: hr_utility.set_location('Processing '||l_proc, 60);
1811: END IF;
1812:
1813:
1814: END IF; -- l_tx_tab.COUNT > 0
1838:
1839: IF ( SQLCODE = '-54' )
1840: THEN
1841: IF ( g_debug ) THEN
1842: hr_utility.set_location('Processing '||l_proc, 70);
1843: END IF;
1844:
1845: IF ( l_locking_retrieval_ranges )
1846: THEN
1854: l_cnt := l_cnt + 1;
1855: ELSE
1856:
1857: IF ( g_debug ) THEN
1858: hr_utility.trace('SQLERRM is '||SQLERRM);
1859: END IF;
1860:
1861: raise;
1862: END IF;