1 Package per_ptu_shd as
2 /* $Header: pepturhi.pkh 120.0 2005/05/31 15:58:28 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (
10 person_type_usage_id number(15),
11 person_id number(15),
12 person_type_id number(15),
13 effective_start_date date,
14 effective_end_date date,
15 object_version_number number(9),
16 request_id number(15),
17 program_application_id number(15),
18 program_id number(15),
19 program_update_date date,
20 attribute_category varchar2(30),
21 attribute1 varchar2(150),
22 attribute2 varchar2(150),
23 attribute3 varchar2(150),
24 attribute4 varchar2(150),
25 attribute5 varchar2(150),
26 attribute6 varchar2(150),
27 attribute7 varchar2(150),
28 attribute8 varchar2(150),
29 attribute9 varchar2(150),
30 attribute10 varchar2(150),
31 attribute11 varchar2(150),
32 attribute12 varchar2(150),
33 attribute13 varchar2(150),
34 attribute14 varchar2(150),
35 attribute15 varchar2(150),
36 attribute16 varchar2(150),
37 attribute17 varchar2(150),
38 attribute18 varchar2(150),
39 attribute19 varchar2(150),
40 attribute20 varchar2(150),
41 attribute21 varchar2(150),
42 attribute22 varchar2(150),
43 attribute23 varchar2(150),
44 attribute24 varchar2(150),
45 attribute25 varchar2(150),
46 attribute26 varchar2(150),
47 attribute27 varchar2(150),
48 attribute28 varchar2(150),
49 attribute29 varchar2(150),
50 attribute30 varchar2(150)
51 );
52 --
53 -- ----------------------------------------------------------------------------
54 -- | Global Definitions - Internal Development Use Only |
55 -- ----------------------------------------------------------------------------
56 --
57 g_old_rec g_rec_type; -- Global record definition
58 g_called_from_form boolean := false; -- Global flag set to true by forms
59 -- code calling the RH. If true,
60 -- flexfield validation is not
61 -- performed.
62 --
63 -- ----------------------------------------------------------------------------
64 -- |---------------------------< constraint_error >---------------------------|
65 -- ----------------------------------------------------------------------------
66 -- {Start Of Comments}
67 --
68 -- Description:
69 -- This procedure is called when a constraint has been violated (i.e.
70 -- The exception hr_api.check_integrity_violated,
71 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
72 -- hr_api.unique_integrity_violated has been raised).
73 -- The exceptions can only be raised as follows:
74 -- 1) A check constraint can only be violated during an INSERT or UPDATE
75 -- dml operation.
76 -- 2) A parent integrity constraint can only be violated during an
77 -- INSERT or UPDATE dml operation.
78 -- 3) A child integrity constraint can only be violated during an
79 -- DELETE dml operation.
80 -- 4) A unique integrity constraint can only be violated during INSERT or
81 -- UPDATE dml operation.
82 --
83 -- Prerequisites:
84 -- 1) Either hr_api.check_integrity_violated,
85 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
86 -- hr_api.unique_integrity_violated has been raised with the subsequent
87 -- stripping of the constraint name from the generated error message
88 -- text.
89 -- 2) Standalone validation test which corresponds with a constraint error.
90 --
91 -- In Parameter:
92 -- p_constraint_name is in upper format and is just the constraint name
93 -- (e.g. not prefixed by brackets, schema owner etc).
94 --
95 -- Post Success:
96 -- Development dependant.
97 --
98 -- Post Failure:
99 -- Developement dependant.
100 --
101 -- Developer Implementation Notes:
102 -- For each constraint being checked the hr system package failure message
103 -- has been generated as a template only. These system error messages should
104 -- be modified as required (i.e. change the system failure message to a user
105 -- friendly defined error message).
106 --
107 -- Access Status:
108 -- Internal Development Use Only.
109 --
110 -- {End Of Comments}
111 -- ----------------------------------------------------------------------------
112 Procedure constraint_error
113 (p_constraint_name in all_constraints.constraint_name%TYPE);
114 --
115 -- ----------------------------------------------------------------------------
116 -- |-----------------------------< api_updating >-----------------------------|
117 -- ----------------------------------------------------------------------------
118 -- {Start Of Comments}
119 --
120 -- Description:
121 -- This function is used to populate the g_old_rec record with the current
122 -- row from the database for the specified primary key provided that the
123 -- primary key exists, and is valid, and does not already match the current
124 -- g_old_rec.
125 -- The function will always return a TRUE value if the g_old_rec is
126 -- populated with the current row. A FALSE value will be returned if all of
127 -- the primary key arguments are null.
128 --
129 -- Prerequisites:
130 -- None.
131 --
132 -- In Parameters:
133 --
134 -- Post Success:
135 -- A value of TRUE will be returned indiciating that the g_old_rec is
136 -- current.
137 -- A value of FALSE will be returned if all of the primary key arguments
138 -- have a null value (this indicates that the row has not be inserted into
139 -- the Schema), and therefore could never have a corresponding row.
140 --
141 -- Post Failure:
142 -- A failure can only occur under two circumstances:
143 -- 1) The primary key is invalid (i.e. a row does not exist for the
144 -- specified primary key values).
145 -- 2) If an object_version_number exists but is NOT the same as the current
146 -- g_old_rec value.
147 --
148 -- Developer Implementation Notes:
149 -- None.
150 --
151 -- Access Status:
152 -- Internal Development Use Only.
153 --
154 -- {End Of Comments}
155 -- ----------------------------------------------------------------------------
156 Function api_updating
157 (p_effective_date in date,
158 p_person_type_usage_id in number,
159 p_object_version_number in number
160 ) Return Boolean;
161 --
162 -- ----------------------------------------------------------------------------
163 -- |--------------------------< find_dt_del_modes >---------------------------|
164 -- ----------------------------------------------------------------------------
165 -- {Start Of Comments}
166 --
167 -- Description:
168 -- This procedure is used to determine what datetrack delete modes are
169 -- allowed as of the effective date for this entity. The procedure will
170 -- return a corresponding Boolean value for each of the delete modes
171 -- available where TRUE indicates that the corresponding delete mode is
172 -- available.
173 --
174 -- Prerequisites:
175 -- None.
176 --
177 -- In Parameters:
178 -- p_effective_date
179 -- Specifies the date at which the datetrack modes will be operated on.
180 -- p_base_key_value
181 -- Specifies the primary key value for this datetrack entity.
182 -- (E.g. For this entity the assignment of the argument would be:
183 -- p_base_key_value = :person_type_usage_id).
184 --
185 -- Post Success:
186 -- Processing continues.
187 --
188 -- Post Failure:
189 -- Failure might occur if for the specified effective date and primary key
190 -- value a row doesn't exist.
191 --
192 -- Developer Implementation Notes:
193 -- This procedure could require changes if this entity has any sepcific
194 -- delete restrictions.
195 -- For example, this entity might disallow the datetrack delete mode of
196 -- ZAP. To implement this you would have to set and return a Boolean value
197 -- of FALSE after the call to the dt_api.find_dt_del_modes procedure.
198 --
199 -- Access Status:
200 -- Internal Development Use Only.
201 --
202 -- {End Of Comments}
203 -- ----------------------------------------------------------------------------
204 Procedure find_dt_del_modes
205 (p_effective_date in date,
206 p_base_key_value in number,
207 p_zap out nocopy boolean,
208 p_delete out nocopy boolean,
209 p_future_change out nocopy boolean,
210 p_delete_next_change out nocopy boolean);
211 --
212 -- ----------------------------------------------------------------------------
213 -- |--------------------------< find_dt_upd_modes >---------------------------|
214 -- ----------------------------------------------------------------------------
215 -- {Start Of Comments}
216 --
217 -- Description:
218 -- This procedure is used to determine what datetrack update modes are
219 -- allowed as of the effective date for this entity. The procedure will
220 -- return a corresponding Boolean value for each of the update modes
221 -- available where TRUE indicates that the corresponding update mode
222 -- is available.
223 --
224 -- Prerequisites:
225 -- None.
226 --
227 -- In Parameters:
228 -- p_effective_date
229 -- Specifies the date at which the datetrack modes will be operated on.
230 -- p_base_key_value
231 -- Specifies the primary key value for this datetrack entity.
232 -- (E.g. For this entity the assignment of the argument would be:
233 -- p_base_key_value = :person_type_usage_id).
234 --
235 -- Post Success:
236 -- Processing continues.
237 --
238 -- Post Failure:
239 -- Failure might occur if for the specified effective date and primary key
240 -- value a row doesn't exist.
241 --
242 -- Developer Implementation Notes:
243 -- This procedure could require changes if this entity has any sepcific
244 -- delete restrictions.
245 -- For example, this entity might disallow the datetrack update mode of
246 -- UPDATE. To implement this you would have to set and return a Boolean
247 -- value of FALSE after the call to the dt_api.find_dt_upd_modes procedure.
248 --
249 -- Access Status:
250 -- Internal Development Use Only.
251 --
252 -- {End Of Comments}
253 -- ----------------------------------------------------------------------------
254 Procedure find_dt_upd_modes
255 (p_effective_date in date,
256 p_base_key_value in number,
257 p_correction out nocopy boolean,
258 p_update out nocopy boolean,
259 p_update_override out nocopy boolean,
260 p_update_change_insert out nocopy boolean);
261 --
262 -- ----------------------------------------------------------------------------
263 -- |------------------------< upd_effective_end_date >------------------------|
264 -- ----------------------------------------------------------------------------
265 -- {Start Of Comments}
266 --
267 -- Description:
268 -- This procedure will update the specified datetrack row with the
269 -- specified new effective end date. The object version number is also
270 -- set to the next object version number. DateTrack modes which call
271 -- this procedure are: UPDATE, UPDATE_CHANGE_INSERT,
272 -- UPDATE_OVERRIDE, DELETE, FUTURE_CHANGE and DELETE_NEXT_CHANGE.
273 -- This is an internal datetrack maintenance procedure which should
274 -- not be modified in anyway.
275 --
276 -- Prerequisites:
277 -- None.
278 --
279 -- In Parameters:
280 -- p_new_effective_end_date
281 -- Specifies the new effective end date which will be set for the
282 -- row as of the effective date.
283 -- p_base_key_value
284 -- Specifies the primary key value for this datetrack entity.
285 -- (E.g. For this entity the assignment of the argument would be:
286 -- p_base_key_value = :person_type_usage_id).
287 --
288 -- Post Success:
289 -- The specified row will be updated with the new effective end date and
290 -- object_version_number.
291 --
292 -- Post Failure:
293 -- Failure might occur if for the specified effective date and primary key
294 -- value a row doesn't exist.
295 --
296 -- Developer Implementation Notes:
297 -- This is an internal datetrack maintenance procedure which should
298 -- not be modified in anyway.
299 --
300 -- Access Status:
301 -- Internal Row Handler Use Only.
302 --
303 -- {End Of Comments}
304 -- ----------------------------------------------------------------------------
305 Procedure upd_effective_end_date
306 (p_effective_date in date,
307 p_base_key_value in number,
308 p_new_effective_end_date in date,
309 p_validation_start_date in date,
310 p_validation_end_date in date,
311 p_object_version_number out nocopy number);
312 --
313 -- ----------------------------------------------------------------------------
314 -- |---------------------------------< lck >----------------------------------|
315 -- ----------------------------------------------------------------------------
316 -- {Start Of Comments}
317 --
318 -- Description:
319 -- The Lck process for datetrack is complicated and comprises of the
320 -- following processing
321 -- The processing steps are as follows:
322 -- 1) The row to be updated or deleted must be locked.
323 -- By locking this row, the g_old_rec record data type is populated.
324 -- 2) If a comment exists the text is selected from hr_comments.
325 -- 3) The datetrack mode is then validated to ensure the operation is
326 -- valid. If the mode is valid the validation start and end dates for
327 -- the mode will be derived and returned. Any required locking is
328 -- completed when the datetrack mode is validated.
329 --
330 -- Prerequisites:
331 -- When attempting to call the lck procedure the object version number,
332 -- primary key, effective date and datetrack mode must be specified.
333 --
334 -- In Parameters:
335 -- p_effective_date
336 -- Specifies the date of the datetrack update operation.
337 -- p_datetrack_mode
338 -- Determines the datetrack update or delete mode.
339 --
340 -- Post Success:
341 -- On successful completion of the Lck process the row to be updated or
342 -- deleted will be locked and selected into the global data structure
343 -- g_old_rec.
344 --
345 -- Post Failure:
346 -- The Lck process can fail for three reasons:
347 -- 1) When attempting to lock the row the row could already be locked by
348 -- another user. This will raise the HR_Api.Object_Locked exception.
349 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
350 -- This error is trapped and reported using the message name
351 -- 'HR_7220_INVALID_PRIMARY_KEY'.
352 -- 3) The row although existing in the HR Schema has a different object
353 -- version number than the object version number specified.
354 -- This error is trapped and reported using the message name
355 -- 'HR_7155_OBJECT_INVALID'.
356 --
357 -- Developer Implementation Notes:
358 -- None.
359 --
360 -- Access Status:
361 -- Internal Development Use Only.
365 Procedure lck
362 --
363 -- {End Of Comments}
364 -- ----------------------------------------------------------------------------
366 (p_effective_date in date,
367 p_datetrack_mode in varchar2,
368 p_person_type_usage_id in number,
369 p_object_version_number in number,
370 p_validation_start_date out nocopy date,
371 p_validation_end_date out nocopy date);
372 --
373 -- ----------------------------------------------------------------------------
374 -- |-----------------------------< convert_args >-----------------------------|
375 -- ----------------------------------------------------------------------------
376 -- {Start Of Comments}
377 --
378 -- Description:
379 -- This function is used to turn attribute parameters into the record
380 -- structure parameter g_rec_type.
381 --
382 -- Prerequisites:
383 -- This is a private function and can only be called from the ins or upd
384 -- attribute processes.
385 --
386 -- In Parameters:
387 --
388 -- Post Success:
389 -- A returning record structure will be returned.
390 --
391 -- Post Failure:
392 -- No direct error handling is required within this function. Any possible
393 -- errors within this function will be a PL/SQL value error due to conversion
394 -- of datatypes or data lengths.
395 --
396 -- Developer Implementation Notes:
397 -- None.
398 --
399 -- Access Status:
400 -- Internal Row Handler Use Only.
401 --
402 -- {End Of Comments}
403 -- ----------------------------------------------------------------------------
404 Function convert_args
405 (
406 p_person_type_usage_id in number,
407 p_person_id in number,
408 p_person_type_id in number,
409 p_effective_start_date in date,
410 p_effective_end_date in date,
411 p_object_version_number in number,
412 p_request_id in number,
413 p_program_application_id in number,
414 p_program_id in number,
415 p_program_update_date in date,
416 p_attribute_category in varchar2,
417 p_attribute1 in varchar2,
418 p_attribute2 in varchar2,
419 p_attribute3 in varchar2,
420 p_attribute4 in varchar2,
421 p_attribute5 in varchar2,
422 p_attribute6 in varchar2,
423 p_attribute7 in varchar2,
424 p_attribute8 in varchar2,
425 p_attribute9 in varchar2,
426 p_attribute10 in varchar2,
427 p_attribute11 in varchar2,
428 p_attribute12 in varchar2,
429 p_attribute13 in varchar2,
430 p_attribute14 in varchar2,
431 p_attribute15 in varchar2,
432 p_attribute16 in varchar2,
433 p_attribute17 in varchar2,
434 p_attribute18 in varchar2,
435 p_attribute19 in varchar2,
436 p_attribute20 in varchar2,
437 p_attribute21 in varchar2,
438 p_attribute22 in varchar2,
439 p_attribute23 in varchar2,
440 p_attribute24 in varchar2,
441 p_attribute25 in varchar2,
442 p_attribute26 in varchar2,
443 p_attribute27 in varchar2,
444 p_attribute28 in varchar2,
445 p_attribute29 in varchar2,
446 p_attribute30 in varchar2
447 )
448 Return g_rec_type;
449 --
450 --
451 -- ----------------------------------------------------------------------------
452 -- |-------------------------< set_called_from_form >-------------------------|
453 -- ----------------------------------------------------------------------------
454 -- {Start Of Comments}
455 --
456 -- Description:
457 -- This procedure is used to set the global g_called_from_form which controls
458 -- the execution of the df data validation. When set the df validation is
459 -- bypassed.
460 --
461 -- Pre Conditions:
462 -- This is a public function
463 --
464 -- In Parameters:
465 --
466 -- Post Success:
467 -- The global variable is set.
468 --
469 -- Post Failure:
470 -- No failure condition exists.
471 --
472 -- Developer Implementation Notes:
473 -- None.
474 --
475 -- Access Status:
476 -- Internal Development Use Only.
477 --
478 -- {End Of Comments}
479 -- ----------------------------------------------------------------------------
480 Procedure set_called_from_form
481 ( p_flag in boolean );
482 --
483 end per_ptu_shd;