DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PEOPLE_PKG

Source


1 PACKAGE BODY PER_PEOPLE_PKG AS
2 /* $Header: peper01t.pkb 120.0 2005/05/31 13:31:01 appldev noship $ */
3 --
4 procedure insert_row(p_rowid in out nocopy VARCHAR2
5     ,p_person_id in out nocopy NUMBER
6     ,p_effective_start_date DATE
7     ,p_effective_end_date DATE
8     ,p_business_group_id NUMBER
9     ,p_person_type_id NUMBER
10     ,p_last_name VARCHAR2
11     ,p_start_date DATE
12     ,p_applicant_number IN OUT NOCOPY VARCHAR2
13     ,p_comment_id NUMBER
14     ,p_current_applicant_flag VARCHAR2
15     ,p_current_emp_or_apl_flag VARCHAR2
16     ,p_current_employee_flag VARCHAR2
17     ,p_date_employee_data_verified DATE
18     ,p_date_of_birth DATE
19     ,p_email_address VARCHAR2
20     ,p_employee_number IN OUT NOCOPY VARCHAR2
21     ,p_expense_check_send_to_addr VARCHAR2
22     ,p_first_name VARCHAR2
23     ,p_full_name VARCHAR2
24     ,p_known_as VARCHAR2
25     ,p_marital_status VARCHAR2
26     ,p_middle_names VARCHAR2
27     ,p_nationality VARCHAR2
28     ,p_national_identifier VARCHAR2
29     ,p_previous_last_name VARCHAR2
30     ,p_registered_disabled_flag VARCHAR2
31     ,p_sex VARCHAR2
32     ,p_title VARCHAR2
33    ,p_suffix VARCHAR2
34     ,p_vendor_id NUMBER
35     ,p_work_telephone VARCHAR2
36     ,p_request_id NUMBER
37     ,p_program_application_id NUMBER
38     ,p_program_id NUMBER
39     ,p_program_update_date DATE
40     ,p_a_cat VARCHAR2
41     ,p_a1 VARCHAR2
42     ,p_a2 VARCHAR2
43     ,p_a3 VARCHAR2
44     ,p_a4 VARCHAR2
45     ,p_a5 VARCHAR2
46     ,p_a6 VARCHAR2
47     ,p_a7 VARCHAR2
48     ,p_a8 VARCHAR2
49     ,p_a9 VARCHAR2
50     ,p_a10 VARCHAR2
51     ,p_a11 VARCHAR2
52     ,p_a12 VARCHAR2
53     ,p_a13 VARCHAR2
54     ,p_a14 VARCHAR2
55     ,p_a15 VARCHAR2
56     ,p_a16 VARCHAR2
57     ,p_a17 VARCHAR2
58     ,p_a18 VARCHAR2
59     ,p_a19 VARCHAR2
60     ,p_a20 VARCHAR2
61     ,p_a21 VARCHAR2
62     ,p_a22 VARCHAR2
63     ,p_a23 VARCHAR2
64     ,p_a24 VARCHAR2
65     ,p_a25 VARCHAR2
66     ,p_a26 VARCHAR2
67     ,p_a27 VARCHAR2
68     ,p_a28 VARCHAR2
69     ,p_a29 VARCHAR2
70     ,p_a30 VARCHAR2
71     ,p_last_update_date DATE
72     ,p_last_updated_by NUMBER
73     ,p_last_update_login NUMBER
74     ,p_created_by NUMBER
75     ,p_creation_date DATE
76     ,p_i_cat VARCHAR2
77     ,p_i1 VARCHAR2
78     ,p_i2 VARCHAR2
79     ,p_i3 VARCHAR2
80     ,p_i4 VARCHAR2
81     ,p_i5 VARCHAR2
82     ,p_i6 VARCHAR2
83     ,p_i7 VARCHAR2
84     ,p_i8 VARCHAR2
85     ,p_i9 VARCHAR2
86     ,p_i10 VARCHAR2
87     ,p_i11 VARCHAR2
88     ,p_i12 VARCHAR2
89     ,p_i13 VARCHAR2
90     ,p_i14 VARCHAR2
91     ,p_i15 VARCHAR2
92     ,p_i16 VARCHAR2
93     ,p_i17 VARCHAR2
94     ,p_i18 VARCHAR2
95     ,p_i19 VARCHAR2
96     ,p_i20 VARCHAR2
97     ,p_i21 VARCHAR2
98     ,p_i22 VARCHAR2
99     ,p_i23 VARCHAR2
100     ,p_i24 VARCHAR2
101     ,p_i25 VARCHAR2
102     ,p_i26 VARCHAR2
103     ,p_i27 VARCHAR2
104     ,p_i28 VARCHAR2
105     ,p_i29 VARCHAR2
106     ,p_i30 VARCHAR2
107     ,p_app_ass_status_type_id NUMBER
108     ,p_emp_ass_status_type_id NUMBER
109     ,p_create_defaults_for VARCHAR2
110     ,p_party_id number default null
111     ,p_blood_type            VARCHAR2 default NULL
112     ,p_correspondence_language VARCHAR2 default NULL
113     ,p_honors                 VARCHAR2 default NULL
114     ,p_pre_name_adjunct       VARCHAR2 default NULL
115     ,p_rehire_authorizor      VARCHAR2 default NULL
116     ,p_rehire_recommendation  VARCHAR2 default NULL
117     ,p_resume_exists          VARCHAR2 default NULL
118     ,p_resume_last_updated    DATE default NULL
119     ,p_second_passport_exists VARCHAR2 default NULL
120     ,p_student_status     VARCHAR2 default NULL
121     ,p_date_of_death      DATE default NULL
122     ,p_uses_tobacco_flag  VARCHAR2 default NULL
123     ,p_town_of_birth      VARCHAR2 default NULL
124     ,p_region_of_birth    VARCHAR2 default NULL
125     ,p_country_of_birth   VARCHAR2 default NULL
126     ,p_fast_path_employee VARCHAR2 default NULL
127     ,p_fte_capacity    VARCHAR2 default NULL) is
128 --
129 -- Define Cursor.
130 --
131 cursor c1 is select per_people_s.nextval
132              from sys.dual;
133 --
134 cursor c2 is select rowid
135             from   per_people_f
136             where  effective_start_date = p_effective_start_date
137             and    effective_end_date = p_effective_end_date
138             and    person_id = p_person_id;
139 cursor c_person is
140   select *
141   from   per_all_people_f
142   where  person_id = p_person_id
143   and    p_effective_start_date
144          between effective_start_date
145          and     effective_end_date;
146 
147 --
148 l_person per_all_people_f%rowtype;
149 --
150 l_phone_ovn        number;
151 l_phone_id         number;
152 l_person_type_id   number;
153 --
154 l_full_name        per_all_people_f.full_name%TYPE;
155 l_order_name       per_all_people_f.order_name%TYPE;
156 l_global_name      per_all_people_f.global_name%TYPE;
157 l_local_name       per_all_people_f.local_name%TYPE;
158 l_duplicate_flag   varchar2(10);
159 --
160 begin
161    l_phone_ovn      := NULL ;
162    l_phone_id       := NULL ;
163    l_person_type_id := p_person_type_id;
164    --
165    -- Test current numbers are not used by
166    -- the system already.
167    --
168    hr_person.validate_unique_number(p_person_id    => p_person_id
169                                 , p_business_group_id => p_business_group_id
170                                 , p_employee_number  => p_employee_number
171                                 , p_applicant_number => p_applicant_number
172                                 , p_npw_number       => null --p_npw_number
173                                 , p_current_employee => p_current_employee_flag
174                                 , p_current_applicant => p_current_applicant_flag
175                                 , p_current_npw       => null --p_current_npw_flag
176                                 );
177    -- #345205
178    -- A new person id is only selected from the sequence if the value passed is
179    -- not null already. This is used in Applicant Quick Entry when creating an
180    -- applicant with an initial status of TERM_APL - this requires two person
181    -- rows on successive days.
182    -- DK 27-FEB-96
183    if ( p_person_id is null ) then
184       open c1;
185       fetch c1 into p_person_id;
186       close c1;
187    end if;
188 
189   -- Verify party id, if one is passed in
190   if p_party_id is not null then
191     --
192     per_per_bus.chk_party_id
193       (p_person_id             => p_person_id
194       ,p_party_id              => p_party_id
195       ,p_effective_date        => p_effective_start_date
196       ,p_object_version_number => null);
197    end if;
198 --
199   -- Enh 3889584. Derive names
200   hr_person_name.derive_person_names -- #3889584
201     (p_format_name        =>  NULL, -- derive all person names
202      p_business_group_id  =>  p_business_group_id,
203      p_person_id          =>  p_person_id,
204      p_first_name         =>  p_first_name,
205      p_middle_names       =>  p_middle_names,
206      p_last_name          =>  p_last_name,
207      p_known_as           =>  p_known_as,
208      p_title              =>  p_title,
209      p_suffix             =>  p_suffix,
210      p_pre_name_adjunct   =>  p_pre_name_adjunct,
211      p_date_of_birth      =>  p_date_of_birth,
212      p_previous_last_name =>  p_previous_last_name ,
213      p_email_address     =>   p_email_address,
214      p_employee_number    =>  p_employee_number  ,
215      p_applicant_number   =>  p_applicant_number  ,
216      p_npw_number         =>  NULL,
217      p_per_information1   =>  p_i1  ,
218      p_per_information2   =>  p_i2  ,
219      p_per_information3   =>  p_i3  ,
220      p_per_information4   =>  p_i4  ,
221      p_per_information5   =>  p_i5  ,
222      p_per_information6   =>  p_i6  ,
223      p_per_information7   =>  p_i7  ,
224      p_per_information8   =>  p_i8  ,
225      p_per_information9   =>  p_i9  ,
226      p_per_information10  =>  p_i10  ,
227      p_per_information11  =>  p_i11  ,
228      p_per_information12  =>  p_i12  ,
229      p_per_information13  =>  p_i13  ,
230      p_per_information14  =>  p_i14  ,
231      p_per_information15  =>  p_i15  ,
232      p_per_information16  =>  p_i16  ,
233      p_per_information17  =>  p_i17  ,
234      p_per_information18  =>  p_i18  ,
235      p_per_information19  =>  p_i19  ,
236      p_per_information20  =>  p_i20  ,
237      p_per_information21  =>  p_i21  ,
238      p_per_information22  =>  p_i22  ,
239      p_per_information23  =>  p_i23  ,
240      p_per_information24  =>  p_i24  ,
241      p_per_information25  =>  p_i25  ,
242      p_per_information26  =>  p_i26  ,
243      p_per_information27  =>  p_i27  ,
244      p_per_information28  =>  p_i28  ,
245      p_per_information29  =>  p_i29  ,
246      p_per_information30  =>  p_i30  ,
247      p_attribute1         =>  p_a1  ,
248      p_attribute2         =>  p_a2  ,
249      p_attribute3         =>  p_a3  ,
250      p_attribute4         =>  p_a4  ,
251      p_attribute5         =>  p_a5  ,
252      p_attribute6         =>  p_a6  ,
253      p_attribute7         =>  p_a7  ,
254      p_attribute8         =>  p_a8  ,
255      p_attribute9         =>  p_a9  ,
256      p_attribute10        =>  p_a10  ,
257      p_attribute11        =>  p_a11  ,
258      p_attribute12        =>  p_a12  ,
259      p_attribute13        =>  p_a13  ,
260      p_attribute14        =>  p_a14  ,
261      p_attribute15        =>  p_a15  ,
262      p_attribute16        =>  p_a16  ,
263      p_attribute17        =>  p_a17  ,
264      p_attribute18        =>  p_a18  ,
265      p_attribute19        =>  p_a19  ,
266      p_attribute20        =>  p_a20  ,
267      p_attribute21        =>  p_a21  ,
268      p_attribute22        =>  p_a22  ,
269      p_attribute23        =>  p_a23,
270      p_attribute24        =>  p_a24,
271      p_attribute25        =>  p_a25,
272      p_attribute26        =>  p_a26,
273      p_attribute27        =>  p_a27,
274      p_attribute28        =>  p_a28,
275      p_attribute29        =>  p_a29,
276      p_attribute30        =>  p_a30,
277      p_full_name          =>  l_full_name,
278      p_order_name         =>  l_order_name,
279      p_global_name        =>  l_global_name,
280      p_local_name         =>  l_local_name,
281      p_duplicate_flag     =>  l_duplicate_flag);
282   --
283    insert into PER_PEOPLE_F
284     (person_id
285     ,party_id
286     ,effective_start_date
287     ,effective_end_date
288     ,business_group_id
289     ,person_type_id
290     ,last_name
291     ,start_date
292     ,applicant_number
293     ,comment_id
294     ,current_applicant_flag
295     ,current_emp_or_apl_flag
296     ,current_employee_flag
297     ,date_employee_data_verified
298     ,date_of_birth
299     ,email_address
300     ,employee_number
301     ,expense_check_send_to_address
302     ,first_name
303     ,full_name
304     ,known_as
305     ,marital_status
306     ,middle_names
307     ,nationality
308     ,national_identifier
309     ,previous_last_name
310     ,registered_disabled_flag
311     ,sex
312     ,title
313     ,suffix
314     ,vendor_id
315 --    ,work_telephone    -- Now done by the create_phone business process call
316     ,request_id
317     ,program_application_id
318     ,program_id
319     ,program_update_date
320     ,attribute_category
321     ,attribute1
322     ,attribute2
323     ,attribute3
324     ,attribute4
325     ,attribute5
326     ,attribute6
327     ,attribute7
328     ,attribute8
329     ,attribute9
330     ,attribute10
331     ,attribute11
332     ,attribute12
333     ,attribute13
334     ,attribute14
335     ,attribute15
336     ,attribute16
337     ,attribute17
338     ,attribute18
339     ,attribute19
340     ,attribute20
341     ,attribute21
342     ,attribute22
343     ,attribute23
344     ,attribute24
345     ,attribute25
346     ,attribute26
347     ,attribute27
348     ,attribute28
349     ,attribute29
350     ,attribute30
351     ,last_update_date
352     ,last_updated_by
353     ,last_update_login
354     ,created_by
355     ,creation_date
356     ,per_information_category
357     ,per_information1
358     ,per_information2
359     ,per_information3
360     ,per_information4
361     ,per_information5
362     ,per_information6
363     ,per_information7
364     ,per_information8
365     ,per_information9
366     ,per_information10
367     ,per_information11
368     ,per_information12
369     ,per_information13
370     ,per_information14
371     ,per_information15
372     ,per_information16
373     ,per_information17
374     ,per_information18
375     ,per_information19
376     ,per_information20
377     ,per_information21
378     ,per_information22
379     ,per_information23
380     ,per_information24
381     ,per_information25
382     ,per_information26
383     ,per_information27
384     ,per_information28
385     ,per_information29
386     ,per_information30
387     ,blood_type
388     ,correspondence_language
389     ,honors
390     ,pre_name_adjunct
391     ,rehire_authorizor
392     ,rehire_recommendation
393     ,resume_exists
394     ,resume_last_updated
395     ,second_passport_exists
396     ,student_status
397     ,date_of_death
398     ,uses_tobacco_flag
399     ,town_of_birth
400     ,region_of_birth
401     ,country_of_birth
402     ,fast_path_employee
403     ,fte_capacity
404     ,order_name
405     ,global_name
406     ,local_name   )
407    values
408     (p_person_id
409     ,p_party_id
410     ,p_effective_start_date
411     ,p_effective_end_date
412     ,p_business_group_id
413 --    ,p_person_type_id
414     ,hr_person_type_usage_info.get_default_person_type_id(p_person_type_id)
415     ,p_last_name
416     ,p_start_date
417     ,p_applicant_number
418     ,p_comment_id
419     ,p_current_applicant_flag
420     ,p_current_emp_or_apl_flag
421     ,p_current_employee_flag
422     ,p_date_employee_data_verified
423     ,p_date_of_birth
424     ,p_email_address
425     ,p_employee_number
426     ,p_expense_check_send_to_addr
427     ,p_first_name
428     ,l_full_name
429     ,p_known_as
430     ,p_marital_status
431     ,p_middle_names
432     ,p_nationality
433     ,p_national_identifier
434     ,p_previous_last_name
435     ,p_registered_disabled_flag
436     ,p_sex
437     ,p_title
438    ,p_suffix
439     ,p_vendor_id
440 --    ,p_work_telephone   -- Now done by the create_phone business process call
441     ,p_request_id
442     ,p_program_application_id
443     ,p_program_id
444     ,p_program_update_date
445     ,p_a_cat
446     ,p_a1
447     ,p_a2
448     ,p_a3
449     ,p_a4
450     ,p_a5
451     ,p_a6
452     ,p_a7
453     ,p_a8
454     ,p_a9
455     ,p_a10
456     ,p_a11
457     ,p_a12
458     ,p_a13
459     ,p_a14
460     ,p_a15
461     ,p_a16
462     ,p_a17
463     ,p_a18
464     ,p_a19
465     ,p_a20
466     ,p_a21
467     ,p_a22
468     ,p_a23
469     ,p_a24
470     ,p_a25
471     ,p_a26
472     ,p_a27
473     ,p_a28
474     ,p_a29
475     ,p_a30
476     ,p_last_update_date
477     ,p_last_updated_by
478     ,p_last_update_login
479     ,p_created_by
480     ,p_creation_date
481     ,p_i_cat
482     ,p_i1
483     ,p_i2
484     ,p_i3
485     ,p_i4
486     ,p_i5
487     ,p_i6
488     ,p_i7
489     ,p_i8
490     ,p_i9
491     ,p_i10
492     ,p_i11
493     ,p_i12
494     ,p_i13
495     ,p_i14
496     ,p_i15
497     ,p_i16
498     ,p_i17
499     ,p_i18
500     ,p_i19
501     ,p_i20
502     ,p_i21
503     ,p_i22
504     ,p_i23
505     ,p_i24
506     ,p_i25
507     ,p_i26
508     ,p_i27
509     ,p_i28
510     ,p_i29
511     ,p_i30
512     ,p_blood_type
513     ,p_correspondence_language
514     ,p_honors
515     ,p_pre_name_adjunct
516     ,p_rehire_authorizor
517     ,p_rehire_recommendation
518     ,p_resume_exists
519     ,p_resume_last_updated
520     ,p_second_passport_exists
521     ,p_student_status
522     ,p_date_of_death
523     ,p_uses_tobacco_flag
524     ,p_town_of_birth
525     ,p_region_of_birth
526     ,p_country_of_birth
527     ,p_fast_path_employee
528     ,p_fte_capacity
529     ,l_order_name
530     ,l_global_name
531     ,l_local_name   );
532 --
533    /* BEGIN OF PARTY_ID WORK */
534   --
535   open c_person;
536     --
537     fetch c_person into l_person;
538     --
539   close c_person;
540   --
541   per_hrtca_merge.create_tca_person(p_rec => l_person);
542   --
543   hr_utility.set_location('Updating party id',10);
544   --
545   -- Now assign the resulting party id back to the record.
546   --
547   if p_party_id is null then
548     update per_people_f
549        set party_id = l_person.party_id
550      where person_id = p_person_id;
551   end if;
552   --
553   /* END OF PARTY ID WORK */
554 
555    open c2;
556 --
557    fetch c2 into p_rowid;
558 --
559    close c2;
560 --
561    --
562    if p_create_defaults_for in ('EMP','APL') then
563       --
564       -- #317298 We must insert a row into per_person_list for the new EMP
565       -- or APL, otherwise secure users won't be able to see them until LISTGEN
566       -- has next been run. This should be revisited as part of a wider security
567       -- review. For example, #294004 points out that all users will be able
568       -- to see the new person created here in the default business group, until
569       -- their Org or Position is changed on the assignment AND LISTGEN is run.
570       --
571       -- For the time being, just put a row into per_person_list for the
572       -- default business group if it doesn't have the VIEW_ALL_FLAG set. The
573       -- 'not exists' check is there for defensive coding, and should never
574       -- arise, as we're only dealing with new people.
575       -- RMF 02-Feb-96.
576       --
577       hr_security_internal.populate_new_person
578       (p_business_group_id=>p_business_group_id
579       ,p_person_id        =>p_person_id);
580       --
581       if p_create_defaults_for = 'EMP' then
582          --
583          -- insert employee rows.
584          --
585          -- VT 08/13/96
586          per_people9_pkg.insert_employee_rows(p_person_id => p_person_id
587                            ,p_effective_start_date => p_effective_start_date
588                            ,p_effective_end_date => p_effective_end_date
589                            ,p_business_group_id =>p_business_group_id
590                            ,p_emp_ass_status_type_id => p_emp_ass_status_type_id
591                            ,p_employee_number => p_employee_number
592                            ,p_request_id => p_request_id
593                            ,p_program_application_id => p_program_application_id
594                            ,p_program_id => p_program_id
595                            ,p_program_update_date => p_program_update_date
596                            ,p_last_update_date => p_last_update_date
597                            ,p_last_updated_by => p_last_updated_by
598                            ,p_last_update_login => p_last_update_login
599                            ,p_created_by => p_created_by
600                            ,p_creation_date => p_creation_date
601                            ,p_adjusted_svc_date => NULL);
602 
603 -- PTU : Start of Changes
604 -- validate person type first
605 
606  per_per_bus.chk_person_type
607           (p_person_type_id    => l_person_type_id
608           ,p_business_group_id => p_business_group_id
609           ,p_expected_sys_type => 'EMP');
610 
611 
612  hr_per_type_usage_internal.maintain_person_type_usage
613 	(p_effective_date	=> p_effective_start_date
614 	,p_person_id 		=> p_person_id
615 	,p_person_type_id 	=> l_person_type_id
616 	);
617 
618 -- PTU : End of Changes
619 
620       else
621          --
622          -- do insert applicant rows.
623          --
624          -- VT 08/13/96
625          per_people9_pkg.insert_applicant_rows(p_person_id => p_person_id
626                            ,p_effective_start_date => p_effective_start_date
627                            ,p_effective_end_date => p_effective_end_date
628                            ,p_business_group_id =>p_business_group_id
629                            ,p_app_ass_status_type_id => p_app_ass_status_type_id
630                            ,p_request_id => p_request_id
631                            ,p_program_application_id => p_program_application_id
632                            ,p_program_id => p_program_id
633                            ,p_program_update_date => p_program_update_date
634                            ,p_last_update_date => p_last_update_date
635                            ,p_last_updated_by => p_last_updated_by
636                            ,p_last_update_login => p_last_update_login
637                            ,p_created_by => p_created_by
638                            ,p_creation_date => p_creation_date);
639 
640 -- PTU : Start of Changes
641 -- validate person type first
642 
643  per_per_bus.chk_person_type
644           (p_person_type_id    => l_person_type_id
645           ,p_business_group_id => p_business_group_id
646           ,p_expected_sys_type => 'APL');
647 
648  hr_per_type_usage_internal.maintain_person_type_usage
649 	(p_effective_date	=> p_effective_start_date
650 	,p_person_id 		=> p_person_id
651 	,p_person_type_id 	=> l_person_type_id
652 	);
653 
654 -- PTU : End of Changes
655 
656       end if;
657    end if;
658    --
659    -- Create a phone row if the work_telephone parm is not null.
660    -- Use p_start_date (i.e., p_date_received passed from per_applicant_pkg)
661    -- as the value for effective date and date from.
662    --
663    if p_work_telephone is not null then
664           hr_phone_api.create_phone
665              (p_date_from                 => p_start_date
666              ,p_date_to                   => null
667              ,p_phone_type                => 'W1'
668              ,p_phone_number              => p_work_telephone
669              ,p_parent_id                 => p_person_id
670              ,p_parent_table              => 'PER_ALL_PEOPLE_F'
671              ,p_validate                  => FALSE
672              ,p_effective_date            => p_start_date
673              ,p_object_version_number     => l_phone_ovn  --out
674              ,p_phone_id                  => l_phone_id   --out
675              );
676    end if;
677    --
678 --
679 end insert_row;
680 --
681 procedure delete_row(p_rowid VARCHAR2) is
682 begin
683 --
684    delete from per_people_f
685    where rowid=chartorowid(p_rowid);
686 --
687 end delete_row;
688 --
689 procedure lock_row(p_rowid VARCHAR2
690    ,p_person_id NUMBER
691    ,p_effective_start_date DATE
692    ,p_effective_end_date DATE
693    ,p_business_group_id NUMBER
694    ,p_person_type_id NUMBER
695    ,p_last_name VARCHAR2
696    ,p_start_date DATE
697    ,p_applicant_number VARCHAR2
698    ,p_comment_id NUMBER
699    ,p_current_applicant_flag VARCHAR2
700    ,p_current_emp_or_apl_flag VARCHAR2
701    ,p_current_employee_flag VARCHAR2
702    ,p_date_employee_data_verified DATE
703    ,p_date_of_birth DATE
704    ,p_email_address VARCHAR2
705    ,p_employee_number VARCHAR2
706    ,p_expense_check_send_to_addr VARCHAR2
707    ,p_first_name VARCHAR2
708    ,p_full_name VARCHAR2
709    ,p_known_as  VARCHAR2
710    ,p_marital_status VARCHAR2
711    ,p_middle_names  VARCHAR2
712    ,p_nationality VARCHAR2
713    ,p_national_identifier VARCHAR2
714    ,p_previous_last_name VARCHAR2
715    ,p_registered_disabled_flag VARCHAR2
716    ,p_sex VARCHAR2
717    ,p_title VARCHAR2
718    ,p_suffix VARCHAR2
719    ,p_vendor_id NUMBER
720    ,p_work_telephone VARCHAR2
721    ,p_a_cat VARCHAR2
722    ,p_a1 VARCHAR2
723    ,p_a2 VARCHAR2
724    ,p_a3 VARCHAR2
725    ,p_a4 VARCHAR2
726    ,p_a5 VARCHAR2
727    ,p_a6 VARCHAR2
728    ,p_a7 VARCHAR2
729    ,p_a8 VARCHAR2
730    ,p_a9 VARCHAR2
731    ,p_a10 VARCHAR2
732    ,p_a11 VARCHAR2
733    ,p_a12 VARCHAR2
734    ,p_a13 VARCHAR2
735    ,p_a14 VARCHAR2
736    ,p_a15 VARCHAR2
737    ,p_a16 VARCHAR2
738    ,p_a17 VARCHAR2
739    ,p_a18 VARCHAR2
740    ,p_a19 VARCHAR2
741    ,p_a20 VARCHAR2
742    ,p_a21 VARCHAR2
743    ,p_a22 VARCHAR2
744    ,p_a23 VARCHAR2
745    ,p_a24 VARCHAR2
746    ,p_a25 VARCHAR2
747    ,p_a26 VARCHAR2
748    ,p_a27 VARCHAR2
749    ,p_a28 VARCHAR2
750    ,p_a29 VARCHAR2
751    ,p_a30 VARCHAR2
752    ,p_i_cat VARCHAR2
753    ,p_i1 VARCHAR2
754    ,p_i2 VARCHAR2
755    ,p_i3 VARCHAR2
756    ,p_i4 VARCHAR2
757    ,p_i5 VARCHAR2
758    ,p_i6 VARCHAR2
759    ,p_i7 VARCHAR2
760    ,p_i8 VARCHAR2
761    ,p_i9 VARCHAR2
762    ,p_i10 VARCHAR2
763    ,p_i11 VARCHAR2
764    ,p_i12 VARCHAR2
765    ,p_i13 VARCHAR2
766    ,p_i14 VARCHAR2
767    ,p_i15 VARCHAR2
768    ,p_i16 VARCHAR2
769    ,p_i17 VARCHAR2
770    ,p_i18 VARCHAR2
771    ,p_i19 VARCHAR2
772    ,p_i20 VARCHAR2
773    ,p_i21 VARCHAR2
774    ,p_i22 VARCHAR2
775    ,p_i23 VARCHAR2
776    ,p_i24 VARCHAR2
777    ,p_i25 VARCHAR2
778    ,p_i26 VARCHAR2
779    ,p_i27 VARCHAR2
780    ,p_i28 VARCHAR2
781    ,p_i29 VARCHAR2
782    ,p_i30 VARCHAR2) is
783 --
784 -- Define cursor.
785 --
786    cursor per is select *
787    from per_people_f
788    where rowid = chartorowid(p_rowid)
789    for update nowait;
790 --
791 -- Local variables.
792 --
793 per_rec per%rowtype;
794 --
795 begin
796    open per;
797    fetch per into per_rec;
798    close per;
799    --
800    -- Fix to ensure column values are rtrim before
801    -- comparison (as forms truncates all char fields for trailing spaces.)
802    --
803    per_rec.last_name := rtrim(per_rec.last_name);
804    per_rec.applicant_number := rtrim(per_rec.applicant_number);
805    per_rec.current_emp_or_apl_flag := rtrim(per_rec.current_emp_or_apl_flag);
806    per_rec.expense_check_send_to_address :=
807                        rtrim(per_rec.expense_check_send_to_address);
808    per_rec.known_as := rtrim(per_rec.known_as);
809    per_rec.per_information11 := rtrim(per_rec.per_information11);
810    per_rec.per_information16 := rtrim(per_rec.per_information16);
811    per_rec.registered_disabled_flag := rtrim(per_rec.registered_disabled_flag);
812    per_rec.attribute_category := rtrim(per_rec.attribute_category);
813    per_rec.attribute3 := rtrim(per_rec.attribute3);
814    per_rec.attribute6 := rtrim(per_rec.attribute6);
815    per_rec.attribute9 := rtrim(per_rec.attribute9);
816    per_rec.attribute12 := rtrim(per_rec.attribute12);
817    per_rec.attribute14 := rtrim(per_rec.attribute14);
818    per_rec.attribute17 := rtrim(per_rec.attribute17);
819    per_rec.attribute20 := rtrim(per_rec.attribute20);
820    per_rec.middle_names := rtrim(per_rec.middle_names);
821    per_rec.nationality := rtrim(per_rec.nationality);
822    per_rec.national_identifier := rtrim(per_rec.national_identifier);
823    per_rec.previous_last_name := rtrim(per_rec.previous_last_name);
824    per_rec.sex := rtrim(per_rec.sex);
825    per_rec.title := rtrim(per_rec.title);
826    per_rec.suffix := rtrim(per_rec.suffix);
827    per_rec.work_telephone := rtrim(per_rec.work_telephone);
828    per_rec.attribute1 := rtrim(per_rec.attribute1);
829    per_rec.attribute2 := rtrim(per_rec.attribute2);
830    per_rec.attribute4 := rtrim(per_rec.attribute4);
831    per_rec.attribute5 := rtrim(per_rec.attribute5);
832    per_rec.attribute7 := rtrim(per_rec.attribute7);
833    per_rec.attribute8 := rtrim(per_rec.attribute8);
834    per_rec.attribute10 := rtrim(per_rec.attribute10);
835    per_rec.attribute11 := rtrim(per_rec.attribute11);
836    per_rec.attribute13 := rtrim(per_rec.attribute13);
837    per_rec.attribute15 := rtrim(per_rec.attribute15);
838    per_rec.attribute16 := rtrim(per_rec.attribute16);
839    per_rec.attribute18 := rtrim(per_rec.attribute18);
840    per_rec.attribute19 := rtrim(per_rec.attribute19);
841    per_rec.attribute21 := rtrim(per_rec.attribute21);
842    per_rec.attribute22 := rtrim(per_rec.attribute22);
843    per_rec.attribute23 := rtrim(per_rec.attribute23);
844    per_rec.attribute24 := rtrim(per_rec.attribute24);
845    per_rec.attribute25 := rtrim(per_rec.attribute25);
846    per_rec.attribute26 := rtrim(per_rec.attribute26);
847    per_rec.attribute27 := rtrim(per_rec.attribute27);
848    per_rec.attribute28 := rtrim(per_rec.attribute28);
849    per_rec.attribute29 := rtrim(per_rec.attribute29);
850    per_rec.attribute30 := rtrim(per_rec.attribute30);
851    per_rec.per_information_category := rtrim(per_rec.per_information_category);
852    per_rec.current_applicant_flag := rtrim(per_rec.current_applicant_flag);
853    per_rec.current_employee_flag := rtrim(per_rec.current_employee_flag);
854    per_rec.email_address := rtrim(per_rec.email_address);
855    per_rec.employee_number := rtrim(per_rec.employee_number);
856    per_rec.first_name := rtrim(per_rec.first_name);
857    per_rec.full_name := rtrim(per_rec.full_name);
858    per_rec.marital_status := rtrim(per_rec.marital_status);
859    per_rec.per_information1 := rtrim(per_rec.per_information1);
860    per_rec.per_information2 := rtrim(per_rec.per_information2);
861    per_rec.per_information3 := rtrim(per_rec.per_information3);
862    per_rec.per_information4 := rtrim(per_rec.per_information4);
863    per_rec.per_information5 := rtrim(per_rec.per_information5);
864    per_rec.per_information6 := rtrim(per_rec.per_information6);
865    per_rec.per_information7 := rtrim(per_rec.per_information7);
866    per_rec.per_information8 := rtrim(per_rec.per_information8);
867    per_rec.per_information9 := rtrim(per_rec.per_information9);
868    per_rec.per_information10 := rtrim(per_rec.per_information10);
869    per_rec.per_information12 := rtrim(per_rec.per_information12);
870    per_rec.per_information13 := rtrim(per_rec.per_information13);
871    per_rec.per_information14 := rtrim(per_rec.per_information14);
872    per_rec.per_information15 := rtrim(per_rec.per_information15);
873    per_rec.per_information17 := rtrim(per_rec.per_information17);
874    per_rec.per_information18 := rtrim(per_rec.per_information18);
875    per_rec.per_information19 := rtrim(per_rec.per_information19);
876    per_rec.per_information20 := rtrim(per_rec.per_information20);
877    per_rec.per_information21 := rtrim(per_rec.per_information21);
878    per_rec.per_information22 := rtrim(per_rec.per_information22);
879    per_rec.per_information23 := rtrim(per_rec.per_information23);
880    per_rec.per_information24 := rtrim(per_rec.per_information24);
881    per_rec.per_information25 := rtrim(per_rec.per_information25);
882    per_rec.per_information26 := rtrim(per_rec.per_information26);
883    per_rec.per_information27 := rtrim(per_rec.per_information27);
884    per_rec.per_information28 := rtrim(per_rec.per_information28);
885    per_rec.per_information29 := rtrim(per_rec.per_information29);
886    per_rec.per_information30 := rtrim(per_rec.per_information30);
887    --
888    if ( ((per_rec.person_id = p_person_id)
889    or (per_rec.person_id is null
890    and (p_person_id is null)))
891    and ((per_rec.effective_start_date = p_effective_start_date)
892    or (per_rec.effective_start_date is null
893    and (p_effective_start_date is null)))
894    and ((per_rec.effective_end_date = p_effective_end_date)
895    or (per_rec.effective_end_date is null
896    and (p_effective_end_date is null)))
897    and ((per_rec.business_group_id = p_business_group_id)
898    or (per_rec.business_group_id is null
899    and (p_business_group_id is null)))
900 -- PTU : Start of Changes
901 --   and ((per_rec.person_type_id = p_person_type_id)
902 --   or (per_rec.person_type_id is null
903 --   and (p_person_type_id is null)))
904 -- PTU : End of Changes
905    and ((per_rec.last_name = p_last_name)
906    or (per_rec.last_name is null
907    and (p_last_name is null)))
908    and ((per_rec.start_date = p_start_date)
909    or (per_rec.start_date is null
910    and (p_start_date is null)))
911    and ((per_rec.applicant_number = p_applicant_number)
912    or (per_rec.applicant_number is null
913    and (p_applicant_number is null)))
914    and ((per_rec.comment_id = p_comment_id)
915    or (per_rec.comment_id is null
916    and (p_comment_id is null)))
917    and ((per_rec.current_applicant_flag = p_current_applicant_flag)
918    or (per_rec.current_applicant_flag is null
919    and (p_current_applicant_flag is null)))
920    and ((per_rec.current_emp_or_apl_flag = p_current_emp_or_apl_flag)
921    or (per_rec.current_emp_or_apl_flag is null
922    and (p_current_emp_or_apl_flag is null)))
923    and ((per_rec.current_employee_flag = p_current_employee_flag)
924    or (per_rec.current_employee_flag is null
925    and (p_current_employee_flag is null)))
926    and ((per_rec.date_employee_data_verified = p_date_employee_data_verified)
927    or (per_rec.date_employee_data_verified is null
928    and (p_date_employee_data_verified is null)))
929    and ((per_rec.date_of_birth = p_date_of_birth)
930    or (per_rec.date_of_birth is null
931    and (p_date_of_birth is null)))
932    and ((per_rec.email_address = p_email_address)
933    or (per_rec.email_address is null
934    and (p_email_address is null)))
935    and ((per_rec.employee_number = p_employee_number)
936    or (per_rec.employee_number is null
937    and (p_employee_number is null)))
938    and ((per_rec.expense_check_send_to_address = p_expense_check_send_to_addr)
939    or (per_rec.expense_check_send_to_address is null
940    and (p_expense_check_send_to_addr is null)))
941    and ((per_rec.first_name = p_first_name)
942    or (per_rec.first_name is null
943    and (p_first_name is null)))
944    and ((per_rec.full_name = p_full_name)
945    or (per_rec.full_name is null
946    and (p_full_name is null)))
947    and ((per_rec.known_as = p_known_as)
948    or (per_rec.known_as is null
949    and (p_known_as is null)))
950    and ((per_rec.marital_status = p_marital_status)
951    or (per_rec.marital_status is null
952    and (p_marital_status is null)))
953    and ((per_rec.middle_names = p_middle_names)
954    or (per_rec.middle_names is null
955    and (p_middle_names is null)))
956    and ((per_rec.nationality = p_nationality)
957    or (per_rec.nationality is null
958    and (p_nationality is null)))
959    and ((per_rec.national_identifier = p_national_identifier)
960    or (per_rec.national_identifier is null
961    and (p_national_identifier is null)))
962    and ((per_rec.previous_last_name = p_previous_last_name)
963    or (per_rec.previous_last_name is null
964    and (p_previous_last_name is null)))
965    and ((per_rec.registered_disabled_flag = p_registered_disabled_flag)
966    or (per_rec.registered_disabled_flag is null
967    and (p_registered_disabled_flag is null)))
968    and ((per_rec.sex = p_sex)
969    or (per_rec.sex is null
970    and (p_sex is null)))
971    and ((per_rec.title = p_title)
972    or (per_rec.title is null
973    and (p_title is null)))
974    and ((per_rec.suffix = p_suffix)
975    or (per_rec.suffix is null
976    and (p_suffix is null)))
977    and ((per_rec.vendor_id = p_vendor_id)
978    or (per_rec.vendor_id is null
979    and (p_vendor_id is null)))
980    and ((per_rec.work_telephone = p_work_telephone)
981    or (per_rec.work_telephone is null
982    and (p_work_telephone is null)))
983    and ((per_rec.attribute_category = p_a_cat)
984    or (per_rec.attribute_category is null
985    and (p_a_cat is null)))
986    and ((per_rec.attribute1 = p_a1)
987    or (per_rec.attribute1 is null
988    and (p_a1 is null)))
989    and ((per_rec.attribute2 = p_a2)
990    or (per_rec.attribute2 is null
991    and (p_a2 is null)))
992    and ((per_rec.attribute3 = p_a3)
993    or (per_rec.attribute3 is null
994    and (p_a3 is null)))
995    and ((per_rec.attribute4 = p_a4)
996    or (per_rec.attribute4 is null
997    and (p_a4 is null)))
998    and ((per_rec.attribute5 = p_a5)
999    or (per_rec.attribute5 is null
1000    and (p_a5 is null)))
1001    and ((per_rec.attribute6 = p_a6)
1002    or (per_rec.attribute6 is null
1003    and (p_a6 is null)))
1004    and ((per_rec.attribute7 = p_a7)
1005    or (per_rec.attribute7 is null
1006    and (p_a7 is null)))
1007    and ((per_rec.attribute8 = p_a8)
1008    or (per_rec.attribute8 is null
1009    and (p_a8 is null)))
1010    and ((per_rec.attribute9 = p_a9)
1011    or (per_rec.attribute9 is null
1012    and (p_a9 is null)))
1013    and ((per_rec.attribute10 = p_a10)
1014    or (per_rec.attribute10 is null
1015    and (p_a10 is null)))
1016    and ((per_rec.attribute11 = p_a11)
1017    or (per_rec.attribute11 is null
1018    and (p_a11 is null)))
1019    and ((per_rec.attribute12 = p_a12)
1020    or (per_rec.attribute12 is null
1021    and (p_a12 is null)))
1022    and ((per_rec.attribute13 = p_a13)
1023    or (per_rec.attribute13 is null
1024    and (p_a13 is null)))
1025    and ((per_rec.attribute14 = p_a14)
1026    or (per_rec.attribute14 is null
1027    and (p_a14 is null)))
1028    and ((per_rec.attribute15 = p_a15)
1029    or (per_rec.attribute15 is null
1030    and (p_a15 is null)))
1031    and ((per_rec.attribute16 = p_a16)
1032    or (per_rec.attribute16 is null
1033    and (p_a16 is null)))
1034    and ((per_rec.attribute17 = p_a17)
1035    or (per_rec.attribute17 is null
1036    and (p_a17 is null)))
1037    and ((per_rec.attribute18 = p_a18)
1038    or (per_rec.attribute18 is null
1039    and (p_a18 is null)))
1040    and ((per_rec.attribute19 = p_a19)
1041    or (per_rec.attribute19 is null
1042    and (p_a19 is null)))
1043    and ((per_rec.attribute20 = p_a20)
1044    or (per_rec.attribute20 is null
1045    and (p_a20 is null))) )then
1046       --
1047       -- PL/SQL cannot handle an IF statement this length
1048       -- so split the comparisons into more manageable 'chunks'
1049       --
1050       if (  ((per_rec.attribute21 = p_a21)
1051       or (per_rec.attribute21 is null
1052       and (p_a21 is null)))
1053       and ((per_rec.attribute22 = p_a22)
1054       or (per_rec.attribute22 is null
1055       and (p_a22 is null)))
1056       and ((per_rec.attribute23 = p_a23)
1057       or (per_rec.attribute23 is null
1058       and (p_a23 is null)))
1059       and ((per_rec.attribute24 = p_a24)
1060       or (per_rec.attribute24 is null
1061       and (p_a24 is null)))
1062       and ((per_rec.attribute25 = p_a25)
1063       or (per_rec.attribute25 is null
1064       and (p_a25 is null)))
1065       and ((per_rec.attribute26 = p_a26)
1066       or (per_rec.attribute26 is null
1067       and (p_a26 is null)))
1068       and ((per_rec.attribute27 = p_a27)
1069       or (per_rec.attribute27 is null
1070       and (p_a27 is null)))
1071       and ((per_rec.attribute28 = p_a28)
1072       or (per_rec.attribute28 is null
1073       and (p_a28 is null)))
1074       and ((per_rec.attribute29 = p_a29)
1075       or (per_rec.attribute29 is null
1076       and (p_a29 is null)))
1077       and ((per_rec.attribute30 = p_a30)
1078       or (per_rec.attribute30 is null
1079       and (p_a30 is null)))
1080       and ((per_rec.per_information_category = p_i_cat)
1081       or (per_rec.per_information_category is null
1082       and (p_i_cat is null)))
1083       and ((per_rec.per_information1 = p_i1)
1084       or (per_rec.per_information1 is null
1085       and (p_i1 is null)))
1086       and ((per_rec.per_information2 = p_i2)
1087       or (per_rec.per_information2 is null
1088       and (p_i2 is null)))
1089       and ((per_rec.per_information3 = p_i3)
1090       or (per_rec.per_information3 is null
1091       and (p_i3 is null)))
1092       and ((per_rec.per_information4 = p_i4)
1093       or (per_rec.per_information4 is null
1094       and (p_i4 is null)))
1095       and ((per_rec.per_information5 = p_i5)
1096       or (per_rec.per_information5 is null
1097       and (p_i5 is null)))
1098       and ((per_rec.per_information6 = p_i6)
1099       or (per_rec.per_information6 is null
1100       and (p_i6 is null)))
1101       and ((per_rec.per_information7 = p_i7)
1102       or (per_rec.per_information7 is null
1103       and (p_i7 is null)))
1104       and ((per_rec.per_information8 = p_i8)
1105       or (per_rec.per_information8 is null
1106       and (p_i8 is null)))
1107       and ((per_rec.per_information9 = p_i9)
1108       or (per_rec.per_information9 is null
1109       and (p_i9 is null)))
1110       and ((per_rec.per_information10 = p_i10)
1111       or (per_rec.per_information10 is null
1112       and (p_i10 is null)))
1113       and ((per_rec.per_information11 = p_i11)
1114       or (per_rec.per_information11 is null
1115       and (p_i11 is null)))
1116       and ((per_rec.per_information12 = p_i12)
1117       or (per_rec.per_information12 is null
1118       and (p_i12 is null)))
1119       and ((per_rec.per_information13 = p_i13)
1120       or (per_rec.per_information13 is null
1121       and (p_i13 is null)))
1122       and ((per_rec.per_information14 = p_i14)
1123       or (per_rec.per_information14 is null
1124       and (p_i14 is null)))
1125       and ((per_rec.per_information15 = p_i15)
1126       or (per_rec.per_information15 is null
1127       and (p_i15 is null)))
1128       and ((per_rec.per_information16 = p_i16)
1129       or (per_rec.per_information16 is null
1130       and (p_i16 is null)))
1131       and ((per_rec.per_information17 = p_i17)
1132       or (per_rec.per_information17 is null
1133       and (p_i17 is null)))
1134       and ((per_rec.per_information18 = p_i18)
1135       or (per_rec.per_information18 is null
1136       and (p_i18 is null)))
1137       and ((per_rec.per_information19 = p_i19)
1138       or (per_rec.per_information19 is null
1139       and (p_i19 is null)))
1140       and ((per_rec.per_information20 = p_i20)
1141       or (per_rec.per_information20 is null
1142       and (p_i20 is null)))
1143       and ((per_rec.per_information21 = p_i21)
1144       or (per_rec.per_information21 is null
1145       and (p_i21 is null)))
1146       and ((per_rec.per_information22 = p_i22)
1147       or (per_rec.per_information22 is null
1148       and (p_i22 is null)))
1149       and ((per_rec.per_information23 = p_i23)
1150       or (per_rec.per_information23 is null
1151       and (p_i23 is null)))
1152       and ((per_rec.per_information24 = p_i24)
1153       or (per_rec.per_information24 is null
1154       and (p_i24 is null)))
1155       and ((per_rec.per_information25 = p_i25)
1156       or (per_rec.per_information25 is null
1157       and (p_i25 is null)))
1158       and ((per_rec.per_information26 = p_i26)
1159       or (per_rec.per_information26 is null
1160       and (p_i26 is null)))
1161       and ((per_rec.per_information27 = p_i27)
1162       or (per_rec.per_information27 is null
1163       and (p_i27 is null)))
1164       and ((per_rec.per_information28 = p_i28)
1165       or (per_rec.per_information28 is null
1166       and (p_i28 is null)))
1167       and ((per_rec.per_information29 = p_i29)
1168       or (per_rec.per_information29 is null
1169       and (p_i29 is null)))
1170       and ((per_rec.per_information30 = p_i30)
1171       or (per_rec.per_information30 is null
1172       and (p_i30 is null)))
1173       ) then
1174     return; -- return record is locked and ok.
1175       end if;
1176    end if;
1177 -- Record changed by another user.
1178 --
1179    fnd_message.set_name('FND','FORM_RECORD_CHANGED');
1180    app_exception.raise_exception ;
1181    exception when no_data_found then
1182       raise;
1183       when others then raise;
1184 end lock_row;
1185 --
1186 procedure update_row(p_rowid VARCHAR2
1187    ,p_person_id NUMBER
1188    ,p_effective_start_date DATE
1189    ,p_effective_end_date DATE
1190    ,p_business_group_id NUMBER
1191    ,p_person_type_id NUMBER
1192    ,p_last_name VARCHAR2
1193    ,p_start_date DATE
1194    ,p_applicant_number IN OUT NOCOPY VARCHAR2
1195    ,p_comment_id NUMBER
1196    ,p_current_applicant_flag VARCHAR2
1197    ,p_current_emp_or_apl_flag VARCHAR2
1198    ,p_current_employee_flag VARCHAR2
1199    ,p_date_employee_data_verified DATE
1200    ,p_date_of_birth DATE
1201    ,p_email_address VARCHAR2
1202    ,p_employee_number IN OUT NOCOPY VARCHAR2
1203    ,p_expense_check_send_to_addr VARCHAR2
1204    ,p_first_name VARCHAR2
1205    ,p_full_name VARCHAR2
1206    ,p_known_as VARCHAR2
1207    ,p_marital_status VARCHAR2
1208    ,p_middle_names VARCHAR2
1209    ,p_nationality VARCHAR2
1210    ,p_national_identifier VARCHAR2
1211    ,p_previous_last_name VARCHAR2
1212    ,p_registered_disabled_flag VARCHAR2
1213    ,p_sex VARCHAR2
1214    ,p_title VARCHAR2
1215    ,p_suffix VARCHAR2
1216    ,p_vendor_id NUMBER
1217    ,p_work_telephone VARCHAR2
1218    ,p_request_id NUMBER
1219    ,p_program_application_id NUMBER
1220    ,p_program_id NUMBER
1221    ,p_program_update_date DATE
1222    ,p_a_cat VARCHAR2
1223    ,p_a1 VARCHAR2
1224    ,p_a2 VARCHAR2
1225    ,p_a3 VARCHAR2
1226    ,p_a4 VARCHAR2
1227    ,p_a5 VARCHAR2
1228    ,p_a6 VARCHAR2
1229    ,p_a7 VARCHAR2
1230    ,p_a8 VARCHAR2
1231    ,p_a9 VARCHAR2
1232    ,p_a10 VARCHAR2
1233    ,p_a11 VARCHAR2
1234    ,p_a12 VARCHAR2
1235    ,p_a13 VARCHAR2
1236    ,p_a14 VARCHAR2
1237    ,p_a15 VARCHAR2
1238    ,p_a16 VARCHAR2
1239    ,p_a17 VARCHAR2
1240    ,p_a18 VARCHAR2
1241    ,p_a19 VARCHAR2
1242    ,p_a20 VARCHAR2
1243    ,p_a21 VARCHAR2
1244    ,p_a22 VARCHAR2
1245    ,p_a23 VARCHAR2
1246    ,p_a24 VARCHAR2
1247    ,p_a25 VARCHAR2
1248    ,p_a26 VARCHAR2
1249    ,p_a27 VARCHAR2
1250    ,p_a28 VARCHAR2
1251    ,p_a29 VARCHAR2
1252    ,p_a30 VARCHAR2
1253    ,p_last_update_date DATE
1254    ,p_last_updated_by NUMBER
1255    ,p_last_update_login NUMBER
1256    ,p_created_by NUMBER
1257    ,p_creation_date DATE
1258    ,p_i_cat VARCHAR2
1259    ,p_i1 VARCHAR2
1260    ,p_i2 VARCHAR2
1261    ,p_i3 VARCHAR2
1262    ,p_i4 VARCHAR2
1263    ,p_i5 VARCHAR2
1264    ,p_i6 VARCHAR2
1265    ,p_i7 VARCHAR2
1266    ,p_i8 VARCHAR2
1267    ,p_i9 VARCHAR2
1268    ,p_i10 VARCHAR2
1269    ,p_i11 VARCHAR2
1270    ,p_i12 VARCHAR2
1271    ,p_i13 VARCHAR2
1272    ,p_i14 VARCHAR2
1273    ,p_i15 VARCHAR2
1274    ,p_i16 VARCHAR2
1275    ,p_i17 VARCHAR2
1276    ,p_i18 VARCHAR2
1277    ,p_i19 VARCHAR2
1278    ,p_i20 VARCHAR2
1279    ,p_i21 VARCHAR2
1280    ,p_i22 VARCHAR2
1281    ,p_i23 VARCHAR2
1282    ,p_i24 VARCHAR2
1283    ,p_i25 VARCHAR2
1284    ,p_i26 VARCHAR2
1285    ,p_i27 VARCHAR2
1286    ,p_i28 VARCHAR2
1287    ,p_i29 VARCHAR2
1288    ,p_i30 VARCHAR2
1289    ,p_app_ass_status_type_id NUMBER
1290    ,p_emp_ass_status_type_id NUMBER
1291    ,p_system_person_type VARCHAR2
1292    ,p_s_system_person_type VARCHAR2
1293    ,p_hire_date DATE
1294    ,p_s_hire_date DATE
1295    ,p_s_date_of_birth DATE
1296    ,p_status in out nocopy VARCHAR2
1297    ,p_new_primary_id in out nocopy NUMBER
1298    ,p_update_primary in out nocopy VARCHAR2
1299    ,p_legislation_code VARCHAR2
1300    ,p_vacancy_id IN OUT NOCOPY NUMBER
1301    ,p_session_date date
1302    ,p_end_of_time date) is
1303 --
1304    l_period_of_service_id number; -- Period of Service id.
1305    l_employ_emp_apl varchar2(1);  -- Are we employing an EMP_APL?
1306    l_fire_warning varchar2(1);    -- If set Y return to form displaying warning.
1307    l_num_appls NUMBER;            -- Number of applicants.
1308    l_num_accepted_appls NUMBER;   -- Number of accepted spplicant assignments
1309    l_set_of_books_id NUMBER;      -- Required for GL.
1310    l_npw_number per_all_people_f.npw_number%TYPE;
1311    l_party_id   per_all_people_f.party_id%type;
1312 --
1313    cursor csr_partyId_details is -- Enh 3299580
1314      select party_id
1315        from per_all_people_f
1316       where person_id = p_person_id
1317         and p_session_date between effective_start_date
1318                               and  effective_end_date;
1319 begin
1320    --
1321    -- p_status has the Value of where the code should start on re-entry.
1322    -- on startup = 'BEGIN'( First time called from form)
1323    -- other values depend on what meesages have been returned to the client
1324    -- and the re-entry point on return from the client.
1325    --
1326    if p_status = 'BEGIN' then
1327       --
1328       -- Test to see if the hire_date_has changed
1329       -- Providing Person type has not and it is emp.
1330       -- Or that it has changed to EMP
1331       --
1332       if (p_hire_date <> p_s_hire_date)
1333          and (p_s_hire_date is not null)
1334          and (((p_system_person_type = p_s_system_person_type)
1335             and p_system_person_type = 'EMP')
1336           or ((p_system_person_type = 'EMP'
1337                and p_s_system_person_type in ('APL','APL_EX_APL','EX_EMP_APL'))
1338           or (p_system_person_type = 'EMP_APL'
1339                and p_s_system_person_type = 'APL')
1340           or (p_system_person_type = 'EMP'
1341              and p_s_system_person_type = 'EMP_APL'))) then
1342          -- get the period_of_service_id
1343          begin
1344             select pps.period_of_service_id
1345             into   l_period_of_service_id
1346             from   per_periods_of_service pps
1347             where  pps.person_id = p_person_id
1348             and    pps.date_start = p_s_hire_date;
1349             --
1350             exception
1351              when no_data_found then
1352                --
1353                -- If no data found and a previous hire date existed
1354                -- then raise an error;
1355                --
1356                if p_s_hire_date is not null then
1357                   hr_utility.set_message('801','HR_6153_ALL_PROCEDURE_FAIL');
1358                   hr_utility.set_message_token('PROCEDURE','Update_row');
1359                   hr_utility.raise_error;
1360                end if;
1361          end;
1362          --
1363          -- check the integrity of the date change.
1364          -- Date may come in between a person type change.
1365          --
1366          hr_date_chk.check_hire_ref_int(p_person_id
1367                   ,p_business_group_id
1368                   ,l_period_of_service_id
1369                   ,p_s_hire_date
1370                   ,p_system_person_type
1371                   ,p_hire_date);
1372       end if;
1373       --
1374       -- check session date and effective_start_date for differences
1375       -- if any exists then ensure the person record is correct
1376       -- i.e duplicate datetrack functionality as it currently uses
1377       -- a global version of session date to update the rows (not good)
1378       --
1379       -- VT 08/13/96
1380       if p_session_date <> p_effective_start_date  then
1381         per_people9_pkg.update_old_person_row(p_person_id =>p_person_id
1382                               ,p_session_date => p_session_date
1383                               ,p_effective_start_date=>p_effective_start_date);
1384       end if;
1385       --
1386       -- get the Employee and applicant numbers if necessary
1387       -- only returns values depending on values of
1388       -- p_current_applicant_flag, p_current_applicant_flag
1389       -- and whether p_employee_number and p_applicant_number
1390       -- are null.
1391       --
1392       open csr_partyId_details;  -- Enh 3299580
1393       fetch csr_partyId_details into l_party_id;
1394       close csr_partyId_details;
1395       --
1396       hr_person.generate_number(p_current_employee_flag
1397            ,p_current_applicant_flag
1398            ,null  -- p_current_npw_flag
1399            ,p_national_identifier
1400            ,p_business_group_id
1401            ,p_person_id
1402            ,p_employee_number
1403            ,p_applicant_number
1404            ,l_npw_number
1405             -- Enh 3299580 --
1406            ,p_session_date
1407            ,l_party_id
1408            ,p_date_of_birth
1409            ,p_hire_date
1410        );
1411       --
1412       -- Test current numbers are not used by
1413       -- the system already.
1414       --
1415       hr_person.validate_unique_number(p_person_id    =>p_person_id
1416 				   , p_business_group_id => p_business_group_id
1417 				   , p_employee_number  => p_employee_number
1418 				   , p_applicant_number => p_applicant_number
1419                                    , p_npw_number       => null --p_npw_number
1420 				   , p_current_employee => p_current_employee_flag
1421 				   , p_current_applicant => p_current_applicant_flag
1422                                    , p_current_npw       => null --p_current_npw_flag
1423                                    );
1424       p_status := 'VACANCY_CHECK'; -- Set status to next possible reentry point.
1425    end if; -- End the First in section
1426    --
1427    -- Start of Person type changes.
1428    --
1429    -- Has the Person type changed to become that of an applicant?
1430    --
1431    if (p_system_person_type ='APL'
1432          and p_s_system_person_type = 'OTHER')
1433       or (p_system_person_type = 'APL_EX_APL'
1434          and p_s_system_person_type = 'EX_APL')
1435       or (p_system_person_type = 'EMP_APL'
1436          and p_s_system_person_type = 'EMP')
1437       or (p_system_person_type = 'EX_EMP_APL'
1438          and p_s_system_person_type = 'EX_EMP') then
1439          --
1440          --  Ensure no future person_type_changes.
1441          --
1442          if hr_person.chk_future_person_type(p_s_system_person_type
1443                                             ,p_person_id
1444                                             ,p_business_group_id
1445                                             ,p_effective_start_date) then
1446            fnd_message.set_name('PAY','HR_7193_PER_FUT_TYPE_EXISTS');
1447            app_exception.raise_exception;
1448          end if;
1449          --
1450          -- Ensure there are no future applicant assignments
1451          --
1452          per_people3_pkg.check_future_apl(p_person_id => p_person_id
1453                           ,p_hire_date => p_session_date);
1454          --
1455          -- Insert the default applicant row and applicant
1456          -- assignment.
1457          --
1458          -- VT 08/13/96
1459          per_people9_pkg.insert_applicant_rows(p_person_id => p_person_id
1460                ,p_effective_start_date => p_effective_start_date
1461                ,p_effective_end_date => p_effective_end_date
1462                ,p_business_group_id =>p_business_group_id
1463                ,p_app_ass_status_type_id => p_app_ass_status_type_id
1464                ,p_request_id => p_request_id
1465                ,p_program_application_id => p_program_application_id
1466                ,p_program_id => p_program_id
1467                ,p_program_update_date => p_program_update_date
1468                ,p_last_update_date => p_last_update_date
1469                ,p_last_updated_by => p_last_updated_by
1470                ,p_last_update_login => p_last_update_login
1471                ,p_created_by => p_created_by
1472                ,p_creation_date => p_creation_date);
1473    --
1474    -- Has the Person type changed to become that of an employee
1475    -- when the previous type is not a current applicant?
1476    --
1477    elsif (p_system_person_type = 'EMP'
1478          and ( p_s_system_person_type = 'OTHER'
1479       or p_s_system_person_type = 'EX_EMP')) then
1480          --
1481          --  Ensure no future person_type_changes.
1482          --
1483          if hr_person.chk_future_person_type(p_s_system_person_type
1484                                             ,p_person_id
1485                                             ,p_business_group_id
1486                                             ,p_effective_start_date) then
1487            fnd_message.set_name('PAY','HR_7193_PER_FUT_TYPE_EXISTS');
1488            app_exception.raise_exception;
1489          end if;
1490       --
1491       -- Ensure there are no future applicant assignments
1492       --
1493       per_people3_pkg.check_future_apl(p_person_id => p_person_id
1494                         ,p_hire_date => p_effective_start_date);
1495       --
1496       -- Insert the default period_of service and assignment
1497       -- rows.
1498       --
1499       -- VT 08/13/96
1500       per_people9_pkg.insert_employee_rows(p_person_id => p_person_id
1501          ,p_effective_start_date => p_effective_start_date
1502          ,p_effective_end_date => p_effective_end_date
1503          ,p_business_group_id =>p_business_group_id
1504          ,p_emp_ass_status_type_id => p_emp_ass_status_type_id
1505          ,p_employee_number => p_employee_number
1506          ,p_request_id => p_request_id
1507          ,p_program_application_id => p_program_application_id
1508          ,p_program_id => p_program_id
1509          ,p_program_update_date => p_program_update_date
1510          ,p_last_update_date => p_last_update_date
1511          ,p_last_updated_by => p_last_updated_by
1512          ,p_last_update_login => p_last_update_login
1513          ,p_created_by => p_created_by
1514          ,p_creation_date => p_creation_date
1515          ,p_adjusted_svc_date => NULL);
1516       --
1517       -- Has the Person become an Employee or Employee applicant from being an
1518       -- applicant or employee applicant?
1519       --
1520    elsif ((p_system_person_type = 'EMP'
1521          and p_s_system_person_type in ('APL','APL_EX_APL','EX_EMP_APL'))
1522       or (p_system_person_type = 'EMP_APL'
1523          and p_s_system_person_type = 'APL')
1524       or (p_system_person_type = 'EMP'
1525          and p_s_system_person_type = 'EMP_APL')) then
1526          --
1527          --  Ensure no future person_type_changes.
1528          --
1529          if hr_person.chk_future_person_type(p_s_system_person_type
1530                                             ,p_person_id
1531                                             ,p_business_group_id
1532                                             ,p_effective_start_date) then
1533           fnd_message.set_name('PAY','HR_7193_PER_FUT_TYPE_EXISTS');
1534            hr_utility.raise_error;
1535          end if;
1536       --
1537       -- Ensure there are no future applicant assignments
1538       --
1539       per_people3_pkg.check_future_apl(p_person_id => p_person_id
1540                         ,p_hire_date => p_effective_start_date);
1541       --
1542       -- Check that the change is valid.
1543       --
1544       if p_status = 'VACANCY_CHECK' then
1545          loop
1546             exit when p_status = 'GET_APPLS';
1547                --
1548                -- Check each vacancy,if it is oversubscribed
1549                -- l_fire_warning = 'Y', return to client
1550                -- displaying relevant message.
1551                -- on return l_vacancy_id starts the cursor at the
1552                -- relevant point.
1553                --
1554                per_people3_pkg.vacancy_chk(p_person_id => p_person_id
1555                            ,p_fire_warning => l_fire_warning
1556                            ,p_vacancy_id => p_vacancy_id);
1557                if l_fire_warning = 'Y' then
1558                   return;
1559                elsif l_fire_warning = 'N' then
1560                   p_status := 'GET_APPLS'; -- Set next possible re-entry point.
1561                end if;
1562          end loop;
1563       end if; -- End of VACANCY_CHECK
1564       --
1565       if p_status='GET_APPLS' then
1566          --
1567          -- Get all the accepted applicants
1568          --
1569          per_people3_pkg.get_accepted_appls(p_person_id => p_person_id
1570                            ,p_num_accepted_appls => l_num_accepted_appls
1571                            ,p_new_primary_id =>p_new_primary_id);
1572          --
1573          -- Get all current applicant assignments.
1574          --
1575          per_people3_pkg.get_all_current_appls(p_person_id => p_person_id
1576                               ,p_num_appls => l_num_appls);
1577          --
1578          if p_system_person_type = 'EMP_APL' then
1579             --
1580             -- If we have got this far then there must be > 0 Accepted
1581             -- applications,therefore check p_system_person_type if EMP_APL
1582             -- and number of accepted is equal to number of current assignments
1583             -- then there is an error. Otherwise go around end_accepted
1584             -- to multiple contracts.
1585             --
1586             if l_num_accepted_appls = l_num_appls then
1587                hr_utility.set_message('801','HR_6791_EMP_APL_NO_ASG');
1588                hr_utility.raise_error;
1589             else
1590                p_status := 'MULTIPLE_CONTRACTS';-- Set next re-entry point.
1591             end if;
1592          --
1593          -- Number of accepted does not equal number of current then
1594          -- end_accepted.
1595          --
1596          elsif l_num_accepted_appls <> l_num_appls then
1597             hr_utility.set_message('801','HR_EMP_UNACCEPTED_APPL');
1598             p_status := 'END_UNACCEPTED'; -- next code re-entry,
1599             return;
1600          --
1601          -- Otherwise ignore end_accepted.
1602          --
1603          else
1604             p_status := 'MULTIPLE_CONTRACTS'; -- next code re-entry.
1605          end if;
1606       end if; -- End of GET_APPLS
1607       --
1608       if p_status = 'END_UNACCEPTED' then
1609          --
1610          -- End the unaccepted assignments.
1611          --
1612          hrhirapl.end_unaccepted_app_assign(p_person_id
1613                                              ,p_business_group_id
1614                                              ,p_legislation_code
1615                                              ,p_session_date);
1616          p_status := 'MULTIPLE_CONTRACTS';
1617       end if; -- End of END_UNACCEPTED
1618       --
1619       -- Test to see if multiple contracts are a possibility.
1620       --
1621    hr_utility.set_location('update_row - b4 MULTIPLE_CONTRACTS',1);
1622       if p_status = 'MULTIPLE_CONTRACTS' then -- MULTIPLE_CONTRACTS
1623          if l_num_accepted_appls >1 then
1624             hr_utility.set_message('801','HR_EMP_MULTIPLE_CONTRACTS');
1625             return;
1626          else
1627             p_status := 'CHOOSE_VAC'; -- next code re-entry.
1628          end if;
1629       end if; -- End of MULTIPLE_CONTRACTS
1630       --
1631       -- Choose whether to change the Primary assignment
1632       -- and which vacancy  is to be the primary if so.
1633       --
1634    hr_utility.set_location('update_row - b4 CHOOSE_VAC',1);
1635       if p_status = 'CHOOSE_VAC' then
1636          return;
1637       end if; --End of CHOOSE_VAC
1638       --
1639       -- Can now hire the Person
1640 		-- Note HIRE status can only be set from client form
1641 		-- as interaction is generally required.
1642       --
1643    hr_utility.set_location('update_row - b4 HIRE',1);
1644       if p_status = 'HIRE' then
1645          --
1646          -- If new is Emp and old was Emp_apl
1647          -- then l_emp_emp_apl is set to Y
1648          --
1649          if p_system_person_type = 'EMP'
1650                and p_s_system_person_type = 'EMP_APL' then
1651             l_employ_emp_apl := 'Y';
1652          else
1653             l_employ_emp_apl := 'N';
1654          end if;
1655          --
1656          -- Run the employ_applicant stored procedure
1657          --
1658    hr_utility.set_location('update_row - b4 hrhirapl',1);
1659          hrhirapl.employ_applicant(p_person_id
1660                                   ,p_business_group_id
1661                                   ,p_legislation_code
1662                                   ,p_new_primary_id
1663                                   ,p_emp_ass_status_type_id
1664                                   ,p_last_updated_by
1665                                   ,p_last_update_login
1666                                   ,p_effective_start_date
1667                                   ,p_end_of_time
1668                                   ,p_last_update_date
1669                                   ,p_update_primary
1670                                   ,p_employee_number
1671                                   ,l_set_of_books_id
1672                                   ,l_employ_emp_apl
1673                                   ,NULL
1674                                   ,p_session_date); -- Bug 3564129
1675    hr_utility.set_location('update_row - after hrhirapl',2);
1676       end if; -- End of HIRE.
1677    end if; -- Of Person type change checks.
1678    --
1679    hr_utility.set_location('update_row - b4 update',1);
1680    update per_people_f ppf
1681    set ppf.person_id = p_person_id
1682    ,ppf.effective_start_date = p_effective_start_date
1683    ,ppf.effective_end_date = p_effective_end_date
1684    ,ppf.business_group_id = p_business_group_id
1685    ,ppf.person_type_id = p_person_type_id
1686    ,ppf.last_name = p_last_name
1687    ,ppf.start_date = p_start_date
1688    ,ppf.applicant_number = p_applicant_number
1689    ,ppf.comment_id = p_comment_id
1690    ,ppf.current_applicant_flag = p_current_applicant_flag
1691    ,ppf.current_emp_or_apl_flag = p_current_emp_or_apl_flag
1692    ,ppf.current_employee_flag = p_current_employee_flag
1693    ,ppf.date_employee_data_verified = p_date_employee_data_verified
1694    ,ppf.date_of_birth = p_date_of_birth
1695    ,ppf.email_address = p_email_address
1696    ,ppf.employee_number = p_employee_number
1697    ,ppf.expense_check_send_to_address = p_expense_check_send_to_addr
1698    ,ppf.first_name = p_first_name
1699    ,ppf.full_name = p_full_name
1700    ,ppf.known_as = p_known_as
1701    ,ppf.marital_status = p_marital_status
1702    ,ppf.middle_names = p_middle_names
1703    ,ppf.nationality = p_nationality
1704    ,ppf.national_identifier = p_national_identifier
1705    ,ppf.previous_last_name = p_previous_last_name
1706    ,ppf.registered_disabled_flag = p_registered_disabled_flag
1707    ,ppf.sex = p_sex
1708    ,ppf.title = p_title
1709    ,ppf.suffix = p_suffix
1710    ,ppf.vendor_id = p_vendor_id
1711    ,ppf.work_telephone = p_work_telephone
1712    ,ppf.request_id = p_request_id
1713    ,ppf.program_application_id = p_program_application_id
1714    ,ppf.program_id = p_program_id
1715    ,ppf.program_update_date = p_program_update_date
1716    ,ppf.attribute_category = p_a_cat
1717    ,ppf.attribute1 = p_a1
1718    ,ppf.attribute2 = p_a2
1719    ,ppf.attribute3 = p_a3
1720    ,ppf.attribute4 = p_a4
1721    ,ppf.attribute5 = p_a5
1722    ,ppf.attribute6 = p_a6
1723    ,ppf.attribute7 = p_a7
1724    ,ppf.attribute8 = p_a8
1725    ,ppf.attribute9 = p_a9
1726    ,ppf.attribute10 = p_a10
1727    ,ppf.attribute11 = p_a11
1728    ,ppf.attribute12 = p_a12
1729    ,ppf.attribute13 = p_a13
1730    ,ppf.attribute14 = p_a14
1731    ,ppf.attribute15 = p_a15
1732    ,ppf.attribute16 = p_a16
1733    ,ppf.attribute17 = p_a17
1734    ,ppf.attribute18 = p_a18
1735    ,ppf.attribute19 = p_a19
1736    ,ppf.attribute20 = p_a20
1737    ,ppf.attribute21 = p_a21
1738    ,ppf.attribute22 = p_a22
1739    ,ppf.attribute23 = p_a23
1740    ,ppf.attribute24 = p_a24
1741    ,ppf.attribute25 = p_a25
1742    ,ppf.attribute26 = p_a26
1743    ,ppf.attribute27 = p_a27
1744    ,ppf.attribute28 = p_a28
1745    ,ppf.attribute29 = p_a29
1746    ,ppf.attribute30 = p_a30
1747    ,ppf.last_update_date = p_last_update_date
1748    ,ppf.last_updated_by = p_last_updated_by
1749    ,ppf.last_update_login = p_last_update_login
1750    ,ppf.created_by = p_created_by
1751    ,ppf.creation_date = p_creation_date
1752    ,ppf.per_information_category = p_i_cat
1753    ,ppf.per_information1 = p_i1
1754    ,ppf.per_information2 = p_i2
1755    ,ppf.per_information3 = p_i3
1756    ,ppf.per_information4 = p_i4
1757    ,ppf.per_information5 = p_i5
1758    ,ppf.per_information6 = p_i6
1759    ,ppf.per_information7 = p_i7
1760    ,ppf.per_information8 = p_i8
1761    ,ppf.per_information9 = p_i9
1762    ,ppf.per_information10 = p_i10
1763    ,ppf.per_information11 = p_i11
1764    ,ppf.per_information12 = p_i12
1765    ,ppf.per_information13 = p_i13
1766    ,ppf.per_information14 = p_i14
1767    ,ppf.per_information15 = p_i15
1768    ,ppf.per_information16 = p_i16
1769    ,ppf.per_information17 = p_i17
1770    ,ppf.per_information18 = p_i18
1771    ,ppf.per_information19 = p_i19
1772    ,ppf.per_information20 = p_i20
1773    ,ppf.per_information21 = p_i21
1774    ,ppf.per_information22 = p_i22
1775    ,ppf.per_information23 = p_i23
1776    ,ppf.per_information24 = p_i24
1777    ,ppf.per_information25 = p_i25
1778    ,ppf.per_information26 = p_i26
1779    ,ppf.per_information27 = p_i27
1780    ,ppf.per_information28 = p_i28
1781    ,ppf.per_information29 = p_i29
1782    ,ppf.per_information30 = p_i30
1783    where ppf.rowid = p_rowid;
1784    --
1785    if sql%rowcount <1 then
1786       hr_utility.set_message(801,'HR_6001_ALL_MANDATORY_FIELD');
1787       hr_utility.set_message_token('MISSING_FIELD','rowid is'||p_rowid);
1788       hr_utility.raise_error;
1789    end if;
1790    --
1791    -- Tests required post-update
1792    --
1793    hr_utility.set_location('update_row - after update',1);
1794    --
1795    -- Has the Date of Birth changed?
1796    --
1797    if p_date_of_birth <> p_s_date_of_birth then
1798       --
1799       -- Run the assignment_link_usages and Element_entry
1800       -- code for Change of Personal qualifying conditions.
1801       --
1802       per_people3_pkg.run_alu_ee(p_alu_mode => 'CHANGE_PQC'
1803                             ,p_business_group_id=>p_business_group_id
1804                             ,p_person_id =>p_person_id
1805                             ,p_old_start =>p_s_hire_date
1806                             ,p_start_date => p_last_update_date
1807                             );
1808    end if;
1809    --
1810    hr_utility.set_location('update_row - after update',2);
1811    --
1812    -- test if hire_date has changed. and system person type has not.
1813    --
1814    if  ((p_current_employee_flag = 'Y')
1815          and (p_hire_date <> p_s_hire_date)
1816          and (p_system_person_type = p_s_system_person_type)) then
1817       --
1818       -- Update the period of service for the employee
1819       --
1820       --
1821       per_people3_pkg.update_period(p_person_id =>p_person_id
1822                               ,p_hire_date => p_s_hire_date
1823                               ,p_new_hire_date =>p_hire_date);
1824       --
1825       hr_utility.set_location('update_row - after update',3);
1826       --
1827       -- Update the hire records i.e
1828       -- assignment etc.
1829       --
1830       --
1831       hr_date_chk.update_hire_records(p_person_id
1832           ,p_applicant_number
1833           ,p_hire_date
1834           ,p_s_hire_date
1835           ,p_last_updated_by
1836           ,p_last_update_login);
1837       --
1838       hr_utility.set_location('update_row - after update',4);
1839       --
1840       -- Run the assignment_link_usages and Element_entry
1841       -- code for Assignment Criteria.
1842       --
1843       per_people3_pkg.run_alu_ee(p_alu_mode => 'ASG_CRITERIA'
1844                           ,p_business_group_id=>p_business_group_id
1845                           ,p_person_id =>p_person_id
1846                           ,p_old_start =>p_s_hire_date
1847                          ,p_start_date => p_hire_date);
1848    end if;
1849    --
1850    p_status := 'END'; -- Status required to end update loop on server
1851    --
1852 end update_row;
1853 --
1854 END PER_PEOPLE_PKG;