DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_CTC_BUS

Source


1 Package Body per_ctc_bus as
2 /* $Header: pectcrhi.pkb 115.20 2003/02/11 14:24:18 vramanai ship $ */
3 --
4 -- ----------------------------------------------------------------------------
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;
89   hr_utility.set_location(' Leaving:'||l_proc, 9);
90 end check_non_updateable_args;
91 --
92 --  ---------------------------------------------------------------------------
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',
244                           'UPDATE_CHANGE_INSERT')
245   AND p_reference <> per_ctc_shd.g_old_rec.reference
246   THEN
247     open csr_update;
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:
397 --    p_contract_id
398 --    p_status
399 --    p_effective_date
400 --    p_validation_start_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
438     );
435     (p_api_name       => l_proc
436     ,p_argument       => 'effective_date'
437     ,p_argument_value => p_effective_date
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
549     (p_api_name       => l_proc
550     ,p_argument       => 'effective_date'
551     ,p_argument_value => p_effective_date
552     );
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);
583       -- Check that the status_reason exists in hr_lookups for the
580     --
581     if p_status_reason is not null then
582       --
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
695     hr_utility.set_location(l_proc, 40);
696     --
697     if p_duration_units is not null then
698       --
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       --
723         hr_utility.set_message(800, 'PER_52843_INV_DURATION');
720       -- Check that the duration exists when the duration units is not null
721       --
722       if p_duration is null then
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 >------------------------------|
866 --    Check that the passed in lookup code exists in hr_lookups for the with an
863 --  ---------------------------------------------------------------------------
864 --
865 --  Description:
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 --
1010  ,p_extension_period_units in     per_contracts_f.extension_period_units%TYPE
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
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
1144     close csr_assignment;
1145     return true;
1146   else
1147     close csr_assignment;
1148     return false;
1149   end if;
1150   --
1151 end chk_assignment_exists;
1152 --
1153 -- -----------------------------------------------------------------------
1157 -- Description:
1154 -- |------------------------------< chk_df >-----------------------------|
1155 -- -----------------------------------------------------------------------
1156 --
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    hr_dflex_utility.ins_or_upd_descflex_attribs
1239      (p_appl_short_name     => 'PER'
1240       ,p_descflex_name      => 'PER_CONTRACTS'
1241       ,p_attribute_category => p_rec.attribute_category
1242       ,p_attribute1_name    => 'ATTRIBUTE1'
1243       ,p_attribute1_value   => p_rec.attribute1
1244       ,p_attribute2_name    => 'ATTRIBUTE2'
1245       ,p_attribute2_value   => p_rec.attribute2
1246       ,p_attribute3_name    => 'ATTRIBUTE3'
1247       ,p_attribute3_value   => p_rec.attribute3
1248       ,p_attribute4_name    => 'ATTRIBUTE4'
1249       ,p_attribute4_value   => p_rec.attribute4
1250       ,p_attribute5_name    => 'ATTRIBUTE5'
1251       ,p_attribute5_value   => p_rec.attribute5
1252       ,p_attribute6_name    => 'ATTRIBUTE6'
1253       ,p_attribute6_value   => p_rec.attribute6
1254       ,p_attribute7_name    => 'ATTRIBUTE7'
1255       ,p_attribute7_value   => p_rec.attribute7
1256       ,p_attribute8_name    => 'ATTRIBUTE8'
1257       ,p_attribute8_value   => p_rec.attribute8
1258       ,p_attribute9_name    => 'ATTRIBUTE9'
1259       ,p_attribute9_value   => p_rec.attribute9
1260       ,p_attribute10_name   => 'ATTRIBUTE10'
1261       ,p_attribute10_value  => p_rec.attribute10
1262       ,p_attribute11_name   => 'ATTRIBUTE11'
1263       ,p_attribute11_value  => p_rec.attribute11
1264       ,p_attribute12_name   => 'ATTRIBUTE12'
1265       ,p_attribute12_value  => p_rec.attribute12
1269       ,p_attribute14_value  => p_rec.attribute14
1266       ,p_attribute13_name   => 'ATTRIBUTE13'
1267       ,p_attribute13_value  => p_rec.attribute13
1268       ,p_attribute14_name   => 'ATTRIBUTE14'
1270       ,p_attribute15_name   => 'ATTRIBUTE15'
1271       ,p_attribute15_value  => p_rec.attribute15
1272       ,p_attribute16_name   => 'ATTRIBUTE16'
1273       ,p_attribute16_value  => p_rec.attribute16
1274       ,p_attribute17_name   => 'ATTRIBUTE17'
1275       ,p_attribute17_value  => p_rec.attribute17
1276       ,p_attribute18_name   => 'ATTRIBUTE18'
1277       ,p_attribute18_value  => p_rec.attribute18
1278       ,p_attribute19_name   => 'ATTRIBUTE19'
1279       ,p_attribute19_value  => p_rec.attribute19
1280       ,p_attribute20_name   => 'ATTRIBUTE20'
1281       ,p_attribute20_value  => p_rec.attribute20
1282       );
1283   end if;
1284   --
1285   hr_utility.set_location(' Leaving:'||l_proc, 20);
1286 
1287 end chk_df;
1288 --
1289 -- -----------------------------------------------------------------------
1290 -- |------------------------------< chk_ddf >----------------------------|
1291 -- -----------------------------------------------------------------------
1292 --
1293 -- Description:
1294 --   Validates the all Developer Descriptive Flexfield values.
1295 --
1296 -- Pre-conditions:
1297 --   All other columns have been validated. Must be called as the
1298 --   second last step from insert_validate and update_validate.
1299 --   Before any Descriptive Flexfield (chk_df) calls.
1300 --
1301 -- In Arguments:
1302 --   p_rec
1303 --
1304 -- Post Success:
1305 --   If the Developer Descriptive Flexfield structure column and data
1306 --   values are all valid this procedure will end normally and
1307 --   processing will continue.
1308 --
1309 -- Post Failure:
1310 --   If the DDF structure column value or any of the data values
1311 --   are invalid then an application error is raised as
1312 --   a PL/SQL exception.
1313 --
1314 -- Access Status:
1315 --   Internal Row Handler Use Only.
1316 --
1317 -- {End Of Comments}
1318 -- ----------------------------------------------------------------------------
1319 --
1320 procedure chk_ddf
1321   (p_rec   in per_ctc_shd.g_rec_type) is
1322 --
1323   l_proc       varchar2(72) := g_package||'chk_ddf';
1324   l_error      exception;
1325 --
1326 Begin
1327   hr_utility.set_location('Entering:'||l_proc, 5);
1328   --
1329   -- Check if the row is being inserted or updated and a
1330   -- value has changed
1331   --
1332   if (p_rec.contract_id is null)
1333     or ((p_rec.contract_id is not null)
1334     and
1335     nvl(per_ctc_shd.g_old_rec.ctr_information_category, hr_api.g_varchar2) <>
1336     nvl(p_rec.ctr_information_category, hr_api.g_varchar2) or
1337     nvl(per_ctc_shd.g_old_rec.ctr_information1, hr_api.g_varchar2) <>
1338     nvl(p_rec.ctr_information1, hr_api.g_varchar2) or
1339     nvl(per_ctc_shd.g_old_rec.ctr_information2, hr_api.g_varchar2) <>
1340     nvl(p_rec.ctr_information2, hr_api.g_varchar2) or
1341     nvl(per_ctc_shd.g_old_rec.ctr_information3, hr_api.g_varchar2) <>
1342     nvl(p_rec.ctr_information3, hr_api.g_varchar2) or
1343     nvl(per_ctc_shd.g_old_rec.ctr_information4, hr_api.g_varchar2) <>
1344     nvl(p_rec.ctr_information4, hr_api.g_varchar2) or
1345     nvl(per_ctc_shd.g_old_rec.ctr_information5, hr_api.g_varchar2) <>
1346     nvl(p_rec.ctr_information5, hr_api.g_varchar2) or
1347     nvl(per_ctc_shd.g_old_rec.ctr_information6, hr_api.g_varchar2) <>
1348     nvl(p_rec.ctr_information6, hr_api.g_varchar2) or
1349     nvl(per_ctc_shd.g_old_rec.ctr_information7, hr_api.g_varchar2) <>
1350     nvl(p_rec.ctr_information7, hr_api.g_varchar2) or
1351     nvl(per_ctc_shd.g_old_rec.ctr_information8, hr_api.g_varchar2) <>
1352     nvl(p_rec.ctr_information8, hr_api.g_varchar2) or
1353     nvl(per_ctc_shd.g_old_rec.ctr_information9, hr_api.g_varchar2) <>
1354     nvl(p_rec.ctr_information9, hr_api.g_varchar2) or
1355     nvl(per_ctc_shd.g_old_rec.ctr_information10, hr_api.g_varchar2) <>
1356     nvl(p_rec.ctr_information10, hr_api.g_varchar2) or
1357     nvl(per_ctc_shd.g_old_rec.ctr_information11, hr_api.g_varchar2) <>
1358     nvl(p_rec.ctr_information11, hr_api.g_varchar2) or
1359     nvl(per_ctc_shd.g_old_rec.ctr_information12, hr_api.g_varchar2) <>
1360     nvl(p_rec.ctr_information12, hr_api.g_varchar2) or
1361     nvl(per_ctc_shd.g_old_rec.ctr_information13, hr_api.g_varchar2) <>
1362     nvl(p_rec.ctr_information13, hr_api.g_varchar2) or
1363     nvl(per_ctc_shd.g_old_rec.ctr_information14, hr_api.g_varchar2) <>
1364     nvl(p_rec.ctr_information14, hr_api.g_varchar2) or
1365     nvl(per_ctc_shd.g_old_rec.ctr_information15, hr_api.g_varchar2) <>
1366     nvl(p_rec.ctr_information15, hr_api.g_varchar2) or
1367     nvl(per_ctc_shd.g_old_rec.ctr_information16, hr_api.g_varchar2) <>
1368     nvl(p_rec.ctr_information16, hr_api.g_varchar2) or
1369     nvl(per_ctc_shd.g_old_rec.ctr_information17, hr_api.g_varchar2) <>
1370     nvl(p_rec.ctr_information17, hr_api.g_varchar2) or
1371     nvl(per_ctc_shd.g_old_rec.ctr_information18, hr_api.g_varchar2) <>
1372     nvl(p_rec.ctr_information18, hr_api.g_varchar2) or
1373     nvl(per_ctc_shd.g_old_rec.ctr_information19, hr_api.g_varchar2) <>
1374     nvl(p_rec.ctr_information19, hr_api.g_varchar2) or
1375     nvl(per_ctc_shd.g_old_rec.ctr_information20, hr_api.g_varchar2) <>
1376     nvl(p_rec.ctr_information20, hr_api.g_varchar2))
1377   then
1378     --
1382       ,p_attribute_category => p_rec.ctr_information_category
1379     hr_dflex_utility.ins_or_upd_descflex_attribs
1380       (p_appl_short_name    => 'PER'
1381       ,p_descflex_name      => 'Contract Developer DF'
1383       ,p_attribute1_name    => 'CTR_INFORMATION1'
1384       ,p_attribute1_value   => p_rec.ctr_information1
1385       ,p_attribute2_name    => 'CTR_INFORMATION2'
1386       ,p_attribute2_value   => p_rec.ctr_information2
1387       ,p_attribute3_name    => 'CTR_INFORMATION3'
1388       ,p_attribute3_value   => p_rec.ctr_information3
1389       ,p_attribute4_name    => 'CTR_INFORMATION4'
1390       ,p_attribute4_value   => p_rec.ctr_information4
1391       ,p_attribute5_name    => 'CTR_INFORMATION5'
1392       ,p_attribute5_value   => p_rec.ctr_information5
1393       ,p_attribute6_name    => 'CTR_INFORMATION6'
1394       ,p_attribute6_value   => p_rec.ctr_information6
1395       ,p_attribute7_name    => 'CTR_INFORMATION7'
1396       ,p_attribute7_value   => p_rec.ctr_information7
1397       ,p_attribute8_name    => 'CTR_INFORMATION8'
1398       ,p_attribute8_value   => p_rec.ctr_information8
1399       ,p_attribute9_name    => 'CTR_INFORMATION9'
1400       ,p_attribute9_value   => p_rec.ctr_information9
1401       ,p_attribute10_name   => 'CTR_INFORMATION10'
1402       ,p_attribute10_value  => p_rec.ctr_information10
1403       ,p_attribute11_name   => 'CTR_INFORMATION11'
1404       ,p_attribute11_value  => p_rec.ctr_information11
1405       ,p_attribute12_name   => 'CTR_INFORMATION12'
1406       ,p_attribute12_value  => p_rec.ctr_information12
1407       ,p_attribute13_name   => 'CTR_INFORMATION13'
1408       ,p_attribute13_value  => p_rec.ctr_information13
1409       ,p_attribute14_name   => 'CTR_INFORMATION14'
1410       ,p_attribute14_value  => p_rec.ctr_information14
1411       ,p_attribute15_name   => 'CTR_INFORMATION15'
1412       ,p_attribute15_value  => p_rec.ctr_information15
1413       ,p_attribute16_name   => 'CTR_INFORMATION16'
1414       ,p_attribute16_value  => p_rec.ctr_information16
1415       ,p_attribute17_name   => 'CTR_INFORMATION17'
1416       ,p_attribute17_value  => p_rec.ctr_information17
1417       ,p_attribute18_name   => 'CTR_INFORMATION18'
1418       ,p_attribute18_value  => p_rec.ctr_information18
1419       ,p_attribute19_name   => 'CTR_INFORMATION19'
1420       ,p_attribute19_value  => p_rec.ctr_information19
1421       ,p_attribute20_name   => 'CTR_INFORMATION20'
1422       ,p_attribute20_value  => p_rec.ctr_information20
1423       );
1424     --
1425   end if;
1426   --
1427   hr_utility.set_location(' Leaving:'||l_proc, 10);
1428 end chk_ddf;
1429 --
1430 --  -------------------------------------------------------------
1431 --  |-------------------< chk_del_mode>-------------------------|
1432 --  -------------------------------------------------------------
1433 --
1434 procedure chk_del_mode
1435  (p_datetrack_mode         in     varchar2)
1436  is
1437  --
1438   l_proc       varchar2(72) := g_package||'chk_del_mode';
1439  --
1440 begin
1441   hr_utility.set_location('Entering:'|| l_proc, 10);
1442       --
1443       -- Check that the datetrack mode is correct
1444       --
1445       if upper(p_datetrack_mode) = 'DELETE' then
1446         hr_utility.set_message(800, 'PER_52842_CTR_DEL_MODE');
1447         hr_utility.raise_error;
1448         --
1449       end if;
1450       hr_utility.set_location(l_proc, 20);
1451       --
1452    hr_utility.set_location(' Leaving:'|| l_proc, 30);
1453   --
1454 end chk_del_mode;
1455 --
1456 --  ---------------------------------------------------------------------------
1457 --  |---------------------< return_legislation_code >-------------------------|
1458 --  ---------------------------------------------------------------------------
1459 --
1460 function return_legislation_code
1461   (p_contract_id              in number
1462   ) return varchar2 is
1463   --
1464   -- Declare cursor
1465   --
1466   cursor csr_leg_code is
1467     select pbg.legislation_code
1468       from per_business_groups  pbg
1469          , per_contracts_f      ctr
1470      where ctr.contract_id       = p_contract_id
1471        and pbg.business_group_id = ctr.business_group_id
1472   order by ctr.effective_start_date;
1473   --
1474   -- Declare local variables
1475   --
1476   l_legislation_code  varchar2(150);
1477   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
1478 begin
1479   hr_utility.set_location('Entering:'|| l_proc, 10);
1480   --
1481   -- Ensure that all the mandatory parameter are not null
1482   --
1483   hr_api.mandatory_arg_error(p_api_name       => l_proc,
1484                              p_argument       => 'contract_id',
1485                              p_argument_value => p_contract_id);
1486   --
1487   if nvl(g_contract_id, hr_api.g_number) = p_contract_id then
1488     --
1489     -- The legislation code has already been found with a previous
1490     -- call to this function. Just return the value in the global
1491     -- variable.
1492     --
1493     l_legislation_code := g_legislation_code;
1494     hr_utility.set_location(l_proc, 20);
1495   else
1496     --
1497     -- The ID is different to the last call to this function
1498     -- or this is the first call to this function.
1499     --
1500   open csr_leg_code;
1501   fetch csr_leg_code into l_legislation_code;
1505     -- The primary key is invalid therefore we must error
1502   if csr_leg_code%notfound then
1503     close csr_leg_code;
1504     --
1506     --
1507     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
1508     hr_utility.raise_error;
1509   end if;
1510   --
1511   close csr_leg_code;
1512   hr_utility.set_location(' Leaving:'|| l_proc, 20);
1513   --
1514     g_contract_id := p_contract_id;
1515     g_legislation_code := l_legislation_code;
1516   end if;
1517   hr_utility.set_location(' Leaving:'|| l_proc, 25);
1518   --
1519   return l_legislation_code;
1520 end return_legislation_code;
1521 --
1522 -- ----------------------------------------------------------------------------
1523 -- |--------------------------< dt_update_validate >--------------------------|
1524 -- ----------------------------------------------------------------------------
1525 -- {Start Of Comments}
1526 --
1527 -- Description:
1528 --   This procedure is used for referential integrity of datetracked
1529 --   parent entities when a datetrack update operation is taking place
1530 --   and where there is no cascading of update defined for this entity.
1531 --
1532 -- Prerequisites:
1533 --   This procedure is called from the update_validate.
1534 --
1535 -- In Parameters:
1536 --
1537 -- Post Success:
1538 --   Processing continues.
1539 --
1540 -- Post Failure:
1541 --
1542 -- Developer Implementation Notes:
1543 --   This procedure should not need maintenance unless the HR Schema model
1544 --   changes.
1545 --
1546 -- Access Status:
1547 --   Internal Row Handler Use Only.
1548 --
1549 -- {End Of Comments}
1550 -- ----------------------------------------------------------------------------
1551 Procedure dt_update_validate
1552             (
1553              p_person_id                     in number default hr_api.g_number,
1554 	     p_datetrack_mode		     in varchar2,
1555              p_validation_start_date	     in date,
1556 	     p_validation_end_date	     in date) Is
1557 --
1558   l_proc	    varchar2(72) := g_package||'dt_update_validate';
1559   l_integrity_error Exception;
1560   l_table_name	    all_tables.table_name%TYPE;
1561 --
1562 Begin
1563   hr_utility.set_location('Entering:'||l_proc, 5);
1564   --
1565   -- Ensure that the p_datetrack_mode argument is not null
1566   --
1567   hr_api.mandatory_arg_error
1568     (p_api_name       => l_proc,
1569      p_argument       => 'datetrack_mode',
1570      p_argument_value => p_datetrack_mode);
1571   --
1572   -- Only perform the validation if the datetrack update mode is valid
1573   --
1574   If (dt_api.validate_dt_upd_mode(p_datetrack_mode => p_datetrack_mode)) then
1575     --
1576     --
1577     -- Ensure the arguments are not null
1578     --
1579     hr_api.mandatory_arg_error
1580       (p_api_name       => l_proc,
1581        p_argument       => 'validation_start_date',
1582        p_argument_value => p_validation_start_date);
1583     --
1584     hr_api.mandatory_arg_error
1585       (p_api_name       => l_proc,
1586        p_argument       => 'validation_end_date',
1587        p_argument_value => p_validation_end_date);
1588     --
1589     If ((nvl(p_person_id, hr_api.g_number) <> hr_api.g_number) and
1590       NOT (dt_api.check_min_max_dates
1591             (p_base_table_name => 'per_people_f',
1592              p_base_key_column => 'person_id',
1593              p_base_key_value  => p_person_id,
1594              p_from_date       => p_validation_start_date,
1595              p_to_date         => p_validation_end_date)))  Then
1596       l_table_name := 'people';
1597       Raise l_integrity_error;
1598     End If;
1599     --
1600   End If;
1601   --
1602   hr_utility.set_location(' Leaving:'||l_proc, 10);
1603 Exception
1604   When l_integrity_error Then
1605     --
1606     -- A referential integrity check was violated therefore
1607     -- we must error
1608     --
1609     hr_utility.set_message(801, 'HR_7216_DT_UPD_INTEGRITY_ERR');
1610     hr_utility.set_message_token('TABLE_NAME', l_table_name);
1611     hr_utility.raise_error;
1612   When Others Then
1613     --
1614     -- An unhandled or unexpected error has occurred which
1615     -- we must report
1616     --
1617     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
1618     hr_utility.set_message_token('PROCEDURE', l_proc);
1619     hr_utility.set_message_token('STEP','15');
1620     hr_utility.raise_error;
1621 
1622 End dt_update_validate;
1623 --
1624 -- ----------------------------------------------------------------------------
1625 -- |--------------------------< dt_delete_validate >--------------------------|
1626 -- ----------------------------------------------------------------------------
1627 -- {Start Of Comments}
1628 --
1629 -- Description:
1630 --   This procedure is used for referential integrity of datetracked
1631 --   child entities when either a datetrack DELETE or ZAP is in operation
1632 --   and where there is no cascading of delete defined for this entity.
1633 --   For the datetrack mode of DELETE or ZAP we must ensure that no
1634 --   datetracked child rows exist between the validation start and end
1635 --   dates.
1636 --
1637 -- Prerequisites:
1641 --
1638 --   This procedure is called from the delete_validate.
1639 --
1640 -- In Parameters:
1642 -- Post Success:
1643 --   Processing continues.
1644 --
1645 -- Post Failure:
1646 --   If a row exists by determining the returning Boolean value from the
1647 --   generic dt_api.rows_exist function then we must supply an error via
1648 --   the use of the local exception handler l_rows_exist.
1649 --
1650 -- Developer Implementation Notes:
1651 --   This procedure should not need maintenance unless the HR Schema model
1652 --   changes.
1653 --
1654 -- Access Status:
1655 --   Internal Row Handler Use Only.
1656 --
1657 -- {End Of Comments}
1658 -- ----------------------------------------------------------------------------
1659 Procedure dt_delete_validate
1660           (p_contract_id		in number,
1661            p_datetrack_mode		in varchar2,
1662 	     p_validation_start_date	in date,
1663 	     p_validation_end_date	in date) Is
1664 --
1665   l_proc	varchar2(72) 	:= g_package||'dt_delete_validate';
1666   l_rows_exist	Exception;
1667   l_table_name	all_tables.table_name%TYPE;
1668 --
1669 Begin
1670   hr_utility.set_location('Entering:'||l_proc, 5);
1671   --
1672   -- Ensure that the p_datetrack_mode argument is not null
1673   --
1674   hr_api.mandatory_arg_error
1675     (p_api_name       => l_proc,
1676      p_argument       => 'datetrack_mode',
1677      p_argument_value => p_datetrack_mode);
1678   --
1679   -- Only perform the validation if the datetrack mode is either
1680   -- DELETE or ZAP
1681   --
1682   If (p_datetrack_mode = 'DELETE' or
1683       p_datetrack_mode = 'ZAP') then
1684     --
1685     --
1686     -- Ensure the arguments are not null
1687     --
1688     hr_api.mandatory_arg_error
1689       (p_api_name       => l_proc,
1690        p_argument       => 'validation_start_date',
1691        p_argument_value => p_validation_start_date);
1692     --
1693     hr_api.mandatory_arg_error
1694       (p_api_name       => l_proc,
1695        p_argument       => 'validation_end_date',
1696        p_argument_value => p_validation_end_date);
1697     --
1698     hr_api.mandatory_arg_error
1699       (p_api_name       => l_proc,
1700        p_argument       => 'contract_id',
1701        p_argument_value => p_contract_id);
1702     --
1703     --
1704     --
1705   End If;
1706   --
1707   hr_utility.set_location(' Leaving:'||l_proc, 10);
1708 Exception
1709   When l_rows_exist Then
1710     --
1711     -- A referential integrity check was violated therefore
1712     -- we must error
1713     --
1714     hr_utility.set_message(801, 'HR_7215_DT_CHILD_EXISTS');
1715     hr_utility.set_message_token('TABLE_NAME', l_table_name);
1716     hr_utility.raise_error;
1717   When Others Then
1718     --
1719     -- An unhandled or unexpected error has occurred which
1720     -- we must report
1721     --
1722     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
1723     hr_utility.set_message_token('PROCEDURE', l_proc);
1724     hr_utility.set_message_token('STEP','15');
1725     hr_utility.raise_error;
1726 
1727 End dt_delete_validate;
1728 --
1729 -- ----------------------------------------------------------------------------
1730 -- |---------------------------< insert_validate >----------------------------|
1731 -- ----------------------------------------------------------------------------
1732 Procedure insert_validate
1733 	(p_rec 			 in per_ctc_shd.g_rec_type,
1734 	 p_effective_date	 in date,
1735 	 p_datetrack_mode	 in varchar2,
1736 	 p_validation_start_date in date,
1737 	 p_validation_end_date	 in date) is
1738   --
1739   l_proc	varchar2(72) := g_package||'insert_validate';
1740   l_session_id  number;
1741   --
1742 Begin
1743   hr_utility.set_location('Entering:'||l_proc, 5);
1744   --
1745   -- Call all supporting business operations
1746   --
1747   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
1748   --
1749   hr_utility.set_location(l_proc, 7);
1750   --
1751   -- Set the business group profile as this is used by the flexfield validation.
1752   --
1753   hr_kflex_utility.set_profiles
1754      (p_business_group_id => p_rec.business_group_id);
1755   --
1756   hr_utility.set_location(l_proc, 8);
1757   --
1758   -- Set the session date as this is used by the flexfield validation.
1759   --
1760   hr_kflex_utility.set_session_date
1761      (p_effective_date => p_effective_date
1762      ,p_session_id     => l_session_id);
1763   --
1764   hr_utility.set_location(l_proc, 10);
1765   --
1766   chk_person_id
1767      (p_rec.person_id,
1768       p_rec.business_group_id,
1769       p_effective_date);
1770   --
1771   hr_utility.set_location(l_proc, 15);
1772   --
1773   chk_type
1774      (p_rec.contract_id,
1775       p_rec.type,
1776       p_effective_date,
1777       p_validation_start_date,
1778       p_validation_end_date,
1779       p_rec.object_version_number
1780      );
1781   --
1782   hr_utility.set_location(l_proc, 20);
1783   --
1784   chk_status
1785    (p_rec.contract_id,
1786     p_rec.status,
1787     p_effective_date,
1788     p_validation_start_date,
1789     p_validation_end_date,
1790     p_rec.object_version_number
1791    );
1792   --
1796    (p_rec.contract_id,
1793   hr_utility.set_location(l_proc, 25);
1794   --
1795   chk_status_reason
1797     p_rec.status_reason,
1798     p_effective_date,
1799     p_validation_start_date,
1800     p_validation_end_date,
1801     p_rec.object_version_number
1802    );
1803   --
1804   hr_utility.set_location(l_proc, 30);
1805   --
1806   chk_duration_units
1807    (p_rec.contract_id,
1808     p_rec.duration,
1809     p_rec.duration_units,
1810     p_effective_date,
1811     p_validation_start_date,
1812     p_validation_end_date,
1813     p_rec.object_version_number
1814    );
1815   --
1816   hr_utility.set_location(l_proc, 35);
1817   --
1818   chk_start_reason
1819    (p_rec.contract_id,
1820     p_rec.start_reason,
1821     p_effective_date,
1822     p_validation_start_date,
1823     p_validation_end_date,
1824     p_rec.object_version_number
1825    );
1826   --
1827   hr_utility.set_location(l_proc, 40);
1828   --
1829   chk_end_reason
1830    (p_rec.contract_id,
1831     p_rec.end_reason,
1832     p_effective_date,
1833     p_validation_start_date,
1834     p_validation_end_date,
1835     p_rec.object_version_number
1836    );
1837   --
1838   hr_utility.set_location(l_proc, 45);
1839   --
1840   chk_extension_period_units
1841    (p_rec.contract_id,
1842     p_rec.extension_period,
1843     p_rec.extension_period_units,
1844     p_effective_date,
1845     p_validation_start_date,
1846     p_validation_end_date,
1847     p_rec.object_version_number
1848    );
1849   --
1850   hr_utility.set_location(l_proc, 47);
1851   --
1852   chk_reference
1853   (p_rec.person_id
1854   ,p_rec.reference
1855   ,p_datetrack_mode
1856   ,null
1857   );
1858   --
1859   hr_utility.set_location(l_proc, 50);
1860   --
1861   per_ctc_bus.chk_ddf(p_rec => p_rec);
1862   --
1863   hr_utility.set_location(l_proc, 55);
1864   --
1865   per_ctc_bus.chk_df(p_rec => p_rec);
1866   --
1867   hr_utility.set_location(l_proc, 57);
1868   --
1869   -- Unset the session date.
1870   --
1871   hr_kflex_utility.unset_session_date
1872      (p_session_id => l_session_id);
1873   --
1874   hr_utility.set_location(l_proc, 60);
1875   --
1876 End insert_validate;
1877 --
1878 -- ----------------------------------------------------------------------------
1879 -- |---------------------------< update_validate >----------------------------|
1880 -- ----------------------------------------------------------------------------
1881 Procedure update_validate
1882 	(p_rec 			 in per_ctc_shd.g_rec_type,
1883 	 p_effective_date	 in date,
1884 	 p_datetrack_mode	 in varchar2,
1885 	 p_validation_start_date in date,
1886 	 p_validation_end_date	 in date) is
1887   --
1888   l_proc	varchar2(72) := g_package||'update_validate';
1889   l_session_id  number;
1890   --
1891 Begin
1892   hr_utility.set_location('Entering:'||l_proc, 5);
1893   --
1894   -- Call all supporting business operations
1895   --
1896   hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
1897   --
1898   hr_utility.set_location(l_proc, 7);
1899   --
1900   -- Set the business group profile as this is used by the flexfield validation.
1901   --
1902   hr_kflex_utility.set_profiles
1906   --
1903      (p_business_group_id => p_rec.business_group_id);
1904   --
1905   hr_utility.set_location(l_proc, 8);
1907   -- Set the session date as this is used by the flexfield validation.
1908   --
1909   hr_kflex_utility.set_session_date
1910      (p_effective_date => p_effective_date
1911      ,p_session_id     => l_session_id);
1912   --
1913   hr_utility.set_location(l_proc, 10);
1914   --
1915   chk_type
1916      (p_rec.contract_id,
1917       p_rec.type,
1918       p_effective_date,
1919       p_validation_start_date,
1920       p_validation_end_date,
1921       p_rec.object_version_number
1922      );
1923   --
1924   hr_utility.set_location(l_proc, 15);
1925   --
1926   chk_status
1927    (p_rec.contract_id,
1928     p_rec.status,
1929     p_effective_date,
1930     p_validation_start_date,
1931     p_validation_end_date,
1932     p_rec.object_version_number
1933    );
1934   --
1935   hr_utility.set_location(l_proc, 20);
1936   --
1937   chk_status_reason
1938    (p_rec.contract_id,
1939     p_rec.status_reason,
1940     p_effective_date,
1941     p_validation_start_date,
1942     p_validation_end_date,
1943     p_rec.object_version_number
1944    );
1945   --
1946   hr_utility.set_location(l_proc, 25);
1947   --
1948   chk_duration_units
1949    (p_rec.contract_id,
1950     p_rec.duration,
1951     p_rec.duration_units,
1952     p_effective_date,
1953     p_validation_start_date,
1954     p_validation_end_date,
1955     p_rec.object_version_number
1956    );
1957   --
1958   hr_utility.set_location(l_proc, 30);
1959   --
1960   chk_start_reason
1961    (p_rec.contract_id,
1962     p_rec.start_reason,
1963     p_effective_date,
1964     p_validation_start_date,
1965     p_validation_end_date,
1966     p_rec.object_version_number
1967    );
1968   --
1969   hr_utility.set_location(l_proc, 35);
1970   --
1971   chk_end_reason
1972    (p_rec.contract_id,
1973     p_rec.end_reason,
1974     p_effective_date,
1975     p_validation_start_date,
1976     p_validation_end_date,
1977     p_rec.object_version_number
1978    );
1979   --
1980   hr_utility.set_location(l_proc, 40);
1981   --
1982   chk_extension_period_units
1983    (p_rec.contract_id,
1984     p_rec.extension_period,
1985     p_rec.extension_period_units,
1986     p_effective_date,
1987     p_validation_start_date,
1988     p_validation_end_date,
1989     p_rec.object_version_number
1990    );
1991   --
1992   hr_utility.set_location(l_proc, 42);
1993   --
1994   chk_reference
1995   (p_rec.person_id
1996   ,p_rec.reference
1997   ,p_datetrack_mode
1998   ,p_rec.contract_id
1999   );
2000   --
2001   hr_utility.set_location(l_proc, 45);
2002   --
2003   -- Call the datetrack update integrity operation
2004   --
2005   dt_update_validate
2006     (
2007      p_datetrack_mode                => p_datetrack_mode,
2008      p_validation_start_date         => p_validation_start_date,
2009      p_validation_end_date           => p_validation_end_date);
2010   --
2011   hr_utility.set_location(l_proc, 50);
2012   --
2013   per_ctc_bus.chk_ddf(p_rec => p_rec);
2014   --
2015   hr_utility.set_location(l_proc, 55);
2016   --
2017   per_ctc_bus.chk_df(p_rec => p_rec);
2018   --
2019   hr_utility.set_location(l_proc, 57);
2020   --
2021   -- Unset the session date.
2022   --
2023   hr_kflex_utility.unset_session_date
2024      (p_session_id => l_session_id);
2025   --
2026   hr_utility.set_location(' Leaving:'||l_proc, 60);
2027   --
2028 End update_validate;
2029 --
2030 -- ----------------------------------------------------------------------------
2031 -- |---------------------------< delete_validate >----------------------------|
2032 -- ----------------------------------------------------------------------------
2033 Procedure delete_validate
2034 	(p_rec 			 in per_ctc_shd.g_rec_type,
2035 	 p_effective_date	 in date,
2036 	 p_datetrack_mode	 in varchar2,
2037 	 p_validation_start_date in date,
2038 	 p_validation_end_date	 in date) is
2039 --
2040   l_proc	varchar2(72) := g_package||'delete_validate';
2041 --
2042 Begin
2043   hr_utility.set_location('Entering:'||l_proc, 5);
2044   --
2045   -- Call all supporting business operations
2046   --
2047   dt_delete_validate
2048     (p_datetrack_mode		=> p_datetrack_mode,
2049      p_validation_start_date	=> p_validation_start_date,
2050      p_validation_end_date	=> p_validation_end_date,
2051      p_contract_id		=> p_rec.contract_id);
2052   --
2053   hr_utility.set_location(l_proc, 10);
2054   --
2055   chk_del_mode
2056    (p_datetrack_mode		=> p_datetrack_mode) ;
2057   --
2058   hr_utility.set_location(l_proc, 15);
2059   --
2060   if chk_assignment_exists (p_contract_id => p_rec.contract_id) then
2061      hr_utility.set_message(800, 'PER_52841_CTR_DEL_ASG');
2062      hr_utility.raise_error;
2063   end if;
2064   hr_utility.set_location(' Leaving:'||l_proc, 20);
2065 
2066 End delete_validate;
2067 --
2068 end per_ctc_bus;