[Home] [Help]
PACKAGE BODY: APPS.PA_JOB
Source
1 PACKAGE BODY pa_job AS
2 /* $Header: PAJOBB.pls 120.2 2005/08/25 12:25:44 ramurthy noship $ */
3 --
4 /*
5 NAME
6 pa_predel_validation
7 DESCRIPTION
8 Foreign key reference check.
9 */
10 --
11 PROCEDURE check_business_group(p_job_id IN number,
12 Other_Business_group OUT NOCOPY varchar2); --File.Sql.39 bug 4440895
13 PROCEDURE phase2(p_job_id number);
14
15 PROCEDURE pa_predel_validation (p_job_id number) IS
16 Allow_deletion exception;
17 Not_Allow_deletion exception;
18 Error_Message varchar2(30);
19 Reference_Exist varchar2(1);
20 Other_Business_group varchar2(1);
21 BEGIN
22
23 check_business_group(p_job_id,
24 Other_Business_group);
25 if ( Other_Business_group = 'Y' ) then
26 raise Allow_deletion;
27 end if;
28
29 Pa_Hr_Project_setup.Check_job_reference(p_job_id,
30 Error_Message,
31 Reference_Exist);
32 if ( Reference_Exist = 'Y' ) then
33 raise Not_Allow_deletion;
34 end if;
35
36 Pa_Hr_Resource.Check_job_reference(p_job_id,
37 Error_Message,
38 Reference_Exist);
39 if ( Reference_Exist = 'Y' ) then
40 raise Not_Allow_deletion;
41 end if;
42
43 Pa_Hr_Summarizations.Check_job_reference(p_job_id,
44 Error_Message,
45 Reference_Exist);
46 if ( Reference_Exist = 'Y' ) then
47 raise Not_Allow_deletion;
48 end if;
49
50 Pa_Hr_Budgets.Check_job_reference(p_job_id,
51 Error_Message,
52 Reference_Exist);
53 if ( Reference_Exist = 'Y' ) then
54 raise Not_Allow_deletion;
55 end if;
56
57 Pa_Hr_Cost_Rates.Check_job_reference(p_job_id,
58 Error_Message,
59 Reference_Exist);
60 if ( Reference_Exist = 'Y' ) then
61 raise Not_Allow_deletion;
62 end if;
63
64 Pa_Hr_Transactions.Check_job_reference(p_job_id,
65 Error_Message,
66 Reference_Exist);
67 if ( Reference_Exist = 'Y' ) then
68 raise Not_Allow_deletion;
69 end if;
70
71 Pa_Hr_Bill_Rates.Check_job_reference(p_job_id,
72 Error_Message,
73 Reference_Exist);
74 if ( Reference_Exist = 'Y' ) then
75 raise Not_Allow_deletion;
76 end if;
77
78 Pa_Hr_Agreements.Check_job_reference(p_job_id,
79 Error_Message,
80 Reference_Exist);
81 if ( Reference_Exist = 'Y' ) then
82 raise Not_Allow_deletion;
83 end if;
84
85 Pa_Hr_Invoice.Check_job_reference(p_job_id,
86 Error_Message,
87 Reference_Exist);
88 if ( Reference_Exist = 'Y' ) then
89 raise Not_Allow_deletion;
90 end if;
91
92 Pa_Hr_Capital.Check_job_reference(p_job_id,
93 Error_Message,
94 Reference_Exist);
95 if ( Reference_Exist = 'Y' ) then
96 raise Not_Allow_deletion;
97 end if;
98
99 exception
100 when Allow_deletion then
101 Return;
102 when Not_Allow_deletion then
103 hr_utility.set_message (275, Error_Message);
104 hr_utility.raise_error;
105 when OTHERS then
106 raise;
107
108 END pa_predel_validation;
109
110 PROCEDURE check_business_group (p_job_id IN number,
111 Other_Business_group OUT NOCOPY varchar2) IS --File.Sql.39 bug 4440895
112 job_delete_allowed VARCHAR2(1);
113 BEGIN
114
115 select 'X'
116 into job_delete_allowed
117 from sys.dual
118 where not exists (
119 select null
120 from pa_implementations_all imp,
121 per_jobs job
122 where job.job_id = p_job_id
123 and job.business_group_id = imp.business_group_id );
124 Other_Business_group := 'Y';
125 exception
126 when NO_DATA_FOUND then
127 Other_Business_group := 'N';
128 when OTHERS then
129 Raise;
130 /* **
131 when NO_DATA_FOUND then
132 hr_utility.set_message (275, 'PA_JOB_PHS1_NO_DEL');
133 hr_utility.raise_error;
134 ** */
135 END check_business_group;
136
137 PROCEDURE phase2 (p_job_id number) IS
138 dummy VARCHAR2(240); -- used for into argument
139 cursor pa_job_exists is
140 SELECT 'The Job may not be deleted if PA is installed and implemented'
141 FROM fnd_product_installations fpi
142 , pa_implementations_all imp
143 WHERE fpi.application_id = 275
144 AND fpi.status = 'I';
145
146 BEGIN
147 --
148 -- hr_utility.set_location('PA_JOB.PA_PREDEL_VALIDATION', 1);
149 --
150 open pa_job_exists;
151 fetch pa_job_exists into dummy;
152 if pa_job_exists%found then
153 hr_utility.set_message (275,'PA_JOB_CANT_DELETE');
154 hr_utility.raise_error;
155 end if;
156 close pa_job_exists;
157 --
158 END phase2;
159
160 END pa_job;