1 Package pay_ele_shd as
2 /* $Header: pyelerhi.pkh 120.0 2005/05/29 04:33:12 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (element_entry_id number(15)
10 ,effective_start_date date
11 ,effective_end_date date
12 ,cost_allocation_keyflex_id number(9)
13 ,assignment_id number(10)
14 ,updating_action_id number(15)
15 ,updating_action_type varchar2(30)
16 ,element_link_id number(9)
17 ,original_entry_id number(15)
18 ,creator_type varchar2(30)
19 ,entry_type varchar2(30)
20 ,comment_id number(15)
21 ,comments varchar2(2000) -- pseudo column
22 ,creator_id number(15)
23 ,reason varchar2(30)
24 ,target_entry_id number(15)
25 ,attribute_category varchar2(30)
26 ,attribute1 varchar2(150)
27 ,attribute2 varchar2(150)
28 ,attribute3 varchar2(150)
29 ,attribute4 varchar2(150)
30 ,attribute5 varchar2(150)
31 ,attribute6 varchar2(150)
32 ,attribute7 varchar2(150)
33 ,attribute8 varchar2(150)
34 ,attribute9 varchar2(150)
35 ,attribute10 varchar2(150)
36 ,attribute11 varchar2(150)
37 ,attribute12 varchar2(150)
38 ,attribute13 varchar2(150)
39 ,attribute14 varchar2(150)
40 ,attribute15 varchar2(150)
41 ,attribute16 varchar2(150)
42 ,attribute17 varchar2(150)
43 ,attribute18 varchar2(150)
44 ,attribute19 varchar2(150)
45 ,attribute20 varchar2(150)
46 ,entry_information_category varchar2(30)
47 ,entry_information1 varchar2(150)
48 ,entry_information2 varchar2(150)
49 ,entry_information3 varchar2(150)
50 ,entry_information4 varchar2(150)
51 ,entry_information5 varchar2(150)
52 ,entry_information6 varchar2(150)
53 ,entry_information7 varchar2(150)
54 ,entry_information8 varchar2(150)
55 ,entry_information9 varchar2(150)
56 ,entry_information10 varchar2(150)
57 ,entry_information11 varchar2(150)
58 ,entry_information12 varchar2(150)
59 ,entry_information13 varchar2(150)
60 ,entry_information14 varchar2(150)
61 ,entry_information15 varchar2(150)
62 ,entry_information16 varchar2(150)
63 ,entry_information17 varchar2(150)
64 ,entry_information18 varchar2(150)
65 ,entry_information19 varchar2(150)
66 ,entry_information20 varchar2(150)
67 ,entry_information21 varchar2(150)
68 ,entry_information22 varchar2(150)
69 ,entry_information23 varchar2(150)
70 ,entry_information24 varchar2(150)
71 ,entry_information25 varchar2(150)
72 ,entry_information26 varchar2(150)
73 ,entry_information27 varchar2(150)
74 ,entry_information28 varchar2(150)
75 ,entry_information29 varchar2(150)
76 ,entry_information30 varchar2(150)
77 ,subpriority number(9) -- Increased length
78 ,personal_payment_method_id number(9)
79 ,date_earned date
80 ,object_version_number number(9)
81 ,source_id number(15)
82 ,balance_adj_cost_flag varchar2(9) -- Increased length
83 ,element_type_id number(9)
84 ,all_entry_values_null varchar2(30)
85 );
86
87
88 -- Used when mimicing an element entry value hook package
89 -- eg get cache of old values in to a local table structure
90 Type g_val_rec_type Is Record
91 (element_entry_value_id number(15)
92 ,effective_start_date date
93 ,effective_end_date date
94 ,input_value_id number(9)
95 ,element_entry_id number(15)
96 ,screen_entry_value varchar2(60)
97 );
98
99 Type g_old_val_tab_type is Table of g_val_rec_type index by binary_integer;
100
101
102 -- Cont Calc Changes
103 cursor csr_get_eevals(cp_element_entry_id number,
104 cp_eff_date date) is
105 select
106 element_entry_value_id
107 ,effective_start_date
108 ,effective_end_date
109 ,input_value_id
110 ,element_entry_id
111 ,screen_entry_value
112 from pay_element_entry_values_f
113 where element_entry_id = cp_element_entry_id
114 and cp_eff_date between effective_start_date and effective_end_date
115 order by element_entry_value_id;
116
117 --
118 -- ----------------------------------------------------------------------------
119 -- | Global Definitions - Internal Development Use Only |
120 -- ----------------------------------------------------------------------------
121 --
122 g_old_rec g_rec_type; -- Global record definition
123 g_api_dml boolean; -- Global api dml status
124
125 --
126 -- ----------------------------------------------------------------------------
127 -- |------------------------< return_api_dml_status >-------------------------|
128 -- ----------------------------------------------------------------------------
129 -- {Start Of Comments}
130 --
131 -- Description:
132 -- This function will return the current g_api_dml private global
133 -- boolean status.
134 -- The g_api_dml status determines if at the time of the function
135 -- being executed if a dml statement (i.e. INSERT, UPDATE or DELETE)
136 -- is being issued from within an api.
137 -- If the status is TRUE then a dml statement is being issued from
138 -- within this entity api.
139 -- This function is primarily to support database triggers which
140 -- need to maintain the object_version_number for non-supported
141 -- dml statements (i.e. dml statement issued outside of the api layer).
142 --
143 -- Prerequisites:
144 -- None.
145 --
146 -- In Parameters:
147 -- None.
148 --
149 -- Post Success:
150 -- Processing continues.
151 -- If the function returns a TRUE value then, dml is being executed from
152 -- within this api.
153 --
154 -- Post Failure:
155 -- None.
156 --
157 -- Access Status:
158 -- Internal Row Handler Use Only.
159 --
160 -- {End Of Comments}
161 -- ----------------------------------------------------------------------------
162 Function return_api_dml_status Return Boolean;
163 --
164 -- ----------------------------------------------------------------------------
165 -- |---------------------------< constraint_error >---------------------------|
166 -- ----------------------------------------------------------------------------
167 -- {Start Of Comments}
168 --
169 -- Description:
170 -- This procedure is called when a constraint has been violated (i.e.
171 -- The exception hr_api.check_integrity_violated,
172 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
173 -- hr_api.unique_integrity_violated has been raised).
174 -- The exceptions can only be raised as follows:
175 -- 1) A check constraint can only be violated during an INSERT or UPDATE
176 -- dml operation.
177 -- 2) A parent integrity constraint can only be violated during an
178 -- INSERT or UPDATE dml operation.
179 -- 3) A child integrity constraint can only be violated during an
180 -- DELETE dml operation.
181 -- 4) A unique integrity constraint can only be violated during INSERT or
182 -- UPDATE dml operation.
183 --
184 -- Prerequisites:
185 -- 1) Either hr_api.check_integrity_violated,
186 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
187 -- hr_api.unique_integrity_violated has been raised with the subsequent
188 -- stripping of the constraint name from the generated error message
189 -- text.
190 -- 2) Standalone validation test which corresponds with a constraint error.
191 --
192 -- In Parameter:
193 -- p_constraint_name is in upper format and is just the constraint name
194 -- (e.g. not prefixed by brackets, schema owner etc).
195 --
196 -- Post Success:
197 -- Development dependant.
198 --
199 -- Post Failure:
200 -- Developement dependant.
201 --
202 -- Developer Implementation Notes:
203 -- For each constraint being checked the hr system package failure message
204 -- has been generated as a template only. These system error messages should
205 -- be modified as required (i.e. change the system failure message to a user
206 -- friendly defined error message).
207 --
208 -- Access Status:
209 -- Internal Development Use Only.
210 --
211 -- {End Of Comments}
212 -- ----------------------------------------------------------------------------
213 Procedure constraint_error
214 (p_constraint_name in all_constraints.constraint_name%TYPE);
215 --
216 -- ----------------------------------------------------------------------------
217 -- |-----------------------------< api_updating >-----------------------------|
218 -- ----------------------------------------------------------------------------
219 -- {Start Of Comments}
220 --
221 -- Description:
222 -- This function is used to populate the g_old_rec record with the
223 -- current row from the database for the specified primary key
224 -- provided that the primary key exists and is valid and does not
225 -- already match the current g_old_rec. The function will always return
226 -- a TRUE value if the g_old_rec is populated with the current row.
227 -- A FALSE value will be returned if all of the primary key arguments
228 -- are null.
229 --
230 -- Prerequisites:
231 -- None.
232 --
233 -- In Parameters:
234 --
235 -- Post Success:
236 -- A value of TRUE will be returned indiciating that the g_old_rec
237 -- is current.
238 -- A value of FALSE will be returned if all of the primary key arguments
239 -- have a null value (this indicates that the row has not be inserted into
240 -- the Schema), and therefore could never have a corresponding row.
241 --
242 -- Post Failure:
243 -- A failure can only occur under two circumstances:
244 -- 1) The primary key is invalid (i.e. a row does not exist for the
245 -- specified primary key values).
246 -- 2) If an object_version_number exists but is NOT the same as the current
247 -- g_old_rec value.
248 --
249 -- Developer Implementation Notes:
250 -- None.
251 --
252 -- Access Status:
253 -- Internal Development Use Only.
254 --
255 -- {End Of Comments}
256 -- ----------------------------------------------------------------------------
257 Function api_updating
258 (p_effective_date in date
259 ,p_element_entry_id in number
260 ,p_object_version_number in number
261 ) Return Boolean;
262 --
263 -- ----------------------------------------------------------------------------
264 -- |---------------------------< find_dt_upd_modes >--------------------------|
265 -- ----------------------------------------------------------------------------
266 -- {Start Of Comments}
267 --
268 -- Description:
269 -- This procedure is used to determine what datetrack update modes are
270 -- allowed as of the effective date for this entity. The procedure will
271 -- return a corresponding Boolean value for each of the update modes
272 -- available where TRUE indicates that the corresponding update mode
273 -- is available.
274 --
275 -- Prerequisites:
276 -- None.
277 --
278 -- In Parameters:
279 -- p_effective_date
280 -- Specifies the date at which the datetrack modes will be operated on.
281 -- p_base_key_value
282 -- Specifies the primary key value for this datetrack entity.
283 -- (E.g. For this entity the assignment of the argument would be:
284 -- p_base_key_value = :element_entry_id).
285 --
286 -- Post Success:
287 -- Processing continues.
288 --
289 -- Post Failure:
290 -- Failure might occur if for the specified effective date and primary key
291 -- value a row doesn't exist.
292 --
293 -- Developer Implementation Notes:
294 -- This procedure could require changes if this entity has any sepcific
295 -- delete restrictions.
296 -- For example, this entity might disallow the datetrack update mode of
297 -- UPDATE. To implement this you would have to set and return a Boolean
298 -- value of FALSE after the call to the dt_api.find_dt_upd_modes procedure.
299 --
300 -- Access Status:
301 -- Internal Development Use Only.
302 --
303 -- {End Of Comments}
304 -- ----------------------------------------------------------------------------
305 Procedure find_dt_upd_modes
306 (p_effective_date in date
307 ,p_base_key_value in number
308 ,p_correction out nocopy boolean
309 ,p_update out nocopy boolean
310 ,p_update_override out nocopy boolean
311 ,p_update_change_insert out nocopy boolean
312 );
313 --
314 -- ----------------------------------------------------------------------------
315 -- |---------------------------< find_dt_del_modes >--------------------------|
316 -- ----------------------------------------------------------------------------
317 -- {Start Of Comments}
318 --
319 -- Description:
320 -- This procedure is used to determine what datetrack delete modes are
321 -- allowed as of the effective date for this entity. The procedure will
322 -- return a corresponding Boolean value for each of the delete modes
323 -- available where TRUE indicates that the corresponding delete mode is
324 -- available.
325 --
326 -- Prerequisites:
327 -- None.
328 --
329 -- In Parameters:
330 -- p_effective_date
331 -- Specifies the date at which the datetrack modes will be operated on.
332 -- p_base_key_value
333 -- Specifies the primary key value for this datetrack entity.
334 -- (E.g. For this entity the assignment of the argument would be:
335 -- p_base_key_value = :element_entry_id).
336 --
337 -- Post Success:
338 -- Processing continues.
339 --
340 -- Post Failure:
341 -- Failure might occur if for the specified effective date and primary key
342 -- value a row doesn't exist.
343 --
344 -- Developer Implementation Notes:
345 -- This procedure could require changes if this entity has any sepcific
346 -- delete restrictions.
347 -- For example, this entity might disallow the datetrack delete mode of
348 -- ZAP. To implement this you would have to set and return a Boolean value
349 -- of FALSE after the call to the dt_api.find_dt_del_modes procedure.
353 --
350 --
351 -- Access Status:
352 -- Internal Development Use Only.
354 -- {End Of Comments}
355 -- ----------------------------------------------------------------------------
356 Procedure find_dt_del_modes
357 (p_effective_date in date
358 ,p_base_key_value in number
359 ,p_zap out nocopy boolean
360 ,p_delete out nocopy boolean
361 ,p_future_change out nocopy boolean
362 ,p_delete_next_change out nocopy boolean
363 );
364 --
365 -- ----------------------------------------------------------------------------
366 -- |-----------------------< upd_effective_end_date >-------------------------|
367 -- ----------------------------------------------------------------------------
368 -- {Start Of Comments}
369 --
370 -- Description:
371 -- This procedure will update the specified datetrack row with the
372 -- specified new effective end date. The object version number is also
373 -- set to the next object version number. DateTrack modes which call
374 -- this procedure are: UPDATE, UPDATE_CHANGE_INSERT,
375 -- UPDATE_OVERRIDE, DELETE, FUTURE_CHANGE and DELETE_NEXT_CHANGE.
376 -- This is an internal datetrack maintenance procedure which should
377 -- not be modified in anyway.
378 --
379 -- Prerequisites:
380 -- None.
381 --
382 -- In Parameters:
383 -- p_new_effective_end_date
384 -- Specifies the new effective end date which will be set for the
385 -- row as of the effective date.
386 -- p_base_key_value
387 -- Specifies the primary key value for this datetrack entity.
388 -- (E.g. For this entity the assignment of the argument would be:
389 -- p_base_key_value = :element_entry_id).
390 --
391 -- Post Success:
392 -- The specified row will be updated with the new effective end date and
393 -- object_version_number.
394 --
395 -- Post Failure:
396 -- Failure might occur if for the specified effective date and primary key
397 -- value a row doesn't exist.
398 --
399 -- Developer Implementation Notes:
400 -- This is an internal datetrack maintenance procedure which should
401 -- not be modified in anyway.
402 --
403 -- Access Status:
404 -- Internal Row Handler Use Only.
405 --
406 -- {End Of Comments}
407 -- ----------------------------------------------------------------------------
408 Procedure upd_effective_end_date
409 (p_effective_date in date
410 ,p_base_key_value in number
411 ,p_new_effective_end_date in date
412 ,p_validation_start_date in date
413 ,p_validation_end_date in date
414 ,p_object_version_number out nocopy number
415 );
416 --
417 -- ----------------------------------------------------------------------------
418 -- |---------------------------------< lck >----------------------------------|
419 -- ----------------------------------------------------------------------------
420 -- {Start Of Comments}
421 --
422 -- Description:
423 -- The Lck process for datetrack is complicated and comprises of the
424 -- following processing
425 -- The processing steps are as follows:
426 -- 1) The row to be updated or deleted must be locked.
427 -- By locking this row, the g_old_rec record data type is populated.
428 -- 2) If a comment exists the text is selected from hr_comments.
429 -- 3) The datetrack mode is then validated to ensure the operation is
430 -- valid. If the mode is valid the validation start and end dates for
431 -- the mode will be derived and returned. Any required locking is
432 -- completed when the datetrack mode is validated.
433 --
434 -- Prerequisites:
435 -- When attempting to call the lck procedure the object version number,
436 -- primary key, effective date and datetrack mode must be specified.
437 --
438 -- In Parameters:
442 -- Determines the datetrack update or delete mode.
439 -- p_effective_date
440 -- Specifies the date of the datetrack update operation.
441 -- p_datetrack_mode
443 --
444 -- Post Success:
445 -- On successful completion of the Lck process the row to be updated or
446 -- deleted will be locked and selected into the global data structure
447 -- g_old_rec.
448 --
449 -- Post Failure:
450 -- The Lck process can fail for three reasons:
451 -- 1) When attempting to lock the row the row could already be locked by
452 -- another user. This will raise the HR_Api.Object_Locked exception.
453 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
454 -- This error is trapped and reported using the message name
455 -- 'HR_7220_INVALID_PRIMARY_KEY'.
456 -- 3) The row although existing in the HR Schema has a different object
457 -- version number than the object version number specified.
458 -- This error is trapped and reported using the message name
459 -- 'HR_7155_OBJECT_INVALID'.
460 --
461 -- Developer Implementation Notes:
462 -- None.
463 --
464 -- Access Status:
465 -- Internal Development Use Only.
466 --
467 -- {End Of Comments}
468 -- ----------------------------------------------------------------------------
469 Procedure lck
470 (p_effective_date in date
471 ,p_datetrack_mode in varchar2
472 ,p_element_entry_id in number
473 ,p_object_version_number in number
474 ,p_validation_start_date out nocopy date
475 ,p_validation_end_date out nocopy date
476 );
477 --
478 Function convert_lookups
479 (
480 p_input_value_id in number,
481 p_entry_value in varchar2,
482 p_effective_date in date default null
483 ) return VARCHAR2;
484 --
485 -- ----------------------------------------------------------------------------
486 -- |-----------------------------< convert_args >-----------------------------|
487 -- ----------------------------------------------------------------------------
488 -- {Start Of Comments}
489 --
490 -- Description:
491 -- This function is used to turn attribute parameters into the record
492 -- structure parameter g_rec_type.
493 --
494 -- Prerequisites:
495 -- This is a private function and can only be called from the ins or upd
496 -- attribute processes.
497 --
498 -- In Parameters:
499 --
500 -- Post Success:
501 -- A returning record structure will be returned.
502 --
503 -- Post Failure:
504 -- No direct error handling is required within this function. Any possible
505 -- errors within this function will be a PL/SQL value error due to conversion
506 -- of datatypes or data lengths.
507 --
508 -- Developer Implementation Notes:
509 -- None.
510 --
511 -- Access Status:
512 -- Internal Row Handler Use Only.
513 --
514 -- {End Of Comments}
515 -- ----------------------------------------------------------------------------
516 Function convert_args
517 (p_element_entry_id in number
518 ,p_effective_start_date in date
519 ,p_effective_end_date in date
520 ,p_cost_allocation_keyflex_id in number
521 ,p_assignment_id in number
522 ,p_updating_action_id in number
523 ,p_updating_action_type in varchar2
524 ,p_element_link_id in number
525 ,p_original_entry_id in number
526 ,p_creator_type in varchar2
527 ,p_entry_type in varchar2
528 ,p_comment_id in number
529 ,p_comments in varchar2
530 ,p_creator_id in number
531 ,p_reason in varchar2
532 ,p_target_entry_id in number
533 ,p_attribute_category in varchar2
534 ,p_attribute1 in varchar2
535 ,p_attribute2 in varchar2
536 ,p_attribute3 in varchar2
537 ,p_attribute4 in varchar2
538 ,p_attribute5 in varchar2
539 ,p_attribute6 in varchar2
540 ,p_attribute7 in varchar2
541 ,p_attribute8 in varchar2
542 ,p_attribute9 in varchar2
543 ,p_attribute10 in varchar2
544 ,p_attribute11 in varchar2
545 ,p_attribute12 in varchar2
546 ,p_attribute13 in varchar2
547 ,p_attribute14 in varchar2
548 ,p_attribute15 in varchar2
549 ,p_attribute16 in varchar2
550 ,p_attribute17 in varchar2
551 ,p_attribute18 in varchar2
552 ,p_attribute19 in varchar2
553 ,p_attribute20 in varchar2
554 ,p_subpriority in number
555 ,p_personal_payment_method_id in number
556 ,p_date_earned in date
557 ,p_object_version_number in number
558 ,p_source_id in number
559 ,p_balance_adj_cost_flag in varchar2
560 ,p_element_type_id in number
561 ,p_all_entry_values_null in varchar2
562 )
563 Return g_rec_type;
564 end pay_ele_shd;