DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_CTC_BUS

Source


4 -- ----------------------------------------------------------------------------
1 Package Body per_ctc_bus as
2 /* $Header: pectcrhi.pkb 120.1 2010/11/29 06:24:00 ghshanka ship $ */
3 --
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_ctc_bus.';  -- Global package name
9 --
10 -- The following two global variables are only to be used by the
11 -- return_legislation_code function.
12 --
13 g_contract_id number default null;
14 g_legislation_code varchar2(150) default null;
15 --
16 -- ----------------------------------------------------------------------------
17 -- |----------------------< check_non_updateable_args >-----------------------|
18 -- ----------------------------------------------------------------------------
19 -- {Start Of Comments}
20 --
21 -- Description:
22 --   This procedure is used to ensure that non updatetable attributes have
23 --   not been updated. If an attribute has been updated an error is generated.
24 --
25 -- Pre Conditions:
26 --   g_old_rec has been populated with details of the values currently in
27 --   the database.
28 --
29 -- In Arguments:
30 --   p_rec has been populated with the updated values the user would like the
31 --
32 -- Post Success:
33 --   Processing continues if all the non updateable attributes have not
34 --   changed.
35 --
36 -- Post Failure:
37 --   An application error is raised if any of the non updatable attributes
38 --   (business_group_id or person_id) have been altered.
39 --
40 -- Access Status:
41 --   Internal Table Handler Use Only.
42 --
43 Procedure check_non_updateable_args(p_rec in per_asg_shd.g_rec_type
44                                    ,p_effective_date in date) is
45 --
46   l_proc     varchar2(72) := g_package||'check_non_updateable_args';
47   l_error    exception;
48   l_argument varchar2(30);
49 --
50 Begin
51   hr_utility.set_location('Entering:'||l_proc, 5);
52   --
53   -- Only proceed with validation if a row exists for
54   -- the current record in the HR Schema
55   --
56   if not per_asg_shd.api_updating
57                 (p_assignment_id          => p_rec.assignment_id
58                 ,p_object_version_number  => p_rec.object_version_number
59                 ,p_effective_date         => p_effective_date
60                 ) then
61     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
62     hr_utility.set_message_token('PROCEDURE', l_proc);
63     hr_utility.set_message_token('STEP', '5');
64   end if;
65   --
66   hr_utility.set_location(l_proc, 6);
67   --
68   if nvl(p_rec.business_group_id, hr_api.g_number) <>
69      nvl(per_asg_shd.g_old_rec.business_group_id, hr_api.g_number) then
70      l_argument := 'business_group_id';
71      raise l_error;
72   end if;
73   hr_utility.set_location(l_proc, 7);
74   --
75   if nvl(p_rec.person_id,hr_api.g_number) <>
76      nvl(per_asg_shd.g_old_rec.person_id, hr_api.g_number) then
77      l_argument := 'person_id';
78      raise l_error;
79   end if;
80   --
81   hr_utility.set_location(l_proc, 8);
82   exception
83     when l_error then
84        hr_api.argument_changed_error
85          (p_api_name => l_proc
86          ,p_argument => l_argument);
87     when others then
88        raise;
92 --  ---------------------------------------------------------------------------
89   hr_utility.set_location(' Leaving:'||l_proc, 9);
90 end check_non_updateable_args;
91 --
93 --  |--------------------------< chk_person_id >------------------------------|
94 --  ---------------------------------------------------------------------------
95 --
96 --  Description:
97 --    Check that person business group is the same as the contract business group.
98 --
99 --  Pre-conditions:
100 --    None
101 --
102 --  In Arguments:
103 --    p_person_id
104 --    p_business_group_id
105 --    p_effective_date
106 --
107 --  Post Success:
108 --    If person business group is the same as the contract business group then processing
109 --    continues
110 --
111 --  Post Failure:
112 --    Application error is raised and processing is terminated.
113 --
114 --  Access Status:
115 --    Internal Row Handler Use Only.
116 --
117 procedure chk_person_id
118   (p_person_id             in per_contracts_f.person_id%TYPE
119   ,p_business_group_id     in per_contracts_f.business_group_id%TYPE
120   ,p_effective_date        in per_contracts_f.effective_start_date%TYPE
121   )
122   is
123 --
124    l_exists             varchar2(1);
125    l_business_group_id  number(15);
126    l_proc               varchar2(72)  :=  g_package||'chk_person_id';
127    --
128    cursor csr_get_bus_grp is
129      select   ppf.business_group_id
130      from     per_people_f ppf
131      where    ppf.person_id = p_person_id
132      and      p_effective_date between ppf.effective_start_date
133                                and     ppf.effective_end_date;
134    --
135 --
136 begin
137   hr_utility.set_location('Entering:'|| l_proc, 1);
138   --
139   -- Check mandatory parameters have been set
140   --
141   hr_api.mandatory_arg_error
142     (p_api_name       => l_proc
143     ,p_argument       => 'person_id'
144     ,p_argument_value => p_person_id
145     );
146   --
147   hr_utility.set_location(l_proc, 2);
148   --
149   -- Check that person business group is the same as
150   -- the contract business group
151   --
152   open csr_get_bus_grp;
153   fetch csr_get_bus_grp into l_business_group_id;
154   if l_business_group_id <> p_business_group_id then
155     close csr_get_bus_grp;
156     hr_utility.set_message(800, 'PER_52832_CTR_INV_BG');
157     hr_utility.raise_error;
158   end if;
159   close csr_get_bus_grp;
160   --
161   hr_utility.set_location(' Leaving:'|| l_proc, 3);
162 end chk_person_id;
163 --
164 --  ---------------------------------------------------------------------------
165 --  |--------------------------< chk_reference >------------------------------|
166 --  ---------------------------------------------------------------------------
167 --
168 --  Description:
169 --    Check that the reference is unique within a person. As this is datetracked
170 --    the same reference must not exist outside of the contract_id.
171 --    --If this is a (DT) update and the reference is changing, it should be unique
172 --      for the person, for every contract_id except this one.
173 --    --If it is a (DT) insert, then the reference should be unque for the personid
174 --
175 --  Pre-conditions:
176 --    None
177 --
178 --  In Arguments:
179 --    p_person_id
180 --    p_reference
181 --    p_datetrack_mode
182 --    p_contract_id
183 --
184 --  Post Success:
185 --    If reference the reference is unique within the allowed paramertrs stated above
186 --    then processing continues.
187 --
188 --  Post Failure:
189 --    Application error is raised and processing is terminated.
190 --
191 --  Access Status:
192 --    Internal Row Handler Use Only.
193 --
194 procedure chk_reference
195   (p_person_id             in per_contracts_f.person_id%TYPE
196   ,p_reference             in per_contracts_f.reference%TYPE
197   ,p_datetrack_mode        in varchar2
198   ,p_contract_id           in per_contracts_f.contract_id%TYPE
199   )
200   is
201 --
202    l_exists             varchar2(1);
203    l_business_group_id  number(15);
204    l_proc               varchar2(72)  :=  g_package||'chk_reference';
205    --
206    cursor csr_update is
207      select   null
208      from     per_contracts_f
209      where    person_id = p_person_id
210      and      contract_id <> p_contract_id
211      and      reference = p_reference;
212    --
213    cursor csr_insert is
214      select   null
215      from     per_contracts_f
216      where    person_id = p_person_id
217      and      reference = p_reference;
218 --
219 begin
220   hr_utility.set_location('Entering:'|| l_proc, 1);
221   --
222   -- Check mandatory parameters have been set
223   --
224   hr_api.mandatory_arg_error
225     (p_api_name       => l_proc
226     ,p_argument       => 'person_id'
227     ,p_argument_value => p_person_id
228     );
229   --
230   hr_api.mandatory_arg_error
231     (p_api_name       => l_proc
232     ,p_argument       => 'p_datetrack_mode'
233     ,p_argument_value => p_datetrack_mode
234     );
235   --
236   hr_utility.set_location(l_proc, 2);
237   --
238   -- If this is a DT update and reference is changing, Check that
239   -- the reference does not exist for any other contract for the same person.
240   --
241   if p_datetrack_mode in ('UPDATE_OVERRIDE',
242                           'UPDATE',
243                           'CORRECTION',
247     open csr_update;
244                           'UPDATE_CHANGE_INSERT')
245   AND p_reference <> per_ctc_shd.g_old_rec.reference
246   THEN
248     fetch csr_update into l_exists;
249     if csr_update%FOUND then
250       close csr_update;
251       hr_utility.set_message(800, 'PER_52855_CTC_ORIGINAL');
252       hr_utility.raise_error;
253     end if;
254     close csr_update;
255   end if;
256   if p_datetrack_mode = 'INSERT' then
257     open csr_insert;
258     fetch csr_insert into l_exists;
259     if csr_insert%FOUND then
260       close csr_insert;
261       hr_utility.set_message(800, 'PER_52855_CTC_ORIGINAL');
262       hr_utility.raise_error;
263     end if;
264     close csr_insert;
265   end if;
266   --
267   hr_utility.set_location(' Leaving:'|| l_proc, 3);
268 end chk_reference;
269 --
270 --  ---------------------------------------------------------------------------
271 --  |-----------------------< chk_type >--------------------------------------|
272 --  ---------------------------------------------------------------------------
273 --
274 --  Description:
275 --    Check that the passed in lookup code exists in hr_lookups for the with an
276 --    enabled flag set to 'Y' and that the effective start date of the contract
277 --    is between start date active and end date active in hr_lookups.
278 --
279 --  Pre-conditions:
280 --    None
281 --
282 --  In Arguments:
283 --    p_contract_id
284 --    p_type
285 --    p_effective_date
286 --    p_validation_start_date
287 --    p_validation_end_date
288 --    p_object_version_number
289 --
290 --  Post Success:
291 --    If lookup exists and can be derived then processing
292 --    continues
293 --
294 --  Post Failure:
295 --    If lookup is not valid or cannot be derived then an
296 --    application error is raised and processing is terminated
297 --
298 --  Access Status:
299 --    Internal Row Handler Use Only.
300 --
301 procedure chk_type
302  (p_contract_id            in     per_contracts_f.contract_id%TYPE
303  ,p_type                   in     per_contracts_f.type%TYPE
304  ,p_effective_date         in     date
305  ,p_validation_start_date  in     date
306  ,p_validation_end_date    in     date
307  ,p_object_version_number  in     per_contracts_f.object_version_number%TYPE
308  )
309   is
310 --
311    l_proc           varchar2(72)  :=  g_package||'chk_type';
312    l_exists         varchar2(1);
313    l_api_updating   boolean;
314 --
315 begin
316   hr_utility.set_location('Entering:'|| l_proc, 10);
317   --
318   -- Check mandatory parameters have been set
319   --
320   hr_api.mandatory_arg_error
321     (p_api_name       => l_proc
322     ,p_argument       => 'effective_date'
323     ,p_argument_value => p_effective_date
324     );
325   --
326   hr_api.mandatory_arg_error
327     (p_api_name       =>  l_proc
328     ,p_argument       =>  'validation_start_date'
329     ,p_argument_value =>  p_validation_start_date
330     );
331   --
332   hr_api.mandatory_arg_error
333     (p_api_name        =>  l_proc
334     ,p_argument       =>  'validation_end_date'
335     ,p_argument_value =>  p_validation_end_date
336     );
337   hr_utility.set_location(l_proc, 20);
338   --
339   l_api_updating := per_ctc_shd.api_updating
340          (p_contract_id            => p_contract_id
341          ,p_effective_date         => p_effective_date
342          ,p_object_version_number  => p_object_version_number
343          );
344   hr_utility.set_location(l_proc, 30);
345   --
346   if ((l_api_updating and
347        nvl(per_ctc_shd.g_old_rec.type, hr_api.g_varchar2) <>
348        nvl(p_type, hr_api.g_varchar2))
349     or (NOT l_api_updating))
350   then
351     hr_utility.set_location(l_proc, 40);
352     --
353     if p_type is not null then
354       --
355       -- Check that the type exists in hr_lookups for the
356       -- lookup type 'TYPE' with an enabled flag set to 'Y' and that
357       -- the effective start date of the contract is between start date
358       -- active and end date active in hr_lookups.
359       --
360       if hr_api.not_exists_in_dt_hr_lookups
361         (p_effective_date        => p_effective_date
362         ,p_validation_start_date => p_validation_start_date
363         ,p_validation_end_date   => p_validation_end_date
364         ,p_lookup_type           => 'CONTRACT_TYPE'
365         ,p_lookup_code           => p_type
366         )
367       then
368         --
369         hr_utility.set_message(800, 'PER_52820_CTR_INV_TYPE');
370         hr_utility.raise_error;
371         --
372       end if;
373       hr_utility.set_location(l_proc, 50);
374       --
375     end if;
376     hr_utility.set_location(l_proc, 60);
377     --
378   end if;
379   --
380   hr_utility.set_location(' Leaving:'|| l_proc, 70);
381   --
382 end chk_type;
383 --
384 --  ---------------------------------------------------------------------------
385 --  |-----------------------< chk_status >--------------------------------------|
386 --  ---------------------------------------------------------------------------
387 --
388 --  Description:
389 --    Check that the passed in lookup code exists in hr_lookups for the with an
390 --    enabled flag set to 'Y' and that the effective start date of the contract
391 --    is between start date active and end date active in hr_lookups.
392 --
393 --  Pre-conditions:
394 --    None
395 --
396 --  In Arguments:
400 --    p_validation_start_date
397 --    p_contract_id
398 --    p_status
399 --    p_effective_date
401 --    p_validation_end_date
402 --    p_object_version_number
403 --
404 --  Post Success:
405 --    If lookup exists and can be derived then processing
406 --    continues
407 --
408 --  Post Failure:
409 --    If lookup is not valid or cannot be derived then an
410 --    application error is raised and processing is terminated
411 --
412 --  Access Status:
413 --    Internal Row Handler Use Only.
414 --
415 procedure chk_status
416  (p_contract_id            in     per_contracts_f.contract_id%TYPE
417  ,p_status                 in     per_contracts_f.status%TYPE
418  ,p_effective_date         in     date
419  ,p_validation_start_date  in     date
420  ,p_validation_end_date    in     date
421  ,p_object_version_number  in     per_contracts_f.object_version_number%TYPE
422  )
423   is
424 --
425    l_proc           varchar2(72)  :=  g_package||'chk_status';
426    l_exists         varchar2(1);
427    l_api_updating   boolean;
428 --
429 begin
430   hr_utility.set_location('Entering:'|| l_proc, 10);
431   --
432   -- Check mandatory parameters have been set
433   --
434   hr_api.mandatory_arg_error
435     (p_api_name       => l_proc
436     ,p_argument       => 'effective_date'
437     ,p_argument_value => p_effective_date
438     );
439   --
440   hr_api.mandatory_arg_error
441     (p_api_name       =>  l_proc
442     ,p_argument       =>  'validation_start_date'
443     ,p_argument_value =>  p_validation_start_date
444     );
445   --
446   hr_api.mandatory_arg_error
447     (p_api_name        =>  l_proc
448     ,p_argument       =>  'validation_end_date'
449     ,p_argument_value =>  p_validation_end_date
450     );
451   hr_utility.set_location(l_proc, 20);
452   --
453   l_api_updating := per_ctc_shd.api_updating
454          (p_contract_id            => p_contract_id
455          ,p_effective_date         => p_effective_date
456          ,p_object_version_number  => p_object_version_number
457          );
458   hr_utility.set_location(l_proc, 30);
459   --
460   if ((l_api_updating and
461        nvl(per_ctc_shd.g_old_rec.type, hr_api.g_varchar2) <>
462        nvl(p_status, hr_api.g_varchar2))
463     or (NOT l_api_updating))
464   then
465     hr_utility.set_location(l_proc, 40);
466     --
467     if p_status is not null then
468       --
469       -- Check that the status exists in hr_lookups for the
470       -- lookup type 'CONTRACT_STATUS' with an enabled flag set to 'Y' and that
471       -- the effective start date of the contract is between start date
472       -- active and end date active in hr_lookups.
473       --
474       if hr_api.not_exists_in_dt_hr_lookups
475         (p_effective_date        => p_effective_date
476         ,p_validation_start_date => p_validation_start_date
477         ,p_validation_end_date   => p_validation_end_date
478         ,p_lookup_type           => 'CONTRACT_STATUS'
479         ,p_lookup_code           => p_status
480         )
481       then
482         --
483         hr_utility.set_message(800, 'PER_52821_CTR_INV_STATUS');
484         hr_utility.raise_error;
485         --
486       end if;
487       hr_utility.set_location(l_proc, 50);
488       --
489     end if;
490     hr_utility.set_location(l_proc, 60);
491     --
492   end if;
493   --
494   hr_utility.set_location(' Leaving:'|| l_proc, 70);
495   --
496 end chk_status;
497 --
498 --  ---------------------------------------------------------------------------
499 --  |---------------------< chk_status_reason >-------------------------------|
500 --  ---------------------------------------------------------------------------
501 --
502 --  Description:
503 --    Check that the passed in lookup code exists in hr_lookups for the with an
504 --    enabled flag set to 'Y' and that the effective start date of the contract
505 --    is between start date active and end date active in hr_lookups.
506 --
507 --  Pre-conditions:
508 --    None
509 --
510 --  In Arguments:
511 --    p_contract_id
512 --    p_status_reason
513 --    p_effective_date
514 --    p_validation_start_date
515 --    p_validation_end_date
516 --    p_object_version_number
517 --
518 --  Post Success:
519 --    If lookup exists and can be derived then processing
520 --    continues
521 --
522 --  Post Failure:
523 --    If lookup is not valid or cannot be derived then an
524 --    application error is raised and processing is terminated
525 --
526 --  Access Status:
527 --    Internal Row Handler Use Only.
528 --
529 procedure chk_status_reason
530  (p_contract_id            in     per_contracts_f.contract_id%TYPE
531  ,p_status_reason          in     per_contracts_f.status_reason%TYPE
532  ,p_effective_date         in     date
533  ,p_validation_start_date  in     date
534  ,p_validation_end_date    in     date
535  ,p_object_version_number  in     per_contracts_f.object_version_number%TYPE
536  )
537   is
538 --
539    l_proc           varchar2(72)  :=  g_package||'chk_status_reason';
540    l_exists         varchar2(1);
541    l_api_updating   boolean;
542 --
543 begin
544   hr_utility.set_location('Entering:'|| l_proc, 10);
545   --
546   -- Check mandatory parameters have been set
547   --
548   hr_api.mandatory_arg_error
552     );
549     (p_api_name       => l_proc
550     ,p_argument       => 'effective_date'
551     ,p_argument_value => p_effective_date
553   --
554   hr_api.mandatory_arg_error
555     (p_api_name       =>  l_proc
556     ,p_argument       =>  'validation_start_date'
557     ,p_argument_value =>  p_validation_start_date
558     );
559   --
560   hr_api.mandatory_arg_error
561     (p_api_name        =>  l_proc
562     ,p_argument       =>  'validation_end_date'
563     ,p_argument_value =>  p_validation_end_date
564     );
565   hr_utility.set_location(l_proc, 20);
566   --
567   l_api_updating := per_ctc_shd.api_updating
568          (p_contract_id            => p_contract_id
569          ,p_effective_date         => p_effective_date
570          ,p_object_version_number  => p_object_version_number
571          );
572   hr_utility.set_location(l_proc, 30);
573   --
574   if ((l_api_updating and
575        nvl(per_ctc_shd.g_old_rec.type, hr_api.g_varchar2) <>
576        nvl(p_status_reason, hr_api.g_varchar2))
577     or (NOT l_api_updating))
578   then
579     hr_utility.set_location(l_proc, 40);
580     --
581     if p_status_reason is not null then
582       --
583       -- Check that the status_reason exists in hr_lookups for the
584       -- lookup type 'CONTRACT_STATUS_REASON' with an enabled flag set to 'Y' and that
585       -- the effective start date of the contract is between start date
586       -- active and end date active in hr_lookups.
587       --
588       if hr_api.not_exists_in_dt_hr_lookups
589         (p_effective_date        => p_effective_date
590         ,p_validation_start_date => p_validation_start_date
591         ,p_validation_end_date   => p_validation_end_date
592         ,p_lookup_type           => 'CONTRACT_STATUS_REASON'
593         ,p_lookup_code           => p_status_reason
594         )
595       then
596         --
597         hr_utility.set_message(800, 'PER_52822_CTR_INV_STATUS_REASO');
598         hr_utility.raise_error;
599         --
600       end if;
601       hr_utility.set_location(l_proc, 50);
602       --
603     end if;
604     hr_utility.set_location(l_proc, 60);
605     --
606   end if;
607   --
608   hr_utility.set_location(' Leaving:'|| l_proc, 70);
609   --
610 end chk_status_reason;
611 --
612 --  ---------------------------------------------------------------------------
613 --  |-----------------------< chk_duration_units>-----------------------------|
614 --  ---------------------------------------------------------------------------
615 --
616 --  Description:
617 --    Check that the passed in lookup code exists in hr_lookups for the with an
618 --    enabled flag set to 'Y' and that the effective start date of the contract
619 --    is between start date active and end date active in hr_lookups.
620 --
621 --  Pre-conditions:
622 --    None
623 --
624 --  In Arguments:
625 --    p_contract_id
626 --    p_duration
627 --    p_duration_units
628 --    p_effective_date
629 --    p_validation_start_date
630 --    p_validation_end_date
631 --    p_object_version_number
632 --
633 --  Post Success:
634 --    If lookup exists and can be derived then processing
635 --    continues
636 --
637 --  Post Failure:
638 --    If lookup is not valid or cannot be derived then an
639 --    application error is raised and processing is terminated
640 --
641 --  Access Status:
642 --    Internal Row Handler Use Only.
643 --
644 procedure chk_duration_units
645  (p_contract_id            in     per_contracts_f.contract_id%TYPE
646  ,p_duration		   in     per_contracts_f.duration%TYPE
647  ,p_duration_units         in     per_contracts_f.duration_units%TYPE
648  ,p_effective_date         in     date
649  ,p_validation_start_date  in     date
650  ,p_validation_end_date    in     date
651  ,p_object_version_number  in     per_contracts_f.object_version_number%TYPE
652  )
653   is
654 --
655    l_proc           varchar2(72)  :=  g_package||'chk_duration_units';
656    l_exists         varchar2(1);
657    l_api_updating   boolean;
658 --
659 begin
660   hr_utility.set_location('Entering:'|| l_proc, 10);
661   --
662   -- Check mandatory parameters have been set
663   --
664   hr_api.mandatory_arg_error
665     (p_api_name       => l_proc
666     ,p_argument       => 'effective_date'
667     ,p_argument_value => p_effective_date
668     );
669   --
670   hr_api.mandatory_arg_error
671     (p_api_name       =>  l_proc
672     ,p_argument       =>  'validation_start_date'
673     ,p_argument_value =>  p_validation_start_date
674     );
675   --
676   hr_api.mandatory_arg_error
677     (p_api_name        =>  l_proc
678     ,p_argument       =>  'validation_end_date'
679     ,p_argument_value =>  p_validation_end_date
680     );
681   hr_utility.set_location(l_proc, 20);
682   --
683   l_api_updating := per_ctc_shd.api_updating
684          (p_contract_id            => p_contract_id
685          ,p_effective_date         => p_effective_date
686          ,p_object_version_number  => p_object_version_number
687          );
688   hr_utility.set_location(l_proc, 30);
689   --
690   if ((l_api_updating and
691        nvl(per_ctc_shd.g_old_rec.type, hr_api.g_varchar2) <>
692        nvl(p_duration_units, hr_api.g_varchar2))
693     or (NOT l_api_updating))
694   then
698       --
695     hr_utility.set_location(l_proc, 40);
696     --
697     if p_duration_units is not null then
699       -- Check that the duration units exists in hr_lookups for the
700       -- lookup type 'DURATION_UNITS' with an enabled flag set to 'Y' and that
701       -- the effective start date of the contract is between start date
702       -- active and end date active in hr_lookups.
703       --
704       if hr_api.not_exists_in_dt_hr_lookups
705         (p_effective_date        => p_effective_date
706         ,p_validation_start_date => p_validation_start_date
707         ,p_validation_end_date   => p_validation_end_date
708         ,p_lookup_type           => 'QUALIFYING_UNITS'
709         ,p_lookup_code           => p_duration_units
710         )
711       then
712         --
713         hr_utility.set_message(800, 'PER_52823_CTR_INV_DURATION_UN');
714         hr_utility.raise_error;
715         --
716       end if;
717       --
718       hr_utility.set_location(l_proc, 50);
719       --
720       -- Check that the duration exists when the duration units is not null
721       --
722       if p_duration is null then
723         hr_utility.set_message(800, 'PER_52843_INV_DURATION');
724         hr_utility.raise_error;
725         --
726       end if;
727       hr_utility.set_location(l_proc, 60);
728       --
729     else
730       --
731       -- Check that the duration doesn't exist when the duration units is null
732       --
733       if p_duration is not null then
734         hr_utility.set_message(800, 'PER_52843_CTR_INV_DURATION');
735         hr_utility.raise_error;
736         --
737       end if;
738      end if;
739     hr_utility.set_location(l_proc, 70);
740     --
741   end if;
742   --
743   hr_utility.set_location(' Leaving:'|| l_proc, 80);
744   --
745 end chk_duration_units;
746 --
747 --  ---------------------------------------------------------------------------
748 --  |-----------------------< chk_start_reason >------------------------------|
749 --  ---------------------------------------------------------------------------
750 --
751 --  Description:
752 --    Check that the passed in lookup code exists in hr_lookups for the with an
753 --    enabled flag set to 'Y' and that the effective start date of the contract
754 --    is between start date active and end date active in hr_lookups.
755 --
756 --  Pre-conditions:
757 --    None
758 --
759 --  In Arguments:
760 --    p_contract_id
761 --    p_start_reason
762 --    p_effective_date
763 --    p_validation_start_date
764 --    p_validation_end_date
765 --    p_object_version_number
766 --
767 --  Post Success:
768 --    If lookup exists and can be derived then processing
769 --    continues
770 --
771 --  Post Failure:
772 --    If lookup is not valid or cannot be derived then an
773 --    application error is raised and processing is terminated
774 --
775 --  Access Status:
776 --    Internal Row Handler Use Only.
777 --
778 procedure chk_start_reason
779  (p_contract_id            in     per_contracts_f.contract_id%TYPE
780  ,p_start_reason           in     per_contracts_f.start_reason%TYPE
781  ,p_effective_date         in     date
782  ,p_validation_start_date  in     date
783  ,p_validation_end_date    in     date
784  ,p_object_version_number  in     per_contracts_f.object_version_number%TYPE
785  )
786   is
787 --
788    l_proc           varchar2(72)  :=  g_package||'chk_start_reason';
789    l_exists         varchar2(1);
790    l_api_updating   boolean;
791 --
792 begin
793   hr_utility.set_location('Entering:'|| l_proc, 10);
794   --
795   -- Check mandatory parameters have been set
796   --
797   hr_api.mandatory_arg_error
798     (p_api_name       => l_proc
799     ,p_argument       => 'effective_date'
800     ,p_argument_value => p_effective_date
801     );
802   --
803   hr_api.mandatory_arg_error
804     (p_api_name       =>  l_proc
805     ,p_argument       =>  'validation_start_date'
806     ,p_argument_value =>  p_validation_start_date
807     );
808   --
809   hr_api.mandatory_arg_error
810     (p_api_name        =>  l_proc
811     ,p_argument       =>  'validation_end_date'
812     ,p_argument_value =>  p_validation_end_date
813     );
814   hr_utility.set_location(l_proc, 20);
815   --
816   l_api_updating := per_ctc_shd.api_updating
817          (p_contract_id            => p_contract_id
818          ,p_effective_date         => p_effective_date
819          ,p_object_version_number  => p_object_version_number
820          );
821   hr_utility.set_location(l_proc, 30);
822   --
823   if ((l_api_updating and
824        nvl(per_ctc_shd.g_old_rec.type, hr_api.g_varchar2) <>
825        nvl(p_start_reason, hr_api.g_varchar2))
826     or (NOT l_api_updating))
827   then
828     hr_utility.set_location(l_proc, 40);
829     --
830     if p_start_reason is not null then
831       --
832       -- Check that the start reason exists in hr_lookups for the
833       -- lookup type 'START_REASON' with an enabled flag set to 'Y' and that
834       -- the effective start date of the contract is between start date
835       -- active and end date active in hr_lookups.
836       --
837       if hr_api.not_exists_in_dt_hr_lookups
838         (p_effective_date        => p_effective_date
839         ,p_validation_start_date => p_validation_start_date
840         ,p_validation_end_date   => p_validation_end_date
841         ,p_lookup_type           => 'CONTRACT_START_REASON'
842         ,p_lookup_code           => p_start_reason
843         )
844       then
845         --
846         hr_utility.set_message(800, 'PER_52824_CTR_INV_START_REASON');
847         hr_utility.raise_error;
848         --
849       end if;
850       hr_utility.set_location(l_proc, 50);
851       --
852     end if;
853     hr_utility.set_location(l_proc, 60);
854     --
855   end if;
856   --
857   hr_utility.set_location(' Leaving:'|| l_proc, 70);
858   --
859 end chk_start_reason;
860 --
861 --  ---------------------------------------------------------------------------
862 --  |-----------------------< chk_end_reason >------------------------------|
863 --  ---------------------------------------------------------------------------
864 --
865 --  Description:
866 --    Check that the passed in lookup code exists in hr_lookups for the with an
867 --    enabled flag set to 'Y' and that the effective start date of the contract
868 --    is between start date active and end date active in hr_lookups.
869 --
870 --  Pre-conditions:
871 --    None
872 --
873 --  In Arguments:
874 --    p_contract_id
875 --    p_end_reason
876 --    p_effective_date
877 --    p_validation_start_date
878 --    p_validation_end_date
879 --    p_object_version_number
880 --
881 --  Post Success:
882 --    If lookup exists and can be derived then processing
883 --    continues
884 --
885 --  Post Failure:
886 --    If lookup is not valid or cannot be derived then an
887 --    application error is raised and processing is terminated
888 --
889 --  Access Status:
890 --    Internal Row Handler Use Only.
891 --
892 procedure chk_end_reason
893  (p_contract_id            in     per_contracts_f.contract_id%TYPE
894  ,p_end_reason             in     per_contracts_f.end_reason%TYPE
895  ,p_effective_date         in     date
896  ,p_validation_start_date  in     date
897  ,p_validation_end_date    in     date
898  ,p_object_version_number  in     per_contracts_f.object_version_number%TYPE
899  )
900   is
901 --
902    l_proc           varchar2(72)  :=  g_package||'chk_end_reason';
903    l_exists         varchar2(1);
904    l_api_updating   boolean;
905 --
906 begin
907   hr_utility.set_location('Entering:'|| l_proc, 10);
908   --
909   -- Check mandatory parameters have been set
910   --
911   hr_api.mandatory_arg_error
912     (p_api_name       => l_proc
913     ,p_argument       => 'effective_date'
914     ,p_argument_value => p_effective_date
915     );
916   --
917   hr_api.mandatory_arg_error
918     (p_api_name       =>  l_proc
919     ,p_argument       =>  'validation_start_date'
920     ,p_argument_value =>  p_validation_start_date
921     );
922   --
923   hr_api.mandatory_arg_error
924     (p_api_name        =>  l_proc
925     ,p_argument       =>  'validation_end_date'
926     ,p_argument_value =>  p_validation_end_date
927     );
928   hr_utility.set_location(l_proc, 20);
929   --
930   l_api_updating := per_ctc_shd.api_updating
931          (p_contract_id            => p_contract_id
932          ,p_effective_date         => p_effective_date
933          ,p_object_version_number  => p_object_version_number
934          );
935   hr_utility.set_location(l_proc, 30);
936   --
937   if ((l_api_updating and
938        nvl(per_ctc_shd.g_old_rec.type, hr_api.g_varchar2) <>
939        nvl(p_end_reason, hr_api.g_varchar2))
940     or (NOT l_api_updating))
941   then
942     hr_utility.set_location(l_proc, 40);
943     --
944     if p_end_reason is not null then
945       --
946       -- Check that the end reason exists in hr_lookups for the
947       -- lookup type 'CONTRACT_END_REASON' with an enabled flag set to 'Y' and that
948       -- the effective start date of the contract is between start date
949       -- active and end date active in hr_lookups.
950       --
951       if hr_api.not_exists_in_dt_hr_lookups
952         (p_effective_date        => p_effective_date
953         ,p_validation_start_date => p_validation_start_date
954         ,p_validation_end_date   => p_validation_end_date
955         ,p_lookup_type           => 'CONTRACT_END_REASON'
956         ,p_lookup_code           => p_end_reason
957         )
958       then
959         --
960         hr_utility.set_message(800, 'PER_52825_CTR_INV_END_REASON');
961         hr_utility.raise_error;
962         --
963       end if;
964       hr_utility.set_location(l_proc, 50);
965       --
966     end if;
967     hr_utility.set_location(l_proc, 60);
968     --
969   end if;
970   --
971   hr_utility.set_location(' Leaving:'|| l_proc, 70);
972   --
973 end chk_end_reason;
974 --
975 --  ---------------------------------------------------------------------------
976 --  |-------------------< chk_extension_period_units>-------------------------|
977 --  ---------------------------------------------------------------------------
978 --
979 --  Description:
980 --    Check that the passed in lookup code exists in hr_lookups for the with an
981 --    enabled flag set to 'Y' and that the effective start date of the contract
982 --    is between start date active and end date active in hr_lookups.
983 --
984 --  Pre-conditions:
985 --    None
986 --
987 --  In Arguments:
988 --    p_contract_id
989 --    p_extension_period
990 --    p_extension_period_units
991 --    p_effective_date
992 --    p_validation_start_date
993 --    p_validation_end_date
994 --    p_object_version_number
995 --
996 --  Post Success:
997 --    If lookup exists and can be derived then processing
998 --    continues
999 --
1000 --  Post Failure:
1001 --    If lookup is not valid or cannot be derived then an
1002 --    application error is raised and processing is terminated
1003 --
1004 --  Access Status:
1005 --    Internal Row Handler Use Only.
1006 --
1007 procedure chk_extension_period_units
1008  (p_contract_id            in     per_contracts_f.contract_id%TYPE
1009  ,p_extension_period	   in 	  per_contracts_f.extension_period%TYPE
1010  ,p_extension_period_units in     per_contracts_f.extension_period_units%TYPE
1011  ,p_effective_date         in     date
1012  ,p_validation_start_date  in     date
1013  ,p_validation_end_date    in     date
1014  ,p_object_version_number  in     per_contracts_f.object_version_number%TYPE
1015  )
1016   is
1017 --
1018    l_proc           varchar2(72)  :=  g_package||'chk_extension_period_units';
1019    l_exists         varchar2(1);
1020    l_api_updating   boolean;
1021 --
1022 begin
1023   hr_utility.set_location('Entering:'|| l_proc, 10);
1024   --
1025   -- Check mandatory parameters have been set
1026   --
1027   hr_api.mandatory_arg_error
1028     (p_api_name       => l_proc
1029     ,p_argument       => 'effective_date'
1030     ,p_argument_value => p_effective_date
1031     );
1032   --
1033   hr_api.mandatory_arg_error
1034     (p_api_name       =>  l_proc
1035     ,p_argument       =>  'validation_start_date'
1036     ,p_argument_value =>  p_validation_start_date
1037     );
1038   --
1039   hr_api.mandatory_arg_error
1040     (p_api_name        =>  l_proc
1041     ,p_argument       =>  'validation_end_date'
1042     ,p_argument_value =>  p_validation_end_date
1043     );
1044   hr_utility.set_location(l_proc, 20);
1045   --
1046   l_api_updating := per_ctc_shd.api_updating
1047          (p_contract_id            => p_contract_id
1048          ,p_effective_date         => p_effective_date
1049          ,p_object_version_number  => p_object_version_number
1050          );
1051   hr_utility.set_location(l_proc, 30);
1052   --
1053   if ((l_api_updating and
1054        nvl(per_ctc_shd.g_old_rec.type, hr_api.g_varchar2) <>
1055        nvl(p_extension_period_units, hr_api.g_varchar2))
1056     or (NOT l_api_updating))
1057   then
1058     hr_utility.set_location(l_proc, 40);
1059     --
1060     if p_extension_period_units is not null then
1061       --
1062       if hr_api.not_exists_in_dt_hr_lookups
1063         (p_effective_date        => p_effective_date
1064         ,p_validation_start_date => p_validation_start_date
1065         ,p_validation_end_date   => p_validation_end_date
1066         ,p_lookup_type           => 'QUALIFYING_UNITS'
1067         ,p_lookup_code           => p_extension_period_units
1068         )
1069       then
1070         --
1071         hr_utility.set_message(800, 'PER_52826_CTR_INV_EXTENSION_UN');
1072         hr_utility.raise_error;
1073         --
1074       end if;
1075       hr_utility.set_location(l_proc, 50);
1076       --
1077       -- Check that the extension exists when the extension units is not null
1078       --
1079       if p_extension_period is null then
1080         hr_utility.set_message(800, 'PER_52844_CTR_INV_EXTENSION');
1081         hr_utility.raise_error;
1082         --
1083       end if;
1084       hr_utility.set_location(l_proc, 60);
1085       --
1086     else
1087       --
1088       -- Check that the extension doesn't exist when the extension units is null
1089       --
1090       if p_extension_period is not null then
1091         hr_utility.set_message(800, 'PER_52844_CTR_INV_EXTENSION');
1092         hr_utility.raise_error;
1093         --
1094       end if;
1095      end if;
1096     hr_utility.set_location(l_proc, 70);
1097     --
1098   end if;
1099   --
1100   hr_utility.set_location(' Leaving:'|| l_proc, 80);
1101   --
1102 end chk_extension_period_units;
1103 --
1104 --  ---------------------------------------------------------------------------
1105 --  |-----------------------< chk_assignment_exists>------------------------|
1106 --  ---------------------------------------------------------------------------
1107 --
1108 --  Description:
1109 --    Function checks whether the given contract is referenced by any assignments and
1110 --    returns True of False accordingly.
1111 --
1112 --  Pre-conditions:
1113 --    None
1114 --
1115 --  In Arguments:
1116 --    p_contract_id
1117 --
1118 --  Post Success:
1119 --    True or False always returned.
1120 --
1121 --  Post Failure:
1122 --    Failure is not allowed.
1123 --
1124 --  Access Status:
1125 --    Internal Development Use Only.
1126 --
1127 function chk_assignment_exists
1128  (p_contract_id in per_contracts_f.contract_id%TYPE) return boolean is
1129    --
1130    cursor csr_assignment is
1131     select '1' from per_all_assignments_f
1132     where contract_id = p_contract_id;
1133    --
1134    l_proc           varchar2(72)  :=  g_package||'chk_assignment_exists';
1135    l_dummy          varchar2(1);
1136 --
1137 begin
1138   --
1139   hr_utility.set_location('Entering:'|| l_proc, 10);
1140   --
1141   open csr_assignment;
1142   fetch csr_assignment into l_dummy;
1143   if csr_assignment%found then
1147     close csr_assignment;
1144     close csr_assignment;
1145     return true;
1146   else
1148     return false;
1149   end if;
1150   --
1151 end chk_assignment_exists;
1152 --
1153 -- -----------------------------------------------------------------------
1154 -- |------------------------------< chk_df >-----------------------------|
1155 -- -----------------------------------------------------------------------
1156 --
1157 -- Description:
1158 --   Validates the all Descriptive Flexfield values.
1159 --
1160 -- Pre-conditions:
1161 --   All other columns have been validated. Must be called as the
1162 --   last step from insert_validate and update_validate.
1163 --
1164 -- In Arguments:
1165 --   p_rec
1166 --
1167 -- Post Success:
1168 --   If the Descriptive Flexfield structure column and data values are
1169 --   all valid this procedure will end normally and processing will
1170 --   continue.
1171 --
1172 -- Post Failure:
1173 --   If the Descriptive Flexfield structure column value or any of
1174 --   the data values are invalid then an application error is raised as
1175 --   a PL/SQL exception.
1176 --
1177 -- Access Status:
1178 --   Internal Row Handler Use Only.
1179 --
1180 procedure chk_df
1181   (p_rec in per_ctc_shd.g_rec_type) is
1182 --
1183   l_proc     varchar2(72) := g_package||'chk_df';
1184 --
1185 begin
1186   hr_utility.set_location('Entering:'||l_proc, 10);
1187   --
1188   if ((p_rec.contract_id is NULL) and (
1189     nvl(per_ctc_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
1190     nvl(p_rec.attribute_category, hr_api.g_varchar2) or
1191     nvl(per_ctc_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
1192     nvl(p_rec.attribute1, hr_api.g_varchar2) or
1193     nvl(per_ctc_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
1194     nvl(p_rec.attribute2, hr_api.g_varchar2) or
1195     nvl(per_ctc_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
1196     nvl(p_rec.attribute3, hr_api.g_varchar2) or
1197     nvl(per_ctc_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
1198     nvl(p_rec.attribute4, hr_api.g_varchar2) or
1199     nvl(per_ctc_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
1200     nvl(p_rec.attribute5, hr_api.g_varchar2) or
1201     nvl(per_ctc_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
1202     nvl(p_rec.attribute6, hr_api.g_varchar2) or
1203     nvl(per_ctc_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
1204     nvl(p_rec.attribute7, hr_api.g_varchar2) or
1205     nvl(per_ctc_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
1206     nvl(p_rec.attribute8, hr_api.g_varchar2) or
1207     nvl(per_ctc_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
1208     nvl(p_rec.attribute9, hr_api.g_varchar2) or
1209     nvl(per_ctc_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
1210     nvl(p_rec.attribute10, hr_api.g_varchar2) or
1211     nvl(per_ctc_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
1212     nvl(p_rec.attribute11, hr_api.g_varchar2) or
1213     nvl(per_ctc_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
1214     nvl(p_rec.attribute12, hr_api.g_varchar2) or
1215     nvl(per_ctc_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
1216     nvl(p_rec.attribute13, hr_api.g_varchar2) or
1217     nvl(per_ctc_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
1218     nvl(p_rec.attribute14, hr_api.g_varchar2) or
1219     nvl(per_ctc_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
1220     nvl(p_rec.attribute15, hr_api.g_varchar2) or
1221     nvl(per_ctc_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
1222     nvl(p_rec.attribute16, hr_api.g_varchar2) or
1223     nvl(per_ctc_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
1224     nvl(p_rec.attribute17, hr_api.g_varchar2) or
1225     nvl(per_ctc_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
1226     nvl(p_rec.attribute18, hr_api.g_varchar2) or
1227     nvl(per_ctc_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
1228     nvl(p_rec.attribute19, hr_api.g_varchar2) or
1229     nvl(per_ctc_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
1230     nvl(p_rec.attribute20, hr_api.g_varchar2)))
1231     or (p_rec.contract_id is null) then
1232    --
1233    -- Only execute the validation if absolutely necessary:
1234    -- a) During update, the structure column value or any
1235    --    of the attribute values have actually changed.
1236    -- b) During insert.
1237    --
1238 
1239      fnd_profile.put('PER_PERSON_ID',p_rec.person_id); -- bug 10133492
1240 
1241    hr_dflex_utility.ins_or_upd_descflex_attribs
1242      (p_appl_short_name     => 'PER'
1243       ,p_descflex_name      => 'PER_CONTRACTS'
1244       ,p_attribute_category => p_rec.attribute_category
1245       ,p_attribute1_name    => 'ATTRIBUTE1'
1246       ,p_attribute1_value   => p_rec.attribute1
1247       ,p_attribute2_name    => 'ATTRIBUTE2'
1248       ,p_attribute2_value   => p_rec.attribute2
1249       ,p_attribute3_name    => 'ATTRIBUTE3'
1250       ,p_attribute3_value   => p_rec.attribute3
1251       ,p_attribute4_name    => 'ATTRIBUTE4'
1252       ,p_attribute4_value   => p_rec.attribute4
1253       ,p_attribute5_name    => 'ATTRIBUTE5'
1254       ,p_attribute5_value   => p_rec.attribute5
1255       ,p_attribute6_name    => 'ATTRIBUTE6'
1256       ,p_attribute6_value   => p_rec.attribute6
1257       ,p_attribute7_name    => 'ATTRIBUTE7'
1258       ,p_attribute7_value   => p_rec.attribute7
1259       ,p_attribute8_name    => 'ATTRIBUTE8'
1260       ,p_attribute8_value   => p_rec.attribute8
1261       ,p_attribute9_name    => 'ATTRIBUTE9'
1262       ,p_attribute9_value   => p_rec.attribute9
1263       ,p_attribute10_name   => 'ATTRIBUTE10'
1264       ,p_attribute10_value  => p_rec.attribute10
1265       ,p_attribute11_name   => 'ATTRIBUTE11'
1269       ,p_attribute13_name   => 'ATTRIBUTE13'
1266       ,p_attribute11_value  => p_rec.attribute11
1267       ,p_attribute12_name   => 'ATTRIBUTE12'
1268       ,p_attribute12_value  => p_rec.attribute12
1270       ,p_attribute13_value  => p_rec.attribute13
1271       ,p_attribute14_name   => 'ATTRIBUTE14'
1272       ,p_attribute14_value  => p_rec.attribute14
1273       ,p_attribute15_name   => 'ATTRIBUTE15'
1274       ,p_attribute15_value  => p_rec.attribute15
1275       ,p_attribute16_name   => 'ATTRIBUTE16'
1276       ,p_attribute16_value  => p_rec.attribute16
1277       ,p_attribute17_name   => 'ATTRIBUTE17'
1278       ,p_attribute17_value  => p_rec.attribute17
1279       ,p_attribute18_name   => 'ATTRIBUTE18'
1280       ,p_attribute18_value  => p_rec.attribute18
1281       ,p_attribute19_name   => 'ATTRIBUTE19'
1282       ,p_attribute19_value  => p_rec.attribute19
1283       ,p_attribute20_name   => 'ATTRIBUTE20'
1284       ,p_attribute20_value  => p_rec.attribute20
1285       );
1286   end if;
1287   --
1288   hr_utility.set_location(' Leaving:'||l_proc, 20);
1289 
1290 end chk_df;
1291 --
1292 -- -----------------------------------------------------------------------
1293 -- |------------------------------< chk_ddf >----------------------------|
1294 -- -----------------------------------------------------------------------
1295 --
1296 -- Description:
1297 --   Validates the all Developer Descriptive Flexfield values.
1298 --
1299 -- Pre-conditions:
1300 --   All other columns have been validated. Must be called as the
1301 --   second last step from insert_validate and update_validate.
1302 --   Before any Descriptive Flexfield (chk_df) calls.
1303 --
1304 -- In Arguments:
1305 --   p_rec
1306 --
1307 -- Post Success:
1308 --   If the Developer Descriptive Flexfield structure column and data
1309 --   values are all valid this procedure will end normally and
1310 --   processing will continue.
1311 --
1312 -- Post Failure:
1313 --   If the DDF structure column value or any of the data values
1314 --   are invalid then an application error is raised as
1315 --   a PL/SQL exception.
1316 --
1317 -- Access Status:
1318 --   Internal Row Handler Use Only.
1319 --
1320 -- {End Of Comments}
1321 -- ----------------------------------------------------------------------------
1322 --
1323 procedure chk_ddf
1324   (p_rec   in per_ctc_shd.g_rec_type) is
1325 --
1326   l_proc       varchar2(72) := g_package||'chk_ddf';
1327   l_error      exception;
1328 --
1329 Begin
1330   hr_utility.set_location('Entering:'||l_proc, 5);
1331   --
1332   -- Check if the row is being inserted or updated and a
1333   -- value has changed
1334   --
1335   if (p_rec.contract_id is null)
1336     or ((p_rec.contract_id is not null)
1337     and
1338     nvl(per_ctc_shd.g_old_rec.ctr_information_category, hr_api.g_varchar2) <>
1339     nvl(p_rec.ctr_information_category, hr_api.g_varchar2) or
1340     nvl(per_ctc_shd.g_old_rec.ctr_information1, hr_api.g_varchar2) <>
1341     nvl(p_rec.ctr_information1, hr_api.g_varchar2) or
1342     nvl(per_ctc_shd.g_old_rec.ctr_information2, hr_api.g_varchar2) <>
1343     nvl(p_rec.ctr_information2, hr_api.g_varchar2) or
1344     nvl(per_ctc_shd.g_old_rec.ctr_information3, hr_api.g_varchar2) <>
1345     nvl(p_rec.ctr_information3, hr_api.g_varchar2) or
1346     nvl(per_ctc_shd.g_old_rec.ctr_information4, hr_api.g_varchar2) <>
1347     nvl(p_rec.ctr_information4, hr_api.g_varchar2) or
1348     nvl(per_ctc_shd.g_old_rec.ctr_information5, hr_api.g_varchar2) <>
1349     nvl(p_rec.ctr_information5, hr_api.g_varchar2) or
1350     nvl(per_ctc_shd.g_old_rec.ctr_information6, hr_api.g_varchar2) <>
1351     nvl(p_rec.ctr_information6, hr_api.g_varchar2) or
1352     nvl(per_ctc_shd.g_old_rec.ctr_information7, hr_api.g_varchar2) <>
1353     nvl(p_rec.ctr_information7, hr_api.g_varchar2) or
1354     nvl(per_ctc_shd.g_old_rec.ctr_information8, hr_api.g_varchar2) <>
1355     nvl(p_rec.ctr_information8, hr_api.g_varchar2) or
1356     nvl(per_ctc_shd.g_old_rec.ctr_information9, hr_api.g_varchar2) <>
1357     nvl(p_rec.ctr_information9, hr_api.g_varchar2) or
1358     nvl(per_ctc_shd.g_old_rec.ctr_information10, hr_api.g_varchar2) <>
1359     nvl(p_rec.ctr_information10, hr_api.g_varchar2) or
1360     nvl(per_ctc_shd.g_old_rec.ctr_information11, hr_api.g_varchar2) <>
1361     nvl(p_rec.ctr_information11, hr_api.g_varchar2) or
1362     nvl(per_ctc_shd.g_old_rec.ctr_information12, hr_api.g_varchar2) <>
1363     nvl(p_rec.ctr_information12, hr_api.g_varchar2) or
1364     nvl(per_ctc_shd.g_old_rec.ctr_information13, hr_api.g_varchar2) <>
1365     nvl(p_rec.ctr_information13, hr_api.g_varchar2) or
1366     nvl(per_ctc_shd.g_old_rec.ctr_information14, hr_api.g_varchar2) <>
1367     nvl(p_rec.ctr_information14, hr_api.g_varchar2) or
1368     nvl(per_ctc_shd.g_old_rec.ctr_information15, hr_api.g_varchar2) <>
1369     nvl(p_rec.ctr_information15, hr_api.g_varchar2) or
1370     nvl(per_ctc_shd.g_old_rec.ctr_information16, hr_api.g_varchar2) <>
1371     nvl(p_rec.ctr_information16, hr_api.g_varchar2) or
1372     nvl(per_ctc_shd.g_old_rec.ctr_information17, hr_api.g_varchar2) <>
1373     nvl(p_rec.ctr_information17, hr_api.g_varchar2) or
1374     nvl(per_ctc_shd.g_old_rec.ctr_information18, hr_api.g_varchar2) <>
1375     nvl(p_rec.ctr_information18, hr_api.g_varchar2) or
1376     nvl(per_ctc_shd.g_old_rec.ctr_information19, hr_api.g_varchar2) <>
1377     nvl(p_rec.ctr_information19, hr_api.g_varchar2) or
1378     nvl(per_ctc_shd.g_old_rec.ctr_information20, hr_api.g_varchar2) <>
1379     nvl(p_rec.ctr_information20, hr_api.g_varchar2))
1380   then
1381     --
1382     hr_dflex_utility.ins_or_upd_descflex_attribs
1386       ,p_attribute1_name    => 'CTR_INFORMATION1'
1383       (p_appl_short_name    => 'PER'
1384       ,p_descflex_name      => 'Contract Developer DF'
1385       ,p_attribute_category => p_rec.ctr_information_category
1387       ,p_attribute1_value   => p_rec.ctr_information1
1388       ,p_attribute2_name    => 'CTR_INFORMATION2'
1389       ,p_attribute2_value   => p_rec.ctr_information2
1390       ,p_attribute3_name    => 'CTR_INFORMATION3'
1391       ,p_attribute3_value   => p_rec.ctr_information3
1392       ,p_attribute4_name    => 'CTR_INFORMATION4'
1393       ,p_attribute4_value   => p_rec.ctr_information4
1394       ,p_attribute5_name    => 'CTR_INFORMATION5'
1395       ,p_attribute5_value   => p_rec.ctr_information5
1396       ,p_attribute6_name    => 'CTR_INFORMATION6'
1397       ,p_attribute6_value   => p_rec.ctr_information6
1398       ,p_attribute7_name    => 'CTR_INFORMATION7'
1399       ,p_attribute7_value   => p_rec.ctr_information7
1400       ,p_attribute8_name    => 'CTR_INFORMATION8'
1401       ,p_attribute8_value   => p_rec.ctr_information8
1402       ,p_attribute9_name    => 'CTR_INFORMATION9'
1403       ,p_attribute9_value   => p_rec.ctr_information9
1404       ,p_attribute10_name   => 'CTR_INFORMATION10'
1405       ,p_attribute10_value  => p_rec.ctr_information10
1406       ,p_attribute11_name   => 'CTR_INFORMATION11'
1407       ,p_attribute11_value  => p_rec.ctr_information11
1408       ,p_attribute12_name   => 'CTR_INFORMATION12'
1409       ,p_attribute12_value  => p_rec.ctr_information12
1410       ,p_attribute13_name   => 'CTR_INFORMATION13'
1411       ,p_attribute13_value  => p_rec.ctr_information13
1412       ,p_attribute14_name   => 'CTR_INFORMATION14'
1413       ,p_attribute14_value  => p_rec.ctr_information14
1414       ,p_attribute15_name   => 'CTR_INFORMATION15'
1415       ,p_attribute15_value  => p_rec.ctr_information15
1416       ,p_attribute16_name   => 'CTR_INFORMATION16'
1417       ,p_attribute16_value  => p_rec.ctr_information16
1418       ,p_attribute17_name   => 'CTR_INFORMATION17'
1419       ,p_attribute17_value  => p_rec.ctr_information17
1420       ,p_attribute18_name   => 'CTR_INFORMATION18'
1421       ,p_attribute18_value  => p_rec.ctr_information18
1422       ,p_attribute19_name   => 'CTR_INFORMATION19'
1423       ,p_attribute19_value  => p_rec.ctr_information19
1424       ,p_attribute20_name   => 'CTR_INFORMATION20'
1425       ,p_attribute20_value  => p_rec.ctr_information20
1426       );
1427     --
1428   end if;
1429   --
1430   hr_utility.set_location(' Leaving:'||l_proc, 10);
1431 end chk_ddf;
1432 --
1433 --  -------------------------------------------------------------
1434 --  |-------------------< chk_del_mode>-------------------------|
1435 --  -------------------------------------------------------------
1436 --
1437 procedure chk_del_mode
1438  (p_datetrack_mode         in     varchar2)
1439  is
1440  --
1441   l_proc       varchar2(72) := g_package||'chk_del_mode';
1442  --
1443 begin
1444   hr_utility.set_location('Entering:'|| l_proc, 10);
1445       --
1446       -- Check that the datetrack mode is correct
1447       --
1448       if upper(p_datetrack_mode) = 'DELETE' then
1449         hr_utility.set_message(800, 'PER_52842_CTR_DEL_MODE');
1450         hr_utility.raise_error;
1451         --
1452       end if;
1453       hr_utility.set_location(l_proc, 20);
1454       --
1455    hr_utility.set_location(' Leaving:'|| l_proc, 30);
1456   --
1457 end chk_del_mode;
1458 --
1459 --  ---------------------------------------------------------------------------
1460 --  |---------------------< return_legislation_code >-------------------------|
1461 --  ---------------------------------------------------------------------------
1462 --
1463 function return_legislation_code
1464   (p_contract_id              in number
1465   ) return varchar2 is
1466   --
1467   -- Declare cursor
1468   --
1469   cursor csr_leg_code is
1470     select pbg.legislation_code
1471       from per_business_groups  pbg
1472          , per_contracts_f      ctr
1473      where ctr.contract_id       = p_contract_id
1474        and pbg.business_group_id = ctr.business_group_id
1475   order by ctr.effective_start_date;
1476   --
1477   -- Declare local variables
1478   --
1479   l_legislation_code  varchar2(150);
1480   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
1481 begin
1482   hr_utility.set_location('Entering:'|| l_proc, 10);
1483   --
1484   -- Ensure that all the mandatory parameter are not null
1485   --
1486   hr_api.mandatory_arg_error(p_api_name       => l_proc,
1487                              p_argument       => 'contract_id',
1488                              p_argument_value => p_contract_id);
1489   --
1490   if nvl(g_contract_id, hr_api.g_number) = p_contract_id then
1491     --
1492     -- The legislation code has already been found with a previous
1493     -- call to this function. Just return the value in the global
1494     -- variable.
1495     --
1496     l_legislation_code := g_legislation_code;
1497     hr_utility.set_location(l_proc, 20);
1498   else
1499     --
1500     -- The ID is different to the last call to this function
1501     -- or this is the first call to this function.
1502     --
1503   open csr_leg_code;
1504   fetch csr_leg_code into l_legislation_code;
1505   if csr_leg_code%notfound then
1506     close csr_leg_code;
1507     --
1508     -- The primary key is invalid therefore we must error
1509     --
1510     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
1514   close csr_leg_code;
1511     hr_utility.raise_error;
1512   end if;
1513   --
1515   hr_utility.set_location(' Leaving:'|| l_proc, 20);
1516   --
1517     g_contract_id := p_contract_id;
1518     g_legislation_code := l_legislation_code;
1519   end if;
1520   hr_utility.set_location(' Leaving:'|| l_proc, 25);
1521   --
1522   return l_legislation_code;
1523 end return_legislation_code;
1524 --
1525 -- ----------------------------------------------------------------------------
1526 -- |--------------------------< dt_update_validate >--------------------------|
1527 -- ----------------------------------------------------------------------------
1528 -- {Start Of Comments}
1529 --
1530 -- Description:
1531 --   This procedure is used for referential integrity of datetracked
1532 --   parent entities when a datetrack update operation is taking place
1533 --   and where there is no cascading of update defined for this entity.
1534 --
1535 -- Prerequisites:
1536 --   This procedure is called from the update_validate.
1537 --
1538 -- In Parameters:
1539 --
1540 -- Post Success:
1541 --   Processing continues.
1542 --
1543 -- Post Failure:
1544 --
1545 -- Developer Implementation Notes:
1546 --   This procedure should not need maintenance unless the HR Schema model
1547 --   changes.
1548 --
1549 -- Access Status:
1550 --   Internal Row Handler Use Only.
1551 --
1552 -- {End Of Comments}
1553 -- ----------------------------------------------------------------------------
1554 Procedure dt_update_validate
1555             (
1556              p_person_id                     in number default hr_api.g_number,
1557 	     p_datetrack_mode		     in varchar2,
1558              p_validation_start_date	     in date,
1559 	     p_validation_end_date	     in date) Is
1560 --
1561   l_proc	    varchar2(72) := g_package||'dt_update_validate';
1562   l_integrity_error Exception;
1563   l_table_name	    all_tables.table_name%TYPE;
1564 --
1565 Begin
1566   hr_utility.set_location('Entering:'||l_proc, 5);
1567   --
1568   -- Ensure that the p_datetrack_mode argument is not null
1569   --
1570   hr_api.mandatory_arg_error
1571     (p_api_name       => l_proc,
1572      p_argument       => 'datetrack_mode',
1573      p_argument_value => p_datetrack_mode);
1574   --
1575   -- Only perform the validation if the datetrack update mode is valid
1576   --
1577   If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
1578     --
1579     --
1580     -- Ensure the arguments are not null
1581     --
1582     hr_api.mandatory_arg_error
1583       (p_api_name       => l_proc,
1584        p_argument       => 'validation_start_date',
1585        p_argument_value => p_validation_start_date);
1586     --
1587     hr_api.mandatory_arg_error
1588       (p_api_name       => l_proc,
1589        p_argument       => 'validation_end_date',
1590        p_argument_value => p_validation_end_date);
1591     --
1592     If ((nvl(p_person_id, hr_api.g_number) <> hr_api.g_number) and
1593       NOT (dt_api.check_min_max_dates
1594             (p_base_table_name => 'per_people_f',
1595              p_base_key_column => 'person_id',
1596              p_base_key_value  => p_person_id,
1597              p_from_date       => p_validation_start_date,
1598              p_to_date         => p_validation_end_date)))  Then
1599       l_table_name := 'people';
1600       Raise l_integrity_error;
1601     End If;
1602     --
1603   End If;
1604   --
1605   hr_utility.set_location(' Leaving:'||l_proc, 10);
1606 Exception
1607   When l_integrity_error Then
1608     --
1609     -- A referential integrity check was violated therefore
1610     -- we must error
1611     --
1612     hr_utility.set_message(801, 'HR_7216_DT_UPD_INTEGRITY_ERR');
1613     hr_utility.set_message_token('TABLE_NAME', l_table_name);
1614     hr_utility.raise_error;
1615   When Others Then
1616     --
1617     -- An unhandled or unexpected error has occurred which
1618     -- we must report
1619     --
1620     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
1621     hr_utility.set_message_token('PROCEDURE', l_proc);
1622     hr_utility.set_message_token('STEP','15');
1623     hr_utility.raise_error;
1624 
1625 End dt_update_validate;
1626 --
1627 -- ----------------------------------------------------------------------------
1628 -- |--------------------------< dt_delete_validate >--------------------------|
1629 -- ----------------------------------------------------------------------------
1630 -- {Start Of Comments}
1631 --
1632 -- Description:
1633 --   This procedure is used for referential integrity of datetracked
1634 --   child entities when either a datetrack DELETE or ZAP is in operation
1635 --   and where there is no cascading of delete defined for this entity.
1636 --   For the datetrack mode of DELETE or ZAP we must ensure that no
1637 --   datetracked child rows exist between the validation start and end
1638 --   dates.
1639 --
1640 -- Prerequisites:
1641 --   This procedure is called from the delete_validate.
1642 --
1643 -- In Parameters:
1644 --
1645 -- Post Success:
1646 --   Processing continues.
1647 --
1648 -- Post Failure:
1649 --   If a row exists by determining the returning Boolean value from the
1650 --   generic dt_api.rows_exist function then we must supply an error via
1651 --   the use of the local exception handler l_rows_exist.
1652 --
1653 -- Developer Implementation Notes:
1654 --   This procedure should not need maintenance unless the HR Schema model
1655 --   changes.
1656 --
1657 -- Access Status:
1658 --   Internal Row Handler Use Only.
1662 Procedure dt_delete_validate
1659 --
1660 -- {End Of Comments}
1661 -- ----------------------------------------------------------------------------
1663           (p_contract_id		in number,
1664            p_datetrack_mode		in varchar2,
1665 	     p_validation_start_date	in date,
1666 	     p_validation_end_date	in date) Is
1667 --
1668   l_proc	varchar2(72) 	:= g_package||'dt_delete_validate';
1669   l_rows_exist	Exception;
1670   l_table_name	all_tables.table_name%TYPE;
1671 --
1672 Begin
1673   hr_utility.set_location('Entering:'||l_proc, 5);
1674   --
1675   -- Ensure that the p_datetrack_mode argument is not null
1676   --
1677   hr_api.mandatory_arg_error
1678     (p_api_name       => l_proc,
1679      p_argument       => 'datetrack_mode',
1680      p_argument_value => p_datetrack_mode);
1681   --
1682   -- Only perform the validation if the datetrack mode is either
1683   -- DELETE or ZAP
1684   --
1685   If (p_datetrack_mode = 'DELETE' or
1686       p_datetrack_mode = 'ZAP') then
1687     --
1688     --
1689     -- Ensure the arguments are not null
1690     --
1691     hr_api.mandatory_arg_error
1692       (p_api_name       => l_proc,
1693        p_argument       => 'validation_start_date',
1694        p_argument_value => p_validation_start_date);
1695     --
1696     hr_api.mandatory_arg_error
1697       (p_api_name       => l_proc,
1698        p_argument       => 'validation_end_date',
1699        p_argument_value => p_validation_end_date);
1700     --
1701     hr_api.mandatory_arg_error
1702       (p_api_name       => l_proc,
1703        p_argument       => 'contract_id',
1704        p_argument_value => p_contract_id);
1705     --
1706     --
1707     --
1708   End If;
1709   --
1710   hr_utility.set_location(' Leaving:'||l_proc, 10);
1711 Exception
1712   When l_rows_exist Then
1713     --
1714     -- A referential integrity check was violated therefore
1715     -- we must error
1716     --
1717     hr_utility.set_message(801, 'HR_7215_DT_CHILD_EXISTS');
1718     hr_utility.set_message_token('TABLE_NAME', l_table_name);
1719     hr_utility.raise_error;
1720   When Others Then
1721     --
1722     -- An unhandled or unexpected error has occurred which
1723     -- we must report
1724     --
1725     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
1726     hr_utility.set_message_token('PROCEDURE', l_proc);
1727     hr_utility.set_message_token('STEP','15');
1728     hr_utility.raise_error;
1729 
1730 End dt_delete_validate;
1731 --
1732 -- ----------------------------------------------------------------------------
1733 -- |---------------------------< insert_validate >----------------------------|
1734 -- ----------------------------------------------------------------------------
1735 Procedure insert_validate
1736 	(p_rec 			 in per_ctc_shd.g_rec_type,
1737 	 p_effective_date	 in date,
1738 	 p_datetrack_mode	 in varchar2,
1739 	 p_validation_start_date in date,
1740 	 p_validation_end_date	 in date) is
1741   --
1742   l_proc	varchar2(72) := g_package||'insert_validate';
1743   l_session_id  number;
1744   --
1745 Begin
1746   hr_utility.set_location('Entering:'||l_proc, 5);
1747   --
1748   -- Call all supporting business operations
1749   --
1750   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
1751   --
1752   hr_utility.set_location(l_proc, 7);
1753   --
1754   -- Set the business group profile as this is used by the flexfield validation.
1755   --
1756   hr_kflex_utility.set_profiles
1757      (p_business_group_id => p_rec.business_group_id);
1758   --
1759   hr_utility.set_location(l_proc, 8);
1760   --
1761   -- Set the session date as this is used by the flexfield validation.
1762   --
1763   hr_kflex_utility.set_session_date
1764      (p_effective_date => p_effective_date
1765      ,p_session_id     => l_session_id);
1766   --
1767   hr_utility.set_location(l_proc, 10);
1768   --
1769   chk_person_id
1770      (p_rec.person_id,
1771       p_rec.business_group_id,
1772       p_effective_date);
1773   --
1774   hr_utility.set_location(l_proc, 15);
1775   --
1776   chk_type
1777      (p_rec.contract_id,
1778       p_rec.type,
1779       p_effective_date,
1780       p_validation_start_date,
1781       p_validation_end_date,
1782       p_rec.object_version_number
1783      );
1784   --
1785   hr_utility.set_location(l_proc, 20);
1786   --
1787   chk_status
1788    (p_rec.contract_id,
1789     p_rec.status,
1790     p_effective_date,
1791     p_validation_start_date,
1792     p_validation_end_date,
1793     p_rec.object_version_number
1794    );
1795   --
1796   hr_utility.set_location(l_proc, 25);
1797   --
1798   chk_status_reason
1799    (p_rec.contract_id,
1800     p_rec.status_reason,
1801     p_effective_date,
1802     p_validation_start_date,
1803     p_validation_end_date,
1804     p_rec.object_version_number
1805    );
1806   --
1807   hr_utility.set_location(l_proc, 30);
1808   --
1809   chk_duration_units
1810    (p_rec.contract_id,
1811     p_rec.duration,
1812     p_rec.duration_units,
1813     p_effective_date,
1814     p_validation_start_date,
1815     p_validation_end_date,
1816     p_rec.object_version_number
1817    );
1818   --
1819   hr_utility.set_location(l_proc, 35);
1820   --
1821   chk_start_reason
1822    (p_rec.contract_id,
1823     p_rec.start_reason,
1824     p_effective_date,
1825     p_validation_start_date,
1829   --
1826     p_validation_end_date,
1827     p_rec.object_version_number
1828    );
1830   hr_utility.set_location(l_proc, 40);
1831   --
1832   chk_end_reason
1833    (p_rec.contract_id,
1834     p_rec.end_reason,
1835     p_effective_date,
1836     p_validation_start_date,
1837     p_validation_end_date,
1838     p_rec.object_version_number
1839    );
1840   --
1841   hr_utility.set_location(l_proc, 45);
1842   --
1843   chk_extension_period_units
1844    (p_rec.contract_id,
1845     p_rec.extension_period,
1846     p_rec.extension_period_units,
1847     p_effective_date,
1848     p_validation_start_date,
1849     p_validation_end_date,
1850     p_rec.object_version_number
1851    );
1852   --
1853   hr_utility.set_location(l_proc, 47);
1854   --
1855   chk_reference
1856   (p_rec.person_id
1857   ,p_rec.reference
1858   ,p_datetrack_mode
1859   ,null
1860   );
1861   --
1862   hr_utility.set_location(l_proc, 50);
1863   --
1864   per_ctc_bus.chk_ddf(p_rec => p_rec);
1865   --
1866   hr_utility.set_location(l_proc, 55);
1867   --
1868   per_ctc_bus.chk_df(p_rec => p_rec);
1869   --
1870   hr_utility.set_location(l_proc, 57);
1871   --
1872   -- Unset the session date.
1873   --
1874   hr_kflex_utility.unset_session_date
1875      (p_session_id => l_session_id);
1876   --
1877   hr_utility.set_location(l_proc, 60);
1878   --
1879 End insert_validate;
1880 --
1881 -- ----------------------------------------------------------------------------
1882 -- |---------------------------< update_validate >----------------------------|
1883 -- ----------------------------------------------------------------------------
1884 Procedure update_validate
1885 	(p_rec 			 in per_ctc_shd.g_rec_type,
1886 	 p_effective_date	 in date,
1887 	 p_datetrack_mode	 in varchar2,
1888 	 p_validation_start_date in date,
1889 	 p_validation_end_date	 in date) is
1890   --
1891   l_proc	varchar2(72) := g_package||'update_validate';
1892   l_session_id  number;
1893   --
1894 Begin
1895   hr_utility.set_location('Entering:'||l_proc, 5);
1896   --
1897   -- Call all supporting business operations
1898   --
1899   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
1900   --
1901   hr_utility.set_location(l_proc, 7);
1902   --
1903   -- Set the business group profile as this is used by the flexfield validation.
1904   --
1905   hr_kflex_utility.set_profiles
1906      (p_business_group_id => p_rec.business_group_id);
1907   --
1908   hr_utility.set_location(l_proc, 8);
1909   --
1910   -- Set the session date as this is used by the flexfield validation.
1911   --
1912   hr_kflex_utility.set_session_date
1913      (p_effective_date => p_effective_date
1914      ,p_session_id     => l_session_id);
1915   --
1916   hr_utility.set_location(l_proc, 10);
1917   --
1918   chk_type
1919      (p_rec.contract_id,
1920       p_rec.type,
1921       p_effective_date,
1922       p_validation_start_date,
1923       p_validation_end_date,
1924       p_rec.object_version_number
1925      );
1926   --
1927   hr_utility.set_location(l_proc, 15);
1928   --
1929   chk_status
1930    (p_rec.contract_id,
1931     p_rec.status,
1932     p_effective_date,
1933     p_validation_start_date,
1934     p_validation_end_date,
1935     p_rec.object_version_number
1936    );
1937   --
1938   hr_utility.set_location(l_proc, 20);
1939   --
1940   chk_status_reason
1941    (p_rec.contract_id,
1942     p_rec.status_reason,
1943     p_effective_date,
1944     p_validation_start_date,
1945     p_validation_end_date,
1946     p_rec.object_version_number
1947    );
1948   --
1949   hr_utility.set_location(l_proc, 25);
1950   --
1951   chk_duration_units
1952    (p_rec.contract_id,
1953     p_rec.duration,
1954     p_rec.duration_units,
1955     p_effective_date,
1956     p_validation_start_date,
1957     p_validation_end_date,
1958     p_rec.object_version_number
1959    );
1960   --
1961   hr_utility.set_location(l_proc, 30);
1962   --
1963   chk_start_reason
1964    (p_rec.contract_id,
1965     p_rec.start_reason,
1966     p_effective_date,
1967     p_validation_start_date,
1968     p_validation_end_date,
1969     p_rec.object_version_number
1970    );
1971   --
1972   hr_utility.set_location(l_proc, 35);
1973   --
1974   chk_end_reason
1975    (p_rec.contract_id,
1976     p_rec.end_reason,
1977     p_effective_date,
1978     p_validation_start_date,
1979     p_validation_end_date,
1980     p_rec.object_version_number
1981    );
1982   --
1983   hr_utility.set_location(l_proc, 40);
1984   --
1985   chk_extension_period_units
1986    (p_rec.contract_id,
1987     p_rec.extension_period,
1988     p_rec.extension_period_units,
1989     p_effective_date,
1990     p_validation_start_date,
1991     p_validation_end_date,
1992     p_rec.object_version_number
1993    );
1994   --
1995   hr_utility.set_location(l_proc, 42);
1996   --
1997   chk_reference
1998   (p_rec.person_id
1999   ,p_rec.reference
2000   ,p_datetrack_mode
2001   ,p_rec.contract_id
2002   );
2003   --
2004   hr_utility.set_location(l_proc, 45);
2005   --
2006   -- Call the datetrack update integrity operation
2007   --
2008   dt_update_validate
2009     (
2010      p_datetrack_mode                => p_datetrack_mode,
2014   hr_utility.set_location(l_proc, 50);
2011      p_validation_start_date         => p_validation_start_date,
2012      p_validation_end_date           => p_validation_end_date);
2013   --
2015   --
2016   per_ctc_bus.chk_ddf(p_rec => p_rec);
2017   --
2018   hr_utility.set_location(l_proc, 55);
2019   --
2020   per_ctc_bus.chk_df(p_rec => p_rec);
2021   --
2022   hr_utility.set_location(l_proc, 57);
2023   --
2024   -- Unset the session date.
2025   --
2026   hr_kflex_utility.unset_session_date
2027      (p_session_id => l_session_id);
2028   --
2029   hr_utility.set_location(' Leaving:'||l_proc, 60);
2030   --
2031 End update_validate;
2032 --
2033 -- ----------------------------------------------------------------------------
2034 -- |---------------------------< delete_validate >----------------------------|
2035 -- ----------------------------------------------------------------------------
2036 Procedure delete_validate
2037 	(p_rec 			 in per_ctc_shd.g_rec_type,
2038 	 p_effective_date	 in date,
2039 	 p_datetrack_mode	 in varchar2,
2040 	 p_validation_start_date in date,
2041 	 p_validation_end_date	 in date) is
2042 --
2043   l_proc	varchar2(72) := g_package||'delete_validate';
2044 --
2045 Begin
2046   hr_utility.set_location('Entering:'||l_proc, 5);
2047   --
2048   -- Call all supporting business operations
2049   --
2050   dt_delete_validate
2051     (p_datetrack_mode		=> p_datetrack_mode,
2052      p_validation_start_date	=> p_validation_start_date,
2053      p_validation_end_date	=> p_validation_end_date,
2054      p_contract_id		=> p_rec.contract_id);
2055   --
2056   hr_utility.set_location(l_proc, 10);
2057   --
2058   chk_del_mode
2059    (p_datetrack_mode		=> p_datetrack_mode) ;
2060   --
2061   hr_utility.set_location(l_proc, 15);
2062   --
2063   if chk_assignment_exists (p_contract_id => p_rec.contract_id) then
2064      hr_utility.set_message(800, 'PER_52841_CTR_DEL_ASG');
2065      hr_utility.raise_error;
2066   end if;
2067   hr_utility.set_location(' Leaving:'||l_proc, 20);
2068 
2069 End delete_validate;
2070 --
2071 end per_ctc_bus;