[Home] [Help]
PACKAGE BODY: APPS.HR_EMPLOYEE_APPLICANT_API
Source
1 PACKAGE BODY hr_employee_applicant_api
2 /* $Header: peemaapi.pkb 120.32.12020000.8 2013/02/27 12:57:06 karthmoh ship $ */
3 AS
4 --
5 -- Package variables
6 --
7 g_package VARCHAR2(33) := 'hr_employee_applicant_api.';
8 --
9 -- #2264569
10 g_retain_apl varchar2(1) := 'R'; -- indicates Retain asg
11 g_convert_apl varchar2(1) := 'C'; -- Convert asg
12 g_end_date_apl varchar2(1) := 'E'; -- End Date asg
13
14 --
15 -- Package cursors
16 --
17 CURSOR csr_future_asgs
18 (p_person_id IN per_all_people_f.person_id%TYPE
19 ,p_effective_date IN DATE
20 ,p_assignment_id IN per_all_assignments_f.assignment_id%type --2264191 added
21 )
22 IS
23 SELECT asg.assignment_id
24 ,asg.object_version_number
25 FROM per_assignments_f asg
26 WHERE asg.person_id = csr_future_asgs.p_person_id
27 AND asg.effective_start_date > csr_future_asgs.p_effective_date
28 AND (p_assignment_id is null OR
29 (p_assignment_id is not null AND
30 p_assignment_id = asg.assignment_id));
31 --
32 CURSOR csr_nonaccepted_asgs
33 (p_person_id IN per_all_people_f.person_id%TYPE
34 ,p_effective_date IN DATE
35 )
36 IS
37 SELECT asg.assignment_id
38 ,asg.object_version_number
39 FROM per_assignments_f asg
40 ,per_assignment_status_types ast
41 WHERE asg.assignment_status_type_id = ast.assignment_status_type_id
42 AND asg.person_id = csr_nonaccepted_asgs.p_person_id
43 AND csr_nonaccepted_asgs.p_effective_date BETWEEN asg.effective_start_date
44 AND asg.effective_end_date
45 AND asg.assignment_type = 'A'
46 AND ast.per_system_status <> 'ACCEPTED';
47 --
48 CURSOR csr_accepted_asgs
49 (p_person_id IN per_all_people_f.person_id%TYPE
50 ,p_effective_date IN DATE
51 ,p_assignment_id IN per_all_assignments_f.assignment_id%TYPE DEFAULT hr_api.g_number
52 )
53 IS
54 SELECT asg.assignment_id
55 ,asg.object_version_number
56 ,asg.vacancy_id
57 FROM per_assignments_f asg
58 ,per_assignment_status_types ast
59 WHERE asg.assignment_status_type_id = ast.assignment_status_type_id
60 AND asg.person_id = csr_accepted_asgs.p_person_id
61 AND ( asg.assignment_id = csr_accepted_asgs.p_assignment_id
62 OR csr_accepted_asgs.p_assignment_id = hr_api.g_number)
63 AND csr_accepted_asgs.p_effective_date BETWEEN asg.effective_start_date
64 AND asg.effective_end_date
65 AND asg.assignment_type = 'A'
66 AND ast.per_system_status = 'ACCEPTED';
67 --
68 CURSOR csr_primary_asgs
69 (p_person_id IN per_all_people_f.person_id%TYPE
70 ,p_effective_date IN DATE
71 )
72 IS
73 SELECT asg.assignment_id
74 ,asg.object_version_number
75 FROM per_assignments_f asg
76 ,per_assignment_status_types ast
77 WHERE asg.assignment_status_type_id = ast.assignment_status_type_id
78 AND asg.person_id = csr_primary_asgs.p_person_id
79 AND csr_primary_asgs.p_effective_date BETWEEN asg.effective_start_date
80 AND asg.effective_end_date
81 AND asg.assignment_type = 'E'
82 AND asg.primary_flag = 'Y'
83 AND ast.per_system_status = 'ACTIVE_ASSIGN';
84 --
85 CURSOR csr_per_details
86 (p_person_id IN per_all_people_f.person_id%TYPE
87 ,p_effective_date IN DATE
88 )
89 IS
90 SELECT pet.person_type_id
91 ,pet.system_person_type
92 ,per.effective_start_date
93 ,per.effective_end_date
94 ,per.applicant_number
95 ,per.employee_number
96 ,per.npw_number
97 ,bus.business_group_id
98 ,bus.legislation_code
99 FROM per_people_f per
100 ,per_business_groups bus
101 ,per_person_types pet
102 WHERE per.person_type_id = pet.person_type_id
103 AND per.business_group_id+0 = bus.business_group_id
104 AND per.person_id = csr_per_details.p_person_id
105 AND csr_per_details.p_effective_date BETWEEN per.effective_start_date
106 AND per.effective_end_date;
107 --
108 CURSOR csr_apl_details
109 (p_person_id IN per_all_people_f.person_id%TYPE
110 ,p_effective_date IN DATE
111 )
112 IS
113 SELECT apl.application_id
114 ,apl.object_version_number
115 FROM per_applications apl
116 WHERE apl.person_id = csr_apl_details.p_person_id
117 AND csr_apl_details.p_effective_date BETWEEN apl.date_received
118 AND NVL(apl.date_end,hr_api.g_eot);
119 --
120 CURSOR csr_pds_details
121 (p_person_id IN per_all_people_f.person_id%TYPE
122 ,p_effective_date IN DATE
123 )
124 IS
125 SELECT pds.period_of_service_id
126 ,pds.object_version_number
127 FROM per_periods_of_service pds
128 WHERE pds.person_id = csr_pds_details.p_person_id
129 AND csr_pds_details.p_effective_date BETWEEN pds.date_start
130 AND NVL(pds.actual_termination_date,hr_api.g_eot);
131 --
132 -- -----------------------------------------------------------------------------
133 -- |--------------------------< future_asgs_count >----------------------------|
134 -- -----------------------------------------------------------------------------
135 --
136 -- {Start Of Comments}
137 --
138 -- Description:
139 -- Determines the number of assignments for a person which start on or after
140 -- a date.
141 --
142 -- Prerequisites:
143 -- None
144 --
145 -- In Parameters:
146 -- Name Reqd Type Description
147 -- p_person_id No number Person id
148 -- p_effective_date No date Effective date
149 -- p_assignment_id No number assignment_id if specified looks only for
150 -- future changes to that assignment
151 --
152 -- Post Success:
153 -- The number of assignments for the person starting on or after a date is
154 -- returned.
155 --
156 -- Post Failure:
157 -- An error is raised.
158 --
159 -- Access Status:
160 -- Internal Development Use Only
161 --
162 -- {End Of Comments}
163 --
164 FUNCTION future_asgs_count
165 (p_person_id IN per_all_people_f.person_id%TYPE
166 ,p_effective_date IN DATE
167 ,p_assignment_id IN per_all_assignments_f.assignment_id%type DEFAULT NULL --2264191 added
168 )
169 RETURN INTEGER
170 IS
171 --
172 -- Local variables
173 --
174 l_proc VARCHAR2(72) := g_package||'future_asgs_count';
175 --
176 l_future_asgs_count INTEGER := 0;
177 --
178 BEGIN
179 --
180 hr_utility.set_location('Entering:'||l_proc,10);
181 --
182 FOR l_future_asgs_rec IN
183 csr_future_asgs
184 (p_person_id => p_person_id
185 ,p_effective_date => p_effective_date
186 ,p_assignment_id => p_assignment_id
187 )
188 LOOP
189 l_future_asgs_count := l_future_asgs_count + 1;
190 END LOOP;
191 --
192 hr_utility.set_location(' Leaving:'||l_proc,100);
193 --
194 RETURN(l_future_asgs_count);
195 --
196 EXCEPTION
197 WHEN OTHERS
198 THEN
199 IF csr_future_asgs%ISOPEN
200 THEN
201 CLOSE csr_future_asgs;
202 END IF;
203 RAISE;
204 --
205 END future_asgs_count;
206 --
207 -- -----------------------------------------------------------------------------
208 -- |------------------------< nonaccepted_asgs_count >-------------------------|
209 -- -----------------------------------------------------------------------------
210 --
211 -- {Start Of Comments}
212 --
213 -- Description:
214 -- Determines the number of non-accepted applicant assignments for a person
215 -- on a date.
216 --
217 -- Prerequisites:
218 -- None.
219 --
220 -- In Parameters:
221 -- Name Reqd Type Description
222 -- p_person_id No number Person id
223 -- p_effective_date No date Effective date
224 --
225 -- Post Success:
226 -- The number of non-accepted applicant assignments for the person on a date
227 -- is returned.
228 --
229 -- Post Failure:
230 -- An error is raised.
231 --
232 -- Access Status:
233 -- Internal Development Use Only
234 --
235 -- {End Of Comments}
236 --
237 FUNCTION nonaccepted_asgs_count
238 (p_person_id IN per_all_people_f.person_id%TYPE
239 ,p_effective_date IN DATE
240 )
241 RETURN INTEGER
242 IS
243 --
244 -- Local variables
245 --
246 l_proc VARCHAR2(72) := g_package||'nonaccepted_asgs_count';
247 --
248 l_nonaccepted_asgs_count INTEGER := 0;
249 --
250 BEGIN
251 --
252 hr_utility.set_location('Entering:'||l_proc,10);
253 --
254 FOR l_nonaccepted_asgs_rec IN
255 csr_nonaccepted_asgs
256 (p_person_id => p_person_id
257 ,p_effective_date => p_effective_date
258 )
259 LOOP
260 l_nonaccepted_asgs_count := l_nonaccepted_asgs_count + 1;
261 END LOOP;
262 --
263 hr_utility.set_location(' Leaving:'||l_proc,100);
264 --
265 RETURN(l_nonaccepted_asgs_count);
266 --
267 EXCEPTION
268 WHEN OTHERS
269 THEN
270 IF csr_nonaccepted_asgs%ISOPEN
271 THEN
272 CLOSE csr_nonaccepted_asgs;
273 END IF;
274 RAISE;
275 --
276 END nonaccepted_asgs_count;
277 --
278 -- -----------------------------------------------------------------------------
279 -- |-------------------------< accepted_asgs_count >---------------------------|
280 -- -----------------------------------------------------------------------------
281 --
282 -- {Start Of Comments}
283 --
284 -- Description:
285 -- Determines the number of accepted applicant assignments for a person on a
286 -- date.
287 --
288 -- Prerequisites:
289 -- None.
290 --
291 -- In Parameters:
292 -- Name Reqd Type Description
293 -- p_person_id No number Person id
294 -- p_effective_date No date Effective date
295 --
296 -- Post Success:
297 -- The number of accepted applicant assignments for the person on a date is
298 -- returned.
299 --
300 -- Post Failure:
301 -- An error is raised.
302 --
303 -- Access Status:
304 -- Internal Development Use Only
305 --
306 -- {End Of Comments}
307 --
308 FUNCTION accepted_asgs_count
309 (p_person_id IN per_all_people_f.person_id%TYPE
310 ,p_effective_date IN DATE
311 )
312 RETURN INTEGER
313 IS
314 --
315 -- Local variables
316 --
317 l_proc VARCHAR2(72) := g_package||'accepted_asgs_count';
318 --
319 l_accepted_asgs_count INTEGER := 0;
320 --
321 BEGIN
322 --
323 hr_utility.set_location('Entering:'||l_proc,10);
324 --
325 FOR l_accepted_asgs_rec IN
326 csr_accepted_asgs
327 (p_person_id => p_person_id
328 ,p_effective_date => p_effective_date
329 )
330 LOOP
331 l_accepted_asgs_count := l_accepted_asgs_count + 1;
332 END LOOP;
333 --
334 hr_utility.set_location(' Leaving:'||l_proc,100);
335 --
336 RETURN(l_accepted_asgs_count);
337 --
338 EXCEPTION
339 WHEN OTHERS
340 THEN
341 IF csr_accepted_asgs%ISOPEN
342 THEN
343 CLOSE csr_accepted_asgs;
344 END IF;
345 RAISE;
346 --
347 END accepted_asgs_count;
348 --
349 -- -----------------------------------------------------------------------------
350 -- |--------------------------< primary_asgs_count >---------------------------|
351 -- -----------------------------------------------------------------------------
352 --
353 -- {Start Of Comments}
354 --
355 -- Description:
356 -- Determines the number of primary employee assignments for a person on a
357 -- date.
358 --
359 -- Prerequisites:
360 -- None.
361 --
362 -- In Parameters:
363 -- Name Reqd Type Description
364 -- p_person_id No number Person id
365 -- p_effective_date No date Effective date
366 --
367 -- Post Success:
368 -- The number of primary employee assignments for the person on a date is
369 -- returned.
370 --
371 -- Post Failure:
372 -- An error is raised.
373 --
374 -- Access Status:
375 -- Internal Development Use Only
376 --
377 -- {End Of Comments}
378 --
379 FUNCTION primary_asgs_count
380 (p_person_id IN per_all_people_f.person_id%TYPE
381 ,p_effective_date IN DATE
382 )
383 RETURN INTEGER
384 IS
385 --
386 -- Local variables
387 --
388 l_proc VARCHAR2(72) := g_package||'primary_asgs_count';
389 --
390 l_primary_asgs_count INTEGER := 0;
391 --
392 BEGIN
393 --
394 hr_utility.set_location('Entering:'||l_proc,10);
395 --
396 FOR l_primary_asgs_rec IN
397 csr_primary_asgs
398 (p_person_id => p_person_id
399 ,p_effective_date => p_effective_date
400 )
401 LOOP
402 l_primary_asgs_count := l_primary_asgs_count + 1;
403 END LOOP;
404 --
405 hr_utility.set_location(' Leaving:'||l_proc,100);
406 --
407 RETURN(l_primary_asgs_count);
408 --
409 EXCEPTION
410 WHEN OTHERS
411 THEN
412 IF csr_primary_asgs%ISOPEN
413 THEN
414 CLOSE csr_primary_asgs;
415 END IF;
416 RAISE;
417 --
418 END primary_asgs_count;
419 --
420 -- -----------------------------------------------------------------------------
421 -- |----------------------------< per_details >--------------------------------|
422 -- -----------------------------------------------------------------------------
423 --
424 -- {Start Of Comments}
425 --
426 -- Description:
427 -- Retrieve details about a person on a date.
428 --
429 -- Prerequisites:
430 -- None.
431 --
432 -- In Parameters:
433 -- Name Reqd Type Description
434 -- p_person_id No number Person id
435 -- p_effective_date No date Effective date
436 --
437 -- Post Success:
438 -- The person details are returned.
439 --
440 -- Post Failure:
441 -- An error is raised.
442 --
443 -- Access Status:
444 -- Internal Development Use Only
445 --
446 -- {End Of Comments}
447 --
448 FUNCTION per_details
449 (p_person_id IN per_all_people_f.person_id%TYPE
450 ,p_effective_date IN DATE
451 )
452 RETURN csr_per_details%ROWTYPE
453 IS
454 --
455 -- Local variables
456 --
457 l_proc VARCHAR2(72) := g_package||'per_details';
458 --
459 l_per_details_rec csr_per_details%ROWTYPE;
460 --
461 BEGIN
462 --
463 hr_utility.set_location('Entering:'||l_proc,10);
464 --
465 OPEN csr_per_details
466 (p_person_id => p_person_id
467 ,p_effective_date => p_effective_date
468 );
469 FETCH csr_per_details INTO l_per_details_rec;
470 IF csr_per_details%NOTFOUND
471 THEN
472 hr_utility.set_location(l_proc,20);
473 CLOSE csr_per_details;
474 hr_utility.set_message(800,'PER_52097_APL_INV_PERSON_ID');
475 hr_utility.raise_error;
476 END IF;
477 CLOSE csr_per_details;
478 --
479 hr_utility.set_location(' Leaving:'||l_proc,100);
480 --
481 RETURN(l_per_details_rec);
482 --
483 EXCEPTION
484 WHEN OTHERS
485 THEN
486 IF csr_per_details%ISOPEN
487 THEN
488 CLOSE csr_per_details;
489 END IF;
490 RAISE;
491 END per_details;
492 --
493 -- -----------------------------------------------------------------------------
494 -- |----------------------------< apl_details >--------------------------------|
495 -- -----------------------------------------------------------------------------
496 --
497 -- {Start Of Comments}
498 --
499 -- Description:
500 -- Retrieve details about an application of a person on a date.
501 --
502 -- Prerequisites:
503 -- None.
504 --
505 -- In Parameters:
506 -- Name Reqd Type Description
507 -- p_person_id No number Person id
508 -- p_effective_date No date Effective date
509 --
510 -- Post Success:
511 -- The application details are returned.
512 --
513 -- Post Failure:
514 -- An error is raised.
515 --
516 -- Access Status:
517 -- Internal Development Use Only
518 --
519 -- {End Of Comments}
520 --
521 FUNCTION apl_details
522 (p_person_id IN per_all_people_f.person_id%TYPE
523 ,p_effective_date IN DATE
524 )
525 RETURN csr_apl_details%ROWTYPE
526 IS
527 --
528 -- Local variables
529 --
530 l_proc VARCHAR2(72) := g_package||'apl_details';
531 --
532 l_apl_details_rec csr_apl_details%ROWTYPE;
533 --
534 BEGIN
535 --
536 hr_utility.set_location('Entering:'||l_proc,10);
537 --
538 OPEN csr_apl_details
539 (p_person_id => p_person_id
540 ,p_effective_date => p_effective_date
541 );
542 FETCH csr_apl_details INTO l_apl_details_rec;
543 CLOSE csr_apl_details;
544 --
545 hr_utility.set_location(' Leaving:'||l_proc,100);
546 --
547 RETURN(l_apl_details_rec);
548 --
549 EXCEPTION
550 WHEN OTHERS
551 THEN
552 IF csr_apl_details%ISOPEN
553 THEN
554 CLOSE csr_apl_details;
555 END IF;
556 RAISE;
557 END apl_details;
558 --
559 -- -----------------------------------------------------------------------------
560 -- |----------------------------< pds_details >--------------------------------|
561 -- -----------------------------------------------------------------------------
562 --
563 -- {Start Of Comments}
564 --
565 -- Description:
566 -- Retrieve details about a period of service of a person on a date.
567 --
568 -- Prerequisites:
569 -- None.
570 --
571 -- In Parameters:
572 -- Name Reqd Type Description
573 -- p_person_id No number Person id
574 -- p_effective_date No date Effective date
575 --
576 -- Post Success:
577 -- The period of service details are returned.
578 --
579 -- Post Failure:
580 -- An error is raised.
581 --
582 -- Access Status:
583 -- Internal Development Use Only
584 --
585 -- {End Of Comments}
586 --
587 FUNCTION pds_details
588 (p_person_id IN per_all_people_f.person_id%TYPE
589 ,p_effective_date IN DATE
590 )
591 RETURN csr_pds_details%ROWTYPE
592 IS
593 --
594 -- Local variables
595 --
596 l_proc VARCHAR2(72) := g_package||'pds_details';
597 --
598 l_pds_details_rec csr_pds_details%ROWTYPE;
599 --
600 BEGIN
601 --
602 hr_utility.set_location('Entering:'||l_proc,10);
603 --
604 OPEN csr_pds_details
605 (p_person_id => p_person_id
606 ,p_effective_date => p_effective_date
607 );
608 FETCH csr_pds_details INTO l_pds_details_rec;
609 CLOSE csr_pds_details;
610 --
611 hr_utility.set_location(' Leaving:'||l_proc,100);
612 --
613 RETURN(l_pds_details_rec);
614 --
615 EXCEPTION
616 WHEN OTHERS
617 THEN
618 IF csr_pds_details%ISOPEN
619 THEN
620 CLOSE csr_pds_details;
621 END IF;
622 RAISE;
623 END pds_details;
624 --
625 -- -----------------------------------------------------------------------------
626 -- |--------------------< hire_to_employee_applicant OLD>----------------------|
627 -- -----------------------------------------------------------------------------
628 -- This procedure is overloaded to keep the parameters in line with the base
629 -- release
630 --
631 PROCEDURE hire_to_employee_applicant
632 (p_validate IN BOOLEAN DEFAULT FALSE
633 ,p_hire_date IN DATE
634 ,p_person_id IN per_all_people_f.person_id%TYPE
635 ,p_per_object_version_number IN OUT NOCOPY per_all_people_f.object_version_number%TYPE
636 ,p_person_type_id IN per_person_types.person_type_id%TYPE DEFAULT NULL
637 ,p_assignment_id IN per_all_assignments_f.assignment_id%TYPE DEFAULT NULL
638 ,p_employee_number IN OUT NOCOPY per_all_people_f.employee_number%TYPE
639 ,p_per_effective_start_date OUT NOCOPY per_all_people_f.effective_start_date%TYPE
640 ,p_per_effective_end_date OUT NOCOPY per_all_people_f.effective_end_date%TYPE
641 ,p_assign_payroll_warning OUT NOCOPY BOOLEAN
642 )
643 IS
644 --
645 -- Local variables
646 --
647 l_proc VARCHAR2(72) := g_package||'hire__to_employee_applicant';
648 --
649 l_per_object_version_number per_all_people_f.object_version_number%TYPE;
650 l_ovn per_all_people_f.object_version_number%TYPE := p_per_object_version_number;
651 l_employee_number per_all_people_f.employee_number%TYPE;
652 l_per_effective_start_date per_all_people_f.effective_start_date%TYPE;
653 l_per_effective_end_date per_all_people_f.effective_end_date%TYPE;
654 l_assign_payroll_warning BOOLEAN;
655 l_oversubscribed_vacancy_id number;
656 --
657 BEGIN
658 --
659 hr_utility.set_location('Entering:'||l_proc,10);
660 --
661 l_per_object_version_number:= p_per_object_version_number;
662 l_employee_number:= p_employee_number;
663 --
664 hr_employee_applicant_api.hire_to_employee_applicant
665 (p_validate => p_validate
666 ,p_hire_date => p_hire_date
667 ,p_person_id => p_person_id
668 ,p_per_object_version_number => l_per_object_version_number
669 ,p_person_type_id => p_person_type_id
670 ,p_hire_all_accepted_asgs => 'Y' --2264191: this value replicates the old behaviour
671 ,p_assignment_id => p_assignment_id
672 ,p_employee_number => l_employee_number
673 ,p_per_effective_start_date => l_per_effective_start_date
674 ,p_per_effective_end_date => l_per_effective_end_date
675 ,p_assign_payroll_warning => l_assign_payroll_warning
676 ,p_oversubscribed_vacancy_id => l_oversubscribed_vacancy_id
677 );
678 --
679 p_per_object_version_number:=l_per_object_version_number;
680 p_employee_number:=l_employee_number;
681 p_per_effective_start_date:=l_per_effective_start_date;
682 p_per_effective_end_date:=l_per_effective_end_date;
683 p_assign_payroll_warning:=l_assign_payroll_warning;
684 --
685 hr_utility.set_location('Leaving:'||l_proc,20);
686 --
687 end hire_to_employee_applicant;
688 --
689 -- -----------------------------------------------------------------------------
690 -- |--------------------< hire_to_employee_applicant OLD1>---------------------|
691 -- -----------------------------------------------------------------------------
692 -- This procedure is overloaded to keep the parameters in line with the previous
693 -- release
694 --
695 PROCEDURE hire_to_employee_applicant
696 (p_validate IN BOOLEAN DEFAULT FALSE
697 ,p_hire_date IN DATE
698 ,p_person_id IN per_all_people_f.person_id%TYPE
699 ,p_per_object_version_number IN OUT NOCOPY per_all_people_f.object_version_number%TYPE
700 ,p_person_type_id IN per_person_types.person_type_id%TYPE DEFAULT NULL
701 ,p_assignment_id IN per_all_assignments_f.assignment_id%TYPE DEFAULT NULL
702 ,p_employee_number IN OUT NOCOPY per_all_people_f.employee_number%TYPE
703 ,p_per_effective_start_date OUT NOCOPY per_all_people_f.effective_start_date%TYPE
704 ,p_per_effective_end_date OUT NOCOPY per_all_people_f.effective_end_date%TYPE
705 ,p_assign_payroll_warning OUT NOCOPY BOOLEAN
706 ,p_oversubscribed_vacancy_id out nocopy number
707 )
708 IS
709 --
710 -- Local variables
711 --
712 l_proc VARCHAR2(72) := g_package||'hire__to_employee_applicant';
713 --
714 l_per_object_version_number per_all_people_f.object_version_number%TYPE;
715 l_ovn per_all_people_f.object_version_number%TYPE := p_per_object_version_number;
716 l_employee_number per_all_people_f.employee_number%TYPE;
717 l_per_effective_start_date per_all_people_f.effective_start_date%TYPE;
718 l_per_effective_end_date per_all_people_f.effective_end_date%TYPE;
719 l_assign_payroll_warning BOOLEAN;
720 l_oversubscribed_vacancy_id number;
721 --
722 BEGIN
723 --
724 hr_utility.set_location('Entering:'||l_proc,10);
725 --
726 l_per_object_version_number:= p_per_object_version_number;
727 l_employee_number:= p_employee_number;
728 --
729 hr_employee_applicant_api.hire_to_employee_applicant
730 (p_validate => p_validate
731 ,p_hire_date => p_hire_date
732 ,p_person_id => p_person_id
733 ,p_per_object_version_number => l_per_object_version_number
734 ,p_person_type_id => p_person_type_id
735 ,p_hire_all_accepted_asgs => 'Y' --2264191: this value replicates the old behaviour
736 ,p_assignment_id => p_assignment_id
737 ,p_employee_number => l_employee_number
738 ,p_per_effective_start_date => l_per_effective_start_date
739 ,p_per_effective_end_date => l_per_effective_end_date
740 ,p_assign_payroll_warning => l_assign_payroll_warning
741 ,p_oversubscribed_vacancy_id => l_oversubscribed_vacancy_id
742 );
743 --
744 p_per_object_version_number:=l_per_object_version_number;
745 p_employee_number:=l_employee_number;
746 p_per_effective_start_date:=l_per_effective_start_date;
747 p_per_effective_end_date:=l_per_effective_end_date;
748 p_assign_payroll_warning:=l_assign_payroll_warning;
749 --
750 hr_utility.set_location('Leaving:'||l_proc,20);
751 --
752 end hire_to_employee_applicant;
753
754 --
755 -- Start changes for bug 9879782
756 -- -----------------------------------------------------------------------------
757 -- |--------------------< hire_to_employee_applicant NEW >----------------------|
758 -- -----------------------------------------------------------------------------
759 --
760 PROCEDURE hire_to_employee_applicant
761 (p_validate IN BOOLEAN DEFAULT FALSE
762 ,p_hire_date IN DATE
763 ,p_person_id IN per_all_people_f.person_id%TYPE
764 ,p_per_object_version_number IN OUT NOCOPY per_all_people_f.object_version_number%TYPE
765 ,p_person_type_id IN per_person_types.person_type_id%TYPE DEFAULT NULL
766 ,p_hire_all_accepted_asgs IN VARCHAR2
767 ,p_assignment_id IN per_all_assignments_f.assignment_id%TYPE DEFAULT NULL
768 ,p_national_identifier IN per_all_people_f.national_identifier%TYPE DEFAULT hr_api.g_varchar2
769 ,p_employee_number IN OUT NOCOPY per_all_people_f.employee_number%TYPE
770 ,p_per_effective_start_date OUT NOCOPY per_all_people_f.effective_start_date%TYPE
771 ,p_per_effective_end_date OUT NOCOPY per_all_people_f.effective_end_date%TYPE
772 ,p_assign_payroll_warning OUT NOCOPY BOOLEAN
773 ,p_oversubscribed_vacancy_id OUT NOCOPY NUMBER
774 ) AS
775
776 l_proc VARCHAR2(72) := g_package||'hire_to_employee_applicant';
777
778 BEGIN
779
780 hr_utility.set_location('Entering:'||l_proc,10);
781
782 hr_employee_applicant_api.hire_to_employee_applicant
783 (p_validate => p_validate
784 ,p_hire_date => p_hire_date
785 ,p_person_id => p_person_id
786 ,p_per_object_version_number => p_per_object_version_number
787 ,p_person_type_id => p_person_type_id
788 ,p_hire_all_accepted_asgs => p_hire_all_accepted_asgs
789 ,p_assignment_id => p_assignment_id
790 ,p_employee_number => p_employee_number
791 ,p_per_effective_start_date => p_per_effective_start_date
792 ,p_per_effective_end_date => p_per_effective_end_date
793 ,p_assign_payroll_warning => p_assign_payroll_warning
794 ,p_oversubscribed_vacancy_id => p_oversubscribed_vacancy_id
795 ,p_upload_irec_docs => 'N'
796 );
797
798 hr_utility.set_location('Leaving:'||l_proc,20);
799
800 END;
801 -- End changes for bug 9879782
802
803 --
804 -- -----------------------------------------------------------------------------
805 -- |--------------------< hire_to_employee_applicant NEW >----------------------|
806 -- -----------------------------------------------------------------------------
807 --
808 PROCEDURE hire_to_employee_applicant
809 (p_validate IN BOOLEAN DEFAULT FALSE
810 ,p_hire_date IN DATE
811 ,p_person_id IN per_all_people_f.person_id%TYPE
812 ,p_per_object_version_number IN OUT NOCOPY per_all_people_f.object_version_number%TYPE
813 ,p_person_type_id IN per_person_types.person_type_id%TYPE DEFAULT NULL
814 ,p_hire_all_accepted_asgs IN VARCHAR2
815 ,p_assignment_id IN per_all_assignments_f.assignment_id%TYPE DEFAULT NULL
816 ,p_national_identifier IN per_all_people_f.national_identifier%TYPE DEFAULT hr_api.g_varchar2
817 ,p_employee_number IN OUT NOCOPY per_all_people_f.employee_number%TYPE
818 ,p_per_effective_start_date OUT NOCOPY per_all_people_f.effective_start_date%TYPE
819 ,p_per_effective_end_date OUT NOCOPY per_all_people_f.effective_end_date%TYPE
820 ,p_assign_payroll_warning OUT NOCOPY BOOLEAN
821 ,p_oversubscribed_vacancy_id out nocopy number
822 ,p_upload_irec_docs IN VARCHAR2 --Added for bug 9879782
823 )
824 IS
825 --
826 -- Local variables
827 --
828 l_proc VARCHAR2(72) := g_package||'hire_to_employee_applicant';
829 --
830 l_hire_date DATE;
831 l_ovn per_all_people_f.object_version_number%TYPE := p_per_object_version_number;
832 l_person_type_id per_person_types.person_type_id%TYPE := p_person_type_id;
833 l_person_type_id1 per_person_types.person_type_id%TYPE;
834 --
835 l_new_primary_asg_id per_all_assignments_f.assignment_id%TYPE;
836 l_hire_all_accepted_asgs VARCHAR2(1);
837 l_hire_single_asg_id per_all_assignments_f.assignment_id%TYPE;
838 --
839 l_per_object_version_number CONSTANT per_all_people_f.object_version_number%TYPE := p_per_object_version_number;
840 l_employee_number CONSTANT per_all_people_f.employee_number%TYPE := p_employee_number;
841 l_emp_num CONSTANT per_all_people_f.employee_number%TYPE := p_employee_number;
842 --
843 l_per_effective_start_date per_all_people_f.effective_start_date%TYPE;
844 l_per_effective_end_date per_all_people_f.effective_end_date%TYPE;
845 l_assign_payroll_warning BOOLEAN;
846 --
847 l_system_person_type per_person_types.system_person_type%TYPE;
848 l_future_asgs_count INTEGER;
849 l_nonaccepted_asgs_count INTEGER;
850 l_accepted_asgs_count INTEGER;
851 l_primary_asgs_count INTEGER;
852 l_assignment_status_type_id per_assignment_status_types.assignment_status_type_id%TYPE;
853 l_primary_flag per_all_assignments_f.primary_flag%TYPE;
854 --
855 l_effective_start_date DATE;
856 l_effective_end_date DATE;
857 l_validation_start_date DATE;
858 l_validation_end_date DATE;
859 l_business_group_id hr_all_organization_units.organization_id%TYPE;
860 l_comment_id hr_comments.comment_id%TYPE;
861 l_current_applicant_flag per_all_people_f.current_applicant_flag%TYPE;
862 l_current_emp_or_apl_flag per_all_people_f.current_emp_or_apl_flag%TYPE;
863 l_current_employee_flag per_all_people_f.current_employee_flag%TYPE;
864 l_full_name per_all_people_f.full_name%TYPE;
865 l_name_combination_warning BOOLEAN;
866 l_orig_hire_warning BOOLEAN;
867 l_payroll_id_updated BOOLEAN;
868 l_other_manager_warning BOOLEAN;
869 l_no_managers_warning BOOLEAN;
870 l_org_now_no_manager_warning BOOLEAN;
871 l_hourly_salaried_warning BOOLEAN;
872 l_oversubscribed_vacancy_id number;
873 l_person_type_usage_id per_person_type_usages.person_type_usage_id%TYPE;
874 l_object_version_number NUMBER := p_per_object_version_number; -- 3684087
875 --
876 l_per_details_rec csr_per_details%ROWTYPE;
877 l_pds_details_rec csr_pds_details%ROWTYPE;
878 l_accepted_asgs_rec csr_accepted_asgs%ROWTYPE;
879 --
880 l_dummy number;
881 --
882 cursor csr_vacs(p_vacancy_id number) is
883 select 1
884 from per_all_vacancies vac
885 where vac.vacancy_id=p_vacancy_id
886 and vac.number_of_openings <
887 (select count(distinct assignment_id)
888 from per_all_assignments_f asg
889 where asg.vacancy_id=p_vacancy_id
890 and asg.assignment_type='E');
891 --
892 cursor csr_future_per_changes(p_effective_date DATE) is
893 select 1 from dual where exists
894 (select 1
895 from per_all_people_f
896 where person_id = p_person_id
897 and effective_start_date >= p_effective_date);
898
899 -- Start changes for bug 9879782
900 cursor csr_get_appl_id(lp_assignment_id number) is
901 select application_id
902 from per_all_assignments_f
903 where assignment_id = lp_assignment_id
904 and p_hire_date between effective_start_date and effective_end_date;
905
906 l_appl_id number;
907 -- End changes for bug 9879782
908
909 ---- Fix For Bug: 12612530 Starts ----
910 PROCEDURE update_salary_proposal(p_assignment_id number
911 , p_effective_date date) IS
912
913 l_pay_proposal_id per_pay_proposals.pay_proposal_id%TYPE;
914 l_pyp_object_version_number per_pay_proposals.object_version_number%TYPE;
915 l_change_date per_pay_proposals.change_date%TYPE;
916 l_proposed_salary per_pay_proposals.PROPOSED_SALARY_N%TYPE;
917 l_approved_flag varchar2(1) := 'N'; ---- Changed from Y to N for ER: 6136609
918 l_inv_next_sal_date_warning boolean;
919 l_proposed_salary_warning boolean;
920 l_approved_warning boolean;
921 l_payroll_warning boolean;
922
923 ---- Fix For ER: 6136609 Starts ----
924
925 l_autoApprove varchar2(1);
926
927 ---- Fix For ER: 6136609 Ends ----
928
929 cursor csr_payproposal is
930 select pay_proposal_id, object_version_number, change_date
931 ,PROPOSED_SALARY_N
932 from per_pay_proposals
933 where assignment_id = p_assignment_id
934 order by change_date DESC;
935 BEGIN
936 open csr_payproposal;
937 fetch csr_payproposal into l_pay_proposal_id, l_pyp_object_version_number
938 ,l_change_date, l_proposed_salary;
939 if csr_payproposal%found and l_change_date < p_effective_date then
940
941 ---- Fix For ER: 6136609 Starts ----
942
943 l_autoApprove:=fnd_profile.value('HR_AUTO_APPROVE_FIRST_PROPOSAL');
944 if(l_autoApprove is null or l_autoApprove ='Y') then
945 hr_utility.set_location(l_proc, 32);
946 l_approved_flag:='Y';
947 end if;
948
949 ---- Fix For ER: 6136609 Ends ----
950
951 hr_maintain_proposal_api.cre_or_upd_salary_proposal
952 (p_pay_proposal_id => l_pay_proposal_id
953 ,p_object_version_number => l_pyp_object_version_number
954 ,p_change_date => p_effective_date
955 ,p_approved => l_approved_flag
956 ,p_inv_next_sal_date_warning => l_inv_next_sal_date_warning
957 ,p_proposed_salary_warning => l_proposed_salary_warning
958 ,p_approved_warning => l_approved_warning
959 ,p_payroll_warning => l_payroll_warning
960 );
961 end if;
962 close csr_payproposal;
963 END update_salary_proposal;
964 ---- Fix For Bug: 12612530 Ends ----
965 --
966 BEGIN
967 --
968 hr_utility.set_location('Entering:'||l_proc,10);
969 --
970 -- Ensure mandatory arguments have been passed
971 --
972 hr_api.mandatory_arg_error
973 (p_api_name => l_proc
974 ,p_argument => 'person_id'
975 ,p_argument_value => p_person_id
976 );
977 --
978 hr_api.mandatory_arg_error
979 (p_api_name => l_proc
980 ,p_argument => 'hire_date'
981 ,p_argument_value => p_hire_date
982 );
983 --
984 -- Truncate all date parameters passed in
985 --
986 l_hire_date := TRUNC(p_hire_date);
987 --
988 -- Issue savepoint
989 --
990 SAVEPOINT hire_to_employee_applicant;
991 --
992 hr_utility.set_location(l_proc,20);
993 --
994 -- Get the derived details for the person on the hire date
995 --
996 l_per_details_rec := per_details
997 (p_person_id => p_person_id
998 ,p_effective_date => l_hire_date
999 );
1000 --
1001 hr_utility.set_location(l_proc,40);
1002 --
1003 -- 2264191 changed behaviour: single asg hire requires the assignment id.
1004 -- only hire all accepted if passed the 'Y' flag, not for any other value
1005 -- 'Y' replicates the old behaviour
1006 --
1007 IF p_hire_all_accepted_asgs is null
1008 OR ( p_hire_all_accepted_asgs <> 'Y'
1009 AND p_hire_all_accepted_asgs is not null)
1010 THEN
1011 hr_utility.set_location(l_proc,45);
1012 l_hire_all_accepted_asgs := 'N';
1013 l_hire_single_asg_id := p_assignment_id;
1014 hr_api.mandatory_arg_error
1015 (p_api_name => l_proc
1016 ,p_argument => 'assignment_id'
1017 ,p_argument_value => p_assignment_id);
1018 ELSE
1019 l_hire_all_accepted_asgs := 'Y';
1020 l_hire_single_asg_id := -1;
1021 END IF;
1022 --
1023 -- Call Before Process User Hook
1024 --
1025 BEGIN
1026 hr_employee_applicant_bk1.hire_to_employee_applicant_b
1027 (p_hire_date => l_hire_date
1028 ,p_person_id => p_person_id
1029 ,p_business_group_id => l_per_details_rec.business_group_id
1030 ,p_person_type_id => p_person_type_id
1031 ,p_hire_all_accepted_asgs => p_hire_all_accepted_asgs
1032 ,p_assignment_id => p_assignment_id
1033 ,p_per_object_version_number => p_per_object_version_number
1034 ,p_national_identifier => p_national_identifier
1035 ,p_employee_number => p_employee_number
1036 );
1037 EXCEPTION
1038 WHEN hr_api.cannot_find_prog_unit
1039 THEN
1040 hr_api.cannot_find_prog_unit_error
1041 (p_module_name => 'HIRE_TO_EMPLOYEE_APPLICANT'
1042 ,p_hook_type => 'BP'
1043 );
1044 END;
1045 --
1046 hr_utility.set_location(l_proc,50);
1047 --
1048 -- Check the person is of a correct system person type
1049 --
1050 IF l_per_details_rec.system_person_type NOT IN
1051 ('APL','EMP_APL','EX_EMP_APL','APL_EX_APL')
1052 THEN
1053 hr_utility.set_location(l_proc,60);
1054 hr_utility.set_message(800,'PER_52096_APL_INV_PERSON_TYPE');
1055 hr_utility.raise_error;
1056 END IF;
1057 --
1058 hr_utility.set_location(l_proc,70);
1059 --
1060 -- Ensure the employee number will not be changed if it exists
1061 --
1062 IF l_per_details_rec.employee_number IS NOT NULL
1063 AND NVL(p_employee_number,hr_api.g_number) <> l_per_details_rec.employee_number
1064 THEN
1065 hr_utility.set_location(l_proc,80);
1066 p_employee_number := l_per_details_rec.employee_number;
1067 END IF;
1068 --
1069 hr_utility.set_location(l_proc,90);
1070 --
1071 -- Check the person does not have future assignment changes
1072 --
1073 IF l_hire_all_accepted_asgs = 'Y' then
1074 l_future_asgs_count := future_asgs_count
1075 (p_person_id => p_person_id
1076 ,p_effective_date => l_hire_date
1077 );
1078 ELSE --2264191 added this clause to enhance error handling
1079 l_future_asgs_count := future_asgs_count
1080 (p_person_id => p_person_id
1081 ,p_effective_date => l_hire_date
1082 ,p_assignment_id => p_assignment_id
1083 );
1084 END IF;
1085 IF l_future_asgs_count > 0
1086 THEN
1087 hr_utility.set_location(l_proc,100);
1088 hr_utility.set_message(800,'HR_7975_ASG_INV_FUTURE_ASA');
1089 hr_utility.raise_error;
1090 END IF;
1091 --
1092 hr_utility.set_location(l_proc,110);
1093 --
1094 -- If person type id is not null check it corresponds to type EMP_APL is
1095 -- currently active and in the correct business group, otherwise set person
1096 -- type id to the active default for EMP_APL in the correct business group
1097 --
1098 l_system_person_type := 'EMP_APL';
1099
1100 /* PTU changes: move this validation as now flavour of EMP must be specified
1101 now check before maintain_person_type_usage_call
1102 per_per_bus.chk_person_type
1103 (p_person_type_id => l_person_type_id
1104 ,p_business_group_id => l_per_details_rec.business_group_id
1105 ,p_expected_sys_type => l_system_person_type
1106 );
1107 */ --
1108 hr_utility.set_location(l_proc,120);
1109 --
1110 -- 2264191 changed behaviour: If hiring all accepted, ensure there are some nonaccepted
1111 -- applicant assignments that will remain for the person to be an applicant for.
1112 --
1113 l_nonaccepted_asgs_count := nonaccepted_asgs_count
1114 (p_person_id => p_person_id
1115 ,p_effective_date => l_hire_date
1116 );
1117 IF l_nonaccepted_asgs_count = 0
1118 AND l_hire_all_accepted_asgs = 'Y'
1119 THEN
1120 hr_utility.set_location(l_proc,130);
1121 hr_utility.set_message(800,'HR_289149_NOHIR_NO_UNACCEPTED'); --'PER_52098_APL_INV_ASG_STATUS');
1122 hr_utility.raise_error;
1123 END IF;
1124 --
1125 hr_utility.set_location(l_proc,140);
1126 --
1127 -- Ensure there are some accepted applicant assignments for the person to be
1128 -- hired into (applies pre and post 2264191)
1129 --
1130 l_accepted_asgs_count := accepted_asgs_count
1131 (p_person_id => p_person_id
1132 ,p_effective_date => l_hire_date
1133 );
1134 IF l_accepted_asgs_count = 0
1135 THEN
1136 hr_utility.set_location(l_proc,150);
1137 hr_utility.set_message(800,'HR_289150_NOHIR_NO_ACCEPTED'); --'PER_52098_APL_INV_ASG_STATUS');
1138 hr_utility.raise_error;
1139 END IF;
1140 --
1141 -- 2264191 changed behaviour: If hiring a single assignment
1142 -- ensure that there is more than one APL assignment to retain
1143 --
1144 IF l_hire_all_accepted_asgs = 'N'
1145 AND l_accepted_asgs_count + l_nonaccepted_asgs_count < 2
1146 THEN
1147 hr_utility.set_location(l_proc,155);
1148 hr_utility.set_message(800,'HR_289151_NOHIR_SGL_NO_RETAIN');
1149 hr_utility.raise_error;
1150 END IF;
1151 --
1152 hr_utility.set_location(l_proc,160);
1153 --
1154 -- 2264191 changed behaviour: Ensure the assignment id has been set
1155 -- if either no current primary employee
1156 -- assignment and multiple accepted applicant assignment exist, or if hiring a single
1157 -- assignment and no current primary employee assignments exist.
1158 -- Ensure it is null if a primary employee assignment already exists.
1159 --
1160 l_primary_asgs_count := primary_asgs_count
1161 (p_person_id => p_person_id
1162 ,p_effective_date => l_hire_date
1163 );
1164 IF l_primary_asgs_count = 0
1165 AND l_hire_all_accepted_asgs = 'Y' --replicate the behaviour pre2264191
1166 THEN
1167 hr_utility.set_location(l_proc,170);
1168 IF p_assignment_id IS NULL
1169 THEN
1170 hr_utility.set_location(l_proc,180);
1171 IF l_accepted_asgs_count = 1
1172 THEN
1173 hr_utility.set_location(l_proc,190);
1174 OPEN csr_accepted_asgs
1175 (p_person_id => p_person_id
1176 ,p_effective_date => l_hire_date
1177 );
1178 FETCH csr_accepted_asgs INTO l_accepted_asgs_rec;
1179 CLOSE csr_accepted_asgs;
1180 l_new_primary_asg_id := l_accepted_asgs_rec.assignment_id;
1181 ELSE
1182 hr_utility.set_location(l_proc,200);
1183 hr_api.mandatory_arg_error
1184 (p_api_name => l_proc
1185 ,p_argument => 'assignment_id'
1186 ,p_argument_value => p_assignment_id);
1187 END IF;
1188 ELSE
1189 l_new_primary_asg_id := p_assignment_id;
1190 END IF;
1191 ELSIF l_primary_asgs_count = 0 --2264191 hiring single asg, must make it primary
1192 AND l_hire_all_accepted_asgs = 'N'
1193 THEN
1194 hr_utility.set_location(l_proc,205);
1195 l_new_primary_asg_id := p_assignment_id;
1196 ELSE -- a primary already exists
1197 hr_utility.set_location(l_proc,210);
1198 --IF p_assignment_id IS NOT NULL
1199 --THEN
1200 hr_utility.set_location(l_proc,220);
1201 l_new_primary_asg_id := NULL;
1202 --END IF;
1203 END IF;
1204 --
1205 hr_utility.set_location(l_proc,230);
1206 --
1207 -- Ensure any assignment id specified is for the person, has an assignment
1208 -- type of A and a system status of ACCEPTED on the hire date
1209 --
1210 IF p_assignment_id IS NOT NULL
1211 THEN
1212 hr_utility.set_location(l_proc,240);
1213 OPEN csr_accepted_asgs
1214 (p_person_id => p_person_id
1215 ,p_effective_date => l_hire_date
1216 ,p_assignment_id => p_assignment_id
1217 );
1218 FETCH csr_accepted_asgs INTO l_accepted_asgs_rec;
1219 IF csr_accepted_asgs%NOTFOUND
1220 THEN
1221 hr_utility.set_location(l_proc,250);
1222 CLOSE csr_accepted_asgs;
1223 hr_utility.set_message(800,'HR_289152_NOHIR_ACCEPT_APL_ASG'); --'PER_52099_ASG_INV_ASG_ID');
1224 hr_utility.raise_error;
1225 END IF;
1226 CLOSE csr_accepted_asgs;
1227 END IF;
1228 --
1229 hr_utility.set_location(l_proc,260);
1230
1231 -- Start changes for bug 9879782
1232 if p_upload_irec_docs = 'Y' and p_validate = false then
1233 hr_utility.set_location('l_new_primary_asg_id'||l_new_primary_asg_id,326);
1234 hr_utility.set_location('p_assignment_id'||p_assignment_id,326);
1235
1236 open csr_get_appl_id(nvl(p_assignment_id,l_new_primary_asg_id));
1237 fetch csr_get_appl_id into l_appl_id;
1238 close csr_get_appl_id;
1239
1240 hr_utility.set_location('l_appl_id'||l_appl_id,326);
1241
1242 per_fnd_attachment_pkg.upload_irec_docs(
1243 p_person_id => p_PERSON_ID,
1244 p_assignment_id => nvl(p_assignment_id,l_new_primary_asg_id),
1245 p_application_id => l_appl_id,
1246 p_hire_date => p_hire_date,
1247 p_transaction_type => 'COREHR',
1248 p_transaction_status => 'ACTIVE',
1249 p_status => 'I');
1250 end if;
1251 -- End changes for bug 9879782
1252
1253 --
1254 -- PTU : Changes
1255
1256 l_person_type_id1 := hr_person_type_usage_info.get_default_person_type_id
1257 (l_per_details_rec.business_group_id,
1258 'EMP_APL');
1259 -- PTU : End of Changes
1260
1261 -- Update the person details to the new person type, if it has changed
1262 --
1263 IF l_per_details_rec.person_type_id <> l_person_type_id1
1264 THEN
1265 hr_utility.set_location(l_proc,270);
1266 --2931560 added check for future person changes
1267 open csr_future_per_changes(l_hire_date);
1268 fetch csr_future_per_changes into l_dummy;
1269 if csr_future_per_changes%found then
1270 close csr_future_per_changes;
1271 -- hr_utility.set_message('PER','HR_289729_FUT_PER_NOHIR');
1272 hr_utility.set_message(800,'HR_289729_FUT_PER_NOHIR'); -- Bug 2931560
1273 hr_utility.raise_error;
1274 else
1275 close csr_future_per_changes;
1276 end if;
1277 --
1278 per_per_upd.upd
1279 (p_person_id => p_person_id
1280 ,p_effective_start_date => l_per_effective_start_date
1281 ,p_effective_end_date => l_per_effective_end_date
1282 ,p_person_type_id => l_person_type_id1
1283 ,p_applicant_number => l_per_details_rec.applicant_number
1284 ,p_comment_id => l_comment_id
1285 ,p_current_applicant_flag => l_current_applicant_flag
1286 ,p_current_emp_or_apl_flag => l_current_emp_or_apl_flag
1287 ,p_current_employee_flag => l_current_employee_flag
1288 ,p_employee_number => p_employee_number
1289 ,p_full_name => l_full_name
1290 ,p_national_identifier => p_national_identifier
1291 ,p_object_version_number => l_object_version_number -- 3684087
1292 ,p_effective_date => l_hire_date
1293 ,p_datetrack_mode => hr_api.g_update
1294 ,p_name_combination_warning => l_name_combination_warning
1295 ,p_dob_null_warning => l_assign_payroll_warning
1296 ,p_orig_hire_warning => l_orig_hire_warning
1297 ,p_npw_number => l_per_details_rec.npw_number
1298 );
1299 ELSE
1300 hr_utility.set_location(l_proc,280);
1301 l_per_effective_start_date := l_per_details_rec.effective_start_date;
1302 l_per_effective_end_date := l_per_details_rec.effective_end_date;
1303 END IF;
1304 --
1305 --
1306 hr_utility.set_location(l_proc,290);
1307 --
1308 -- Derive the current period of service, and create one if it does not exist
1309 --
1310 l_pds_details_rec := pds_details
1311 (p_person_id => p_person_id
1312 ,p_effective_date => l_hire_date
1313 );
1314 IF l_pds_details_rec.period_of_service_id IS NULL
1315 THEN
1316 hr_utility.set_location(l_proc,300);
1317 per_pds_ins.ins
1318 (p_person_id => p_person_id
1319 ,p_business_group_id => l_per_details_rec.business_group_id
1320 ,p_date_start => l_hire_date
1321 ,p_effective_date => l_hire_date
1322 ,p_period_of_service_id => l_pds_details_rec.period_of_service_id
1323 ,p_object_version_number => l_pds_details_rec.object_version_number
1324 ,p_validate_df_flex => false -- fix for bug 8587538
1325 );
1326 END IF;
1327 --
1328 -- PTU : Following Code has been added
1329 --
1330 begin
1331 select ptuf.person_type_id into l_person_type_id1
1332 from per_person_type_usages_f ptuf, per_person_types ppt
1333 where ptuf.person_id = p_person_id
1334 and l_hire_date between ptuf.effective_start_date and ptuf.effective_end_date
1335 and ppt.person_type_id = ptuf.person_type_id
1336 and ppt.system_person_type = 'EMP';
1337 exception
1338 when no_data_found then
1339 l_person_type_id1 := null; --added for 2264191, to refine the following IF clause
1340 end;
1341 --
1342 -- IF l_pds_details_rec.period_of_service_id IS NULL
1343 -- OR (l_pds_details_rec.period_of_service_id IS NOT NULL
1344 -- AND l_person_type_id <> l_person_type_id1)
1345 --
1346 -- 2264191 Refined this check
1347 --
1348 IF (l_person_type_id1 is null) -- inserting
1349 OR (l_person_type_id1 is not null -- updating with a change in PTU
1350 AND nvl(l_person_type_id,l_person_type_id1) <> l_person_type_id1)
1351 THEN
1352 per_per_bus.chk_person_type
1353 (p_person_type_id => l_person_type_id
1354 ,p_business_group_id => l_per_details_rec.business_group_id
1355 ,p_expected_sys_type => 'EMP'
1356 );
1357 --
1358 hr_per_type_usage_internal.maintain_person_type_usage
1359 (p_effective_date => l_hire_date
1360 ,p_person_id => p_person_id
1361 ,p_person_type_id => l_person_type_id
1362 );
1363 END IF;
1364 --
1365 -- PTU : End of changes
1366 --
1367 hr_utility.set_location(l_proc,310);
1368 --
1369 -- Derive assignment status type id for default system status type of
1370 -- ACTIVE_ASSIGN for this business group
1371 --
1372 per_asg_bus1.chk_assignment_status_type
1373 (p_assignment_status_type_id => l_assignment_status_type_id
1374 ,p_business_group_id => l_per_details_rec.business_group_id
1375 ,p_legislation_code => l_per_details_rec.legislation_code
1376 ,p_expected_system_status => 'ACTIVE_ASSIGN'
1377 );
1378 --
1379 hr_utility.set_location(l_proc,320);
1380 --
1381 l_oversubscribed_vacancy_id :=null;
1382 --
1383 -- 2264191 changed behaviour: If p_hire_all_accepted_asgs = 'Y' then
1384 -- set all accepted assignments to be active assignments, marking the
1385 -- assignment specified to be the primary assignment
1386 -- ELSE single hire only processes the specified assignment it has already been marked
1387 -- primary if no employee primaries exist
1388 --
1389 FOR l_accepted_asgs_rec IN
1390 csr_accepted_asgs
1391 (p_person_id => p_person_id
1392 ,p_effective_date => l_hire_date
1393 )
1394 LOOP
1395 l_primary_flag := 'N';
1396 IF l_accepted_asgs_rec.assignment_id = l_new_primary_asg_id
1397 THEN
1398 l_primary_flag := 'Y';
1399 END IF;
1400 IF l_hire_all_accepted_asgs = 'Y'
1401 OR ( l_hire_all_accepted_asgs = 'N'
1402 AND l_hire_single_asg_id = l_accepted_asgs_rec.assignment_id)
1403 THEN
1404 --
1405 -- 2264191 only process the assignment (in all cases it has to be accepted anyway)
1406 -- if we are processing all assignments
1407 -- or if processing one and the assignment_id matches
1408 --
1409 per_asg_upd.upd
1410 (p_assignment_id => l_accepted_asgs_rec.assignment_id
1411 ,p_effective_start_date => l_effective_start_date
1412 ,p_effective_end_date => l_effective_end_date
1413 ,p_business_group_id => l_business_group_id
1414 ,p_assignment_status_type_id => l_assignment_status_type_id
1415 ,p_assignment_type => 'E'
1416 ,p_primary_flag => l_primary_flag
1417 ,p_period_of_service_id => l_pds_details_rec.period_of_service_id
1418 ,p_comment_id => l_comment_id
1419 ,p_object_version_number => l_accepted_asgs_rec.object_version_number
1420 ,p_payroll_id_updated => l_payroll_id_updated
1421 ,p_other_manager_warning => l_other_manager_warning
1422 ,p_no_managers_warning => l_no_managers_warning
1423 ,p_org_now_no_manager_warning => l_org_now_no_manager_warning
1424 ,p_validation_start_date => l_validation_start_date
1425 ,p_validation_end_date => l_validation_end_date
1426 ,p_effective_date => l_hire_date
1427 ,p_datetrack_mode => hr_api.g_update
1428 ,p_hourly_salaried_warning => l_hourly_salaried_warning
1429 );
1430 --
1431 -- Fix For Bug: 12612530 Starts ----
1432 update_salary_proposal(l_accepted_asgs_rec.assignment_id, l_hire_date);
1433 -- Fix For Bug: 12612530 Ends ----
1434
1435 open csr_vacs(l_accepted_asgs_rec.vacancy_id);
1436 fetch csr_vacs into l_dummy;
1437 if csr_vacs%found then
1438 close csr_vacs;
1439 l_oversubscribed_vacancy_id :=l_accepted_asgs_rec.vacancy_id;
1440 else
1441 close csr_vacs;
1442 end if;
1443 --
1444 END IF; --end of test if processing all asgs or matching single asg
1445 END LOOP;
1446 --
1447 hr_utility.set_location(l_proc,325);
1448 --
1449 -- Maintain person type usage record
1450 --
1451 /* Removed for PTU changes, since covered by previous call to maintain
1452 hr_per_type_usage_internal.create_person_type_usage
1453 (p_effective_date => l_hire_date
1454 ,p_person_id => p_person_id
1455 ,p_person_type_id => l_person_type_id
1456 ,p_person_type_usage_id => l_person_type_usage_id
1457 ,p_effective_start_date => l_effective_start_date
1458 ,p_effective_end_date => l_effective_end_date
1459 ,p_object_version_number => l_object_version_number
1460 );
1461 */
1462 --
1463 hr_utility.set_location(l_proc,330);
1464
1465 -- Start chagnes for bug 9879782
1466 if p_upload_irec_docs = 'Y' and p_validate = false then
1467
1468 per_fnd_attachment_pkg.adjust_irec_docs (
1469 p_person_id => P_person_id,
1470 p_assignment_id => nvl(p_assignment_id,l_new_primary_asg_id),
1471 p_application_id => l_appl_id,
1472 p_old_hire_date => p_hire_date,
1473 p_hire_date => p_hire_date,
1474 p_transaction_type => 'COREHR',
1475 p_transaction_status => 'COMPLETE',
1476 p_status => 'I',
1477 p_adjustment_type => 'COMMIT');
1478 end if;
1479 -- End chagnes for bug 9879782
1480
1481 hr_utility.set_location(l_proc,340);
1482 --
1483 -- Call After Process User Hook
1484 --
1485 BEGIN
1486 hr_employee_applicant_bk1.hire_to_employee_applicant_a
1487 (p_hire_date => l_hire_date
1488 ,p_person_id => p_person_id
1489 ,p_business_group_id => l_per_details_rec.business_group_id
1490 ,p_person_type_id => p_person_type_id
1491 ,p_hire_all_accepted_asgs => p_hire_all_accepted_asgs
1492 ,p_assignment_id => p_assignment_id
1493 ,p_per_object_version_number => p_per_object_version_number
1494 ,p_national_identifier => p_national_identifier
1495 ,p_employee_number => p_employee_number
1496 ,p_per_effective_start_date => l_per_effective_start_date
1497 ,p_per_effective_end_date => l_per_effective_end_date
1498 ,p_assign_payroll_warning => l_assign_payroll_warning
1499 ,p_oversubscribed_vacancy_id => l_oversubscribed_vacancy_id
1500 );
1501 EXCEPTION
1502 WHEN hr_api.cannot_find_prog_unit
1503 THEN
1504 hr_api.cannot_find_prog_unit_error
1505 (p_module_name => 'HIRE_TO_EMPLOYEE_APPLICANT'
1506 ,p_hook_type => 'AP'
1507 );
1508 END;
1509 --
1510 hr_utility.set_location(l_proc,340);
1511 --
1512 -- When in validation only mode raise validate_enabled exception
1513 --
1514 IF p_validate
1515 THEN
1516 RAISE hr_api.validate_enabled;
1517 END IF;
1518 --
1519 -- Set OUT parameters
1520 --
1521 p_per_object_version_number := l_object_version_number; -- 3684087
1522 p_employee_number := l_employee_number;
1523 p_per_effective_start_date := l_per_effective_start_date;
1524 p_per_effective_end_date := l_per_effective_end_date;
1525 p_assign_payroll_warning := l_assign_payroll_warning;
1526 p_oversubscribed_vacancy_id := l_oversubscribed_vacancy_id ;
1527 --
1528 hr_utility.set_location(' Leaving:'||l_proc,1000);
1529 --
1530 EXCEPTION
1531 --
1532 WHEN hr_api.validate_enabled
1533 THEN
1534 --
1535 -- In validation only mode
1536 -- Rollback to savepoint
1537 -- Set relevant output warning arguments
1538 -- Reset any key or derived arguments
1539 --
1540 ROLLBACK TO hire_to_employee_applicant;
1541 p_per_object_version_number := l_per_object_version_number;
1542 p_employee_number := l_employee_number;
1543 p_per_effective_start_date := NULL;
1544 p_per_effective_end_date := NULL;
1545 p_assign_payroll_warning := l_assign_payroll_warning;
1546 p_oversubscribed_vacancy_id := l_oversubscribed_vacancy_id ;
1547 --
1548 WHEN OTHERS
1549 THEN
1550 --
1551 -- Validation or unexpected error occured
1552 -- Ensure opened non-local cursors are closed
1553 -- Rollback to savepoint
1554 -- Re-raise exception
1555 --
1556 ROLLBACK TO hire_to_employee_applicant;
1557 --
1558 -- set in out parameters and set out parameters
1559 --
1560 p_per_object_version_number := l_ovn;
1561 p_employee_number := l_emp_num;
1562 p_per_effective_start_date := NULL;
1563 p_per_effective_end_date := NULL;
1564 p_assign_payroll_warning := false;
1565 p_oversubscribed_vacancy_id := null;
1566 --
1567 IF csr_accepted_asgs%ISOPEN
1568 THEN
1569 CLOSE csr_accepted_asgs;
1570 END IF;
1571 RAISE;
1572 --
1573 END hire_to_employee_applicant;
1574 --
1575 -- ---------------------------------------------------------------------------
1576 -- |-------------------------< hire_employee_applicant >---------------------|
1577 -- ---------------------------------------------------------------------------
1578 -- This procedure is overloaded to keep the parameters in line with the base
1579 -- release
1580 --
1581 procedure hire_employee_applicant
1582 (p_validate in boolean default false,
1583 p_hire_date in date,
1584 p_person_id in per_all_people_f.person_id%TYPE,
1585 p_per_object_version_number in out nocopy per_all_people_f.object_version_number%TYPE,
1586 p_person_type_id in number default null,
1587 p_assignment_id in number default null,
1588 p_per_effective_start_date out nocopy date,
1589 p_per_effective_end_date out nocopy date,
1590 p_unaccepted_asg_del_warning out nocopy boolean,
1591 p_assign_payroll_warning out nocopy boolean
1592 )
1593 is
1594 --
1595 -- Declare cursors and local variables
1596 --
1597 l_proc varchar2(72) := g_package||'hire__employee_applicant';
1598 --
1599 l_per_object_version_number per_all_people_f.object_version_number%TYPE;
1600 l_per_effective_start_date date;
1601 l_per_effective_end_date date;
1602 l_unaccepted_asg_del_warning boolean;
1603 l_assign_payroll_warning boolean;
1604 l_oversubscribed_vacancy_id number;
1605 --
1606 begin
1607 --
1608 hr_utility.set_location('Entering:'|| l_proc, 10);
1609 --
1610 l_per_object_version_number:=p_per_object_version_number;
1611 --
1612 hr_employee_applicant_api.hire_employee_applicant
1613 (p_validate => p_validate
1614 ,p_hire_date => p_hire_date
1615 ,p_person_id => p_person_id
1616 ,p_primary_assignment_id => p_assignment_id
1617 ,p_person_type_id => p_person_type_id
1618 ,p_per_object_version_number => l_per_object_version_number
1619 ,p_per_effective_start_date => l_per_effective_start_date
1620 ,p_per_effective_end_date => l_per_effective_end_date
1621 ,p_unaccepted_asg_del_warning => l_unaccepted_asg_del_warning
1622 ,p_assign_payroll_warning => l_assign_payroll_warning
1623 ,p_oversubscribed_vacancy_id => l_oversubscribed_vacancy_id
1624 );
1625 p_per_object_version_number := l_per_object_version_number;
1626 p_per_effective_start_date := l_per_effective_start_date;
1627 p_per_effective_end_date := l_per_effective_end_date;
1628 p_unaccepted_asg_del_warning := l_unaccepted_asg_del_warning;
1629 p_assign_payroll_warning := l_assign_payroll_warning;
1630 --
1631 hr_utility.set_location('Leaving:'|| l_proc, 20);
1632 --
1633 end hire_employee_applicant;
1634
1635 --
1636 -- Start changes for bug 9879782
1637 -- ---------------------------------------------------------------------------
1638 -- |-------------------------< hire_employee_applicant >---------------------|
1639 -- ---------------------------------------------------------------------------
1640 --
1641 procedure hire_employee_applicant
1642 (p_validate in boolean default false,
1643 p_hire_date in date,
1644 p_person_id in per_all_people_f.person_id%TYPE,
1645 p_primary_assignment_id in number default null,
1646 p_person_type_id in number default null,
1647 p_overwrite_primary in varchar2 default 'N',
1648 p_per_object_version_number in out nocopy per_all_people_f.object_version_number%TYPE,
1649 p_per_effective_start_date out nocopy date,
1650 p_per_effective_end_date out nocopy date,
1651 p_unaccepted_asg_del_warning out nocopy boolean,
1652 p_assign_payroll_warning out nocopy boolean
1653 ,p_oversubscribed_vacancy_id out nocopy number
1654 )
1655 is
1656 l_proc varchar2(72) := g_package||'hire_employee_applicant';
1657 BEGIN
1658
1659 hr_utility.set_location('Entering:'|| l_proc, 10);
1660
1661 hr_employee_applicant_api.hire_employee_applicant
1662 (p_validate => p_validate
1663 ,p_hire_date => p_hire_date
1664 ,p_person_id => p_person_id
1665 ,p_primary_assignment_id => p_primary_assignment_id
1666 ,p_person_type_id => p_person_type_id
1667 ,p_overwrite_primary => p_overwrite_primary --Added for bug#14195398
1668 ,p_per_object_version_number => p_per_object_version_number
1669 ,p_per_effective_start_date => p_per_effective_start_date
1670 ,p_per_effective_end_date => p_per_effective_end_date
1671 ,p_unaccepted_asg_del_warning => p_unaccepted_asg_del_warning
1672 ,p_assign_payroll_warning => p_assign_payroll_warning
1673 ,p_oversubscribed_vacancy_id => p_oversubscribed_vacancy_id
1674 ,p_upload_irec_docs => 'N'
1675 );
1676
1677 hr_utility.set_location('Leaving:'|| l_proc, 20);
1678
1679 END;
1680 -- End changes for bug 9879782
1681 --
1682
1683 --
1684 -- ---------------------------------------------------------------------------
1685 -- |-------------------------< hire_employee_applicant >---------------------|
1686 -- ---------------------------------------------------------------------------
1687 --
1688 procedure hire_employee_applicant
1689 (p_validate in boolean default false,
1690 p_hire_date in date,
1691 p_person_id in per_all_people_f.person_id%TYPE,
1692 p_primary_assignment_id in number default null,
1693 p_person_type_id in number default null,
1694 p_overwrite_primary in varchar2 default 'N',
1695 p_per_object_version_number in out nocopy per_all_people_f.object_version_number%TYPE,
1696 p_per_effective_start_date out nocopy date,
1697 p_per_effective_end_date out nocopy date,
1698 p_unaccepted_asg_del_warning out nocopy boolean,
1699 p_assign_payroll_warning out nocopy boolean,
1700 p_oversubscribed_vacancy_id out nocopy number,
1701 p_upload_irec_docs in varchar2 --added for bug 9879782
1702 )
1703 is
1704 --
1705 -- Declare cursors and local variables
1706 --
1707 l_proc varchar2(72) := g_package||'hire_employee_applicant';
1708 --
1709 l_exists varchar2(1);
1710 l_count number;
1711 l_chk_system_status per_assignment_status_types.per_system_status%TYPE;
1712 l_chk_person_id per_all_people_f.person_id%TYPE;
1713 --
1714 l_person_type_id number := p_person_type_id;
1715 l_person_type_id1 number;
1716 l_unaccepted_asg_del_warning boolean;
1717 --
1718 l_primary_assignment_id number:=p_primary_assignment_id;
1719 --
1720 l_system_person_type per_person_types.system_person_type%TYPE;
1721 l_business_group_id per_all_people_f.business_group_id%TYPE;
1722 l_legislation_code per_business_groups.legislation_code%TYPE;
1723 l_application_id per_applications.application_id%TYPE;
1724 l_apl_object_version_number per_applications.application_id%TYPE;
1725 --
1726 l_hire_date date;
1727 --
1728 l_per_system_status per_assignment_status_types.per_system_status%TYPE;
1729 l_assignment_id per_assignments_f.assignment_id%TYPE;
1730 l_asg_object_version_number per_assignments_f.object_version_number%TYPE;
1731 --
1732 l_per_object_version_number per_all_people_f.object_version_number%TYPE;
1733 l_ovn per_all_people_f.object_version_number%TYPE := p_per_object_version_number;
1734 l_employee_number per_all_people_f.employee_number%TYPE;
1735 l_applicant_number per_all_people_f.applicant_number%TYPE;
1736 l_npw_number per_all_people_f.npw_number%TYPE;
1737 l_per_effective_start_date per_all_people_f.effective_start_date%TYPE;
1738 l_per_effective_end_date per_all_people_f.effective_end_date%TYPE;
1739 l_comment_id per_assignments_f.comment_id%TYPE;
1740 l_current_applicant_flag varchar2(1);
1741 l_current_emp_or_apl_flag varchar2(1);
1742 l_current_employee_flag varchar2(1);
1743 l_full_name per_all_people_f.full_name%TYPE;
1744 l_name_combination_warning boolean;
1745 l_assign_payroll_warning boolean;
1746 l_orig_hire_warning boolean;
1747 l_oversubscribed_vacancy_id number;
1748 --Added for 5277866
1749 l_check_loop number:=0;
1750 --
1751 l_period_of_service_id per_periods_of_service.period_of_service_id%TYPE;
1752 l_pds_object_version_number per_periods_of_service.object_version_number%TYPE;
1753 --
1754 l_assignment_status_type_id per_assignments_f.assignment_status_type_id%TYPE;
1755 --
1756 l_primary_flag per_assignments_f.primary_flag%TYPE;
1757 --
1758 l_effective_start_date per_assignments_f.effective_start_date%TYPE;
1759 l_effective_end_date per_assignments_f.effective_end_date%TYPE;
1760 l_validation_start_date date;
1761 l_validation_end_date date;
1762 l_payroll_id_updated boolean;
1763 l_other_manager_warning boolean;
1764 l_no_managers_warning boolean;
1765 l_org_now_no_manager_warning boolean;
1766 l_hourly_salaried_warning boolean;
1767 l_datetrack_update_mode varchar2(30);
1768 --
1769 l_primary_asg_id per_all_assignments_f.assignment_id%type;
1770 l_primary_ovn per_all_assignments_f.object_version_number%type;
1771 l_dummy number;
1772 l_dummy1 number;
1773 l_dummy2 number;
1774 l_dummyv varchar2(700);
1775 l_dummyb boolean;
1776 -- 2788390 starts here
1777 l_dummynum1 number;
1778 -- 2788390 ends here
1779 --added as per bug 5102160
1780 l_gsp_post_process_warning varchar2(2000); -- bug2999562
1781 l_concatenated_segments hr_soft_coding_keyflex.concatenated_segments%TYPE;
1782 --
1783 --
1784 cursor csr_future_asg_changes is
1785 select 'x'
1786 from per_assignments_f asg
1787 where asg.person_id = p_person_id
1788 and asg.effective_start_date > p_hire_date;
1789 -- ER FPT
1790 cursor fpt_future_asg_changes is
1791 select 'x'
1792 from per_all_assignments_f asg
1793 where asg.person_id = p_person_id
1794 and asg.effective_start_date >= p_hire_date
1795 and asg.assignment_type = 'E';
1796
1797 cursor csr_get_devived_details is
1798 select per.effective_start_date,
1799 ppt.system_person_type,
1800 per.business_group_id,
1801 bus.legislation_code,
1802 per.employee_number,
1803 per.npw_number,
1804 pap.application_id,
1805 pap.object_version_number
1806 from per_all_people_f per,
1807 per_business_groups bus,
1808 per_person_types ppt,
1809 per_applications pap
1810 where per.person_type_id = ppt.person_type_id
1811 and per.business_group_id = bus.business_group_id
1812 and per.person_id = pap.person_id
1813 and per.person_id = p_person_id
1814 and l_hire_date between per.effective_start_date
1815 and per.effective_end_date
1816 and l_hire_date between pap.date_received
1817 and nvl(pap.date_end,hr_api.g_eot);
1818 --
1819 cursor csr_chk_asg_status is
1820 select count(asg.assignment_id)
1821 from per_assignments_f asg,
1822 per_assignment_status_types pas
1823 where asg.assignment_status_type_id = pas.assignment_status_type_id
1824 and asg.person_id = p_person_id
1825 and pas.per_system_status = 'ACCEPTED'
1826 and l_hire_date between asg.effective_start_date
1827 and asg.effective_end_date;
1828 --
1829 cursor csr_chk_assignment_id is
1830 select per.person_id,
1831 pas.per_system_status
1832 from per_all_people_f per,
1833 per_assignments_f asg,
1834 per_assignment_status_types pas
1835 where asg.assignment_status_type_id = pas.assignment_status_type_id
1836 and per.person_id = asg.person_id
1837 and l_hire_date between per.effective_start_date
1838 and per.effective_end_date
1839 and asg.assignment_id = p_primary_assignment_id
1840 and l_hire_date between asg.effective_start_date
1841 and asg.effective_end_date;
1842 --
1843 cursor csr_get_un_accepted is
1844 select asg.assignment_id,
1845 asg.object_version_number
1846 from per_assignments_f asg,
1847 per_assignment_status_types pas
1848 where asg.assignment_status_type_id = pas.assignment_status_type_id
1849 and asg.person_id = p_person_id
1850 and asg.assignment_type='A'
1851 and l_hire_date between asg.effective_start_date
1852 and asg.effective_end_date
1853 and pas.per_system_status <> 'ACCEPTED'
1854 order by asg.assignment_id;
1855 --
1856 /*
1857 cursor csr_get_accepted is
1858 select asg.assignment_id,
1859 asg.object_version_number,
1860 asg.effective_start_date,
1861 asg.vacancy_id
1862 from per_assignments_f asg,
1863 per_assignment_status_types pas
1864 where asg.assignment_status_type_id = pas.assignment_status_type_id
1865 and asg.person_id = p_person_id
1866 and l_hire_date between asg.effective_start_date
1867 and asg.effective_end_date
1868 and pas.per_system_status = 'ACCEPTED'
1869 order by asg.assignment_id;
1870 */
1871 -- modified the above cursor for the bug 5534570
1872 cursor csr_get_accepted is
1873 select asg.assignment_id,
1874 asg.object_version_number,
1875 asg.effective_start_date,
1876 asg.vacancy_id
1877
1878 from per_assignments_f asg,
1879 per_assignment_status_types pas
1880 where asg.assignment_status_type_id = pas.assignment_status_type_id
1881 and asg.person_id = p_person_id
1882 and l_hire_date between asg.effective_start_date
1883 and asg.effective_end_date
1884 and pas.per_system_status = 'ACCEPTED'
1885 order by decode(asg.assignment_id,p_primary_assignment_id,1,0) desc;
1886 --
1887 --
1888 cursor get_primary is
1889 select assignment_id,object_version_number, period_of_service_id -- #2468916
1890 from per_all_assignments_f
1891 where person_id=p_person_id
1892 and primary_flag='Y'
1893 and l_hire_date between effective_start_date and effective_end_date
1894 and assignment_type='E';
1895 --
1896 cursor get_asg(p_assignment_id number) is
1897 select *
1898 from per_all_assignments_f asg
1899 where asg.assignment_id=p_assignment_id
1900 and l_hire_date between asg.effective_start_date
1901 and asg.effective_end_date;
1902 --
1903 l_asg_rec per_all_assignments_f%rowtype;
1904 l_primary_asg_rec per_all_assignments_f%rowtype;
1905 --
1906 cursor get_pgp(p_people_group_id number) is
1907 select *
1908 from pay_people_groups
1909 where people_group_id=p_people_group_id;
1910 --
1911 l_pgp_rec pay_people_groups%rowtype :=NULL;
1912 l_primary_pgp_rec pay_people_groups%rowtype;
1913 --
1914 cursor get_scl(p_soft_coding_keyflex_id number) is
1915 select *
1916 from hr_soft_coding_keyflex
1917 where soft_coding_keyflex_id=p_soft_coding_keyflex_id;
1918 --
1919 l_scl_rec hr_soft_coding_keyflex%rowtype :=NULL;
1920 l_primary_scl_rec hr_soft_coding_keyflex%rowtype :=NULL;
1921 --
1922 cursor get_cag(p_cagr_grade_def_id number) is
1923 select *
1924 from per_cagr_grades_def
1925 where cagr_grade_def_id=p_cagr_grade_def_id;
1926 --
1927 l_cag_rec per_cagr_grades_def%rowtype :=NULL;
1928 l_primary_cag_rec per_cagr_grades_def%rowtype;
1929 --
1930 cursor csr_vacs(p_vacancy_id number) is
1931 select 1
1932 from per_all_vacancies vac
1933 where vac.vacancy_id=p_vacancy_id
1934 and vac.number_of_openings <
1935 (select count(distinct assignment_id)
1936 from per_all_assignments_f asg
1937 where asg.vacancy_id=p_vacancy_id
1938 and asg.assignment_type='E');
1939 --
1940 -- Bug 4644830 Start
1941 cursor get_pay_proposal(ass_id per_all_assignments_f.assignment_id%type) is
1942 select pay_proposal_id,object_version_number,proposed_salary_n, change_date, proposal_reason -- Added For Bug 5987409 --
1943 from per_pay_proposals
1944 where assignment_id=ass_id
1945 and approved = 'N'
1946 order by change_date desc;
1947 l_pay_pspl_id per_pay_proposals.pay_proposal_id%TYPE;
1948 l_pay_obj_number per_pay_proposals.object_version_number%TYPE;
1949 l_proposed_sal_n per_pay_proposals.proposed_salary_n%TYPE;
1950 l_dummy_change_date per_pay_proposals.change_date%TYPE;
1951 l_inv_next_sal_date_warning boolean := false;
1952 l_proposed_salary_warning boolean := false;
1953 l_approved_warning boolean := false;
1954 l_payroll_warning boolean := false;
1955 l_proposal_reason per_pay_proposals.proposal_reason%TYPE; -- Added For Bug 5987409 --
1956 -- Bug 4644830 End
1957 --
1958 -- start of bug 4641965
1959 l_pspl_asg_id per_all_assignments_f.assignment_id%type;
1960 cursor get_primary_proposal(ass_id per_all_assignments_f.assignment_id%type) is
1961 select pay_proposal_id,object_version_number
1962 from per_pay_proposals
1963 where assignment_id=ass_id
1964 and APPROVED='N';
1965 -- end 4641965
1966
1967 --Bug 4959033 starts here
1968
1969 cursor get_business_group(p_asg_id number) is
1970 select distinct PAAF.business_group_id
1971 from per_all_assignments_f PAAF
1972 where PAAF.assignment_id=p_asg_id;
1973 l_bg_id number;
1974
1975 cursor get_primary_approved_proposal(ass_id per_all_assignments_f.assignment_id%type) is
1976 select pay_proposal_id
1977 from per_pay_proposals
1978 where assignment_id=ass_id
1979 and APPROVED='Y';
1980
1981 --Bug 4959033 ends here
1982 --
1983 --Bug 5102289 starts here
1984 l_pay_basis_id per_all_assignments_f.pay_basis_id%type;
1985 l_approved varchar2(10);
1986 cursor get_primary_pay_basis(p_asg_id number) is
1987 select PAAF.pay_basis_id
1988 from per_all_assignments_f PAAF
1989 where PAAF.assignment_id=p_asg_id;
1990 --Bug 5102289 ends here
1991
1992 -- Start changes for bug 9879782
1993 cursor csr_get_appl_id(lp_assignment_id number) is
1994 select application_id
1995 from per_all_assignments_f
1996 where assignment_id = lp_assignment_id
1997 and p_hire_date between effective_start_date and effective_end_date;
1998
1999 l_appl_id number;
2000 -- End changes for bug 9879782
2001
2002 -- ER FPT
2003 l_fpt_hire_flag varchar2(1) := 'N';
2004 l_apl_end_date date;
2005 l_current_apl_end_date date;
2006 l_cur_apl_id number;
2007 l_new_application_id number;
2008 l_yes_backtoback varchar2(1) := 'N';
2009
2010 cursor chk_future_changes(p_assignment_id number) is
2011 select 'Y' from per_all_assignments_f
2012 where person_id = p_person_id
2013 and assignment_id = p_assignment_id
2014 and effective_start_date >= p_hire_date;
2015
2016 cursor csr_get_apln_details(p_hire_date date) is
2017 select date_received,date_end
2018 from per_applications
2019 where person_id= p_person_id and date_received > p_hire_date;
2020
2021 cursor csr_back_toback_apln(p_date_end date) is
2022 select 'Y' from per_applications
2023 where person_id = p_person_id
2024 and date_received = p_date_end +1;
2025
2026 cursor fut_asg_rec is
2027 select assignment_id, effective_start_date, effective_end_date
2028 from per_all_assignments_f
2029 where person_id = p_person_id
2030 and assignment_type = 'A'
2031 and effective_start_date > l_hire_date
2032 and application_id = l_application_id
2033 order by effective_start_date;
2034
2035 cursor chk_apl_exists(p_asg_start_date date) is
2036 select application_id, date_end from per_applications
2037 where person_id = p_person_id
2038 and p_asg_start_date between date_received and nvl(date_end,hr_api.g_eot);
2039 -- ER FPT
2040
2041 begin
2042 hr_utility.set_location('Entering:'|| l_proc, 10);
2043 --
2044 hr_api.mandatory_arg_error
2045 (p_api_name => l_proc
2046 ,p_argument => 'person_id'
2047 ,p_argument_value => p_person_id
2048 );
2049 --
2050 hr_api.mandatory_arg_error
2051 (p_api_name => l_proc
2052 ,p_argument => 'hire_date'
2053 ,p_argument_value => p_hire_date
2054 );
2055 --
2056 -- Issue a savepoint.
2057 --
2058 savepoint hire_employee_applicant;
2059 --
2060 hr_utility.set_location(l_proc, 20);
2061 --
2062 -- Process Logic
2063 --
2064 -- Truncate the time portion from all date parameters
2065 -- which are passed in.
2066 --
2067 l_hire_date := trunc(p_hire_date);
2068 l_per_object_version_number:=p_per_object_version_number;
2069 --
2070 -- Call Before Process User Hook for hire_applicant
2071 --
2072 begin
2073 hr_employee_applicant_bk2.hire_employee_applicant_b
2074 (
2075 p_hire_date => l_hire_date,
2076 p_person_id => p_person_id,
2077 p_primary_assignment_id => p_primary_assignment_id,
2078 p_overwrite_primary => p_overwrite_primary,
2079 p_person_type_id => p_person_type_id,
2080 p_per_object_version_number => l_per_object_version_number
2081 );
2082 exception
2083 when hr_api.cannot_find_prog_unit then
2084 hr_api.cannot_find_prog_unit_error
2085 (p_module_name => 'HIRE_EMPLOYEE_APPLICANT'
2086 ,p_hook_type => 'BP'
2087 );
2088 --
2089 -- End of the before hook for hire_employee_applicant
2090 --
2091 end;
2092 --
2093 -- Check that there are not any future changes to the assignment
2094 --
2095 hr_utility.set_location(l_proc, 30);
2096 -- ER FPT
2097 open csr_future_asg_changes;
2098 fetch csr_future_asg_changes into l_exists;
2099 if csr_future_asg_changes%FOUND then
2100 --
2101 hr_utility.set_location(l_proc,40);
2102 if (nvl(fnd_profile.value('HR_ALLOW_FPT_UPDATES'),'N') = 'Y') then
2103 open fpt_future_asg_changes;
2104 fetch fpt_future_asg_changes into l_exists;
2105 if fpt_future_asg_changes%found then
2106 hr_utility.set_message(801,'HR_7975_ASG_INV_FUTURE_ASA');
2107 hr_utility.raise_error;
2108 end if;
2109 close fpt_future_asg_changes;
2110 else
2111 hr_utility.set_message(801,'HR_7975_ASG_INV_FUTURE_ASA');
2112 hr_utility.raise_error;
2113 end if;
2114 end if;
2115 close csr_future_asg_changes;
2116 --
2117 hr_utility.set_location(l_proc,45);
2118 --
2119 -- Get the derived details for the person DT instance
2120 --
2121 open csr_get_devived_details;
2122 fetch csr_get_devived_details
2123 into l_per_effective_start_date,
2124 l_system_person_type,
2125 l_business_group_id,
2126 l_legislation_code,
2127 l_employee_number,
2128 l_npw_number,
2129 l_application_id,
2130 l_apl_object_version_number;
2131 if csr_get_devived_details%NOTFOUND
2132 then
2133 --
2134 hr_utility.set_location(l_proc,50);
2135 --
2136 close csr_get_devived_details;
2137 --
2138 hr_utility.set_message(800,'PER_52097_APL_INV_PERSON_ID');
2139 hr_utility.raise_error;
2140 --
2141 end if;
2142 close csr_get_devived_details;
2143 --
2144 hr_utility.set_location(l_proc,55);
2145 --
2146 -- Validation in addition to Row Handlers
2147 --
2148 -- If the specified person type id is not null then check that it
2149 -- corresponds to type 'EMP', is currently active and is in the correct
2150 -- business group, otherwise set person type to the active default for EMP
2151 -- in the current business group.
2152 --
2153 per_per_bus.chk_person_type
2154 (p_person_type_id => l_person_type_id
2155 ,p_business_group_id => l_business_group_id
2156 ,p_expected_sys_type => 'EMP'
2157 );
2158 --
2159 hr_utility.set_location(l_proc,60);
2160 --
2161 -- Check that corresponding person is of 'EMP_APL'
2162 -- system person type.
2163 --
2164 if l_system_person_type <> 'EMP_APL'
2165 then
2166 --
2167 hr_utility.set_location(l_proc,70);
2168 --
2169 hr_utility.set_message(800,'PER_52096_APL_INV_PERSON_TYPE');
2170 hr_utility.raise_error;
2171 end if;
2172 --
2173 hr_utility.set_location(l_proc,80);
2174 --
2175 -- Check that corresponding person is of 'ACCEPTED' of
2176 -- assignment status type.
2177 --
2178 open csr_chk_asg_status;
2179 fetch csr_chk_asg_status into l_count;
2180 --close csr_chk_asg_status; -- Bug 3266844. Commented out.
2181 --
2182 if l_count = 0 then
2183 --
2184 hr_utility.set_location(l_proc,90);
2185 --
2186 close csr_chk_asg_status;
2187 --
2188 hr_utility.set_message(800,'PER_52098_APL_INV_ASG_STATUS');
2189 hr_utility.raise_error;
2190 --
2191 end if;
2192 --
2193 close csr_chk_asg_status; -- Bug 3266844. Added.
2194 -- If we are overwriting the primary, the new primary id
2195 -- must be not null.
2196 --
2197 if p_overwrite_primary='Y' then
2198 --
2199 hr_utility.set_location(l_proc,100);
2200 --
2201 hr_api.mandatory_arg_error
2202 (p_api_name => l_proc
2203 ,p_argument => 'assignment_id'
2204 ,p_argument_value => p_primary_assignment_id
2205 );
2206 --
2207 hr_utility.set_location(l_proc,110);
2208 else
2209 --the primary assignment id should be null
2210 l_primary_assignment_id:=null;
2211 hr_utility.set_location(l_proc,115);
2212 --
2213 end if;
2214 --
2215 hr_utility.set_location(l_proc,120);
2216 --
2217 -- Check p_assignment is corresponding data.
2218 -- The assignment record specified by P_ASSIGNMENT_ID on the hire
2219 -- date in the PER_ASSIGNMENTS_F table has assignment status
2220 -- 'ACCEPTED'.
2221 --
2222 if p_primary_assignment_id is not null then
2223 --
2224 hr_utility.set_location(l_proc,130);
2225 --
2226 open csr_chk_assignment_id;
2227 fetch csr_chk_assignment_id
2228 into l_chk_person_id,
2229 l_chk_system_status;
2230 if csr_chk_assignment_id%NOTFOUND then
2231 --
2232 hr_utility.set_location(l_proc,140);
2233 --
2234 close csr_chk_assignment_id;
2235 --
2236 hr_utility.set_message(800,'PER_52099_ASG_INV_ASG_ID');
2237 hr_utility.raise_error;
2238 --
2239 end if;
2240 --
2241 if l_chk_person_id <> p_person_id then
2242 --
2243 hr_utility.set_location(l_proc,150);
2244 --
2245 close csr_chk_assignment_id;
2246 --
2247 hr_utility.set_message(800,'PER_52101_ASG_INV_PER_ID_COMB');
2248 hr_utility.raise_error;
2249 --
2250 end if;
2251 --
2252 if l_chk_system_status <> 'ACCEPTED' then
2253 --
2254 hr_utility.set_location(l_proc,155);
2255 --
2256 close csr_chk_assignment_id;
2257 --
2258 hr_utility.set_message(800,'PER_52100_ASG_INV_PER_TYPE');
2259 hr_utility.raise_error;
2260 --
2261 end if;
2262 --
2263 hr_utility.set_location(l_proc,160);
2264 --
2265 close csr_chk_assignment_id;
2266 --
2267 end if;
2268 --
2269 hr_utility.set_location(l_proc,170);
2270
2271 -- Start changes for bug 9879782
2272 if p_upload_irec_docs = 'Y' and p_validate = false then
2273 hr_utility.set_location('p_primary_assignment_id'||p_primary_assignment_id,380);
2274
2275 open csr_get_appl_id(p_primary_assignment_id);
2276 fetch csr_get_appl_id into l_appl_id;
2277 close csr_get_appl_id;
2278
2279 hr_utility.set_location('l_appl_id'||l_appl_id,380);
2280
2281 per_fnd_attachment_pkg.upload_irec_docs(
2282 p_person_id => p_PERSON_ID,
2283 p_assignment_id => p_primary_assignment_id,
2284 p_application_id => l_appl_id,
2285 p_hire_date => p_hire_date,
2286 p_transaction_type => 'COREHR',
2287 p_transaction_status => 'ACTIVE',
2288 p_status => 'I');
2289 end if;
2290 -- End changes for bug 9879782
2291
2292 --
2293 -- Lock the person record in PER_ALL_PEOPLE_F ready for UPDATE at a later point.
2294 -- (Note: This is necessary because calling the table handlers in locking
2295 -- ladder order invokes an error in per_apl_upd.upd due to the person
2296 -- being modified by the per_per_upd.upd table handler.)
2297 if l_per_effective_start_date=l_hire_date then
2298 l_datetrack_update_mode:='CORRECTION';
2299 else
2300 l_datetrack_update_mode:='UPDATE';
2301 end if;
2302 --
2303 per_per_shd.lck
2304 (p_effective_date => l_hire_date
2305 ,p_datetrack_mode => l_datetrack_update_mode
2306 ,p_person_id => p_person_id
2307 ,p_object_version_number => l_per_object_version_number
2308 ,p_validation_start_date => l_validation_start_date
2309 ,p_validation_end_date => l_validation_end_date
2310 );
2311 --
2312 hr_utility.set_location(l_proc,180);
2313 --
2314 -- Update the application details by calling the upd procedure in the
2315 -- application table handler:
2316 -- Date_end is set to l_hire_date - 1;
2317 --
2318 per_apl_upd.upd
2319 (p_application_id => l_application_id
2320 ,p_date_end => l_hire_date - 1
2321 ,p_object_version_number => l_apl_object_version_number
2322 ,p_effective_date => l_hire_date-1
2323 ,p_validate => false
2324 );
2325 hr_utility.set_location(l_proc,190);
2326 --
2327 -- Set all unaccepted applicant assignments to have end date = p_hire_date -1
2328 -- by calling the del procedure in the PER_ASSIGNMENTS_F table handler
2329 -- (This is a datetrack DELETE mode operation)
2330 --
2331 open csr_get_un_accepted;
2332 loop
2333 fetch csr_get_un_accepted
2334 into l_assignment_id,
2335 l_asg_object_version_number;
2336 exit when csr_get_un_accepted%NOTFOUND;
2337 --
2338 hr_utility.set_location(l_proc,200);
2339 -- ER FPT
2340 open chk_future_changes(l_assignment_id);
2341 fetch chk_future_changes into l_exists;
2342 if chk_future_changes%found then
2343 close chk_future_changes;
2344 hr_utility.set_message(801,'HR_7975_ASG_INV_FUTURE_ASA');
2345 hr_utility.raise_error;
2346 end if;
2347 close chk_future_changes;
2348
2349 --
2350 per_asg_del.del
2351 (p_assignment_id => l_assignment_id
2352 ,p_effective_start_date => l_effective_start_date
2353 ,p_effective_end_date => l_effective_end_date
2354 ,p_business_group_id => l_business_group_id
2355 ,p_object_version_number => l_asg_object_version_number
2356 ,p_effective_date => l_hire_date-1
2357 ,p_validation_start_date => l_validation_start_date
2358 ,p_validation_end_date => l_validation_end_date
2359 ,p_datetrack_mode => 'DELETE'
2360 ,p_org_now_no_manager_warning => l_org_now_no_manager_warning
2361 );
2362 --
2363
2364 if per_otherbg_apl_api.isMultiRegVac(l_assignment_id) then
2365 per_otherbg_apl_api.close_otherbg_applications(l_assignment_id,l_hire_date-1,'HIRE_END');
2366 end if;
2367
2368 hr_utility.set_location(l_proc,210);
2369 --
2370 l_unaccepted_asg_del_warning := TRUE;
2371 --
2372 end loop;
2373 --
2374 close csr_get_un_accepted;
2375 --
2376 hr_utility.set_location(l_proc, 220);
2377
2378 -- PTU : Changes
2379
2380 l_person_type_id1 := hr_person_type_usage_info.get_default_person_type_id
2381 (l_business_group_id,
2382 'EMP');
2383 -- PTU : End of Changes
2384
2385 hr_utility.set_location(l_proc, 225);
2386
2387 --
2388 -- Update the person details by calling upd procedure in
2389 -- the per_all_people_f table.
2390 --
2391 l_applicant_number:=hr_api.g_varchar2;
2392 l_employee_number:=hr_api.g_varchar2;
2393 per_per_upd.upd
2394 (p_person_id => p_person_id
2395 ,p_effective_date => l_hire_date
2396 ,p_applicant_number => l_applicant_number
2397 ,p_employee_number => l_employee_number
2398 ,p_person_type_id => l_person_type_id1
2399 ,p_object_version_number => l_per_object_version_number
2400 ,p_datetrack_mode => l_datetrack_update_mode
2401 ,p_effective_start_date => l_per_effective_start_date
2402 ,p_effective_end_date => l_per_effective_end_date
2403 ,p_comment_id => l_comment_id
2404 ,p_current_applicant_flag => l_current_applicant_flag
2405 ,p_current_emp_or_apl_flag => l_current_emp_or_apl_flag
2406 ,p_current_employee_flag => l_current_employee_flag
2407 ,p_full_name => l_full_name
2408 ,p_name_combination_warning => l_name_combination_warning
2409 ,p_dob_null_warning => p_assign_payroll_warning
2410 ,p_orig_hire_warning => l_orig_hire_warning
2411 ,p_npw_number => l_npw_number
2412 );
2413 --
2414 hr_utility.set_location(l_proc,230);
2415
2416 -- PTU : Following Code has been added
2417 --
2418 hr_per_type_usage_internal.maintain_person_type_usage
2419 (p_effective_date => l_hire_date
2420 ,p_person_id => p_person_id
2421 ,p_person_type_id => l_person_type_id
2422 ,p_datetrack_update_mode => l_datetrack_update_mode
2423 );
2424 --
2425 l_person_type_id1 := hr_person_type_usage_info.get_default_person_type_id
2426 (l_business_group_id,
2427 'EX_APL');
2428 --
2429 hr_per_type_usage_internal.maintain_person_type_usage
2430 (p_effective_date => l_hire_date
2431 ,p_person_id => p_person_id
2432 ,p_person_type_id => l_person_type_id1
2433 ,p_datetrack_update_mode => l_datetrack_update_mode
2434 );
2435 --
2436 -- PTU : End of changes
2437
2438
2439 --
2440 -- All accepted applicant assignments are changed to employee assignments
2441 -- with default employee assignment.(ACTIVE_ASSIGN)
2442 -- 1) Derive assignment_status_type_id for default 'ACTIVE_ASSIGN'.
2443 -- 2) Update the assignments by calling the upd procedure in the
2444 -- PER_ASSIGNMENTS_F table handler(This is a datetrack UPDATE mode
2445 -- operation)
2446 -- 3) When the accepted assignments are multiple, the primary flag of the
2447 -- record not specified by P_ASSIGNMENT_ID is set to 'N'.
2448 --
2449 per_asg_bus1.chk_assignment_status_type
2450 (p_assignment_status_type_id => l_assignment_status_type_id
2451 ,p_business_group_id => l_business_group_id
2452 ,p_legislation_code => l_legislation_code
2453 ,p_expected_system_status => 'ACTIVE_ASSIGN'
2454 );
2455 --
2456 hr_utility.set_location(l_proc,240);
2457 --
2458 l_oversubscribed_vacancy_id :=null;
2459 --
2460 -- #2468916: Need to retrieve the period of service id
2461 open get_primary;
2462 fetch get_primary into l_primary_asg_id,l_primary_ovn, l_period_of_service_id;
2463 close get_primary;
2464 --
2465 for asg_rec in csr_get_accepted loop
2466 --
2467 hr_utility.set_location(l_proc,250);
2468 -- ER FPT
2469 open chk_future_changes(asg_rec.assignment_id);
2470 fetch chk_future_changes into l_exists;
2471 if chk_future_changes%found then
2472 close chk_future_changes;
2473 hr_utility.set_message(801,'HR_7975_ASG_INV_FUTURE_ASA');
2474 hr_utility.raise_error;
2475 end if;
2476 close chk_future_changes;
2477
2478 --
2479 if asg_rec.effective_start_date=l_hire_date then
2480 l_datetrack_update_mode:='CORRECTION';
2481 else
2482 l_datetrack_update_mode:='UPDATE';
2483 end if;
2484 --
2485 if asg_rec.assignment_id <> p_primary_assignment_id or p_overwrite_primary ='N' then
2486 --
2487 per_asg_upd.upd
2488 (p_assignment_id => asg_rec.assignment_id,
2489 p_object_version_number => asg_rec.object_version_number,
2490 p_effective_date => l_hire_date,
2491 p_datetrack_mode => l_datetrack_update_mode,
2492 p_assignment_status_type_id => l_assignment_status_type_id,
2493 p_assignment_type => 'E',
2494 p_primary_flag => 'N',
2495 p_period_of_service_id => l_period_of_service_id,
2496 --
2497 p_effective_start_date => l_effective_start_date,
2498 p_effective_end_date => l_effective_end_date,
2499 p_business_group_id => l_business_group_id,
2500 p_comment_id => l_comment_id,
2501 p_validation_start_date => l_validation_start_date,
2502 p_validation_end_date => l_validation_end_date,
2503 p_payroll_id_updated => l_payroll_id_updated,
2504 p_other_manager_warning => l_other_manager_warning,
2505 p_no_managers_warning => l_no_managers_warning,
2506 p_org_now_no_manager_warning => l_org_now_no_manager_warning,
2507 p_hourly_salaried_warning => l_hourly_salaried_warning
2508 );
2509 --
2510 hr_utility.set_location(l_proc,260);
2511 --The below has been commented as part of bug fix 5481530
2512 -- if asg_rec.assignment_id = p_primary_assignment_id then
2513 if asg_rec.assignment_id = l_primary_assignment_id then
2514 hr_assignment_api.set_new_primary_asg
2515 (p_validate => false
2516 ,p_effective_date => l_hire_date
2517 ,p_person_id => p_person_id
2518 ,p_assignment_id => asg_rec.assignment_id
2519 ,p_object_version_number => asg_rec.object_version_number
2520 ,p_effective_start_date => l_effective_start_date
2521 ,p_effective_end_date => l_effective_end_date
2522 );
2523 end if;
2524 -- Bug 4644830 Start
2525 OPEN get_pay_proposal(asg_rec.assignment_id);
2526 FETCH get_pay_proposal INTO l_pay_pspl_id,l_pay_obj_number,l_proposed_sal_n, l_dummy_change_date,l_proposal_reason; --Added Proposal_Reason for Bug # 5987409 --
2527 if get_pay_proposal%found then
2528 close get_pay_proposal;
2529 hr_maintain_proposal_api.cre_or_upd_salary_proposal(
2530 p_validate => false,
2531 p_pay_proposal_id => l_pay_pspl_id ,
2532 p_object_version_number => l_pay_obj_number,
2533 p_change_date => p_hire_date,
2534 p_approved => 'Y',
2535 p_inv_next_sal_date_warning => l_inv_next_sal_date_warning,
2536 p_proposed_salary_warning => l_proposed_salary_warning,
2537 p_approved_warning => l_approved_warning,
2538 p_payroll_warning => l_payroll_warning,
2539 p_proposed_salary_n => l_proposed_sal_n,
2540 p_business_group_id => l_business_group_id,
2541 p_proposal_reason => l_proposal_reason);
2542
2543 else
2544 close get_pay_proposal;
2545 end if;
2546 -- Bug 4644830 End
2547 -- Bug 4630129 Starts
2548 elsif asg_rec.assignment_id = p_primary_assignment_id and p_overwrite_primary ='Y' then
2549 -- Hire the new secondary Applicant assignment.
2550 hr_utility.set_location(l_proc,261);
2551 per_asg_upd.upd
2552 (p_assignment_id => asg_rec.assignment_id,
2553 p_object_version_number => asg_rec.object_version_number,
2554 p_effective_date => l_hire_date,
2555 p_datetrack_mode => l_datetrack_update_mode,
2556 p_assignment_status_type_id => l_assignment_status_type_id,
2557 p_assignment_type => 'E',
2558 p_primary_flag => 'N',
2559 p_period_of_service_id => l_period_of_service_id,
2560 --
2561 p_effective_start_date => l_effective_start_date,
2562 p_effective_end_date => l_effective_end_date,
2563 p_business_group_id => l_business_group_id,
2564 p_comment_id => l_comment_id,
2565 p_validation_start_date => l_validation_start_date,
2566 p_validation_end_date => l_validation_end_date,
2567 p_payroll_id_updated => l_payroll_id_updated,
2568 p_other_manager_warning => l_other_manager_warning,
2569 p_no_managers_warning => l_no_managers_warning,
2570 p_org_now_no_manager_warning => l_org_now_no_manager_warning,
2571 p_hourly_salaried_warning => l_hourly_salaried_warning
2572 );
2573 -- Make the new secondary Applicant assignment Primary.
2574 hr_utility.set_location(l_proc,262);
2575 hr_assignment_api.set_new_primary_asg
2576 (p_validate => false
2577 ,p_effective_date => l_hire_date
2578 ,p_person_id => p_person_id
2579 ,p_assignment_id => asg_rec.assignment_id
2580 ,p_object_version_number => asg_rec.object_version_number
2581 ,p_effective_start_date => l_effective_start_date
2582 ,p_effective_end_date => l_effective_end_date
2583 );
2584 hr_utility.set_location(l_proc,263);
2585 -- Bug 4630129 Ends
2586 -- Bug 4644830 Start
2587 OPEN get_pay_proposal(asg_rec.assignment_id);
2588 FETCH get_pay_proposal INTO l_pay_pspl_id,l_pay_obj_number,l_proposed_sal_n, l_dummy_change_date,l_proposal_reason; --Added Proposal_Reason for Bug # 5987409 --
2589 if get_pay_proposal%found then
2590 close get_pay_proposal;
2591 hr_maintain_proposal_api.cre_or_upd_salary_proposal(
2592 p_validate => false,
2593 p_pay_proposal_id => l_pay_pspl_id ,
2594 p_object_version_number => l_pay_obj_number,
2595 p_change_date => p_hire_date,
2596 p_approved => 'Y',
2597 p_inv_next_sal_date_warning => l_inv_next_sal_date_warning,
2598 p_proposed_salary_warning => l_proposed_salary_warning,
2599 p_approved_warning => l_approved_warning,
2600 p_payroll_warning => l_payroll_warning,
2601 p_proposed_salary_n => l_proposed_sal_n,
2602 p_business_group_id => l_business_group_id,
2603 p_proposal_reason => l_proposal_reason);
2604
2605 else
2606 close get_pay_proposal;
2607 end if;
2608 -- Bug 4644830 End
2609
2610 -- fix for the bug 4777901 starts here
2611
2612 elsif p_overwrite_primary ='W' then
2613 --
2614 -- bug 5024006 fix starts here
2615 --
2616 if l_check_loop=0 then
2617
2618 open get_primary;
2619 fetch get_primary into l_primary_asg_id,l_primary_ovn, l_period_of_service_id; -- #2468916
2620 close get_primary;
2621 --
2622 hr_utility.set_location(l_proc, 264);
2623 --
2624 open get_asg(asg_rec.assignment_id);
2625 fetch get_asg into l_asg_rec;
2626 close get_asg;
2627
2628 ---changes for 4959033 starts here
2629 open get_primary_approved_proposal(l_primary_asg_id);
2630 fetch get_primary_approved_proposal into l_pay_pspl_id;
2631
2632 if get_primary_approved_proposal%found then
2633 close get_primary_approved_proposal;
2634
2635 if l_asg_rec.pay_basis_id is null then
2636 hr_utility.set_message(800,'HR_289767_SALARY_BASIS_IS_NULL');
2637 hr_utility.raise_error;
2638 end if;
2639 --Added else to close the cursor--5277866
2640 else
2641 close get_primary_approved_proposal;
2642 end if;
2643 ---changes for 4959033 ends here
2644
2645 if l_asg_rec.people_group_id is not null then
2646 --
2647 hr_utility.set_location(l_proc, 265);
2648 --
2649 open get_pgp(l_asg_rec.people_group_id);
2650 fetch get_pgp into l_pgp_rec;
2651 close get_pgp;
2652
2653 end if;
2654
2655 if l_asg_rec.soft_coding_keyflex_id is not null then
2656 --
2657 hr_utility.set_location(l_proc, 266);
2658 --
2659 open get_scl(l_asg_rec.soft_coding_keyflex_id);
2660 fetch get_scl into l_scl_rec;
2661 close get_scl;
2662
2663 end if;
2664 --
2665 if l_asg_rec.cagr_grade_def_id is not null then
2666 --
2667 hr_utility.set_location(l_proc, 267);
2668 --
2669 open get_cag(l_asg_rec.cagr_grade_def_id);
2670 fetch get_cag into l_cag_rec;
2671 close get_cag;
2672 end if;
2673 --
2674
2675 hr_utility.set_location(l_proc, 268);
2676 --
2677
2678 --The below call has been commented as per bug 5102160
2679 -- soft_coding_keyflex_id is passed by calling the new update_emp_asg_criteria procedure
2680
2681 /*hr_assignment_api.update_emp_asg_criteria
2682 (p_validate => FALSE
2683 ,p_effective_date => l_hire_date
2684 ,p_datetrack_update_mode => l_datetrack_update_mode
2685 ,p_assignment_id => l_primary_asg_id
2686 ,p_object_version_number => l_primary_ovn
2687 ,p_grade_id => l_asg_rec.grade_id
2688 ,p_position_id => l_asg_rec.position_id
2689 ,p_job_id => l_asg_rec.job_id
2690 ,p_payroll_id => l_asg_rec.payroll_id
2691 ,p_location_id => l_asg_rec.location_id
2692 ,p_special_ceiling_step_id => l_asg_rec.special_ceiling_step_id
2693 ,p_organization_id => l_asg_rec.organization_id
2694 ,p_pay_basis_id => l_asg_rec.pay_basis_id
2695 ,p_employment_category => l_asg_rec.employment_category
2696 ,p_segment1 => l_pgp_rec.segment1
2697 ,p_segment2 => l_pgp_rec.segment2
2698 ,p_segment3 => l_pgp_rec.segment3
2699 ,p_segment4 => l_pgp_rec.segment4
2700 ,p_segment5 => l_pgp_rec.segment5
2701 ,p_segment6 => l_pgp_rec.segment6
2702 ,p_segment7 => l_pgp_rec.segment7
2703 ,p_segment8 => l_pgp_rec.segment8
2704 ,p_segment9 => l_pgp_rec.segment9
2705 ,p_segment10 => l_pgp_rec.segment10
2706 ,p_segment11 => l_pgp_rec.segment11
2707 ,p_segment12 => l_pgp_rec.segment12
2708 ,p_segment13 => l_pgp_rec.segment13
2709 ,p_segment14 => l_pgp_rec.segment14
2710 ,p_segment15 => l_pgp_rec.segment15
2711 ,p_segment16 => l_pgp_rec.segment16
2712 ,p_segment17 => l_pgp_rec.segment17
2713 ,p_segment18 => l_pgp_rec.segment18
2714 ,p_segment19 => l_pgp_rec.segment19
2715 ,p_segment20 => l_pgp_rec.segment20
2716 ,p_segment21 => l_pgp_rec.segment21
2717 ,p_segment22 => l_pgp_rec.segment22
2718 ,p_segment23 => l_pgp_rec.segment23
2719 ,p_segment24 => l_pgp_rec.segment24
2720 ,p_segment25 => l_pgp_rec.segment25
2721 ,p_segment26 => l_pgp_rec.segment26
2722 ,p_segment27 => l_pgp_rec.segment27
2723 ,p_segment28 => l_pgp_rec.segment28
2724 ,p_segment29 => l_pgp_rec.segment29
2725 ,p_segment30 => l_pgp_rec.segment30
2726 ,p_group_name => l_dummyv
2727 ,p_effective_start_date => l_effective_start_date
2728 ,p_effective_end_date => l_effective_end_date
2729 ,p_people_group_id => l_dummy
2730 ,p_org_now_no_manager_warning => l_dummyb
2731 ,p_other_manager_warning => l_dummyb
2732 ,p_spp_delete_warning => l_dummyb
2733 ,p_entries_changed_warning => l_dummyv
2734 ,p_tax_district_changed_warning => l_dummyb
2735 );*/
2736
2737 hr_assignment_api.update_emp_asg_criteria
2738 (p_validate => FALSE
2739 ,p_effective_date => l_hire_date
2740 ,p_datetrack_update_mode => l_datetrack_update_mode
2741 ,p_assignment_id => l_primary_asg_id
2742 ,p_object_version_number => l_primary_ovn
2743 ,p_grade_id => l_asg_rec.grade_id
2744 ,p_position_id => l_asg_rec.position_id
2745 ,p_job_id => l_asg_rec.job_id
2746 ,p_payroll_id => l_asg_rec.payroll_id
2747 ,p_location_id => l_asg_rec.location_id
2748 ,p_special_ceiling_step_id => l_asg_rec.special_ceiling_step_id
2749 ,p_organization_id => l_asg_rec.organization_id
2750 ,p_pay_basis_id => l_asg_rec.pay_basis_id
2751 ,p_supervisor_assignment_id => l_asg_rec.supervisor_assignment_id -- 13595937
2752 ,p_segment1 => l_pgp_rec.segment1
2753 ,p_segment2 => l_pgp_rec.segment2
2754 ,p_segment3 => l_pgp_rec.segment3
2755 ,p_segment4 => l_pgp_rec.segment4
2756 ,p_segment5 => l_pgp_rec.segment5
2757 ,p_segment6 => l_pgp_rec.segment6
2758 ,p_segment7 => l_pgp_rec.segment7
2759 ,p_segment8 => l_pgp_rec.segment8
2760 ,p_segment9 => l_pgp_rec.segment9
2761 ,p_segment10 => l_pgp_rec.segment10
2762 ,p_segment11 => l_pgp_rec.segment11
2763 ,p_segment12 => l_pgp_rec.segment12
2764 ,p_segment13 => l_pgp_rec.segment13
2765 ,p_segment14 => l_pgp_rec.segment14
2766 ,p_segment15 => l_pgp_rec.segment15
2767 ,p_segment16 => l_pgp_rec.segment16
2768 ,p_segment17 => l_pgp_rec.segment17
2769 ,p_segment18 => l_pgp_rec.segment18
2770 ,p_segment19 => l_pgp_rec.segment19
2771 ,p_segment20 => l_pgp_rec.segment20
2772 ,p_segment21 => l_pgp_rec.segment21
2773 ,p_segment22 => l_pgp_rec.segment22
2774 ,p_segment23 => l_pgp_rec.segment23
2775 ,p_segment24 => l_pgp_rec.segment24
2776 ,p_segment25 => l_pgp_rec.segment25
2777 ,p_segment26 => l_pgp_rec.segment26
2778 ,p_segment27 => l_pgp_rec.segment27
2779 ,p_segment28 => l_pgp_rec.segment28
2780 ,p_segment29 => l_pgp_rec.segment29
2781 ,p_segment30 => l_pgp_rec.segment30
2782 ,p_employment_category => l_asg_rec.employment_category
2783 ,p_people_group_id => l_dummy
2784 ,p_soft_coding_keyflex_id => l_asg_rec.soft_coding_keyflex_id
2785 ,p_group_name => l_dummyv
2786 ,p_effective_start_date => l_effective_start_date
2787 ,p_effective_end_date => l_effective_end_date
2788 ,p_org_now_no_manager_warning => l_dummyb
2789 ,p_other_manager_warning => l_dummyb
2790 ,p_spp_delete_warning => l_dummyb
2791 ,p_entries_changed_warning => l_dummyv
2792 ,p_tax_district_changed_warning => l_dummyb
2793 ,p_concatenated_segments => l_concatenated_segments
2794 ,p_gsp_post_process_warning => l_gsp_post_process_warning -- bug 2999562
2795 );
2796
2797 --
2798 hr_utility.set_location(l_proc, 269);
2799 --
2800 hr_assignment_api.update_emp_asg
2801 (p_validate => FALSE
2802 ,p_effective_date => l_hire_date
2803 ,p_datetrack_update_mode => 'CORRECTION'
2804 ,p_assignment_id => l_primary_asg_id
2805 ,p_object_version_number => l_primary_ovn
2806 ,p_supervisor_id => l_asg_rec.supervisor_id
2807 ,p_assignment_number => l_asg_rec.assignment_number
2808 ,p_change_reason => l_asg_rec.change_reason
2809 ,p_date_probation_end => l_asg_rec.date_probation_end
2810 ,p_default_code_comb_id => l_asg_rec.default_code_comb_id
2811 ,p_frequency => l_asg_rec.frequency
2812 ,p_internal_address_line => l_asg_rec.internal_address_line
2813 ,p_manager_flag => l_asg_rec.manager_flag
2814 ,p_normal_hours => l_asg_rec.normal_hours
2815 ,p_perf_review_period => l_asg_rec.perf_review_period
2816 ,p_perf_review_period_frequency => l_asg_rec.perf_review_period_frequency
2817 ,p_probation_period => l_asg_rec.probation_period
2818 ,p_probation_unit => l_asg_rec.probation_unit
2819 ,p_sal_review_period => l_asg_rec.sal_review_period
2820 ,p_sal_review_period_frequency => l_asg_rec.sal_review_period_frequency
2821 ,p_set_of_books_id => l_asg_rec.set_of_books_id
2822 ,p_source_type => l_asg_rec.source_type
2823 ,p_time_normal_finish => l_asg_rec.time_normal_finish
2824 ,p_time_normal_start => l_asg_rec.time_normal_start
2825 ,p_bargaining_unit_code => l_asg_rec.bargaining_unit_code
2826 ,p_labour_union_member_flag => l_asg_rec.labour_union_member_flag
2827 ,p_hourly_salaried_code => l_asg_rec.hourly_salaried_code
2828 ,p_ass_attribute_category => l_asg_rec.ass_attribute_category
2829 ,p_ass_attribute1 => l_asg_rec.ass_attribute1
2830 ,p_ass_attribute2 => l_asg_rec.ass_attribute2
2831 ,p_ass_attribute3 => l_asg_rec.ass_attribute3
2832 ,p_ass_attribute4 => l_asg_rec.ass_attribute4
2833 ,p_ass_attribute5 => l_asg_rec.ass_attribute5
2834 ,p_ass_attribute6 => l_asg_rec.ass_attribute6
2835 ,p_ass_attribute7 => l_asg_rec.ass_attribute7
2836 ,p_ass_attribute8 => l_asg_rec.ass_attribute8
2837 ,p_ass_attribute9 => l_asg_rec.ass_attribute9
2838 ,p_ass_attribute10 => l_asg_rec.ass_attribute10
2839 ,p_ass_attribute11 => l_asg_rec.ass_attribute11
2840 ,p_ass_attribute12 => l_asg_rec.ass_attribute12
2841 ,p_ass_attribute13 => l_asg_rec.ass_attribute13
2842 ,p_ass_attribute14 => l_asg_rec.ass_attribute14
2843 ,p_ass_attribute15 => l_asg_rec.ass_attribute15
2844 ,p_ass_attribute16 => l_asg_rec.ass_attribute16
2845 ,p_ass_attribute17 => l_asg_rec.ass_attribute17
2846 ,p_ass_attribute18 => l_asg_rec.ass_attribute18
2847 ,p_ass_attribute19 => l_asg_rec.ass_attribute19
2848 ,p_ass_attribute20 => l_asg_rec.ass_attribute20
2849 ,p_ass_attribute21 => l_asg_rec.ass_attribute21
2850 ,p_ass_attribute22 => l_asg_rec.ass_attribute22
2851 ,p_ass_attribute23 => l_asg_rec.ass_attribute23
2852 ,p_ass_attribute24 => l_asg_rec.ass_attribute24
2853 ,p_ass_attribute25 => l_asg_rec.ass_attribute25
2854 ,p_ass_attribute26 => l_asg_rec.ass_attribute26
2855 ,p_ass_attribute27 => l_asg_rec.ass_attribute27
2856 ,p_ass_attribute28 => l_asg_rec.ass_attribute28
2857 ,p_ass_attribute29 => l_asg_rec.ass_attribute29
2858 ,p_ass_attribute30 => l_asg_rec.ass_attribute30
2859 ,p_segment1 => l_scl_rec.segment1
2860 ,p_segment2 => l_scl_rec.segment2
2861 ,p_segment3 => l_scl_rec.segment3
2862 ,p_segment4 => l_scl_rec.segment4
2863 ,p_segment5 => l_scl_rec.segment5
2864 ,p_segment6 => l_scl_rec.segment6
2865 ,p_segment7 => l_scl_rec.segment7
2866 ,p_segment8 => l_scl_rec.segment8
2867 ,p_segment9 => l_scl_rec.segment9
2868 ,p_segment10 => l_scl_rec.segment10
2869 ,p_segment11 => l_scl_rec.segment11
2870 ,p_segment12 => l_scl_rec.segment12
2871 ,p_segment13 => l_scl_rec.segment13
2872 ,p_segment14 => l_scl_rec.segment14
2873 ,p_segment15 => l_scl_rec.segment15
2874 ,p_segment16 => l_scl_rec.segment16
2875 ,p_segment17 => l_scl_rec.segment17
2876 ,p_segment18 => l_scl_rec.segment18
2877 ,p_segment19 => l_scl_rec.segment19
2878 ,p_segment20 => l_scl_rec.segment20
2879 ,p_segment21 => l_scl_rec.segment21
2880 ,p_segment22 => l_scl_rec.segment22
2881 ,p_segment23 => l_scl_rec.segment23
2882 ,p_segment24 => l_scl_rec.segment24
2883 ,p_segment25 => l_scl_rec.segment25
2884 ,p_segment26 => l_scl_rec.segment26
2885 ,p_segment27 => l_scl_rec.segment27
2886 ,p_segment28 => l_scl_rec.segment28
2887 ,p_segment29 => l_scl_rec.segment29
2888 ,p_segment30 => l_scl_rec.segment30
2889 ,p_contract_id => l_asg_rec.contract_id
2890 ,p_establishment_id => l_asg_rec.establishment_id
2891 ,p_collective_agreement_id => l_asg_rec.collective_agreement_id
2892 ,p_cagr_id_flex_num => l_asg_rec.cagr_id_flex_num
2893 ,p_cag_segment1 => l_cag_rec.segment1
2894 ,p_cag_segment2 => l_cag_rec.segment2
2895 ,p_cag_segment3 => l_cag_rec.segment3
2896 ,p_cag_segment4 => l_cag_rec.segment4
2897 ,p_cag_segment5 => l_cag_rec.segment5
2898 ,p_cag_segment6 => l_cag_rec.segment6
2899 ,p_cag_segment7 => l_cag_rec.segment7
2900 ,p_cag_segment8 => l_cag_rec.segment8
2901 ,p_cag_segment9 => l_cag_rec.segment9
2902 ,p_cag_segment10 => l_cag_rec.segment10
2903 ,p_cag_segment11 => l_cag_rec.segment11
2904 ,p_cag_segment12 => l_cag_rec.segment12
2905 ,p_cag_segment13 => l_cag_rec.segment13
2906 ,p_cag_segment14 => l_cag_rec.segment14
2907 ,p_cag_segment15 => l_cag_rec.segment15
2908 ,p_cag_segment16 => l_cag_rec.segment16
2909 ,p_cag_segment17 => l_cag_rec.segment17
2910 ,p_cag_segment18 => l_cag_rec.segment18
2911 ,p_cag_segment19 => l_cag_rec.segment19
2912 ,p_cag_segment20 => l_cag_rec.segment20
2913 ,p_notice_period => l_asg_rec.notice_period
2914 ,p_notice_period_uom => l_asg_rec.notice_period_uom
2915 ,p_employee_category => l_asg_rec.employee_category
2916 ,p_work_at_home => l_asg_rec.work_at_home
2917 ,p_job_post_source_name => l_asg_rec.job_post_source_name
2918 ,p_cagr_grade_def_id => l_dummynum1 -- Bug # 2788390 modified l_dummy to l_dummynum1.
2919 ,p_cagr_concatenated_segments => l_dummyv
2920 ,p_concatenated_segments => l_dummyv
2921 ,p_soft_coding_keyflex_id => l_dummy1
2922 ,p_comment_id => l_dummy2
2923 ,p_effective_start_date => l_effective_start_date
2924 ,p_effective_end_date => l_effective_end_date
2925 ,p_no_managers_warning => l_dummyb
2926 ,p_other_manager_warning => l_dummyb
2927 ,p_hourly_salaried_warning => l_dummyb
2928 );
2929 --
2930 hr_utility.set_location(l_proc, 271);
2931
2932 --Fix For Bug # 5987409 Starts -----
2933
2934 UPDATE PER_ASSIGNMENTS_F PAF SET PAF.VACANCY_ID =l_asg_rec.vacancy_id ,
2935 PAF.RECRUITER_ID =l_asg_rec.recruiter_id
2936 WHERE PAF.ASSIGNMENT_ID = l_primary_asg_id AND
2937 PAF.EFFECTIVE_START_DATE = l_effective_start_date AND
2938 PAF.EFFECTIVE_END_DATE = l_effective_end_date;
2939
2940 --Fix For Bug # 5987409 Starts -----
2941
2942
2943 --
2944 -- now end date the application
2945 --
2946 per_asg_del.del
2947 (p_assignment_id => l_asg_rec.assignment_id
2948 ,p_effective_start_date => l_effective_start_date
2949 ,p_effective_end_date => l_effective_end_date
2950 ,p_business_group_id => l_business_group_id
2951 ,p_object_version_number => l_asg_rec.object_version_number
2952 ,p_effective_date => l_hire_date-1
2953 ,p_validation_start_date => l_validation_start_date
2954 ,p_validation_end_date => l_validation_end_date
2955 ,p_datetrack_mode => 'DELETE'
2956 ,p_org_now_no_manager_warning => l_org_now_no_manager_warning
2957 );
2958 --
2959 hr_utility.set_location(l_proc, 272);
2960 --
2961 --
2962
2963 l_pspl_asg_id :=asg_rec.assignment_id;
2964
2965
2966 OPEN get_pay_proposal(l_pspl_asg_id);
2967 FETCH get_pay_proposal INTO l_pay_pspl_id,l_pay_obj_number,l_proposed_sal_n, l_dummy_change_date,l_proposal_reason; -- Added Proposal_Reason For Bug # 5987409 --
2968 if get_pay_proposal%found then
2969 l_pay_pspl_id:=null;
2970 l_pay_obj_number:=null;
2971 open get_primary_proposal(l_primary_asg_id);
2972 fetch get_primary_proposal into l_pay_pspl_id,l_pay_obj_number;
2973 if get_primary_proposal%found then
2974 close get_primary_proposal;
2975 hr_maintain_proposal_api.cre_or_upd_salary_proposal(
2976 p_validate => false,
2977 p_pay_proposal_id => l_pay_pspl_id ,
2978 p_object_version_number => l_pay_obj_number,
2979 p_change_date => p_hire_date,
2980 p_approved => 'Y',
2981 p_inv_next_sal_date_warning => l_inv_next_sal_date_warning,
2982 p_proposed_salary_warning => l_proposed_salary_warning,
2983 p_approved_warning => l_approved_warning,
2984 p_payroll_warning => l_payroll_warning,
2985 p_proposed_salary_n => l_proposed_sal_n,
2986 p_business_group_id => l_business_group_id,
2987 p_proposal_reason => l_proposal_reason);
2988 else
2989 close get_primary_proposal;
2990 l_pay_pspl_id:=null;
2991 l_pay_obj_number:=null;
2992 hr_maintain_proposal_api.cre_or_upd_salary_proposal(
2993 p_validate => false,
2994 p_pay_proposal_id => l_pay_pspl_id,
2995 p_assignment_id => l_primary_asg_id,
2996 p_object_version_number => l_pay_obj_number,
2997 p_change_date => p_hire_date,
2998 p_approved => 'Y',
2999 p_inv_next_sal_date_warning => l_inv_next_sal_date_warning,
3000 p_proposed_salary_warning => l_proposed_salary_warning,
3001 p_approved_warning => l_approved_warning,
3002 p_payroll_warning => l_payroll_warning,
3003 p_proposed_salary_n => l_proposed_sal_n,
3004 p_business_group_id => l_business_group_id,
3005 p_proposal_reason => l_proposal_reason);
3006
3007 end if;
3008 --
3009 end if;
3010 --
3011 close get_pay_proposal;
3012 --
3013 l_check_loop := l_check_loop +1;
3014
3015 end if;
3016
3017 -- fix for the bug 5024006 ends here
3018
3019 else
3020 --
3021 hr_utility.set_location(l_proc, 270);
3022 --
3023 -- we must update the old assignment with the new assignment record
3024 --
3025 open get_primary;
3026 fetch get_primary into l_primary_asg_id,l_primary_ovn, l_period_of_service_id; -- #2468916
3027 close get_primary;
3028 --
3029 hr_utility.set_location(l_proc, 280);
3030 --
3031 open get_asg(asg_rec.assignment_id);
3032 fetch get_asg into l_asg_rec;
3033 close get_asg;
3034 --
3035 hr_utility.set_location(l_proc, 290);
3036 --
3037 if l_asg_rec.people_group_id is not null then
3038 --
3039 hr_utility.set_location(l_proc, 300);
3040 --
3041 open get_pgp(l_asg_rec.people_group_id);
3042 fetch get_pgp into l_pgp_rec;
3043 close get_pgp;
3044 end if;
3045 --
3046 if l_asg_rec.soft_coding_keyflex_id is not null then
3047 --
3048 hr_utility.set_location(l_proc, 310);
3049 --
3050 open get_scl(l_asg_rec.soft_coding_keyflex_id);
3051 fetch get_scl into l_scl_rec;
3052 close get_scl;
3053 end if;
3054 --
3055 if l_asg_rec.cagr_grade_def_id is not null then
3056 --
3057 hr_utility.set_location(l_proc, 320);
3058 --
3059 open get_cag(l_asg_rec.cagr_grade_def_id);
3060 fetch get_cag into l_cag_rec;
3061 close get_cag;
3062 end if;
3063 --
3064 hr_utility.set_location(l_proc, 330);
3065 --
3066 if p_overwrite_primary = 'V' then
3067 --
3068 open get_asg(l_primary_asg_id);
3069 fetch get_asg into l_primary_asg_rec;
3070 close get_asg;
3071 --
3072 if l_primary_asg_rec.people_group_id is not null then
3073 open get_pgp(l_primary_asg_rec.people_group_id);
3074 fetch get_pgp into l_primary_pgp_rec;
3075 close get_pgp;
3076 end if;
3077 --
3078 if l_primary_asg_rec.soft_coding_keyflex_id is not null then
3079 open get_scl(l_primary_asg_rec.soft_coding_keyflex_id);
3080 fetch get_scl into l_primary_scl_rec;
3081 close get_scl;
3082 end if;
3083 --
3084 if l_primary_asg_rec.cagr_grade_def_id is not null then
3085 open get_cag(l_primary_asg_rec.cagr_grade_def_id);
3086 fetch get_cag into l_primary_cag_rec;
3087 close get_cag;
3088 end if;
3089 --
3090 -- Merge new and old primary assignments, giving preference to the
3091 -- new one.
3092 --
3093 --Bug 4234518
3094 --
3095 l_asg_rec.employee_category := NVL(l_asg_rec.employee_category,l_primary_asg_rec.employee_category);
3096 --Bug fix 4234518 ends here
3097 --
3098 l_asg_rec.employment_category := NVL(l_asg_rec.employment_category,l_primary_asg_rec.employment_category);
3099 l_asg_rec.grade_id := NVL(l_asg_rec.grade_id,l_primary_asg_rec.grade_id);
3100 l_asg_rec.job_id := NVL(l_asg_rec.job_id,l_primary_asg_rec.job_id);
3101 l_asg_rec.location_id := NVL(l_asg_rec.location_id,l_primary_asg_rec.location_id);
3102 l_asg_rec.organization_id := NVL(l_asg_rec.organization_id,l_primary_asg_rec.organization_id);
3103 l_asg_rec.payroll_id := NVL(l_asg_rec.payroll_id,l_primary_asg_rec.payroll_id);
3104 l_asg_rec.pay_basis_id := NVL(l_asg_rec.pay_basis_id,l_primary_asg_rec.pay_basis_id);
3105 l_asg_rec.position_id := NVL(l_asg_rec.position_id,l_primary_asg_rec.position_id);
3106 l_asg_rec.special_ceiling_step_id := NVL(l_asg_rec.special_ceiling_step_id,l_primary_asg_rec.special_ceiling_step_id);
3107 --
3108 l_pgp_rec.segment1 := NVL(l_pgp_rec.segment1, l_primary_pgp_rec.segment1);
3109 l_pgp_rec.segment2 := NVL(l_pgp_rec.segment2, l_primary_pgp_rec.segment2);
3110 l_pgp_rec.segment3 := NVL(l_pgp_rec.segment3, l_primary_pgp_rec.segment3);
3111 l_pgp_rec.segment4 := NVL(l_pgp_rec.segment4, l_primary_pgp_rec.segment4);
3112 l_pgp_rec.segment5 := NVL(l_pgp_rec.segment5, l_primary_pgp_rec.segment5);
3113 l_pgp_rec.segment6 := NVL(l_pgp_rec.segment6, l_primary_pgp_rec.segment6);
3114 l_pgp_rec.segment7 := NVL(l_pgp_rec.segment7, l_primary_pgp_rec.segment7);
3115 l_pgp_rec.segment8 := NVL(l_pgp_rec.segment8, l_primary_pgp_rec.segment8); --- Fix For Bug # 8758419
3116 l_pgp_rec.segment9 := NVL(l_pgp_rec.segment9, l_primary_pgp_rec.segment9);
3117 l_pgp_rec.segment10 := NVL(l_pgp_rec.segment10,l_primary_pgp_rec.segment10);
3118 l_pgp_rec.segment11 := NVL(l_pgp_rec.segment11,l_primary_pgp_rec.segment11);
3119 l_pgp_rec.segment12 := NVL(l_pgp_rec.segment12,l_primary_pgp_rec.segment12);
3120 l_pgp_rec.segment13 := NVL(l_pgp_rec.segment13,l_primary_pgp_rec.segment13);
3121 l_pgp_rec.segment14 := NVL(l_pgp_rec.segment14,l_primary_pgp_rec.segment14);
3122 l_pgp_rec.segment15 := NVL(l_pgp_rec.segment15,l_primary_pgp_rec.segment15);
3123 l_pgp_rec.segment16 := NVL(l_pgp_rec.segment16,l_primary_pgp_rec.segment16);
3124 l_pgp_rec.segment17 := NVL(l_pgp_rec.segment17,l_primary_pgp_rec.segment17);
3125 l_pgp_rec.segment18 := NVL(l_pgp_rec.segment18,l_primary_pgp_rec.segment18);
3126 l_pgp_rec.segment19 := NVL(l_pgp_rec.segment19,l_primary_pgp_rec.segment19);
3127 l_pgp_rec.segment20 := NVL(l_pgp_rec.segment20,l_primary_pgp_rec.segment20);
3128 l_pgp_rec.segment21 := NVL(l_pgp_rec.segment21,l_primary_pgp_rec.segment21);
3129 l_pgp_rec.segment22 := NVL(l_pgp_rec.segment22,l_primary_pgp_rec.segment22);
3130 l_pgp_rec.segment23 := NVL(l_pgp_rec.segment23,l_primary_pgp_rec.segment23);
3131 l_pgp_rec.segment24 := NVL(l_pgp_rec.segment24,l_primary_pgp_rec.segment24);
3132 l_pgp_rec.segment25 := NVL(l_pgp_rec.segment25,l_primary_pgp_rec.segment25);
3133 l_pgp_rec.segment26 := NVL(l_pgp_rec.segment26,l_primary_pgp_rec.segment26);
3134 l_pgp_rec.segment27 := NVL(l_pgp_rec.segment27,l_primary_pgp_rec.segment27);
3135 l_pgp_rec.segment28 := NVL(l_pgp_rec.segment28,l_primary_pgp_rec.segment28);
3136 l_pgp_rec.segment29 := NVL(l_pgp_rec.segment29,l_primary_pgp_rec.segment29);
3137 l_pgp_rec.segment30 := NVL(l_pgp_rec.segment30,l_primary_pgp_rec.segment30);
3138 --
3139 -- l_asg_rec.assignment_number := NVL(l_asg_rec.assignment_number,l_primary_asg_rec.assignment_number);
3140 l_asg_rec.bargaining_unit_code := NVL(l_asg_rec.bargaining_unit_code,l_primary_asg_rec.bargaining_unit_code);
3141 -- l_asg_rec.change_reason := NVL(l_asg_rec.change_reason,l_primary_asg_rec.change_reason);
3142 if l_asg_rec.change_reason is null
3143 then
3144 l_asg_rec.change_reason := l_primary_asg_rec.change_reason;
3145 end if; -- for Bug 14225861
3146 l_asg_rec.collective_agreement_id := NVL(l_asg_rec.collective_agreement_id,l_primary_asg_rec.collective_agreement_id);
3147 l_asg_rec.contract_id := NVL(l_asg_rec.contract_id,l_primary_asg_rec.contract_id);
3148 l_asg_rec.date_probation_end := NVL(l_asg_rec.date_probation_end,l_primary_asg_rec.date_probation_end);
3149 l_asg_rec.default_code_comb_id := NVL(l_asg_rec.default_code_comb_id,l_primary_asg_rec.default_code_comb_id);
3150 l_asg_rec.establishment_id := NVL(l_asg_rec.establishment_id,l_primary_asg_rec.establishment_id);
3151 l_asg_rec.frequency := NVL(l_asg_rec.frequency,l_primary_asg_rec.frequency);
3152 l_asg_rec.hourly_salaried_code := NVL(l_asg_rec.hourly_salaried_code,l_primary_asg_rec.hourly_salaried_code);
3153 l_asg_rec.internal_address_line := NVL(l_asg_rec.internal_address_line,l_primary_asg_rec.internal_address_line);
3154 l_asg_rec.labour_union_member_flag := NVL(l_asg_rec.labour_union_member_flag,l_primary_asg_rec.labour_union_member_flag);
3155 l_asg_rec.manager_flag := NVL(l_asg_rec.manager_flag,l_primary_asg_rec.manager_flag);
3156 l_asg_rec.normal_hours := NVL(l_asg_rec.normal_hours,l_primary_asg_rec.normal_hours);
3157 l_asg_rec.perf_review_period := NVL(l_asg_rec.perf_review_period,l_primary_asg_rec.perf_review_period);
3158 l_asg_rec.perf_review_period_frequency := NVL(l_asg_rec.perf_review_period_frequency,l_primary_asg_rec.perf_review_period_frequency);
3159 l_asg_rec.probation_period := NVL(l_asg_rec.probation_period,l_primary_asg_rec.probation_period);
3160 l_asg_rec.probation_unit := NVL(l_asg_rec.probation_unit,l_primary_asg_rec.probation_unit);
3161 l_asg_rec.sal_review_period := NVL(l_asg_rec.sal_review_period,l_primary_asg_rec.sal_review_period);
3162 l_asg_rec.sal_review_period_frequency := NVL(l_asg_rec.sal_review_period_frequency,l_primary_asg_rec.sal_review_period_frequency);
3163 l_asg_rec.set_of_books_id := NVL(l_asg_rec.set_of_books_id,l_primary_asg_rec.set_of_books_id);
3164 l_asg_rec.source_type := NVL(l_asg_rec.source_type,l_primary_asg_rec.source_type);
3165 l_asg_rec.supervisor_id := NVL(l_asg_rec.supervisor_id,l_primary_asg_rec.supervisor_id);
3166 l_asg_rec.time_normal_finish := NVL(l_asg_rec.time_normal_finish,l_primary_asg_rec.time_normal_finish);
3167 l_asg_rec.time_normal_start := NVL(l_asg_rec.time_normal_start,l_primary_asg_rec.time_normal_start);
3168 --
3169 -- Bug 12834915
3170 if (nvl(l_asg_rec.ass_attribute_category,-1) = nvl(l_primary_asg_rec.ass_attribute_category,-1)) then
3171 l_asg_rec.ass_attribute1 := NVL(l_asg_rec.ass_attribute1, l_primary_asg_rec.ass_attribute1);
3172 l_asg_rec.ass_attribute2 := NVL(l_asg_rec.ass_attribute2, l_primary_asg_rec.ass_attribute2);
3173 l_asg_rec.ass_attribute3 := NVL(l_asg_rec.ass_attribute3, l_primary_asg_rec.ass_attribute3);
3174 l_asg_rec.ass_attribute4 := NVL(l_asg_rec.ass_attribute4, l_primary_asg_rec.ass_attribute4);
3175 l_asg_rec.ass_attribute5 := NVL(l_asg_rec.ass_attribute5, l_primary_asg_rec.ass_attribute5);
3176 l_asg_rec.ass_attribute6 := NVL(l_asg_rec.ass_attribute6, l_primary_asg_rec.ass_attribute6);
3177 l_asg_rec.ass_attribute7 := NVL(l_asg_rec.ass_attribute7, l_primary_asg_rec.ass_attribute7);
3178 l_asg_rec.ass_attribute8 := NVL(l_asg_rec.ass_attribute8, l_primary_asg_rec.ass_attribute8);
3179 l_asg_rec.ass_attribute9 := NVL(l_asg_rec.ass_attribute9, l_primary_asg_rec.ass_attribute9);
3180 l_asg_rec.ass_attribute10 := NVL(l_asg_rec.ass_attribute10,l_primary_asg_rec.ass_attribute10);
3181 l_asg_rec.ass_attribute11 := NVL(l_asg_rec.ass_attribute11,l_primary_asg_rec.ass_attribute11);
3182 l_asg_rec.ass_attribute12 := NVL(l_asg_rec.ass_attribute12,l_primary_asg_rec.ass_attribute12);
3183 l_asg_rec.ass_attribute13 := NVL(l_asg_rec.ass_attribute13,l_primary_asg_rec.ass_attribute13);
3184 l_asg_rec.ass_attribute14 := NVL(l_asg_rec.ass_attribute14,l_primary_asg_rec.ass_attribute14);
3185 l_asg_rec.ass_attribute15 := NVL(l_asg_rec.ass_attribute15,l_primary_asg_rec.ass_attribute15);
3186 l_asg_rec.ass_attribute16 := NVL(l_asg_rec.ass_attribute16,l_primary_asg_rec.ass_attribute16);
3187 l_asg_rec.ass_attribute17 := NVL(l_asg_rec.ass_attribute17,l_primary_asg_rec.ass_attribute17);
3188 l_asg_rec.ass_attribute18 := NVL(l_asg_rec.ass_attribute18,l_primary_asg_rec.ass_attribute18);
3189 l_asg_rec.ass_attribute19 := NVL(l_asg_rec.ass_attribute19,l_primary_asg_rec.ass_attribute19);
3190 l_asg_rec.ass_attribute20 := NVL(l_asg_rec.ass_attribute20,l_primary_asg_rec.ass_attribute20);
3191 l_asg_rec.ass_attribute21 := NVL(l_asg_rec.ass_attribute21,l_primary_asg_rec.ass_attribute21);
3192 l_asg_rec.ass_attribute22 := NVL(l_asg_rec.ass_attribute22,l_primary_asg_rec.ass_attribute22);
3193 l_asg_rec.ass_attribute23 := NVL(l_asg_rec.ass_attribute23,l_primary_asg_rec.ass_attribute23);
3194 l_asg_rec.ass_attribute24 := NVL(l_asg_rec.ass_attribute24,l_primary_asg_rec.ass_attribute24);
3195 l_asg_rec.ass_attribute25 := NVL(l_asg_rec.ass_attribute25,l_primary_asg_rec.ass_attribute25);
3196 l_asg_rec.ass_attribute26 := NVL(l_asg_rec.ass_attribute26,l_primary_asg_rec.ass_attribute26);
3197 l_asg_rec.ass_attribute27 := NVL(l_asg_rec.ass_attribute27,l_primary_asg_rec.ass_attribute27);
3198 l_asg_rec.ass_attribute28 := NVL(l_asg_rec.ass_attribute28,l_primary_asg_rec.ass_attribute28);
3199 l_asg_rec.ass_attribute29 := NVL(l_asg_rec.ass_attribute29,l_primary_asg_rec.ass_attribute29);
3200 l_asg_rec.ass_attribute30 := NVL(l_asg_rec.ass_attribute30,l_primary_asg_rec.ass_attribute30);
3201 elsif (l_asg_rec.ass_attribute_category is null) then
3202 l_asg_rec.ass_attribute_category := l_primary_asg_rec.ass_attribute_category;
3203 l_asg_rec.ass_attribute1 := l_primary_asg_rec.ass_attribute1;
3204 l_asg_rec.ass_attribute2 := l_primary_asg_rec.ass_attribute2;
3205 l_asg_rec.ass_attribute3 := l_primary_asg_rec.ass_attribute3;
3206 l_asg_rec.ass_attribute4 := l_primary_asg_rec.ass_attribute4;
3207 l_asg_rec.ass_attribute5 := l_primary_asg_rec.ass_attribute5;
3208 l_asg_rec.ass_attribute6 := l_primary_asg_rec.ass_attribute6;
3209 l_asg_rec.ass_attribute7 := l_primary_asg_rec.ass_attribute7;
3210 l_asg_rec.ass_attribute8 := l_primary_asg_rec.ass_attribute8;
3211 l_asg_rec.ass_attribute9 := l_primary_asg_rec.ass_attribute9;
3212 l_asg_rec.ass_attribute10 := l_primary_asg_rec.ass_attribute10;
3213 l_asg_rec.ass_attribute11 := l_primary_asg_rec.ass_attribute11;
3214 l_asg_rec.ass_attribute12 := l_primary_asg_rec.ass_attribute12;
3215 l_asg_rec.ass_attribute13 := l_primary_asg_rec.ass_attribute13;
3216 l_asg_rec.ass_attribute14 := l_primary_asg_rec.ass_attribute14;
3217 l_asg_rec.ass_attribute15 := l_primary_asg_rec.ass_attribute15;
3218 l_asg_rec.ass_attribute16 := l_primary_asg_rec.ass_attribute16;
3219 l_asg_rec.ass_attribute17 := l_primary_asg_rec.ass_attribute17;
3220 l_asg_rec.ass_attribute18 := l_primary_asg_rec.ass_attribute18;
3221 l_asg_rec.ass_attribute19 := l_primary_asg_rec.ass_attribute19;
3222 l_asg_rec.ass_attribute20 := l_primary_asg_rec.ass_attribute20;
3223 l_asg_rec.ass_attribute21 := l_primary_asg_rec.ass_attribute21;
3224 l_asg_rec.ass_attribute22 := l_primary_asg_rec.ass_attribute22;
3225 l_asg_rec.ass_attribute23 := l_primary_asg_rec.ass_attribute23;
3226 l_asg_rec.ass_attribute24 := l_primary_asg_rec.ass_attribute24;
3227 l_asg_rec.ass_attribute25 := l_primary_asg_rec.ass_attribute25;
3228 l_asg_rec.ass_attribute26 := l_primary_asg_rec.ass_attribute26;
3229 l_asg_rec.ass_attribute27 := l_primary_asg_rec.ass_attribute27;
3230 l_asg_rec.ass_attribute28 := l_primary_asg_rec.ass_attribute28;
3231 l_asg_rec.ass_attribute29 := l_primary_asg_rec.ass_attribute29;
3232 l_asg_rec.ass_attribute30 := l_primary_asg_rec.ass_attribute30;
3233 end if;
3234 --
3235 if (l_asg_rec.cagr_id_flex_num = l_primary_asg_rec.cagr_id_flex_num) then
3236 l_cag_rec.segment1 := NVL(l_cag_rec.segment1, l_primary_cag_rec.segment1);
3237 l_cag_rec.segment2 := NVL(l_cag_rec.segment2, l_primary_cag_rec.segment2);
3238 l_cag_rec.segment3 := NVL(l_cag_rec.segment3, l_primary_cag_rec.segment3);
3239 l_cag_rec.segment4 := NVL(l_cag_rec.segment4, l_primary_cag_rec.segment4);
3240 l_cag_rec.segment5 := NVL(l_cag_rec.segment5, l_primary_cag_rec.segment5);
3241 l_cag_rec.segment6 := NVL(l_cag_rec.segment6, l_primary_cag_rec.segment6);
3242 l_cag_rec.segment7 := NVL(l_cag_rec.segment7, l_primary_cag_rec.segment7);
3243 l_cag_rec.segment8 := NVL(l_cag_rec.segment8, l_primary_cag_rec.segment8);
3244 l_cag_rec.segment9 := NVL(l_cag_rec.segment9, l_primary_cag_rec.segment9);
3245 l_cag_rec.segment10 := NVL(l_cag_rec.segment10,l_primary_cag_rec.segment10);
3246 l_cag_rec.segment11 := NVL(l_cag_rec.segment11,l_primary_cag_rec.segment11);
3247 l_cag_rec.segment12 := NVL(l_cag_rec.segment12,l_primary_cag_rec.segment12);
3248 l_cag_rec.segment13 := NVL(l_cag_rec.segment13,l_primary_cag_rec.segment13);
3249 l_cag_rec.segment14 := NVL(l_cag_rec.segment14,l_primary_cag_rec.segment14);
3250 l_cag_rec.segment15 := NVL(l_cag_rec.segment15,l_primary_cag_rec.segment15);
3251 l_cag_rec.segment16 := NVL(l_cag_rec.segment16,l_primary_cag_rec.segment16);
3252 l_cag_rec.segment17 := NVL(l_cag_rec.segment17,l_primary_cag_rec.segment17);
3253 l_cag_rec.segment18 := NVL(l_cag_rec.segment18,l_primary_cag_rec.segment18);
3254 l_cag_rec.segment19 := NVL(l_cag_rec.segment19,l_primary_cag_rec.segment19);
3255 l_cag_rec.segment20 := NVL(l_cag_rec.segment20,l_primary_cag_rec.segment20);
3256 elsif (l_asg_rec.cagr_id_flex_num is null) then
3257 l_asg_rec.cagr_id_flex_num := l_primary_asg_rec.cagr_id_flex_num;
3258 l_cag_rec.segment1 := l_primary_cag_rec.segment1;
3259 l_cag_rec.segment2 := l_primary_cag_rec.segment2;
3260 l_cag_rec.segment3 := l_primary_cag_rec.segment3;
3261 l_cag_rec.segment4 := l_primary_cag_rec.segment4;
3262 l_cag_rec.segment5 := l_primary_cag_rec.segment5;
3263 l_cag_rec.segment6 := l_primary_cag_rec.segment6;
3264 l_cag_rec.segment7 := l_primary_cag_rec.segment7;
3265 l_cag_rec.segment8 := l_primary_cag_rec.segment8;
3266 l_cag_rec.segment9 := l_primary_cag_rec.segment9;
3267 l_cag_rec.segment10 := l_primary_cag_rec.segment10;
3268 l_cag_rec.segment11 := l_primary_cag_rec.segment11;
3269 l_cag_rec.segment12 := l_primary_cag_rec.segment12;
3270 l_cag_rec.segment13 := l_primary_cag_rec.segment13;
3271 l_cag_rec.segment14 := l_primary_cag_rec.segment14;
3272 l_cag_rec.segment15 := l_primary_cag_rec.segment15;
3273 l_cag_rec.segment16 := l_primary_cag_rec.segment16;
3274 l_cag_rec.segment17 := l_primary_cag_rec.segment17;
3275 l_cag_rec.segment18 := l_primary_cag_rec.segment18;
3276 l_cag_rec.segment19 := l_primary_cag_rec.segment19;
3277 l_cag_rec.segment20 := l_primary_cag_rec.segment20;
3278 end if;
3279 --
3280 l_scl_rec.segment1 := NVL(l_scl_rec.segment1, l_primary_scl_rec.segment1);
3281 l_scl_rec.segment2 := NVL(l_scl_rec.segment2, l_primary_scl_rec.segment2);
3282 l_scl_rec.segment3 := NVL(l_scl_rec.segment3, l_primary_scl_rec.segment3);
3283 l_scl_rec.segment4 := NVL(l_scl_rec.segment4, l_primary_scl_rec.segment4);
3284 l_scl_rec.segment5 := NVL(l_scl_rec.segment5, l_primary_scl_rec.segment5);
3285 l_scl_rec.segment6 := NVL(l_scl_rec.segment6, l_primary_scl_rec.segment6);
3286 l_scl_rec.segment7 := NVL(l_scl_rec.segment7, l_primary_scl_rec.segment7);
3287 l_scl_rec.segment8 := NVL(l_scl_rec.segment8, l_primary_scl_rec.segment8);
3288 l_scl_rec.segment9 := NVL(l_scl_rec.segment9, l_primary_scl_rec.segment9);
3289 l_scl_rec.segment10 := NVL(l_scl_rec.segment10,l_primary_scl_rec.segment10);
3290 l_scl_rec.segment11 := NVL(l_scl_rec.segment11,l_primary_scl_rec.segment11);
3291 l_scl_rec.segment12 := NVL(l_scl_rec.segment12,l_primary_scl_rec.segment12);
3292 l_scl_rec.segment13 := NVL(l_scl_rec.segment13,l_primary_scl_rec.segment13);
3293 l_scl_rec.segment14 := NVL(l_scl_rec.segment14,l_primary_scl_rec.segment14);
3294 l_scl_rec.segment15 := NVL(l_scl_rec.segment15,l_primary_scl_rec.segment15);
3295 l_scl_rec.segment16 := NVL(l_scl_rec.segment16,l_primary_scl_rec.segment16);
3296 l_scl_rec.segment17 := NVL(l_scl_rec.segment17,l_primary_scl_rec.segment17);
3297 l_scl_rec.segment18 := NVL(l_scl_rec.segment18,l_primary_scl_rec.segment18);
3298 l_scl_rec.segment19 := NVL(l_scl_rec.segment19,l_primary_scl_rec.segment19);
3299 l_scl_rec.segment20 := NVL(l_scl_rec.segment20,l_primary_scl_rec.segment20);
3300 l_scl_rec.segment21 := NVL(l_scl_rec.segment21,l_primary_scl_rec.segment21);
3301 l_scl_rec.segment22 := NVL(l_scl_rec.segment22,l_primary_scl_rec.segment22);
3302 l_scl_rec.segment23 := NVL(l_scl_rec.segment23,l_primary_scl_rec.segment23);
3303 l_scl_rec.segment24 := NVL(l_scl_rec.segment24,l_primary_scl_rec.segment24);
3304 l_scl_rec.segment25 := NVL(l_scl_rec.segment25,l_primary_scl_rec.segment25);
3305 l_scl_rec.segment26 := NVL(l_scl_rec.segment26,l_primary_scl_rec.segment26);
3306 l_scl_rec.segment27 := NVL(l_scl_rec.segment27,l_primary_scl_rec.segment27);
3307 l_scl_rec.segment28 := NVL(l_scl_rec.segment28,l_primary_scl_rec.segment28);
3308 l_scl_rec.segment29 := NVL(l_scl_rec.segment29,l_primary_scl_rec.segment29);
3309 l_scl_rec.segment30 := NVL(l_scl_rec.segment30,l_primary_scl_rec.segment30);
3310 --
3311 end if;
3312 --
3313 --The below call to the old update_emp_asg_criteria procedure has been commented as per bug 5102160
3314 -- soft_coding_keyflex_id is passed by calling the new update_emp_asg_criteria procedure
3315
3316 /* hr_assignment_api.update_emp_asg_criteria
3317 (p_validate => FALSE
3318 ,p_effective_date => l_hire_date
3319 ,p_datetrack_update_mode => l_datetrack_update_mode
3320 ,p_assignment_id => l_primary_asg_id
3321 ,p_object_version_number => l_primary_ovn
3322 ,p_grade_id => l_asg_rec.grade_id
3323 ,p_position_id => l_asg_rec.position_id
3324 ,p_job_id => l_asg_rec.job_id
3325 ,p_payroll_id => l_asg_rec.payroll_id
3326 ,p_location_id => l_asg_rec.location_id
3327 ,p_special_ceiling_step_id => l_asg_rec.special_ceiling_step_id
3328 ,p_organization_id => l_asg_rec.organization_id
3329 ,p_pay_basis_id => l_asg_rec.pay_basis_id
3330 ,p_employment_category => l_asg_rec.employment_category
3331 ,p_segment1 => l_pgp_rec.segment1
3332 ,p_segment2 => l_pgp_rec.segment2
3333 ,p_segment3 => l_pgp_rec.segment3
3334 ,p_segment4 => l_pgp_rec.segment4
3335 ,p_segment5 => l_pgp_rec.segment5
3336 ,p_segment6 => l_pgp_rec.segment6
3337 ,p_segment7 => l_pgp_rec.segment7
3338 ,p_segment8 => l_pgp_rec.segment8
3339 ,p_segment9 => l_pgp_rec.segment9
3340 ,p_segment10 => l_pgp_rec.segment10
3341 ,p_segment11 => l_pgp_rec.segment11
3342 ,p_segment12 => l_pgp_rec.segment12
3343 ,p_segment13 => l_pgp_rec.segment13
3344 ,p_segment14 => l_pgp_rec.segment14
3345 ,p_segment15 => l_pgp_rec.segment15
3346 ,p_segment16 => l_pgp_rec.segment16
3347 ,p_segment17 => l_pgp_rec.segment17
3348 ,p_segment18 => l_pgp_rec.segment18
3349 ,p_segment19 => l_pgp_rec.segment19
3350 ,p_segment20 => l_pgp_rec.segment20
3351 ,p_segment21 => l_pgp_rec.segment21
3352 ,p_segment22 => l_pgp_rec.segment22
3353 ,p_segment23 => l_pgp_rec.segment23
3354 ,p_segment24 => l_pgp_rec.segment24
3355 ,p_segment25 => l_pgp_rec.segment25
3356 ,p_segment26 => l_pgp_rec.segment26
3357 ,p_segment27 => l_pgp_rec.segment27
3358 ,p_segment28 => l_pgp_rec.segment28
3359 ,p_segment29 => l_pgp_rec.segment29
3360 ,p_segment30 => l_pgp_rec.segment30
3361 ,p_group_name => l_dummyv
3362 ,p_effective_start_date => l_effective_start_date
3363 ,p_effective_end_date => l_effective_end_date
3364 ,p_people_group_id => l_dummy
3365 ,p_org_now_no_manager_warning => l_dummyb
3366 ,p_other_manager_warning => l_dummyb
3367 ,p_spp_delete_warning => l_dummyb
3368 ,p_entries_changed_warning => l_dummyv
3369 ,p_tax_district_changed_warning => l_dummyb
3370 );*/
3371
3372 hr_assignment_api.update_emp_asg_criteria
3373 (p_validate => FALSE
3374 ,p_effective_date => l_hire_date
3375 ,p_datetrack_update_mode => l_datetrack_update_mode
3376 ,p_assignment_id => l_primary_asg_id
3377 ,p_object_version_number => l_primary_ovn
3378 ,p_grade_id => l_asg_rec.grade_id
3379 ,p_position_id => l_asg_rec.position_id
3380 ,p_job_id => l_asg_rec.job_id
3381 ,p_payroll_id => l_asg_rec.payroll_id
3382 ,p_location_id => l_asg_rec.location_id
3383 ,p_special_ceiling_step_id => l_asg_rec.special_ceiling_step_id
3384 ,p_organization_id => l_asg_rec.organization_id
3385 ,p_pay_basis_id => l_asg_rec.pay_basis_id
3386 ,p_supervisor_assignment_id => nvl(l_asg_rec.supervisor_assignment_id
3387 , l_primary_asg_rec.supervisor_assignment_id) -- 13595937
3388 ,p_segment1 => l_pgp_rec.segment1
3389 ,p_segment2 => l_pgp_rec.segment2
3390 ,p_segment3 => l_pgp_rec.segment3
3391 ,p_segment4 => l_pgp_rec.segment4
3392 ,p_segment5 => l_pgp_rec.segment5
3393 ,p_segment6 => l_pgp_rec.segment6
3394 ,p_segment7 => l_pgp_rec.segment7
3395 ,p_segment8 => l_pgp_rec.segment8
3396 ,p_segment9 => l_pgp_rec.segment9
3397 ,p_segment10 => l_pgp_rec.segment10
3398 ,p_segment11 => l_pgp_rec.segment11
3399 ,p_segment12 => l_pgp_rec.segment12
3400 ,p_segment13 => l_pgp_rec.segment13
3401 ,p_segment14 => l_pgp_rec.segment14
3402 ,p_segment15 => l_pgp_rec.segment15
3403 ,p_segment16 => l_pgp_rec.segment16
3404 ,p_segment17 => l_pgp_rec.segment17
3405 ,p_segment18 => l_pgp_rec.segment18
3406 ,p_segment19 => l_pgp_rec.segment19
3407 ,p_segment20 => l_pgp_rec.segment20
3408 ,p_segment21 => l_pgp_rec.segment21
3409 ,p_segment22 => l_pgp_rec.segment22
3410 ,p_segment23 => l_pgp_rec.segment23
3411 ,p_segment24 => l_pgp_rec.segment24
3412 ,p_segment25 => l_pgp_rec.segment25
3413 ,p_segment26 => l_pgp_rec.segment26
3414 ,p_segment27 => l_pgp_rec.segment27
3415 ,p_segment28 => l_pgp_rec.segment28
3416 ,p_segment29 => l_pgp_rec.segment29
3417 ,p_segment30 => l_pgp_rec.segment30
3418 ,p_employment_category => l_asg_rec.employment_category
3419 ,p_people_group_id => l_dummy
3420 ,p_soft_coding_keyflex_id => l_asg_rec.soft_coding_keyflex_id
3421 ,p_group_name => l_dummyv
3422 ,p_effective_start_date => l_effective_start_date
3423 ,p_effective_end_date => l_effective_end_date
3424 ,p_org_now_no_manager_warning => l_dummyb
3425 ,p_other_manager_warning => l_dummyb
3426 ,p_spp_delete_warning => l_dummyb
3427 ,p_entries_changed_warning => l_dummyv
3428 ,p_tax_district_changed_warning => l_dummyb
3429 ,p_concatenated_segments => l_concatenated_segments
3430 ,p_gsp_post_process_warning => l_gsp_post_process_warning -- bug 2999562
3431 );
3432 --
3433 hr_utility.set_location(l_proc, 340);
3434 --
3435 hr_assignment_api.update_emp_asg
3436 (p_validate => FALSE
3437 ,p_effective_date => l_hire_date
3438 ,p_datetrack_update_mode => 'CORRECTION'
3439 ,p_assignment_id => l_primary_asg_id
3440 ,p_object_version_number => l_primary_ovn
3441 ,p_supervisor_id => l_asg_rec.supervisor_id
3442 ,p_assignment_number => l_asg_rec.assignment_number
3443 ,p_change_reason => NULL -- l_asg_rec.change_reason Bug 12946619
3444 ,p_date_probation_end => l_asg_rec.date_probation_end
3445 ,p_default_code_comb_id => l_asg_rec.default_code_comb_id
3446 ,p_frequency => l_asg_rec.frequency
3447 ,p_internal_address_line => l_asg_rec.internal_address_line
3448 ,p_manager_flag => l_asg_rec.manager_flag
3449 ,p_normal_hours => l_asg_rec.normal_hours
3450 ,p_perf_review_period => l_asg_rec.perf_review_period
3451 ,p_perf_review_period_frequency => l_asg_rec.perf_review_period_frequency
3452 ,p_probation_period => l_asg_rec.probation_period
3453 ,p_probation_unit => l_asg_rec.probation_unit
3454 ,p_sal_review_period => l_asg_rec.sal_review_period
3455 ,p_sal_review_period_frequency => l_asg_rec.sal_review_period_frequency
3456 ,p_set_of_books_id => l_asg_rec.set_of_books_id
3457 ,p_source_type => l_asg_rec.source_type
3458 ,p_time_normal_finish => l_asg_rec.time_normal_finish
3459 ,p_time_normal_start => l_asg_rec.time_normal_start
3460 ,p_bargaining_unit_code => l_asg_rec.bargaining_unit_code
3461 ,p_labour_union_member_flag => l_asg_rec.labour_union_member_flag
3462 ,p_hourly_salaried_code => l_asg_rec.hourly_salaried_code
3463 ,p_ass_attribute_category => l_asg_rec.ass_attribute_category
3464 ,p_ass_attribute1 => l_asg_rec.ass_attribute1
3465 ,p_ass_attribute2 => l_asg_rec.ass_attribute2
3466 ,p_ass_attribute3 => l_asg_rec.ass_attribute3
3467 ,p_ass_attribute4 => l_asg_rec.ass_attribute4
3468 ,p_ass_attribute5 => l_asg_rec.ass_attribute5
3469 ,p_ass_attribute6 => l_asg_rec.ass_attribute6
3470 ,p_ass_attribute7 => l_asg_rec.ass_attribute7
3471 ,p_ass_attribute8 => l_asg_rec.ass_attribute8
3472 ,p_ass_attribute9 => l_asg_rec.ass_attribute9
3473 ,p_ass_attribute10 => l_asg_rec.ass_attribute10
3474 ,p_ass_attribute11 => l_asg_rec.ass_attribute11
3475 ,p_ass_attribute12 => l_asg_rec.ass_attribute12
3476 ,p_ass_attribute13 => l_asg_rec.ass_attribute13
3477 ,p_ass_attribute14 => l_asg_rec.ass_attribute14
3478 ,p_ass_attribute15 => l_asg_rec.ass_attribute15
3479 ,p_ass_attribute16 => l_asg_rec.ass_attribute16
3480 ,p_ass_attribute17 => l_asg_rec.ass_attribute17
3481 ,p_ass_attribute18 => l_asg_rec.ass_attribute18
3482 ,p_ass_attribute19 => l_asg_rec.ass_attribute19
3483 ,p_ass_attribute20 => l_asg_rec.ass_attribute20
3484 ,p_ass_attribute21 => l_asg_rec.ass_attribute21
3485 ,p_ass_attribute22 => l_asg_rec.ass_attribute22
3486 ,p_ass_attribute23 => l_asg_rec.ass_attribute23
3487 ,p_ass_attribute24 => l_asg_rec.ass_attribute24
3488 ,p_ass_attribute25 => l_asg_rec.ass_attribute25
3489 ,p_ass_attribute26 => l_asg_rec.ass_attribute26
3490 ,p_ass_attribute27 => l_asg_rec.ass_attribute27
3491 ,p_ass_attribute28 => l_asg_rec.ass_attribute28
3492 ,p_ass_attribute29 => l_asg_rec.ass_attribute29
3493 ,p_ass_attribute30 => l_asg_rec.ass_attribute30
3494 ,p_segment1 => l_scl_rec.segment1
3495 ,p_segment2 => l_scl_rec.segment2
3496 ,p_segment3 => l_scl_rec.segment3
3497 ,p_segment4 => l_scl_rec.segment4
3498 ,p_segment5 => l_scl_rec.segment5
3499 ,p_segment6 => l_scl_rec.segment6
3500 ,p_segment7 => l_scl_rec.segment7
3501 ,p_segment8 => l_scl_rec.segment8
3502 ,p_segment9 => l_scl_rec.segment9
3503 ,p_segment10 => l_scl_rec.segment10
3504 ,p_segment11 => l_scl_rec.segment11
3505 ,p_segment12 => l_scl_rec.segment12
3506 ,p_segment13 => l_scl_rec.segment13
3507 ,p_segment14 => l_scl_rec.segment14
3508 ,p_segment15 => l_scl_rec.segment15
3509 ,p_segment16 => l_scl_rec.segment16
3510 ,p_segment17 => l_scl_rec.segment17
3511 ,p_segment18 => l_scl_rec.segment18
3512 ,p_segment19 => l_scl_rec.segment19
3513 ,p_segment20 => l_scl_rec.segment20
3514 ,p_segment21 => l_scl_rec.segment21
3515 ,p_segment22 => l_scl_rec.segment22
3516 ,p_segment23 => l_scl_rec.segment23
3517 ,p_segment24 => l_scl_rec.segment24
3518 ,p_segment25 => l_scl_rec.segment25
3519 ,p_segment26 => l_scl_rec.segment26
3520 ,p_segment27 => l_scl_rec.segment27
3521 ,p_segment28 => l_scl_rec.segment28
3522 ,p_segment29 => l_scl_rec.segment29
3523 ,p_segment30 => l_scl_rec.segment30
3524 ,p_contract_id => l_asg_rec.contract_id
3525 ,p_establishment_id => l_asg_rec.establishment_id
3526 ,p_collective_agreement_id => l_asg_rec.collective_agreement_id
3527 ,p_cagr_id_flex_num => l_asg_rec.cagr_id_flex_num
3528 ,p_cag_segment1 => l_cag_rec.segment1
3529 ,p_cag_segment2 => l_cag_rec.segment2
3530 ,p_cag_segment3 => l_cag_rec.segment3
3531 ,p_cag_segment4 => l_cag_rec.segment4
3532 ,p_cag_segment5 => l_cag_rec.segment5
3533 ,p_cag_segment6 => l_cag_rec.segment6
3534 ,p_cag_segment7 => l_cag_rec.segment7
3535 ,p_cag_segment8 => l_cag_rec.segment8
3536 ,p_cag_segment9 => l_cag_rec.segment9
3537 ,p_cag_segment10 => l_cag_rec.segment10
3538 ,p_cag_segment11 => l_cag_rec.segment11
3539 ,p_cag_segment12 => l_cag_rec.segment12
3540 ,p_cag_segment13 => l_cag_rec.segment13
3541 ,p_cag_segment14 => l_cag_rec.segment14
3542 ,p_cag_segment15 => l_cag_rec.segment15
3543 ,p_cag_segment16 => l_cag_rec.segment16
3544 ,p_cag_segment17 => l_cag_rec.segment17
3545 ,p_cag_segment18 => l_cag_rec.segment18
3546 ,p_cag_segment19 => l_cag_rec.segment19
3547 ,p_cag_segment20 => l_cag_rec.segment20
3548 ,p_notice_period => l_asg_rec.notice_period
3549 ,p_notice_period_uom => l_asg_rec.notice_period_uom
3550 ,p_employee_category => l_asg_rec.employee_category
3551 ,p_work_at_home => l_asg_rec.work_at_home
3552 ,p_job_post_source_name => l_asg_rec.job_post_source_name
3553 ,p_cagr_grade_def_id => l_dummynum1 -- Bug # 2788390 modified l_dummy to l_dummynum1.
3554 ,p_cagr_concatenated_segments => l_dummyv
3555 ,p_concatenated_segments => l_dummyv
3556 ,p_soft_coding_keyflex_id => l_dummy1
3557 ,p_comment_id => l_dummy2
3558 ,p_effective_start_date => l_effective_start_date
3559 ,p_effective_end_date => l_effective_end_date
3560 ,p_no_managers_warning => l_dummyb
3561 ,p_other_manager_warning => l_dummyb
3562 ,p_hourly_salaried_warning => l_dummyb
3563 );
3564 --
3565 hr_utility.set_location(l_proc, 350);
3566
3567
3568 --Fix For Bug # 5987409 Starts -----
3569
3570 UPDATE PER_ASSIGNMENTS_F PAF SET PAF.VACANCY_ID =l_asg_rec.vacancy_id ,
3571 PAF.RECRUITER_ID =l_asg_rec.recruiter_id
3572 WHERE PAF.ASSIGNMENT_ID = l_primary_asg_id AND
3573 PAF.EFFECTIVE_START_DATE = l_effective_start_date AND
3574 PAF.EFFECTIVE_END_DATE = l_effective_end_date;
3575
3576 --Fix For Bug # 5987409 Starts -----
3577
3578
3579 --
3580 -- now end date the application
3581 --
3582 per_asg_del.del
3583 (p_assignment_id => l_asg_rec.assignment_id
3584 ,p_effective_start_date => l_effective_start_date
3585 ,p_effective_end_date => l_effective_end_date
3586 ,p_business_group_id => l_business_group_id
3587 ,p_object_version_number => l_asg_rec.object_version_number
3588 ,p_effective_date => l_hire_date-1
3589 ,p_validation_start_date => l_validation_start_date
3590 ,p_validation_end_date => l_validation_end_date
3591 ,p_datetrack_mode => 'DELETE'
3592 ,p_org_now_no_manager_warning => l_org_now_no_manager_warning
3593 );
3594 --
3595 hr_utility.set_location(l_proc, 360);
3596 --
3597 -- added for the bug 4641965
3598 --
3599 if (p_primary_assignment_id is not null ) then
3600 l_pspl_asg_id :=p_primary_assignment_id;
3601 else
3602 l_pspl_asg_id :=asg_rec.assignment_id;
3603 end if;
3604 --start of bug 5102289
3605 open get_primary_pay_basis(l_primary_asg_id);
3606 fetch get_primary_pay_basis into l_pay_basis_id;
3607 if l_pay_basis_id = l_asg_rec.pay_basis_id then
3608 l_approved := 'N';
3609 else
3610 l_approved := 'Y';
3611 end if;
3612 close get_primary_pay_basis;
3613 --End of bug 5102289
3614
3615 OPEN get_pay_proposal(l_pspl_asg_id);
3616 FETCH get_pay_proposal INTO l_pay_pspl_id,l_pay_obj_number,l_proposed_sal_n, l_dummy_change_date,l_proposal_reason; --Added Proposal_Reason For Bug # 5987409 --
3617 if get_pay_proposal%found then
3618 l_pay_pspl_id:=null;
3619 l_pay_obj_number:=null;
3620 open get_primary_proposal (l_primary_asg_id);
3621 fetch get_primary_proposal into l_pay_pspl_id,l_pay_obj_number;
3622 if get_primary_proposal%found then
3623 close get_primary_proposal;
3624 hr_maintain_proposal_api.cre_or_upd_salary_proposal(
3625 p_validate => false,
3626 p_pay_proposal_id => l_pay_pspl_id ,
3627 p_object_version_number => l_pay_obj_number,
3628 p_change_date => p_hire_date,
3629 p_approved => l_approved,
3630 p_inv_next_sal_date_warning => l_inv_next_sal_date_warning,
3631 p_proposed_salary_warning => l_proposed_salary_warning,
3632 p_approved_warning => l_approved_warning,
3633 p_payroll_warning => l_payroll_warning,
3634 p_proposed_salary_n => l_proposed_sal_n,
3635 p_business_group_id => l_business_group_id,
3636 p_proposal_reason => l_proposal_reason);
3637 else
3638 close get_primary_proposal;
3639 l_pay_pspl_id:=null;
3640 l_pay_obj_number:=null;
3641 hr_maintain_proposal_api.cre_or_upd_salary_proposal(
3642 p_validate => false,
3643 p_pay_proposal_id => l_pay_pspl_id,
3644 p_assignment_id => l_primary_asg_id,
3645 p_object_version_number => l_pay_obj_number,
3646 p_change_date => p_hire_date,
3647 p_approved => l_approved,
3648 p_inv_next_sal_date_warning => l_inv_next_sal_date_warning,
3649 p_proposed_salary_warning => l_proposed_salary_warning,
3650 p_approved_warning => l_approved_warning,
3651 p_payroll_warning => l_payroll_warning,
3652 p_proposed_salary_n => l_proposed_sal_n,
3653 p_business_group_id => l_business_group_id,
3654 p_proposal_reason => l_proposal_reason);
3655
3656 end if;
3657 --
3658 end if;
3659 --
3660 close get_pay_proposal;
3661 --
3662 -- end of bug 4641965
3663 end if;
3664 --
3665 if per_otherbg_apl_api.isMultiRegVac(asg_rec.assignment_id) then
3666 per_otherbg_apl_api.close_otherbg_applications(asg_rec.assignment_id,l_hire_date-1,'HIRE_CLOSE');
3667 end if;
3668
3669 --Bug 4959033
3670
3671 open get_business_group(l_primary_asg_id);
3672 fetch get_business_group into l_bg_id;
3673 --
3674 if get_business_group%NOTFOUND then
3675 close get_business_group;
3676 l_bg_id := hr_general.get_business_group_id;
3677 else
3678 close get_business_group;
3679 end if;
3680 --
3681 hrentmnt.maintain_entries_asg (
3682 p_assignment_id => l_primary_asg_id,
3683 p_business_group_id => l_bg_id,
3684 p_operation => 'ASG_CRITERIA',
3685 p_actual_term_date => null,
3686 p_last_standard_date => null,
3687 p_final_process_date => null,
3688 p_dt_mode => 'UPDATE',
3689 p_validation_start_date => l_effective_start_date,
3690 p_validation_end_date => l_effective_end_date
3691 );
3692 -- End of Bug 4959033
3693 open csr_vacs(l_asg_rec.vacancy_id);
3694 fetch csr_vacs into l_dummy;
3695 if csr_vacs%found then
3696 close csr_vacs;
3697 l_oversubscribed_vacancy_id :=l_asg_rec.vacancy_id;
3698 else
3699 close csr_vacs;
3700 end if;
3701 --
3702 end loop;
3703 --
3704 hr_utility.set_location(l_proc,370);
3705 -- ER FPT
3706 for apl in fut_asg_rec
3707 loop
3708 hr_utility.set_location('Processing Assignment ID = '||apl.assignment_id,375);
3709
3710 l_fpt_hire_flag :='Y';
3711
3712 -- retrieve the max end date of the ASG to update the APLN date_end
3713 select max(effective_end_date) into l_apl_end_date
3714 from per_all_assignments_f
3715 where person_id = p_person_id
3716 and assignment_id = apl.assignment_id
3717 and assignment_type = 'A';
3718
3719 if l_apl_end_date = hr_api.g_eot then
3720 l_apl_end_date := null;
3721 end if;
3722
3723 -- check whether an application exists on the start date of the ASG
3724 open chk_apl_exists(apl.effective_start_date);
3725 fetch chk_apl_exists into l_cur_apl_id, l_current_apl_end_date;
3726 if chk_apl_exists%notfound then
3727
3728 -- creating APLN since not found
3729 SELECT per_applications_s.nextval into l_new_application_id FROM sys.dual;
3730 l_cur_apl_id := l_new_application_id;
3731 begin
3732 INSERT INTO PER_APPLICATIONS(
3733 application_id,
3734 business_group_id,
3735 person_id,
3736 date_received,
3737 date_end)
3738
3739 VALUES (l_new_application_id,l_business_group_id,p_person_id,apl.effective_start_date,l_apl_end_date);
3740
3741 exception
3742 when others then
3743 raise;
3744 end ;
3745
3746 else
3747
3748 -- if APLN end date < ASG end date, update the APLN
3749 if nvl(l_current_apl_end_date,hr_api.g_eot) < nvl(l_apl_end_date,hr_api.g_eot) then
3750 update per_applications
3751 set date_end = l_apl_end_date
3752 where person_id = p_person_id
3753 and application_id = l_cur_apl_id;
3754 end if;
3755
3756 end if;
3757
3758 close chk_apl_exists;
3759
3760 -- update the ASG with the correct APLN ID
3761 update per_all_assignments_f
3762 set application_id = l_cur_apl_id
3763 where person_id = p_person_id
3764 and assignment_id = apl.assignment_id
3765 and effective_start_date = apl.effective_start_date
3766 and effective_end_date = apl.effective_end_date;
3767
3768 end loop;
3769
3770 if nvl(l_fpt_hire_flag,'N') = 'Y' then
3771
3772 hr_utility.set_location('HR_EMPLOYEE_APPLICANT_API.HIRE_EMPLOYEE_APPLICANT',377);
3773
3774 -- loop through the future applications > hire date
3775 for apl in csr_get_apln_details(l_hire_date)
3776 loop
3777 l_person_type_id1 := hr_person_type_usage_info.get_default_person_type_id
3778 (l_business_group_id,'APL');
3779
3780 -- creating APL records in PTU table
3781 hr_per_type_usage_internal.maintain_person_type_usage
3782 (p_effective_date => apl.date_received
3783 ,p_person_id => p_person_id
3784 ,p_person_type_id => l_person_type_id1);
3785
3786 l_person_type_id1 := hr_person_type_usage_info.get_default_person_type_id
3787 (l_business_group_id,'EMP_APL');
3788
3789 select object_version_number into l_per_object_version_number
3790 from per_all_people_f
3791 where person_id = p_person_id
3792 and apl.date_received between effective_start_date and effective_end_date;
3793
3794 -- creating EMP_APL records in PER table
3795
3796 per_per_upd.upd
3797 (p_person_id => p_person_id
3798 ,p_effective_date => apl.date_received
3799 ,p_applicant_number => l_applicant_number
3800 ,p_employee_number => l_employee_number
3801 ,p_person_type_id => l_person_type_id1
3802 ,p_object_version_number => l_per_object_version_number
3803 ,p_datetrack_mode => 'UPDATE'
3804 ,p_effective_start_date => l_per_effective_start_date
3805 ,p_effective_end_date => l_per_effective_end_date
3806 ,p_comment_id => l_comment_id
3807 ,p_current_applicant_flag => l_current_applicant_flag
3808 ,p_current_emp_or_apl_flag => l_current_emp_or_apl_flag
3809 ,p_current_employee_flag => l_current_employee_flag
3810 ,p_full_name => l_full_name
3811 ,p_name_combination_warning => l_name_combination_warning
3812 ,p_dob_null_warning => p_assign_payroll_warning
3813 ,p_orig_hire_warning => l_orig_hire_warning
3814 ,p_npw_number => l_npw_number
3815 );
3816
3817 if nvl(apl.date_end,hr_api.g_eot) <> hr_api.g_eot then
3818
3819 -- check whether back-to-back application exists
3820
3821 open csr_back_toback_apln(apl.date_end) ;
3822 fetch csr_back_toback_apln into l_yes_backtoback;
3823 close csr_back_toback_apln;
3824
3825 if l_yes_backtoback ='N' then
3826
3827 l_person_type_id1 := hr_person_type_usage_info.get_default_person_type_id
3828 (l_business_group_id,'EX_APL');
3829
3830 -- creating EX_APL records in PTU table
3831 hr_per_type_usage_internal.maintain_person_type_usage
3832 (p_effective_date => apl.date_end + 1
3833 ,p_person_id => p_person_id
3834 ,p_person_type_id => l_person_type_id1
3835 );
3836
3837 select object_version_number into l_per_object_version_number
3838 from per_all_people_f
3839 where person_id= p_person_id
3840 and apl.date_end between effective_start_date and effective_end_date;
3841
3842 l_person_type_id1 := hr_person_type_usage_info.get_default_person_type_id
3843 (l_business_group_id,'EMP');
3844
3845
3846 -- creating EMP records in PER table
3847 per_per_upd.upd
3848 (p_person_id => p_person_id
3849 ,p_effective_date => apl.date_end + 1
3850 ,p_applicant_number => l_applicant_number
3851 ,p_employee_number => l_employee_number
3852 ,p_person_type_id => l_person_type_id1
3853 ,p_object_version_number => l_per_object_version_number
3854 ,p_datetrack_mode => 'UPDATE'
3855 ,p_effective_start_date => l_per_effective_start_date
3856 ,p_effective_end_date => l_per_effective_end_date
3857 ,p_comment_id => l_comment_id
3858 ,p_current_applicant_flag => l_current_applicant_flag
3859 ,p_current_emp_or_apl_flag => l_current_emp_or_apl_flag
3860 ,p_current_employee_flag => l_current_employee_flag
3861 ,p_full_name => l_full_name
3862 ,p_name_combination_warning => l_name_combination_warning
3863 ,p_dob_null_warning => p_assign_payroll_warning
3864 ,p_orig_hire_warning => l_orig_hire_warning
3865 ,p_npw_number => l_npw_number
3866 );
3867
3868 END IF;
3869
3870 end if;
3871
3872 end loop;
3873
3874 end if;
3875 -- ER FPT
3876
3877 -- Maintain person type usage record
3878 --
3879 -- PTU : Commented call to maintain_ptu
3880
3881 -- hr_per_type_usage_internal.maintain_ptu
3882 -- (p_person_id => p_person_id
3883 -- ,p_action => 'TERM_APL'
3884 -- ,p_business_group_id => l_business_group_id
3885 -- ,p_actual_termination_date => l_hire_date
3886 -- );
3887 --
3888 -- Call After Process User Hook for hire_employee_applicant
3889 --
3890
3891 -- Start chagnes for bug 9879782
3892 if p_upload_irec_docs = 'Y' and p_validate = false then
3893
3894 per_fnd_attachment_pkg.adjust_irec_docs (
3895 p_person_id => P_person_id,
3896 p_assignment_id => p_primary_assignment_id,
3897 p_application_id => l_appl_id,
3898 p_old_hire_date => p_hire_date,
3899 p_hire_date => p_hire_date,
3900 p_transaction_type => 'COREHR',
3901 p_transaction_status => 'COMPLETE',
3902 p_status => 'I',
3903 p_adjustment_type => 'COMMIT');
3904 end if;
3905 -- End chagnes for bug 9879782
3906
3907 begin
3908 hr_employee_applicant_bk2.hire_employee_applicant_a
3909 (
3910 p_hire_date => l_hire_date,
3911 p_person_id => p_person_id,
3912 p_primary_assignment_id => p_primary_assignment_id,
3913 p_overwrite_primary => p_overwrite_primary,
3914 p_person_type_id => p_person_type_id,
3915 p_per_object_version_number => l_per_object_version_number,
3916 p_per_effective_start_date => l_per_effective_start_date,
3917 p_per_effective_end_date => l_per_effective_end_date,
3918 p_unaccepted_asg_del_warning => l_unaccepted_asg_del_warning,
3919 p_assign_payroll_warning => l_assign_payroll_warning,
3920 p_oversubscribed_vacancy_id => l_oversubscribed_vacancy_id
3921 );
3922 exception
3923 when hr_api.cannot_find_prog_unit then
3924 hr_api.cannot_find_prog_unit_error
3925 (p_module_name => 'HIRE_EMPLOYEE_APPLICANT'
3926 ,p_hook_type => 'AP'
3927 );
3928 --
3929 -- End of the after hook for hire_employee_applicant
3930 --
3931 end;
3932 --
3933 -- When in validation only mode raise the Validate_Enabled exception
3934 --
3935 if p_validate then
3936 raise hr_api.validate_enabled;
3937 end if;
3938 --
3939 -- Set OUT parameters
3940 --
3941 p_per_object_version_number := l_per_object_version_number;
3942 p_per_effective_start_date := l_per_effective_start_date;
3943 p_per_effective_end_date := l_per_effective_end_date;
3944 p_unaccepted_asg_del_warning := l_unaccepted_asg_del_warning;
3945 p_assign_payroll_warning := l_assign_payroll_warning;
3946 p_oversubscribed_vacancy_id := l_oversubscribed_vacancy_id ;
3947 --
3948 hr_utility.set_location(' Leaving:'||l_proc, 380);
3949 --
3950 exception
3951 when hr_api.validate_enabled then
3952 --
3953 -- As the Validate_Enabled exception has been raised
3954 -- we must rollback to the savepoint
3955 --
3956 ROLLBACK TO hire_employee_applicant;
3957 --
3958 -- Only set output warning arguments
3959 -- (Any key or derived arguments must be set to null
3960 -- when validation only mode is being used.)
3961 -- Set OUT parameters to null
3962 --
3963 p_per_object_version_number := null;
3964 p_per_effective_start_date := null;
3965 p_per_effective_end_date := null;
3966 p_unaccepted_asg_del_warning := l_unaccepted_asg_del_warning;
3967 p_assign_payroll_warning := l_assign_payroll_warning;
3968 p_oversubscribed_vacancy_id := l_oversubscribed_vacancy_id ;
3969 --
3970 hr_utility.set_location(' Leaving:'||l_proc, 390);
3971 --
3972 when others then
3973 --
3974 -- A validation or unexpected error has occurred
3975 --
3976 p_per_object_version_number := l_ovn;
3977 p_per_effective_start_date := null;
3978 p_per_effective_end_date := null;
3979 p_oversubscribed_vacancy_id := null;
3980 p_unaccepted_asg_del_warning := false;
3981 p_assign_payroll_warning := false;
3982 ROLLBACK TO hire_employee_applicant;
3983 --
3984 --
3985 -- set in out parameters and set out parameters
3986 --
3987
3988 hr_utility.set_location(' Leaving:'||l_proc, 400);
3989 raise;
3990 --
3991 end hire_employee_applicant;
3992 --
3993 -- Begin #2264569
3994 -- +-------------------------------------------------------------------------+
3995 -- LOCATE_ELEMENT:
3996 -- Returns the location of a particular ID in the array.
3997 -- +-------------------------------------------------------------------------+
3998 function locate_element(p_table t_ApplTable
3999 ,p_id per_all_assignments_f.assignment_id%TYPE)
4000 return binary_integer is
4001 --
4002 l_index number;
4003 l_max_ele number;
4004 begin
4005 hr_utility.set_location('IN locate_element',50);
4006 l_index := 0;
4007 l_max_ele := p_table.COUNT;
4008 hr_utility.trace(' table rows: '||to_char(l_max_ele));
4009 if l_max_ele > 0 then
4010 l_index := 1;
4011 loop
4012 if p_table(l_index).id = p_id then
4013 exit;
4014 end if;
4015 l_index := l_index + 1;
4016 EXIT when l_index > l_max_ele ;
4017 end loop;
4018 end if;
4019 hr_utility.trace(' index found : '||to_char(l_index));
4020 hr_utility.set_location('OUT locate_element',51);
4021
4022 if l_index > l_max_ele then
4023 return(0);
4024 else
4025 return(l_index);
4026 end if;
4027 end locate_element;
4028 -- +-------------------------------------------------------------------------+
4029 -- LOCATE_VALUE:
4030 -- Returns index of first value that matches p_flag parameter.
4031 -- +-------------------------------------------------------------------------+
4032 function locate_value(p_table t_ApplTable
4033 ,p_flag varchar2)
4034 return binary_integer is
4035 l_index number;
4036 l_max_ele number;
4037 begin
4038 l_index := 0;
4039 l_max_ele := p_table.COUNT;
4040 if l_max_ele > 0 then
4041 l_index := 1;
4042 loop
4043 if p_table(l_index).process_flag = p_flag then
4044 exit;
4045 end if;
4046 l_index := l_index + 1;
4047 EXIT when l_index > l_max_ele ;
4048 end loop;
4049 end if;
4050
4051 if l_index > l_max_ele then
4052 return(0);
4053 else
4054 return(l_index);
4055 end if;
4056 end locate_value;
4057 --
4058 -- +-------------------------------------------------------------------------+
4059 -- end_date_exists
4060 -- Returns
4061 -- -1: if element not found
4062 -- 0: if value is null
4063 -- 1: if END DATE value has been stored in
4064 -- 2: a different value has been found.
4065 -- +-------------------------------------------------------------------------+
4066 function end_date_exists(p_table t_ApplTable
4067 ,p_id per_all_assignments_f.assignment_id%TYPE)
4068 return integer is
4069 l_index binary_integer;
4070 begin
4071 l_index := locate_element(p_table, p_id);
4072 if (l_index = 0) then
4073 return(-1);
4074 elsif p_table(l_index).process_flag is null then
4075 return(0);
4076 elsif p_table(l_index).process_flag = hr_employee_applicant_api.g_end_date_apl then
4077 return(1);
4078 else
4079 return(2);
4080 end if;
4081
4082 end end_date_exists;
4083 -- +-------------------------------------------------------------------------+
4084 -- is_convert:
4085 -- Returns
4086 -- TRUE if value exists for a particular ID or table is empty or value is null
4087 -- Restrictions: this function should be called when processing applicant
4088 -- assignments that have been ACCEPTED. The null value reflects a default
4089 -- value of 'Convert into secondary'.
4090 -- +-------------------------------------------------------------------------+
4091 function is_convert(p_table t_ApplTable
4092 ,p_id per_all_assignments_f.assignment_id%TYPE)
4093 return boolean is
4094 l_index binary_integer;
4095 begin
4096
4097 l_index := locate_element(p_table, p_id);
4098 if (l_index = 0) then
4099 return(TRUE);
4100 elsif (p_table(l_index).process_flag is null
4101 or p_table(l_index).process_flag = hr_employee_applicant_api.g_convert_apl) then
4102 return(TRUE);
4103 else
4104 return(FALSE);
4105 end if;
4106 end is_convert;
4107 --
4108 function retain_exists (p_table t_ApplTable) return boolean is
4109 begin
4110 return(hr_employee_applicant_api.locate_value(p_table
4111 ,hr_employee_applicant_api.g_retain_apl) <> 0 );
4112
4113 end retain_exists;
4114 --
4115 -- +-------------------------------------------------------------------------+
4116 -- TAB_IS_EMPTY:
4117 -- Returns TRUE if PL/SQL table is empty.
4118 -- +-------------------------------------------------------------------------+
4119 function tab_is_empty(p_table t_ApplTable) return boolean is
4120 begin
4121 return(p_table.COUNT = 0);
4122 end tab_is_empty;
4123 --
4124 --
4125 function empty_table return t_ApplTable is
4126 begin
4127 return t_EmptyAPPL;
4128 end;
4129 --
4130 function retain_flag return varchar2 is
4131 begin
4132 return(g_retain_apl);
4133 end;
4134 --
4135 function convert_flag return varchar2 is
4136 begin
4137 return(g_convert_apl);
4138 end;
4139 --
4140 function end_date_flag return varchar2 is
4141 begin
4142 return(g_end_date_apl);
4143 end;
4144
4145 -- end #2264569
4146 --
4147 -- ---------------------------------------------------------------------------
4148 -- |-------------------------< hire_employee_applicant >---------------------|
4149 -- ---------------------------------------------------------------------------
4150 -- ---------------------This procedure is only for SSHR use-------------------
4151 --
4152 procedure hire_employee_applicant
4153 (p_validate in boolean default false,
4154 p_hire_date in date,
4155 p_asg_rec in out nocopy per_all_assignments_f%rowtype,
4156 p_person_id in per_all_people_f.person_id%TYPE,
4157 p_primary_assignment_id in number default null,
4158 p_person_type_id in number default null,
4159 p_overwrite_primary in varchar2 default 'N',
4160 p_per_object_version_number in out nocopy per_all_people_f.object_version_number%TYPE,
4161 p_per_effective_start_date out nocopy date,
4162 p_per_effective_end_date out nocopy date,
4163 p_unaccepted_asg_del_warning out nocopy boolean,
4164 p_assign_payroll_warning out nocopy boolean
4165 ,p_oversubscribed_vacancy_id out nocopy number
4166 ,p_called_from in varchar2
4167 )
4168 is
4169 --
4170 -- Declare cursors and local variables
4171 --
4172 l_proc varchar2(72) := g_package||'hire_employee_applicant';
4173 --
4174 l_exists varchar2(1);
4175 l_count number;
4176 l_chk_system_status per_assignment_status_types.per_system_status%TYPE;
4177 l_chk_person_id per_all_people_f.person_id%TYPE;
4178 --
4179 l_person_type_id number := p_person_type_id;
4180 l_person_type_id1 number;
4181 l_unaccepted_asg_del_warning boolean;
4182 --
4183 l_primary_assignment_id number:=p_primary_assignment_id;
4184 --
4185 l_system_person_type per_person_types.system_person_type%TYPE;
4186 l_business_group_id per_all_people_f.business_group_id%TYPE;
4187 l_legislation_code per_business_groups.legislation_code%TYPE;
4188 l_application_id per_applications.application_id%TYPE;
4189 l_apl_object_version_number per_applications.application_id%TYPE;
4190 --
4191 l_hire_date date;
4192 --
4193 l_per_system_status per_assignment_status_types.per_system_status%TYPE;
4194 l_assignment_id per_assignments_f.assignment_id%TYPE;
4195 l_asg_object_version_number per_assignments_f.object_version_number%TYPE;
4196 --
4197 l_per_object_version_number per_all_people_f.object_version_number%TYPE;
4198 l_ovn per_all_people_f.object_version_number%TYPE := p_per_object_version_number;
4199 l_employee_number per_all_people_f.employee_number%TYPE;
4200 l_applicant_number per_all_people_f.applicant_number%TYPE;
4201 l_npw_number per_all_people_f.npw_number%TYPE;
4202 l_per_effective_start_date per_all_people_f.effective_start_date%TYPE;
4203 l_per_effective_end_date per_all_people_f.effective_end_date%TYPE;
4204 l_comment_id per_assignments_f.comment_id%TYPE;
4205 l_current_applicant_flag varchar2(1);
4206 l_current_emp_or_apl_flag varchar2(1);
4207 l_current_employee_flag varchar2(1);
4208 l_full_name per_all_people_f.full_name%TYPE;
4209 l_name_combination_warning boolean;
4210 l_assign_payroll_warning boolean;
4211 l_orig_hire_warning boolean;
4212 l_oversubscribed_vacancy_id number;
4213 --Added for 5277866
4214 l_check_loop number:=0;
4215 --
4216 l_period_of_service_id per_periods_of_service.period_of_service_id%TYPE;
4217 l_pds_object_version_number per_periods_of_service.object_version_number%TYPE;
4218 --
4219 l_assignment_status_type_id per_assignments_f.assignment_status_type_id%TYPE;
4220 --
4221 l_primary_flag per_assignments_f.primary_flag%TYPE;
4222 --
4223 l_effective_start_date per_assignments_f.effective_start_date%TYPE;
4224 l_effective_end_date per_assignments_f.effective_end_date%TYPE;
4225 l_validation_start_date date;
4226 l_validation_end_date date;
4227 l_payroll_id_updated boolean;
4228 l_other_manager_warning boolean;
4229 l_no_managers_warning boolean;
4230 l_org_now_no_manager_warning boolean;
4231 l_hourly_salaried_warning boolean;
4232 l_datetrack_update_mode varchar2(30);
4233 --
4234 l_primary_asg_id per_all_assignments_f.assignment_id%type;
4235 l_primary_ovn per_all_assignments_f.object_version_number%type;
4236 l_dummy number;
4237 l_dummy1 number;
4238 l_dummy2 number;
4239 l_dummyv varchar2(700);
4240 l_dummyb boolean;
4241 -- 2788390 starts here
4242 l_dummynum1 number;
4243 -- 2788390 ends here
4244 --added as per bug 5102160
4245 l_gsp_post_process_warning varchar2(2000); -- bug2999562
4246 l_concatenated_segments hr_soft_coding_keyflex.concatenated_segments%TYPE;
4247 --
4248 L_ASG_STATUS_OVN1 number; --12905192
4249 l_change_reason varchar2(30); --12905192
4250 l_assignment_status_id number; --12905192
4251 --
4252 -- bug 10376122
4253 l_asg_status_id number;
4254 l_asg_status_ovn number;
4255 -- bug 10376122
4256 cursor csr_future_asg_changes is
4257 select 'x'
4258 from per_assignments_f asg
4259 where asg.person_id = p_person_id
4260 and asg.effective_start_date > p_hire_date;
4261
4262 -- ER FPT
4263 cursor fpt_future_asg_changes is
4264 select 'x'
4265 from per_all_assignments_f asg
4266 where asg.person_id = p_person_id
4267 and asg.effective_start_date >= p_hire_date
4268 and asg.assignment_type = 'E';
4269 --
4270 cursor csr_get_devived_details is
4271 select per.effective_start_date,
4272 ppt.system_person_type,
4273 per.business_group_id,
4274 bus.legislation_code,
4275 per.employee_number,
4276 per.npw_number,
4277 pap.application_id,
4278 pap.object_version_number
4279 from per_all_people_f per,
4280 per_business_groups bus,
4281 per_person_types ppt,
4282 per_applications pap
4283 where per.person_type_id = ppt.person_type_id
4284 and per.business_group_id = bus.business_group_id
4285 and per.person_id = pap.person_id
4286 and per.person_id = p_person_id
4287 and l_hire_date between per.effective_start_date
4288 and per.effective_end_date
4289 and l_hire_date between pap.date_received
4290 and nvl(pap.date_end,hr_api.g_eot);
4291 --
4292 cursor csr_chk_asg_status is
4293 select count(asg.assignment_id)
4294 from per_assignments_f asg,
4295 per_assignment_status_types pas
4296 where asg.assignment_status_type_id = pas.assignment_status_type_id
4297 and asg.person_id = p_person_id
4298 and pas.per_system_status = 'ACCEPTED'
4299 and l_hire_date between asg.effective_start_date
4300 and asg.effective_end_date;
4301 --
4302 cursor csr_chk_assignment_id is
4303 select per.person_id,
4304 pas.per_system_status
4305 from per_all_people_f per,
4306 per_assignments_f asg,
4307 per_assignment_status_types pas
4308 where asg.assignment_status_type_id = pas.assignment_status_type_id
4309 and per.person_id = asg.person_id
4310 and l_hire_date between per.effective_start_date
4311 and per.effective_end_date
4312 and asg.assignment_id = p_primary_assignment_id
4313 and l_hire_date between asg.effective_start_date
4314 and asg.effective_end_date;
4315 --
4316 cursor csr_get_un_accepted is
4317 select asg.assignment_id,
4318 asg.object_version_number
4319 from per_assignments_f asg,
4320 per_assignment_status_types pas
4321 where asg.assignment_status_type_id = pas.assignment_status_type_id
4322 and asg.person_id = p_person_id
4323 and asg.assignment_type='A'
4324 and l_hire_date between asg.effective_start_date
4325 and asg.effective_end_date
4326 and pas.per_system_status <> 'ACCEPTED'
4327 order by asg.assignment_id;
4328 --
4329 /*
4330 cursor csr_get_accepted is
4331 select asg.assignment_id,
4332 asg.object_version_number,
4333 asg.effective_start_date,
4334 asg.vacancy_id
4335 from per_assignments_f asg,
4336 per_assignment_status_types pas
4337 where asg.assignment_status_type_id = pas.assignment_status_type_id
4338 and asg.person_id = p_person_id
4339 and l_hire_date between asg.effective_start_date
4340 and asg.effective_end_date
4341 and pas.per_system_status = 'ACCEPTED'
4342 order by asg.assignment_id;
4343 */
4344 -- modified the above cursor for the bug 5534570
4345 /*
4346 In the below cursor we should not touch the other Accepted application which belong to
4347 this employee.applicant as per SSHR requirement. So added the extra selection criteria to
4348 pick only the application assignment which we are hiring.
4349 SSHR Enhancement(Bug # 8536819).
4350 */
4351 cursor csr_get_accepted is
4352 select asg.assignment_id,
4353 asg.object_version_number,
4354 asg.effective_start_date,
4355 asg.vacancy_id,
4356 asg.assignment_status_type_id -- 10376122
4357
4358 from per_assignments_f asg,
4359 per_assignment_status_types pas
4360 where asg.assignment_status_type_id = pas.assignment_status_type_id
4361 and asg.person_id = p_person_id
4362 and l_hire_date between asg.effective_start_date
4363 and asg.effective_end_date
4364 and pas.per_system_status = 'ACCEPTED'
4365 and asg.assignment_id = p_primary_assignment_id --- Added for SSHR Enhancement(Bug # 8536819).
4366 order by decode(asg.assignment_id,p_primary_assignment_id,1,0) desc;
4367 --
4368 --
4369 cursor get_primary is
4370 select assignment_id,object_version_number, period_of_service_id -- #2468916
4371 from per_all_assignments_f
4372 where person_id=p_person_id
4373 and primary_flag='Y'
4374 and l_hire_date between effective_start_date and effective_end_date
4375 and assignment_type='E';
4376 --
4377 cursor get_asg(p_assignment_id number) is
4378 select *
4379 from per_all_assignments_f asg
4380 where asg.assignment_id=p_assignment_id
4381 and l_hire_date between asg.effective_start_date
4382 and asg.effective_end_date;
4383 --
4384 l_asg_rec per_all_assignments_f%rowtype;
4385 l_primary_asg_rec per_all_assignments_f%rowtype;
4386 --
4387 cursor get_pgp(p_people_group_id number) is
4388 select *
4389 from pay_people_groups
4390 where people_group_id=p_people_group_id;
4391 --
4392 l_pgp_rec pay_people_groups%rowtype :=NULL;
4393 l_primary_pgp_rec pay_people_groups%rowtype;
4394 --
4395 cursor get_scl(p_soft_coding_keyflex_id number) is
4396 select *
4397 from hr_soft_coding_keyflex
4398 where soft_coding_keyflex_id=p_soft_coding_keyflex_id;
4399 --
4400 l_scl_rec hr_soft_coding_keyflex%rowtype :=NULL;
4401 l_primary_scl_rec hr_soft_coding_keyflex%rowtype :=NULL;
4402 --
4403 cursor get_cag(p_cagr_grade_def_id number) is
4404 select *
4405 from per_cagr_grades_def
4406 where cagr_grade_def_id=p_cagr_grade_def_id;
4407 --
4408 l_cag_rec per_cagr_grades_def%rowtype :=NULL;
4409 l_primary_cag_rec per_cagr_grades_def%rowtype;
4410 --
4411 cursor csr_vacs(p_vacancy_id number) is
4412 select 1
4413 from per_all_vacancies vac
4414 where vac.vacancy_id=p_vacancy_id
4415 and vac.number_of_openings <
4416 (select count(distinct assignment_id)
4417 from per_all_assignments_f asg
4418 where asg.vacancy_id=p_vacancy_id
4419 and asg.assignment_type='E');
4420 --
4421 -- Bug 4644830 Start
4422 cursor get_pay_proposal(ass_id per_all_assignments_f.assignment_id%type) is
4423 select pay_proposal_id,object_version_number,proposed_salary_n, change_date, proposal_reason -- Added For Bug 5987409 --
4424 from per_pay_proposals
4425 where assignment_id=ass_id
4426 and approved = 'N'
4427 order by change_date desc;
4428 l_pay_pspl_id per_pay_proposals.pay_proposal_id%TYPE;
4429 l_pay_obj_number per_pay_proposals.object_version_number%TYPE;
4430 l_proposed_sal_n per_pay_proposals.proposed_salary_n%TYPE;
4431 l_dummy_change_date per_pay_proposals.change_date%TYPE;
4432 l_inv_next_sal_date_warning boolean := false;
4433 l_proposed_salary_warning boolean := false;
4434 l_approved_warning boolean := false;
4435 l_payroll_warning boolean := false;
4436 l_proposal_reason per_pay_proposals.proposal_reason%TYPE; -- Added For Bug 5987409 --
4437 -- Bug 4644830 End
4438 --
4439 -- start of bug 4641965
4440 l_pspl_asg_id per_all_assignments_f.assignment_id%type;
4441 cursor get_primary_proposal(ass_id per_all_assignments_f.assignment_id%type) is
4442 select pay_proposal_id,object_version_number
4443 from per_pay_proposals
4444 where assignment_id=ass_id
4445 and APPROVED='N';
4446 -- end 4641965
4447
4448 --Bug 4959033 starts here
4449
4450 cursor get_business_group(p_asg_id number) is
4451 select distinct PAAF.business_group_id
4452 from per_all_assignments_f PAAF
4453 where PAAF.assignment_id=p_asg_id;
4454 l_bg_id number;
4455
4456 cursor get_primary_approved_proposal(ass_id per_all_assignments_f.assignment_id%type) is
4457 select pay_proposal_id
4458 from per_pay_proposals
4459 where assignment_id=ass_id
4460 and APPROVED='Y';
4461
4462 --Bug 4959033 ends here
4463 --
4464 --Bug 5102289 starts here
4465 l_pay_basis_id per_all_assignments_f.pay_basis_id%type;
4466 l_approved varchar2(10);
4467 cursor get_primary_pay_basis(p_asg_id number) is
4468 select PAAF.pay_basis_id
4469 from per_all_assignments_f PAAF
4470 where PAAF.assignment_id=p_asg_id;
4471 --Bug 5102289 ends here
4472 --
4473
4474 --- SSHR Enhancement (Bug # 8536819)---
4475 ---Cursor to find if there are any other applications other than the one
4476 ---into which we are hiring.
4477 cursor csr_get_all_appl_asgs is
4478 select 'X' from dual where exists
4479 ( select *
4480 from per_assignments_f asg,
4481 per_assignment_status_types pas
4482 where asg.assignment_status_type_id = pas.assignment_status_type_id
4483 and asg.person_id = p_person_id
4484 and asg.assignment_type='A'
4485 and l_hire_date between asg.effective_start_date
4486 and asg.effective_end_date
4487 and asg.assignment_id <> p_primary_assignment_id);
4488
4489 l_appl_count varchar2(1);
4490 l_appl_present boolean;
4491 ---- SSHR Enhancement (Bug # 8536819)----
4492
4493 --- Fix For Bug # 8844816 Starts ---
4494 cursor csr_existing_SCL (crs_asg_id number) is
4495 select soft_coding_keyflex_id,payroll_id
4496 from per_all_assignments_f asg
4497 where asg.assignment_id = crs_asg_id
4498 -- and asg.primary_flag = 'Y'
4499 and trunc(sysdate) between asg.effective_start_date
4500 and asg.effective_end_date;
4501 --and asg.soft_coding_keyflex_id = scl.soft_coding_keyflex_id;
4502
4503 cursor get_scl1 is
4504 select soft_coding_keyflex_id
4505 from hr_soft_coding_keyflex
4506 where rownum=1;
4507
4508 l_soft_coding_keyflex_id hr_soft_coding_keyflex.soft_coding_keyflex_id%type;
4509 l_payroll_id per_all_assignments_f.payroll_id%type;
4510 l_dummy_soft_coding_keyflex_id hr_soft_coding_keyflex.soft_coding_keyflex_id%type;
4511 --- Fix For Bug # 8844816 Ends ---
4512
4513 -- vb 10376122
4514 cursor csr_get_vacancy(p_asg_id number) is
4515 select vacancy_id,RECRUITER_ID
4516 from per_all_assignments_f
4517 where assignment_id = p_asg_id
4518 and l_hire_date between effective_start_date and effective_end_date;
4519
4520 cursor csr_get_asg_type_id (p_asg_id number)is
4521 select assignment_status_type_id
4522 from per_all_assignments_f
4523 where assignment_id = p_asg_id
4524 and l_hire_date between effective_start_date and effective_end_date;
4525
4526 l_aplasg_vacancy_id number ;
4527 l_aplasg_RECRUITER_ID number;
4528 l_asg_type_id number;
4529
4530 -- vb 10376122
4531
4532 -- ER FPT
4533 l_fpt_hire_flag varchar2(1) := 'N';
4534 l_apl_end_date date;
4535 l_current_apl_end_date date;
4536 l_cur_apl_id number;
4537 l_new_application_id number;
4538 l_yes_backtoback varchar2(1) := 'N';
4539
4540 cursor chk_future_changes(p_assignment_id number) is
4541 select 'Y' from per_all_assignments_f
4542 where person_id = p_person_id
4543 and assignment_id = p_assignment_id
4544 and effective_start_date >= p_hire_date;
4545
4546 cursor csr_get_apln_details(p_hire_date date) is
4547 select date_received,date_end
4548 from per_applications
4549 where person_id= p_person_id and date_received > p_hire_date;
4550
4551 cursor csr_back_toback_apln(p_date_end date) is
4552 select 'Y' from per_applications
4553 where person_id = p_person_id
4554 and date_received = p_date_end +1;
4555
4556 cursor fut_asg_rec is
4557 select assignment_id, effective_start_date, effective_end_date
4558 from per_all_assignments_f
4559 where person_id = p_person_id
4560 and assignment_type = 'A'
4561 and effective_start_date > l_hire_date
4562 and application_id = l_application_id
4563 order by effective_start_date;
4564
4565 cursor chk_apl_exists(p_asg_start_date date) is
4566 select application_id, date_end from per_applications
4567 where person_id = p_person_id
4568 and p_asg_start_date between date_received and nvl(date_end,hr_api.g_eot);
4569
4570 -- ER FPT
4571
4572
4573 begin
4574 hr_utility.set_location('Entering:'|| l_proc, 10);
4575 --
4576 hr_api.mandatory_arg_error
4577 (p_api_name => l_proc
4578 ,p_argument => 'person_id'
4579 ,p_argument_value => p_person_id
4580 );
4581 --
4582 hr_api.mandatory_arg_error
4583 (p_api_name => l_proc
4584 ,p_argument => 'hire_date'
4585 ,p_argument_value => p_hire_date
4586 );
4587 --
4588 -- Issue a savepoint.
4589 --
4590 savepoint hire_employee_applicant;
4591 --
4592 hr_utility.set_location(l_proc, 20);
4593 --
4594 -- Process Logic
4595 --
4596 -- Truncate the time portion from all date parameters
4597 -- which are passed in.
4598 --
4599 l_hire_date := trunc(p_hire_date);
4600 l_per_object_version_number:=p_per_object_version_number;
4601 --
4602 -- Call Before Process User Hook for hire_applicant
4603 --
4604 begin
4605 hr_employee_applicant_bk2.hire_employee_applicant_b
4606 (
4607 p_hire_date => l_hire_date,
4608 p_person_id => p_person_id,
4609 p_primary_assignment_id => p_primary_assignment_id,
4610 p_overwrite_primary => p_overwrite_primary,
4611 p_person_type_id => p_person_type_id,
4612 p_per_object_version_number => l_per_object_version_number
4613 );
4614 exception
4615 when hr_api.cannot_find_prog_unit then
4616 hr_api.cannot_find_prog_unit_error
4617 (p_module_name => 'HIRE_EMPLOYEE_APPLICANT'
4618 ,p_hook_type => 'BP'
4619 );
4620 --
4621 -- End of the before hook for hire_employee_applicant
4622 --
4623 end;
4624 --
4625 -- Check that there are not any future changes to the assignment
4626 --
4627 hr_utility.set_location(l_proc, 30);
4628 --
4629 -- ER FPT
4630 open csr_future_asg_changes;
4631 fetch csr_future_asg_changes into l_exists;
4632 if csr_future_asg_changes%FOUND then
4633 --
4634 hr_utility.set_location(l_proc,40);
4635 if (nvl(fnd_profile.value('HR_ALLOW_FPT_UPDATES'),'N') = 'Y') then
4636 open fpt_future_asg_changes;
4637 fetch fpt_future_asg_changes into l_exists;
4638 if fpt_future_asg_changes%found then
4639 hr_utility.set_message(801,'HR_7975_ASG_INV_FUTURE_ASA');
4640 hr_utility.raise_error;
4641 end if;
4642 close fpt_future_asg_changes;
4643 else
4644 hr_utility.set_message(801,'HR_7975_ASG_INV_FUTURE_ASA');
4645 hr_utility.raise_error;
4646 end if;
4647 end if;
4648 close csr_future_asg_changes;
4649 -- ER FPT
4650 --
4651 hr_utility.set_location(l_proc,45);
4652 --
4653 -- Get the derived details for the person DT instance
4654 --
4655 open csr_get_devived_details;
4656 fetch csr_get_devived_details
4657 into l_per_effective_start_date,
4658 l_system_person_type,
4659 l_business_group_id,
4660 l_legislation_code,
4661 l_employee_number,
4662 l_npw_number,
4663 l_application_id,
4664 l_apl_object_version_number;
4665 if csr_get_devived_details%NOTFOUND
4666 then
4667 --
4668 hr_utility.set_location(l_proc,50);
4669 --
4670 close csr_get_devived_details;
4671 --
4672 hr_utility.set_message(800,'PER_52097_APL_INV_PERSON_ID');
4673 hr_utility.raise_error;
4674 --
4675 end if;
4676 close csr_get_devived_details;
4677 --
4678 hr_utility.set_location(l_proc,55);
4679 --
4680 -- Validation in addition to Row Handlers
4681 --
4682 -- If the specified person type id is not null then check that it
4683 -- corresponds to type 'EMP', is currently active and is in the correct
4684 -- business group, otherwise set person type to the active default for EMP
4685 -- in the current business group.
4686 --
4687 per_per_bus.chk_person_type
4688 (p_person_type_id => l_person_type_id
4689 ,p_business_group_id => l_business_group_id
4690 ,p_expected_sys_type => 'EMP'
4691 );
4692 --
4693 hr_utility.set_location(l_proc,60);
4694 --
4695 -- Check that corresponding person is of 'EMP_APL'
4696 -- system person type.
4697 --
4698 if l_system_person_type <> 'EMP_APL'
4699 then
4700 --
4701 hr_utility.set_location(l_proc,70);
4702 --
4703 hr_utility.set_message(800,'PER_52096_APL_INV_PERSON_TYPE');
4704 hr_utility.raise_error;
4705 end if;
4706 --
4707 hr_utility.set_location(l_proc,80);
4708 --
4709 -- Check that corresponding person is of 'ACCEPTED' of
4710 -- assignment status type.
4711 --
4712 open csr_chk_asg_status;
4713 fetch csr_chk_asg_status into l_count;
4714 --close csr_chk_asg_status; -- Bug 3266844. Commented out.
4715 --
4716 if l_count = 0 then
4717 --
4718 hr_utility.set_location(l_proc,90);
4719 --
4720 close csr_chk_asg_status;
4721 --
4722 hr_utility.set_message(800,'PER_52098_APL_INV_ASG_STATUS');
4723 hr_utility.raise_error;
4724 --
4725 end if;
4726 --
4727 close csr_chk_asg_status; -- Bug 3266844. Added.
4728 -- If we are overwriting the primary, the new primary id
4729 -- must be not null.
4730 --
4731 if p_overwrite_primary='Y' then
4732 --
4733 hr_utility.set_location(l_proc,100);
4734 --
4735 hr_api.mandatory_arg_error
4736 (p_api_name => l_proc
4737 ,p_argument => 'assignment_id'
4738 ,p_argument_value => p_primary_assignment_id
4739 );
4740 --
4741 hr_utility.set_location(l_proc,110);
4742 else
4743 --the primary assignment id should be null
4744 l_primary_assignment_id:=null;
4745 hr_utility.set_location(l_proc,115);
4746 --
4747 end if;
4748 --
4749 hr_utility.set_location(l_proc,120);
4750 --
4751 -- Check p_assignment is corresponding data.
4752 -- The assignment record specified by P_ASSIGNMENT_ID on the hire
4753 -- date in the PER_ASSIGNMENTS_F table has assignment status
4754 -- 'ACCEPTED'.
4755 --
4756 if p_primary_assignment_id is not null then
4757 --
4758 hr_utility.set_location(l_proc,130);
4759 --
4760 open csr_chk_assignment_id;
4761 fetch csr_chk_assignment_id
4762 into l_chk_person_id,
4763 l_chk_system_status;
4764 if csr_chk_assignment_id%NOTFOUND then
4765 --
4766 hr_utility.set_location(l_proc,140);
4767 --
4768 close csr_chk_assignment_id;
4769 --
4770 hr_utility.set_message(800,'PER_52099_ASG_INV_ASG_ID');
4771 hr_utility.raise_error;
4772 --
4773 end if;
4774 --
4775 if l_chk_person_id <> p_person_id then
4776 --
4777 hr_utility.set_location(l_proc,150);
4778 --
4779 close csr_chk_assignment_id;
4780 --
4781 hr_utility.set_message(800,'PER_52101_ASG_INV_PER_ID_COMB');
4782 hr_utility.raise_error;
4783 --
4784 end if;
4785 --
4786 if l_chk_system_status <> 'ACCEPTED' then
4787 --
4788 hr_utility.set_location(l_proc,155);
4789 --
4790 close csr_chk_assignment_id;
4791 --
4792 hr_utility.set_message(800,'PER_52100_ASG_INV_PER_TYPE');
4793 hr_utility.raise_error;
4794 --
4795 end if;
4796 --
4797 hr_utility.set_location(l_proc,160);
4798 --
4799 close csr_chk_assignment_id;
4800 --
4801 end if;
4802 --
4803 hr_utility.set_location(l_proc,170);
4804 --
4805
4806 ------ SSHR Enhancement (Bug # 8536819)-------
4807 -- Check if there are any applications for the person other than the
4808 -- one into which we are hiring and set the value for item l_appl_present.
4809
4810 open csr_get_all_appl_asgs;
4811 fetch csr_get_all_appl_asgs into l_appl_count;
4812 if csr_get_all_appl_asgs%NOTFOUND then
4813 l_appl_present := FALSE;
4814 else
4815 l_appl_present := TRUE;
4816 end if;
4817 close csr_get_all_appl_asgs;
4818
4819 ------ SSHR Enhancement (Bug # 8536819)-------
4820
4821
4822
4823 -- Lock the person record in PER_ALL_PEOPLE_F ready for UPDATE at a later point.
4824 -- (Note: This is necessary because calling the table handlers in locking
4825 -- ladder order invokes an error in per_apl_upd.upd due to the person
4826 -- being modified by the per_per_upd.upd table handler.)
4827 if l_per_effective_start_date=l_hire_date then
4828 l_datetrack_update_mode:='CORRECTION';
4829 else
4830 l_datetrack_update_mode:='UPDATE';
4831 end if;
4832 --
4833 ------ SSHR Enhancement (Bug # 8536819)-------
4834 -- If there are no aaplication other than the one into which we are hiring
4835 -- then need to change the person_type. Added the below IF.
4836 if not l_appl_present then
4837 per_per_shd.lck
4838 (p_effective_date => l_hire_date
4839 ,p_datetrack_mode => l_datetrack_update_mode
4840 ,p_person_id => p_person_id
4841 ,p_object_version_number => l_per_object_version_number
4842 ,p_validation_start_date => l_validation_start_date
4843 ,p_validation_end_date => l_validation_end_date
4844 );
4845
4846 --
4847 hr_utility.set_location(l_proc,180);
4848 end if; -- SSHR Enhancement (Bug # 8536819).
4849 --
4850 -- Update the application details by calling the upd procedure in the
4851 -- application table handler:
4852 -- Date_end is set to l_hire_date - 1;
4853 --
4854
4855 ------ SSHR Enhancement (Bug # 8536819)-------
4856 -- If there are no aaplication other than the one into which we are hiring
4857 -- then need to close the application. Added the below IF.
4858 if not l_appl_present then
4859 per_apl_upd.upd
4860 (p_application_id => l_application_id
4861 ,p_date_end => l_hire_date - 1
4862 ,p_object_version_number => l_apl_object_version_number
4863 ,p_effective_date => l_hire_date-1
4864 ,p_validate => false
4865 );
4866 hr_utility.set_location(l_proc,190);
4867 end if; -- SSHR Enhancement (Bug # 8536819).
4868 --
4869 -- Set all unaccepted applicant assignments to have end date = p_hire_date -1
4870 -- by calling the del procedure in the PER_ASSIGNMENTS_F table handler
4871 -- (This is a datetrack DELETE mode operation)
4872 --
4873 --Commented the below cursor loop as it is not required to close the
4874 --unaccepted applications when hiring the employee.applicant in SSHR.
4875 --This is as per the enhancement requirements.(Bug # 8536819)
4876 /* ----------------------------------------------------------------------------- */
4877
4878 --12905192
4879
4880 l_change_reason:=fnd_profile.value('HR_APL_CHNG_REASON');
4881
4882 if l_change_reason is not null then
4883
4884 open csr_get_un_accepted;
4885 loop
4886 fetch csr_get_un_accepted
4887 into l_assignment_id,
4888 l_asg_object_version_number;
4889 exit when csr_get_un_accepted%NOTFOUND;
4890 --
4891 hr_utility.set_location(l_proc,200);
4892
4893 -- ER FPT
4894 open chk_future_changes(l_assignment_id);
4895 fetch chk_future_changes into l_exists;
4896 if chk_future_changes%found then
4897 close chk_future_changes;
4898 hr_utility.set_message(801,'HR_7975_ASG_INV_FUTURE_ASA');
4899 hr_utility.raise_error;
4900 end if;
4901 close chk_future_changes;
4902
4903 --
4904 per_asg_del.del
4905 (p_assignment_id => l_assignment_id
4906 ,p_effective_start_date => l_effective_start_date
4907 ,p_effective_end_date => l_effective_end_date
4908 ,p_business_group_id => l_business_group_id
4909 ,p_object_version_number => l_asg_object_version_number
4910 ,p_effective_date => l_hire_date-1
4911 ,p_validation_start_date => l_validation_start_date
4912 ,p_validation_end_date => l_validation_end_date
4913 ,p_datetrack_mode => 'DELETE'
4914 ,p_org_now_no_manager_warning => l_org_now_no_manager_warning
4915 );
4916 --
4917 hr_utility.set_location(l_proc,210);
4918 --
4919 per_people3_pkg.get_default_person_type
4920 (p_required_type => 'TERM_APL'
4921 ,p_business_group_id => l_business_group_id
4922 ,p_legislation_code => l_legislation_code
4923 ,p_person_type => l_assignment_status_type_id
4924 );
4925 hr_utility.set_location(l_proc,211);
4926
4927 IRC_ASG_STATUS_API.create_irc_asg_status
4928 (p_assignment_id => l_assignment_id
4929 , p_assignment_status_type_id => l_assignment_status_type_id
4930 , p_status_change_date => l_hire_date -- Fix for bug 6036285
4931 ,p_status_change_reason => l_change_reason --12905192
4932 , p_assignment_status_id => l_assignment_status_id
4933 , p_object_version_number => l_asg_status_ovn1);
4934
4935 IRC_OFFERS_API.close_offer
4936 ( p_validate => false
4937 ,p_effective_date => l_hire_date-1
4938 ,p_applicant_assignment_id => l_assignment_id
4939 ,p_change_reason => 'MANUAL_CLOSURE'
4940 );
4941 --
4942 end loop;
4943 --
4944 close csr_get_un_accepted;
4945 end if; --12905192
4946 -------------------------------------------------------------------------------*/
4947 --
4948 hr_utility.set_location(l_proc, 220);
4949
4950 -- PTU : Changes
4951
4952 l_person_type_id1 := hr_person_type_usage_info.get_default_person_type_id
4953 (l_business_group_id,
4954 'EMP');
4955 -- PTU : End of Changes
4956
4957 hr_utility.set_location(l_proc, 225);
4958
4959 --
4960 -- Update the person details by calling upd procedure in
4961 -- the per_all_people_f table.
4962 --
4963 l_applicant_number:=hr_api.g_varchar2;
4964 l_employee_number:=hr_api.g_varchar2;
4965
4966 ------ SSHR Enhancement (Bug # 8536819)-------
4967 -- If there are no aaplication other than the one into which we are hiring
4968 -- then need to change the person_type. Added the below IF.
4969 if not l_appl_present then
4970
4971 per_per_upd.upd
4972 (p_person_id => p_person_id
4973 ,p_effective_date => l_hire_date
4974 ,p_applicant_number => l_applicant_number
4975 ,p_employee_number => l_employee_number
4976 ,p_person_type_id => l_person_type_id1
4977 ,p_object_version_number => l_per_object_version_number
4978 ,p_datetrack_mode => l_datetrack_update_mode
4979 ,p_effective_start_date => l_per_effective_start_date
4980 ,p_effective_end_date => l_per_effective_end_date
4981 ,p_comment_id => l_comment_id
4982 ,p_current_applicant_flag => l_current_applicant_flag
4983 ,p_current_emp_or_apl_flag => l_current_emp_or_apl_flag
4984 ,p_current_employee_flag => l_current_employee_flag
4985 ,p_full_name => l_full_name
4986 ,p_name_combination_warning => l_name_combination_warning
4987 ,p_dob_null_warning => p_assign_payroll_warning
4988 ,p_orig_hire_warning => l_orig_hire_warning
4989 ,p_npw_number => l_npw_number
4990 );
4991 --
4992 hr_utility.set_location(l_proc,230);
4993
4994 -- PTU : Following Code has been added
4995 --
4996 hr_per_type_usage_internal.maintain_person_type_usage
4997 (p_effective_date => l_hire_date
4998 ,p_person_id => p_person_id
4999 ,p_person_type_id => l_person_type_id
5000 ,p_datetrack_update_mode => l_datetrack_update_mode
5001 );
5002 --
5003 l_person_type_id1 := hr_person_type_usage_info.get_default_person_type_id
5004 (l_business_group_id,
5005 'EX_APL');
5006 --
5007 hr_per_type_usage_internal.maintain_person_type_usage
5008 (p_effective_date => l_hire_date
5009 ,p_person_id => p_person_id
5010 ,p_person_type_id => l_person_type_id1
5011 ,p_datetrack_update_mode => l_datetrack_update_mode
5012 );
5013 --
5014 -- PTU : End of changes
5015
5016 end if; -- SSHR Enhancement.(Bug # 8536819)
5017
5018
5019 --
5020 -- All accepted applicant assignments are changed to employee assignments
5021 -- with default employee assignment.(ACTIVE_ASSIGN)
5022 -- 1) Derive assignment_status_type_id for default 'ACTIVE_ASSIGN'.
5023 -- 2) Update the assignments by calling the upd procedure in the
5024 -- PER_ASSIGNMENTS_F table handler(This is a datetrack UPDATE mode
5025 -- operation)
5026 -- 3) When the accepted assignments are multiple, the primary flag of the
5027 -- record not specified by P_ASSIGNMENT_ID is set to 'N'.
5028 --
5029 l_assignment_status_type_id :=''; --12905192
5030 per_asg_bus1.chk_assignment_status_type
5031 (p_assignment_status_type_id => l_assignment_status_type_id
5032 ,p_business_group_id => l_business_group_id
5033 ,p_legislation_code => l_legislation_code
5034 ,p_expected_system_status => 'ACTIVE_ASSIGN'
5035 );
5036 --
5037 hr_utility.set_location(l_proc,240);
5038 --
5039 l_oversubscribed_vacancy_id :=null;
5040
5041 --- Fix For Bug # 8844816 Starts ---
5042 open get_scl1;
5043 fetch get_scl1 into l_dummy_soft_coding_keyflex_id;
5044 close get_scl1;
5045
5046 open csr_existing_SCL(p_primary_assignment_id);
5047 fetch csr_existing_SCL into l_soft_coding_keyflex_id,l_payroll_id;
5048 close csr_existing_SCL;
5049
5050 -- 12970825 added l_legislation code condition.
5051 if l_soft_coding_keyflex_id is null and l_payroll_id is not null and l_legislation_code = 'US' then
5052 l_soft_coding_keyflex_id := l_dummy_soft_coding_keyflex_id;
5053 else
5054 l_soft_coding_keyflex_id := hr_api.g_number;
5055 end if;
5056 --- Fix For Bug # 8844816 Ends ---
5057
5058 --
5059 -- #2468916: Need to retrieve the period of service id
5060 open get_primary;
5061 fetch get_primary into l_primary_asg_id,l_primary_ovn, l_period_of_service_id;
5062 close get_primary;
5063 --
5064 for asg_rec in csr_get_accepted loop
5065 --
5066 hr_utility.set_location(l_proc,250);
5067
5068 -- ER FPT
5069 open chk_future_changes(asg_rec.assignment_id);
5070 fetch chk_future_changes into l_exists;
5071 if chk_future_changes%found then
5072 close chk_future_changes;
5073 hr_utility.set_message(801,'HR_7975_ASG_INV_FUTURE_ASA');
5074 hr_utility.raise_error;
5075 end if;
5076 close chk_future_changes;
5077 --
5078 if asg_rec.effective_start_date=l_hire_date then
5079 l_datetrack_update_mode:='CORRECTION';
5080 else
5081 l_datetrack_update_mode:='UPDATE';
5082 end if;
5083 --
5084 if asg_rec.assignment_id <> p_primary_assignment_id or p_overwrite_primary ='N' then
5085 --
5086 per_asg_upd.upd
5087 (p_assignment_id => asg_rec.assignment_id,
5088 p_object_version_number => asg_rec.object_version_number,
5089 p_effective_date => l_hire_date,
5090 p_datetrack_mode => l_datetrack_update_mode,
5091 p_assignment_status_type_id => l_assignment_status_type_id,
5092 p_assignment_type => 'E',
5093 p_primary_flag => 'N',
5094 p_period_of_service_id => l_period_of_service_id,
5095 --
5096 p_effective_start_date => l_effective_start_date,
5097 p_effective_end_date => l_effective_end_date,
5098 p_business_group_id => l_business_group_id,
5099 p_comment_id => l_comment_id,
5100 p_validation_start_date => l_validation_start_date,
5101 p_validation_end_date => l_validation_end_date,
5102 p_payroll_id_updated => l_payroll_id_updated,
5103 p_other_manager_warning => l_other_manager_warning,
5104 p_no_managers_warning => l_no_managers_warning,
5105 p_org_now_no_manager_warning => l_org_now_no_manager_warning,
5106 p_hourly_salaried_warning => l_hourly_salaried_warning,
5107 p_soft_coding_keyflex_id => l_soft_coding_keyflex_id --- Fix For Bug # 8844816
5108 );
5109 --
5110 hr_utility.set_location(l_proc,260);
5111 --The below has been commented as part of bug fix 5481530
5112 -- if asg_rec.assignment_id = p_primary_assignment_id then
5113 if asg_rec.assignment_id = l_primary_assignment_id then
5114 hr_assignment_api.set_new_primary_asg
5115 (p_validate => false
5116 ,p_effective_date => l_hire_date
5117 ,p_person_id => p_person_id
5118 ,p_assignment_id => asg_rec.assignment_id
5119 ,p_object_version_number => asg_rec.object_version_number
5120 ,p_effective_start_date => l_effective_start_date
5121 ,p_effective_end_date => l_effective_end_date
5122
5123
5124 );
5125 end if;
5126
5127
5128 -- added 10376122
5129 if asg_rec.vacancy_id is not null then --fix for bug8488222
5130 IRC_ASG_STATUS_API.create_irc_asg_status
5131 (p_assignment_id => asg_rec.assignment_id
5132 ,p_assignment_status_type_id => asg_rec.assignment_status_type_id
5133 ,p_status_change_date => l_hire_date
5134 ,p_assignment_status_id => l_asg_status_id
5135 ,p_object_version_number => l_asg_status_ovn);
5136 end if;
5137 -- End of fix 3564129
5138 -- Start of fix 7289811
5139 IRC_OFFERS_API.close_offer
5140 ( p_validate => false
5141 ,p_effective_date => l_hire_date-1
5142 ,p_applicant_assignment_id => asg_rec.assignment_id
5143 ,p_change_reason => 'APL_HIRED'-- Fix for bug 7540870
5144 );
5145 -- added 10376122
5146
5147
5148
5149
5150 -- Bug 4644830 Start
5151 OPEN get_pay_proposal(asg_rec.assignment_id);
5152 FETCH get_pay_proposal INTO l_pay_pspl_id,l_pay_obj_number,l_proposed_sal_n, l_dummy_change_date,l_proposal_reason; --Added Proposal_Reason for Bug # 5987409 --
5153 if get_pay_proposal%found then
5154 close get_pay_proposal;
5155 hr_maintain_proposal_api.cre_or_upd_salary_proposal(
5156 p_validate => false,
5157 p_pay_proposal_id => l_pay_pspl_id ,
5158 p_object_version_number => l_pay_obj_number,
5159 p_change_date => p_hire_date,
5160 p_approved => 'Y',
5161 p_inv_next_sal_date_warning => l_inv_next_sal_date_warning,
5162 p_proposed_salary_warning => l_proposed_salary_warning,
5163 p_approved_warning => l_approved_warning,
5164 p_payroll_warning => l_payroll_warning,
5165 p_proposed_salary_n => l_proposed_sal_n,
5166 p_business_group_id => l_business_group_id,
5167 p_proposal_reason => l_proposal_reason);
5168
5169 else
5170 close get_pay_proposal;
5171 end if;
5172 -- Bug 4644830 End
5173 -- Bug 4630129 Starts
5174
5175 elsif asg_rec.assignment_id = p_primary_assignment_id and p_overwrite_primary ='Y' then
5176
5177
5178 -- Hire the new secondary Applicant assignment.
5179 hr_utility.set_location(l_proc,261);
5180 per_asg_upd.upd
5181 (p_assignment_id => asg_rec.assignment_id,
5182 p_object_version_number => asg_rec.object_version_number,
5183 p_effective_date => l_hire_date,
5184 p_datetrack_mode => l_datetrack_update_mode,
5185 p_assignment_status_type_id => l_assignment_status_type_id,
5186 p_assignment_type => 'E',
5187 p_primary_flag => 'N',
5188 p_period_of_service_id => l_period_of_service_id,
5189 --
5190 p_effective_start_date => l_effective_start_date,
5191 p_effective_end_date => l_effective_end_date,
5192 p_business_group_id => l_business_group_id,
5193 p_comment_id => l_comment_id,
5194 p_validation_start_date => l_validation_start_date,
5195 p_validation_end_date => l_validation_end_date,
5196 p_payroll_id_updated => l_payroll_id_updated,
5197 p_other_manager_warning => l_other_manager_warning,
5198 p_no_managers_warning => l_no_managers_warning,
5199 p_org_now_no_manager_warning => l_org_now_no_manager_warning,
5200 p_hourly_salaried_warning => l_hourly_salaried_warning,
5201 p_soft_coding_keyflex_id => l_soft_coding_keyflex_id --- Fix For Bug # 8844816
5202 );
5203 -- Make the new secondary Applicant assignment Primary.
5204 hr_utility.set_location(l_proc,262);
5205 hr_assignment_api.set_new_primary_asg
5206 (p_validate => false
5207 ,p_effective_date => l_hire_date
5208 ,p_person_id => p_person_id
5209 ,p_assignment_id => asg_rec.assignment_id
5210 ,p_object_version_number => asg_rec.object_version_number
5211 ,p_effective_start_date => l_effective_start_date
5212 ,p_effective_end_date => l_effective_end_date
5213 );
5214 hr_utility.set_location(l_proc,263);
5215
5216
5217 -- added 10376122
5218 if asg_rec.vacancy_id is not null then --fix for bug8488222
5219 IRC_ASG_STATUS_API.create_irc_asg_status
5220 (p_assignment_id => asg_rec.assignment_id
5221 ,p_assignment_status_type_id => asg_rec.assignment_status_type_id
5222 ,p_status_change_date => l_hire_date
5223 ,p_assignment_status_id => l_asg_status_id
5224 ,p_object_version_number => l_asg_status_ovn);
5225 end if;
5226 -- End of fix 3564129
5227 -- Start of fix 7289811
5228 IRC_OFFERS_API.close_offer
5229 ( p_validate => false
5230 ,p_effective_date => l_hire_date-1
5231 ,p_applicant_assignment_id => asg_rec.assignment_id
5232 ,p_change_reason => 'APL_HIRED'-- Fix for bug 7540870
5233 );
5234 -- added 10376122
5235
5236 -- Bug 4630129 Ends
5237 -- Bug 4644830 Start
5238 OPEN get_pay_proposal(asg_rec.assignment_id);
5239 FETCH get_pay_proposal INTO l_pay_pspl_id,l_pay_obj_number,l_proposed_sal_n, l_dummy_change_date,l_proposal_reason; --Added Proposal_Reason for Bug # 5987409 --
5240 if get_pay_proposal%found then
5241 close get_pay_proposal;
5242 hr_maintain_proposal_api.cre_or_upd_salary_proposal(
5243 p_validate => false,
5244 p_pay_proposal_id => l_pay_pspl_id ,
5245 p_object_version_number => l_pay_obj_number,
5246 p_change_date => p_hire_date,
5247 p_approved => 'Y',
5248 p_inv_next_sal_date_warning => l_inv_next_sal_date_warning,
5249 p_proposed_salary_warning => l_proposed_salary_warning,
5250 p_approved_warning => l_approved_warning,
5251 p_payroll_warning => l_payroll_warning,
5252 p_proposed_salary_n => l_proposed_sal_n,
5253 p_business_group_id => l_business_group_id,
5254 p_proposal_reason => l_proposal_reason);
5255
5256 else
5257 close get_pay_proposal;
5258 end if;
5259 -- Bug 4644830 End
5260
5261 -- fix for the bug 4777901 starts here
5262
5263 elsif p_overwrite_primary ='W' then
5264 --
5265 -- bug 5024006 fix starts here
5266 --
5267
5268 hr_utility.set_location('p_asg_rec.vacany_id'||p_asg_rec.vacancy_id,100);
5269 hr_utility.set_location('p_asg_rec.assignment_id'||p_asg_rec.assignment_id,100);
5270
5271 if l_check_loop=0 then
5272
5273 open get_primary;
5274 fetch get_primary into l_primary_asg_id,l_primary_ovn, l_period_of_service_id; -- #2468916
5275 close get_primary;
5276 --
5277 hr_utility.set_location(l_proc, 264);
5278 --
5279 if p_asg_rec.assignment_id is not null then
5280 l_asg_rec := p_asg_rec;
5281 hr_utility.set_location('inside if overwrite'||p_asg_rec.assignment_id,100);
5282
5283 -- vb 10376122
5284
5285 open csr_get_vacancy(p_asg_rec.assignment_id);
5286 fetch csr_get_vacancy into l_aplasg_vacancy_id,l_aplasg_RECRUITER_ID;
5287 close csr_get_vacancy;
5288
5289 -- vb 10376122
5290
5291 else
5292 open get_asg(asg_rec.assignment_id);
5293 fetch get_asg into l_asg_rec;
5294 close get_asg;
5295 hr_utility.set_location('inside else overwrite'||l_asg_rec.assignment_id,100);
5296 end if;
5297
5298
5299 hr_utility.set_location('1_asg_rec.vacany_id'||l_asg_rec.vacancy_id,121);
5300 hr_utility.set_location('l_asg_rec.assignment_id'||l_asg_rec.assignment_id,121);
5301
5302 hr_utility.set_location('p_asg_rec.vacany_id'||p_asg_rec.vacancy_id,110);
5303 hr_utility.set_location('p_asg_rec.assignment_id'||p_asg_rec.assignment_id,110);
5304
5305 ---changes for 4959033 starts here
5306 open get_primary_approved_proposal(l_primary_asg_id);
5307 fetch get_primary_approved_proposal into l_pay_pspl_id;
5308
5309 if get_primary_approved_proposal%found then
5310 close get_primary_approved_proposal;
5311
5312 if l_asg_rec.pay_basis_id is null then
5313 hr_utility.set_message(800,'HR_289767_SALARY_BASIS_IS_NULL');
5314 hr_utility.raise_error;
5315 end if;
5316 --Added else to close the cursor--5277866
5317 else
5318 close get_primary_approved_proposal;
5319 end if;
5320 ---changes for 4959033 ends here
5321
5322 if l_asg_rec.people_group_id is not null then
5323 --
5324 hr_utility.set_location(l_proc, 265);
5325 --
5326 open get_pgp(l_asg_rec.people_group_id);
5327 fetch get_pgp into l_pgp_rec;
5328 close get_pgp;
5329
5330 end if;
5331
5332 if l_asg_rec.soft_coding_keyflex_id is not null then
5333 --
5334 hr_utility.set_location(l_proc, 266);
5335 --
5336 open get_scl(l_asg_rec.soft_coding_keyflex_id);
5337 fetch get_scl into l_scl_rec;
5338 close get_scl;
5339
5340 end if;
5341 --
5342 if l_asg_rec.cagr_grade_def_id is not null then
5343 --
5344 hr_utility.set_location(l_proc, 267);
5345 --
5346 open get_cag(l_asg_rec.cagr_grade_def_id);
5347 fetch get_cag into l_cag_rec;
5348 close get_cag;
5349 end if;
5350 --
5351
5352 hr_utility.set_location(l_proc, 268);
5353 --
5354
5355 --The below call has been commented as per bug 5102160
5356 -- soft_coding_keyflex_id is passed by calling the new update_emp_asg_criteria procedure
5357
5358 /*hr_assignment_api.update_emp_asg_criteria
5359 (p_validate => FALSE
5360 ,p_effective_date => l_hire_date
5361 ,p_datetrack_update_mode => l_datetrack_update_mode
5362 ,p_assignment_id => l_primary_asg_id
5363 ,p_object_version_number => l_primary_ovn
5364 ,p_grade_id => l_asg_rec.grade_id
5365 ,p_position_id => l_asg_rec.position_id
5366 ,p_job_id => l_asg_rec.job_id
5367 ,p_payroll_id => l_asg_rec.payroll_id
5368 ,p_location_id => l_asg_rec.location_id
5369 ,p_special_ceiling_step_id => l_asg_rec.special_ceiling_step_id
5370 ,p_organization_id => l_asg_rec.organization_id
5371 ,p_pay_basis_id => l_asg_rec.pay_basis_id
5372 ,p_employment_category => l_asg_rec.employment_category
5373 ,p_segment1 => l_pgp_rec.segment1
5374 ,p_segment2 => l_pgp_rec.segment2
5375 ,p_segment3 => l_pgp_rec.segment3
5376 ,p_segment4 => l_pgp_rec.segment4
5377 ,p_segment5 => l_pgp_rec.segment5
5378 ,p_segment6 => l_pgp_rec.segment6
5379 ,p_segment7 => l_pgp_rec.segment7
5380 ,p_segment8 => l_pgp_rec.segment8
5381 ,p_segment9 => l_pgp_rec.segment9
5382 ,p_segment10 => l_pgp_rec.segment10
5383 ,p_segment11 => l_pgp_rec.segment11
5384 ,p_segment12 => l_pgp_rec.segment12
5385 ,p_segment13 => l_pgp_rec.segment13
5386 ,p_segment14 => l_pgp_rec.segment14
5387 ,p_segment15 => l_pgp_rec.segment15
5388 ,p_segment16 => l_pgp_rec.segment16
5389 ,p_segment17 => l_pgp_rec.segment17
5390 ,p_segment18 => l_pgp_rec.segment18
5391 ,p_segment19 => l_pgp_rec.segment19
5392 ,p_segment20 => l_pgp_rec.segment20
5393 ,p_segment21 => l_pgp_rec.segment21
5394 ,p_segment22 => l_pgp_rec.segment22
5395 ,p_segment23 => l_pgp_rec.segment23
5396 ,p_segment24 => l_pgp_rec.segment24
5397 ,p_segment25 => l_pgp_rec.segment25
5398 ,p_segment26 => l_pgp_rec.segment26
5399 ,p_segment27 => l_pgp_rec.segment27
5400 ,p_segment28 => l_pgp_rec.segment28
5401 ,p_segment29 => l_pgp_rec.segment29
5402 ,p_segment30 => l_pgp_rec.segment30
5403 ,p_group_name => l_dummyv
5404 ,p_effective_start_date => l_effective_start_date
5405 ,p_effective_end_date => l_effective_end_date
5406 ,p_people_group_id => l_dummy
5407 ,p_org_now_no_manager_warning => l_dummyb
5408 ,p_other_manager_warning => l_dummyb
5409 ,p_spp_delete_warning => l_dummyb
5410 ,p_entries_changed_warning => l_dummyv
5411 ,p_tax_district_changed_warning => l_dummyb
5412 );*/
5413
5414 hr_assignment_api.update_emp_asg_criteria
5415 (p_validate => FALSE
5416 ,p_effective_date => l_hire_date
5417 ,p_datetrack_update_mode => l_datetrack_update_mode
5418 ,p_assignment_id => l_primary_asg_id
5419 ,p_object_version_number => l_primary_ovn
5420 ,p_grade_id => l_asg_rec.grade_id
5421 ,p_position_id => l_asg_rec.position_id
5422 ,p_job_id => l_asg_rec.job_id
5423 ,p_payroll_id => l_asg_rec.payroll_id
5424 ,p_location_id => l_asg_rec.location_id
5425 ,p_special_ceiling_step_id => l_asg_rec.special_ceiling_step_id
5426 ,p_organization_id => l_asg_rec.organization_id
5427 ,p_pay_basis_id => l_asg_rec.pay_basis_id
5428 ,p_supervisor_assignment_id => l_asg_rec.supervisor_assignment_id -- 13595937
5429 ,p_segment1 => l_pgp_rec.segment1
5430 ,p_segment2 => l_pgp_rec.segment2
5431 ,p_segment3 => l_pgp_rec.segment3
5432 ,p_segment4 => l_pgp_rec.segment4
5433 ,p_segment5 => l_pgp_rec.segment5
5434 ,p_segment6 => l_pgp_rec.segment6
5435 ,p_segment7 => l_pgp_rec.segment7
5436 ,p_segment8 => l_pgp_rec.segment8
5437 ,p_segment9 => l_pgp_rec.segment9
5438 ,p_segment10 => l_pgp_rec.segment10
5439 ,p_segment11 => l_pgp_rec.segment11
5440 ,p_segment12 => l_pgp_rec.segment12
5441 ,p_segment13 => l_pgp_rec.segment13
5442 ,p_segment14 => l_pgp_rec.segment14
5443 ,p_segment15 => l_pgp_rec.segment15
5444 ,p_segment16 => l_pgp_rec.segment16
5445 ,p_segment17 => l_pgp_rec.segment17
5446 ,p_segment18 => l_pgp_rec.segment18
5447 ,p_segment19 => l_pgp_rec.segment19
5448 ,p_segment20 => l_pgp_rec.segment20
5449 ,p_segment21 => l_pgp_rec.segment21
5450 ,p_segment22 => l_pgp_rec.segment22
5451 ,p_segment23 => l_pgp_rec.segment23
5452 ,p_segment24 => l_pgp_rec.segment24
5453 ,p_segment25 => l_pgp_rec.segment25
5454 ,p_segment26 => l_pgp_rec.segment26
5455 ,p_segment27 => l_pgp_rec.segment27
5456 ,p_segment28 => l_pgp_rec.segment28
5457 ,p_segment29 => l_pgp_rec.segment29
5458 ,p_segment30 => l_pgp_rec.segment30
5459 ,p_employment_category => l_asg_rec.employment_category
5460 ,p_people_group_id => l_dummy
5461 ,p_soft_coding_keyflex_id => l_asg_rec.soft_coding_keyflex_id
5462 ,p_group_name => l_dummyv
5463 ,p_effective_start_date => l_effective_start_date
5464 ,p_effective_end_date => l_effective_end_date
5465 ,p_org_now_no_manager_warning => l_dummyb
5466 ,p_other_manager_warning => l_dummyb
5467 ,p_spp_delete_warning => l_dummyb
5468 ,p_entries_changed_warning => l_dummyv
5469 ,p_tax_district_changed_warning => l_dummyb
5470 ,p_concatenated_segments => l_concatenated_segments
5471 ,p_gsp_post_process_warning => l_gsp_post_process_warning -- bug 2999562
5472 );
5473
5474 --
5475 hr_utility.set_location(l_proc, 269);
5476 --
5477 hr_assignment_api.update_emp_asg
5478 (p_validate => FALSE
5479 ,p_effective_date => l_hire_date
5480 ,p_datetrack_update_mode => 'CORRECTION'
5481 ,p_assignment_id => l_primary_asg_id
5482 ,p_object_version_number => l_primary_ovn
5483 ,p_supervisor_id => l_asg_rec.supervisor_id
5484 ,p_assignment_number => l_asg_rec.assignment_number
5485 ,p_change_reason => l_asg_rec.change_reason
5486 ,p_date_probation_end => l_asg_rec.date_probation_end
5487 ,p_default_code_comb_id => l_asg_rec.default_code_comb_id
5488 ,p_frequency => l_asg_rec.frequency
5489 ,p_internal_address_line => l_asg_rec.internal_address_line
5490 ,p_manager_flag => l_asg_rec.manager_flag
5491 ,p_normal_hours => l_asg_rec.normal_hours
5492 ,p_perf_review_period => l_asg_rec.perf_review_period
5493 ,p_perf_review_period_frequency => l_asg_rec.perf_review_period_frequency
5494 ,p_probation_period => l_asg_rec.probation_period
5495 ,p_probation_unit => l_asg_rec.probation_unit
5496 ,p_sal_review_period => l_asg_rec.sal_review_period
5497 ,p_sal_review_period_frequency => l_asg_rec.sal_review_period_frequency
5498 ,p_set_of_books_id => l_asg_rec.set_of_books_id
5499 ,p_source_type => l_asg_rec.source_type
5500 ,p_time_normal_finish => l_asg_rec.time_normal_finish
5501 ,p_time_normal_start => l_asg_rec.time_normal_start
5502 ,p_bargaining_unit_code => l_asg_rec.bargaining_unit_code
5503 ,p_labour_union_member_flag => l_asg_rec.labour_union_member_flag
5504 ,p_hourly_salaried_code => l_asg_rec.hourly_salaried_code
5505 ,p_ass_attribute_category => l_asg_rec.ass_attribute_category
5506 ,p_ass_attribute1 => l_asg_rec.ass_attribute1
5507 ,p_ass_attribute2 => l_asg_rec.ass_attribute2
5508 ,p_ass_attribute3 => l_asg_rec.ass_attribute3
5509 ,p_ass_attribute4 => l_asg_rec.ass_attribute4
5510 ,p_ass_attribute5 => l_asg_rec.ass_attribute5
5511 ,p_ass_attribute6 => l_asg_rec.ass_attribute6
5512 ,p_ass_attribute7 => l_asg_rec.ass_attribute7
5513 ,p_ass_attribute8 => l_asg_rec.ass_attribute8
5514 ,p_ass_attribute9 => l_asg_rec.ass_attribute9
5515 ,p_ass_attribute10 => l_asg_rec.ass_attribute10
5516 ,p_ass_attribute11 => l_asg_rec.ass_attribute11
5517 ,p_ass_attribute12 => l_asg_rec.ass_attribute12
5518 ,p_ass_attribute13 => l_asg_rec.ass_attribute13
5519 ,p_ass_attribute14 => l_asg_rec.ass_attribute14
5520 ,p_ass_attribute15 => l_asg_rec.ass_attribute15
5521 ,p_ass_attribute16 => l_asg_rec.ass_attribute16
5522 ,p_ass_attribute17 => l_asg_rec.ass_attribute17
5523 ,p_ass_attribute18 => l_asg_rec.ass_attribute18
5524 ,p_ass_attribute19 => l_asg_rec.ass_attribute19
5525 ,p_ass_attribute20 => l_asg_rec.ass_attribute20
5526 ,p_ass_attribute21 => l_asg_rec.ass_attribute21
5527 ,p_ass_attribute22 => l_asg_rec.ass_attribute22
5528 ,p_ass_attribute23 => l_asg_rec.ass_attribute23
5529 ,p_ass_attribute24 => l_asg_rec.ass_attribute24
5530 ,p_ass_attribute25 => l_asg_rec.ass_attribute25
5531 ,p_ass_attribute26 => l_asg_rec.ass_attribute26
5532 ,p_ass_attribute27 => l_asg_rec.ass_attribute27
5533 ,p_ass_attribute28 => l_asg_rec.ass_attribute28
5534 ,p_ass_attribute29 => l_asg_rec.ass_attribute29
5535 ,p_ass_attribute30 => l_asg_rec.ass_attribute30
5536 ,p_segment1 => l_scl_rec.segment1
5537 ,p_segment2 => l_scl_rec.segment2
5538 ,p_segment3 => l_scl_rec.segment3
5539 ,p_segment4 => l_scl_rec.segment4
5540 ,p_segment5 => l_scl_rec.segment5
5541 ,p_segment6 => l_scl_rec.segment6
5542 ,p_segment7 => l_scl_rec.segment7
5543 ,p_segment8 => l_scl_rec.segment8
5544 ,p_segment9 => l_scl_rec.segment9
5545 ,p_segment10 => l_scl_rec.segment10
5546 ,p_segment11 => l_scl_rec.segment11
5547 ,p_segment12 => l_scl_rec.segment12
5548 ,p_segment13 => l_scl_rec.segment13
5549 ,p_segment14 => l_scl_rec.segment14
5550 ,p_segment15 => l_scl_rec.segment15
5551 ,p_segment16 => l_scl_rec.segment16
5552 ,p_segment17 => l_scl_rec.segment17
5553 ,p_segment18 => l_scl_rec.segment18
5554 ,p_segment19 => l_scl_rec.segment19
5555 ,p_segment20 => l_scl_rec.segment20
5556 ,p_segment21 => l_scl_rec.segment21
5557 ,p_segment22 => l_scl_rec.segment22
5558 ,p_segment23 => l_scl_rec.segment23
5559 ,p_segment24 => l_scl_rec.segment24
5560 ,p_segment25 => l_scl_rec.segment25
5561 ,p_segment26 => l_scl_rec.segment26
5562 ,p_segment27 => l_scl_rec.segment27
5563 ,p_segment28 => l_scl_rec.segment28
5564 ,p_segment29 => l_scl_rec.segment29
5565 ,p_segment30 => l_scl_rec.segment30
5566 ,p_contract_id => l_asg_rec.contract_id
5567 ,p_establishment_id => l_asg_rec.establishment_id
5568 ,p_collective_agreement_id => l_asg_rec.collective_agreement_id
5569 ,p_cagr_id_flex_num => l_asg_rec.cagr_id_flex_num
5570 ,p_cag_segment1 => l_cag_rec.segment1
5571 ,p_cag_segment2 => l_cag_rec.segment2
5572 ,p_cag_segment3 => l_cag_rec.segment3
5573 ,p_cag_segment4 => l_cag_rec.segment4
5574 ,p_cag_segment5 => l_cag_rec.segment5
5575 ,p_cag_segment6 => l_cag_rec.segment6
5576 ,p_cag_segment7 => l_cag_rec.segment7
5577 ,p_cag_segment8 => l_cag_rec.segment8
5578 ,p_cag_segment9 => l_cag_rec.segment9
5579 ,p_cag_segment10 => l_cag_rec.segment10
5580 ,p_cag_segment11 => l_cag_rec.segment11
5581 ,p_cag_segment12 => l_cag_rec.segment12
5582 ,p_cag_segment13 => l_cag_rec.segment13
5583 ,p_cag_segment14 => l_cag_rec.segment14
5584 ,p_cag_segment15 => l_cag_rec.segment15
5585 ,p_cag_segment16 => l_cag_rec.segment16
5586 ,p_cag_segment17 => l_cag_rec.segment17
5587 ,p_cag_segment18 => l_cag_rec.segment18
5588 ,p_cag_segment19 => l_cag_rec.segment19
5589 ,p_cag_segment20 => l_cag_rec.segment20
5590 ,p_notice_period => l_asg_rec.notice_period
5591 ,p_notice_period_uom => l_asg_rec.notice_period_uom
5592 ,p_employee_category => l_asg_rec.employee_category
5593 ,p_work_at_home => l_asg_rec.work_at_home
5594 ,p_job_post_source_name => l_asg_rec.job_post_source_name
5595 ,p_cagr_grade_def_id => l_dummynum1 -- Bug # 2788390 modified l_dummy to l_dummynum1.
5596 ,p_cagr_concatenated_segments => l_dummyv
5597 ,p_concatenated_segments => l_dummyv
5598 ,p_soft_coding_keyflex_id => l_dummy1
5599 ,p_comment_id => l_dummy2
5600 ,p_effective_start_date => l_effective_start_date
5601 ,p_effective_end_date => l_effective_end_date
5602 ,p_no_managers_warning => l_dummyb
5603 ,p_other_manager_warning => l_dummyb
5604 ,p_hourly_salaried_warning => l_dummyb
5605 );
5606 --
5607 hr_utility.set_location(l_proc, 271);
5608
5609 --Fix For Bug # 5987409 Starts -----
5610
5611
5612 hr_utility.set_location('1_asg_rec.vacany_id'||l_asg_rec.vacancy_id,103);
5613 hr_utility.set_location('l_asg_rec.assignment_id'||l_asg_rec.assignment_id,103);
5614
5615 /*
5616 UPDATE PER_ASSIGNMENTS_F PAF SET PAF.VACANCY_ID =l_asg_rec.vacancy_id ,
5617 PAF.RECRUITER_ID =l_asg_rec.recruiter_id
5618 WHERE PAF.ASSIGNMENT_ID = l_primary_asg_id AND
5619 PAF.EFFECTIVE_START_DATE = l_effective_start_date AND
5620 PAF.EFFECTIVE_END_DATE = l_effective_end_date;
5621 */
5622 -- vb 10376122
5623 UPDATE PER_ASSIGNMENTS_F PAF SET PAF.VACANCY_ID =l_aplasg_vacancy_id ,
5624 PAF.RECRUITER_ID = l_aplasg_RECRUITER_ID
5625 WHERE PAF.ASSIGNMENT_ID = l_primary_asg_id AND
5626 PAF.EFFECTIVE_START_DATE = l_effective_start_date AND
5627 PAF.EFFECTIVE_END_DATE = l_effective_end_date;
5628
5629 open csr_get_asg_type_id(l_primary_asg_id);
5630 fetch csr_get_asg_type_id into l_asg_type_id;
5631 close csr_get_asg_type_id;
5632
5633 -- vb 10376122
5634
5635
5636 --Fix For Bug # 5987409 Starts -----
5637 -- 10376122 -- new
5638 if l_aplasg_vacancy_id is not null then --fix for bug8488222
5639
5640 hr_utility.set_location('1_asg_rec.vacany_id'||l_asg_rec.vacancy_id,104);
5641 hr_utility.set_location('l_asg_rec.assignment_id'||l_asg_rec.assignment_id,105);
5642
5643 IRC_ASG_STATUS_API.create_irc_asg_status
5644 (p_assignment_id => l_primary_asg_id
5645 ,p_assignment_status_type_id => l_asg_type_id
5646 ,p_status_change_date => l_hire_date
5647 ,p_assignment_status_id => l_asg_status_id
5648 ,p_object_version_number => l_asg_status_ovn);
5649 end if;
5650 -- End of fix 3564129
5651 -- Start of fix 7289811
5652 IRC_OFFERS_API.close_offer
5653 ( p_validate => false
5654 ,p_effective_date => l_hire_date-1
5655 ,p_applicant_assignment_id => l_asg_rec.assignment_id
5656 ,p_change_reason => 'APL_HIRED'-- Fix for bug 7540870
5657 );
5658 -- 10376122 -- new
5659 --
5660 -- now end date the application
5661 --
5662 per_asg_del.del
5663 (p_assignment_id => l_asg_rec.assignment_id
5664 ,p_effective_start_date => l_effective_start_date
5665 ,p_effective_end_date => l_effective_end_date
5666 ,p_business_group_id => l_business_group_id
5667 ,p_object_version_number => l_asg_rec.object_version_number
5668 ,p_effective_date => l_hire_date-1
5669 ,p_validation_start_date => l_validation_start_date
5670 ,p_validation_end_date => l_validation_end_date
5671 ,p_datetrack_mode => 'DELETE'
5672 ,p_org_now_no_manager_warning => l_org_now_no_manager_warning
5673 );
5674 --
5675 hr_utility.set_location(l_proc, 272);
5676 --
5677 --
5678 /*
5679 l_change_reason:=fnd_profile.value('HR_APL_CHNG_REASON'); -- 12905192
5680 if l_change_reason is not null then
5681
5682 per_people3_pkg.get_default_person_type
5683 (p_required_type => 'TERM_APL'
5684 ,p_business_group_id => l_business_group_id
5685 ,p_legislation_code => l_legislation_code
5686 ,p_person_type => l_assignment_status_type_id
5687 );
5688
5689
5690 IRC_ASG_STATUS_API.create_irc_asg_status
5691 (p_assignment_id => l_asg_rec.assignment_id
5692 , p_assignment_status_type_id => l_assignment_status_type_id
5693 , p_status_change_date => l_hire_date -- Fix for bug 6036285
5694 ,p_status_change_reason => l_change_reason --12905192
5695 , p_assignment_status_id => l_assignment_status_id
5696 , p_object_version_number => l_asg_status_ovn1);
5697
5698 IRC_OFFERS_API.close_offer
5699 ( p_validate => false
5700 ,p_effective_date => l_hire_date-1
5701 ,p_applicant_assignment_id => l_asg_rec.assignment_id
5702 ,p_change_reason => 'MANUAL_CLOSURE'
5703 );
5704
5705 end if;
5706 -- 12905192
5707 */
5708
5709
5710 l_pspl_asg_id :=asg_rec.assignment_id;
5711
5712
5713 OPEN get_pay_proposal(l_pspl_asg_id);
5714 FETCH get_pay_proposal INTO l_pay_pspl_id,l_pay_obj_number,l_proposed_sal_n, l_dummy_change_date,l_proposal_reason; -- Added Proposal_Reason For Bug # 5987409 --
5715 if get_pay_proposal%found then
5716 /* l_pay_pspl_id:=null;
5717 l_pay_obj_number:=null;
5718 open get_primary_proposal(l_primary_asg_id);
5719 fetch get_primary_proposal into l_pay_pspl_id,l_pay_obj_number;
5720 if get_primary_proposal%found then
5721 close get_primary_proposal; */
5722 update per_pay_proposals set assignment_id = l_primary_asg_id
5723 where pay_proposal_id = l_pay_pspl_id;
5724 l_pay_obj_number := l_pay_obj_number +1;
5725 hr_maintain_proposal_api.cre_or_upd_salary_proposal(
5726 p_validate => false,
5727 p_pay_proposal_id => l_pay_pspl_id ,
5728 p_object_version_number => l_pay_obj_number,
5729 p_change_date => p_hire_date,
5730 p_approved => 'Y',
5731 p_inv_next_sal_date_warning => l_inv_next_sal_date_warning,
5732 p_proposed_salary_warning => l_proposed_salary_warning,
5733 p_approved_warning => l_approved_warning,
5734 p_payroll_warning => l_payroll_warning,
5735 p_proposed_salary_n => l_proposed_sal_n,
5736 p_business_group_id => l_business_group_id,
5737 p_proposal_reason => l_proposal_reason);
5738 /* else
5739 close get_primary_proposal;
5740 l_pay_pspl_id:=null;
5741 l_pay_obj_number:=null;
5742 hr_maintain_proposal_api.cre_or_upd_salary_proposal(
5743 p_validate => false,
5744 p_pay_proposal_id => l_pay_pspl_id,
5745 p_assignment_id => l_primary_asg_id,
5746 p_object_version_number => l_pay_obj_number,
5747 p_change_date => p_hire_date,
5748 p_approved => 'Y',
5749 p_inv_next_sal_date_warning => l_inv_next_sal_date_warning,
5750 p_proposed_salary_warning => l_proposed_salary_warning,
5751 p_approved_warning => l_approved_warning,
5752 p_payroll_warning => l_payroll_warning,
5753 p_proposed_salary_n => l_proposed_sal_n,
5754 p_business_group_id => l_business_group_id,
5755 p_proposal_reason => l_proposal_reason);
5756
5757 end if; */
5758 --
5759 end if;
5760 --
5761 close get_pay_proposal;
5762 --
5763 l_check_loop := l_check_loop +1;
5764
5765 end if;
5766
5767 -- fix for the bug 5024006 ends here
5768
5769 else
5770 --
5771 hr_utility.set_location(l_proc, 270);
5772 --
5773 -- we must update the old assignment with the new assignment record
5774 --
5775 open get_primary;
5776 fetch get_primary into l_primary_asg_id,l_primary_ovn, l_period_of_service_id; -- #2468916
5777 close get_primary;
5778 --
5779 hr_utility.set_location(l_proc, 280);
5780 --
5781 if p_asg_rec.assignment_id is not null then
5782 l_asg_rec := p_asg_rec;
5783
5784 -- vb 10376122
5785
5786 open csr_get_vacancy(p_asg_rec.assignment_id);
5787 fetch csr_get_vacancy into l_aplasg_vacancy_id,l_aplasg_RECRUITER_ID;
5788 close csr_get_vacancy;
5789
5790 -- vb 10376122
5791
5792
5793 else
5794 open get_asg(asg_rec.assignment_id);
5795 fetch get_asg into l_asg_rec;
5796 close get_asg;
5797 end if;
5798 --
5799 hr_utility.set_location(l_proc, 290);
5800 --
5801 if l_asg_rec.people_group_id is not null then
5802 --
5803 hr_utility.set_location(l_proc, 300);
5804 --
5805 open get_pgp(l_asg_rec.people_group_id);
5806 fetch get_pgp into l_pgp_rec;
5807 close get_pgp;
5808 end if;
5809 --
5810 if l_asg_rec.soft_coding_keyflex_id is not null then
5811 --
5812 hr_utility.set_location(l_proc, 310);
5813 --
5814 open get_scl(l_asg_rec.soft_coding_keyflex_id);
5815 fetch get_scl into l_scl_rec;
5816 close get_scl;
5817 end if;
5818 --
5819 if l_asg_rec.cagr_grade_def_id is not null then
5820 --
5821 hr_utility.set_location(l_proc, 320);
5822 --
5823 open get_cag(l_asg_rec.cagr_grade_def_id);
5824 fetch get_cag into l_cag_rec;
5825 close get_cag;
5826 end if;
5827 --
5828 hr_utility.set_location(l_proc, 330);
5829 --
5830 if p_overwrite_primary = 'V' then
5831 --
5832
5833 hr_utility.set_location('l_aplasg_vacancy_id'||l_aplasg_vacancy_id,180);
5834 hr_utility.set_location('l_aplasg_RECRUITER_ID'||l_aplasg_RECRUITER_ID,180);
5835
5836 open get_asg(l_primary_asg_id);
5837 fetch get_asg into l_primary_asg_rec;
5838 close get_asg;
5839 --
5840 if l_primary_asg_rec.people_group_id is not null then
5841 open get_pgp(l_primary_asg_rec.people_group_id);
5842 fetch get_pgp into l_primary_pgp_rec;
5843 close get_pgp;
5844 end if;
5845 --
5846 if l_primary_asg_rec.soft_coding_keyflex_id is not null then
5847 open get_scl(l_primary_asg_rec.soft_coding_keyflex_id);
5848 fetch get_scl into l_primary_scl_rec;
5849 close get_scl;
5850 end if;
5851 --
5852 if l_primary_asg_rec.cagr_grade_def_id is not null then
5853 open get_cag(l_primary_asg_rec.cagr_grade_def_id);
5854 fetch get_cag into l_primary_cag_rec;
5855 close get_cag;
5856 end if;
5857 --
5858 -- Merge new and old primary assignments, giving preference to the
5859 -- new one.
5860 --
5861 --Bug 4234518
5862 --
5863 l_asg_rec.employee_category := NVL(l_asg_rec.employee_category,l_primary_asg_rec.employee_category);
5864 --Bug fix 4234518 ends here
5865 --
5866 l_asg_rec.employment_category := NVL(l_asg_rec.employment_category,l_primary_asg_rec.employment_category);
5867 l_asg_rec.grade_id := NVL(l_asg_rec.grade_id,l_primary_asg_rec.grade_id);
5868 l_asg_rec.job_id := NVL(l_asg_rec.job_id,l_primary_asg_rec.job_id);
5869 l_asg_rec.location_id := NVL(l_asg_rec.location_id,l_primary_asg_rec.location_id);
5870 l_asg_rec.organization_id := NVL(l_asg_rec.organization_id,l_primary_asg_rec.organization_id);
5871 l_asg_rec.payroll_id := NVL(l_asg_rec.payroll_id,l_primary_asg_rec.payroll_id);
5872 l_asg_rec.pay_basis_id := NVL(l_asg_rec.pay_basis_id,l_primary_asg_rec.pay_basis_id);
5873 l_asg_rec.position_id := NVL(l_asg_rec.position_id,l_primary_asg_rec.position_id);
5874 l_asg_rec.special_ceiling_step_id := NVL(l_asg_rec.special_ceiling_step_id,l_primary_asg_rec.special_ceiling_step_id);
5875 --
5876 l_pgp_rec.segment1 := NVL(l_pgp_rec.segment1, l_primary_pgp_rec.segment1);
5877 l_pgp_rec.segment2 := NVL(l_pgp_rec.segment2, l_primary_pgp_rec.segment2);
5878 l_pgp_rec.segment3 := NVL(l_pgp_rec.segment3, l_primary_pgp_rec.segment3);
5879 l_pgp_rec.segment4 := NVL(l_pgp_rec.segment4, l_primary_pgp_rec.segment4);
5880 l_pgp_rec.segment5 := NVL(l_pgp_rec.segment5, l_primary_pgp_rec.segment5);
5881 l_pgp_rec.segment6 := NVL(l_pgp_rec.segment6, l_primary_pgp_rec.segment6);
5882 l_pgp_rec.segment7 := NVL(l_pgp_rec.segment7, l_primary_pgp_rec.segment7);
5883 l_pgp_rec.segment8 := NVL(l_pgp_rec.segment8, l_primary_pgp_rec.segment8); --- Fix For Bug # 8758419
5884 l_pgp_rec.segment9 := NVL(l_pgp_rec.segment9, l_primary_pgp_rec.segment9);
5885 l_pgp_rec.segment10 := NVL(l_pgp_rec.segment10,l_primary_pgp_rec.segment10);
5886 l_pgp_rec.segment11 := NVL(l_pgp_rec.segment11,l_primary_pgp_rec.segment11);
5887 l_pgp_rec.segment12 := NVL(l_pgp_rec.segment12,l_primary_pgp_rec.segment12);
5888 l_pgp_rec.segment13 := NVL(l_pgp_rec.segment13,l_primary_pgp_rec.segment13);
5889 l_pgp_rec.segment14 := NVL(l_pgp_rec.segment14,l_primary_pgp_rec.segment14);
5890 l_pgp_rec.segment15 := NVL(l_pgp_rec.segment15,l_primary_pgp_rec.segment15);
5891 l_pgp_rec.segment16 := NVL(l_pgp_rec.segment16,l_primary_pgp_rec.segment16);
5892 l_pgp_rec.segment17 := NVL(l_pgp_rec.segment17,l_primary_pgp_rec.segment17);
5893 l_pgp_rec.segment18 := NVL(l_pgp_rec.segment18,l_primary_pgp_rec.segment18);
5894 l_pgp_rec.segment19 := NVL(l_pgp_rec.segment19,l_primary_pgp_rec.segment19);
5895 l_pgp_rec.segment20 := NVL(l_pgp_rec.segment20,l_primary_pgp_rec.segment20);
5896 l_pgp_rec.segment21 := NVL(l_pgp_rec.segment21,l_primary_pgp_rec.segment21);
5897 l_pgp_rec.segment22 := NVL(l_pgp_rec.segment22,l_primary_pgp_rec.segment22);
5898 l_pgp_rec.segment23 := NVL(l_pgp_rec.segment23,l_primary_pgp_rec.segment23);
5899 l_pgp_rec.segment24 := NVL(l_pgp_rec.segment24,l_primary_pgp_rec.segment24);
5900 l_pgp_rec.segment25 := NVL(l_pgp_rec.segment25,l_primary_pgp_rec.segment25);
5901 l_pgp_rec.segment26 := NVL(l_pgp_rec.segment26,l_primary_pgp_rec.segment26);
5902 l_pgp_rec.segment27 := NVL(l_pgp_rec.segment27,l_primary_pgp_rec.segment27);
5903 l_pgp_rec.segment28 := NVL(l_pgp_rec.segment28,l_primary_pgp_rec.segment28);
5904 l_pgp_rec.segment29 := NVL(l_pgp_rec.segment29,l_primary_pgp_rec.segment29);
5905 l_pgp_rec.segment30 := NVL(l_pgp_rec.segment30,l_primary_pgp_rec.segment30);
5906 --
5907 -- l_asg_rec.assignment_number := NVL(l_asg_rec.assignment_number,l_primary_asg_rec.assignment_number);
5908 l_asg_rec.bargaining_unit_code := NVL(l_asg_rec.bargaining_unit_code,l_primary_asg_rec.bargaining_unit_code);
5909 -- l_asg_rec.change_reason := NVL(l_asg_rec.change_reason,l_primary_asg_rec.change_reason);
5910 l_asg_rec.collective_agreement_id := NVL(l_asg_rec.collective_agreement_id,l_primary_asg_rec.collective_agreement_id);
5911 l_asg_rec.contract_id := NVL(l_asg_rec.contract_id,l_primary_asg_rec.contract_id);
5912 l_asg_rec.date_probation_end := NVL(l_asg_rec.date_probation_end,l_primary_asg_rec.date_probation_end);
5913 l_asg_rec.default_code_comb_id := NVL(l_asg_rec.default_code_comb_id,l_primary_asg_rec.default_code_comb_id);
5914 l_asg_rec.establishment_id := NVL(l_asg_rec.establishment_id,l_primary_asg_rec.establishment_id);
5915 l_asg_rec.frequency := NVL(l_asg_rec.frequency,l_primary_asg_rec.frequency);
5916 l_asg_rec.hourly_salaried_code := NVL(l_asg_rec.hourly_salaried_code,l_primary_asg_rec.hourly_salaried_code);
5917 l_asg_rec.internal_address_line := NVL(l_asg_rec.internal_address_line,l_primary_asg_rec.internal_address_line);
5918 l_asg_rec.labour_union_member_flag := NVL(l_asg_rec.labour_union_member_flag,l_primary_asg_rec.labour_union_member_flag);
5919 l_asg_rec.manager_flag := NVL(l_asg_rec.manager_flag,l_primary_asg_rec.manager_flag);
5920 l_asg_rec.normal_hours := NVL(l_asg_rec.normal_hours,l_primary_asg_rec.normal_hours);
5921 l_asg_rec.perf_review_period := NVL(l_asg_rec.perf_review_period,l_primary_asg_rec.perf_review_period);
5922 l_asg_rec.perf_review_period_frequency := NVL(l_asg_rec.perf_review_period_frequency,l_primary_asg_rec.perf_review_period_frequency);
5923 l_asg_rec.probation_period := NVL(l_asg_rec.probation_period,l_primary_asg_rec.probation_period);
5924 l_asg_rec.probation_unit := NVL(l_asg_rec.probation_unit,l_primary_asg_rec.probation_unit);
5925 l_asg_rec.sal_review_period := NVL(l_asg_rec.sal_review_period,l_primary_asg_rec.sal_review_period);
5926 l_asg_rec.sal_review_period_frequency := NVL(l_asg_rec.sal_review_period_frequency,l_primary_asg_rec.sal_review_period_frequency);
5927 l_asg_rec.set_of_books_id := NVL(l_asg_rec.set_of_books_id,l_primary_asg_rec.set_of_books_id);
5928 l_asg_rec.source_type := NVL(l_asg_rec.source_type,l_primary_asg_rec.source_type);
5929 l_asg_rec.supervisor_id := NVL(l_asg_rec.supervisor_id,l_primary_asg_rec.supervisor_id);
5930 l_asg_rec.time_normal_finish := NVL(l_asg_rec.time_normal_finish,l_primary_asg_rec.time_normal_finish);
5931 l_asg_rec.time_normal_start := NVL(l_asg_rec.time_normal_start,l_primary_asg_rec.time_normal_start);
5932 --
5933 -- Bug 12834915
5934 if (nvl(l_asg_rec.ass_attribute_category,-1) = nvl(l_primary_asg_rec.ass_attribute_category,-1)) then
5935 l_asg_rec.ass_attribute1 := NVL(l_asg_rec.ass_attribute1, l_primary_asg_rec.ass_attribute1);
5936 l_asg_rec.ass_attribute2 := NVL(l_asg_rec.ass_attribute2, l_primary_asg_rec.ass_attribute2);
5937 l_asg_rec.ass_attribute3 := NVL(l_asg_rec.ass_attribute3, l_primary_asg_rec.ass_attribute3);
5938 l_asg_rec.ass_attribute4 := NVL(l_asg_rec.ass_attribute4, l_primary_asg_rec.ass_attribute4);
5939 l_asg_rec.ass_attribute5 := NVL(l_asg_rec.ass_attribute5, l_primary_asg_rec.ass_attribute5);
5940 l_asg_rec.ass_attribute6 := NVL(l_asg_rec.ass_attribute6, l_primary_asg_rec.ass_attribute6);
5941 l_asg_rec.ass_attribute7 := NVL(l_asg_rec.ass_attribute7, l_primary_asg_rec.ass_attribute7);
5942 l_asg_rec.ass_attribute8 := NVL(l_asg_rec.ass_attribute8, l_primary_asg_rec.ass_attribute8);
5943 l_asg_rec.ass_attribute9 := NVL(l_asg_rec.ass_attribute9, l_primary_asg_rec.ass_attribute9);
5944 l_asg_rec.ass_attribute10 := NVL(l_asg_rec.ass_attribute10,l_primary_asg_rec.ass_attribute10);
5945 l_asg_rec.ass_attribute11 := NVL(l_asg_rec.ass_attribute11,l_primary_asg_rec.ass_attribute11);
5946 l_asg_rec.ass_attribute12 := NVL(l_asg_rec.ass_attribute12,l_primary_asg_rec.ass_attribute12);
5947 l_asg_rec.ass_attribute13 := NVL(l_asg_rec.ass_attribute13,l_primary_asg_rec.ass_attribute13);
5948 l_asg_rec.ass_attribute14 := NVL(l_asg_rec.ass_attribute14,l_primary_asg_rec.ass_attribute14);
5949 l_asg_rec.ass_attribute15 := NVL(l_asg_rec.ass_attribute15,l_primary_asg_rec.ass_attribute15);
5950 l_asg_rec.ass_attribute16 := NVL(l_asg_rec.ass_attribute16,l_primary_asg_rec.ass_attribute16);
5951 l_asg_rec.ass_attribute17 := NVL(l_asg_rec.ass_attribute17,l_primary_asg_rec.ass_attribute17);
5952 l_asg_rec.ass_attribute18 := NVL(l_asg_rec.ass_attribute18,l_primary_asg_rec.ass_attribute18);
5953 l_asg_rec.ass_attribute19 := NVL(l_asg_rec.ass_attribute19,l_primary_asg_rec.ass_attribute19);
5954 l_asg_rec.ass_attribute20 := NVL(l_asg_rec.ass_attribute20,l_primary_asg_rec.ass_attribute20);
5955 l_asg_rec.ass_attribute21 := NVL(l_asg_rec.ass_attribute21,l_primary_asg_rec.ass_attribute21);
5956 l_asg_rec.ass_attribute22 := NVL(l_asg_rec.ass_attribute22,l_primary_asg_rec.ass_attribute22);
5957 l_asg_rec.ass_attribute23 := NVL(l_asg_rec.ass_attribute23,l_primary_asg_rec.ass_attribute23);
5958 l_asg_rec.ass_attribute24 := NVL(l_asg_rec.ass_attribute24,l_primary_asg_rec.ass_attribute24);
5959 l_asg_rec.ass_attribute25 := NVL(l_asg_rec.ass_attribute25,l_primary_asg_rec.ass_attribute25);
5960 l_asg_rec.ass_attribute26 := NVL(l_asg_rec.ass_attribute26,l_primary_asg_rec.ass_attribute26);
5961 l_asg_rec.ass_attribute27 := NVL(l_asg_rec.ass_attribute27,l_primary_asg_rec.ass_attribute27);
5962 l_asg_rec.ass_attribute28 := NVL(l_asg_rec.ass_attribute28,l_primary_asg_rec.ass_attribute28);
5963 l_asg_rec.ass_attribute29 := NVL(l_asg_rec.ass_attribute29,l_primary_asg_rec.ass_attribute29);
5964 l_asg_rec.ass_attribute30 := NVL(l_asg_rec.ass_attribute30,l_primary_asg_rec.ass_attribute30);
5965 elsif (l_asg_rec.ass_attribute_category is null) then
5966 l_asg_rec.ass_attribute_category := l_primary_asg_rec.ass_attribute_category;
5967 l_asg_rec.ass_attribute1 := l_primary_asg_rec.ass_attribute1;
5968 l_asg_rec.ass_attribute2 := l_primary_asg_rec.ass_attribute2;
5969 l_asg_rec.ass_attribute3 := l_primary_asg_rec.ass_attribute3;
5970 l_asg_rec.ass_attribute4 := l_primary_asg_rec.ass_attribute4;
5971 l_asg_rec.ass_attribute5 := l_primary_asg_rec.ass_attribute5;
5972 l_asg_rec.ass_attribute6 := l_primary_asg_rec.ass_attribute6;
5973 l_asg_rec.ass_attribute7 := l_primary_asg_rec.ass_attribute7;
5974 l_asg_rec.ass_attribute8 := l_primary_asg_rec.ass_attribute8;
5975 l_asg_rec.ass_attribute9 := l_primary_asg_rec.ass_attribute9;
5976 l_asg_rec.ass_attribute10 := l_primary_asg_rec.ass_attribute10;
5977 l_asg_rec.ass_attribute11 := l_primary_asg_rec.ass_attribute11;
5978 l_asg_rec.ass_attribute12 := l_primary_asg_rec.ass_attribute12;
5979 l_asg_rec.ass_attribute13 := l_primary_asg_rec.ass_attribute13;
5980 l_asg_rec.ass_attribute14 := l_primary_asg_rec.ass_attribute14;
5981 l_asg_rec.ass_attribute15 := l_primary_asg_rec.ass_attribute15;
5982 l_asg_rec.ass_attribute16 := l_primary_asg_rec.ass_attribute16;
5983 l_asg_rec.ass_attribute17 := l_primary_asg_rec.ass_attribute17;
5984 l_asg_rec.ass_attribute18 := l_primary_asg_rec.ass_attribute18;
5985 l_asg_rec.ass_attribute19 := l_primary_asg_rec.ass_attribute19;
5986 l_asg_rec.ass_attribute20 := l_primary_asg_rec.ass_attribute20;
5987 l_asg_rec.ass_attribute21 := l_primary_asg_rec.ass_attribute21;
5988 l_asg_rec.ass_attribute22 := l_primary_asg_rec.ass_attribute22;
5989 l_asg_rec.ass_attribute23 := l_primary_asg_rec.ass_attribute23;
5990 l_asg_rec.ass_attribute24 := l_primary_asg_rec.ass_attribute24;
5991 l_asg_rec.ass_attribute25 := l_primary_asg_rec.ass_attribute25;
5992 l_asg_rec.ass_attribute26 := l_primary_asg_rec.ass_attribute26;
5993 l_asg_rec.ass_attribute27 := l_primary_asg_rec.ass_attribute27;
5994 l_asg_rec.ass_attribute28 := l_primary_asg_rec.ass_attribute28;
5995 l_asg_rec.ass_attribute29 := l_primary_asg_rec.ass_attribute29;
5996 l_asg_rec.ass_attribute30 := l_primary_asg_rec.ass_attribute30;
5997 end if;
5998 --
5999 if (l_asg_rec.cagr_id_flex_num = l_primary_asg_rec.cagr_id_flex_num) then
6000 l_cag_rec.segment1 := NVL(l_cag_rec.segment1, l_primary_cag_rec.segment1);
6001 l_cag_rec.segment2 := NVL(l_cag_rec.segment2, l_primary_cag_rec.segment2);
6002 l_cag_rec.segment3 := NVL(l_cag_rec.segment3, l_primary_cag_rec.segment3);
6003 l_cag_rec.segment4 := NVL(l_cag_rec.segment4, l_primary_cag_rec.segment4);
6004 l_cag_rec.segment5 := NVL(l_cag_rec.segment5, l_primary_cag_rec.segment5);
6005 l_cag_rec.segment6 := NVL(l_cag_rec.segment6, l_primary_cag_rec.segment6);
6006 l_cag_rec.segment7 := NVL(l_cag_rec.segment7, l_primary_cag_rec.segment7);
6007 l_cag_rec.segment8 := NVL(l_cag_rec.segment8, l_primary_cag_rec.segment8);
6008 l_cag_rec.segment9 := NVL(l_cag_rec.segment9, l_primary_cag_rec.segment9);
6009 l_cag_rec.segment10 := NVL(l_cag_rec.segment10,l_primary_cag_rec.segment10);
6010 l_cag_rec.segment11 := NVL(l_cag_rec.segment11,l_primary_cag_rec.segment11);
6011 l_cag_rec.segment12 := NVL(l_cag_rec.segment12,l_primary_cag_rec.segment12);
6012 l_cag_rec.segment13 := NVL(l_cag_rec.segment13,l_primary_cag_rec.segment13);
6013 l_cag_rec.segment14 := NVL(l_cag_rec.segment14,l_primary_cag_rec.segment14);
6014 l_cag_rec.segment15 := NVL(l_cag_rec.segment15,l_primary_cag_rec.segment15);
6015 l_cag_rec.segment16 := NVL(l_cag_rec.segment16,l_primary_cag_rec.segment16);
6016 l_cag_rec.segment17 := NVL(l_cag_rec.segment17,l_primary_cag_rec.segment17);
6017 l_cag_rec.segment18 := NVL(l_cag_rec.segment18,l_primary_cag_rec.segment18);
6018 l_cag_rec.segment19 := NVL(l_cag_rec.segment19,l_primary_cag_rec.segment19);
6019 l_cag_rec.segment20 := NVL(l_cag_rec.segment20,l_primary_cag_rec.segment20);
6020 elsif (l_asg_rec.cagr_id_flex_num is null) then
6021 l_asg_rec.cagr_id_flex_num := l_primary_asg_rec.cagr_id_flex_num;
6022 l_cag_rec.segment1 := l_primary_cag_rec.segment1;
6023 l_cag_rec.segment2 := l_primary_cag_rec.segment2;
6024 l_cag_rec.segment3 := l_primary_cag_rec.segment3;
6025 l_cag_rec.segment4 := l_primary_cag_rec.segment4;
6026 l_cag_rec.segment5 := l_primary_cag_rec.segment5;
6027 l_cag_rec.segment6 := l_primary_cag_rec.segment6;
6028 l_cag_rec.segment7 := l_primary_cag_rec.segment7;
6029 l_cag_rec.segment8 := l_primary_cag_rec.segment8;
6030 l_cag_rec.segment9 := l_primary_cag_rec.segment9;
6031 l_cag_rec.segment10 := l_primary_cag_rec.segment10;
6032 l_cag_rec.segment11 := l_primary_cag_rec.segment11;
6033 l_cag_rec.segment12 := l_primary_cag_rec.segment12;
6034 l_cag_rec.segment13 := l_primary_cag_rec.segment13;
6035 l_cag_rec.segment14 := l_primary_cag_rec.segment14;
6036 l_cag_rec.segment15 := l_primary_cag_rec.segment15;
6037 l_cag_rec.segment16 := l_primary_cag_rec.segment16;
6038 l_cag_rec.segment17 := l_primary_cag_rec.segment17;
6039 l_cag_rec.segment18 := l_primary_cag_rec.segment18;
6040 l_cag_rec.segment19 := l_primary_cag_rec.segment19;
6041 l_cag_rec.segment20 := l_primary_cag_rec.segment20;
6042 end if;
6043 --
6044 l_scl_rec.segment1 := NVL(l_scl_rec.segment1, l_primary_scl_rec.segment1);
6045 l_scl_rec.segment2 := NVL(l_scl_rec.segment2, l_primary_scl_rec.segment2);
6046 l_scl_rec.segment3 := NVL(l_scl_rec.segment3, l_primary_scl_rec.segment3);
6047 l_scl_rec.segment4 := NVL(l_scl_rec.segment4, l_primary_scl_rec.segment4);
6048 l_scl_rec.segment5 := NVL(l_scl_rec.segment5, l_primary_scl_rec.segment5);
6049 l_scl_rec.segment6 := NVL(l_scl_rec.segment6, l_primary_scl_rec.segment6);
6050 l_scl_rec.segment7 := NVL(l_scl_rec.segment7, l_primary_scl_rec.segment7);
6051 l_scl_rec.segment8 := NVL(l_scl_rec.segment8, l_primary_scl_rec.segment8);
6052 l_scl_rec.segment9 := NVL(l_scl_rec.segment9, l_primary_scl_rec.segment9);
6053 l_scl_rec.segment10 := NVL(l_scl_rec.segment10,l_primary_scl_rec.segment10);
6054 l_scl_rec.segment11 := NVL(l_scl_rec.segment11,l_primary_scl_rec.segment11);
6055 l_scl_rec.segment12 := NVL(l_scl_rec.segment12,l_primary_scl_rec.segment12);
6056 l_scl_rec.segment13 := NVL(l_scl_rec.segment13,l_primary_scl_rec.segment13);
6057 l_scl_rec.segment14 := NVL(l_scl_rec.segment14,l_primary_scl_rec.segment14);
6058 l_scl_rec.segment15 := NVL(l_scl_rec.segment15,l_primary_scl_rec.segment15);
6059 l_scl_rec.segment16 := NVL(l_scl_rec.segment16,l_primary_scl_rec.segment16);
6060 l_scl_rec.segment17 := NVL(l_scl_rec.segment17,l_primary_scl_rec.segment17);
6061 l_scl_rec.segment18 := NVL(l_scl_rec.segment18,l_primary_scl_rec.segment18);
6062 l_scl_rec.segment19 := NVL(l_scl_rec.segment19,l_primary_scl_rec.segment19);
6063 l_scl_rec.segment20 := NVL(l_scl_rec.segment20,l_primary_scl_rec.segment20);
6064 l_scl_rec.segment21 := NVL(l_scl_rec.segment21,l_primary_scl_rec.segment21);
6065 l_scl_rec.segment22 := NVL(l_scl_rec.segment22,l_primary_scl_rec.segment22);
6066 l_scl_rec.segment23 := NVL(l_scl_rec.segment23,l_primary_scl_rec.segment23);
6067 l_scl_rec.segment24 := NVL(l_scl_rec.segment24,l_primary_scl_rec.segment24);
6068 l_scl_rec.segment25 := NVL(l_scl_rec.segment25,l_primary_scl_rec.segment25);
6069 l_scl_rec.segment26 := NVL(l_scl_rec.segment26,l_primary_scl_rec.segment26);
6070 l_scl_rec.segment27 := NVL(l_scl_rec.segment27,l_primary_scl_rec.segment27);
6071 l_scl_rec.segment28 := NVL(l_scl_rec.segment28,l_primary_scl_rec.segment28);
6072 l_scl_rec.segment29 := NVL(l_scl_rec.segment29,l_primary_scl_rec.segment29);
6073 l_scl_rec.segment30 := NVL(l_scl_rec.segment30,l_primary_scl_rec.segment30);
6074 --
6075 end if;
6076 --
6077 --The below call to the old update_emp_asg_criteria procedure has been commented as per bug 5102160
6078 -- soft_coding_keyflex_id is passed by calling the new update_emp_asg_criteria procedure
6079
6080 /* hr_assignment_api.update_emp_asg_criteria
6081 (p_validate => FALSE
6082 ,p_effective_date => l_hire_date
6083 ,p_datetrack_update_mode => l_datetrack_update_mode
6084 ,p_assignment_id => l_primary_asg_id
6085 ,p_object_version_number => l_primary_ovn
6086 ,p_grade_id => l_asg_rec.grade_id
6087 ,p_position_id => l_asg_rec.position_id
6088 ,p_job_id => l_asg_rec.job_id
6089 ,p_payroll_id => l_asg_rec.payroll_id
6090 ,p_location_id => l_asg_rec.location_id
6091 ,p_special_ceiling_step_id => l_asg_rec.special_ceiling_step_id
6092 ,p_organization_id => l_asg_rec.organization_id
6093 ,p_pay_basis_id => l_asg_rec.pay_basis_id
6094 ,p_employment_category => l_asg_rec.employment_category
6095 ,p_segment1 => l_pgp_rec.segment1
6096 ,p_segment2 => l_pgp_rec.segment2
6097 ,p_segment3 => l_pgp_rec.segment3
6098 ,p_segment4 => l_pgp_rec.segment4
6099 ,p_segment5 => l_pgp_rec.segment5
6100 ,p_segment6 => l_pgp_rec.segment6
6101 ,p_segment7 => l_pgp_rec.segment7
6102 ,p_segment8 => l_pgp_rec.segment8
6103 ,p_segment9 => l_pgp_rec.segment9
6104 ,p_segment10 => l_pgp_rec.segment10
6105 ,p_segment11 => l_pgp_rec.segment11
6106 ,p_segment12 => l_pgp_rec.segment12
6107 ,p_segment13 => l_pgp_rec.segment13
6108 ,p_segment14 => l_pgp_rec.segment14
6109 ,p_segment15 => l_pgp_rec.segment15
6110 ,p_segment16 => l_pgp_rec.segment16
6111 ,p_segment17 => l_pgp_rec.segment17
6112 ,p_segment18 => l_pgp_rec.segment18
6113 ,p_segment19 => l_pgp_rec.segment19
6114 ,p_segment20 => l_pgp_rec.segment20
6115 ,p_segment21 => l_pgp_rec.segment21
6116 ,p_segment22 => l_pgp_rec.segment22
6117 ,p_segment23 => l_pgp_rec.segment23
6118 ,p_segment24 => l_pgp_rec.segment24
6119 ,p_segment25 => l_pgp_rec.segment25
6120 ,p_segment26 => l_pgp_rec.segment26
6121 ,p_segment27 => l_pgp_rec.segment27
6122 ,p_segment28 => l_pgp_rec.segment28
6123 ,p_segment29 => l_pgp_rec.segment29
6124 ,p_segment30 => l_pgp_rec.segment30
6125 ,p_group_name => l_dummyv
6126 ,p_effective_start_date => l_effective_start_date
6127 ,p_effective_end_date => l_effective_end_date
6128 ,p_people_group_id => l_dummy
6129 ,p_org_now_no_manager_warning => l_dummyb
6130 ,p_other_manager_warning => l_dummyb
6131 ,p_spp_delete_warning => l_dummyb
6132 ,p_entries_changed_warning => l_dummyv
6133 ,p_tax_district_changed_warning => l_dummyb
6134 );*/
6135
6136 p_asg_rec := l_asg_rec;
6137
6138 hr_assignment_api.update_emp_asg_criteria
6139 (p_validate => FALSE
6140 ,p_effective_date => l_hire_date
6141 ,p_datetrack_update_mode => l_datetrack_update_mode
6142 ,p_assignment_id => l_primary_asg_id
6143 ,p_object_version_number => l_primary_ovn
6144 ,p_grade_id => l_asg_rec.grade_id
6145 ,p_position_id => l_asg_rec.position_id
6146 ,p_job_id => l_asg_rec.job_id
6147 ,p_payroll_id => l_asg_rec.payroll_id
6148 ,p_location_id => l_asg_rec.location_id
6149 ,p_special_ceiling_step_id => l_asg_rec.special_ceiling_step_id
6150 ,p_organization_id => l_asg_rec.organization_id
6151 ,p_pay_basis_id => l_asg_rec.pay_basis_id
6152 ,p_supervisor_assignment_id => nvl(l_asg_rec.supervisor_assignment_id
6153 , l_primary_asg_rec.supervisor_assignment_id) -- 13595937
6154 ,p_segment1 => l_pgp_rec.segment1
6155 ,p_segment2 => l_pgp_rec.segment2
6156 ,p_segment3 => l_pgp_rec.segment3
6157 ,p_segment4 => l_pgp_rec.segment4
6158 ,p_segment5 => l_pgp_rec.segment5
6159 ,p_segment6 => l_pgp_rec.segment6
6160 ,p_segment7 => l_pgp_rec.segment7
6161 ,p_segment8 => l_pgp_rec.segment8
6162 ,p_segment9 => l_pgp_rec.segment9
6163 ,p_segment10 => l_pgp_rec.segment10
6164 ,p_segment11 => l_pgp_rec.segment11
6165 ,p_segment12 => l_pgp_rec.segment12
6166 ,p_segment13 => l_pgp_rec.segment13
6167 ,p_segment14 => l_pgp_rec.segment14
6168 ,p_segment15 => l_pgp_rec.segment15
6169 ,p_segment16 => l_pgp_rec.segment16
6170 ,p_segment17 => l_pgp_rec.segment17
6171 ,p_segment18 => l_pgp_rec.segment18
6172 ,p_segment19 => l_pgp_rec.segment19
6173 ,p_segment20 => l_pgp_rec.segment20
6174 ,p_segment21 => l_pgp_rec.segment21
6175 ,p_segment22 => l_pgp_rec.segment22
6176 ,p_segment23 => l_pgp_rec.segment23
6177 ,p_segment24 => l_pgp_rec.segment24
6178 ,p_segment25 => l_pgp_rec.segment25
6179 ,p_segment26 => l_pgp_rec.segment26
6180 ,p_segment27 => l_pgp_rec.segment27
6181 ,p_segment28 => l_pgp_rec.segment28
6182 ,p_segment29 => l_pgp_rec.segment29
6183 ,p_segment30 => l_pgp_rec.segment30
6184 ,p_employment_category => l_asg_rec.employment_category
6185 ,p_people_group_id => l_dummy
6186 ,p_soft_coding_keyflex_id => l_asg_rec.soft_coding_keyflex_id
6187 ,p_group_name => l_dummyv
6188 ,p_effective_start_date => l_effective_start_date
6189 ,p_effective_end_date => l_effective_end_date
6190 ,p_org_now_no_manager_warning => l_dummyb
6191 ,p_other_manager_warning => l_dummyb
6192 ,p_spp_delete_warning => l_dummyb
6193 ,p_entries_changed_warning => l_dummyv
6194 ,p_tax_district_changed_warning => l_dummyb
6195 ,p_concatenated_segments => l_concatenated_segments
6196 ,p_gsp_post_process_warning => l_gsp_post_process_warning -- bug 2999562
6197 );
6198 --
6199 p_asg_rec.people_group_id := l_dummy;
6200
6201 hr_utility.set_location(l_proc, 340);
6202 --
6203 hr_assignment_api.update_emp_asg
6204 (p_validate => FALSE
6205 ,p_effective_date => l_hire_date
6206 ,p_datetrack_update_mode => 'CORRECTION'
6207 ,p_assignment_id => l_primary_asg_id
6208 ,p_object_version_number => l_primary_ovn
6209 ,p_supervisor_id => l_asg_rec.supervisor_id
6210 ,p_assignment_number => l_asg_rec.assignment_number
6211 ,p_change_reason => NULL -- l_asg_rec.change_reason Bug 12946619
6212 ,p_date_probation_end => l_asg_rec.date_probation_end
6213 ,p_default_code_comb_id => l_asg_rec.default_code_comb_id
6214 ,p_frequency => l_asg_rec.frequency
6215 ,p_internal_address_line => l_asg_rec.internal_address_line
6216 ,p_manager_flag => l_asg_rec.manager_flag
6217 ,p_normal_hours => l_asg_rec.normal_hours
6218 ,p_perf_review_period => l_asg_rec.perf_review_period
6219 ,p_perf_review_period_frequency => l_asg_rec.perf_review_period_frequency
6220 ,p_probation_period => l_asg_rec.probation_period
6221 ,p_probation_unit => l_asg_rec.probation_unit
6222 ,p_sal_review_period => l_asg_rec.sal_review_period
6223 ,p_sal_review_period_frequency => l_asg_rec.sal_review_period_frequency
6224 ,p_set_of_books_id => l_asg_rec.set_of_books_id
6225 ,p_source_type => l_asg_rec.source_type
6226 ,p_time_normal_finish => l_asg_rec.time_normal_finish
6227 ,p_time_normal_start => l_asg_rec.time_normal_start
6228 ,p_bargaining_unit_code => l_asg_rec.bargaining_unit_code
6229 ,p_labour_union_member_flag => l_asg_rec.labour_union_member_flag
6230 ,p_hourly_salaried_code => l_asg_rec.hourly_salaried_code
6231 ,p_ass_attribute_category => l_asg_rec.ass_attribute_category
6232 ,p_ass_attribute1 => l_asg_rec.ass_attribute1
6233 ,p_ass_attribute2 => l_asg_rec.ass_attribute2
6234 ,p_ass_attribute3 => l_asg_rec.ass_attribute3
6235 ,p_ass_attribute4 => l_asg_rec.ass_attribute4
6236 ,p_ass_attribute5 => l_asg_rec.ass_attribute5
6237 ,p_ass_attribute6 => l_asg_rec.ass_attribute6
6238 ,p_ass_attribute7 => l_asg_rec.ass_attribute7
6239 ,p_ass_attribute8 => l_asg_rec.ass_attribute8
6240 ,p_ass_attribute9 => l_asg_rec.ass_attribute9
6241 ,p_ass_attribute10 => l_asg_rec.ass_attribute10
6242 ,p_ass_attribute11 => l_asg_rec.ass_attribute11
6243 ,p_ass_attribute12 => l_asg_rec.ass_attribute12
6244 ,p_ass_attribute13 => l_asg_rec.ass_attribute13
6245 ,p_ass_attribute14 => l_asg_rec.ass_attribute14
6246 ,p_ass_attribute15 => l_asg_rec.ass_attribute15
6247 ,p_ass_attribute16 => l_asg_rec.ass_attribute16
6248 ,p_ass_attribute17 => l_asg_rec.ass_attribute17
6249 ,p_ass_attribute18 => l_asg_rec.ass_attribute18
6250 ,p_ass_attribute19 => l_asg_rec.ass_attribute19
6251 ,p_ass_attribute20 => l_asg_rec.ass_attribute20
6252 ,p_ass_attribute21 => l_asg_rec.ass_attribute21
6253 ,p_ass_attribute22 => l_asg_rec.ass_attribute22
6254 ,p_ass_attribute23 => l_asg_rec.ass_attribute23
6255 ,p_ass_attribute24 => l_asg_rec.ass_attribute24
6256 ,p_ass_attribute25 => l_asg_rec.ass_attribute25
6257 ,p_ass_attribute26 => l_asg_rec.ass_attribute26
6258 ,p_ass_attribute27 => l_asg_rec.ass_attribute27
6259 ,p_ass_attribute28 => l_asg_rec.ass_attribute28
6260 ,p_ass_attribute29 => l_asg_rec.ass_attribute29
6261 ,p_ass_attribute30 => l_asg_rec.ass_attribute30
6262 ,p_segment1 => l_scl_rec.segment1
6263 ,p_segment2 => l_scl_rec.segment2
6264 ,p_segment3 => l_scl_rec.segment3
6265 ,p_segment4 => l_scl_rec.segment4
6266 ,p_segment5 => l_scl_rec.segment5
6267 ,p_segment6 => l_scl_rec.segment6
6268 ,p_segment7 => l_scl_rec.segment7
6269 ,p_segment8 => l_scl_rec.segment8
6270 ,p_segment9 => l_scl_rec.segment9
6271 ,p_segment10 => l_scl_rec.segment10
6272 ,p_segment11 => l_scl_rec.segment11
6273 ,p_segment12 => l_scl_rec.segment12
6274 ,p_segment13 => l_scl_rec.segment13
6275 ,p_segment14 => l_scl_rec.segment14
6276 ,p_segment15 => l_scl_rec.segment15
6277 ,p_segment16 => l_scl_rec.segment16
6278 ,p_segment17 => l_scl_rec.segment17
6279 ,p_segment18 => l_scl_rec.segment18
6280 ,p_segment19 => l_scl_rec.segment19
6281 ,p_segment20 => l_scl_rec.segment20
6282 ,p_segment21 => l_scl_rec.segment21
6283 ,p_segment22 => l_scl_rec.segment22
6284 ,p_segment23 => l_scl_rec.segment23
6285 ,p_segment24 => l_scl_rec.segment24
6286 ,p_segment25 => l_scl_rec.segment25
6287 ,p_segment26 => l_scl_rec.segment26
6288 ,p_segment27 => l_scl_rec.segment27
6289 ,p_segment28 => l_scl_rec.segment28
6290 ,p_segment29 => l_scl_rec.segment29
6291 ,p_segment30 => l_scl_rec.segment30
6292 ,p_contract_id => l_asg_rec.contract_id
6293 ,p_establishment_id => l_asg_rec.establishment_id
6294 ,p_collective_agreement_id => l_asg_rec.collective_agreement_id
6295 ,p_cagr_id_flex_num => l_asg_rec.cagr_id_flex_num
6296 ,p_cag_segment1 => l_cag_rec.segment1
6297 ,p_cag_segment2 => l_cag_rec.segment2
6298 ,p_cag_segment3 => l_cag_rec.segment3
6299 ,p_cag_segment4 => l_cag_rec.segment4
6300 ,p_cag_segment5 => l_cag_rec.segment5
6301 ,p_cag_segment6 => l_cag_rec.segment6
6302 ,p_cag_segment7 => l_cag_rec.segment7
6303 ,p_cag_segment8 => l_cag_rec.segment8
6304 ,p_cag_segment9 => l_cag_rec.segment9
6305 ,p_cag_segment10 => l_cag_rec.segment10
6306 ,p_cag_segment11 => l_cag_rec.segment11
6307 ,p_cag_segment12 => l_cag_rec.segment12
6308 ,p_cag_segment13 => l_cag_rec.segment13
6309 ,p_cag_segment14 => l_cag_rec.segment14
6310 ,p_cag_segment15 => l_cag_rec.segment15
6311 ,p_cag_segment16 => l_cag_rec.segment16
6312 ,p_cag_segment17 => l_cag_rec.segment17
6313 ,p_cag_segment18 => l_cag_rec.segment18
6314 ,p_cag_segment19 => l_cag_rec.segment19
6315 ,p_cag_segment20 => l_cag_rec.segment20
6316 ,p_notice_period => l_asg_rec.notice_period
6317 ,p_notice_period_uom => l_asg_rec.notice_period_uom
6318 ,p_employee_category => l_asg_rec.employee_category
6319 ,p_work_at_home => l_asg_rec.work_at_home
6320 ,p_job_post_source_name => l_asg_rec.job_post_source_name
6321 ,p_cagr_grade_def_id => l_dummynum1 -- Bug # 2788390 modified l_dummy to l_dummynum1.
6322 ,p_cagr_concatenated_segments => l_dummyv
6323 ,p_concatenated_segments => l_dummyv
6324 ,p_soft_coding_keyflex_id => l_dummy1
6325 ,p_comment_id => l_dummy2
6326 ,p_effective_start_date => l_effective_start_date
6327 ,p_effective_end_date => l_effective_end_date
6328 ,p_no_managers_warning => l_dummyb
6329 ,p_other_manager_warning => l_dummyb
6330 ,p_hourly_salaried_warning => l_dummyb
6331 );
6332 --
6333 p_asg_rec.soft_coding_keyflex_id := l_dummy1;
6334
6335 hr_utility.set_location(l_proc, 350);
6336
6337
6338 --Fix For Bug # 5987409 Starts -----
6339 /*
6340 UPDATE PER_ASSIGNMENTS_F PAF SET PAF.VACANCY_ID =l_asg_rec.vacancy_id ,
6341 PAF.RECRUITER_ID =l_asg_rec.recruiter_id
6342 WHERE PAF.ASSIGNMENT_ID = l_primary_asg_id AND
6343 PAF.EFFECTIVE_START_DATE = l_effective_start_date AND
6344 PAF.EFFECTIVE_END_DATE = l_effective_end_date;
6345 */
6346
6347 --Fix For Bug # 5987409 Starts -----
6348 -- vb 10376122
6349
6350 hr_utility.set_location('l_aplasg_vacancy_id'||l_aplasg_vacancy_id,180);
6351 hr_utility.set_location('l_aplasg_RECRUITER_ID'||l_aplasg_RECRUITER_ID,180);
6352
6353 hr_utility.set_location('p_asg_rec.assignment_id'||p_asg_rec.assignment_id,180);
6354 hr_utility.set_location('l_asg_rec.assignment_id'||l_asg_rec.assignment_id,180);
6355
6356 UPDATE PER_ASSIGNMENTS_F PAF SET PAF.VACANCY_ID =l_aplasg_vacancy_id ,
6357 PAF.RECRUITER_ID = l_aplasg_RECRUITER_ID
6358 WHERE PAF.ASSIGNMENT_ID = l_primary_asg_id AND
6359 PAF.EFFECTIVE_START_DATE = l_effective_start_date AND
6360 PAF.EFFECTIVE_END_DATE = l_effective_end_date;
6361
6362 open csr_get_asg_type_id(l_primary_asg_id);
6363 fetch csr_get_asg_type_id into l_asg_type_id;
6364 close csr_get_asg_type_id;
6365
6366
6367 -- vb 10376122
6368
6369
6370
6371 -- bug 10376122 new
6372 if l_aplasg_vacancy_id is not null then --fix for bug8488222
6373 IRC_ASG_STATUS_API.create_irc_asg_status
6374 (p_assignment_id => l_primary_asg_id
6375 ,p_assignment_status_type_id => l_asg_type_id
6376 ,p_status_change_date => l_hire_date
6377 ,p_assignment_status_id => l_asg_status_id
6378 ,p_object_version_number => l_asg_status_ovn);
6379 end if;
6380 -- End of fix 3564129
6381 -- Start of fix 7289811
6382 IRC_OFFERS_API.close_offer
6383 ( p_validate => false
6384 ,p_effective_date => l_hire_date-1
6385 ,p_applicant_assignment_id => l_asg_rec.assignment_id
6386 ,p_change_reason => 'APL_HIRED'-- Fix for bug 7540870
6387 );
6388 --
6389 -- bug 10376122 new
6390 -- now end date the application
6391 --
6392 per_asg_del.del
6393 (p_assignment_id => l_asg_rec.assignment_id
6394 ,p_effective_start_date => l_effective_start_date
6395 ,p_effective_end_date => l_effective_end_date
6396 ,p_business_group_id => l_business_group_id
6397 ,p_object_version_number => l_asg_rec.object_version_number
6398 ,p_effective_date => l_hire_date-1
6399 ,p_validation_start_date => l_validation_start_date
6400 ,p_validation_end_date => l_validation_end_date
6401 ,p_datetrack_mode => 'DELETE'
6402 ,p_org_now_no_manager_warning => l_org_now_no_manager_warning
6403 );
6404 --
6405 hr_utility.set_location(l_proc, 360);
6406 --
6407 /*
6408 l_change_reason:=fnd_profile.value('HR_APL_CHNG_REASON'); -- 12905192
6409 if l_change_reason is not null then
6410
6411 per_people3_pkg.get_default_person_type
6412 (p_required_type => 'TERM_APL'
6413 ,p_business_group_id => l_business_group_id
6414 ,p_legislation_code => l_legislation_code
6415 ,p_person_type => l_assignment_status_type_id
6416 );
6417
6418
6419 IRC_ASG_STATUS_API.create_irc_asg_status
6420 (p_assignment_id => l_asg_rec.assignment_id
6421 , p_assignment_status_type_id => l_assignment_status_type_id
6422 , p_status_change_date => l_hire_date -- Fix for bug 6036285
6423 ,p_status_change_reason => l_change_reason --12905192
6424 , p_assignment_status_id => l_assignment_status_id
6425 , p_object_version_number => l_asg_status_ovn1);
6426
6427 IRC_OFFERS_API.close_offer
6428 ( p_validate => false
6429 ,p_effective_date => l_hire_date-1
6430 ,p_applicant_assignment_id => l_asg_rec.assignment_id
6431 ,p_change_reason => 'MANUAL_CLOSURE'
6432 );
6433
6434 end if;
6435 -- 12905192
6436 */
6437 -- added for the bug 4641965
6438 --
6439 if (p_primary_assignment_id is not null ) then
6440 l_pspl_asg_id :=p_primary_assignment_id;
6441 else
6442 l_pspl_asg_id :=asg_rec.assignment_id;
6443 end if;
6444 --start of bug 5102289
6445 open get_primary_pay_basis(l_primary_asg_id);
6446 fetch get_primary_pay_basis into l_pay_basis_id;
6447 if l_pay_basis_id = l_asg_rec.pay_basis_id then
6448 l_approved := 'N';
6449 else
6450 l_approved := 'Y';
6451 end if;
6452 close get_primary_pay_basis;
6453 --End of bug 5102289
6454
6455 OPEN get_pay_proposal(l_pspl_asg_id);
6456 FETCH get_pay_proposal INTO l_pay_pspl_id,l_pay_obj_number,l_proposed_sal_n, l_dummy_change_date,l_proposal_reason; --Added Proposal_Reason For Bug # 5987409 --
6457 if get_pay_proposal%found then
6458 /* l_pay_pspl_id:=null;
6459 l_pay_obj_number:=null;
6460 open get_primary_proposal (l_primary_asg_id);
6461 fetch get_primary_proposal into l_pay_pspl_id,l_pay_obj_number;
6462 if get_primary_proposal%found then
6463 close get_primary_proposal; */
6464 update per_pay_proposals set assignment_id = l_primary_asg_id
6465 where pay_proposal_id = l_pay_pspl_id;
6466 l_pay_obj_number := l_pay_obj_number + 1;
6467 hr_maintain_proposal_api.cre_or_upd_salary_proposal(
6468 p_validate => false,
6469 p_pay_proposal_id => l_pay_pspl_id ,
6470 p_object_version_number => l_pay_obj_number,
6471 p_change_date => p_hire_date,
6472 p_approved => 'Y', -- l_approved for bug 13550269
6473 p_inv_next_sal_date_warning => l_inv_next_sal_date_warning,
6474 p_proposed_salary_warning => l_proposed_salary_warning,
6475 p_approved_warning => l_approved_warning,
6476 p_payroll_warning => l_payroll_warning,
6477 p_proposed_salary_n => l_proposed_sal_n,
6478 p_business_group_id => l_business_group_id,
6479 p_proposal_reason => l_proposal_reason);
6480 /* else
6481 close get_primary_proposal;
6482 l_pay_pspl_id:=null;
6483 l_pay_obj_number:=null;
6484 hr_maintain_proposal_api.cre_or_upd_salary_proposal(
6485 p_validate => false,
6486 p_pay_proposal_id => l_pay_pspl_id,
6487 p_assignment_id => l_primary_asg_id,
6488 p_object_version_number => l_pay_obj_number,
6489 p_change_date => p_hire_date,
6490 p_approved => l_approved,
6491 p_inv_next_sal_date_warning => l_inv_next_sal_date_warning,
6492 p_proposed_salary_warning => l_proposed_salary_warning,
6493 p_approved_warning => l_approved_warning,
6494 p_payroll_warning => l_payroll_warning,
6495 p_proposed_salary_n => l_proposed_sal_n,
6496 p_business_group_id => l_business_group_id,
6497 p_proposal_reason => l_proposal_reason);
6498
6499 end if; */
6500 --
6501 end if;
6502 --
6503 close get_pay_proposal;
6504 --
6505 -- end of bug 4641965
6506 end if;
6507
6508 if per_otherbg_apl_api.isMultiRegVac(asg_rec.assignment_id) then
6509 per_otherbg_apl_api.close_otherbg_applications(asg_rec.assignment_id,l_hire_date-1,'HIRE_CLOSE');
6510 end if;
6511
6512 --
6513 --Bug 4959033
6514
6515 open get_business_group(l_primary_asg_id);
6516 fetch get_business_group into l_bg_id;
6517 --
6518 if get_business_group%NOTFOUND then
6519 close get_business_group;
6520 l_bg_id := hr_general.get_business_group_id;
6521 else
6522 close get_business_group;
6523 end if;
6524 --
6525 hrentmnt.maintain_entries_asg (
6526 p_assignment_id => l_primary_asg_id,
6527 p_business_group_id => l_bg_id,
6528 p_operation => 'ASG_CRITERIA',
6529 p_actual_term_date => null,
6530 p_last_standard_date => null,
6531 p_final_process_date => null,
6532 p_dt_mode => 'UPDATE',
6533 p_validation_start_date => l_effective_start_date,
6534 p_validation_end_date => l_effective_end_date
6535 );
6536 -- End of Bug 4959033
6537 open csr_vacs(l_asg_rec.vacancy_id);
6538 fetch csr_vacs into l_dummy;
6539 if csr_vacs%found then
6540 close csr_vacs;
6541 l_oversubscribed_vacancy_id :=l_asg_rec.vacancy_id;
6542 else
6543 close csr_vacs;
6544 end if;
6545 --
6546 end loop;
6547 --
6548 hr_utility.set_location(l_proc,370);
6549
6550 -- ER FPT
6551 for apl in fut_asg_rec
6552 loop
6553 hr_utility.set_location('Processing Assignment ID = '||apl.assignment_id,195);
6554
6555 l_fpt_hire_flag :='Y';
6556
6557 -- retrieve the max end date of the ASG to update the APLN date_end
6558 select max(effective_end_date) into l_apl_end_date
6559 from per_all_assignments_f
6560 where person_id = p_person_id
6561 and assignment_id = apl.assignment_id
6562 and assignment_type = 'A';
6563
6564 if l_apl_end_date = hr_api.g_eot then
6565 l_apl_end_date := null;
6566 end if;
6567
6568 -- check whether an application exists on the start date of the ASG
6569 open chk_apl_exists(apl.effective_start_date);
6570 fetch chk_apl_exists into l_cur_apl_id, l_current_apl_end_date;
6571 if chk_apl_exists%notfound then
6572
6573 -- creating APLN since not found
6574 SELECT per_applications_s.nextval into l_new_application_id FROM sys.dual;
6575 l_cur_apl_id := l_new_application_id;
6576 begin
6577 INSERT INTO PER_APPLICATIONS(
6578 application_id,
6579 business_group_id,
6580 person_id,
6581 date_received,
6582 date_end)
6583
6584 VALUES (l_new_application_id,l_business_group_id,p_person_id,apl.effective_start_date,l_apl_end_date);
6585
6586 exception
6587 when others then
6588 raise;
6589 end ;
6590
6591 else
6592
6593 -- if APLN end date < ASG end date, update the APLN
6594 if nvl(l_current_apl_end_date,hr_api.g_eot) < nvl(l_apl_end_date,hr_api.g_eot) then
6595 update per_applications
6596 set date_end = l_apl_end_date
6597 where person_id = p_person_id
6598 and application_id = l_cur_apl_id;
6599 end if;
6600
6601 end if;
6602
6603 close chk_apl_exists;
6604
6605 -- update the ASG with the correct APLN ID
6606 update per_all_assignments_f
6607 set application_id = l_cur_apl_id
6608 where person_id = p_person_id
6609 and assignment_id = apl.assignment_id
6610 and effective_start_date = apl.effective_start_date
6611 and effective_end_date = apl.effective_end_date;
6612
6613 end loop;
6614
6615 if nvl(l_fpt_hire_flag,'N') = 'Y' then
6616
6617 hr_utility.set_location('HR_EMPLOYEE_APPLICANT_API.HIRE_EMPLOYEE_APPLICANT',277);
6618
6619 -- loop through the future applications > hire date
6620 for apl in csr_get_apln_details(l_hire_date)
6621 loop
6622 l_person_type_id1 := hr_person_type_usage_info.get_default_person_type_id
6623 (l_business_group_id,'APL');
6624
6625 -- creating APL records in PTU table
6626 hr_per_type_usage_internal.maintain_person_type_usage
6627 (p_effective_date => apl.date_received
6628 ,p_person_id => p_person_id
6629 ,p_person_type_id => l_person_type_id1);
6630
6631 l_person_type_id1 := hr_person_type_usage_info.get_default_person_type_id
6632 (l_business_group_id,'EMP_APL');
6633
6634 select object_version_number into l_per_object_version_number
6635 from per_all_people_f
6636 where person_id = p_person_id
6637 and apl.date_received between effective_start_date and effective_end_date;
6638
6639 -- creating EMP_APL records in PER table
6640
6641 per_per_upd.upd
6642 (p_person_id => p_person_id
6643 ,p_effective_date => apl.date_received
6644 ,p_applicant_number => l_applicant_number
6645 ,p_employee_number => l_employee_number
6646 ,p_person_type_id => l_person_type_id1
6647 ,p_object_version_number => l_per_object_version_number
6648 ,p_datetrack_mode => 'UPDATE'
6649 ,p_effective_start_date => l_per_effective_start_date
6650 ,p_effective_end_date => l_per_effective_end_date
6651 ,p_comment_id => l_comment_id
6652 ,p_current_applicant_flag => l_current_applicant_flag
6653 ,p_current_emp_or_apl_flag => l_current_emp_or_apl_flag
6654 ,p_current_employee_flag => l_current_employee_flag
6655 ,p_full_name => l_full_name
6656 ,p_name_combination_warning => l_name_combination_warning
6657 ,p_dob_null_warning => p_assign_payroll_warning
6658 ,p_orig_hire_warning => l_orig_hire_warning
6659 ,p_npw_number => l_npw_number
6660 );
6661
6662 if nvl(apl.date_end,hr_api.g_eot) <> hr_api.g_eot then
6663
6664 -- check whether back-to-back application exists
6665
6666 open csr_back_toback_apln(apl.date_end) ;
6667 fetch csr_back_toback_apln into l_yes_backtoback;
6668 close csr_back_toback_apln;
6669
6670 if l_yes_backtoback ='N' then
6671
6672 l_person_type_id1 := hr_person_type_usage_info.get_default_person_type_id
6673 (l_business_group_id,'EX_APL');
6674
6675 -- creating EX_APL records in PTU table
6676 hr_per_type_usage_internal.maintain_person_type_usage
6677 (p_effective_date => apl.date_end + 1
6678 ,p_person_id => p_person_id
6679 ,p_person_type_id => l_person_type_id1
6680 );
6681
6682 select object_version_number into l_per_object_version_number
6683 from per_all_people_f
6684 where person_id= p_person_id
6685 and apl.date_end between effective_start_date and effective_end_date;
6686
6687 l_person_type_id1 := hr_person_type_usage_info.get_default_person_type_id
6688 (l_business_group_id,'EMP');
6689
6690 -- creating EMP records in PER table
6691 per_per_upd.upd
6692 (p_person_id => p_person_id
6693 ,p_effective_date => apl.date_end + 1
6694 ,p_applicant_number => l_applicant_number
6695 ,p_employee_number => l_employee_number
6696 ,p_person_type_id => l_person_type_id1
6697 ,p_object_version_number => l_per_object_version_number
6698 ,p_datetrack_mode => 'UPDATE'
6699 ,p_effective_start_date => l_per_effective_start_date
6700 ,p_effective_end_date => l_per_effective_end_date
6701 ,p_comment_id => l_comment_id
6702 ,p_current_applicant_flag => l_current_applicant_flag
6703 ,p_current_emp_or_apl_flag => l_current_emp_or_apl_flag
6704 ,p_current_employee_flag => l_current_employee_flag
6705 ,p_full_name => l_full_name
6706 ,p_name_combination_warning => l_name_combination_warning
6707 ,p_dob_null_warning => p_assign_payroll_warning
6708 ,p_orig_hire_warning => l_orig_hire_warning
6709 ,p_npw_number => l_npw_number
6710 );
6711
6712 END IF;
6713
6714 end if;
6715
6716 end loop;
6717
6718 end if;
6719
6720 -- ER FPT
6721
6722 -- Maintain person type usage record
6723 --
6724 -- PTU : Commented call to maintain_ptu
6725
6726 -- hr_per_type_usage_internal.maintain_ptu
6727 -- (p_person_id => p_person_id
6728 -- ,p_action => 'TERM_APL'
6729 -- ,p_business_group_id => l_business_group_id
6730 -- ,p_actual_termination_date => l_hire_date
6731 -- );
6732 --
6733 -- Call After Process User Hook for hire_employee_applicant
6734 --
6735 begin
6736 hr_employee_applicant_bk2.hire_employee_applicant_a
6737 (
6738 p_hire_date => l_hire_date,
6739 p_person_id => p_person_id,
6740 p_primary_assignment_id => p_primary_assignment_id,
6741 p_overwrite_primary => p_overwrite_primary,
6742 p_person_type_id => p_person_type_id,
6743 p_per_object_version_number => l_per_object_version_number,
6744 p_per_effective_start_date => l_per_effective_start_date,
6745 p_per_effective_end_date => l_per_effective_end_date,
6746 p_unaccepted_asg_del_warning => l_unaccepted_asg_del_warning,
6747 p_assign_payroll_warning => l_assign_payroll_warning,
6748 p_oversubscribed_vacancy_id => l_oversubscribed_vacancy_id
6749 );
6750 exception
6751 when hr_api.cannot_find_prog_unit then
6752 hr_api.cannot_find_prog_unit_error
6753 (p_module_name => 'HIRE_EMPLOYEE_APPLICANT'
6754 ,p_hook_type => 'AP'
6755 );
6756 --
6757 -- End of the after hook for hire_employee_applicant
6758 --
6759 end;
6760 --
6761 -- When in validation only mode raise the Validate_Enabled exception
6762 --
6763 if p_validate then
6764 raise hr_api.validate_enabled;
6765 end if;
6766 --
6767 -- Set OUT parameters
6768 --
6769 p_per_object_version_number := l_per_object_version_number;
6770 p_per_effective_start_date := l_per_effective_start_date;
6771 p_per_effective_end_date := l_per_effective_end_date;
6772 p_unaccepted_asg_del_warning := l_unaccepted_asg_del_warning;
6773 p_assign_payroll_warning := l_assign_payroll_warning;
6774 p_oversubscribed_vacancy_id := l_oversubscribed_vacancy_id ;
6775 --
6776 hr_utility.set_location(' Leaving:'||l_proc, 380);
6777 --
6778 exception
6779 when hr_api.validate_enabled then
6780 --
6781 -- As the Validate_Enabled exception has been raised
6782 -- we must rollback to the savepoint
6783 --
6784 ROLLBACK TO hire_employee_applicant;
6785 --
6786 -- Only set output warning arguments
6787 -- (Any key or derived arguments must be set to null
6788 -- when validation only mode is being used.)
6789 -- Set OUT parameters to null
6790 --
6791 p_per_object_version_number := null;
6792 p_per_effective_start_date := null;
6793 p_per_effective_end_date := null;
6794 p_unaccepted_asg_del_warning := l_unaccepted_asg_del_warning;
6795 p_assign_payroll_warning := l_assign_payroll_warning;
6796 p_oversubscribed_vacancy_id := l_oversubscribed_vacancy_id ;
6797 --
6798 hr_utility.set_location(' Leaving:'||l_proc, 390);
6799 --
6800 when others then
6801 --
6802 -- A validation or unexpected error has occurred
6803 --
6804 p_per_object_version_number := l_ovn;
6805 p_per_effective_start_date := null;
6806 p_per_effective_end_date := null;
6807 p_oversubscribed_vacancy_id := null;
6808 p_unaccepted_asg_del_warning := false;
6809 p_assign_payroll_warning := false;
6810 ROLLBACK TO hire_employee_applicant;
6811 --
6812 --
6813 -- set in out parameters and set out parameters
6814 --
6815
6816 hr_utility.set_location(' Leaving:'||l_proc, 400);
6817 raise;
6818 end hire_employee_applicant;
6819 --
6820 --
6821 END hr_employee_applicant_api;