DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PDP_BUS

Source


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