1 Package Body pe_pei_del as
2 /* $Header: pepeirhi.pkb 120.1 2005/07/25 05:01:42 jpthomas noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pe_pei_del.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< delete_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 -- This procedure controls the actual dml delete logic. The functions of
17 -- this procedure are as follows:
18 -- 1) To set and unset the g_api_dml status as required (as we are about to
19 -- perform dml).
20 -- (Note: Sue 1/29/97 Removed the need for setting g_api_dml as this is a new
21 -- table and therefore there is no ovn trigger to use it).
22 -- 2) To delete the specified row from the schema using the primary key in
23 -- the predicates.
24 -- 3) To trap any constraint violations that may have occurred.
25 -- 4) To raise any other errors.
26 --
27 -- Pre Conditions:
28 -- This is an internal private procedure which must be called from the del
29 -- procedure.
30 --
31 -- In Parameters:
32 -- A Pl/Sql record structre.
33 --
34 -- Post Success:
35 -- The specified row will be delete from the schema.
36 --
37 -- Post Failure:
38 -- On the delete dml failure it is important to note that we always reset the
39 -- g_api_dml status to false.
40 -- If a child integrity constraint violation is raised the
41 -- constraint_error procedure will be called.
42 -- If any other error is reported, the error will be raised after the
43 -- g_api_dml status is reset.
44 -- (Note: Sue 1/29/97 Removed the need for setting g_api_dml as this is a new
45 -- table and therefore there is no ovn trigger to use it).
46 --
47 -- Developer Implementation Notes:
48 -- None.
49 --
50 -- Access Status:
51 -- Internal Table Handler Use Only.
52 --
53 -- {End Of Comments}
54 -- ----------------------------------------------------------------------------
55 Procedure delete_dml(p_rec in pe_pei_shd.g_rec_type) is
56 --
57 l_proc varchar2(72) := g_package||'delete_dml';
58 --
59 Begin
60 hr_utility.set_location('Entering:'||l_proc, 5);
61 --
62 -- Delete the per_people_extra_info row.
63 --
64 delete from per_people_extra_info
65 where person_extra_info_id = p_rec.person_extra_info_id;
66 --
67 hr_utility.set_location(' Leaving:'||l_proc, 10);
68 --
69 Exception
70 When hr_api.child_integrity_violated then
71 -- Child integrity has been violated
72 pe_pei_shd.constraint_error
73 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
74 When Others Then
75 Raise;
76 End delete_dml;
77 --
78 -- ----------------------------------------------------------------------------
79 -- |------------------------------< pre_delete >------------------------------|
80 -- ----------------------------------------------------------------------------
81 -- {Start Of Comments}
82 --
83 -- Description:
84 -- This private procedure contains any processing which is required before
85 -- the delete dml.
86 --
87 -- Pre Conditions:
88 -- This is an internal procedure which is called from the del procedure.
89 --
90 -- In Parameters:
91 -- A Pl/Sql record structre.
92 --
93 -- Post Success:
94 -- Processing continues.
95 --
96 -- Post Failure:
97 -- If an error has occurred, an error message and exception will be raised
98 -- but not handled.
99 --
100 -- Developer Implementation Notes:
101 -- Any pre-processing required before the delete dml is issued should be
102 -- coded within this procedure. It is important to note that any 3rd party
103 -- maintenance should be reviewed before placing in this procedure.
104 --
105 -- Access Status:
106 -- Internal Table Handler Use Only.
107 --
108 -- {End Of Comments}
109 -- ----------------------------------------------------------------------------
110 Procedure pre_delete(p_rec in pe_pei_shd.g_rec_type) is
111 --
112 l_proc varchar2(72) := g_package||'pre_delete';
113 --
114 Begin
115 hr_utility.set_location('Entering:'||l_proc, 5);
116 --
117 hr_utility.set_location(' Leaving:'||l_proc, 10);
118 End pre_delete;
119 --
120 -- ----------------------------------------------------------------------------
121 -- |-----------------------------< post_delete >------------------------------|
122 -- ----------------------------------------------------------------------------
126 -- This private procedure contains any processing which is required after the
123 -- {Start Of Comments}
124 --
125 -- Description:
127 -- delete dml.
128 --
129 -- Pre Conditions:
130 -- This is an internal procedure which is called from the del procedure.
131 --
132 -- In Parameters:
133 -- A Pl/Sql record structre.
134 --
135 -- Post Success:
136 -- Processing continues.
137 --
138 -- Post Failure:
139 -- If an error has occurred, an error message and exception will be raised
140 -- but not handled.
141 --
142 -- Developer Implementation Notes:
143 -- Any post-processing required after the delete dml is issued should be
144 -- coded within this procedure. It is important to note that any 3rd party
145 -- maintenance should be reviewed before placing in this procedure.
146 --
147 -- Access Status:
148 -- Internal table Handler Use Only.
149 --
150 -- {End Of Comments}
151 -- ----------------------------------------------------------------------------
152 Procedure post_delete(p_rec in pe_pei_shd.g_rec_type) is
153 --
154 l_proc varchar2(72) := g_package||'post_delete';
155 --
156 Begin
157 hr_utility.set_location('Entering:'||l_proc, 5);
158 --
159 -- This is a hook point and the user hook for post_delete is called here.
160 --
161 begin
162 pe_pei_rkd.after_delete (
163 p_person_extra_info_id_o => pe_pei_shd.g_old_rec.person_extra_info_id ,
164 p_person_id_o => pe_pei_shd.g_old_rec.person_id ,
165 p_information_type_o => pe_pei_shd.g_old_rec.information_type ,
166 p_request_id_o => pe_pei_shd.g_old_rec.request_id ,
167 p_program_application_id_o => pe_pei_shd.g_old_rec.program_application_id ,
168 p_program_id_o => pe_pei_shd.g_old_rec.program_id ,
169 p_program_update_date_o => pe_pei_shd.g_old_rec.program_update_date ,
170 p_pei_attribute_category_o => pe_pei_shd.g_old_rec.pei_attribute_category ,
171 p_pei_attribute1_o => pe_pei_shd.g_old_rec.pei_attribute1 ,
172 p_pei_attribute2_o => pe_pei_shd.g_old_rec.pei_attribute2 ,
173 p_pei_attribute3_o => pe_pei_shd.g_old_rec.pei_attribute3 ,
174 p_pei_attribute4_o => pe_pei_shd.g_old_rec.pei_attribute4 ,
175 p_pei_attribute5_o => pe_pei_shd.g_old_rec.pei_attribute5 ,
176 p_pei_attribute6_o => pe_pei_shd.g_old_rec.pei_attribute6 ,
177 p_pei_attribute7_o => pe_pei_shd.g_old_rec.pei_attribute7 ,
178 p_pei_attribute8_o => pe_pei_shd.g_old_rec.pei_attribute8 ,
179 p_pei_attribute9_o => pe_pei_shd.g_old_rec.pei_attribute9 ,
180 p_pei_attribute10_o => pe_pei_shd.g_old_rec.pei_attribute10 ,
181 p_pei_attribute11_o => pe_pei_shd.g_old_rec.pei_attribute11 ,
182 p_pei_attribute12_o => pe_pei_shd.g_old_rec.pei_attribute12 ,
183 p_pei_attribute13_o => pe_pei_shd.g_old_rec.pei_attribute13 ,
184 p_pei_attribute14_o => pe_pei_shd.g_old_rec.pei_attribute14 ,
185 p_pei_attribute15_o => pe_pei_shd.g_old_rec.pei_attribute15 ,
186 p_pei_attribute16_o => pe_pei_shd.g_old_rec.pei_attribute16 ,
187 p_pei_attribute17_o => pe_pei_shd.g_old_rec.pei_attribute17 ,
188 p_pei_attribute18_o => pe_pei_shd.g_old_rec.pei_attribute18 ,
189 p_pei_attribute19_o => pe_pei_shd.g_old_rec.pei_attribute19 ,
190 p_pei_attribute20_o => pe_pei_shd.g_old_rec.pei_attribute20 ,
191 p_pei_information_category_o => pe_pei_shd.g_old_rec.pei_information_category ,
192 p_pei_information1_o => pe_pei_shd.g_old_rec.pei_information1 ,
193 p_pei_information2_o => pe_pei_shd.g_old_rec.pei_information2 ,
194 p_pei_information3_o => pe_pei_shd.g_old_rec.pei_information3 ,
195 p_pei_information4_o => pe_pei_shd.g_old_rec.pei_information4 ,
196 p_pei_information5_o => pe_pei_shd.g_old_rec.pei_information5 ,
197 p_pei_information6_o => pe_pei_shd.g_old_rec.pei_information6 ,
198 p_pei_information7_o => pe_pei_shd.g_old_rec.pei_information7 ,
199 p_pei_information8_o => pe_pei_shd.g_old_rec.pei_information8 ,
200 p_pei_information9_o => pe_pei_shd.g_old_rec.pei_information9 ,
201 p_pei_information10_o => pe_pei_shd.g_old_rec.pei_information10 ,
202 p_pei_information11_o => pe_pei_shd.g_old_rec.pei_information11 ,
203 p_pei_information12_o => pe_pei_shd.g_old_rec.pei_information12 ,
204 p_pei_information13_o => pe_pei_shd.g_old_rec.pei_information13 ,
205 p_pei_information14_o => pe_pei_shd.g_old_rec.pei_information14 ,
206 p_pei_information15_o => pe_pei_shd.g_old_rec.pei_information15 ,
207 p_pei_information16_o => pe_pei_shd.g_old_rec.pei_information16 ,
208 p_pei_information17_o => pe_pei_shd.g_old_rec.pei_information17 ,
209 p_pei_information18_o => pe_pei_shd.g_old_rec.pei_information18 ,
210 p_pei_information19_o => pe_pei_shd.g_old_rec.pei_information19 ,
211 p_pei_information20_o => pe_pei_shd.g_old_rec.pei_information20 ,
212 p_pei_information21_o => pe_pei_shd.g_old_rec.pei_information21 ,
213 p_pei_information22_o => pe_pei_shd.g_old_rec.pei_information22 ,
214 p_pei_information23_o => pe_pei_shd.g_old_rec.pei_information23 ,
215 p_pei_information24_o => pe_pei_shd.g_old_rec.pei_information24 ,
216 p_pei_information25_o => pe_pei_shd.g_old_rec.pei_information25 ,
217 p_pei_information26_o => pe_pei_shd.g_old_rec.pei_information26 ,
218 p_pei_information27_o => pe_pei_shd.g_old_rec.pei_information27 ,
219 p_pei_information28_o => pe_pei_shd.g_old_rec.pei_information28 ,
220 p_pei_information29_o => pe_pei_shd.g_old_rec.pei_information29 ,
221 p_pei_information30_o => pe_pei_shd.g_old_rec.pei_information30
222 );
223 exception
224 when hr_api.cannot_find_prog_unit then
225 hr_api.cannot_find_prog_unit_error
226 ( p_module_name => 'PER_PEOPLE_EXTRA_INFO'
227 ,p_hook_type => 'AD'
228 );
229 end;
230 -- End of API User Hook for post_delete.
231 --
232 if pe_pei_shd.g_old_rec.information_type = 'PQH_ROLE_USERS'then
233 declare
234 l_user_name varchar2(50);
235 l_start_date date;
236 l_expiration_date date;
237 cursor c1 is
238 select usr.user_name, usr.start_date, usr.start_date
239 from fnd_user usr
240 where usr.employee_id = pe_pei_shd.g_old_rec.person_id;
241 begin
242 open c1;
243 fetch c1 into l_user_name, l_start_date, l_expiration_date;
244 if c1%found then
245 close c1;
246 WF_LOCAL_SYNCH.propagate_user_role(p_user_orig_system => 'PER',
247 p_user_orig_system_id => pe_pei_shd.g_old_rec.person_id,
248 p_role_orig_system => 'PQH_ROLE',
249 p_role_orig_system_id => pe_pei_shd.g_old_rec.pei_information3,
250 p_start_date => l_start_date,
251 p_expiration_date => l_expiration_date);
252 else
253 close c1;
254 end if;
255 end;
256 end if;
257 hr_utility.set_location(' Leaving:'||l_proc, 10);
258 End post_delete;
259 --
260 -- ----------------------------------------------------------------------------
261 -- |---------------------------------< del >----------------------------------|
262 -- ----------------------------------------------------------------------------
263 Procedure del
264 (
265 p_rec in pe_pei_shd.g_rec_type,
266 p_validate in boolean default false
267 ) is
268 --
269 l_proc varchar2(72) := g_package||'del';
270 --
271 Begin
272 hr_utility.set_location('Entering:'||l_proc, 5);
273 --
274 -- Determine if the business process is to be validated.
275 --
276 If p_validate then
277 --
278 -- Issue the savepoint.
279 --
280 SAVEPOINT del_pe_pei;
281 End If;
282 --
283 -- We must lock the row which we need to delete.
284 --
285 pe_pei_shd.lck
286 (
287 p_rec.person_extra_info_id,
288 p_rec.object_version_number
289 );
290 --
291 -- Call the supporting delete validate operation
292 --
293 pe_pei_bus.delete_validate(p_rec);
294 --
295 -- Call the supporting pre-delete operation
296 --
297 pre_delete(p_rec);
298 --
299 -- Delete the row.
300 --
301 delete_dml(p_rec);
302 --
303 -- Call the supporting post-delete operation
304 --
305 post_delete(p_rec);
306 --
307 -- If we are validating then raise the Validate_Enabled exception
308 --
309 If p_validate then
310 Raise HR_Api.Validate_Enabled;
311 End If;
312 --
313 hr_utility.set_location(' Leaving:'||l_proc, 10);
314 Exception
315 When HR_Api.Validate_Enabled Then
316 --
317 -- As the Validate_Enabled exception has been raised
318 -- we must rollback to the savepoint
319 --
320 ROLLBACK TO del_pe_pei;
321 End del;
322 --
323 -- ----------------------------------------------------------------------------
324 -- |---------------------------------< del >----------------------------------|
325 -- ----------------------------------------------------------------------------
326 Procedure del
327 (
328 p_person_extra_info_id in number,
329 p_object_version_number in number,
330 p_validate in boolean default false
331 ) is
332 --
333 l_rec pe_pei_shd.g_rec_type;
334 l_proc varchar2(72) := g_package||'del';
335 --
336 Begin
337 hr_utility.set_location('Entering:'||l_proc, 5);
338 --
339 -- As the delete procedure accepts a plsql record structure we do need to
340 -- convert the arguments into the record structure.
341 -- We don't need to call the supplied conversion argument routine as we
342 -- only need a few attributes.
343 --
344 l_rec.person_extra_info_id:= p_person_extra_info_id;
345 l_rec.object_version_number := p_object_version_number;
346 --
347 -- Having converted the arguments into the pe_pei_rec
348 -- plsql record structure we must call the corresponding entity
349 -- business process
350 --
351 del(l_rec, p_validate);
352 --
353 hr_utility.set_location(' Leaving:'||l_proc, 10);
354 End del;
355 --
356 end pe_pei_del;