DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PDP_BUS

Source


1 Package Body per_pdp_bus as
2 /* $Header: pepdprhi.pkb 115.8 2004/01/29 05:53:10 adudekul noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_pdp_bus.';  -- Global package name
9 --
10 -- The following two global variables are only to be
11 -- used by the return_legislation_code function.
12 --
13 g_legislation_code            varchar2(150)  default null;
14 g_period_of_placement_id      number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_period_of_placement_id               in number
22   ,p_associated_column1                   in varchar2 default null
23   ) is
24   --
25   -- Declare cursor
26   --
27   cursor csr_sec_grp is
28     select pbg.security_group_id
29       from per_business_groups pbg
30          , per_periods_of_placement pdp
31      where pdp.period_of_placement_id = p_period_of_placement_id
32        and pbg.business_group_id = pdp.business_group_id;
33   --
34   -- Declare local variables
35   --
36   l_security_group_id number;
37   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
38   --
39 begin
40   --
41   hr_utility.set_location('Entering:'|| l_proc, 10);
42   --
43   -- Ensure that all the mandatory parameter are not null
44   --
45   hr_api.mandatory_arg_error
46     (p_api_name           => l_proc
47     ,p_argument           => 'period_of_placement_id'
48     ,p_argument_value     => p_period_of_placement_id
49     );
50   --
51   open csr_sec_grp;
52   fetch csr_sec_grp into l_security_group_id;
53   --
54   if csr_sec_grp%notfound then
55      --
56      close csr_sec_grp;
57      --
58      -- The primary key is invalid therefore we must error
59      --
60      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
61      hr_multi_message.add
62        (p_associated_column1
63         => nvl(p_associated_column1,'PERIOD_OF_PLACEMENT_ID')
64        );
65      --
66   else
67     close csr_sec_grp;
68     --
69     -- Set the security_group_id in CLIENT_INFO
70     --
71     hr_api.set_security_group_id
72       (p_security_group_id => l_security_group_id
73       );
74   end if;
75   --
76   hr_utility.set_location(' Leaving:'|| l_proc, 20);
77   --
78 end set_security_group_id;
79 --
80 --  ---------------------------------------------------------------------------
81 --  |---------------------< return_legislation_code >-------------------------|
82 --  ---------------------------------------------------------------------------
83 --
84 Function return_legislation_code
85   (p_period_of_placement_id               in     number
86   )
87   Return Varchar2 Is
88   --
89   -- Declare cursor
90   --
91  cursor csr_leg_code is
92     select pbg.legislation_code
93       from per_business_groups pbg
94          , per_periods_of_placement pdp
95      where pdp.period_of_placement_id = p_period_of_placement_id
96        and pbg.business_group_id = pdp.business_group_id;
97   --
98   -- Declare local variables
99   --
100   l_legislation_code  varchar2(150);
101   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
102   --
103 Begin
104   --
105   hr_utility.set_location('Entering:'|| l_proc, 10);
106   --
107   -- Ensure that all the mandatory parameter are not null
108   --
109   hr_api.mandatory_arg_error
110     (p_api_name           => l_proc
111     ,p_argument           => 'period_of_placement_id'
112     ,p_argument_value     => p_period_of_placement_id
113     );
114   --
115   if ( nvl(per_pdp_bus.g_period_of_placement_id, hr_api.g_number)
116        = p_period_of_placement_id) then
117     --
118     -- The legislation code has already been found with a previous
119     -- call to this function. Just return the value in the global
120     -- variable.
121     --
122     l_legislation_code := per_pdp_bus.g_legislation_code;
123     hr_utility.set_location(l_proc, 20);
124   else
125     --
126     -- The ID is different to the last call to this function
127     -- or this is the first call to this function.
128     --
129     open csr_leg_code;
130     fetch csr_leg_code into l_legislation_code;
131     --
132     if csr_leg_code%notfound then
133       --
134       -- The primary key is invalid therefore we must error
135       --
136       close csr_leg_code;
137       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
138       fnd_message.raise_error;
139     end if;
140     hr_utility.set_location(l_proc,30);
141     --
142     -- Set the global variables so the values are
143     -- available for the next call to this function.
144     --
145     close csr_leg_code;
146     per_pdp_bus.g_period_of_placement_id      := p_period_of_placement_id;
147     per_pdp_bus.g_legislation_code  := l_legislation_code;
148   end if;
149   hr_utility.set_location(' Leaving:'|| l_proc, 40);
150   return l_legislation_code;
151 end return_legislation_code;
152 --
153 -- ---------------------------------------------------------------------------
154 -- |--------------< return_period_of_placement_id >--------------------------|
155 -- ---------------------------------------------------------------------------
156 --
157 function return_period_of_placement_id
158   (p_person_id                            in number
159   ,p_date_start                           in date
160   ) return number is
161 
162   cursor c_get_period_of_placement_id is
163     select pdp.period_of_placement_id
164     from   per_periods_of_placement pdp
165     where  pdp.person_id = p_person_id
166     and    pdp.date_start = p_date_start;
167 
168   l_proc  varchar2(72) := g_package||'return_period_of_placement_id';
169   l_period_of_placement_id  number;
170 
171 begin
172   hr_utility.set_location('Entering:'||l_proc, 5);
173 
174   open  c_get_period_of_placement_id;
175   fetch c_get_period_of_placement_id into l_period_of_placement_id;
176   close c_get_period_of_placement_id;
177 
178   if l_period_of_placement_id is null then
179     --
180     -- The record does not exist for the person_id / date_start
181     -- combination. Raise an error.
182     --
183     fnd_message.set_name('PER','HR_289609_PDP_NOT_EXISTS');
184     fnd_message.raise_error;
185   end if;
186 
187   --
188   -- Return the period_of_placement_id
189   --
190   hr_utility.set_location('Leaving:'||l_proc, 10);
191 
192   return l_period_of_placement_id;
193 
194 end return_period_of_placement_id;
195 --
196 --  ---------------------------------------------------------------------------
197 --  |---------------------< chk_actual_termination_date >---------------------|
198 --  ---------------------------------------------------------------------------
199 --
200 --  Description:
201 --    Validates that the following business rules are met:
202 --    a)      Must be <= LAST_STANDARD_PROCESS_DATE (U)
203 --    b)      Must be >= DATE_START (U)
204 --    c)      Must be null (I)
205 --    d)      Cannot be changed from one not null value to another (U)
206 --    e)      Must be after initial insert date of last assignment (U)
207 --    f)      Must be after effective start date of last future change(s) (U)
208 --
209 --  Pre-conditions:
210 --    person_id, date_start, last_standard_process_date and period_of_placement_id
211 --    have been successfully validated separately.
212 --
213 --  In Arguments:
214 --    p_actual_termination_date
215 --    p_date_start
216 --    p_last_standard_process_date
217 --    p_object_version_number
218 --    p_period_of_placement_id
219 --    p_person_id
220 --
221 --  Post Success:
222 --    If the above business rules are satisfied then processing continues.
223 --
224 --  Post Failure:
225 --    If the above business rules then an application error will be raised and
226 --    processing is terminated.
227 --
228 --  Access Status:
229 --   Internal Table Handler Use Only.
230 --
231 -- {End Of Comments}
232 -- ----------------------------------------------------------------------------
233 --
234 procedure chk_actual_termination_date
235 --
236   (p_actual_termination_date    in date
237   ,p_date_start                 in date
238   ,p_last_standard_process_date in date
239   ,p_object_version_number      in number
240   ,p_period_of_placement_id     in number
241   ,p_person_id                  in number
242   ) is
243 --
244    l_api_updating          boolean;
245    l_no_data_found         boolean;
246    l_effective_start_date  date;
247    l_assignment_id         number;
248    l_proc                  varchar2(72) := g_package||
249                                            'chk_actual_termination_date';
250    --
251    cursor csr_get_max_asg_start_date is
252      select min(asg.effective_start_date)
253            ,assignment_id
254      from   per_all_assignments_f asg
255      where  asg.period_of_placement_date_start = p_date_start
256      and    asg.person_id = p_person_id
257      group by asg.assignment_id
258      order by 1 desc;
259    --
260    cursor csr_get_max_per_eff_date is
261      select max(per.effective_start_date)
262      from   per_all_people_f per
263      where  per.person_id = p_person_id;
264 --
265 begin
266   hr_utility.set_location('Entering:'|| l_proc, 10);
267 
268   --
269   -- Only proceed with validation when the Multiple Message List
270   -- does not already contain an error associated with the
271   -- below columns.
272   --
273 
274   if hr_multi_message.no_exclusive_error
275        (p_check_column1      => per_pdp_shd.g_tab_nam||
276                                '.LAST_STANDARD_PROCESS_DATE'
277        ,p_associated_column1 => per_pdp_shd.g_tab_nam||
278                                '.LAST_STANDARD_PROCESS_DATE'
279        ) then
280 
281   --
282   hr_utility.set_location(l_proc, 20);
283   --
284   -- Check to see if record updated.
285   --
286   l_api_updating := per_pdp_shd.api_updating
287          (p_period_of_placement_id  => p_period_of_placement_id
288          ,p_object_version_number   => p_object_version_number);
289   --
290   hr_utility.set_location(l_proc, 30);
291   --
292   if l_api_updating
293   then
294     --
295     if  nvl(per_pdp_shd.g_old_rec.actual_termination_date, hr_api.g_date) <>
296         nvl(p_actual_termination_date, hr_api.g_date)
297     and p_actual_termination_date is not null
298     then
299       hr_utility.set_location(l_proc, 40);
300       --
301       if per_pdp_shd.g_old_rec.actual_termination_date is not null
302       then
303         --
304         -- Cannot be changed from one not null value to another not null value.
305         -- CHK_ACTUAL_TERMINATION_DATE / d
306         --
307         hr_utility.set_message(801,'HR_7955_PDS_INV_ATT_CHANGE');
308         hr_utility.raise_error;
309       end if;
310       hr_utility.set_location(l_proc, 60);
311       --
312       if p_actual_termination_date > p_last_standard_process_date and
313         p_last_standard_process_date is not null                 then
314         --
315         -- CHK_ACTUAL_TERMINATION_DATE / a
316         --
317         hr_utility.set_message(801,'HR_7505_PDS_INV_LSP_ATT_DT');
318         hr_utility.raise_error;
319       end if;
320       hr_utility.set_location(l_proc, 70);
321       --
322       if not (nvl(p_actual_termination_date, hr_api.g_eot) >=
323               p_date_start) then
324         --
325         -- CHK_ACTUAL_TERMINATION_DATE / b
326         --
327         hr_utility.set_message(801,'HR_7493_PDS_INV_ATT_DT_ST');
328         hr_utility.raise_error;
329       end if;
330       hr_utility.set_location(l_proc, 80);
331       --
332       -- Get the initial insert date of the latest assignment.
333       --
334       open csr_get_max_asg_start_date;
335       fetch csr_get_max_asg_start_date
336        into l_effective_start_date
337           , l_assignment_id;
338       --
339       if csr_get_max_asg_start_date%NOTFOUND then
340         --
341         close csr_get_max_asg_start_date;
342         hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
343         hr_utility.set_message_token('PROCEDURE', l_proc);
344         hr_utility.set_message_token('STEP', '5');
345         hr_utility.raise_error;
346         --
347       elsif (p_actual_termination_date < l_effective_start_date) then
348         --
349         -- CHK_ACTUAL_TERMINATION_DATE / e
350         --
351         close csr_get_max_asg_start_date;
352         hr_utility.set_message(801,'HR_7956_PDS_INV_ATT_DT_EARLY');
353         hr_utility.raise_error;
354       end if;
355       close csr_get_max_asg_start_date;
356       hr_utility.set_location(l_proc, 110);
357       --
358       -- Get the latest effective start date for any person future changes.
359       --
360       open csr_get_max_per_eff_date;
361       fetch csr_get_max_per_eff_date
362        into l_effective_start_date;
363       close csr_get_max_per_eff_date;
364       --
365       if l_effective_start_date is null then
366         --
367         hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
368         hr_utility.set_message_token('PROCEDURE', l_proc);
369         hr_utility.set_message_token('STEP', '10');
370         hr_utility.raise_error;
371         --
372       elsif not (p_actual_termination_date >= l_effective_start_date) then
373         --
374         -- CHK_ACTUAL_TERMINATION_DATE / f
375         --
376         hr_utility.set_message(801,'HR_7957_PDS_INV_ATT_FUTURE');
377         hr_utility.raise_error;
378       end if;
379     end if;
380     --
381   end if;
382   --
383   hr_utility.set_location(' Leaving:'|| l_proc, 120);
384 
385 end if; -- end multi_message if
386 
387 exception
388   --
389   -- When Multiple Error Detection is enabled handle the Application Errors
390   -- which have been raised by this procedure. Transfer the error to the
391   -- Multiple Message List and associate the error with the above columns.
392   --
393   when app_exception.application_exception then
394     if hr_multi_message.exception_add
395         (p_same_associated_columns => 'Y'
396         ) then
397       hr_utility.set_location(' Leaving:'|| l_proc, 130);
398       raise;
399     end if;
400     hr_utility.set_location(' Leaving:'|| l_proc, 140);
401 
402 end chk_actual_termination_date;
403 --
404 --  ---------------------------------------------------------------------------
405 --  |---------------------------< chk_date_start >----------------------------|
406 --  ---------------------------------------------------------------------------
407 --
408 --  Description:
409 --    Validates that the following business rules are met:
410 --    a)      Mandatory (I,U)
411 --    NB:     The unique combination of person_id and date_start is validated
412 --            via rule CHK_PERSON_ID_DATE_START.
413 --
414 --
415 --  Pre-conditions:
416 --    None
417 --
418 --  In Arguments:
419 --    p_date_start
420 --
421 --  Post Success:
425 --    If the above business rules then an application error will be raised and
422 --    If the above business rules are satisfied then processing continues.
423 --
424 --  Post Failure:
426 --    processing is terminated.
427 --
428 --  Access Status:
429 --   Internal Table Handler Use Only.
430 --
431 -- {End Of Comments}
432 -- ----------------------------------------------------------------------------
433 --
434 procedure chk_date_start
435 --
436   (p_date_start   in date) is
437 --
438    l_proc           varchar2(72)  :=  g_package||'chk_date_start';
439 --
440 begin
441   hr_utility.set_location('Entering:'|| l_proc, 10);
442   --
443   -- CHK_DATE_START / a
444   --
445   hr_api.mandatory_arg_error
446      (p_api_name       => l_proc
447      ,p_argument       => 'date_start'
448      ,p_argument_value => p_date_start
449      );
450   --
451   hr_utility.set_location(' Leaving:'|| l_proc, 20);
452 
453 exception
454   when app_exception.application_exception then
455     if hr_multi_message.exception_add
456          (p_associated_column1      => per_pdp_shd.g_tab_nam||'.DATE_START'
457          ) then
458       hr_utility.set_location(' Leaving:'|| l_proc, 30);
459       raise;
460     end if;
461     hr_utility.set_location(' Leaving:'|| l_proc, 40);
462 
463 end chk_date_start;
464 --
465 --  ---------------------------------------------------------------------------
466 --  |----------------------< chk_projected_term_date >------------------------|
467 --  ---------------------------------------------------------------------------
468 --
469 --  Description:
470 --    Validates that the following business rules are met:
471 --    a) p_projected_termination_date is less than p_date_start (I,U)
472 --
473 --  Pre-conditions:
474 --    None
475 --
476 --  In Arguments:
477 --    p_date_start
478 --    p_projected_termination_date
479 --    p_object_version_number
480 --    p_period_of_placement_id
481 --
482 --  Post Success:
483 --    If the above business rules are satisfied then processing continues.
484 --
485 --  Post Failure:
486 --    If the above business rules then an application error will be raised and
487 --    processing is terminated.
488 --
489 --  Access Status:
490 --   Internal Table Handler Use Only.
491 --
492 -- {End Of Comments}
493 -- ----------------------------------------------------------------------------
494 --
495 procedure chk_projected_term_date
496   (p_date_start                 in date
497   ,p_projected_termination_date in date
498   ,p_object_version_number      in number
499   ,p_period_of_placement_id     in number) is
500 --
501    l_proc           varchar2(72)  :=  g_package||'chk_projected_term_date';
502    l_api_updating   boolean;
503 --
504 begin
505   hr_utility.set_location('Entering:'|| l_proc, 10);
506   --
507   -- Check to see if record updated.
508   --
509   l_api_updating := per_pdp_shd.api_updating
510          (p_period_of_placement_id => p_period_of_placement_id
511          ,p_object_version_number  => p_object_version_number);
512   --
513   hr_utility.set_location('Entering:'|| l_proc, 20);
514   --
515   if (l_api_updating
516         AND (nvl(per_pdp_shd.g_old_rec.projected_termination_date, hr_api.g_date) <>
517              nvl(p_projected_termination_date, hr_api.g_date)))
518      OR not l_api_updating
519   then
520       if nvl(p_projected_termination_date,hr_api.g_eot) < p_date_start
521         then
522         --
523         -- CHK_PROJECTED_TERM_DATE / a
524         --
525         hr_utility.set_message(800,'HR_289745_ERR_PLACEMENT_DATE');
526         hr_utility.raise_error;
527       end if;
528   end if;
529   --
530   hr_utility.set_location(' Leaving:'|| l_proc, 30);
531 exception
532   when app_exception.application_exception then
533     if hr_multi_message.exception_add
534          (p_associated_column1      => per_pdp_shd.g_tab_nam||'.PROJECTED_TERMINATION_DATE'
535          ) then
536       hr_utility.set_location(' Leaving:'|| l_proc, 40);
537       raise;
538     end if;
539     hr_utility.set_location(' Leaving:'|| l_proc, 50);
540 end chk_projected_term_date;
541 --
542 --  ---------------------------------------------------------------------------
543 --  |------------------------<chk_final_process_date >------------------------|
544 --  ---------------------------------------------------------------------------
545 --
546 --  Description:
547 --    Validates that the following business rules are met:
548 --    a)      If the person is not assigned to any payrolls then
549 --            must be equal to ACTUAL_TERMINATION_DATE (U)
550 --    b)      If the person is assigned to a payroll then
551 --            must equal the maximum period end date of all Assignments
552 --            for the current Period of Placement (U)
553 --    c)      Must be >= LAST_STANDARD_PROCESS_DATE (U)
554 --    d)      If ACTUAL_TERMINATION_DATE is null then must be null (U)
555 --    e)      Must be null (I)
556 --
557 --  Pre-conditions:
558 --    p_date_start, actual_termination_date, last_standard_process_date and
559 --    period_of_placement_id have been successfully validated separately.
560 --
561 --  In Arguments:
562 --    p_actual_termination_date
563 --    p_date_start
564 --    p_final_process_date
568 --
565 --    p_last_standard_process_date
566 --    p_object_version_number
567 --    p_period_of_placement_id
569 --  Post Success:
570 --    If the above business rules are satisfied then processing continues.
571 --
572 --  Post Failure:
573 --    If the above business rules then an application error will be raised and
574 --    processing is terminated.
575 --
576 --  Access Status:
577 --   Internal Table Handler Use Only.
578 --
579 -- {End Of Comments}
580 -- ----------------------------------------------------------------------------
581 --
582 procedure chk_final_process_date
583   (p_actual_termination_date    in date,
584    p_date_start                 in date,
585    p_final_process_date         in date,
586    p_last_standard_process_date in date,
587    p_object_version_number      in number,
588    p_period_of_placement_id     in number) is
589 --
590    l_assigned_payroll boolean;
591    l_api_updating     boolean;
592    l_max_end_date     date;
593    l_proc             varchar2(72)  :=  g_package||'chk_final_process_date';
594 --
595 begin
596   hr_utility.set_location('Entering:'|| l_proc, 1);
597 
598   --
599   -- Only proceed with validation when the Multiple Message List
600   -- does not already contain an error associated with the
601   -- below columns.
602   --
603   if hr_multi_message.no_exclusive_error
604        (p_check_column1      => per_pdp_shd.g_tab_nam||
605                                '.LAST_STANDARD_PROCESS_DATE'
606        ,p_check_column2      => per_pdp_shd.g_tab_nam||
607                                '.ACTUAL_TERMINATION_DATE'
608        ,p_associated_column1 => per_pdp_shd.g_tab_nam||
609                                '.LAST_STANDARD_PROCESS_DATE'
610        ,p_associated_column2 => per_pdp_shd.g_tab_nam||
611                                '.ACTUAL_TERMINATION_DATE'
612        ) then
613 
614   --
615   -- Check to see if record updated.
616   --
617   l_api_updating := per_pdp_shd.api_updating
618          (p_period_of_placement_id => p_period_of_placement_id
619          ,p_object_version_number  => p_object_version_number);
620   --
621   hr_utility.set_location(l_proc, 5);
622   --
623   if l_api_updating
624   then
625     --
626     if nvl(per_pdp_shd.g_old_rec.final_process_date, hr_api.g_date) <>
627        nvl(p_final_process_date, hr_api.g_date)
628     then
629       --
630       hr_utility.set_location(l_proc, 6);
631       --
632       --
633       if  per_pdp_shd.g_old_rec.final_process_date is not null
634       and p_final_process_date is not null
635       then
636         -- CHK_FINAL_PROCESS_DATE / g
637         --
638         hr_utility.set_message(801,'HR_7962_PDS_INV_FP_CHANGE');
639         hr_utility.raise_error;
640       end if;
641       --
642       hr_utility.set_location(l_proc, 50);
643       if p_actual_termination_date is null
644       then
645         --
646         if not (p_final_process_date is null)
647         then
648           -- CHK_FINAL_PROCESS_DATE / d
649           --
650           hr_utility.set_message(801,'HR_7503_PDS_INV_FP_DT_BLANK');
651           hr_utility.raise_error;
652         end if;
653         --
654       end if;
655       --
656       hr_utility.set_location(l_proc, 7);
657       --
658       if p_last_standard_process_date is null
659       then
660         --
661         hr_utility.set_location(l_proc, 8);
662         --
663         if not (nvl(p_final_process_date, hr_api.g_eot) >=
664                 nvl(p_actual_termination_date, hr_api.g_eot))
665         then
666           -- CHK_FINAL_PROCESS_DATE / f
667           --
668           hr_utility.set_message(801,'HR_7963_PDS_INV_FP_BEFORE_ATT');
669           hr_utility.raise_error;
670         end if;
671       else
672         --
673         if not (nvl(p_final_process_date, hr_api.g_eot) >=
674                 p_last_standard_process_date)
675         --
676         then
677           -- CHK_FINAL_PROCESS_DATE / c
678           --
679           hr_utility.set_message(801,'HR_7504_PDS_INV_FP_LSP_DT');
680           hr_utility.raise_error;
681         end if;
682       end if;
683       --
684       hr_utility.set_location(l_proc, 8);
685       --
686     end if;
687   end if;
688   --
689   hr_utility.set_location(' Leaving:'|| l_proc, 14);
690 
691 end if; -- end multi_message if
692 
693 exception
694   --
695   -- Multiple Error Detection is enabled handle the Application Errors
696   -- which have been raised by this procedure. Transfer the error to the
697   -- Multiple Message List and associate the error with the above columns.
698   --
699   when app_exception.application_exception then
700     if hr_multi_message.exception_add
701         (p_same_associated_columns => 'Y'
702         ) then
703       hr_utility.set_location(' Leaving:'|| l_proc, 20);
704       raise;
705     end if;
706     hr_utility.set_location(' Leaving:'|| l_proc, 30);
707 
708 end chk_final_process_date;
709 --
710 --  ---------------------------------------------------------------------------
711 --  |-------------------< chk_last_standard_process_date >--------------------|
715 --    Validates that the following business rules are met:
712 --  ---------------------------------------------------------------------------
713 --
714 --  Description:
716 --    c)      Must be >= ACTUAL_TERMINATION_DATE (U)
717 --    e)      Must be null (I)
718 --    f)      If ACTUAL_TERMINATION_DATE is null then must be null (U)
719 --    g)      If US legislation then must be null (U)
720 --    h)      If not US legislation and ACTUAL_TERMINATION_DATE is not null
721 --            then must not be null (U)
722 --    i)      Cannot be changed from one not null value to another (U)
723 --
724 --  Pre-conditions:
725 --    p_date_start and period_of_placement_id have been successfully
726 --    validated.
727 --
728 --  In Arguments:
729 --    p_actual_termination_date
730 --    p_date_start
731 --    p_last_standard_process_date
732 --    p_object_version_number
733 --    p_period_of_placement_id
734 --
735 --  Post Success:
736 --    If the above business rules are satisfied then processing continues.
737 --
738 --  Post Failure:
739 --    If the above business rules then an application error will be raised and
740 --    processing is terminated.
741 --
742 --  Access Status:
743 --   Internal Table Handler Use Only.
744 --
745 -- {End Of Comments}
746 -- ----------------------------------------------------------------------------
747 --
748 procedure chk_last_standard_process_date
749   (p_actual_termination_date    in date
750   ,p_business_group_id          in number
751   ,p_date_start                 in date
752   ,p_last_standard_process_date in date
753   ,p_object_version_number      in number
754   ,p_period_of_placement_id     in number
755   ) is
756 --
757   l_api_updating     boolean;
758   l_assigned_payroll boolean;
759   l_legislation_code per_business_groups.legislation_code%TYPE;
760   l_max_end_date     date;
761   l_proc             varchar2(72)
762                        := g_package||'chk_last_standard_process_date';
763 --
764   cursor csr_get_legislation_code is
765     select bus.legislation_code
766     from   per_business_groups_perf bus
767     where  bus.business_group_id = p_business_group_id
768     and    rownum = 1;
769 -- Bug 3387328. Used _perf view to increase perfomance.
770 --
771 --
772 begin
773   hr_utility.set_location('Entering:'|| l_proc, 1);
774   --
775   --
776   -- Check to see if record updated.
777   --
778   l_api_updating := per_pdp_shd.api_updating
779          (p_period_of_placement_id  => p_period_of_placement_id
780          ,p_object_version_number   => p_object_version_number);
781   --
782   hr_utility.set_location(l_proc, 20);
783   --
784   if l_api_updating
785   then
786     --
787     if nvl(per_pdp_shd.g_old_rec.last_standard_process_date, hr_api.g_date) <>
788        nvl(p_last_standard_process_date, hr_api.g_date)
789     then
790       --
791       hr_utility.set_location(l_proc, 30);
792       --
793       if  per_pdp_shd.g_old_rec.last_standard_process_date is not null
794       and p_last_standard_process_date is not null
795       then
796         -- CHK_LAST_STANDARD_PROCESS_DATE / i
797         --
798         hr_utility.set_message(801,'HR_7960_PDS_INV_LSP_CHANGE');
799         hr_utility.raise_error;
800       end if;
801       --
802       hr_utility.set_location(l_proc, 40);
803       --
804       open  csr_get_legislation_code;
805       fetch csr_get_legislation_code
806        into l_legislation_code;
807       --
808       if csr_get_legislation_code%NOTFOUND
809       then
810         --
811         close csr_get_legislation_code;
812         --
813         hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
814         hr_utility.set_message_token('PROCEDURE', l_proc);
815         hr_utility.set_message_token('STEP', '5');
816         hr_utility.raise_error;
817       end if;
818       --
819       close csr_get_legislation_code;
820       --
821       hr_utility.set_location(l_proc, 50);
822       --
823 -- Bug 1711085. VS. 27-Mar-2001. Commented out the code that disables
824 -- last_standard_process for US legislature.
825 /*      if l_legislation_code = 'US'
826       then
827         --
828         hr_utility.set_location(l_proc, 60);
829         --
830         if not (p_last_standard_process_date is null)
831         then
832           -- CHK_LAST_STANDARD_PROCESS_DATE / g
833           --
834           hr_utility.set_message(801,'HR_7958_PDS_INV_US_LSP_BLANK');
835           hr_utility.raise_error;
836         end if;
837       end if;
838 */
839       --
840       if p_actual_termination_date is null
841       then
842         --
843         if not (p_last_standard_process_date is null)
844         then
845           -- CHK_LAST_STANDARD_PROCESS_DATE / f
846           --
847           hr_utility.set_message(801,'HR_7497_PDS_INV_LSP_DT_BLANK');
848           hr_utility.raise_error;
849         end if;
850         --
851       end if;
852       --
853       hr_utility.set_location(l_proc, 80);
854       --
855       if not (nvl(p_last_standard_process_date, hr_api.g_eot) >=
856               nvl(p_actual_termination_date, hr_api.g_eot))
857       --
858       then
859         -- CHK_LAST_STANDARD_PROCESS_DATE / c
860         --
864       --
861         hr_utility.set_message(801,'HR_7505_PDS_INV_LSP_ATT_DT');
862         hr_utility.raise_error;
863       end if;
865       hr_utility.set_location(l_proc, 90);
866       --
867     end if;
868     --
869     if  (nvl(per_pdp_shd.g_old_rec.actual_termination_date, hr_api.g_date) <>
870          nvl(p_actual_termination_date,hr_api.g_date) )
871          and (p_actual_termination_date is not null)
872          and l_legislation_code <> 'US'
873     then
874            hr_utility.set_location(l_proc, 100);
875            --
876            if p_last_standard_process_date is null
877            --
878            then
879            --
880            -- Must also be set to not null value if actual_termination_date
881            -- updated to not null value.
882            -- CHK_LAST_STANDARD_PROCESS_DATE / h
883            --
884               hr_utility.set_message(801,'HR_7959_PDS_INV_LSP_BLANK');
885               hr_utility.raise_error;
886            end if;
887     end if;
888     --
889   end if;
890     --
891     hr_utility.set_location(l_proc, 120);
892   --
893   hr_utility.set_location(' Leaving:'|| l_proc, 130);
894 
895 exception
896   when app_exception.application_exception then
897     if hr_multi_message.exception_add
898          (p_associated_column1      => per_pdp_shd.g_tab_nam||
899                                       '.LAST_STANDARD_PROCESS_DATE'
900          ) then
901       hr_utility.set_location(' Leaving:'|| l_proc, 140);
902       raise;
903     end if;
904     hr_utility.set_location(' Leaving:'|| l_proc, 150);
905 
906 end chk_last_standard_process_date;
907 --
908 --  ---------------------------------------------------------------------------
909 --  |-------------------------< chk_at_date_lsp_date >------------------------|
910 --  ---------------------------------------------------------------------------
911 --
912 --  Description:
913 --    Validates the following business rule :
914 --
915 --    If actual_termination_date is changed from a NULL value to
916 --    a NOT NULL value then last_standard_process_date must also
917 --    be changed to a NOT NULL value.
918 --
919 --  Pre-conditions:
920 --    actual_termination_date, last_standard_process_date have been
921 --    successfully validated separately.
922 --
923 --  In Arguments:
924 --    p_period_of_placement_id
925 --    p_actual_termination_date
926 --    p_last_standard_process_date
927 --    p_object_version_number
928 --
929 --  Post Success:
930 --    If the above business rules are satisfied then processing continues.
931 --
932 --  Post Failure:
933 --    If the above business rules then an application error will be raised and
934 --    processing is terminated.
935 --
936 --  Access Status:
937 --   Internal Table Handler Use Only.
938 --
939 -- {End Of Comments}
940 -- ----------------------------------------------------------------------------
941 --
942 procedure chk_at_date_lsp_date
943 --
944   (p_actual_termination_date    in date
945   ,p_last_standard_process_date in date
946   ,p_object_version_number      in number
947   ,p_period_of_placement_id     in number
948   ,p_business_group_id		in number
949   ) is
950 --
951   l_proc             varchar2(72) := g_package||'chk_at_date_lsp_date';
952   l_api_updating     boolean;
953   l_legislation_code per_business_groups.legislation_code%TYPE;
954 --
955  cursor csr_get_legislation_code is
956     select bus.legislation_code
957     from   per_business_groups_perf bus
958     where  bus.business_group_id = p_business_group_id
959     and    rownum = 1;
960 -- Bug 3387328. Used _perf view to improve performance.
961 --
962 begin
963   hr_utility.set_location('Entering:'|| l_proc, 1);
964 
965   --
966   -- Only proceed with validation when the Multiple Message List
967   -- does not already contain an error associated with the
968   -- below columns.
969   --
970   if hr_multi_message.no_exclusive_error
971        (p_check_column1      => per_pdp_shd.g_tab_nam||
972                                '.LAST_STANDARD_PROCESS_DATE'
973        ,p_check_column2      => per_pdp_shd.g_tab_nam||
974                                '.ACTUAL_TERMINATION_DATE'
975        ,p_associated_column1 => per_pdp_shd.g_tab_nam||
976                                '.LAST_STANDARD_PROCESS_DATE'
977        ,p_associated_column2 => per_pdp_shd.g_tab_nam||
978                                '.ACTUAL_TERMINATION_DATE'
979        ) then
980 
981   --
982   -- Check to see if record updated.
983   --
984   l_api_updating := per_pdp_shd.api_updating
985          (p_period_of_placement_id  => p_period_of_placement_id
986          ,p_object_version_number   => p_object_version_number);
987   --
988   hr_utility.set_location(l_proc, 20);
989   --
990   -- Only proceed with validation if :
991   -- a) The current g_old_rec is current and
992   -- b) The value for actual_termination_date or last_standard_process_date
993   --    has changed
994   --
995   if (l_api_updating
996     and ((nvl(per_pdp_shd.g_old_rec.actual_termination_date, hr_api.g_date)
997         <> nvl(p_actual_termination_date, hr_api.g_date))
1001     or
998         or
999         (nvl(per_pdp_shd.g_old_rec.last_standard_process_date, hr_api.g_date)
1000         <> nvl(p_last_standard_process_date, hr_api.g_date))))
1002       NOT l_api_updating then
1003     --
1004     hr_utility.set_location(l_proc, 30);
1005     --
1006       open  csr_get_legislation_code;
1007       fetch csr_get_legislation_code
1008       into l_legislation_code;
1009       --
1010       if csr_get_legislation_code%NOTFOUND
1011       then
1012         --
1013         close csr_get_legislation_code;
1014         --
1015         hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
1016         hr_utility.set_message_token('PROCEDURE', l_proc);
1017         hr_utility.set_message_token('STEP', '5');
1018         hr_utility.raise_error;
1019       end if;
1020       --
1021       close csr_get_legislation_code;
1022       --
1023       hr_utility.set_location(l_proc, 50);
1024       --
1025       if l_legislation_code <> 'US' then
1026       --
1027       -- Check combination when either actual_termination_date or
1028       -- last_standard_process_date are set
1029       --
1030         if  (per_pdp_shd.g_old_rec.actual_termination_date is null
1031             and  p_actual_termination_date is not null)
1032             and  p_last_standard_process_date is null
1033         then
1034             hr_utility.set_message(801,'HR_7959_PDS_INV_LSP_BLANK');
1035             hr_utility.raise_error;
1036         end if;
1037       --
1038       end if;
1039     --
1040   end if;
1041   --
1042   hr_utility.set_location(' Leaving:'|| l_proc, 40);
1043 
1044 end if; -- end multi_message if
1045 
1046 exception
1047   --
1048   -- Multiple Error Detection is enabled handle the Application Errors
1049   -- which have been raised by this procedure. Transfer the error to the
1050   -- Multiple Message List and associate the error with the above columns.
1051   --
1052   when app_exception.application_exception then
1053     if hr_multi_message.exception_add
1054         (p_same_associated_columns => 'Y'
1055         ) then
1056       hr_utility.set_location(' Leaving:'|| l_proc, 50);
1057       raise;
1058     end if;
1059     hr_utility.set_location(' Leaving:'|| l_proc, 60);
1060 
1061 end chk_at_date_lsp_date;
1062 --
1063 --  ---------------------------------------------------------------------------
1064 --  |---------------------< chk_termination_reason >--------------------------|
1065 --  ---------------------------------------------------------------------------
1066 --
1067 --  Description:
1068 --    Validates that the following business rules are met:
1069 --    a)      Validate against HR_LOOKUPS.lookup_code
1070 --            where LOOKUP_TYPE = 'HR_CWK_TERMINATION_REASONS' (U)
1071 --    b)      Must be null (I)
1072 --
1073 --  Pre-conditions:
1074 --    period_of_placement_id must have been successfully validated.
1075 --
1076 --  In Arguments:
1077 --    p_termination_reason
1078 --    p_effective_date
1079 --    p_object_version_number
1080 --    p_period_of_placement_id
1081 --
1082 --  Post Success:
1083 --    If the above business rules are satisfied then processing continues.
1084 --
1085 --  Post Failure:
1086 --    If the above business rules then an application error will be raised and
1087 --    processing is terminated.
1088 --
1089 --  Access Status:
1090 --   Internal Table Handler Use Only.
1091 --
1092 -- {End Of Comments}
1093 -- ----------------------------------------------------------------------------
1094 --
1095 procedure chk_termination_reason
1096 --
1097   (p_termination_reason         in varchar2,
1098    p_effective_date             in date,
1099    p_object_version_number      in number,
1100    p_period_of_placement_id     in number) is
1101 --
1102    l_api_updating boolean;
1103    l_proc         varchar2(72)  :=  g_package||'chk_termination_reason';
1104    l_rec	  per_pdp_shd.g_rec_type;
1105 --
1106 begin
1107   hr_utility.set_location('Entering:'|| l_proc, 1);
1108   --
1109   hr_api.mandatory_arg_error
1110    (p_api_name    => l_proc
1111    ,p_argument    => 'effective date'
1112    ,p_argument_value => p_effective_date
1113    );
1114   --
1115   -- Check to see if record updated.
1116   --
1117   l_api_updating := per_pdp_shd.api_updating
1118          (p_period_of_placement_id => p_period_of_placement_id
1119          ,p_object_version_number  => p_object_version_number);
1120   --
1121   hr_utility.set_location(l_proc, 2);
1122   --
1123   if  l_api_updating
1124   and p_termination_reason is not null
1125   then
1126     --
1127     if nvl(per_pdp_shd.g_old_rec.termination_reason, hr_api.g_varchar2) <>
1128        nvl(p_termination_reason, hr_api.g_varchar2)
1129     then
1130       --
1131       -- Bug 1472162.
1132       --
1133 --      if hr_api.not_exists_in_hr_lookups
1134       if hr_api.not_exists_in_leg_lookups
1135 	  (p_effective_date  => p_effective_date
1136 	  ,p_lookup_type     => 'HR_CWK_TERMINATION_REASONS'
1137 	  ,p_lookup_code     => p_termination_reason
1138 	  ) then
1139         -- Error - Invalid Termination Reason
1140         hr_utility.set_location(l_proc, 3);
1141         hr_utility.set_message(800,'HR_289610_PDP_TERM_REASON');
1142         hr_utility.raise_error;
1146     --
1143       end if;
1144       --
1145     end if;
1147   end if;
1148   --
1149   hr_utility.set_location(' Leaving:'|| l_proc, 5);
1150 
1151 exception
1152   when app_exception.application_exception then
1153     if hr_multi_message.exception_add
1154          (p_associated_column1      => per_pdp_shd.g_tab_nam||
1155                                     '.TERMINATION_REASON'
1156          ) then
1157       hr_utility.set_location(' Leaving:'|| l_proc, 10);
1158       raise;
1159     end if;
1160     hr_utility.set_location(' Leaving:'|| l_proc, 20);
1161 
1162 end chk_termination_reason;
1163 --
1164 --  ---------------------------------------------------------------------------
1165 --  |---------------------------<  chk_person_id >----------------------------|
1166 --  ---------------------------------------------------------------------------
1167 --
1168 --  Description:
1169 --    Validates that the following business rules are met:
1170 --    a)      Mandatory (I,U)
1171 --    b)      UPDATE not allowed (U)
1172 --    c)      The person_id must exist in PER_ALL_PEOPLE_F at the effective
1173 --            date (I)
1174 --    NB:     The unique combination of person_id and date_start is validated
1175 --            for uniqueness.
1176 --
1177 --  Pre-conditions:
1178 --    None
1179 --
1180 --  In Arguments:
1181 --    p_person_id
1182 --
1183 --  Post Success:
1184 --    If the above business rules are satisfied then processing continues.
1185 --
1186 --  Post Failure:
1187 --    If the above business rules then an application error will be raised and
1188 --    processing is terminated.
1189 --
1190 --  Access Status:
1191 --   Internal Table Handler Use Only.
1192 --
1193 -- {End Of Comments}
1194 -- ----------------------------------------------------------------------------
1195 --
1196 procedure chk_person_id
1197 --
1198   (p_person_id                   in number
1199   ,p_effective_date              in date
1200   ,p_business_group_id           in number) is
1201 --
1202    l_proc           varchar2(72)  :=  g_package||'chk_person_id';
1203    l_rec	    per_pdp_shd.g_rec_type;
1204    l_person_id      number;
1205 
1206    cursor c_get_person is
1207    select p.person_id
1208    from   per_all_people_f p
1209    where  p.person_id = p_person_id
1210    and    p.business_group_id = p_business_group_id
1211    and    p_effective_date between
1212           p.effective_start_date and p.effective_end_date;
1213 --
1214 begin
1215   hr_utility.set_location('Entering:'|| l_proc, 10);
1216   --
1217   -- CHK_PERSON_ID / a
1218   --
1219   hr_api.mandatory_arg_error
1220      (p_api_name       => l_proc
1221      ,p_argument       => 'person_id'
1222      ,p_argument_value => p_person_id
1223      );
1224   --
1225   hr_utility.set_location(l_proc, 20);
1226 
1227   --
1228   -- CHK_PERSON_ID / b
1229   --
1230   open  c_get_person;
1231   fetch c_get_person into l_person_id;
1232   close c_get_person;
1233 
1234   if l_person_id is null then
1235     --
1236     -- person does not exist
1237     --
1238     fnd_message.set_name('PAY','HR_7971_PER_PER_IN_PERSON');
1239     fnd_message.raise_error;
1240 
1241   end if;
1242 
1243   hr_utility.set_location(' Leaving:'|| l_proc, 30);
1244 
1245 exception
1246   when app_exception.application_exception then
1247     if hr_multi_message.exception_add
1248          (p_associated_column1      => per_pdp_shd.g_tab_nam||'.PERSON_ID'
1249          ) then
1250       hr_utility.set_location(' Leaving:'|| l_proc, 40);
1251       raise;
1252     end if;
1253     hr_utility.set_location(' Leaving:'|| l_proc, 50);
1254 
1255 end chk_person_id;
1256 --
1257 --  ---------------------------------------------------------------------------
1258 --  |-----------------------< chk_person_id_date_start >----------------------|
1259 --  ---------------------------------------------------------------------------
1260 --
1261 --  Description:
1262 --    Validates that the following business rules are met:
1263 --    a)      PERSON_ID and DATE_START combination must be unique (I)
1264 --    b)      PERSON_ID must have a CWK PTU (I,U)
1265 --
1266 --  Pre-conditions:
1267 --    person_id and date_start have been successfully validated separately.
1268 --
1269 --  In Arguments:
1270 --    p_date_start
1271 --    p_person_id
1272 --
1273 --  Post Success:
1274 --    If the above business rules are satisfied then processing continues.
1275 --
1276 --  Post Failure:
1277 --    If the above business rules then an application error will be raised and
1278 --    processing is terminated.
1279 --
1280 --  Access Status:
1281 --   Internal Table Handler Use Only.
1282 --
1283 -- {End Of Comments}
1284 -- ----------------------------------------------------------------------------
1285 --
1286 procedure chk_person_id_date_start
1287 --
1288   (p_date_start             in date,
1289    p_object_version_number  in number,
1290    p_period_of_placement_id in number,
1291    p_person_id              in number) is
1292 --
1293    l_api_updating   boolean;
1294    l_exists         varchar2(1);
1298      select null
1295    l_proc           varchar2(72)  :=  g_package||'chk_person_id_date_start';
1296 --
1297    cursor csr_new_pers_date is
1299      from   per_periods_of_placement pdp
1300      where  pdp.person_id  = p_person_id
1301      and    pdp.date_start = p_date_start;
1302 --
1303 begin
1304   hr_utility.set_location('Entering:'|| l_proc, 1);
1305   --
1306   -- Check mandatory parameters have been set
1307   --
1308   hr_api.mandatory_arg_error
1309      (p_api_name       => l_proc
1310      ,p_argument       => 'person_id'
1311      ,p_argument_value => p_person_id
1312      );
1313   hr_utility.set_location(l_proc, 4);
1314   --
1315   hr_api.mandatory_arg_error
1316      (p_api_name       => l_proc
1317      ,p_argument       => 'date_start'
1318      ,p_argument_value => p_date_start
1319      );
1320   hr_utility.set_location(l_proc, 5);
1321   --
1322   -- Check to see if record updated.
1323   --
1324   l_api_updating := per_pdp_shd.api_updating
1325          (p_period_of_placement_id => p_period_of_placement_id
1326          ,p_object_version_number  => p_object_version_number);
1327   --
1328   if not l_api_updating
1329   then
1330     --
1331     -- Check that the Person ID and Date Start combination does not exist
1332     -- on PER_PERIODS_OF_PLACEMENT
1333     --
1334     hr_utility.set_location(l_proc, 6);
1335     --
1336     open csr_new_pers_date;
1337     --
1338     fetch csr_new_pers_date into l_exists;
1339     --
1340     if csr_new_pers_date%FOUND
1341     then
1342       -- CHK_PERSON_ID_DATE_START / a
1343       --
1344       close csr_new_pers_date;
1345       hr_utility.set_message(800, 'HR_289611_PDP_EXISTS');
1346       hr_utility.raise_error;
1347     end if;
1348     --
1349     close csr_new_pers_date;
1350   end if;
1351   --
1352   hr_utility.set_location(' Leaving:'|| l_proc, 9);
1353 
1354 exception
1355   when app_exception.application_exception then
1356     if hr_multi_message.exception_add
1357          (p_associated_column1      => per_pdp_shd.g_tab_nam||'.PERSON_ID'
1358          ,p_associated_column2      => per_pdp_shd.g_tab_nam||'.DATE_START'
1359          ) then
1360       hr_utility.set_location(' Leaving:'|| l_proc, 30);
1361       raise;
1362     end if;
1363     hr_utility.set_location(' Leaving:'|| l_proc, 40);
1364 
1365 end chk_person_id_date_start;
1366 --
1367 -- ----------------------------------------------------------------------------
1368 -- |-----------------------------< chk_ddf >----------------------------------|
1369 -- ----------------------------------------------------------------------------
1370 --
1371 -- Description:
1372 --   Validates all the Developer Descriptive Flexfield values.
1373 --
1374 -- Prerequisites:
1375 --   All other columns have been validated.  Must be called as the
1376 --   last step from insert_validate and update_validate.
1377 --
1378 -- In Arguments:
1379 --   p_rec
1380 --
1381 -- Post Success:
1382 --   If the Developer Descriptive Flexfield structure column and data values
1383 --   are all valid this procedure will end normally and processing will
1384 --   continue.
1385 --
1386 -- Post Failure:
1387 --   If the Developer Descriptive Flexfield structure column value or any of
1388 --   the data values are invalid then an application error is raised as
1389 --   a PL/SQL exception.
1390 --
1391 -- Access Status:
1392 --   Internal Row Handler Use Only.
1393 --
1394 -- ----------------------------------------------------------------------------
1395 --
1396 procedure chk_ddf
1397   (p_rec in per_pdp_shd.g_rec_type
1398   ) is
1399 --
1400   l_proc   varchar2(72) := g_package || 'chk_ddf';
1401 --
1402 begin
1403   hr_utility.set_location('Entering:'||l_proc,10);
1404   --
1405   if ((p_rec.period_of_placement_id is not null)  and (
1406     nvl(per_pdp_shd.g_old_rec.information_category, hr_api.g_varchar2) <>
1407     nvl(p_rec.information_category, hr_api.g_varchar2)  or
1408     nvl(per_pdp_shd.g_old_rec.information1, hr_api.g_varchar2) <>
1409     nvl(p_rec.information1, hr_api.g_varchar2)  or
1410     nvl(per_pdp_shd.g_old_rec.information2, hr_api.g_varchar2) <>
1411     nvl(p_rec.information2, hr_api.g_varchar2)  or
1412     nvl(per_pdp_shd.g_old_rec.information3, hr_api.g_varchar2) <>
1413     nvl(p_rec.information3, hr_api.g_varchar2)  or
1414     nvl(per_pdp_shd.g_old_rec.information4, hr_api.g_varchar2) <>
1415     nvl(p_rec.information4, hr_api.g_varchar2)  or
1416     nvl(per_pdp_shd.g_old_rec.information5, hr_api.g_varchar2) <>
1417     nvl(p_rec.information5, hr_api.g_varchar2)  or
1418     nvl(per_pdp_shd.g_old_rec.information6, hr_api.g_varchar2) <>
1419     nvl(p_rec.information6, hr_api.g_varchar2)  or
1420     nvl(per_pdp_shd.g_old_rec.information7, hr_api.g_varchar2) <>
1421     nvl(p_rec.information7, hr_api.g_varchar2)  or
1422     nvl(per_pdp_shd.g_old_rec.information8, hr_api.g_varchar2) <>
1423     nvl(p_rec.information8, hr_api.g_varchar2)  or
1424     nvl(per_pdp_shd.g_old_rec.information9, hr_api.g_varchar2) <>
1425     nvl(p_rec.information9, hr_api.g_varchar2)  or
1426     nvl(per_pdp_shd.g_old_rec.information10, hr_api.g_varchar2) <>
1427     nvl(p_rec.information10, hr_api.g_varchar2)  or
1428     nvl(per_pdp_shd.g_old_rec.information11, hr_api.g_varchar2) <>
1432     nvl(per_pdp_shd.g_old_rec.information13, hr_api.g_varchar2) <>
1429     nvl(p_rec.information11, hr_api.g_varchar2)  or
1430     nvl(per_pdp_shd.g_old_rec.information12, hr_api.g_varchar2) <>
1431     nvl(p_rec.information12, hr_api.g_varchar2)  or
1433     nvl(p_rec.information13, hr_api.g_varchar2)  or
1434     nvl(per_pdp_shd.g_old_rec.information14, hr_api.g_varchar2) <>
1435     nvl(p_rec.information14, hr_api.g_varchar2)  or
1436     nvl(per_pdp_shd.g_old_rec.information15, hr_api.g_varchar2) <>
1437     nvl(p_rec.information15, hr_api.g_varchar2)  or
1438     nvl(per_pdp_shd.g_old_rec.information16, hr_api.g_varchar2) <>
1439     nvl(p_rec.information16, hr_api.g_varchar2)  or
1440     nvl(per_pdp_shd.g_old_rec.information17, hr_api.g_varchar2) <>
1441     nvl(p_rec.information17, hr_api.g_varchar2)  or
1442     nvl(per_pdp_shd.g_old_rec.information18, hr_api.g_varchar2) <>
1443     nvl(p_rec.information18, hr_api.g_varchar2)  or
1444     nvl(per_pdp_shd.g_old_rec.information19, hr_api.g_varchar2) <>
1445     nvl(p_rec.information19, hr_api.g_varchar2)  or
1446     nvl(per_pdp_shd.g_old_rec.information20, hr_api.g_varchar2) <>
1447     nvl(p_rec.information20, hr_api.g_varchar2)  or
1448     nvl(per_pdp_shd.g_old_rec.information21, hr_api.g_varchar2) <>
1449     nvl(p_rec.information21, hr_api.g_varchar2)  or
1450     nvl(per_pdp_shd.g_old_rec.information22, hr_api.g_varchar2) <>
1451     nvl(p_rec.information22, hr_api.g_varchar2)  or
1452     nvl(per_pdp_shd.g_old_rec.information23, hr_api.g_varchar2) <>
1453     nvl(p_rec.information23, hr_api.g_varchar2)  or
1454     nvl(per_pdp_shd.g_old_rec.information24, hr_api.g_varchar2) <>
1455     nvl(p_rec.information24, hr_api.g_varchar2)  or
1456     nvl(per_pdp_shd.g_old_rec.information25, hr_api.g_varchar2) <>
1457     nvl(p_rec.information25, hr_api.g_varchar2)  or
1458     nvl(per_pdp_shd.g_old_rec.information26, hr_api.g_varchar2) <>
1459     nvl(p_rec.information26, hr_api.g_varchar2)  or
1460     nvl(per_pdp_shd.g_old_rec.information27, hr_api.g_varchar2) <>
1461     nvl(p_rec.information27, hr_api.g_varchar2)  or
1462     nvl(per_pdp_shd.g_old_rec.information28, hr_api.g_varchar2) <>
1463     nvl(p_rec.information28, hr_api.g_varchar2)  or
1464     nvl(per_pdp_shd.g_old_rec.information29, hr_api.g_varchar2) <>
1465     nvl(p_rec.information29, hr_api.g_varchar2)  or
1466     nvl(per_pdp_shd.g_old_rec.information30, hr_api.g_varchar2) <>
1467     nvl(p_rec.information30, hr_api.g_varchar2) ))
1468     or (p_rec.period_of_placement_id is null)  then
1469     --
1470     -- Only execute the validation if absolutely necessary:
1471     -- a) During update, the structure column value or any
1472     --    of the attribute values have actually changed.
1473     -- b) During insert.
1474     --
1475     hr_dflex_utility.ins_or_upd_descflex_attribs
1476       (p_appl_short_name                 => 'PER'
1477       ,p_descflex_name                   => 'PER_PDP_DEVELOPER_DF'
1478       ,p_attribute_category              => p_rec.information_category
1479       ,p_attribute1_name                 => 'INFORMATION1'
1480       ,p_attribute1_value                => p_rec.information1
1481       ,p_attribute2_name                 => 'INFORMATION2'
1482       ,p_attribute2_value                => p_rec.information2
1483       ,p_attribute3_name                 => 'INFORMATION3'
1484       ,p_attribute3_value                => p_rec.information3
1485       ,p_attribute4_name                 => 'INFORMATION4'
1486       ,p_attribute4_value                => p_rec.information4
1487       ,p_attribute5_name                 => 'INFORMATION5'
1488       ,p_attribute5_value                => p_rec.information5
1489       ,p_attribute6_name                 => 'INFORMATION6'
1490       ,p_attribute6_value                => p_rec.information6
1491       ,p_attribute7_name                 => 'INFORMATION7'
1492       ,p_attribute7_value                => p_rec.information7
1493       ,p_attribute8_name                 => 'INFORMATION8'
1494       ,p_attribute8_value                => p_rec.information8
1495       ,p_attribute9_name                 => 'INFORMATION9'
1496       ,p_attribute9_value                => p_rec.information9
1497       ,p_attribute10_name                => 'INFORMATION10'
1498       ,p_attribute10_value               => p_rec.information10
1499       ,p_attribute11_name                => 'INFORMATION11'
1500       ,p_attribute11_value               => p_rec.information11
1501       ,p_attribute12_name                => 'INFORMATION12'
1502       ,p_attribute12_value               => p_rec.information12
1503       ,p_attribute13_name                => 'INFORMATION13'
1504       ,p_attribute13_value               => p_rec.information13
1505       ,p_attribute14_name                => 'INFORMATION14'
1506       ,p_attribute14_value               => p_rec.information14
1507       ,p_attribute15_name                => 'INFORMATION15'
1508       ,p_attribute15_value               => p_rec.information15
1509       ,p_attribute16_name                => 'INFORMATION16'
1510       ,p_attribute16_value               => p_rec.information16
1511       ,p_attribute17_name                => 'INFORMATION17'
1512       ,p_attribute17_value               => p_rec.information17
1513       ,p_attribute18_name                => 'INFORMATION18'
1514       ,p_attribute18_value               => p_rec.information18
1515       ,p_attribute19_name                => 'INFORMATION19'
1516       ,p_attribute19_value               => p_rec.information19
1517       ,p_attribute20_name                => 'INFORMATION20'
1518       ,p_attribute20_value               => p_rec.information20
1522       ,p_attribute22_value               => p_rec.information22
1519       ,p_attribute21_name                => 'INFORMATION21'
1520       ,p_attribute21_value               => p_rec.information21
1521       ,p_attribute22_name                => 'INFORMATION22'
1523       ,p_attribute23_name                => 'INFORMATION23'
1524       ,p_attribute23_value               => p_rec.information23
1525       ,p_attribute24_name                => 'INFORMATION24'
1526       ,p_attribute24_value               => p_rec.information24
1527       ,p_attribute25_name                => 'INFORMATION25'
1528       ,p_attribute25_value               => p_rec.information25
1529       ,p_attribute26_name                => 'INFORMATION26'
1530       ,p_attribute26_value               => p_rec.information26
1531       ,p_attribute27_name                => 'INFORMATION27'
1532       ,p_attribute27_value               => p_rec.information27
1533       ,p_attribute28_name                => 'INFORMATION28'
1534       ,p_attribute28_value               => p_rec.information28
1535       ,p_attribute29_name                => 'INFORMATION29'
1536       ,p_attribute29_value               => p_rec.information29
1537       ,p_attribute30_name                => 'INFORMATION30'
1538       ,p_attribute30_value               => p_rec.information30
1539       );
1540   end if;
1541   --
1542   hr_utility.set_location(' Leaving:'||l_proc,20);
1543 end chk_ddf;
1544 --
1545 -- ----------------------------------------------------------------------------
1546 -- |------------------------------< chk_df >----------------------------------|
1547 -- ----------------------------------------------------------------------------
1548 --
1549 -- Description:
1550 --   Validates all the Descriptive Flexfield values.
1551 --
1552 -- Prerequisites:
1553 --   All other columns have been validated.  Must be called as the
1554 --   last step from insert_validate and update_validate.
1555 --
1556 -- In Arguments:
1557 --   p_rec
1558 --
1559 -- Post Success:
1560 --   If the Descriptive Flexfield structure column and data values are
1561 --   all valid this procedure will end normally and processing will
1562 --   continue.
1563 --
1564 -- Post Failure:
1565 --   If the Descriptive Flexfield structure column value or any of
1566 --   the data values are invalid then an application error is raised as
1567 --   a PL/SQL exception.
1568 --
1569 -- Access Status:
1570 --   Internal Row Handler Use Only.
1571 --
1572 -- ----------------------------------------------------------------------------
1573 --
1574 procedure chk_df
1575   (p_rec in per_pdp_shd.g_rec_type
1576   ) is
1577 --
1578   l_proc   varchar2(72) := g_package || 'chk_df';
1579 --
1580 begin
1581   hr_utility.set_location('Entering:'||l_proc,10);
1582   --
1583   if ((p_rec.period_of_placement_id is not null)  and (
1584     nvl(per_pdp_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
1585     nvl(p_rec.attribute_category, hr_api.g_varchar2)  or
1586     nvl(per_pdp_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
1587     nvl(p_rec.attribute1, hr_api.g_varchar2)  or
1588     nvl(per_pdp_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
1589     nvl(p_rec.attribute2, hr_api.g_varchar2)  or
1590     nvl(per_pdp_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
1591     nvl(p_rec.attribute3, hr_api.g_varchar2)  or
1592     nvl(per_pdp_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
1593     nvl(p_rec.attribute4, hr_api.g_varchar2)  or
1594     nvl(per_pdp_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
1595     nvl(p_rec.attribute5, hr_api.g_varchar2)  or
1596     nvl(per_pdp_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
1597     nvl(p_rec.attribute6, hr_api.g_varchar2)  or
1598     nvl(per_pdp_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
1599     nvl(p_rec.attribute7, hr_api.g_varchar2)  or
1600     nvl(per_pdp_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
1601     nvl(p_rec.attribute8, hr_api.g_varchar2)  or
1602     nvl(per_pdp_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
1603     nvl(p_rec.attribute9, hr_api.g_varchar2)  or
1604     nvl(per_pdp_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
1605     nvl(p_rec.attribute10, hr_api.g_varchar2)  or
1606     nvl(per_pdp_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
1607     nvl(p_rec.attribute11, hr_api.g_varchar2)  or
1608     nvl(per_pdp_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
1609     nvl(p_rec.attribute12, hr_api.g_varchar2)  or
1610     nvl(per_pdp_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
1611     nvl(p_rec.attribute13, hr_api.g_varchar2)  or
1612     nvl(per_pdp_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
1613     nvl(p_rec.attribute14, hr_api.g_varchar2)  or
1614     nvl(per_pdp_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
1615     nvl(p_rec.attribute15, hr_api.g_varchar2)  or
1616     nvl(per_pdp_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
1617     nvl(p_rec.attribute16, hr_api.g_varchar2)  or
1618     nvl(per_pdp_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
1619     nvl(p_rec.attribute17, hr_api.g_varchar2)  or
1620     nvl(per_pdp_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
1621     nvl(p_rec.attribute18, hr_api.g_varchar2)  or
1622     nvl(per_pdp_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
1623     nvl(p_rec.attribute19, hr_api.g_varchar2)  or
1624     nvl(per_pdp_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
1625     nvl(p_rec.attribute20, hr_api.g_varchar2)  or
1626     nvl(per_pdp_shd.g_old_rec.attribute21, hr_api.g_varchar2) <>
1630     nvl(per_pdp_shd.g_old_rec.attribute23, hr_api.g_varchar2) <>
1627     nvl(p_rec.attribute21, hr_api.g_varchar2)  or
1628     nvl(per_pdp_shd.g_old_rec.attribute22, hr_api.g_varchar2) <>
1629     nvl(p_rec.attribute22, hr_api.g_varchar2)  or
1631     nvl(p_rec.attribute23, hr_api.g_varchar2)  or
1632     nvl(per_pdp_shd.g_old_rec.attribute24, hr_api.g_varchar2) <>
1633     nvl(p_rec.attribute24, hr_api.g_varchar2)  or
1634     nvl(per_pdp_shd.g_old_rec.attribute25, hr_api.g_varchar2) <>
1635     nvl(p_rec.attribute25, hr_api.g_varchar2)  or
1636     nvl(per_pdp_shd.g_old_rec.attribute26, hr_api.g_varchar2) <>
1637     nvl(p_rec.attribute26, hr_api.g_varchar2)  or
1638     nvl(per_pdp_shd.g_old_rec.attribute27, hr_api.g_varchar2) <>
1639     nvl(p_rec.attribute27, hr_api.g_varchar2)  or
1640     nvl(per_pdp_shd.g_old_rec.attribute28, hr_api.g_varchar2) <>
1641     nvl(p_rec.attribute28, hr_api.g_varchar2)  or
1642     nvl(per_pdp_shd.g_old_rec.attribute29, hr_api.g_varchar2) <>
1643     nvl(p_rec.attribute29, hr_api.g_varchar2)  or
1644     nvl(per_pdp_shd.g_old_rec.attribute30, hr_api.g_varchar2) <>
1645     nvl(p_rec.attribute30, hr_api.g_varchar2) ))
1646     or (p_rec.period_of_placement_id is null)  then
1647     --
1648     -- Only execute the validation if absolutely necessary:
1649     -- a) During update, the structure column value or any
1650     --    of the attribute values have actually changed.
1651     -- b) During insert.
1652     --
1653     hr_dflex_utility.ins_or_upd_descflex_attribs
1654       (p_appl_short_name                 => 'PER'
1655       ,p_descflex_name                   => 'PER_PERIODS_OF_PLACEMENT'
1656       ,p_attribute_category              => p_rec.attribute_category
1657       ,p_attribute1_name                 => 'ATTRIBUTE1'
1658       ,p_attribute1_value                => p_rec.attribute1
1659       ,p_attribute2_name                 => 'ATTRIBUTE2'
1660       ,p_attribute2_value                => p_rec.attribute2
1661       ,p_attribute3_name                 => 'ATTRIBUTE3'
1662       ,p_attribute3_value                => p_rec.attribute3
1663       ,p_attribute4_name                 => 'ATTRIBUTE4'
1664       ,p_attribute4_value                => p_rec.attribute4
1665       ,p_attribute5_name                 => 'ATTRIBUTE5'
1666       ,p_attribute5_value                => p_rec.attribute5
1667       ,p_attribute6_name                 => 'ATTRIBUTE6'
1668       ,p_attribute6_value                => p_rec.attribute6
1669       ,p_attribute7_name                 => 'ATTRIBUTE7'
1670       ,p_attribute7_value                => p_rec.attribute7
1671       ,p_attribute8_name                 => 'ATTRIBUTE8'
1672       ,p_attribute8_value                => p_rec.attribute8
1673       ,p_attribute9_name                 => 'ATTRIBUTE9'
1674       ,p_attribute9_value                => p_rec.attribute9
1675       ,p_attribute10_name                => 'ATTRIBUTE10'
1676       ,p_attribute10_value               => p_rec.attribute10
1677       ,p_attribute11_name                => 'ATTRIBUTE11'
1678       ,p_attribute11_value               => p_rec.attribute11
1679       ,p_attribute12_name                => 'ATTRIBUTE12'
1680       ,p_attribute12_value               => p_rec.attribute12
1681       ,p_attribute13_name                => 'ATTRIBUTE13'
1682       ,p_attribute13_value               => p_rec.attribute13
1683       ,p_attribute14_name                => 'ATTRIBUTE14'
1684       ,p_attribute14_value               => p_rec.attribute14
1685       ,p_attribute15_name                => 'ATTRIBUTE15'
1686       ,p_attribute15_value               => p_rec.attribute15
1687       ,p_attribute16_name                => 'ATTRIBUTE16'
1688       ,p_attribute16_value               => p_rec.attribute16
1689       ,p_attribute17_name                => 'ATTRIBUTE17'
1690       ,p_attribute17_value               => p_rec.attribute17
1691       ,p_attribute18_name                => 'ATTRIBUTE18'
1692       ,p_attribute18_value               => p_rec.attribute18
1693       ,p_attribute19_name                => 'ATTRIBUTE19'
1694       ,p_attribute19_value               => p_rec.attribute19
1695       ,p_attribute20_name                => 'ATTRIBUTE20'
1696       ,p_attribute20_value               => p_rec.attribute20
1697       ,p_attribute21_name                => 'ATTRIBUTE21'
1698       ,p_attribute21_value               => p_rec.attribute21
1699       ,p_attribute22_name                => 'ATTRIBUTE22'
1700       ,p_attribute22_value               => p_rec.attribute22
1701       ,p_attribute23_name                => 'ATTRIBUTE23'
1702       ,p_attribute23_value               => p_rec.attribute23
1703       ,p_attribute24_name                => 'ATTRIBUTE24'
1704       ,p_attribute24_value               => p_rec.attribute24
1705       ,p_attribute25_name                => 'ATTRIBUTE25'
1706       ,p_attribute25_value               => p_rec.attribute25
1707       ,p_attribute26_name                => 'ATTRIBUTE26'
1708       ,p_attribute26_value               => p_rec.attribute26
1709       ,p_attribute27_name                => 'ATTRIBUTE27'
1710       ,p_attribute27_value               => p_rec.attribute27
1711       ,p_attribute28_name                => 'ATTRIBUTE28'
1712       ,p_attribute28_value               => p_rec.attribute28
1713       ,p_attribute29_name                => 'ATTRIBUTE29'
1714       ,p_attribute29_value               => p_rec.attribute29
1715       ,p_attribute30_name                => 'ATTRIBUTE30'
1716       ,p_attribute30_value               => p_rec.attribute30
1717       );
1718   end if;
1719   --
1720   hr_utility.set_location(' Leaving:'||l_proc,20);
1721 end chk_df;
1725 -- ----------------------------------------------------------------------------
1722 --
1723 -- ----------------------------------------------------------------------------
1724 -- |-----------------------< chk_non_updateable_args >------------------------|
1726 -- {Start Of Comments}
1727 --
1728 -- Description:
1729 --   This procedure is used to ensure that non updateable attributes have
1730 --   not been updated. If an attribute has been updated an error is generated.
1731 --
1732 -- Pre Conditions:
1733 --   g_old_rec has been populated with details of the values currently in
1734 --   the database.
1735 --
1736 -- In Arguments:
1737 --   p_rec has been populated with the updated values the user would like the
1738 --   record set to.
1739 --
1740 -- Post Success:
1741 --   Processing continues if all the non updateable attributes have not
1742 --   changed.
1743 --
1744 -- Post Failure:
1745 --   An application error is raised if any of the non updatable attributes
1746 --   have been altered.
1747 --
1748 -- {End Of Comments}
1749 -- ----------------------------------------------------------------------------
1750 Procedure chk_non_updateable_args
1751   (p_effective_date               in date
1752   ,p_rec in per_pdp_shd.g_rec_type
1753   ) IS
1754 --
1755   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
1756 --
1757 Begin
1758   --
1759   -- Only proceed with the validation if a row exists for the current
1760   -- record in the HR Schema.
1761   --
1762   IF NOT per_pdp_shd.api_updating
1763       (p_period_of_placement_id            => p_rec.period_of_placement_id
1764       ,p_object_version_number             => p_rec.object_version_number
1765       ) THEN
1766      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
1767      fnd_message.set_token('PROCEDURE ', l_proc);
1768      fnd_message.set_token('STEP ', '5');
1769      fnd_message.raise_error;
1770   END IF;
1771   --
1772   --
1773 End chk_non_updateable_args;
1774 --
1775 -- ----------------------------------------------------------------------------
1776 -- |---------------------------< insert_validate >----------------------------|
1777 -- ----------------------------------------------------------------------------
1778 Procedure insert_validate
1779   (p_effective_date               in date
1780   ,p_rec                          in per_pdp_shd.g_rec_type
1781   ) is
1782 --
1783   l_proc  varchar2(72) := g_package||'insert_validate';
1784 --
1785 Begin
1786   hr_utility.set_location('Entering:'||l_proc, 5);
1787   --
1788   -- Call all supporting business operations
1789   --
1790   hr_api.validate_bus_grp_id
1791     (p_business_group_id => p_rec.business_group_id
1792     ,p_associated_column1 => per_pdp_shd.g_tab_nam
1793                               || '.BUSINESS_GROUP_ID');
1794 
1795   hr_utility.set_location(l_proc, 10);
1796 
1797   --
1798   -- Validate person id
1799   --
1800   -- Business Rule Mapping
1801   -- =====================
1802   -- CHK_PERSON_ID / a,c
1803   --
1804   per_pdp_bus.chk_person_id
1805     (p_person_id         => p_rec.person_id,
1806      p_effective_date    => p_effective_date,
1807      p_business_group_id => p_rec.business_group_id);
1808   --
1809   hr_utility.set_location(l_proc, 15);
1810 
1811   --
1812   -- Validate date start
1813   --
1814   -- Business Rule Mapping
1815   -- =====================
1816   -- CHK_DATE_START / a
1817   --
1818   per_pdp_bus.chk_date_start(p_date_start => p_rec.date_start);
1819 
1820   hr_utility.set_location(l_proc, 20);
1821 
1822   --
1823   -- After validating the set of important attributes,
1824   -- if Multiple Message detection is enabled and at least
1825   -- one error has been found then abort further validation.
1826   --
1827   hr_multi_message.end_validation_set;
1828 
1829   --
1830   -- Validate Independent Attributes
1831   --
1832   hr_utility.set_location(l_proc, 25);
1833   --
1834   --
1835   -- Validate person id and date start combination
1836   --
1837   -- Business Rule Mapping
1838   -- =====================
1839   -- CHK_PERSON_ID_DATE_START / a,b
1840   --
1841   per_pdp_bus.chk_person_id_date_start
1842     (p_date_start              => p_rec.date_start
1843     ,p_object_version_number   => p_rec.object_version_number
1844     ,p_period_of_placement_id  => p_rec.period_of_placement_id
1845     ,p_person_id               => p_rec.person_id);
1846 
1847   hr_utility.set_location(l_proc, 30);
1848 
1849   --
1850   -- Validate projected termination date
1851   --
1852   -- Business Rule Mapping
1853   -- =====================
1854   -- CHK_PROJECTED_TERM_DATE / a
1855   --
1856   per_pdp_bus.chk_projected_term_date
1857     (p_date_start                 => p_rec.date_start
1858     ,p_projected_termination_date => p_rec.projected_termination_date
1859     ,p_object_version_number      => p_rec.object_version_number
1860     ,p_period_of_placement_id     => p_rec.period_of_placement_id);
1861   --
1862   hr_utility.set_location(l_proc, 35);
1863   --
1864   -- Validate termination reason
1865   --
1866   -- Business Rule Mapping
1867   -- =====================
1868   -- CHK_TERMINATION_REASON / b
1869   --
1870   per_pdp_bus.chk_termination_reason
1874      p_period_of_placement_id  => p_rec.period_of_placement_id);
1871     (p_termination_reason      => p_rec.termination_reason,
1872      p_effective_date          => p_effective_date,
1873      p_object_version_number   => p_rec.object_version_number,
1875 
1876   hr_utility.set_location(l_proc, 40);
1877 
1878   --
1879   -- Validate last standard process date
1880   --
1881   -- Business Rule Mapping
1882   -- =====================
1883   -- CHK_LAST_STANDARD_PROCESS_DATE / e
1884   --
1885   -- 70.3 change c start.
1886   --
1887   per_pdp_bus.chk_last_standard_process_date
1888     (p_actual_termination_date    => p_rec.actual_termination_date
1889     ,p_business_group_id          => p_rec.business_group_id
1890     ,p_date_start                 => p_rec.date_start
1891     ,p_last_standard_process_date => p_rec.last_standard_process_date
1892     ,p_object_version_number      => p_rec.object_version_number
1893     ,p_period_of_placement_id     => p_rec.period_of_placement_id
1894     );
1895 
1896   hr_utility.set_location(l_proc, 50);
1897 
1898   --
1899   -- Validate Dependent Attributes
1900   --
1901 
1902   --
1903   -- Validate actual termination date
1904   --
1905   -- Business Rule Mapping
1906   -- =====================
1907   -- CHK_ACTUAL_TERMINATION_DATE / c
1908   --
1909   per_pdp_bus.chk_actual_termination_date
1910     (p_actual_termination_date    => p_rec.actual_termination_date
1911     ,p_date_start                 => p_rec.date_start
1912     ,p_last_standard_process_date => p_rec.last_standard_process_date
1913     ,p_object_version_number      => p_rec.object_version_number
1914     ,p_period_of_placement_id     => p_rec.period_of_placement_id
1915     ,p_person_id                  => p_rec.person_id);
1916 
1917   hr_utility.set_location(l_proc, 60);
1918 
1919   --
1920   -- Validate final process date
1921   --
1922   -- Business Rule Mapping
1923   -- =====================
1924   -- CHK_FINAL_PROCESS_DATE / e
1925   --
1926   per_pdp_bus.chk_final_process_date
1927     (p_actual_termination_date    => p_rec.actual_termination_date,
1928      p_date_start                 => p_rec.date_start,
1929      p_final_process_date         => p_rec.final_process_date,
1930      p_last_standard_process_date => p_rec.last_standard_process_date,
1931      p_object_version_number      => p_rec.object_version_number,
1932      p_period_of_placement_id     => p_rec.period_of_placement_id);
1933 
1934   hr_utility.set_location(l_proc, 70);
1935 
1936   --
1937   -- Validate actual termination date/last standard process date
1938   --
1939   -- Business Rule Mapping
1940   -- =====================
1941   -- CHK_LAST_STANDARD_PROCESS_DATE / h
1942   --
1943   per_pdp_bus.chk_at_date_lsp_date
1944     (p_actual_termination_date    => p_rec.actual_termination_date
1945     ,p_last_standard_process_date => p_rec.last_standard_process_date
1946     ,p_object_version_number      => p_rec.object_version_number
1947     ,p_period_of_placement_id     => p_rec.period_of_placement_id
1948     ,p_business_group_id          => p_rec.business_group_id
1949     );
1950 
1951   hr_utility.set_location(l_proc, 80);
1952 
1953   --
1954   -- Only validate the flexfields if the PDP being created
1955   -- is not the default for a new person.
1956   --
1957   if per_pdp_shd.g_validate_df_flex then
1958 
1959     per_pdp_bus.chk_ddf(p_rec);
1960     per_pdp_bus.chk_df(p_rec);
1961 
1962   end if;
1963 
1964   hr_utility.set_location(' Leaving:'||l_proc, 10);
1965 End insert_validate;
1966 --
1967 -- ----------------------------------------------------------------------------
1968 -- |---------------------------< update_validate >----------------------------|
1969 -- ----------------------------------------------------------------------------
1970 Procedure update_validate
1971   (p_effective_date               in date
1972   ,p_rec                          in per_pdp_shd.g_rec_type
1973   ) is
1974 --
1975   l_proc  varchar2(72) := g_package||'update_validate';
1976 --
1977 Begin
1978   hr_utility.set_location('Entering:'||l_proc, 5);
1979   --
1980   -- Call all supporting business operations
1981   --
1982   hr_api.validate_bus_grp_id
1983     (p_business_group_id => p_rec.business_group_id
1984     ,p_associated_column1 => per_pdp_shd.g_tab_nam
1985                               || '.BUSINESS_GROUP_ID');
1986 
1987   hr_utility.set_location(l_proc, 10);
1988 
1989   --
1990   -- Validate person id
1991   --
1992   -- Business Rule Mapping
1993   -- =====================
1994   -- CHK_PERSON_ID / a,c
1995   --
1996   per_pdp_bus.chk_person_id
1997     (p_person_id         => p_rec.person_id,
1998      p_effective_date    => p_effective_date,
1999      p_business_group_id => p_rec.business_group_id);
2000   --
2001   hr_utility.set_location(l_proc, 15);
2002 
2003   --
2004   -- Validate date start
2005   --
2006   -- Business Rule Mapping
2007 
2008 -- CHK_DATE_START / a -- per_pdp_bus.chk_date_start(p_date_start => p_rec.date_start);
2009 
2010   hr_utility.set_location(l_proc, 20);
2011 
2012   --
2013   -- After validating the set of important attributes,
2014   -- if Multiple Message detection is enabled and at least
2018 
2015   -- one error has been found then abort further validation.
2016   --
2017   hr_multi_message.end_validation_set;
2019 
2020   chk_non_updateable_args
2021     (p_effective_date              => p_effective_date
2022       ,p_rec              => p_rec
2023     );
2024 
2025   --
2026   -- Validate Independent Attributes
2027   --
2028 
2029   hr_utility.set_location(l_proc, 25);
2030   --
2031   --
2032   -- Validate person id and date start combination
2033   --
2034   -- Business Rule Mapping
2035   -- =====================
2036   -- CHK_PERSON_ID_DATE_START / a,b
2037   --
2038   per_pdp_bus.chk_person_id_date_start
2039     (p_date_start              => p_rec.date_start
2040     ,p_object_version_number   => p_rec.object_version_number
2041     ,p_period_of_placement_id  => p_rec.period_of_placement_id
2042     ,p_person_id               => p_rec.person_id);
2043 
2044   hr_utility.set_location(l_proc, 30);
2045 
2046   --
2047   -- Validate projected termination date
2048   --
2049   -- Business Rule Mapping
2050   -- =====================
2051   -- CHK_PROJECTED_TERM_DATE / a
2052   --
2053   per_pdp_bus.chk_projected_term_date
2054     (p_date_start                 => p_rec.date_start
2055     ,p_projected_termination_date => p_rec.projected_termination_date
2056     ,p_object_version_number      => p_rec.object_version_number
2057     ,p_period_of_placement_id     => p_rec.period_of_placement_id);
2058   --
2059   hr_utility.set_location(l_proc, 35);
2060   --
2061   -- Validate termination reason
2062   --
2063   -- Business Rule Mapping
2064   -- =====================
2065   -- CHK_TERMINATION_REASON / b
2066   --
2067   per_pdp_bus.chk_termination_reason
2068     (p_termination_reason      => p_rec.termination_reason,
2069      p_effective_date          => p_effective_date,
2070      p_object_version_number   => p_rec.object_version_number,
2071      p_period_of_placement_id  => p_rec.period_of_placement_id);
2072 
2073   hr_utility.set_location(l_proc, 40);
2074   --
2075   -- Validate last standard process date
2076   --
2077   -- Business Rule Mapping
2078   -- =====================
2079   -- CHK_LAST_STANDARD_PROCESS_DATE / e
2080   --
2081   -- 70.3 change c start.
2082   --
2083   per_pdp_bus.chk_last_standard_process_date
2084     (p_actual_termination_date    => p_rec.actual_termination_date
2085     ,p_business_group_id          => p_rec.business_group_id
2086     ,p_date_start                 => p_rec.date_start
2087     ,p_last_standard_process_date => p_rec.last_standard_process_date
2088     ,p_object_version_number      => p_rec.object_version_number
2089     ,p_period_of_placement_id     => p_rec.period_of_placement_id
2090     );
2091 
2092   hr_utility.set_location(l_proc, 50);
2093 
2094   --
2095   -- Validate Dependent Attributes
2096   --
2097 
2098   --
2099   -- Validate actual termination date
2100   --
2101   -- Business Rule Mapping
2102   -- =====================
2103   -- CHK_ACTUAL_TERMINATION_DATE / c
2104   --
2105   per_pdp_bus.chk_actual_termination_date
2106     (p_actual_termination_date    => p_rec.actual_termination_date
2107     ,p_date_start                 => p_rec.date_start
2108     ,p_last_standard_process_date => p_rec.last_standard_process_date
2109     ,p_object_version_number      => p_rec.object_version_number
2110     ,p_period_of_placement_id     => p_rec.period_of_placement_id
2111     ,p_person_id                  => p_rec.person_id);
2112 
2113   hr_utility.set_location(l_proc, 60);
2114 
2115   --
2116   -- Validate final process date
2117   --
2118   -- Business Rule Mapping
2119   -- =====================
2120   -- CHK_FINAL_PROCESS_DATE / e
2121   --
2122   per_pdp_bus.chk_final_process_date
2123     (p_actual_termination_date    => p_rec.actual_termination_date,
2124      p_date_start                 => p_rec.date_start,
2125      p_final_process_date         => p_rec.final_process_date,
2126      p_last_standard_process_date => p_rec.last_standard_process_date,
2127      p_object_version_number      => p_rec.object_version_number,
2128      p_period_of_placement_id     => p_rec.period_of_placement_id);
2129 
2130   hr_utility.set_location(l_proc, 70);
2131 
2132   --
2133   -- Validate actual termination date/last standard process date
2134   --
2135   -- Business Rule Mapping
2136   -- =====================
2137   -- CHK_LAST_STANDARD_PROCESS_DATE / h
2138   --
2139   per_pdp_bus.chk_at_date_lsp_date
2140     (p_actual_termination_date    => p_rec.actual_termination_date
2141     ,p_last_standard_process_date => p_rec.last_standard_process_date
2142     ,p_object_version_number      => p_rec.object_version_number
2143     ,p_period_of_placement_id     => p_rec.period_of_placement_id
2144     ,p_business_group_id          => p_rec.business_group_id
2145     );
2146 
2147   hr_utility.set_location(l_proc, 80);
2148 
2149   --
2150   -- Only validate the flexfields if the PDP being created
2151   -- is not the default for a new person.
2152   --
2153   if per_pdp_shd.g_validate_df_flex then
2154 
2155     per_pdp_bus.chk_ddf(p_rec);
2156     per_pdp_bus.chk_df(p_rec);
2157 
2158   end if;
2159   --
2160   hr_utility.set_location(' Leaving:'||l_proc, 10);
2163 -- ----------------------------------------------------------------------------
2164 -- |---------------------------< delete_validate >----------------------------|
2165 -- ----------------------------------------------------------------------------
2166 Procedure delete_validate
2167   (p_rec                          in per_pdp_shd.g_rec_type
2168   ) is
2169 --
2170   l_proc  varchar2(72) := g_package||'delete_validate';
2171 --
2172 Begin
2173   hr_utility.set_location('Entering:'||l_proc, 5);
2174   --
2175   -- Call all supporting business operations
2176   --
2177   hr_utility.set_location(' Leaving:'||l_proc, 10);
2178 End delete_validate;
2179 --
2180 end per_pdp_bus;
2162 --
2161 End update_validate;