1 PACKAGE BODY HR_FR_ASG_RULES AS
2 /* $Header: pefrasgr.pkb 120.0.12000000.2 2007/02/28 10:15:04 spendhar ship $ */
3 --
4 procedure mandatory_checks(
5 p_assignment_id in number,
6 p_payroll_id in number,
7 p_establishment_id in number,
8 p_contract_id in number,
9 p_assignment_type in varchar2 ) is
10
11 begin
12 --
13 /* Added for GSI Bug 5472781 */
14 IF NOT hr_utility.chk_product_install('Oracle Human Resources', 'FR') THEN
15 hr_utility.set_location('Leaving : hr_fr_asg_rules.mandatory_checks' , 10);
16 return;
17 END IF;
18 --
19 hr_utility.set_location('HR_FR_ASG_RULES',10);
20 hr_utility.trace('p_assignment_id: '||to_char(p_assignment_id));
21 hr_utility.trace('p_payroll_id: '||to_char(p_payroll_id));
22 hr_utility.trace('p_establishment_id: '||to_char(p_establishment_id));
23 hr_utility.trace('p_contract_id: '||to_char(p_contract_id));
24 hr_utility.trace('p_assignment_type: '||p_assignment_type);
25
26 IF nvl(fnd_profile.value('PAY_FR_CHECK_MANDATORY_ASG_ATTRIBUTES'),'Y') <> 'N' then -- [
27
28 IF p_assignment_type = 'E' and (Not pqh_utility.is_pqh_installed(hr_general.get_business_group_id)) THEN -- [
29 /* ============================================================================= */
30 /*=================== Commented by DN to test Emp Stat Situation ==============
31
32 IF p_establishment_id is null then -- [
33 hr_utility.trace('HR_FR_ASG_RULES: error PER_74964_MANDATORY_ESTAB. ASSIGNMENT_ID:'||
34 to_char(p_assignment_id));
35 hr_utility.set_message (800,'PER_74964_MANDATORY_ESTAB') ;
36 hr_utility.raise_error;
37 END IF; -- ]
38 =========================== End of comment by DN ===================*/
39 NULL; --added by DN
40 -- contract is no longer mandatory - library code will show a warning if profile is set and
41 -- assignment is on a payroll. Same logic should apply to api but commenting out while
42 -- investigating whether this can be done withing user hook
43 -- IF p_contract_id is null and p_payroll_id is not null then -- [
44 -- hr_utility.trace('HR_FR_ASG_RULES: error PER_74965_MANDATORY_CONTRACT. ASSIGNMENT_ID:'||
45 -- to_char(p_assignment_id));
46 -- hr_utility.set_message (800,'PER_74965_MANDATORY_CONTRACT');
47 -- END IF; -- ]
48 END IF; -- ] end assignment_type E
49 END IF; -- ] end check profile not N
50
51 hr_utility.set_location('HR_FR_ASG_RULES',20);
52
53 end mandatory_checks;
54
55 procedure mandatory_checks_ins(
56 p_assignment_id in number,
57 p_effective_start_date in date,
58 p_effective_end_date in date,
59 p_payroll_id in number,
60 p_establishment_id in number,
61 p_contract_id in number,
62 p_period_of_service_id in Number,
63 p_assignment_type in varchar2 ) is
64
65 cursor csr_existing_assignment is
66 select count(*)
67 from per_all_assignments_f asg
68 where asg.period_of_service_id = p_period_of_service_id
69 and asg.assignment_type = 'E'
70 and asg.assignment_id <> p_assignment_id
71 and asg.effective_start_date <> p_effective_start_date
72 and asg.effective_end_date <> p_effective_end_date;
73
74 l_assignment_exists number;
75
76 begin
77 --
78 /* Added for GSI Bug 5472781 */
79 IF NOT hr_utility.chk_product_install('Oracle Human Resources', 'FR') THEN
80 hr_utility.set_location('Leaving : hr_fr_asg_rules.mandatory_checks_ins' , 30);
81 return;
82 END IF;
83 --
84 -- the employee api first inserts a default assignment with minimal attribution
85 -- detect this situation and bypass validation for the default assignment
86
87 hr_utility.set_location('HR_FR_ASG_RULES.mandatory_checks_ins enter',30);
88 hr_utility.trace('p_assignment_id: '||to_char(p_assignment_id));
89 hr_utility.trace('p_payroll_id: '||to_char(p_payroll_id));
90 hr_utility.trace('p_establishment_id: '||to_char(p_establishment_id));
91 hr_utility.trace('p_contract_id: '||to_char(p_contract_id));
92 hr_utility.trace('p_period_of_service_id:'||to_char(p_period_of_service_id));
93 hr_utility.trace('p_assignment_type: '||p_assignment_type);
94
95 IF nvl(fnd_profile.value('PAY_FR_CHECK_MANDATORY_ASG_ATTRIBUTES'),'Y') <> 'N' then -- [
96
97 IF p_assignment_type = 'E' THEN -- [
98 IF p_establishment_id is null then -- [
99 open csr_existing_assignment;
100 fetch csr_existing_assignment
101 into l_assignment_exists;
102 hr_utility.set_location('HR_FR_ASG_RULES.mandatory_checks_ins ',40);
103 if l_assignment_exists > 0 then -- [ not default assignment
104 hr_utility.trace('HR_FR_ASG_RULES: error PER_74964_MANDATORY_ESTAB. ASSIGNMENT_ID:'||
105 to_char(p_assignment_id));
106 hr_utility.set_message (800,'PER_74964_MANDATORY_ESTAB') ;
107 hr_utility.raise_error;
108 END iF; -- ] end not default asg
109 END IF; -- ] end establishment null
110
111 -- contract is no longer mandatory - library code will show a warning if profile is set and
112 -- assignment is on a payroll. Same logic should apply to api but commenting out while
113 -- investigating whether this can be done withing user hook
114 -- IF p_contract_id is null and p_payroll_id is not null then -- [
115 -- hr_utility.trace('HR_FR_ASG_RULES: error PER_74965_MANDATORY_CONTRACT. ASSIGNMENT_ID:'||
116 -- to_char(p_assignment_id));
117 -- hr_utility.set_message (800,'PER_74965_MANDATORY_CONTRACT');
118 -- END IF; -- ]
119 END IF; -- ] end assignment_type E
120 END IF; -- ] end check profile not N
121
122 hr_utility.set_location('HR_FR_ASG_RULES.mandatory_checks_ins exit',50);
123
124 end mandatory_checks_ins;
125
126 --
127 END HR_FR_ASG_RULES;