DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_PSF_UPD

Source


1 Package Body hr_psf_upd as
2 /* $Header: hrpsfrhi.pkb 120.14.12020000.5 2013/04/12 18:20:17 pathota ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_psf_upd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------------< dt_update_dml >-----------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the execution of dml from the datetrack mode
17 --   of CORRECTION only. It is important to note that the object version
18 --   number is only increment by 1 because the datetrack correction is
19 --   soley for one datetracked row.
20 --   This procedure controls the actual dml update logic. The functions of this
21 --   procedure are as follows:
22 --   1) Get the next object_version_number.
23 --   2) To update the specified row in the schema using the primary key in
24 --      the predicates.
25 --   3) To trap any constraint violations that may have occurred.
26 --   4) To raise any other errors.
27 --
28 -- Prerequisites:
29 --   This is an internal private procedure which must be called from the
30 --   update_dml procedure.
31 --
32 -- In Parameters:
33 --   A Pl/Sql record structre.
34 --
35 -- Post Success:
36 --   The specified row will be updated in the schema.
37 --
38 -- Post Failure:
39 --   If a check or unique integrity constraint violation is raised the
40 --   constraint_error procedure will be called.
41 --
42 -- Developer Implementation Notes:
43 --   The update 'set' arguments list should be modified if any of your
44 --   attributes are not updateable.
45 --
46 -- Access Status:
47 --   Internal Row Handler Use Only.
48 --
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure dt_update_dml
52    (p_rec          in out nocopy hr_psf_shd.g_rec_type,
53     p_effective_date  in   date,
54     p_datetrack_mode  in   varchar2,
55     p_validation_start_date in   date,
56     p_validation_end_date   in   date) is
57 --
58   l_proc varchar2(72)  ;
59 --
60 Begin
61 if g_debug then
62 l_proc    := g_package||'dt_update_dml';
63   hr_utility.set_location('Entering:'||l_proc, 5);
64 end if;
65   --
66   -- Added by Anirban for bug #5855944
67 
68     update per_all_positions
69     set
70   	position_id 			= p_rec.position_id,
71 	business_group_id 		= p_rec.business_group_id,
72 	job_id 				= p_rec.job_id,
73 	organization_id 		= p_rec.organization_id,
74 	successor_position_id 		= p_rec.successor_position_id,
75 	relief_position_id 		= p_rec.relief_position_id,
76 	location_id 			= p_rec.location_id,
77 	position_definition_id 		= p_rec.position_definition_id,
78 	date_effective 			= p_rec.date_effective,
79 	comments 			= p_rec.comments,
80 	date_end 			= p_rec.date_end,
81 	frequency 			= p_rec.frequency,
82 	name 				= p_rec.name,
83 	probation_period 		= p_rec.probation_period,
84 	probation_period_units 		= p_rec.probation_period_unit_cd,
85 	replacement_required_flag 	= p_rec.replacement_required_flag,
86 	time_normal_finish 		= p_rec.time_normal_finish,
87 	time_normal_start 		= p_rec.time_normal_start,
88         status 				= p_rec.status,
89 	working_hours 			= p_rec.working_hours,
90 	request_id 			= p_rec.request_id,
91 	program_application_id 		= p_rec.program_application_id,
92 	program_id 			= p_rec.program_id,
93 	program_update_date 		= p_rec.program_update_date,
94 	attribute_category 		= p_rec.attribute_category,
95 	attribute1                      = p_rec.attribute1,
96 	attribute2                      = p_rec.attribute2,
97 	attribute3                      = p_rec.attribute3,
98 	attribute4                      = p_rec.attribute4,
99 	attribute5                      = p_rec.attribute5,
100 	attribute6                      = p_rec.attribute6,
101 	attribute7                      = p_rec.attribute7,
102 	attribute8                      = p_rec.attribute8,
103 	attribute9                      = p_rec.attribute9,
104 	attribute10                     = p_rec.attribute10,
105 	attribute11                     = p_rec.attribute11,
106 	attribute12                     = p_rec.attribute12,
107 	attribute13                     = p_rec.attribute13,
108 	attribute14                     = p_rec.attribute14,
109 	attribute15                     = p_rec.attribute15,
110 	attribute16                     = p_rec.attribute16,
111 	attribute17                     = p_rec.attribute17,
112 	attribute18                     = p_rec.attribute18,
113 	attribute19                     = p_rec.attribute19,
114 	attribute20                     = p_rec.attribute20,
115 	object_version_number           = p_rec.object_version_number
116 
117    where   position_id = p_rec.position_id ;
118 
119     -- End Addition by Anirban
120   If (p_datetrack_mode = 'CORRECTION') then
121 if g_debug then
122     hr_utility.set_location(l_proc, 10);
123 end if;
124     --
125     -- Because we are updating a row we must get the next object
126     -- version number.
127     --
128     p_rec.object_version_number :=
129       dt_api.get_object_version_number
130      (p_base_table_name => 'hr_all_positions_f',
131       p_base_key_column => 'position_id',
132       p_base_key_value  => p_rec.position_id);
133     --
134     --
135     -- Update the hr_all_positions_f Row
136     --
137     update  hr_all_positions_f
138     set
139     position_id                     = p_rec.position_id,
140     availability_status_id          = p_rec.availability_status_id,
141     business_group_id               = p_rec.business_group_id,
142     entry_step_id                   = p_rec.entry_step_id,
143     entry_grade_rule_id             = p_rec.entry_grade_rule_id,
144     job_id                          = p_rec.job_id,
145     location_id                     = p_rec.location_id,
146     organization_id                 = p_rec.organization_id,
147     pay_freq_payroll_id             = p_rec.pay_freq_payroll_id,
148     position_definition_id          = p_rec.position_definition_id,
149     position_transaction_id         = p_rec.position_transaction_id,
150     prior_position_id               = p_rec.prior_position_id,
151     relief_position_id              = p_rec.relief_position_id,
152     entry_grade_id           = p_rec.entry_grade_id,
153     successor_position_id           = p_rec.successor_position_id,
154     supervisor_position_id          = p_rec.supervisor_position_id,
155     amendment_date                  = p_rec.amendment_date,
156     amendment_recommendation        = p_rec.amendment_recommendation,
157     amendment_ref_number            = p_rec.amendment_ref_number,
158     bargaining_unit_cd              = p_rec.bargaining_unit_cd,
159     current_job_prop_end_date       = p_rec.current_job_prop_end_date,
160     current_org_prop_end_date       = p_rec.current_org_prop_end_date,
161     avail_status_prop_end_date      = p_rec.avail_status_prop_end_date,
162     date_effective                  = p_rec.date_effective,
163     date_end                        = p_rec.date_end,
164     earliest_hire_date              = p_rec.earliest_hire_date,
165     fill_by_date                    = p_rec.fill_by_date,
166     frequency                       = p_rec.frequency,
167     fte                             = p_rec.fte,
168     max_persons                     = p_rec.max_persons,
169     name                            = p_rec.name,
170     overlap_period                  = p_rec.overlap_period,
171     overlap_unit_cd                 = p_rec.overlap_unit_cd,
172     pay_term_end_day_cd             = p_rec.pay_term_end_day_cd,
173     pay_term_end_month_cd           = p_rec.pay_term_end_month_cd,
174     permanent_temporary_flag        = p_rec.permanent_temporary_flag,
175     permit_recruitment_flag         = p_rec.permit_recruitment_flag,
176     position_type                   = p_rec.position_type,
177     posting_description             = p_rec.posting_description,
178     probation_period                = p_rec.probation_period,
179     probation_period_unit_cd        = p_rec.probation_period_unit_cd,
180     replacement_required_flag       = p_rec.replacement_required_flag,
181     review_flag                     = p_rec.review_flag,
182     seasonal_flag                   = p_rec.seasonal_flag,
183     security_requirements           = p_rec.security_requirements,
184     status                          = p_rec.status,
185     term_start_day_cd               = p_rec.term_start_day_cd,
186     term_start_month_cd             = p_rec.term_start_month_cd,
187     time_normal_finish              = p_rec.time_normal_finish,
188     time_normal_start               = p_rec.time_normal_start,
189     update_source_cd                = p_rec.update_source_cd,
190     working_hours                   = p_rec.working_hours,
191     works_council_approval_flag     = p_rec.works_council_approval_flag,
192     work_period_type_cd             = p_rec.work_period_type_cd,
193     work_term_end_day_cd            = p_rec.work_term_end_day_cd,
194     work_term_end_month_cd          = p_rec.work_term_end_month_cd,
195     comments                        = p_rec.comments,
196     proposed_fte_for_layoff         = p_rec.proposed_fte_for_layoff,
197     proposed_date_for_layoff        = p_rec.proposed_date_for_layoff,
198     pay_basis_id                    = p_rec.pay_basis_id,
199     supervisor_id                   = p_rec.supervisor_id,
200     copied_to_old_table_flag        = p_rec.copied_to_old_table_flag,
201     information1                    = p_rec.information1,
202     information2                    = p_rec.information2,
203     information3                    = p_rec.information3,
204     information4                    = p_rec.information4,
205     information5                    = p_rec.information5,
206     information6                    = p_rec.information6,
207     information7                    = p_rec.information7,
208     information8                    = p_rec.information8,
209     information9                    = p_rec.information9,
210     information10                   = p_rec.information10,
211     information11                   = p_rec.information11,
212     information12                   = p_rec.information12,
213     information13                   = p_rec.information13,
214     information14                   = p_rec.information14,
215     information15                   = p_rec.information15,
216     information16                   = p_rec.information16,
217     information17                   = p_rec.information17,
218     information18                   = p_rec.information18,
219     information19                   = p_rec.information19,
220     information20                   = p_rec.information20,
221     information21                   = p_rec.information21,
222     information22                   = p_rec.information22,
223     information23                   = p_rec.information23,
224     information24                   = p_rec.information24,
225     information25                   = p_rec.information25,
226     information26                   = p_rec.information26,
227     information27                   = p_rec.information27,
228     information28                   = p_rec.information28,
229     information29                   = p_rec.information29,
230     information30                   = p_rec.information30,
231     information_category            = p_rec.information_category,
232     attribute1                      = p_rec.attribute1,
233     attribute2                      = p_rec.attribute2,
234     attribute3                      = p_rec.attribute3,
235     attribute4                      = p_rec.attribute4,
236     attribute5                      = p_rec.attribute5,
237     attribute6                      = p_rec.attribute6,
238     attribute7                      = p_rec.attribute7,
239     attribute8                      = p_rec.attribute8,
240     attribute9                      = p_rec.attribute9,
241     attribute10                     = p_rec.attribute10,
242     attribute11                     = p_rec.attribute11,
243     attribute12                     = p_rec.attribute12,
244     attribute13                     = p_rec.attribute13,
245     attribute14                     = p_rec.attribute14,
246     attribute15                     = p_rec.attribute15,
247     attribute16                     = p_rec.attribute16,
248     attribute17                     = p_rec.attribute17,
249     attribute18                     = p_rec.attribute18,
250     attribute19                     = p_rec.attribute19,
251     attribute20                     = p_rec.attribute20,
252     attribute21                     = p_rec.attribute21,
253     attribute22                     = p_rec.attribute22,
254     attribute23                     = p_rec.attribute23,
255     attribute24                     = p_rec.attribute24,
256     attribute25                     = p_rec.attribute25,
257     attribute26                     = p_rec.attribute26,
258     attribute27                     = p_rec.attribute27,
259     attribute28                     = p_rec.attribute28,
260     attribute29                     = p_rec.attribute29,
261     attribute30                     = p_rec.attribute30,
262     attribute_category              = p_rec.attribute_category,
263     request_id                      = p_rec.request_id,
264     program_application_id          = p_rec.program_application_id,
265     program_id                      = p_rec.program_id,
266     program_update_date             = p_rec.program_update_date,
267     object_version_number           = p_rec.object_version_number
268     where   position_id = p_rec.position_id
269     and     effective_start_date = p_validation_start_date
270     and     effective_end_date   = p_validation_end_date;
271     --
272     --
273     -- Set the effective start and end dates
274     --
275     p_rec.effective_start_date := p_validation_start_date;
276     p_rec.effective_end_date   := p_validation_end_date;
277   End If;
278 --
279 if g_debug then
280 hr_utility.set_location(' Leaving:'||l_proc, 15);
281 end if;
282 Exception
283   When hr_api.check_integrity_violated Then
284     -- A check constraint has been violated
285     hr_psf_shd.constraint_error
286       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
287   When hr_api.unique_integrity_violated Then
288     -- Unique integrity has been violated
289     hr_psf_shd.constraint_error
290       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
291   When Others Then
292     Raise;
293 End dt_update_dml;
294 --
295 -- ----------------------------------------------------------------------------
296 -- |------------------------------< update_dml >------------------------------|
297 -- ----------------------------------------------------------------------------
298 -- {Start Of Comments}
299 --
300 -- Description:
301 --   This procedure calls the dt_update_dml control logic which handles
302 --   the actual datetrack dml.
303 --
304 -- Prerequisites:
305 --   This is an internal private procedure which must be called from the upd
306 --   procedure.
307 --
308 -- In Parameters:
309 --   A Pl/Sql record structre.
310 --
311 -- Post Success:
312 --   Processing contines.
313 --
314 -- Post Failure:
315 --   No specific error handling is required within this procedure.
316 --
317 -- Developer Implementation Notes:
318 --   The update 'set' arguments list should be modified if any of your
319 --   attributes are not updateable.
320 --
321 -- Access Status:
322 --   Internal Row Handler Use Only.
323 --
324 -- {End Of Comments}
325 -- ----------------------------------------------------------------------------
326 Procedure update_dml
327    (p_rec          in out nocopy hr_psf_shd.g_rec_type,
328     p_effective_date  in   date,
329     p_datetrack_mode  in   varchar2,
330     p_validation_start_date in   date,
331     p_validation_end_date   in   date) is
332 --
333   l_proc varchar2(72);
334 --
335 Begin
336 g_debug := hr_utility.debug_enabled;
337 if g_debug then
338  l_proc   := g_package||'update_dml';
339   hr_utility.set_location('Entering:'||l_proc, 5);
340 end if;
341   --
342   dt_update_dml(p_rec         => p_rec,
343       p_effective_date  => p_effective_date,
344       p_datetrack_mode  => p_datetrack_mode,
345             p_validation_start_date => p_validation_start_date,
346       p_validation_end_date   => p_validation_end_date);
347   --
348 if g_debug then
349   hr_utility.set_location(' Leaving:'||l_proc, 10);
350 end if;
351 End update_dml;
352 --
353 -- ----------------------------------------------------------------------------
354 -- |----------------------------< dt_pre_update >-----------------------------|
355 -- ----------------------------------------------------------------------------
356 -- {Start Of Comments}
357 --
358 -- Description:
359 --   The dt_pre_update procedure controls the execution
360 --   of dml for the datetrack modes of: UPDATE, UPDATE_OVERRIDE
361 --   and UPDATE_CHANGE_INSERT only. The execution required is as
362 --   follows:
363 --
364 --   1) Providing the datetrack update mode is not 'CORRECTION'
365 --      then set the effective end date of the current row (this
366 --      will be the validation_start_date - 1).
367 --   2) If the datetrack mode is 'UPDATE_OVERRIDE' then call the
368 --      corresponding delete_dml process to delete any future rows
369 --      where the effective_start_date is greater than or equal to
370 -- the validation_start_date.
371 --   3) Call the insert_dml process to insert the new updated row
372 --      details..
373 --
374 -- Prerequisites:
375 --   This is an internal procedure which is called from the
376 --   pre_update procedure.
377 --
378 -- In Parameters:
379 --
380 -- Post Success:
381 --   Processing continues.
382 --
383 -- Post Failure:
384 --   If an error has occurred, an error message and exception will be raised
385 --   but not handled.
386 --
387 -- Developer Implementation Notes:
388 --   This is an internal procedure which is required by Datetrack. Don't
389 --   remove or modify.
390 --
391 -- Access Status:
392 --   Internal Row Handler Use Only.
393 --
394 -- {End Of Comments}
395 -- ----------------------------------------------------------------------------
396 Procedure dt_pre_update
397    (p_rec          in out nocopy hr_psf_shd.g_rec_type,
398     p_effective_date  in   date,
399     p_datetrack_mode  in   varchar2,
400     p_validation_start_date in   date,
401     p_validation_end_date   in   date) is
402 --
403   l_proc          varchar2(72) ;
404   l_dummy_version_number number;
405 --
406 Begin
407 if g_debug then
408  l_proc            := g_package||'dt_pre_update';
409   hr_utility.set_location('Entering:'||l_proc, 5);
410 end if;
411   If (p_datetrack_mode <> 'CORRECTION') then
412 if g_debug then
413     hr_utility.set_location(l_proc, 10);
414 end if;
415     --
416     -- Update the current effective end date
417     --
418     hr_psf_shd.upd_effective_end_date
419      (p_effective_date         => p_effective_date,
420       p_base_key_value         => p_rec.position_id,
421       p_new_effective_end_date => (p_validation_start_date - 1),
422       p_validation_start_date  => p_validation_start_date,
423       p_validation_end_date    => p_validation_end_date,
424       p_object_version_number  => l_dummy_version_number);
425     --
426     If (p_datetrack_mode = 'UPDATE_OVERRIDE') then
427 if g_debug then
428       hr_utility.set_location(l_proc, 15);
429 end if;
430       --
431       -- As the datetrack mode is 'UPDATE_OVERRIDE' then we must
432       -- delete any future rows,
433       --
434       hr_psf_del.delete_dml
435         (p_rec        => p_rec,
436     p_effective_date  => p_effective_date,
437     p_datetrack_mode  => p_datetrack_mode,
438     p_validation_start_date => p_validation_start_date,
439     p_validation_end_date   => p_validation_end_date);
440     End If;
441 if g_debug then
442     hr_utility.set_location(l_proc, 20);
443 end if;
444     --
445     -- We must now insert the updated row
446     --
447     hr_psf_ins.insert_dml
448       (p_rec         => p_rec,
449        p_effective_date    => p_effective_date,
450        p_datetrack_mode    => p_datetrack_mode,
451        p_validation_start_date   => p_validation_start_date,
452        p_validation_end_date  => p_validation_end_date);
453   End If;
454 End dt_pre_update;
455 --
456 -- This procedure is called before checking any validation trigger
457 -- because many validations are dependent on date_effective and when date_effective
458 -- is going to be changed then validation should happen later only.
459 --
460 procedure update_date_effective
461 (p_rec          in out nocopy hr_psf_shd.g_rec_type
462 ,p_datetrack_mode        in varchar2
463 ,p_effective_date        in date
464 ,p_validation_start_date in out nocopy date
465 ,p_validation_end_date   in date)
466 is
467 l_min_esd date;
468 l_esd date;
469 l_prev_eed date;
470 l_present_stat varchar2(30);
471 l_prev_stat varchar2(30);
472 l_next_esd date;
473 -- cursor to fetch all rows of the position for update
474   cursor pos_all is
475       select date_effective
476       from hr_all_positions_f
477       where position_id  = p_rec.position_id
478       for update of date_effective;
479 
480  -- cursor to fetch minimum effective_start_date
481     cursor pos_min_esd is
482       select min(effective_start_date)
483       from hr_all_positions_f
484       where position_id = p_rec.position_id ;
485 
486 -- cursor to fetch the first row
487      cursor pos_first_row(min_esd date) is
488        select effective_start_date
489        from hr_All_positions_f
490        where position_id = p_rec.position_id and
491              effective_start_date = l_min_esd
492        for update of effective_start_date ;
493 
494 -- cursor to fetch the previous row from database current row
495      cursor pos_prev_row is
496        select effective_end_date
497        from hr_All_positions_f
498        where position_id = p_rec.position_id and
499              effective_end_date = p_validation_start_date -1
500        for update of effective_end_date ;
501 
502 -- cursor to fetch the next active row from database
503      cursor next_active_row(p_effective_date date) is
504        select effective_start_date
505        from hr_All_positions_f pos
506        where position_id = p_rec.position_id
507              and effective_start_date > p_effective_date
508         and hr_psf_shd.get_availability_status(pos.availability_status_id
509         ,p_rec.business_group_id ) = 'ACTIVE'
510        order by effective_start_date ;
511 -- cursor to update the current row in database as effective start date is not passed to api
512      cursor current_row (p_effective_start_date date) is
513         select effective_start_date
514         from hr_all_positions_f
515         where position_id = p_rec.position_id
516         and effective_start_date = p_effective_start_date
517    for update of effective_start_date ;
518 l_chg_date_effective boolean;
519 l_new_date_effective date;
520 l_old_esd date;
521 l_ll  date;
522 l_ul  date;
523 l_updateable boolean;
524 l_proc               varchar2(72) ;
525 begin
526 if g_debug then
527 l_proc                := g_package||'update_date_effective' ;
528    hr_utility.set_location('entering'||l_proc,5);
529 end if;
530    if p_rec.date_effective <> hr_psf_shd.g_old_rec.date_effective then
531       -- user has changed date effective in this record
532 if g_debug then
533       hr_utility.set_location('date effective has been changed'||l_proc,10);
534 end if;
535       if p_datetrack_mode ='CORRECTION' then
536 if g_debug then
537          hr_utility.set_location('datetrack mode correction '||l_proc,20);
538 end if;
539          hr_psf_bus.DE_Update_properties(
540           p_position_id           => p_rec.position_id,
541           p_effective_Start_Date  => hr_psf_shd.g_old_rec.effective_start_date,
542           p_updateable            => l_updateable,
543           p_lower_limit           => l_ll,
544           p_upper_limit           => l_ul);
545          if l_updateable and p_rec.date_effective between l_ll and l_ul then
546             -- and the date effective is between the allowed limits
547             -- change date effective for all records
548 if g_debug then
549             hr_utility.set_location('date effective change valid '||l_proc,30);
550 end if;
551             for i in pos_all loop
552                update hr_all_positions_f
553                set date_effective = p_rec.date_effective
554                where current of pos_all ;
555             end loop;
556             if hr_psf_bus.all_proposed_only_position(p_rec.position_id) then
557 if g_debug then
558                hr_utility.set_location('all_proposed only_position '||l_proc,40);
559 end if;
560                open pos_min_esd;
561                fetch pos_min_esd into l_min_esd;
562                close pos_min_esd;
563                if p_rec.date_effective < l_min_esd then
564              if l_min_esd = p_validation_start_date then
565            -- current row is the first row
566            p_validation_start_date := p_rec.date_effective;
567              end if;
568                   -- date effective is less than esd of first row change the esd of first row
569                   open pos_first_row(l_min_esd);
570                   fetch pos_first_row into l_esd;
571                   update hr_all_positions_f
572                   set effective_start_date = p_rec.date_effective
573         where current of pos_first_row;
574                   close pos_first_row;
575                end if;
576             elsif hr_psf_bus.first_active_position_row(p_rec.position_id,p_validation_start_date) then
577           -- change effective end_date of previous row
578 if g_debug then
579                hr_utility.set_location('first_active_position_row '||l_proc,50);
580 end if;
581           open pos_prev_row;
582           fetch pos_prev_row into l_prev_eed;
583                if l_prev_eed is not null then
584 if g_debug then
585                   hr_utility.set_location('first_active_position_row '||l_proc,55);
586 end if;
587              update hr_all_positions_f
588              set effective_end_date = p_rec.date_effective - 1
589              where current of pos_prev_row;
590                end if;
591           close pos_prev_row;
592 
593           -- current row effective_start_date is changed to date_effective
594                open current_row(hr_psf_shd.g_old_rec.effective_start_date);
595                fetch current_row into l_old_esd;
596                if l_old_esd is not null then
597              p_rec.effective_start_date := p_rec.date_effective;
598                   update hr_all_positions_f
599                   set effective_start_date = p_rec.date_effective
600                   where current of current_row;
601                end if;
602           close current_row;
603           -- form values are also updated to reflect the change
604           p_validation_start_date := p_rec.date_effective;
605             end if;
606 if g_debug then
607             hr_utility.set_location('p_rec.date_effective:'||to_char(p_rec.date_effective)||l_proc, 90);
608 end if;
609          else
610 if g_debug then
611             hr_utility.set_location('DE changed but either non doable or wrong limits'||l_proc,15);
612 end if;
613          end if;
614       else
615          -- raise the error that date_effective cannot be changed in
616          -- any other datetrack mode
617          hr_utility.set_message(800, 'PER_DE_CHANGE_ONLY_CORRECTION');
618          hr_utility.raise_error;
619       end if;
620    else
621 if g_debug then
622       hr_utility.set_location('user has not changed date effective'||l_proc,164);
623 end if;
624    end if;
625    if p_rec.availability_status_id <> hr_psf_shd.g_old_rec.availability_status_id then
626       -- user has changed availability_status_id in this record
627 if g_debug then
628       hr_utility.set_location('Avail_stat changed '||l_proc,60);
629 end if;
630       hr_psf_bus.chk_availability_status_id(p_position_id            => p_rec.position_id
631                                            ,p_business_group_id      => p_rec.business_group_id
632                                            ,p_datetrack_mode         => p_datetrack_mode
633                                            ,p_validation_start_date  => p_validation_start_date
634                                            ,p_availability_status_id => p_rec.availability_status_id
635                                            ,p_effective_date         => p_effective_date
636                                            ,p_date_effective         => p_rec.date_effective
637                                            ,p_object_version_number  => p_rec.object_version_number
638                                            ,p_old_avail_status_id    => hr_psf_shd.g_old_rec.availability_status_id
639                              );
640 if g_debug then
641       hr_utility.set_location('after chk_avail_stat '||l_proc, 70);
642 end if;
643       l_present_stat := hr_psf_shd.get_availability_status(p_rec.availability_status_id,
644                                          p_rec.business_group_id);
645       l_prev_stat := hr_psf_shd.get_availability_status(
646                                          hr_psf_shd.g_old_rec.availability_status_id,
647                                          p_rec.business_group_id);
648       if (hr_psf_bus.all_proposed_only_position(p_rec.position_id))
649     and l_present_stat = 'ACTIVE' then
650 if g_debug then
651          hr_utility.set_location('all_proposed_position'||l_proc, 90);
652 end if;
653     -- all_proposed row changed into first active
654     if p_datetrack_mode ='CORRECTION' then
655 if g_debug then
656             hr_utility.set_location('correction'||l_proc, 95);
657 end if;
658        -- all proposed position chnaged in correction mode to active
659        -- then date_effective should be equal to effective_start_date of current row
660        if p_rec.date_effective <> p_validation_start_date then
661           hr_utility.set_message(800,'PER_DE_EQ_ESD_CORR');
662           hr_utility.raise_error;
663        end if;
664     end if;
665     if p_datetrack_mode ='UPDATE' then
666        -- all proposed position chnaged in correction mode to active
667        -- then date_effective should be equal to effective_start_date of current row
668 if g_debug then
669             hr_utility.set_location('correction'||l_proc, 97);
670 end if;
671        if p_rec.date_effective <> p_effective_date then
672           hr_utility.set_message(800,'PER_DE_EQ_ED_UPD');
673           hr_utility.raise_error;
674        end if;
675     end if;
676       elsif (hr_psf_bus.first_active_position_row(p_rec.position_id,hr_psf_shd.g_old_rec.effective_start_date)) then
677     -- find out the ESD of next active row  and make that as Date_effective and the same
678     -- is to be done for all the records of that position
679 if g_debug then
680          hr_utility.set_location('first_active_position'||l_proc, 80);
681 end if;
682 
683    -- Bug Fix : 3381555
684    if (hr_psf_shd.get_availability_status(p_rec.availability_status_id
685         ,p_rec.business_group_id ) <> 'ELIMINATED' ) then
686         --
687         -- Proposed change is not for eliminate, then get the next active row's esd for the
688         -- given validation_start_date.
689         --
690     open next_active_row(p_validation_start_date);
691     fetch next_active_row into l_next_esd;
692     close next_active_row;
693      --
694     End if;
695 
696     if l_next_esd is not null then
697        -- There exists an active row after the current row
698 if g_debug then
699             hr_utility.set_location('first_active_position'||l_proc, 85);
700 end if;
701             p_rec.date_effective := l_next_esd;
702             for i in pos_all loop
703                update hr_all_positions_f
704                set date_effective = p_rec.date_effective
705                where current of pos_all ;
706             end loop;
707     end if;
708       elsif l_present_stat = 'ACTIVE' and l_prev_stat ='PROPOSED' then
709       -- neither first active nor all proposed but current row becoming first active
710 if g_debug then
711          hr_utility.set_location('making first_active_row'||l_proc, 100);
712 end if;
713     if p_datetrack_mode ='CORRECTION' then
714 if g_debug then
715             hr_utility.set_location('mode correction'||l_proc, 102);
716 end if;
717        -- a proposed position changed in correction mode to active
718        -- then date_effective should be equal to effective_start_date of current row
719        p_rec.date_effective := p_validation_start_date ;
720             for i in pos_all loop
721                update hr_all_positions_f
722                set date_effective = p_rec.date_effective
723                where current of pos_all ;
724             end loop;
725     end if;
726     if p_datetrack_mode ='UPDATE_CHANGE_INSERT'
727             or p_datetrack_mode ='UPDATE_OVERRIDE'
728             or p_datetrack_mode ='UPDATE' then
729 if g_debug then
730             hr_utility.set_location('mode update_change_insert'||l_proc, 112);
731 end if;
732        p_rec.date_effective := p_effective_date ;
733             for i in pos_all loop
734                update hr_all_positions_f
735                set date_effective = p_rec.date_effective
736                where current of pos_all ;
737             end loop;
738     end if;
739       end if;
740    end if;
741 if g_debug then
742    hr_utility.set_location('leaving '||l_proc, 200);
743 end if;
744 end update_date_effective;
745 -- ----------------------------------------------------------------------------
746 -- |------------------------------< pre_update >------------------------------|
747 -- ----------------------------------------------------------------------------
748 -- {Start Of Comments}
749 --
750 -- Description:
751 --   This private procedure contains any processing which is required before
752 --   the update dml.
753 --
754 -- Prerequisites:
755 --   This is an internal procedure which is called from the upd procedure.
756 --
757 -- In Parameters:
758 --   A Pl/Sql record structre.
759 --
760 -- Post Success:
761 --   Processing continues.
762 --
763 -- Post Failure:
764 --   If an error has occurred, an error message and exception will be raised
765 --   but not handled.
766 --
767 -- Developer Implementation Notes:
768 --   Any pre-processing required before the update dml is issued should be
769 --   coded within this procedure. It is important to note that any 3rd party
770 --   maintenance should be reviewed before placing in this procedure. The call
771 --   to the dt_update_dml procedure should NOT be removed.
772 --
773 -- Access Status:
774 --   Internal Row Handler Use Only.
775 --
776 -- {End Of Comments}
777 -- ----------------------------------------------------------------------------
778 Procedure pre_update
779    (p_rec          in out nocopy hr_psf_shd.g_rec_type,
780     p_effective_date  in   date,
781     p_datetrack_mode  in   varchar2,
782     p_validation_start_date in out nocopy date,
783     p_validation_end_date   in out nocopy date) is
784 --
785   l_proc varchar2(72);
786   l_min_esd     date;
787   l_proposed    boolean ;
788   l_active_rows      number ;
789   l_current_row_stat varchar2(30) ;
790   l_new_date_effective date ;
791   l_chg_date_effective boolean ;
792   cursor c1 is
793   select min(effective_start_date)
794   from hr_all_positions_f
795   where position_id = p_rec.position_id;
796 
797 -- cursor to fetch all rows of the position for update
798   cursor pos_all is
799       select date_effective
800       from hr_all_positions_f
801       where position_id  = p_rec.position_id
802       for update of date_effective;
803 
804 -- cursor to fetch the previous row
805   cursor pos_prev is
806     select effective_start_date,effective_end_date
807     from hr_all_positions_f
808     where position_id = p_rec.position_id and
809           effective_end_date = hr_psf_shd.g_old_rec.effective_start_date - 1
810     for update of effective_start_date,effective_end_date;
811 
812 -- cursor to fetch the first row
813      cursor pos_first(p_min_esd date) is
814        select effective_start_date, effective_end_date
815        from hr_All_positions_f
816        where position_id = p_rec.position_id and
817              effective_start_date = p_min_esd
818        for update of effective_start_date ;
819 -- cursor to fetch ESD from current row
820      cursor pos_current(p_effective_date date) is
821        select effective_start_date
822        from hr_All_positions_f
823        where position_id = p_rec.position_id and
824              p_effective_date between effective_start_date and effective_end_date;
825 -- cursor to check active rows for the position prior to the effective_start_date of their row
826     cursor pos_active_rows(p_position_id number,p_effective_start_date date) is
827        select count(*)
828        from hr_all_positions_f pos
829        where pos.position_id = p_position_id
830        and pos.effective_start_date < p_effective_start_date
831        and hr_psf_shd.get_availability_status(pos.availability_status_id
832         ,p_rec.business_group_id ) = 'ACTIVE';
833 Begin
834 
835 if g_debug then
836  l_proc  :=    g_package||'pre_update';
837   hr_utility.set_location('Entering:'|| l_proc, 5);
838 end if;
839 
840   --
841   --
842   --
843   dt_pre_update
844     (p_rec          => p_rec,
845      p_effective_date        => p_effective_date,
846      p_datetrack_mode        => p_datetrack_mode,
847      p_validation_start_date => p_validation_start_date,
848      p_validation_end_date   => p_validation_end_date);
849   --
850   -- Logic to update date_effective on all the position rows
851   -- if date_effective has changed
852   -- if effective_date is changed prior to effective_Start_Date of
853   -- first row, effective_start_Date also moves to the same date
854   --
855   if g_debug then
856   hr_utility.set_location('performing validation '||l_proc, 10);
857   end if;
858 /*
859   if p_rec.date_effective <> hr_psf_shd.g_old_rec.date_effective then
860    --
861    -- check the date_track mode, if it is not correction then
862    -- change in date_effective is not allowed
863    --
864       if p_datetrack_mode <> 'CORRECTION' then
865          -- raise the error that date_effective cannot be changed in
866          -- any other datetrack mode
867          hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
868          hr_utility.set_message_token('PROCEDURE', l_proc);
869          hr_utility.set_message_token('STEP','15');
870          hr_utility.raise_error;
871       end if;
872    --
873    -- update date_effective of the all rows of the position for the
874    -- date_effective
875    --
876     open pos_current(p_effective_date);
877     fetch pos_current into p_rec.effective_start_date;
878     close pos_current;
879 
880     for i in pos_all loop
881         update hr_all_positions_f
882           set date_effective = p_rec.date_effective
883           where current of pos_all ;
884     end loop;
885 
886    -- If the current position is all_proposed then no change in
887    -- start date or end date is performed while first record's start
888    -- is to be changed which is outside the condition
889 
890    l_proposed := hr_psf_bus.all_proposed_only_position(p_rec.position_id);
891 
892    if l_proposed = false then
893        l_current_row_stat := hr_psf_shd.get_availability_status(p_rec.availability_status_id
894         ,p_rec.business_group_id ) ;
895       if l_current_row_stat = 'ACTIVE' then
896        --
897        -- update effective start date of current row
898        --
899         update hr_all_positions_f
900         set effective_Start_date = p_rec.date_effective
901         where position_id = p_rec.position_id and
902               effective_start_date = hr_psf_shd.g_old_rec.effective_start_date;
903         if sql%rowcount = 0 then
904           hr_utility.set_message(800, 'HR_6153_ALL_PROCEDURE_FAIL');
905           hr_utility.set_message_token('PROCEDURE', l_proc);
906           hr_utility.set_message_token('STEP','5');
907           hr_utility.raise_error;
908         end if;
909         p_validation_start_date    := p_rec.date_effective;
910         p_rec.effective_start_date := p_rec.date_effective;
911         --
912         -- update previous row's effective_end_date
913         for j in pos_prev loop
914             update hr_all_positions_f
915             set effective_end_date = p_rec.date_effective - 1
916             where current of pos_prev ;
917         end loop;
918       end if;
919     end if;
920 
921     --
922     --
923     -- Find effective_start_date of the first row
924     --
925     open c1;
926     fetch c1 into l_min_esd;
927     close c1;
928     if g_debug then
929     hr_utility.set_location('l_min_esd = ' || to_char(l_min_esd) || l_proc, 100);
930     end if;
931     --
932     -- if esd for the first row is later than new date_Effective
933     if l_min_esd > p_rec.date_effective then
934       --
935       -- move esd of the first row to date_Effective
936       --
937       for k in pos_first(l_min_esd) loop
938       if g_debug then
939           hr_utility.set_location('k.effective_start_date = ' ||
940                            to_char(k.effective_start_date) || l_proc, 110);
941           hr_utility.set_location('p_rec.effective_start_date = ' ||
942                            to_char(p_rec.effective_start_date) || l_proc, 110);
943       end if;
944           update hr_All_positions_f
945           set effective_Start_Date = p_rec.date_effective
946           where current of pos_first ;
947 
948           if p_rec.effective_start_date = k.effective_start_date then
949           if g_debug then
950              hr_utility.set_location('In Current Row = First Row ' || l_proc, 115);
951           end if;
952              p_validation_start_date    := p_rec.date_effective;
953              p_rec.effective_start_date := p_rec.date_effective;
954           end if;
955           if g_debug then
956           hr_utility.set_location('p_rec.effective_start_date = ' ||
957                            to_char(p_rec.effective_start_date) || l_proc, 150);
958           end if;
959         end loop;
960 
961       --
962     end if;
963 
964   end if;
965 */
966 if g_debug then
967   hr_utility.set_location('p_validation_start_date '
968             || to_char(p_validation_start_date) || ' ' || l_proc, 100);
969   hr_utility.set_location(' Leaving:'||l_proc, 20);
970   end if;
971 End pre_update;
972 --
973 -- ----------------------------------------------------------------------------
974 -- |-----------------------------< post_update >------------------------------|
975 -- ----------------------------------------------------------------------------
976 -- {Start Of Comments}
977 --
978 -- Description:
979 --   This private procedure contains any processing which is required after the
980 --   update dml.
981 --
982 -- Prerequisites:
983 --   This is an internal procedure which is called from the upd procedure.
984 --
985 -- In Parameters:
986 --   A Pl/Sql record structre.
987 --
988 -- Post Success:
989 --   Processing continues.
990 --
991 -- Post Failure:
992 --   If an error has occurred, an error message and exception will be raised
993 --   but not handled.
994 --
995 -- Developer Implementation Notes:
996 --   Any post-processing required after the update dml is issued should be
997 --   coded within this procedure. It is important to note that any 3rd party
998 --   maintenance should be reviewed before placing in this procedure.
999 --
1000 -- Access Status:
1001 --   Internal Row Handler Use Only.
1002 --
1003 -- {End Of Comments}
1004 -- ----------------------------------------------------------------------------
1005 Procedure post_update
1006    (p_rec          in hr_psf_shd.g_rec_type,
1007     p_effective_date  in date,
1008     p_datetrack_mode  in varchar2,
1009     p_validation_start_date in date,
1010     p_validation_end_date   in date) is
1011 --
1012   l_proc varchar2(72);
1013 --
1014 Begin
1015 if g_debug then
1016 l_proc    := g_package||'post_update';
1017   hr_utility.set_location('Entering:'||l_proc, 5);
1018 end if;
1019   --
1020   -- User Hook
1021   Begin
1022   hr_psf_rku.after_update(
1023   p_position_id                  => p_rec.position_id                 ,
1024   p_effective_start_date         => p_rec.effective_start_date        ,
1025   p_effective_end_date           => p_rec.effective_end_date          ,
1026   p_availability_status_id       => p_rec.availability_status_id      ,
1027 --  p_business_group_id            => p_rec.business_group_id           ,
1028   p_entry_step_id                => p_rec.entry_step_id               ,
1029   p_entry_grade_rule_id          => p_rec.entry_grade_rule_id         ,
1030 --  p_job_id                       => p_rec.job_id                      ,
1031   p_location_id                  => p_rec.location_id                 ,
1032 --  p_organization_id              => p_rec.organization_id             ,
1033   p_pay_freq_payroll_id          => p_rec.pay_freq_payroll_id         ,
1034   p_position_definition_id       => p_rec.position_definition_id      ,
1035   p_position_transaction_id      => p_rec.position_transaction_id     ,
1036   p_prior_position_id            => p_rec.prior_position_id           ,
1037   p_relief_position_id           => p_rec.relief_position_id          ,
1038   p_entry_grade_id               => p_rec.entry_grade_id              ,
1039   p_successor_position_id        => p_rec.successor_position_id       ,
1040   p_supervisor_position_id       => p_rec.supervisor_position_id      ,
1041   p_amendment_date               => p_rec.amendment_date              ,
1042   p_amendment_recommendation     => p_rec.amendment_recommendation    ,
1043   p_amendment_ref_number         => p_rec.amendment_ref_number        ,
1044   p_bargaining_unit_cd           => p_rec.bargaining_unit_cd          ,
1045   p_comments                     => p_rec.comments                    ,
1046   p_current_job_prop_end_date    => p_rec.current_job_prop_end_date   ,
1047   p_current_org_prop_end_date    => p_rec.current_org_prop_end_date   ,
1048   p_avail_status_prop_end_date   => p_rec.avail_status_prop_end_date  ,
1049   p_date_effective               => p_rec.date_effective              ,
1050   p_date_end                     => p_rec.date_end                    ,
1051   p_earliest_hire_date           => p_rec.earliest_hire_date          ,
1052   p_fill_by_date                 => p_rec.fill_by_date                ,
1053   p_frequency                    => p_rec.frequency                   ,
1054   p_fte                          => p_rec.fte                         ,
1055   p_max_persons                  => p_rec.max_persons                 ,
1056   p_name                         => p_rec.name                        ,
1057   p_overlap_period               => p_rec.overlap_period              ,
1058   p_overlap_unit_cd              => p_rec.overlap_unit_cd             ,
1059   p_pay_term_end_day_cd          => p_rec.pay_term_end_day_cd         ,
1060   p_pay_term_end_month_cd        => p_rec.pay_term_end_month_cd       ,
1061   p_permanent_temporary_flag     => p_rec.permanent_temporary_flag    ,
1062   p_permit_recruitment_flag      => p_rec.permit_recruitment_flag     ,
1063   p_position_type                => p_rec.position_type               ,
1064   p_posting_description          => p_rec.posting_description         ,
1065   p_probation_period             => p_rec.probation_period            ,
1066   p_probation_period_unit_cd     => p_rec.probation_period_unit_cd    ,
1067   p_replacement_required_flag    => p_rec.replacement_required_flag   ,
1068   p_review_flag                  => p_rec.review_flag                 ,
1069   p_seasonal_flag                => p_rec.seasonal_flag               ,
1070   p_security_requirements        => p_rec.security_requirements       ,
1071   p_status                       => p_rec.status                      ,
1072   p_term_start_day_cd            => p_rec.term_start_day_cd           ,
1073   p_term_start_month_cd          => p_rec.term_start_month_cd         ,
1074   p_time_normal_finish           => p_rec.time_normal_finish          ,
1075   p_time_normal_start            => p_rec.time_normal_start           ,
1076   p_update_source_cd             => p_rec.update_source_cd            ,
1077   p_working_hours                => p_rec.working_hours               ,
1078   p_works_council_approval_flag  => p_rec.works_council_approval_flag ,
1079   p_work_period_type_cd          => p_rec.work_period_type_cd         ,
1080   p_work_term_end_day_cd         => p_rec.work_term_end_day_cd        ,
1081   p_work_term_end_month_cd       => p_rec.work_term_end_month_cd      ,
1082   p_proposed_fte_for_layoff      => p_rec.proposed_fte_for_layoff     ,
1083   p_proposed_date_for_layoff     => p_rec.proposed_date_for_layoff    ,
1084   p_pay_basis_id                 => p_rec.pay_basis_id                ,
1085   p_supervisor_id                => p_rec.supervisor_id               ,
1086   p_copied_to_old_table_flag     => p_rec.copied_to_old_table_flag    ,
1087   p_information1                 => p_rec.information1                ,
1088   p_information2                 => p_rec.information2                ,
1089   p_information3                 => p_rec.information3                ,
1090   p_information4                 => p_rec.information4                ,
1091   p_information5                 => p_rec.information5                ,
1092   p_information6                 => p_rec.information6                ,
1093   p_information7                 => p_rec.information7                ,
1094   p_information8                 => p_rec.information8                ,
1095   p_information9                 => p_rec.information9                ,
1096   p_information10                => p_rec.information10               ,
1097   p_information11                => p_rec.information11               ,
1098   p_information12                => p_rec.information12               ,
1099   p_information13                => p_rec.information13               ,
1100   p_information14                => p_rec.information14               ,
1101   p_information15                => p_rec.information15               ,
1102   p_information16                => p_rec.information16               ,
1103   p_information17                => p_rec.information17               ,
1104   p_information18                => p_rec.information18               ,
1105   p_information19                => p_rec.information19               ,
1106   p_information20                => p_rec.information20               ,
1107   p_information21                => p_rec.information21               ,
1108   p_information22                => p_rec.information22               ,
1109   p_information23                => p_rec.information23               ,
1110   p_information24                => p_rec.information24               ,
1111   p_information25                => p_rec.information25               ,
1112   p_information26                => p_rec.information26               ,
1113   p_information27                => p_rec.information27               ,
1114   p_information28                => p_rec.information28               ,
1115   p_information29                => p_rec.information29               ,
1116   p_information30                => p_rec.information30               ,
1117   p_information_category         => p_rec.information_category        ,
1118   p_attribute1                   => p_rec.attribute1                  ,
1119   p_attribute2                   => p_rec.attribute2                  ,
1120   p_attribute3                   => p_rec.attribute3                  ,
1121   p_attribute4                   => p_rec.attribute4                  ,
1122   p_attribute5                   => p_rec.attribute5                  ,
1123   p_attribute6                   => p_rec.attribute6                  ,
1124   p_attribute7                   => p_rec.attribute7                  ,
1125   p_attribute8                   => p_rec.attribute8                  ,
1126   p_attribute9                   => p_rec.attribute9                  ,
1127   p_attribute10                  => p_rec.attribute10                 ,
1128   p_attribute11                  => p_rec.attribute11                 ,
1129   p_attribute12                  => p_rec.attribute12                 ,
1130   p_attribute13                  => p_rec.attribute13                 ,
1131   p_attribute14                  => p_rec.attribute14                 ,
1132   p_attribute15                  => p_rec.attribute15                 ,
1133   p_attribute16                  => p_rec.attribute16                 ,
1134   p_attribute17                  => p_rec.attribute17                 ,
1135   p_attribute18                  => p_rec.attribute18                 ,
1136   p_attribute19                  => p_rec.attribute19                 ,
1137   p_attribute20                  => p_rec.attribute20                 ,
1138   p_attribute21                  => p_rec.attribute21                 ,
1139   p_attribute22                  => p_rec.attribute22                 ,
1140   p_attribute23                  => p_rec.attribute23                 ,
1141   p_attribute24                  => p_rec.attribute24                 ,
1142   p_attribute25                  => p_rec.attribute25                 ,
1143   p_attribute26                  => p_rec.attribute26                 ,
1144   p_attribute27                  => p_rec.attribute27                 ,
1145   p_attribute28                  => p_rec.attribute28                 ,
1146   p_attribute29                  => p_rec.attribute29                 ,
1147   p_attribute30                  => p_rec.attribute30                 ,
1148   p_attribute_category           => p_rec.attribute_category          ,
1149   p_request_id                   => p_rec.request_id                  ,
1150   p_program_application_id       => p_rec.program_application_id      ,
1151   p_program_id                   => p_rec.program_id                  ,
1152   p_program_update_date          => p_rec.program_update_date         ,
1153   p_object_version_number        => p_rec.object_version_number       ,
1154   p_effective_date       => p_effective_date          ,
1155   p_datetrack_mode               => p_datetrack_mode                  ,
1156   p_effective_start_date_o       => hr_psf_shd.g_old_rec.effective_start_date      ,
1157   p_effective_end_date_o         => hr_psf_shd.g_old_rec.effective_end_date        ,
1158   p_availability_status_id_o     => hr_psf_shd.g_old_rec.availability_status_id    ,
1159   p_business_group_id_o          => hr_psf_shd.g_old_rec.business_group_id         ,
1160   p_entry_step_id_o              => hr_psf_shd.g_old_rec.entry_step_id             ,
1161   p_entry_grade_rule_id_o        => hr_psf_shd.g_old_rec.entry_grade_rule_id       ,
1162   p_job_id_o                     => hr_psf_shd.g_old_rec.job_id                    ,
1163   p_location_id_o                => hr_psf_shd.g_old_rec.location_id               ,
1164   p_organization_id_o            => hr_psf_shd.g_old_rec.organization_id             ,
1165   p_pay_freq_payroll_id_o        => hr_psf_shd.g_old_rec.pay_freq_payroll_id       ,
1166   p_position_definition_id_o     => hr_psf_shd.g_old_rec.position_definition_id    ,
1167   p_position_transaction_id_o    => hr_psf_shd.g_old_rec.position_transaction_id   ,
1168   p_prior_position_id_o          => hr_psf_shd.g_old_rec.prior_position_id         ,
1169   p_relief_position_id_o         => hr_psf_shd.g_old_rec.relief_position_id        ,
1170   p_entry_grade_id_o             => hr_psf_shd.g_old_rec.entry_grade_id            ,
1171   p_successor_position_id_o      => hr_psf_shd.g_old_rec.successor_position_id     ,
1172   p_supervisor_position_id_o     => hr_psf_shd.g_old_rec.supervisor_position_id    ,
1173   p_amendment_date_o             => hr_psf_shd.g_old_rec.amendment_date            ,
1174   p_amendment_recommendation_o   => hr_psf_shd.g_old_rec.amendment_recommendation  ,
1175   p_amendment_ref_number_o       => hr_psf_shd.g_old_rec.amendment_ref_number      ,
1176   p_bargaining_unit_cd_o         => hr_psf_shd.g_old_rec.bargaining_unit_cd        ,
1177   p_comments_o                   => hr_psf_shd.g_old_rec.comments                  ,
1178   p_current_job_prop_end_date_o  => hr_psf_shd.g_old_rec.current_job_prop_end_date ,
1179   p_current_org_prop_end_date_o  => hr_psf_shd.g_old_rec.current_org_prop_end_date ,
1180   p_avail_status_prop_end_date_o => hr_psf_shd.g_old_rec.avail_status_prop_end_date,
1181   p_date_effective_o             => hr_psf_shd.g_old_rec.date_effective            ,
1182   p_date_end_o                   => hr_psf_shd.g_old_rec.date_end                  ,
1183   p_earliest_hire_date_o         => hr_psf_shd.g_old_rec.earliest_hire_date        ,
1184   p_fill_by_date_o               => hr_psf_shd.g_old_rec.fill_by_date              ,
1185   p_frequency_o                  => hr_psf_shd.g_old_rec.frequency                 ,
1186   p_fte_o                        => hr_psf_shd.g_old_rec.fte                       ,
1187   p_max_persons_o                => hr_psf_shd.g_old_rec.max_persons               ,
1188   p_name_o                       => hr_psf_shd.g_old_rec.name                      ,
1189   p_overlap_period_o             => hr_psf_shd.g_old_rec.overlap_period            ,
1190   p_overlap_unit_cd_o            => hr_psf_shd.g_old_rec.overlap_unit_cd           ,
1191   p_pay_term_end_day_cd_o        => hr_psf_shd.g_old_rec.pay_term_end_day_cd       ,
1192   p_pay_term_end_month_cd_o      => hr_psf_shd.g_old_rec.pay_term_end_month_cd     ,
1193   p_permanent_temporary_flag_o   => hr_psf_shd.g_old_rec.permanent_temporary_flag  ,
1194   p_permit_recruitment_flag_o    => hr_psf_shd.g_old_rec.permit_recruitment_flag   ,
1195   p_position_type_o              => hr_psf_shd.g_old_rec.position_type             ,
1196   p_posting_description_o        => hr_psf_shd.g_old_rec.posting_description       ,
1197   p_probation_period_o           => hr_psf_shd.g_old_rec.probation_period          ,
1198   p_probation_period_unit_cd_o   => hr_psf_shd.g_old_rec.probation_period_unit_cd  ,
1199   p_replacement_required_flag_o  => hr_psf_shd.g_old_rec.replacement_required_flag ,
1200   p_review_flag_o                => hr_psf_shd.g_old_rec.review_flag               ,
1201   p_seasonal_flag_o              => hr_psf_shd.g_old_rec.seasonal_flag             ,
1202   p_security_requirements_o      => hr_psf_shd.g_old_rec.security_requirements     ,
1203   p_status_o                     => hr_psf_shd.g_old_rec.status                    ,
1204   p_term_start_day_cd_o          => hr_psf_shd.g_old_rec.term_start_day_cd         ,
1205   p_term_start_month_cd_o        => hr_psf_shd.g_old_rec.term_start_month_cd       ,
1206   p_time_normal_finish_o         => hr_psf_shd.g_old_rec.time_normal_finish        ,
1207   p_time_normal_start_o          => hr_psf_shd.g_old_rec.time_normal_start         ,
1208   p_update_source_cd_o           => hr_psf_shd.g_old_rec.update_source_cd          ,
1209   p_working_hours_o              => hr_psf_shd.g_old_rec.working_hours             ,
1210   p_works_council_approval_fla_o => hr_psf_shd.g_old_rec.works_council_approval_flag,
1211   p_work_period_type_cd_o        => hr_psf_shd.g_old_rec.work_period_type_cd       ,
1212   p_work_term_end_day_cd_o       => hr_psf_shd.g_old_rec.work_term_end_day_cd      ,
1213   p_work_term_end_month_cd_o     => hr_psf_shd.g_old_rec.work_term_end_month_cd    ,
1214   p_proposed_fte_for_layoff_o    => hr_psf_shd.g_old_rec.proposed_fte_for_layoff   ,
1215   p_proposed_date_for_layoff_o   => hr_psf_shd.g_old_rec.proposed_date_for_layoff  ,
1216   p_pay_basis_id_o               => hr_psf_shd.g_old_rec.pay_basis_id              ,
1217   p_supervisor_id_o              => hr_psf_shd.g_old_rec.supervisor_id             ,
1218   p_copied_to_old_table_flag_o   => hr_psf_shd.g_old_rec.copied_to_old_table_flag  ,
1219   p_information1_o               => hr_psf_shd.g_old_rec.information1              ,
1220   p_information2_o               => hr_psf_shd.g_old_rec.information2              ,
1221   p_information3_o               => hr_psf_shd.g_old_rec.information3              ,
1222   p_information4_o               => hr_psf_shd.g_old_rec.information4              ,
1223   p_information5_o               => hr_psf_shd.g_old_rec.information5              ,
1224   p_information6_o               => hr_psf_shd.g_old_rec.information6              ,
1225   p_information7_o               => hr_psf_shd.g_old_rec.information7              ,
1226   p_information8_o               => hr_psf_shd.g_old_rec.information8              ,
1227   p_information9_o               => hr_psf_shd.g_old_rec.information9              ,
1228   p_information10_o              => hr_psf_shd.g_old_rec.information10             ,
1229   p_information11_o              => hr_psf_shd.g_old_rec.information11             ,
1230   p_information12_o              => hr_psf_shd.g_old_rec.information12             ,
1231   p_information13_o              => hr_psf_shd.g_old_rec.information13             ,
1232   p_information14_o              => hr_psf_shd.g_old_rec.information14             ,
1233   p_information15_o              => hr_psf_shd.g_old_rec.information15             ,
1234   p_information16_o              => hr_psf_shd.g_old_rec.information16             ,
1235   p_information17_o              => hr_psf_shd.g_old_rec.information17             ,
1236   p_information18_o              => hr_psf_shd.g_old_rec.information18             ,
1237   p_information19_o              => hr_psf_shd.g_old_rec.information19             ,
1238   p_information20_o              => hr_psf_shd.g_old_rec.information20             ,
1239   p_information21_o              => hr_psf_shd.g_old_rec.information21             ,
1240   p_information22_o              => hr_psf_shd.g_old_rec.information22             ,
1241   p_information23_o              => hr_psf_shd.g_old_rec.information23             ,
1242   p_information24_o              => hr_psf_shd.g_old_rec.information24             ,
1243   p_information25_o              => hr_psf_shd.g_old_rec.information25             ,
1244   p_information26_o              => hr_psf_shd.g_old_rec.information26             ,
1245   p_information27_o              => hr_psf_shd.g_old_rec.information27             ,
1246   p_information28_o              => hr_psf_shd.g_old_rec.information28             ,
1247   p_information29_o              => hr_psf_shd.g_old_rec.information29             ,
1248   p_information30_o              => hr_psf_shd.g_old_rec.information30             ,
1249   p_information_category_o       => hr_psf_shd.g_old_rec.information_category      ,
1250   p_attribute1_o                 => hr_psf_shd.g_old_rec.attribute1                ,
1251   p_attribute2_o                 => hr_psf_shd.g_old_rec.attribute2                ,
1252   p_attribute3_o                 => hr_psf_shd.g_old_rec.attribute3                ,
1253   p_attribute4_o                 => hr_psf_shd.g_old_rec.attribute4                ,
1254   p_attribute5_o                 => hr_psf_shd.g_old_rec.attribute5                ,
1255   p_attribute6_o                 => hr_psf_shd.g_old_rec.attribute6                ,
1256   p_attribute7_o                 => hr_psf_shd.g_old_rec.attribute7                ,
1257   p_attribute8_o                 => hr_psf_shd.g_old_rec.attribute8                ,
1258   p_attribute9_o                 => hr_psf_shd.g_old_rec.attribute9                ,
1259   p_attribute10_o                => hr_psf_shd.g_old_rec.attribute10               ,
1260   p_attribute11_o                => hr_psf_shd.g_old_rec.attribute11               ,
1261   p_attribute12_o                => hr_psf_shd.g_old_rec.attribute12               ,
1262   p_attribute13_o                => hr_psf_shd.g_old_rec.attribute13               ,
1263   p_attribute14_o                => hr_psf_shd.g_old_rec.attribute14               ,
1264   p_attribute15_o                => hr_psf_shd.g_old_rec.attribute15               ,
1265   p_attribute16_o                => hr_psf_shd.g_old_rec.attribute16               ,
1266   p_attribute17_o                => hr_psf_shd.g_old_rec.attribute17               ,
1267   p_attribute18_o                => hr_psf_shd.g_old_rec.attribute18               ,
1268   p_attribute19_o                => hr_psf_shd.g_old_rec.attribute19               ,
1269   p_attribute20_o                => hr_psf_shd.g_old_rec.attribute20               ,
1270   p_attribute21_o                => hr_psf_shd.g_old_rec.attribute21               ,
1271   p_attribute22_o                => hr_psf_shd.g_old_rec.attribute22               ,
1272   p_attribute23_o                => hr_psf_shd.g_old_rec.attribute23               ,
1273   p_attribute24_o                => hr_psf_shd.g_old_rec.attribute24               ,
1274   p_attribute25_o                => hr_psf_shd.g_old_rec.attribute25               ,
1275   p_attribute26_o                => hr_psf_shd.g_old_rec.attribute26               ,
1276   p_attribute27_o                => hr_psf_shd.g_old_rec.attribute27               ,
1277   p_attribute28_o                => hr_psf_shd.g_old_rec.attribute28               ,
1278   p_attribute29_o                => hr_psf_shd.g_old_rec.attribute29               ,
1279   p_attribute30_o                => hr_psf_shd.g_old_rec.attribute30               ,
1280   p_attribute_category_o         => hr_psf_shd.g_old_rec.attribute_category        ,
1281   p_request_id_o                 => hr_psf_shd.g_old_rec.request_id                ,
1282   p_program_application_id_o     => hr_psf_shd.g_old_rec.program_application_id    ,
1283   p_program_id_o                 => hr_psf_shd.g_old_rec.program_id                ,
1284   p_program_update_date_o        => hr_psf_shd.g_old_rec.program_update_date       ,
1285   p_object_version_number_o      => hr_psf_shd.g_old_rec.object_version_number     );
1286   --
1287   exception
1288     when hr_api.cannot_find_prog_unit then
1289       hr_api.cannot_find_prog_unit_error
1290         (p_module_name => 'HR_ALL_POSITIONS'
1291         ,p_hook_type   => 'AU'
1292         );
1293   End;
1294   --
1295   --hr_psf_shd.position_wf_sync(p_rec.position_id , p_validation_start_date);
1296     hr_psf_shd.position_wf_sync(p_position_id => p_rec.position_id
1297                             , p_effective_date => p_validation_start_date
1298                             , p_action         => 'UPDATE'
1299                             , p_eff_start_date => p_rec.effective_start_date
1300                             , p_eff_end_date   => p_rec.effective_end_date );
1301   --
1302 if g_debug then
1303   hr_utility.set_location(' Leaving:'||l_proc, 10);
1304 end if;
1305 End post_update;
1306 --
1307 -- ----------------------------------------------------------------------------
1308 -- |-----------------------------< convert_defs >-----------------------------|
1309 -- ----------------------------------------------------------------------------
1310 -- {Start Of Comments}
1311 --
1312 -- Description:
1313 --   The Convert_Defs procedure has one very important function:
1314 --   It must return the record structure for the row with all system defaulted
1315 --   values converted into its corresponding parameter value for update. When
1316 --   we attempt to update a row through the Upd process , certain
1317 --   parameters can be defaulted which enables flexibility in the calling of
1318 --   the upd process (e.g. only attributes which need to be updated need to be
1319 --   specified). For the upd process to determine which attributes
1320 --   have NOT been specified we need to check if the parameter has a reserved
1321 --   system default value. Therefore, for all parameters which have a
1322 --   corresponding reserved system default mechanism specified we need to
1323 --   check if a system default is being used. If a system default is being
1324 --   used then we convert the defaulted value into its corresponding attribute
1325 --   value held in the g_old_rec data structure.
1326 --
1327 -- Prerequisites:
1328 --   This private function can only be called from the upd process.
1329 --
1330 -- In Parameters:
1331 --   A Pl/Sql record structre.
1332 --
1333 -- Post Success:
1334 --   The record structure will be returned with all system defaulted parameter
1335 --   values converted into its current row attribute value.
1336 --
1337 -- Post Failure:
1338 --   No direct error handling is required within this function. Any possible
1339 --   errors within this procedure will be a PL/SQL value error due to conversion
1340 
1341 --   of datatypes or data lengths.
1342 --
1343 -- Developer Implementation Notes:
1344 --   None.
1345 --
1346 -- Access Status:
1347 --   Internal Row Handler Use Only.
1348 --
1349 -- {End Of Comments}
1350 -- ----------------------------------------------------------------------------
1351 Procedure convert_defs(p_rec in out nocopy hr_psf_shd.g_rec_type) is
1352 --
1353   l_proc  varchar2(72) ;
1354 --
1355 Begin
1356   --
1357 if g_debug then
1358  l_proc   := g_package||'convert_defs';
1359   hr_utility.set_location('Entering:'||l_proc, 5);
1360 end if;
1361   --
1362   -- We must now examine each argument value in the
1363   -- p_rec plsql record structure
1364   -- to see if a system default is being used. If a system default
1365   -- is being used then we must set to the 'current' argument value.
1366   --
1367   If (p_rec.availability_status_id = hr_api.g_number) then
1368     p_rec.availability_status_id :=
1369     hr_psf_shd.g_old_rec.availability_status_id;
1370   End If;
1371   If (p_rec.business_group_id = hr_api.g_number) then
1372     p_rec.business_group_id :=
1373     hr_psf_shd.g_old_rec.business_group_id;
1374   End If;
1375   If (p_rec.entry_step_id = hr_api.g_number) then
1376     p_rec.entry_step_id :=
1377     hr_psf_shd.g_old_rec.entry_step_id;
1378   End If;
1379   If (p_rec.entry_grade_rule_id = hr_api.g_number) then
1380     p_rec.entry_grade_rule_id :=
1381     hr_psf_shd.g_old_rec.entry_grade_rule_id;
1382   End If;
1383   If (p_rec.job_id = hr_api.g_number) then
1384     p_rec.job_id :=
1385     hr_psf_shd.g_old_rec.job_id;
1386   End If;
1387   If (p_rec.location_id = hr_api.g_number) then
1388     p_rec.location_id :=
1389     hr_psf_shd.g_old_rec.location_id;
1390   End If;
1391   If (p_rec.organization_id = hr_api.g_number) then
1392     p_rec.organization_id :=
1393     hr_psf_shd.g_old_rec.organization_id;
1394   End If;
1395   If (p_rec.pay_freq_payroll_id = hr_api.g_number) then
1396     p_rec.pay_freq_payroll_id :=
1397     hr_psf_shd.g_old_rec.pay_freq_payroll_id;
1398   End If;
1399   If (p_rec.position_definition_id = hr_api.g_number) then
1400     p_rec.position_definition_id :=
1401     hr_psf_shd.g_old_rec.position_definition_id;
1402   End If;
1403   If (p_rec.position_transaction_id = hr_api.g_number) then
1404     p_rec.position_transaction_id :=
1405     hr_psf_shd.g_old_rec.position_transaction_id;
1406   End If;
1407   If (p_rec.prior_position_id = hr_api.g_number) then
1408     p_rec.prior_position_id :=
1409     hr_psf_shd.g_old_rec.prior_position_id;
1410   End If;
1411   If (p_rec.relief_position_id = hr_api.g_number) then
1412     p_rec.relief_position_id :=
1413     hr_psf_shd.g_old_rec.relief_position_id;
1414   End If;
1415   If (p_rec.entry_grade_id = hr_api.g_number) then
1416     p_rec.entry_grade_id :=
1417     hr_psf_shd.g_old_rec.entry_grade_id;
1418   End If;
1419   If (p_rec.successor_position_id = hr_api.g_number) then
1420     p_rec.successor_position_id :=
1421     hr_psf_shd.g_old_rec.successor_position_id;
1422   End If;
1423   If (p_rec.supervisor_position_id = hr_api.g_number) then
1424     p_rec.supervisor_position_id :=
1425     hr_psf_shd.g_old_rec.supervisor_position_id;
1426   End If;
1427   If (p_rec.amendment_date = hr_api.g_date) then
1428     p_rec.amendment_date :=
1429     hr_psf_shd.g_old_rec.amendment_date;
1430   End If;
1431   If (p_rec.amendment_recommendation = hr_api.g_varchar2) then
1432     p_rec.amendment_recommendation :=
1433     hr_psf_shd.g_old_rec.amendment_recommendation;
1434   End If;
1435   If (p_rec.amendment_ref_number = hr_api.g_varchar2) then
1436     p_rec.amendment_ref_number :=
1437     hr_psf_shd.g_old_rec.amendment_ref_number;
1438   End If;
1439   If (p_rec.bargaining_unit_cd = hr_api.g_varchar2) then
1440     p_rec.bargaining_unit_cd :=
1441     hr_psf_shd.g_old_rec.bargaining_unit_cd;
1442   End If;
1443   If (p_rec.comments = hr_api.g_varchar2) then
1444     p_rec.comments :=
1445     hr_psf_shd.g_old_rec.comments;
1446   End If;
1447   If (p_rec.current_job_prop_end_date = hr_api.g_date) then
1448     p_rec.current_job_prop_end_date :=
1449     hr_psf_shd.g_old_rec.current_job_prop_end_date;
1450   End If;
1451   If (p_rec.current_org_prop_end_date = hr_api.g_date) then
1452     p_rec.current_org_prop_end_date :=
1453     hr_psf_shd.g_old_rec.current_org_prop_end_date;
1454   End If;
1455   If (p_rec.avail_status_prop_end_date = hr_api.g_date) then
1456     p_rec.avail_status_prop_end_date :=
1457     hr_psf_shd.g_old_rec.avail_status_prop_end_date;
1458   End If;
1459   If (p_rec.date_effective = hr_api.g_date) then
1460     p_rec.date_effective :=
1461     hr_psf_shd.g_old_rec.date_effective;
1462   End If;
1463   If (p_rec.date_end = hr_api.g_date) then
1464     p_rec.date_end :=
1465     hr_psf_shd.g_old_rec.date_end;
1466   End If;
1467   If (p_rec.earliest_hire_date = hr_api.g_date) then
1468     p_rec.earliest_hire_date :=
1469     hr_psf_shd.g_old_rec.earliest_hire_date;
1470   End If;
1471   If (p_rec.fill_by_date = hr_api.g_date) then
1472     p_rec.fill_by_date :=
1473     hr_psf_shd.g_old_rec.fill_by_date;
1474   End If;
1475   If (p_rec.frequency = hr_api.g_varchar2) then
1476     p_rec.frequency :=
1477     hr_psf_shd.g_old_rec.frequency;
1478   End If;
1479   If (p_rec.fte = hr_api.g_number) then
1480     p_rec.fte :=
1481     hr_psf_shd.g_old_rec.fte;
1482   End If;
1483   If (p_rec.max_persons = hr_api.g_number) then
1484     p_rec.max_persons :=
1485     hr_psf_shd.g_old_rec.max_persons;
1486   End If;
1487   If (p_rec.name = hr_api.g_varchar2) then
1488     p_rec.name :=
1489     hr_psf_shd.g_old_rec.name;
1490   End If;
1491   If (p_rec.overlap_period = hr_api.g_number) then
1492     p_rec.overlap_period :=
1493     hr_psf_shd.g_old_rec.overlap_period;
1494   End If;
1495   If (p_rec.overlap_unit_cd = hr_api.g_varchar2) then
1496     p_rec.overlap_unit_cd :=
1497     hr_psf_shd.g_old_rec.overlap_unit_cd;
1498   End If;
1499   If (p_rec.pay_term_end_day_cd = hr_api.g_varchar2) then
1500     p_rec.pay_term_end_day_cd :=
1501     hr_psf_shd.g_old_rec.pay_term_end_day_cd;
1502   End If;
1503   If (p_rec.pay_term_end_month_cd = hr_api.g_varchar2) then
1504     p_rec.pay_term_end_month_cd :=
1505     hr_psf_shd.g_old_rec.pay_term_end_month_cd;
1506   End If;
1507   If (p_rec.permanent_temporary_flag = hr_api.g_varchar2) then
1508     p_rec.permanent_temporary_flag :=
1509     hr_psf_shd.g_old_rec.permanent_temporary_flag;
1510   End If;
1511   If (p_rec.permit_recruitment_flag = hr_api.g_varchar2) then
1512     p_rec.permit_recruitment_flag :=
1513     hr_psf_shd.g_old_rec.permit_recruitment_flag;
1514   End If;
1515   If (p_rec.position_type = hr_api.g_varchar2) then
1516     p_rec.position_type :=
1517     hr_psf_shd.g_old_rec.position_type;
1518   End If;
1519   If (p_rec.posting_description = hr_api.g_varchar2) then
1520     p_rec.posting_description :=
1521     hr_psf_shd.g_old_rec.posting_description;
1522   End If;
1523   If (p_rec.probation_period = hr_api.g_number) then
1524     p_rec.probation_period :=
1525     hr_psf_shd.g_old_rec.probation_period;
1526   End If;
1527   If (p_rec.probation_period_unit_cd = hr_api.g_varchar2) then
1528     p_rec.probation_period_unit_cd :=
1529     hr_psf_shd.g_old_rec.probation_period_unit_cd;
1530   End If;
1531   If (p_rec.replacement_required_flag = hr_api.g_varchar2) then
1532     p_rec.replacement_required_flag :=
1533     hr_psf_shd.g_old_rec.replacement_required_flag;
1534   End If;
1535   If (p_rec.review_flag = hr_api.g_varchar2) then
1536     p_rec.review_flag :=
1537     hr_psf_shd.g_old_rec.review_flag;
1538   End If;
1539   If (p_rec.seasonal_flag = hr_api.g_varchar2) then
1540     p_rec.seasonal_flag :=
1541     hr_psf_shd.g_old_rec.seasonal_flag;
1542   End If;
1543   If (p_rec.security_requirements = hr_api.g_varchar2) then
1544     p_rec.security_requirements :=
1545     hr_psf_shd.g_old_rec.security_requirements;
1546   End If;
1547   If (p_rec.status = hr_api.g_varchar2) then
1548     p_rec.status :=
1549     hr_psf_shd.g_old_rec.status;
1550   End If;
1551   If (p_rec.term_start_day_cd = hr_api.g_varchar2) then
1552     p_rec.term_start_day_cd :=
1553     hr_psf_shd.g_old_rec.term_start_day_cd;
1554   End If;
1555   If (p_rec.term_start_month_cd = hr_api.g_varchar2) then
1556     p_rec.term_start_month_cd :=
1557     hr_psf_shd.g_old_rec.term_start_month_cd;
1558   End If;
1559   If (p_rec.time_normal_finish = hr_api.g_varchar2) then
1560     p_rec.time_normal_finish :=
1561     hr_psf_shd.g_old_rec.time_normal_finish;
1562   End If;
1563   If (p_rec.time_normal_start = hr_api.g_varchar2) then
1564     p_rec.time_normal_start :=
1565     hr_psf_shd.g_old_rec.time_normal_start;
1566   End If;
1567   If (p_rec.update_source_cd = hr_api.g_varchar2) then
1568     p_rec.update_source_cd :=
1569     hr_psf_shd.g_old_rec.update_source_cd;
1570   End If;
1571   If (p_rec.working_hours = hr_api.g_number) then
1572     p_rec.working_hours :=
1573     hr_psf_shd.g_old_rec.working_hours;
1574   End If;
1575   If (p_rec.works_council_approval_flag = hr_api.g_varchar2) then
1576     p_rec.works_council_approval_flag :=
1577     hr_psf_shd.g_old_rec.works_council_approval_flag;
1578   End If;
1579   If (p_rec.work_period_type_cd = hr_api.g_varchar2) then
1580     p_rec.work_period_type_cd :=
1581     hr_psf_shd.g_old_rec.work_period_type_cd;
1582   End If;
1583   If (p_rec.work_term_end_day_cd = hr_api.g_varchar2) then
1584     p_rec.work_term_end_day_cd :=
1585     hr_psf_shd.g_old_rec.work_term_end_day_cd;
1586   End If;
1587   If (p_rec.work_term_end_month_cd = hr_api.g_varchar2) then
1588     p_rec.work_term_end_month_cd :=
1589     hr_psf_shd.g_old_rec.work_term_end_month_cd;
1590   End If;
1591   If (p_rec.proposed_fte_for_layoff = hr_api.g_number) then
1592     p_rec.proposed_fte_for_layoff :=
1593     hr_psf_shd.g_old_rec.proposed_fte_for_layoff;
1594   End If;
1595   If (p_rec.proposed_date_for_layoff = hr_api.g_date) then
1596     p_rec.proposed_date_for_layoff :=
1597     hr_psf_shd.g_old_rec.proposed_date_for_layoff;
1598   End If;
1599   If (p_rec.pay_basis_id = hr_api.g_number) then
1600     p_rec.pay_basis_id :=
1601     hr_psf_shd.g_old_rec.pay_basis_id;
1602   End If;
1603   If (p_rec.supervisor_id = hr_api.g_number) then
1604     p_rec.supervisor_id :=
1605     hr_psf_shd.g_old_rec.supervisor_id;
1606   End If;
1607   If (p_rec.copied_to_old_table_flag = hr_api.g_varchar2) then
1608     p_rec.copied_to_old_table_flag :=
1609     hr_psf_shd.g_old_rec.copied_to_old_table_flag;
1610   End If;
1611   If (p_rec.information1 = hr_api.g_varchar2) then
1612     p_rec.information1 :=
1613     hr_psf_shd.g_old_rec.information1;
1614   End If;
1615   If (p_rec.information2 = hr_api.g_varchar2) then
1616     p_rec.information2 :=
1617     hr_psf_shd.g_old_rec.information2;
1618   End If;
1619   If (p_rec.information3 = hr_api.g_varchar2) then
1620     p_rec.information3 :=
1621     hr_psf_shd.g_old_rec.information3;
1622   End If;
1623   If (p_rec.information4 = hr_api.g_varchar2) then
1624     p_rec.information4 :=
1625     hr_psf_shd.g_old_rec.information4;
1626   End If;
1627   If (p_rec.information5 = hr_api.g_varchar2) then
1628     p_rec.information5 :=
1629     hr_psf_shd.g_old_rec.information5;
1630   End If;
1631   If (p_rec.information6 = hr_api.g_varchar2) then
1632     p_rec.information6 :=
1633     hr_psf_shd.g_old_rec.information6;
1634   End If;
1635   If (p_rec.information7 = hr_api.g_varchar2) then
1636     p_rec.information7 :=
1637     hr_psf_shd.g_old_rec.information7;
1638   End If;
1639   If (p_rec.information8 = hr_api.g_varchar2) then
1640     p_rec.information8 :=
1641     hr_psf_shd.g_old_rec.information8;
1642   End If;
1643   If (p_rec.information9 = hr_api.g_varchar2) then
1644     p_rec.information9 :=
1645     hr_psf_shd.g_old_rec.information9;
1646   End If;
1647   If (p_rec.information10 = hr_api.g_varchar2) then
1648     p_rec.information10 :=
1649     hr_psf_shd.g_old_rec.information10;
1650   End If;
1651   If (p_rec.information11 = hr_api.g_varchar2) then
1652     p_rec.information11 :=
1653     hr_psf_shd.g_old_rec.information11;
1654   End If;
1655   If (p_rec.information12 = hr_api.g_varchar2) then
1656     p_rec.information12 :=
1657     hr_psf_shd.g_old_rec.information12;
1658   End If;
1659   If (p_rec.information13 = hr_api.g_varchar2) then
1660     p_rec.information13 :=
1661     hr_psf_shd.g_old_rec.information13;
1662   End If;
1663   If (p_rec.information14 = hr_api.g_varchar2) then
1664     p_rec.information14 :=
1665     hr_psf_shd.g_old_rec.information14;
1666   End If;
1667   If (p_rec.information15 = hr_api.g_varchar2) then
1668     p_rec.information15 :=
1669     hr_psf_shd.g_old_rec.information15;
1670   End If;
1671   If (p_rec.information16 = hr_api.g_varchar2) then
1672     p_rec.information16 :=
1673     hr_psf_shd.g_old_rec.information16;
1674   End If;
1675   If (p_rec.information17 = hr_api.g_varchar2) then
1676     p_rec.information17 :=
1677     hr_psf_shd.g_old_rec.information17;
1678   End If;
1679   If (p_rec.information18 = hr_api.g_varchar2) then
1680     p_rec.information18 :=
1681     hr_psf_shd.g_old_rec.information18;
1682   End If;
1683   If (p_rec.information19 = hr_api.g_varchar2) then
1684     p_rec.information19 :=
1685     hr_psf_shd.g_old_rec.information19;
1686   End If;
1687   If (p_rec.information20 = hr_api.g_varchar2) then
1688     p_rec.information20 :=
1689     hr_psf_shd.g_old_rec.information20;
1690   End If;
1691   If (p_rec.information21 = hr_api.g_varchar2) then
1692     p_rec.information21 :=
1693     hr_psf_shd.g_old_rec.information21;
1694   End If;
1695   If (p_rec.information22 = hr_api.g_varchar2) then
1696     p_rec.information22 :=
1697     hr_psf_shd.g_old_rec.information22;
1698   End If;
1699   If (p_rec.information23 = hr_api.g_varchar2) then
1700     p_rec.information23 :=
1701     hr_psf_shd.g_old_rec.information23;
1702   End If;
1703   If (p_rec.information24 = hr_api.g_varchar2) then
1704     p_rec.information24 :=
1705     hr_psf_shd.g_old_rec.information24;
1706   End If;
1707   If (p_rec.information25 = hr_api.g_varchar2) then
1708     p_rec.information25 :=
1709     hr_psf_shd.g_old_rec.information25;
1710   End If;
1711   If (p_rec.information26 = hr_api.g_varchar2) then
1712     p_rec.information26 :=
1713     hr_psf_shd.g_old_rec.information26;
1714   End If;
1715   If (p_rec.information27 = hr_api.g_varchar2) then
1716     p_rec.information27 :=
1717     hr_psf_shd.g_old_rec.information27;
1718   End If;
1719   If (p_rec.information28 = hr_api.g_varchar2) then
1720     p_rec.information28 :=
1721     hr_psf_shd.g_old_rec.information28;
1722   End If;
1723   If (p_rec.information29 = hr_api.g_varchar2) then
1724     p_rec.information29 :=
1725     hr_psf_shd.g_old_rec.information29;
1726   End If;
1727   If (p_rec.information30 = hr_api.g_varchar2) then
1728     p_rec.information30 :=
1729     hr_psf_shd.g_old_rec.information30;
1730   End If;
1731   If (p_rec.information_category = hr_api.g_varchar2) then
1732     p_rec.information_category :=
1733     hr_psf_shd.g_old_rec.information_category;
1734   End If;
1735   If (p_rec.attribute1 = hr_api.g_varchar2) then
1736     p_rec.attribute1 :=
1737     hr_psf_shd.g_old_rec.attribute1;
1738   End If;
1739   If (p_rec.attribute2 = hr_api.g_varchar2) then
1740     p_rec.attribute2 :=
1741     hr_psf_shd.g_old_rec.attribute2;
1742   End If;
1743   If (p_rec.attribute3 = hr_api.g_varchar2) then
1744     p_rec.attribute3 :=
1745     hr_psf_shd.g_old_rec.attribute3;
1746   End If;
1747   If (p_rec.attribute4 = hr_api.g_varchar2) then
1748     p_rec.attribute4 :=
1749     hr_psf_shd.g_old_rec.attribute4;
1750   End If;
1751   If (p_rec.attribute5 = hr_api.g_varchar2) then
1752     p_rec.attribute5 :=
1753     hr_psf_shd.g_old_rec.attribute5;
1754   End If;
1755   If (p_rec.attribute6 = hr_api.g_varchar2) then
1756     p_rec.attribute6 :=
1757     hr_psf_shd.g_old_rec.attribute6;
1758   End If;
1759   If (p_rec.attribute7 = hr_api.g_varchar2) then
1760     p_rec.attribute7 :=
1761     hr_psf_shd.g_old_rec.attribute7;
1762   End If;
1763   If (p_rec.attribute8 = hr_api.g_varchar2) then
1764     p_rec.attribute8 :=
1765     hr_psf_shd.g_old_rec.attribute8;
1766   End If;
1767   If (p_rec.attribute9 = hr_api.g_varchar2) then
1768     p_rec.attribute9 :=
1769     hr_psf_shd.g_old_rec.attribute9;
1770   End If;
1771   If (p_rec.attribute10 = hr_api.g_varchar2) then
1772     p_rec.attribute10 :=
1773     hr_psf_shd.g_old_rec.attribute10;
1774   End If;
1775   If (p_rec.attribute11 = hr_api.g_varchar2) then
1776     p_rec.attribute11 :=
1777     hr_psf_shd.g_old_rec.attribute11;
1778   End If;
1779   If (p_rec.attribute12 = hr_api.g_varchar2) then
1780     p_rec.attribute12 :=
1781     hr_psf_shd.g_old_rec.attribute12;
1782   End If;
1783   If (p_rec.attribute13 = hr_api.g_varchar2) then
1784     p_rec.attribute13 :=
1785     hr_psf_shd.g_old_rec.attribute13;
1786   End If;
1787   If (p_rec.attribute14 = hr_api.g_varchar2) then
1788     p_rec.attribute14 :=
1789     hr_psf_shd.g_old_rec.attribute14;
1790   End If;
1791   If (p_rec.attribute15 = hr_api.g_varchar2) then
1792     p_rec.attribute15 :=
1793     hr_psf_shd.g_old_rec.attribute15;
1794   End If;
1795   If (p_rec.attribute16 = hr_api.g_varchar2) then
1796     p_rec.attribute16 :=
1797     hr_psf_shd.g_old_rec.attribute16;
1798   End If;
1799   If (p_rec.attribute17 = hr_api.g_varchar2) then
1800     p_rec.attribute17 :=
1801     hr_psf_shd.g_old_rec.attribute17;
1802   End If;
1803   If (p_rec.attribute18 = hr_api.g_varchar2) then
1804     p_rec.attribute18 :=
1805     hr_psf_shd.g_old_rec.attribute18;
1806   End If;
1807   If (p_rec.attribute19 = hr_api.g_varchar2) then
1808     p_rec.attribute19 :=
1809     hr_psf_shd.g_old_rec.attribute19;
1810   End If;
1811   If (p_rec.attribute20 = hr_api.g_varchar2) then
1812     p_rec.attribute20 :=
1813     hr_psf_shd.g_old_rec.attribute20;
1814   End If;
1815   If (p_rec.attribute21 = hr_api.g_varchar2) then
1816     p_rec.attribute21 :=
1817     hr_psf_shd.g_old_rec.attribute21;
1818   End If;
1819   If (p_rec.attribute22 = hr_api.g_varchar2) then
1820     p_rec.attribute22 :=
1821     hr_psf_shd.g_old_rec.attribute22;
1822   End If;
1823   If (p_rec.attribute23 = hr_api.g_varchar2) then
1824     p_rec.attribute23 :=
1825     hr_psf_shd.g_old_rec.attribute23;
1826   End If;
1827   If (p_rec.attribute24 = hr_api.g_varchar2) then
1828     p_rec.attribute24 :=
1829     hr_psf_shd.g_old_rec.attribute24;
1830   End If;
1831   If (p_rec.attribute25 = hr_api.g_varchar2) then
1832     p_rec.attribute25 :=
1833     hr_psf_shd.g_old_rec.attribute25;
1834   End If;
1835   If (p_rec.attribute26 = hr_api.g_varchar2) then
1836     p_rec.attribute26 :=
1837     hr_psf_shd.g_old_rec.attribute26;
1838   End If;
1839   If (p_rec.attribute27 = hr_api.g_varchar2) then
1840     p_rec.attribute27 :=
1841     hr_psf_shd.g_old_rec.attribute27;
1842   End If;
1843   If (p_rec.attribute28 = hr_api.g_varchar2) then
1844     p_rec.attribute28 :=
1845     hr_psf_shd.g_old_rec.attribute28;
1846   End If;
1847   If (p_rec.attribute29 = hr_api.g_varchar2) then
1848     p_rec.attribute29 :=
1849     hr_psf_shd.g_old_rec.attribute29;
1850   End If;
1851   If (p_rec.attribute30 = hr_api.g_varchar2) then
1852     p_rec.attribute30 :=
1853     hr_psf_shd.g_old_rec.attribute30;
1854   End If;
1855   If (p_rec.attribute_category = hr_api.g_varchar2) then
1856     p_rec.attribute_category :=
1857     hr_psf_shd.g_old_rec.attribute_category;
1858   End If;
1859   If (p_rec.request_id = hr_api.g_number) then
1860     p_rec.request_id :=
1861     hr_psf_shd.g_old_rec.request_id;
1862   End If;
1863   If (p_rec.program_application_id = hr_api.g_number) then
1864     p_rec.program_application_id :=
1865     hr_psf_shd.g_old_rec.program_application_id;
1866   End If;
1867   If (p_rec.program_id = hr_api.g_number) then
1868     p_rec.program_id :=
1869     hr_psf_shd.g_old_rec.program_id;
1870   End If;
1871   If (p_rec.program_update_date = hr_api.g_date) then
1872     p_rec.program_update_date :=
1873     hr_psf_shd.g_old_rec.program_update_date;
1874   End If;
1875 
1876   --
1877 if g_debug then
1878   hr_utility.set_location(' Leaving:'||l_proc, 10);
1879 end if;
1880 --
1881 End convert_defs;
1882 --
1883 -- ----------------------------------------------------------------------------
1884 -- |---------------------------------< upd >----------------------------------|
1885 -- ----------------------------------------------------------------------------
1886 Procedure upd
1887   (
1888   p_rec        in out nocopy  hr_psf_shd.g_rec_type,
1889   p_effective_date   in    date,
1890   p_datetrack_mode   in    varchar2,
1891   p_validate            in      boolean  default false
1892   ) is
1893 --
1894   l_proc       varchar2(72) ;
1895   l_validation_start_date  date;
1896   l_validation_end_date    date;
1897 --
1898 Begin
1899 g_debug := hr_utility.debug_enabled;
1900  if g_debug then
1901  l_proc         := g_package||'upd (rec)';
1902   hr_utility.set_location('Entering:'||l_proc, 5);
1903   hr_utility.set_location('ovn 1is: '||to_char(p_rec.object_version_number)||l_proc, 5);
1904 end if;
1905   --
1906   -- Ensure that the DateTrack update mode is valid
1907   --
1908   dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode);
1909   --
1910   If p_validate then
1911     --
1912     -- Issue the savepoint.
1913     --
1914     SAVEPOINT upd_per_per;
1915   End If;
1916   --
1917   --
1918   -- We must lock the row which we need to update.
1919   --
1920   hr_psf_shd.lck
1921    (p_effective_date  => p_effective_date,
1922           p_datetrack_mode  => p_datetrack_mode,
1923           p_position_id  => p_rec.position_id,
1924           p_object_version_number => p_rec.object_version_number,
1925           p_validation_start_date => l_validation_start_date,
1926           p_validation_end_date   => l_validation_end_date);
1927 if g_debug then
1928   hr_utility.set_location('ovn 2 is: '||to_char(p_rec.object_version_number)||l_proc, 5);
1929 end if;
1930   --
1931   -- 1. During an update system defaults are used to determine if
1932   --    arguments have been defaulted or not. We must therefore
1933   --    derive the full record structure values to be updated.
1934   --
1935   -- 2. Call the supporting update validate operations.
1936   --
1937   convert_defs(p_rec);
1938   -- hr_utility.set_location('ovn 3 is: '||to_char(p_rec.object_version_number)||l_proc, 5);
1939   --
1940   -- date effective is changed based on the status change
1941   --
1942   update_date_effective
1943    (p_rec                   => p_rec
1944    ,p_datetrack_mode        => p_datetrack_mode
1945    ,p_effective_date        => p_effective_date
1946    ,p_validation_start_date => l_validation_start_date
1947    ,p_validation_end_date   => l_validation_end_date);
1948 if g_debug then
1949   hr_utility.set_location('ovn 4 is: '||to_char(p_rec.object_version_number)||l_proc, 5);
1950 end if;
1951   if (not per_refresh_position.refreshing_position) then
1952     if g_debug then
1953       hr_utility.set_location('VALIDATING POSITION :'||l_proc, 5);
1954     end if;
1955     --
1956     -- validations are performed based on the new date effective
1957     --
1958     hr_psf_bus.update_validate
1959     (p_rec          => p_rec,
1960      p_effective_date  => p_effective_date,
1961      p_datetrack_mode     => p_datetrack_mode,
1962      p_validation_start_date => l_validation_start_date,
1963      p_validation_end_date   => l_validation_end_date);
1964   end if;
1965 if g_debug then
1966   hr_utility.set_location('ovn 5 is: '||to_char(p_rec.object_version_number)||l_proc, 5);
1967 end if;
1968   --
1969   -- Call the supporting pre-update operation
1970   --
1971   pre_update
1972    (p_rec          => p_rec,
1973     p_effective_date  => p_effective_date,
1974     p_datetrack_mode  => p_datetrack_mode,
1975     p_validation_start_date => l_validation_start_date,
1976     p_validation_end_date   => l_validation_end_date);
1977 if g_debug then
1978   hr_utility.set_location('ovn 6 is: '||to_char(p_rec.object_version_number)||l_proc, 5);
1979 
1980   hr_utility.set_location('p_validation_start_date '
1981             || to_char(l_validation_start_date) || ' ' || l_proc, 100);
1982 end if;
1983   --
1984   -- Update the row.
1985   --
1986   update_dml
1987    (p_rec          => p_rec,
1988     p_effective_date  => p_effective_date,
1989     p_datetrack_mode  => p_datetrack_mode,
1990     p_validation_start_date => l_validation_start_date,
1991     p_validation_end_date   => l_validation_end_date);
1992 if g_debug then
1993   hr_utility.set_location('ovn 7 is: '||to_char(p_rec.object_version_number)||l_proc, 5);
1994   hr_utility.set_location('p_validation_start_date '
1995             || to_char(l_validation_start_date) || ' ' || l_proc, 110);
1996 end if;
1997   --
1998   -- Call the supporting post-update operation
1999   --
2000   post_update
2001    (p_rec          => p_rec,
2002     p_effective_date  => p_effective_date,
2003     p_datetrack_mode  => p_datetrack_mode,
2004     p_validation_start_date => l_validation_start_date,
2005     p_validation_end_date   => l_validation_end_date);
2006 if g_debug then
2007   hr_utility.set_location('p_validation_start_date '
2008             || to_char(l_validation_start_date) || ' ' || l_proc, 120);
2009   hr_utility.set_location('ovn 8 is: '||to_char(p_rec.object_version_number)||l_proc, 5);
2010   end if;
2011   --
2012   -- If we are validating then raise the Validate_Enabled exception
2013   --
2014   If p_validate then
2015   if g_debug then
2016      hr_utility.set_location('p_validation_start_date '
2017             || to_char(l_validation_start_date) || ' ' || l_proc, 120);
2018 end if;
2019     Raise HR_Api.Validate_Enabled;
2020   else
2021   if g_debug then
2022      hr_utility.set_location('p_validation_start_date '
2023             || to_char(l_validation_start_date) || ' ' || l_proc, 120);
2024 end if;
2025   End If;
2026   --
2027   if g_debug then
2028   hr_utility.set_location(' Leaving:'||l_proc, 10);
2029   end if;
2030 Exception
2031   When HR_Api.Validate_Enabled Then
2032     --
2033     -- As the Validate_Enabled exception has been raised
2034     -- we must rollback to the savepoint
2035     --
2036     ROLLBACK TO upd_per_per;
2037 
2038 End upd;
2039 -- ----------------------------------------------------------------------------
2040 -- |---------------------------------< upd >----------------------------------|
2041 -- ----------------------------------------------------------------------------
2042 Procedure upd
2043   (
2044   p_position_id                  in number,
2045   p_effective_start_date         out nocopy date,
2046   p_effective_end_date           out nocopy date,
2047   p_availability_status_id       in number           default hr_api.g_number,
2048 --  p_business_group_id            in number           default hr_api.g_number,
2049   p_entry_step_id                in number           default hr_api.g_number,
2050   p_entry_grade_rule_id          in number           default hr_api.g_number,
2051 --  p_job_id                       in number           default hr_api.g_number,
2052   p_location_id                  in number           default hr_api.g_number,
2053 --  p_organization_id              in number           default hr_api.g_number,
2054   p_pay_freq_payroll_id          in number           default hr_api.g_number,
2055   p_position_definition_id       in number           default hr_api.g_number,
2056   p_position_transaction_id      in number           default hr_api.g_number,
2057   p_prior_position_id            in number           default hr_api.g_number,
2058   p_relief_position_id           in number           default hr_api.g_number,
2059   p_entry_grade_id               in number           default hr_api.g_number,
2060   p_successor_position_id        in number           default hr_api.g_number,
2061   p_supervisor_position_id       in number           default hr_api.g_number,
2062   p_amendment_date               in date             default hr_api.g_date,
2063   p_amendment_recommendation     in varchar2         default hr_api.g_varchar2,
2064   p_amendment_ref_number         in varchar2         default hr_api.g_varchar2,
2065   p_bargaining_unit_cd           in varchar2         default hr_api.g_varchar2,
2066   p_comments                     in varchar2         default hr_api.g_varchar2,
2067   p_current_job_prop_end_date    in date             default hr_api.g_date,
2068   p_current_org_prop_end_date    in date             default hr_api.g_date,
2069   p_avail_status_prop_end_date   in date             default hr_api.g_date,
2070   p_date_effective               in date             default hr_api.g_date,
2071   p_date_end                     in date             default hr_api.g_date,
2072   p_earliest_hire_date           in date             default hr_api.g_date,
2073   p_fill_by_date                 in date             default hr_api.g_date,
2074   p_frequency                    in varchar2         default hr_api.g_varchar2,
2075   p_fte                          in number           default hr_api.g_number,
2076   p_max_persons                  in number           default hr_api.g_number,
2077   p_name                         in varchar2         default hr_api.g_varchar2,
2078   p_overlap_period               in number           default hr_api.g_number,
2079   p_overlap_unit_cd              in varchar2         default hr_api.g_varchar2,
2080   p_pay_term_end_day_cd          in varchar2         default hr_api.g_varchar2,
2081   p_pay_term_end_month_cd        in varchar2         default hr_api.g_varchar2,
2082   p_permanent_temporary_flag     in varchar2         default hr_api.g_varchar2,
2083   p_permit_recruitment_flag      in varchar2         default hr_api.g_varchar2,
2084   p_position_type                in varchar2         default hr_api.g_varchar2,
2085   p_posting_description          in varchar2         default hr_api.g_varchar2,
2086   p_probation_period             in number           default hr_api.g_number,
2087   p_probation_period_unit_cd     in varchar2         default hr_api.g_varchar2,
2088   p_replacement_required_flag    in varchar2         default hr_api.g_varchar2,
2089   p_review_flag                  in varchar2         default hr_api.g_varchar2,
2090   p_seasonal_flag                in varchar2         default hr_api.g_varchar2,
2091   p_security_requirements        in varchar2         default hr_api.g_varchar2,
2092   p_status                       in varchar2         default hr_api.g_varchar2,
2093   p_term_start_day_cd            in varchar2         default hr_api.g_varchar2,
2094   p_term_start_month_cd          in varchar2         default hr_api.g_varchar2,
2095   p_time_normal_finish           in varchar2         default hr_api.g_varchar2,
2096   p_time_normal_start            in varchar2         default hr_api.g_varchar2,
2097   p_update_source_cd             in varchar2         default hr_api.g_varchar2,
2098   p_working_hours                in number           default hr_api.g_number,
2099   p_works_council_approval_flag  in varchar2         default hr_api.g_varchar2,
2100   p_work_period_type_cd          in varchar2         default hr_api.g_varchar2,
2101   p_work_term_end_day_cd         in varchar2         default hr_api.g_varchar2,
2102   p_work_term_end_month_cd       in varchar2         default hr_api.g_varchar2,
2103   p_proposed_fte_for_layoff      in number           default hr_api.g_number,
2104   p_proposed_date_for_layoff     in date             default hr_api.g_date,
2105   p_pay_basis_id                 in  number          default hr_api.g_number,
2106   p_supervisor_id                in  number          default hr_api.g_number,
2107   p_copied_to_old_table_flag     in  varchar2         default hr_api.g_varchar2,
2108   p_information1                 in varchar2         default hr_api.g_varchar2,
2109   p_information2                 in varchar2         default hr_api.g_varchar2,
2110   p_information3                 in varchar2         default hr_api.g_varchar2,
2111   p_information4                 in varchar2         default hr_api.g_varchar2,
2112   p_information5                 in varchar2         default hr_api.g_varchar2,
2113   p_information6                 in varchar2         default hr_api.g_varchar2,
2114   p_information7                 in varchar2         default hr_api.g_varchar2,
2115   p_information8                 in varchar2         default hr_api.g_varchar2,
2116   p_information9                 in varchar2         default hr_api.g_varchar2,
2117   p_information10                in varchar2         default hr_api.g_varchar2,
2118   p_information11                in varchar2         default hr_api.g_varchar2,
2119   p_information12                in varchar2         default hr_api.g_varchar2,
2120   p_information13                in varchar2         default hr_api.g_varchar2,
2121   p_information14                in varchar2         default hr_api.g_varchar2,
2122   p_information15                in varchar2         default hr_api.g_varchar2,
2123   p_information16                in varchar2         default hr_api.g_varchar2,
2124   p_information17                in varchar2         default hr_api.g_varchar2,
2125   p_information18                in varchar2         default hr_api.g_varchar2,
2126   p_information19                in varchar2         default hr_api.g_varchar2,
2127   p_information20                in varchar2         default hr_api.g_varchar2,
2128   p_information21                in varchar2         default hr_api.g_varchar2,
2129   p_information22                in varchar2         default hr_api.g_varchar2,
2130   p_information23                in varchar2         default hr_api.g_varchar2,
2131   p_information24                in varchar2         default hr_api.g_varchar2,
2132   p_information25                in varchar2         default hr_api.g_varchar2,
2133   p_information26                in varchar2         default hr_api.g_varchar2,
2134   p_information27                in varchar2         default hr_api.g_varchar2,
2135   p_information28                in varchar2         default hr_api.g_varchar2,
2136   p_information29                in varchar2         default hr_api.g_varchar2,
2137   p_information30                in varchar2         default hr_api.g_varchar2,
2138   p_information_category         in varchar2         default hr_api.g_varchar2,
2139   p_attribute1                   in varchar2         default hr_api.g_varchar2,
2140   p_attribute2                   in varchar2         default hr_api.g_varchar2,
2141   p_attribute3                   in varchar2         default hr_api.g_varchar2,
2142   p_attribute4                   in varchar2         default hr_api.g_varchar2,
2143   p_attribute5                   in varchar2         default hr_api.g_varchar2,
2144   p_attribute6                   in varchar2         default hr_api.g_varchar2,
2145   p_attribute7                   in varchar2         default hr_api.g_varchar2,
2146   p_attribute8                   in varchar2         default hr_api.g_varchar2,
2147   p_attribute9                   in varchar2         default hr_api.g_varchar2,
2148   p_attribute10                  in varchar2         default hr_api.g_varchar2,
2149   p_attribute11                  in varchar2         default hr_api.g_varchar2,
2150   p_attribute12                  in varchar2         default hr_api.g_varchar2,
2151   p_attribute13                  in varchar2         default hr_api.g_varchar2,
2152   p_attribute14                  in varchar2         default hr_api.g_varchar2,
2153   p_attribute15                  in varchar2         default hr_api.g_varchar2,
2154   p_attribute16                  in varchar2         default hr_api.g_varchar2,
2155   p_attribute17                  in varchar2         default hr_api.g_varchar2,
2156   p_attribute18                  in varchar2         default hr_api.g_varchar2,
2157   p_attribute19                  in varchar2         default hr_api.g_varchar2,
2158   p_attribute20                  in varchar2         default hr_api.g_varchar2,
2159   p_attribute21                  in varchar2         default hr_api.g_varchar2,
2160   p_attribute22                  in varchar2         default hr_api.g_varchar2,
2161   p_attribute23                  in varchar2         default hr_api.g_varchar2,
2162   p_attribute24                  in varchar2         default hr_api.g_varchar2,
2163   p_attribute25                  in varchar2         default hr_api.g_varchar2,
2164   p_attribute26                  in varchar2         default hr_api.g_varchar2,
2165   p_attribute27                  in varchar2         default hr_api.g_varchar2,
2166   p_attribute28                  in varchar2         default hr_api.g_varchar2,
2167   p_attribute29                  in varchar2         default hr_api.g_varchar2,
2168   p_attribute30                  in varchar2         default hr_api.g_varchar2,
2169   p_attribute_category           in varchar2         default hr_api.g_varchar2,
2170   p_request_id                   in number           default hr_api.g_number,
2171   p_program_application_id       in number           default hr_api.g_number,
2172   p_program_id                   in number           default hr_api.g_number,
2173   p_program_update_date          in date             default hr_api.g_date,
2174   p_object_version_number        in out nocopy number,
2175   p_effective_date       in date,
2176   p_datetrack_mode       in varchar2,
2177   p_validate                     in boolean  default false
2178   ) is
2179 --
2180   l_rec     hr_psf_shd.g_rec_type;
2181   l_proc varchar2(72) ;
2182 --
2183 Begin
2184 if g_debug then
2185    l_proc    :=  g_package||'upd';
2186    hr_utility.set_location('Entering:'||l_proc, 5);
2187 end if;
2188 
2189   --
2190   -- Call conversion function to turn arguments into the
2191   -- l_rec structure.
2192   --
2193   l_rec :=
2194   hr_psf_shd.convert_args
2195   (
2196   p_position_id,
2197   null,
2198   null,
2199   p_availability_status_id,
2200   hr_api.g_number,                          -- p_business_group_id,
2201   p_entry_step_id,
2202   p_entry_grade_rule_id,
2203   hr_api.g_number,                          -- p_job_id,
2204   p_location_id,
2205   hr_api.g_number ,                         -- p_organization_id,
2206   p_pay_freq_payroll_id,
2207   p_position_definition_id,
2208   p_position_transaction_id,
2209   p_prior_position_id,
2210   p_relief_position_id,
2211   p_entry_grade_id,
2212   p_successor_position_id,
2213   p_supervisor_position_id,
2214   p_amendment_date,
2215   p_amendment_recommendation,
2216   p_amendment_ref_number,
2217   p_bargaining_unit_cd,
2218   p_comments,
2219   p_current_job_prop_end_date,
2220   p_current_org_prop_end_date,
2221   p_avail_status_prop_end_date,
2222   p_date_effective,
2223   p_date_end,
2224   p_earliest_hire_date,
2225   p_fill_by_date,
2226   p_frequency,
2227   p_fte,
2228   p_max_persons,
2229   p_name,
2230   p_overlap_period,
2231   p_overlap_unit_cd,
2232   p_pay_term_end_day_cd,
2233   p_pay_term_end_month_cd,
2234   p_permanent_temporary_flag,
2235   p_permit_recruitment_flag,
2236   p_position_type,
2237   p_posting_description,
2238   p_probation_period,
2239   p_probation_period_unit_cd,
2240   p_replacement_required_flag,
2241   p_review_flag,
2242   p_seasonal_flag,
2243   p_security_requirements,
2244   p_status,
2245   p_term_start_day_cd,
2246   p_term_start_month_cd,
2247   p_time_normal_finish,
2248   p_time_normal_start,
2249   p_update_source_cd,
2250   p_working_hours,
2251   p_works_council_approval_flag,
2252   p_work_period_type_cd,
2253   p_work_term_end_day_cd,
2254   p_work_term_end_month_cd,
2255   p_proposed_fte_for_layoff,
2256   p_proposed_date_for_layoff,
2257   p_pay_basis_id,
2258   p_supervisor_id,
2259   p_copied_to_old_table_flag,
2260   p_information1,
2261   p_information2,
2262   p_information3,
2263   p_information4,
2264   p_information5,
2265   p_information6,
2266   p_information7,
2267   p_information8,
2268   p_information9,
2269   p_information10,
2270   p_information11,
2271   p_information12,
2272   p_information13,
2273   p_information14,
2274   p_information15,
2275   p_information16,
2276   p_information17,
2277   p_information18,
2278   p_information19,
2279   p_information20,
2280   p_information21,
2281   p_information22,
2282   p_information23,
2283   p_information24,
2284   p_information25,
2285   p_information26,
2286   p_information27,
2287   p_information28,
2288   p_information29,
2289   p_information30,
2290   p_information_category,
2291   p_attribute1,
2292   p_attribute2,
2293   p_attribute3,
2294   p_attribute4,
2295   p_attribute5,
2296   p_attribute6,
2297   p_attribute7,
2298   p_attribute8,
2299   p_attribute9,
2300   p_attribute10,
2301   p_attribute11,
2302   p_attribute12,
2303   p_attribute13,
2304   p_attribute14,
2305   p_attribute15,
2306   p_attribute16,
2307   p_attribute17,
2308   p_attribute18,
2309   p_attribute19,
2310   p_attribute20,
2311   p_attribute21,
2312   p_attribute22,
2313   p_attribute23,
2314   p_attribute24,
2315   p_attribute25,
2316   p_attribute26,
2317   p_attribute27,
2318   p_attribute28,
2319   p_attribute29,
2320   p_attribute30,
2321   p_attribute_category,
2322   p_request_id,
2323   p_program_application_id,
2324   p_program_id,
2325   p_program_update_date,
2326   p_object_version_number,
2327   null
2328   );
2329   --
2330   -- Having converted the arguments into the
2331   -- plsql record structure we call the corresponding record
2332   -- business process.
2333   --
2334   upd(l_rec, p_effective_date, p_datetrack_mode, p_validate);
2335   if g_debug then
2336   hr_utility.set_location('l_rec.effective_start_date '  || to_char(l_rec.effective_start_date) || ' ' || l_proc, 100);
2337  end if;
2338   p_object_version_number       := l_rec.object_version_number;
2339   p_effective_start_date        := l_rec.effective_start_date;
2340   p_effective_end_date          := l_rec.effective_end_date;
2341    if g_debug then
2342   hr_utility.set_location('p_effective_start_date ' || to_char(p_effective_start_date) || ' ' || l_proc, 100);
2343    hr_utility.set_location(' Leaving:'||l_proc, 10);
2344    end if;
2345   --
2346   --
2347 End upd;
2348 --
2349 end hr_psf_upd;