1: Package Body hxc_setup_validation_pkg as
2: /* $Header: hxcotcvld.pkb 120.15 2006/10/06 16:44:09 arundell noship $ */
3:
4: g_debug boolean := hr_utility.debug_enabled;
5:
6: --
7: --
8: -- ----------------------------------------------------------------------------
218: END test_aps_vs_rtr;
219:
220: BEGIN -- execute_otc_Validation
221:
222: g_debug := hr_utility.debug_enabled;
223:
224: if g_debug then
225: l_proc := g_package||'execute_otc_validation';
226: hr_utility.set_location('Processing '||l_proc, 10);
222: g_debug := hr_utility.debug_enabled;
223:
224: if g_debug then
225: l_proc := g_package||'execute_otc_validation';
226: hr_utility.set_location('Processing '||l_proc, 10);
227: end if;
228:
229: l_timecard_info_rec.resource_id := p_resource_id;
230: l_timecard_info_rec.timecard_bb_id := p_timecard_bb_id;
243: p_master_pref_table => p_master_pref_table );
244:
245: l_app_set_id := TO_NUMBER(l_pref_table(1).attribute1);
246: if g_debug then
247: hr_utility.trace('gaz - app set id is '||to_char(l_app_set_id));
248: end if;
249:
250: hxc_preference_evaluation.resource_preferences(p_resource_id => l_timecard_info_rec.resource_id,
251: p_preference_code => 'TS_PER_RETRIEVAL_RULES',
255: p_master_pref_table => p_master_pref_table );
256:
257: l_rtr_grp_id := TO_NUMBER(l_pref_table(1).attribute1);
258: if g_debug then
259: hr_utility.trace('gaz - rtr grp id is '||to_char(l_rtr_grp_id));
260: end if;
261:
262: hxc_preference_evaluation.resource_preferences(p_resource_id => l_timecard_info_rec.resource_id,
263: p_preference_code => 'TC_W_RULES_EVALUATION',
268:
269: l_otm_explosion := l_pref_table(1).attribute1;
270: l_otm_rtr_id := TO_NUMBER(l_pref_table(1).attribute2);
271: if g_debug then
272: hr_utility.trace('gaz - otm explosion is '||l_otm_explosion);
273: end if;
274:
275: hxc_preference_evaluation.resource_preferences(p_resource_id => l_timecard_info_rec.resource_id,
276: p_preference_code => 'TS_PER_APPROVAL_PERIODS',
280: p_master_pref_table => p_master_pref_table );
281:
282: l_approval_period_set_id := TO_NUMBER(l_pref_table(1).attribute1);
283: if g_debug then
284: hr_utility.trace('gaz - approval period set id is '||to_char(l_approval_period_set_id));
285: end if;
286:
287: hxc_preference_evaluation.resource_preferences(p_resource_id => l_timecard_info_rec.resource_id,
288: p_preference_code => 'TS_PER_APPROVAL_STYLE',
293:
294: l_approval_style_id := TO_NUMBER(l_pref_table(1).attribute1);
295: l_override_approval_style_id := TO_NUMBER(l_pref_table(1).attribute2);
296: if g_debug then
297: hr_utility.trace('gaz - approval style id is '||to_char(l_approval_style_id));
298: hr_utility.trace('gaz - override approval style id is '||to_char(l_override_approval_style_id));
299: end if;
300:
301: hxc_preference_evaluation.resource_preferences(p_resource_id => l_timecard_info_rec.resource_id,
294: l_approval_style_id := TO_NUMBER(l_pref_table(1).attribute1);
295: l_override_approval_style_id := TO_NUMBER(l_pref_table(1).attribute2);
296: if g_debug then
297: hr_utility.trace('gaz - approval style id is '||to_char(l_approval_style_id));
298: hr_utility.trace('gaz - override approval style id is '||to_char(l_override_approval_style_id));
299: end if;
300:
301: hxc_preference_evaluation.resource_preferences(p_resource_id => l_timecard_info_rec.resource_id,
302: p_preference_code => 'TC_W_TCRD_ST_ALW_EDITS',
308: l_status_allowing_edits := l_pref_table(1).attribute1;
309: l_past_limit_date := l_pref_table(1).attribute6;
310: l_futur_limit_date := l_pref_table(1).attribute11;
311: if g_debug then
312: hr_utility.trace('gaz - status allowing edits is '||l_status_allowing_edits);
313: hr_utility.trace('gaz - past limit date is '||l_past_limit_date);
314: hr_utility.trace('gaz - futur limit date is '||l_futur_limit_date);
315: end if;
316:
309: l_past_limit_date := l_pref_table(1).attribute6;
310: l_futur_limit_date := l_pref_table(1).attribute11;
311: if g_debug then
312: hr_utility.trace('gaz - status allowing edits is '||l_status_allowing_edits);
313: hr_utility.trace('gaz - past limit date is '||l_past_limit_date);
314: hr_utility.trace('gaz - futur limit date is '||l_futur_limit_date);
315: end if;
316:
317: --ELP Validation
310: l_futur_limit_date := l_pref_table(1).attribute11;
311: if g_debug then
312: hr_utility.trace('gaz - status allowing edits is '||l_status_allowing_edits);
313: hr_utility.trace('gaz - past limit date is '||l_past_limit_date);
314: hr_utility.trace('gaz - futur limit date is '||l_futur_limit_date);
315: end if;
316:
317: --ELP Validation
318:
324: p_master_pref_table => p_master_pref_table );
325:
326: l_elp_terg_id := TO_NUMBER(l_pref_table(1).attribute1);
327: if g_debug then
328: hr_utility.trace('gaz- ELP TERG is ' || to_char(l_elp_terg_id));
329: end if;
330:
331: -- Override Approval Validation
332:
363: l_futur_limit_date := to_char((sysdate + to_number(l_futur_limit_date)),'YYYY/MM/DD');
364: END IF;
365:
366: if g_debug then
367: hr_utility.trace('gaz - past limit date is '||l_past_limit_date);
368: hr_utility.trace('gaz - futur limit date is '||l_futur_limit_date);
369: end if;
370:
371: if g_debug then
364: END IF;
365:
366: if g_debug then
367: hr_utility.trace('gaz - past limit date is '||l_past_limit_date);
368: hr_utility.trace('gaz - futur limit date is '||l_futur_limit_date);
369: end if;
370:
371: if g_debug then
372: hr_utility.set_location('Processing '||l_proc, 20);
368: hr_utility.trace('gaz - futur limit date is '||l_futur_limit_date);
369: end if;
370:
371: if g_debug then
372: hr_utility.set_location('Processing '||l_proc, 20);
373: end if;
374:
375: -- now get the application set time recipients and retrieval rule group time recipients
376: -- and make sure they match.
380:
381: WHILE csr_get_retrieval_rules%FOUND
382: LOOP
383: if g_debug then
384: hr_utility.set_location('Processing '||l_proc, 25);
385: end if;
386:
387: t_rtr_tr(l_rtr_tr_id).dummy := 'N';
388:
392:
393: CLOSE csr_get_retrieval_rules;
394:
395: if g_debug then
396: hr_utility.set_location('Processing '||l_proc, 30);
397: end if;
398:
399: OPEN csr_get_app_sets ( l_app_set_id );
400: FETCH csr_get_app_sets INTO l_aps_tr_id;
401:
402: WHILE csr_get_app_sets%FOUND
403: LOOP
404: if g_debug then
405: hr_utility.set_location('Processing '||l_proc, 35);
406: end if;
407:
408: t_aps_tr(l_aps_tr_id).dummy := 'N';
409:
413:
414: CLOSE csr_get_app_sets;
415:
416: if g_debug then
417: hr_utility.set_location('Processing '||l_proc, 40);
418: end if;
419:
420: -- now test to see if the retrieval rule group time recipients
421: -- is at least a subset of the application set time recipients
438:
439: END IF;
440:
441: if g_debug then
442: hr_utility.set_location('Processing '||l_proc, 50);
443: end if;
444:
445: -- now get the time recipients associated with the
446: -- OTM Evaluation rtr if the person has their
448:
449: IF ( l_otm_explosion = 'Y' )
450: THEN
451: if g_debug then
452: hr_utility.set_location('Processing '||l_proc, 55);
453: end if;
454:
455: IF ( l_otm_rtr_id IS NULL )
456: THEN
454:
455: IF ( l_otm_rtr_id IS NULL )
456: THEN
457: if g_debug then
458: hr_utility.set_location('Processing '||l_proc, 60);
459: end if;
460:
461: raise e_no_rtr_id;
462:
462:
463: END IF;
464:
465: if g_debug then
466: hr_utility.set_location('Processing '||l_proc, 70);
467: end if;
468:
469: t_rtr_tr.DELETE;
470:
473:
474: WHILE csr_get_rtr%FOUND
475: LOOP
476: if g_debug then
477: hr_utility.set_location('Processing '||l_proc, 80);
478: end if;
479:
480: t_rtr_tr(l_rtr_tr_id).dummy := 'N';
481:
485:
486: CLOSE csr_get_rtr;
487:
488: if g_debug then
489: hr_utility.set_location('Processing '||l_proc, 90);
490: end if;
491:
492: -- now test to see if the retrieval rule group time recipients
493: -- is at least a subset of the application set time recipients
511: END IF;
512:
513:
514: if g_debug then
515: hr_utility.set_location('Processing '||l_proc, 100);
516: end if;
517:
518: END IF; -- IF ( l_otm_explosion = 'Y' ) GPM v115.19
519:
517:
518: END IF; -- IF ( l_otm_explosion = 'Y' ) GPM v115.19
519:
520: if g_debug then
521: hr_utility.set_location('Processing '||l_proc, 130);
522: end if;
523:
524: -- test that the applications in the application set have a corresponding
525: -- period in the Approval Periods Group
529: WHILE ( l_index IS NOT NULL )
530: LOOP
531:
532: if g_debug then
533: hr_utility.trace('Here is the time recipient '||to_char(l_index));
534:
535: hr_utility.set_location('Processing '||l_proc, 140);
536: end if;
537:
531:
532: if g_debug then
533: hr_utility.trace('Here is the time recipient '||to_char(l_index));
534:
535: hr_utility.set_location('Processing '||l_proc, 140);
536: end if;
537:
538: OPEN csr_get_app_rec_period(l_index, l_approval_period_set_id);
539: FETCH csr_get_app_rec_period into l_dummy;
540:
541: IF csr_get_app_rec_period%NOTFOUND
542: THEN
543: if g_debug then
544: hr_utility.set_location('Processing '||l_proc, 150);
545: end if;
546:
547: hxc_timecard_message_helper.adderrortocollection (
548: p_messages => p_messages
564:
565: CLOSE csr_get_app_rec_period;
566:
567: if g_debug then
568: hr_utility.set_location('Processing '||l_proc, 160);
569: end if;
570:
571: l_index := t_aps_tr.NEXT(l_index);
572:
572:
573: END LOOP; -- t_aps_tr
574:
575: if g_debug then
576: hr_utility.set_location('Processing '||l_proc, 170);
577: end if;
578:
579:
580: -- tests that the time recipients in the application set have
585: WHILE ( l_index IS NOT NULL )
586: LOOP
587:
588: if g_debug then
589: hr_utility.set_location('Processing '||l_proc, 180);
590: end if;
591:
592: OPEN csr_get_approval_style_comps(l_index, l_approval_style_id);
593: FETCH csr_get_approval_style_comps into l_dummy;
594:
595: IF csr_get_approval_style_comps%NOTFOUND
596: THEN
597: if g_debug then
598: hr_utility.set_location('Processing '||l_proc, 190);
599: end if;
600:
601: hxc_timecard_message_helper.adderrortocollection (
602: p_messages => p_messages
618:
619: CLOSE csr_get_approval_style_comps;
620:
621: if g_debug then
622: hr_utility.set_location('Processing '||l_proc, 200);
623: end if;
624:
625: l_index := t_aps_tr.NEXT(l_index);
626:
634: l_index := t_aps_tr.FIRST;
635: WHILE ( l_index IS NOT NULL ) LOOP
636:
637: if g_debug then
638: hr_utility.set_location('Processing '||l_proc, 201);
639: end if;
640: OPEN csr_get_approval_style_comps(l_index, l_override_approval_style_id);
641: FETCH csr_get_approval_style_comps into l_dummy;
642:
641: FETCH csr_get_approval_style_comps into l_dummy;
642:
643: IF csr_get_approval_style_comps%NOTFOUND THEN
644: if g_debug then
645: hr_utility.set_location('Processing '||l_proc, 202);
646: end if;
647:
648: hxc_timecard_message_helper.adderrortocollection
649: (p_messages => p_messages,
666:
667: CLOSE csr_get_approval_style_comps;
668:
669: if g_debug then
670: hr_utility.set_location('Processing '||l_proc, 203);
671: end if;
672:
673: l_index := t_aps_tr.NEXT(l_index);
674:
675: END LOOP; -- t_aps_tr
676: end if; -- Is the Override Style set?
677:
678: if g_debug then
679: hr_utility.set_location('Processing '||l_proc, 210);
680: end if;
681:
682: --ELP Validation
683: -- tests that the time recipients in the application set have
689: WHILE ( l_index IS NOT NULL )
690: LOOP
691:
692: if g_debug then
693: hr_utility.set_location('Processing '||l_proc, 211);
694: end if;
695:
696: OPEN csr_get_elp_terg_comps(l_elp_terg_id,l_index);
697: FETCH csr_get_elp_terg_comps into l_dummy;
698:
699: IF csr_get_elp_terg_comps%NOTFOUND
700: THEN
701: if g_debug then
702: hr_utility.set_location('Processing '||l_proc, 212);
703: end if;
704:
705: hxc_timecard_message_helper.adderrortocollection (
706: p_messages => p_messages
722:
723: CLOSE csr_get_elp_terg_comps;
724:
725: if g_debug then
726: hr_utility.set_location('Processing '||l_proc, 213);
727: end if;
728:
729: l_index := t_aps_tr.NEXT(l_index);
730:
731: END LOOP; -- t_aps_tr
732:
733: END IF;
734: if g_debug then
735: hr_utility.set_location('Processing '||l_proc, 214);
736: end if;
737:
738: -- Now let's check to see if the user is still allowed to update the timecard
739: -- WWB 2290884