DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_LIP_BUS

Source


1 Package Body hr_lip_bus as
2 /* $Header: hrliprhi.pkb 115.5 2002/12/04 05:07:14 hjonnala noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_lip_bus.';  -- Global package name
9 --
10 -- The following two global variables are only to be
11 -- used by the return_legislation_code function.
12 --
13 g_legislation_code            varchar2(150)  default null;
14 g_organization_link_id        number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_organization_link_id                 in number
22   ) is
23   --
24   -- Declare cursor
25   --
26   cursor csr_sec_grp is
27     select pbg.security_group_id
28       from per_business_groups      pbg
29          , hr_de_organization_links ord
30      where ord.organization_link_id = p_organization_link_id
31        and pbg.business_group_id    = ord.business_group_id;
32   --
33   -- Declare local variables
34   --
35   l_security_group_id number;
36   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
37   --
38 begin
39   --
40   hr_utility.set_location('Entering:'|| l_proc, 10);
41   --
42   -- Ensure that all the mandatory parameter are not null
43   --
44   hr_api.mandatory_arg_error
45     (p_api_name           => l_proc
46     ,p_argument           => 'organization_link_id'
47     ,p_argument_value     => p_organization_link_id
48     );
49   --
50   open csr_sec_grp;
51   fetch csr_sec_grp into l_security_group_id;
52   --
53   if csr_sec_grp%notfound then
54      --
55      close csr_sec_grp;
56      --
57      -- The primary key is invalid therefore we must error
58      --
59      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
60      fnd_message.raise_error;
61      --
62   end if;
63   close csr_sec_grp;
64   --
65   -- Set the security_group_id in CLIENT_INFO
66   --
67   hr_api.set_security_group_id
68     (p_security_group_id => l_security_group_id
69     );
70   --
71   hr_utility.set_location(' Leaving:'|| l_proc, 20);
72   --
73 end set_security_group_id;
74 --
75 --  ---------------------------------------------------------------------------
76 --  |---------------------< return_legislation_code >-------------------------|
77 --  ---------------------------------------------------------------------------
78 --
79 Function return_legislation_code
80   (p_organization_link_id                 in number
81   )
82   Return Varchar2 Is
83   --
84   -- Declare cursor
85   --
86   cursor csr_leg_code is
87     select pbg.legislation_code
88       from per_business_groups      pbg
89          , hr_de_organization_links ord
90      where ord.organization_link_id = p_organization_link_id
91        and pbg.business_group_id    = ord.business_group_id;
92   --
93   -- Declare local variables
94   --
95   l_legislation_code  varchar2(150);
96   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
97   --
98 Begin
99   --
100   hr_utility.set_location('Entering:'|| l_proc, 10);
101   --
102   -- Ensure that all the mandatory parameter are not null
103   --
104   hr_api.mandatory_arg_error
105     (p_api_name           => l_proc
106     ,p_argument           => 'organization_link_id'
107     ,p_argument_value     => p_organization_link_id
108     );
109   --
110   if ( nvl(hr_lip_bus.g_organization_link_id, hr_api.g_number)
111        = p_organization_link_id) then
112     --
113     -- The legislation code has already been found with a previous
114     -- call to this function. Just return the value in the global
115     -- variable.
116     --
117     l_legislation_code := hr_lip_bus.g_legislation_code;
118     hr_utility.set_location(l_proc, 20);
119   else
120     --
121     -- The ID is different to the last call to this function
122     -- or this is the first call to this function.
123     --
124     open csr_leg_code;
125     fetch csr_leg_code into l_legislation_code;
126     --
127     if csr_leg_code%notfound then
128       --
129       -- The primary key is invalid therefore we must error
130       --
131       close csr_leg_code;
132       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
133       fnd_message.raise_error;
134     end if;
135     hr_utility.set_location(l_proc,30);
136     --
137     -- Set the global variables so the values are
138     -- available for the next call to this function.
139     --
140     close csr_leg_code;
141     hr_lip_bus.g_organization_link_id := p_organization_link_id;
142     hr_lip_bus.g_legislation_code     := l_legislation_code;
143   end if;
144   hr_utility.set_location(' Leaving:'|| l_proc, 40);
145   return l_legislation_code;
146 end return_legislation_code;
147 --
148 --  ---------------------------------------------------------------------------
149 --  |---------------------< chk_organization_link_id >------------------------|
150 --  ---------------------------------------------------------------------------
151 --
152 --  Description:
153 --    Check the following organization link rules...
154 --
155 --    1. It is mandatory.
156 --    2. It exists in the table HR_DE_ORGANIZATION_LINK. where the row has a
157 --    3. The row in the table HR_DE_ORGANIZATION_LINK must have a link type of
158 --       'DE_LIABILITY_INSURANCE'.
159 --
160 --  Pre-conditions:
161 --    None
162 --
163 --  In Arguments:
164 --    p_organization_link_id
165 --
166 --  Post Success:
167 --    Continue processing.
168 --
169 --  Post Failure:
170 --    Application error is raised and processing is terminated.
171 --
172 --  Access Status:
173 --    Internal Row Handler Use Only.
174 --
175 procedure chk_organization_link_id
176 (p_organization_link_id in number) is
177   --
178   --
179   -- Local Cursors.
180   --
181   cursor c_organization_link
182     (p_organization_link_id in number) is
183     select org_link_type
184     from   hr_de_organization_links
185     where  organization_link_id = p_organization_link_id;
186   --
187   --
188   -- Local Variables.
189   --
190   l_proc          varchar2(72) :=  g_package || 'chk_organization_link_id';
191   l_org_link_type varchar2(30);
192 begin
193   hr_utility.set_location('Entering:'|| l_proc, 10);
194   --
195   --
196   -- Check mandatory parameters have been set
197   --
198   hr_api.mandatory_arg_error
199     (p_api_name       => l_proc
200     ,p_argument       => 'organization_link_id'
201     ,p_argument_value => p_organization_link_id);
202   --
203   hr_utility.set_location(l_proc, 20);
204   --
205   --
206   -- Check that the organization link exists.
207   --
208   open c_organization_link
209     (p_organization_link_id => p_organization_link_id);
210   fetch c_organization_link into l_org_link_type;
211   if c_organization_link%notfound then
212     close c_organization_link;
213     fnd_message.set_name('PER', 'HR_DE_ORG_LINK_CHK');
214     fnd_message.raise_error;
215   else
216     close c_organization_link;
217   end if;
218   --
219   hr_utility.set_location(l_proc, 30);
220   --
221   --
222   -- Check that the organization link has a link type of 'DE_LIABILITY_INSURANCE'.
223   --
224   if not (l_org_link_type = 'DE_LIABILITY_INSURANCE') then
225     fnd_message.set_name('PER', 'HR_DE_LINK_LIABILITY_INS');
226     fnd_message.raise_error;
227   end if;
228   --
229   hr_utility.set_location(' Leaving:'|| l_proc, 40);
230 end chk_organization_link_id;
231 --
232 --  ---------------------------------------------------------------------------
233 --  |-----------------------< chk_calculation_method >------------------------|
234 --  ---------------------------------------------------------------------------
235 --
236 --  Description:
237 --    Check the following calculation method rules...
238 --
239 --    1. It is valid value from the lookup type 'DE_WORKING_HOURS_CALC_METHOD'.
240 --
241 --  Pre-conditions:
242 --    None
243 --
244 --  In Arguments:
245 --    p_effective_date
246 --    p_liability_premiums_id
247 --    p_object_version_number
248 --    p_calculation_method
249 --
250 --  Post Success:
251 --    Continue processing.
252 --
253 --  Post Failure:
254 --    Application error is raised and processing is terminated.
255 --
256 --  Access Status:
257 --    Internal Row Handler Use Only.
258 --
259 procedure chk_calculation_method
260 (p_effective_date        in date
261 ,p_liability_premiums_id in number
262 ,p_object_version_number in number
263 ,p_calculation_method    in varchar2) is
264   --
265   --
266   -- Local Variables.
267   --
268   l_proc         varchar2(72) :=  g_package || 'chk_calculation_method';
269   l_api_updating boolean;
270 begin
271   hr_utility.set_location('Entering:'|| l_proc, 10);
272   --
273   l_api_updating := hr_lip_shd.api_updating
274                       (p_effective_date        => p_effective_date
275                       ,p_liability_premiums_id => p_liability_premiums_id
276                       ,p_object_version_number => p_object_version_number);
277   --
278   if (not l_api_updating
279       and p_calculation_method is not null)
280   or (l_api_updating
281       and nvl(hr_lip_shd.g_old_rec.calculation_method, hr_api.g_varchar2) <> nvl(p_calculation_method, hr_api.g_varchar2)
282       and p_calculation_method is not null) then
283     --
284     --
285     -- Check that it is a valid value from the lookup type 'DE_WORKING_HOURS_CALC_METHOD'.
286     --
287     if hr_api.not_exists_in_hr_lookups
288          (p_effective_date => p_effective_date
289          ,p_lookup_type    => 'DE_WORKING_HOURS_CALC_METHOD'
290          ,p_lookup_code    => p_calculation_method) then
291       fnd_message.set_name('PER', 'HR_DE_CALC_METHOD_LOOKUP_CHK');
292       fnd_message.raise_error;
293     end if;
294   end if;
295   --
296   hr_utility.set_location(' Leaving:'|| l_proc, 20);
297 end chk_calculation_method;
298 --
299 --  ---------------------------------------------------------------------------
300 --  |-------------------< chk_std_working_hours_per_year >--------------------|
301 --  ---------------------------------------------------------------------------
302 --
303 --  Description:
304 --    Check the following standard working hours per year rules...
305 --
306 --    1. It must be between 0 and 999999999999999.
307 --
308 --  Pre-conditions:
309 --    None
310 --
311 --  In Arguments:
312 --    p_effective_date
313 --    p_liability_premiums_id
314 --    p_object_version_number
315 --    p_std_working_hours_per_year
316 --
317 --  Post Success:
318 --    Continue processing.
319 --
320 --  Post Failure:
321 --    Application error is raised and processing is terminated.
322 --
323 --  Access Status:
324 --    Internal Row Handler Use Only.
325 --
326 procedure chk_std_working_hours_per_year
327 (p_effective_date             in date
328 ,p_liability_premiums_id      in number
329 ,p_object_version_number      in number
330 ,p_std_working_hours_per_year in number) is
331   --
332   --
333   -- Local Variables.
334   --
335   l_proc         varchar2(72) :=  g_package || 'chk_std_working_hours_per_year';
336   l_api_updating boolean;
337 begin
338   hr_utility.set_location('Entering:'|| l_proc, 10);
339   --
340   l_api_updating := hr_lip_shd.api_updating
341                       (p_effective_date        => p_effective_date
342                       ,p_liability_premiums_id => p_liability_premiums_id
343                       ,p_object_version_number => p_object_version_number);
344   --
345   if (not l_api_updating
346       and p_std_working_hours_per_year is not null)
347   or (l_api_updating
348       and nvl(hr_lip_shd.g_old_rec.std_working_hours_per_year, hr_api.g_number) <> nvl(p_std_working_hours_per_year, hr_api.g_number)
349       and p_std_working_hours_per_year is not null) then
350     --
351     --
352     -- Check that it is between 0 and 999999999999999.
353     --
354     if not (p_std_working_hours_per_year >= 0 and p_std_working_hours_per_year <= 999999999999999) then
355       fnd_message.set_name('PER', 'HR_DE_WORK_HRS_VALUE_CHK');
356       fnd_message.raise_error;
357     end if;
358   end if;
359   --
360   hr_utility.set_location(' Leaving:'|| l_proc, 20);
361 end chk_std_working_hours_per_year;
362 --
363 --  ---------------------------------------------------------------------------
364 --  |-------------------------< chk_std_percentage >--------------------------|
365 --  ---------------------------------------------------------------------------
366 --
367 --  Description:
368 --    Check the following standard percentage rules...
369 --
370 --    1. It must be between 0 and 100.
371 --
372 --  Pre-conditions:
373 --    None
374 --
375 --  In Arguments:
376 --    p_effective_date
377 --    p_liability_premiums_id
378 --    p_object_version_number
379 --    p_std_percentage
380 --
381 --  Post Success:
382 --    Continue processing.
383 --
384 --  Post Failure:
385 --    Application error is raised and processing is terminated.
386 --
387 --  Access Status:
388 --    Internal Row Handler Use Only.
389 --
390 procedure chk_std_percentage
391 (p_effective_date        in date
392 ,p_liability_premiums_id in number
393 ,p_object_version_number in number
394 ,p_std_percentage        in varchar2) is
395   --
396   --
397   -- Local Variables.
398   --
399   l_proc         varchar2(72) :=  g_package || 'chk_std_percentage';
400   l_api_updating boolean;
401 begin
402   hr_utility.set_location('Entering:'|| l_proc, 10);
403   --
404   l_api_updating := hr_lip_shd.api_updating
405                       (p_effective_date        => p_effective_date
406                       ,p_liability_premiums_id => p_liability_premiums_id
407                       ,p_object_version_number => p_object_version_number);
408   --
409   if (not l_api_updating
410       and p_std_percentage is not null)
411   or (l_api_updating
412       and nvl(hr_lip_shd.g_old_rec.std_percentage, hr_api.g_number) <> nvl(p_std_percentage, hr_api.g_number)
413       and p_std_percentage is not null) then
414     --
415     --
416     -- Check that it is between 0 and 100.
417     --
418     if not (p_std_percentage >= 0 and p_std_percentage <= 100) then
419       fnd_message.set_name('PER', 'HR_DE_STD_PERC_VALUE_CHK');
420       fnd_message.raise_error;
421     end if;
422   end if;
423   --
424   hr_utility.set_location(l_proc, 20);
425   --
426   hr_utility.set_location(' Leaving:'|| l_proc, 40);
427 end chk_std_percentage;
428 --
429 --  ---------------------------------------------------------------------------
430 --  |-------------------------< chk_max_remuneration >------------------------|
431 --  ---------------------------------------------------------------------------
432 --
433 --  Description:
434 --    Check the following max remuneration rules...
435 --
439 --    None
436 --    1. It must be between 0 and 9999999999.99.
437 --
438 --  Pre-conditions:
440 --
441 --  In Arguments:
442 --    p_effective_date
443 --    p_liability_premiums_id
444 --    p_object_version_number
445 --    p_max_remuneration
446 --
447 --  Post Success:
448 --    Continue processing.
449 --
450 --  Post Failure:
451 --    Application error is raised and processing is terminated.
452 --
453 --  Access Status:
454 --    Internal Row Handler Use Only.
455 --
456 procedure chk_max_remuneration
457 (p_effective_date        in date
458 ,p_liability_premiums_id in number
459 ,p_object_version_number in number
460 ,p_max_remuneration    in varchar2) is
461   --
462   --
463   -- Local Variables.
464   --
465   l_proc         varchar2(72) :=  g_package || 'chk_max_remuneration';
466   l_api_updating boolean;
467 begin
468   hr_utility.set_location('Entering:'|| l_proc, 10);
469   --
470   l_api_updating := hr_lip_shd.api_updating
471                       (p_effective_date        => p_effective_date
472                       ,p_liability_premiums_id => p_liability_premiums_id
473                       ,p_object_version_number => p_object_version_number);
474   --
475   if (not l_api_updating
476       and p_max_remuneration is not null)
477   or (l_api_updating
478       and nvl(hr_lip_shd.g_old_rec.max_remuneration, hr_api.g_number) <> nvl(p_max_remuneration, hr_api.g_number)
479       and p_max_remuneration is not null) then
480     --
481     --
482     -- Check that it is between 0 and 9999999999.99.
483     --
484     if not (p_max_remuneration >= 0 and p_max_remuneration <= 9999999999.99) then
485       fnd_message.set_name('PER', 'HR_DE_MAX_REM_VALUE_CHK');
486       fnd_message.raise_error;
487     end if;
488     null;
489   end if;
490   --
491   hr_utility.set_location(' Leaving:'|| l_proc, 20);
492 end chk_max_remuneration;
493 --
494 --  ---------------------------------------------------------------------------
495 --  |-----------------------< chk_overlapping_premiums >----------------------|
496 --  ---------------------------------------------------------------------------
497 --
498 --  Description:
499 --    Check the following rules...
500 --
501 --    1. Premium records cannot overlap for the same organization link.
502 --
503 --  Pre-conditions:
504 --    None
505 --
506 --  In Arguments:
507 --    p_effective_date
508 --    p_liability_premiums_id
509 --    p_object_version_number
510 --    p_max_remuneration
511 --
512 --  Post Success:
513 --    Continue processing.
514 --
515 --  Post Failure:
516 --    Application error is raised and processing is terminated.
517 --
518 --  Access Status:
519 --    Internal Row Handler Use Only.
520 --
521 procedure chk_overlapping_premiums
522 (p_liability_premiums_id  in number
523 ,p_organization_link_id   in number
524 ,p_validation_start_date  in date
525 ,p_validation_end_date    in date) is
526   --
527   --
528   -- Local Cursors.
529   --
530   cursor c_liability_premiums
531     (p_liability_premiums_id in number
532     ,p_organization_link_id  in number
533     ,p_validation_start_date in date
534     ,p_validation_end_date   in date) is
535     select null
536     from   hr_de_liability_premiums_f
537     where  organization_link_id   = p_organization_link_id
538       and  liability_premiums_id <> nvl(p_liability_premiums_id, hr_api.g_number)
539       and  p_validation_start_date <= effective_end_date
540       and  p_validation_end_date   >= effective_start_date;
541 
542   --
543   --
544   -- Local Variables.
545   --
546   l_proc  varchar2(72) :=  g_package || 'chk_overlapping_premiums';
547   l_dummy varchar2(2000);
548 begin
549   hr_utility.set_location('Entering:'|| l_proc, 10);
550   --
551   --
552   -- Check that there are no overlapping records for the same organization link.
553   --
554   open c_liability_premiums
555     (p_liability_premiums_id => p_liability_premiums_id
556     ,p_organization_link_id  => p_organization_link_id
557     ,p_validation_start_date => p_validation_start_date
558     ,p_validation_end_date   => p_validation_end_date);
559   fetch c_liability_premiums into l_dummy;
560   if c_liability_premiums%found then
561     close c_liability_premiums;
562     fnd_message.set_name('PER', 'HR_DE_SINGLE_LIAB_PREMIUM_CHK');
563     fnd_message.raise_error;
564   else
565     close c_liability_premiums;
566   end if;
567   --
568   hr_utility.set_location(' Leaving:'|| l_proc, 20);
569 end chk_overlapping_premiums;
570 --
571 -- ----------------------------------------------------------------------------
572 -- |------------------------------< chk_df >----------------------------------|
573 -- ----------------------------------------------------------------------------
574 --
575 -- Description:
576 --   Validates all the Descriptive Flexfield values.
577 --
578 -- Prerequisites:
579 --   All other columns have been validated.  Must be called as the
580 --   last step from insert_validate and update_validate.
581 --
582 -- In Arguments:
586 --   If the Descriptive Flexfield structure column and data values are
583 --   p_rec
584 --
585 -- Post Success:
587 --   all valid this procedure will end normally and processing will
588 --   continue.
589 --
590 -- Post Failure:
591 --   If the Descriptive Flexfield structure column value or any of
592 --   the data values are invalid then an application error is raised as
593 --   a PL/SQL exception.
594 --
595 -- Access Status:
596 --   Internal Row Handler Use Only.
597 --
598 -- ----------------------------------------------------------------------------
599 procedure chk_df
600   (p_rec in hr_lip_shd.g_rec_type
601   ) is
602 --
603   l_proc   varchar2(72) := g_package || 'chk_df';
604 --
605 begin
606   hr_utility.set_location('Entering:'||l_proc,10);
607   --
608   if ((p_rec.liability_premiums_id is not null)  and (
609     nvl(hr_lip_shd.g_old_rec.attribute_category, hr_api.g_varchar2) <>
610     nvl(p_rec.attribute_category, hr_api.g_varchar2)  or
611     nvl(hr_lip_shd.g_old_rec.attribute1, hr_api.g_varchar2) <>
612     nvl(p_rec.attribute1, hr_api.g_varchar2)  or
613     nvl(hr_lip_shd.g_old_rec.attribute2, hr_api.g_varchar2) <>
614     nvl(p_rec.attribute2, hr_api.g_varchar2)  or
615     nvl(hr_lip_shd.g_old_rec.attribute3, hr_api.g_varchar2) <>
616     nvl(p_rec.attribute3, hr_api.g_varchar2)  or
617     nvl(hr_lip_shd.g_old_rec.attribute4, hr_api.g_varchar2) <>
618     nvl(p_rec.attribute4, hr_api.g_varchar2)  or
619     nvl(hr_lip_shd.g_old_rec.attribute5, hr_api.g_varchar2) <>
620     nvl(p_rec.attribute5, hr_api.g_varchar2)  or
621     nvl(hr_lip_shd.g_old_rec.attribute6, hr_api.g_varchar2) <>
622     nvl(p_rec.attribute6, hr_api.g_varchar2)  or
623     nvl(hr_lip_shd.g_old_rec.attribute7, hr_api.g_varchar2) <>
624     nvl(p_rec.attribute7, hr_api.g_varchar2)  or
625     nvl(hr_lip_shd.g_old_rec.attribute8, hr_api.g_varchar2) <>
626     nvl(p_rec.attribute8, hr_api.g_varchar2)  or
627     nvl(hr_lip_shd.g_old_rec.attribute9, hr_api.g_varchar2) <>
628     nvl(p_rec.attribute9, hr_api.g_varchar2)  or
629     nvl(hr_lip_shd.g_old_rec.attribute10, hr_api.g_varchar2) <>
630     nvl(p_rec.attribute10, hr_api.g_varchar2)  or
631     nvl(hr_lip_shd.g_old_rec.attribute11, hr_api.g_varchar2) <>
632     nvl(p_rec.attribute11, hr_api.g_varchar2)  or
633     nvl(hr_lip_shd.g_old_rec.attribute12, hr_api.g_varchar2) <>
634     nvl(p_rec.attribute12, hr_api.g_varchar2)  or
635     nvl(hr_lip_shd.g_old_rec.attribute13, hr_api.g_varchar2) <>
636     nvl(p_rec.attribute13, hr_api.g_varchar2)  or
637     nvl(hr_lip_shd.g_old_rec.attribute14, hr_api.g_varchar2) <>
638     nvl(p_rec.attribute14, hr_api.g_varchar2)  or
639     nvl(hr_lip_shd.g_old_rec.attribute15, hr_api.g_varchar2) <>
640     nvl(p_rec.attribute15, hr_api.g_varchar2)  or
641     nvl(hr_lip_shd.g_old_rec.attribute16, hr_api.g_varchar2) <>
642     nvl(p_rec.attribute16, hr_api.g_varchar2)  or
643     nvl(hr_lip_shd.g_old_rec.attribute17, hr_api.g_varchar2) <>
644     nvl(p_rec.attribute17, hr_api.g_varchar2)  or
645     nvl(hr_lip_shd.g_old_rec.attribute18, hr_api.g_varchar2) <>
646     nvl(p_rec.attribute18, hr_api.g_varchar2)  or
647     nvl(hr_lip_shd.g_old_rec.attribute19, hr_api.g_varchar2) <>
648     nvl(p_rec.attribute19, hr_api.g_varchar2)  or
649     nvl(hr_lip_shd.g_old_rec.attribute20, hr_api.g_varchar2) <>
650     nvl(p_rec.attribute20, hr_api.g_varchar2) ))
651     or (p_rec.liability_premiums_id is null)  then
652     --
653     -- Only execute the validation if absolutely necessary:
654     -- a) During update, the structure column value or any
655     --    of the attribute values have actually changed.
656     -- b) During insert.
657     --
658     hr_dflex_utility.ins_or_upd_descflex_attribs
659       (p_appl_short_name                 => 'PER'
660       ,p_descflex_name                   => 'HR_DE_LIABILITY_PREMIUMS'
661       ,p_attribute_category              => p_rec.attribute_category
662       ,p_attribute1_name                 => 'ATTRIBUTE1'
663       ,p_attribute1_value                => p_rec.attribute1
664       ,p_attribute2_name                 => 'ATTRIBUTE2'
665       ,p_attribute2_value                => p_rec.attribute2
666       ,p_attribute3_name                 => 'ATTRIBUTE3'
667       ,p_attribute3_value                => p_rec.attribute3
668       ,p_attribute4_name                 => 'ATTRIBUTE4'
669       ,p_attribute4_value                => p_rec.attribute4
670       ,p_attribute5_name                 => 'ATTRIBUTE5'
671       ,p_attribute5_value                => p_rec.attribute5
672       ,p_attribute6_name                 => 'ATTRIBUTE6'
673       ,p_attribute6_value                => p_rec.attribute6
674       ,p_attribute7_name                 => 'ATTRIBUTE7'
675       ,p_attribute7_value                => p_rec.attribute7
676       ,p_attribute8_name                 => 'ATTRIBUTE8'
677       ,p_attribute8_value                => p_rec.attribute8
678       ,p_attribute9_name                 => 'ATTRIBUTE9'
679       ,p_attribute9_value                => p_rec.attribute9
680       ,p_attribute10_name                => 'ATTRIBUTE10'
681       ,p_attribute10_value               => p_rec.attribute10
682       ,p_attribute11_name                => 'ATTRIBUTE11'
683       ,p_attribute11_value               => p_rec.attribute11
684       ,p_attribute12_name                => 'ATTRIBUTE12'
685       ,p_attribute12_value               => p_rec.attribute12
686       ,p_attribute13_name                => 'ATTRIBUTE13'
690       ,p_attribute15_name                => 'ATTRIBUTE15'
687       ,p_attribute13_value               => p_rec.attribute13
688       ,p_attribute14_name                => 'ATTRIBUTE14'
689       ,p_attribute14_value               => p_rec.attribute14
691       ,p_attribute15_value               => p_rec.attribute15
692       ,p_attribute16_name                => 'ATTRIBUTE16'
693       ,p_attribute16_value               => p_rec.attribute16
694       ,p_attribute17_name                => 'ATTRIBUTE17'
695       ,p_attribute17_value               => p_rec.attribute17
696       ,p_attribute18_name                => 'ATTRIBUTE18'
697       ,p_attribute18_value               => p_rec.attribute18
698       ,p_attribute19_name                => 'ATTRIBUTE19'
699       ,p_attribute19_value               => p_rec.attribute19
700       ,p_attribute20_name                => 'ATTRIBUTE20'
701       ,p_attribute20_value               => p_rec.attribute20
702       );
703   end if;
704   --
705   hr_utility.set_location(' Leaving:'||l_proc,20);
706 end chk_df;
707 --
708 -- ----------------------------------------------------------------------------
709 -- |-----------------------< chk_non_updateable_args >------------------------|
710 -- ----------------------------------------------------------------------------
711 -- {Start Of Comments}
712 --
713 -- Description:
714 --   This procedure is used to ensure that non updateable attributes have
715 --   not been updated. If an attribute has been updated an error is generated.
716 --
717 -- Pre Conditions:
718 --   g_old_rec has been populated with details of the values currently in
719 --   the database.
720 --
721 -- In Arguments:
722 --   p_rec has been populated with the updated values the user would like the
723 --   record set to.
724 --
725 -- Post Success:
726 --   Processing continues if all the non updateable attributes have not
727 --   changed.
728 --
729 -- Post Failure:
730 --   An application error is raised if any of the non updatable attributes
731 --   have been altered.
732 --
733 -- {End Of Comments}
734 -- ----------------------------------------------------------------------------
735 Procedure chk_non_updateable_args
736   (p_effective_date  in date
737   ,p_rec             in hr_lip_shd.g_rec_type
738   ) IS
739 --
740   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
741   l_error    EXCEPTION;
742   l_argument varchar2(30);
743 --
744 Begin
745   --
746   -- Only proceed with the validation if a row exists for the current
747   -- record in the HR Schema.
748   --
749   IF NOT hr_lip_shd.api_updating
750       (p_liability_premiums_id            => p_rec.liability_premiums_id
751       ,p_effective_date                   => p_effective_date
752       ,p_object_version_number            => p_rec.object_version_number
753       ) THEN
754      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
755      fnd_message.set_token('PROCEDURE ', l_proc);
756      fnd_message.set_token('STEP ', '5');
757      fnd_message.raise_error;
758   END IF;
759   --
760   IF NVL(p_rec.organization_link_id, hr_api.g_number) <> NVL(hr_lip_shd.g_old_rec.organization_link_id, hr_api.g_number) THEN
761     l_argument := 'organization_link_id';
762     RAISE l_error;
763   END IF;
764   --
765   EXCEPTION
766     WHEN l_error THEN
767        hr_api.argument_changed_error
768          (p_api_name => l_proc
769          ,p_argument => l_argument);
770     WHEN OTHERS THEN
771        RAISE;
772 End chk_non_updateable_args;
773 --
774 -- ----------------------------------------------------------------------------
775 -- |--------------------------< dt_update_validate >--------------------------|
776 -- ----------------------------------------------------------------------------
777 -- {Start Of Comments}
778 --
779 -- Description:
780 --   This procedure is used for referential integrity of datetracked
781 --   parent entities when a datetrack update operation is taking place
782 --   and where there is no cascading of update defined for this entity.
783 --
784 -- Prerequisites:
785 --   This procedure is called from the update_validate.
786 --
787 -- In Parameters:
788 --
789 -- Post Success:
790 --   Processing continues.
791 --
792 -- Post Failure:
793 --
794 -- Developer Implementation Notes:
795 --   This procedure should not need maintenance unless the HR Schema model
796 --   changes.
797 --
798 -- Access Status:
799 --   Internal Row Handler Use Only.
800 --
801 -- {End Of Comments}
802 -- ----------------------------------------------------------------------------
803 Procedure dt_update_validate
804   (p_datetrack_mode                in varchar2
805   ,p_validation_start_date         in date
806   ,p_validation_end_date           in date
807   ) Is
808 --
809   l_proc  varchar2(72) := g_package||'dt_update_validate';
810   l_integrity_error Exception;
811   l_table_name      all_tables.table_name%TYPE;
812 --
813 Begin
814   --
815   -- Ensure that the p_datetrack_mode argument is not null
816   --
817   hr_api.mandatory_arg_error
818     (p_api_name       => l_proc
819     ,p_argument       => 'datetrack_mode'
823   -- Mode will be valid, as this is checked at the start of the upd.
820     ,p_argument_value => p_datetrack_mode
821     );
822   --
824   --
825   -- Ensure the arguments are not null
826   --
827   hr_api.mandatory_arg_error
828     (p_api_name       => l_proc
829     ,p_argument       => 'validation_start_date'
830     ,p_argument_value => p_validation_start_date
831     );
832   --
833   hr_api.mandatory_arg_error
834     (p_api_name       => l_proc
835     ,p_argument       => 'validation_end_date'
836     ,p_argument_value => p_validation_end_date
837     );
838   --
839     --
840   --
841 Exception
842   When l_integrity_error Then
843     --
844     -- A referential integrity check was violated therefore
845     -- we must error
846     --
847     fnd_message.set_name('PAY', 'HR_7216_DT_UPD_INTEGRITY_ERR');
848     fnd_message.set_token('TABLE_NAME', l_table_name);
849     fnd_message.raise_error;
850   When Others Then
851     --
852     -- An unhandled or unexpected error has occurred which
853     -- we must report
854     --
855     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
856     fnd_message.set_token('PROCEDURE', l_proc);
857     fnd_message.set_token('STEP','15');
858     fnd_message.raise_error;
859 End dt_update_validate;
860 --
861 -- ----------------------------------------------------------------------------
862 -- |--------------------------< dt_delete_validate >--------------------------|
863 -- ----------------------------------------------------------------------------
864 -- {Start Of Comments}
865 --
866 -- Description:
867 --   This procedure is used for referential integrity of datetracked
868 --   child entities when either a datetrack DELETE or ZAP is in operation
869 --   and where there is no cascading of delete defined for this entity.
870 --   For the datetrack mode of DELETE or ZAP we must ensure that no
871 --   datetracked child rows exist between the validation start and end
872 --   dates.
873 --
874 -- Prerequisites:
875 --   This procedure is called from the delete_validate.
876 --
877 -- In Parameters:
878 --
879 -- Post Success:
880 --   Processing continues.
881 --
882 -- Post Failure:
883 --   If a row exists by determining the returning Boolean value from the
884 --   generic dt_api.rows_exist function then we must supply an error via
885 --   the use of the local exception handler l_rows_exist.
886 --
887 -- Developer Implementation Notes:
888 --   This procedure should not need maintenance unless the HR Schema model
889 --   changes.
890 --
891 -- Access Status:
892 --   Internal Row Handler Use Only.
893 --
894 -- {End Of Comments}
895 -- ----------------------------------------------------------------------------
896 Procedure dt_delete_validate
897   (p_liability_premiums_id            in number
898   ,p_datetrack_mode                   in varchar2
899   ,p_validation_start_date            in date
900   ,p_validation_end_date              in date
901   ) Is
902 --
903   l_proc        varchar2(72)    := g_package||'dt_delete_validate';
904   l_rows_exist  Exception;
905   l_table_name  all_tables.table_name%TYPE;
906 --
907 Begin
908   --
909   -- Ensure that the p_datetrack_mode argument is not null
910   --
911   hr_api.mandatory_arg_error
912     (p_api_name       => l_proc
913     ,p_argument       => 'datetrack_mode'
914     ,p_argument_value => p_datetrack_mode
915     );
916   --
917   -- Only perform the validation if the datetrack mode is either
918   -- DELETE or ZAP
919   --
920   If (p_datetrack_mode = hr_api.g_delete or
921       p_datetrack_mode = hr_api.g_zap) then
922     --
923     --
924     -- Ensure the arguments are not null
925     --
926     hr_api.mandatory_arg_error
927       (p_api_name       => l_proc
928       ,p_argument       => 'validation_start_date'
929       ,p_argument_value => p_validation_start_date
930       );
931     --
932     hr_api.mandatory_arg_error
933       (p_api_name       => l_proc
934       ,p_argument       => 'validation_end_date'
935       ,p_argument_value => p_validation_end_date
936       );
937     --
938     hr_api.mandatory_arg_error
939       (p_api_name       => l_proc
940       ,p_argument       => 'liability_premiums_id'
941       ,p_argument_value => p_liability_premiums_id
942       );
943     --
944   --
945     --
946   End If;
947   --
948 Exception
949   When l_rows_exist Then
950     --
951     -- A referential integrity check was violated therefore
952     -- we must error
953     --
954     fnd_message.set_name('PAY', 'HR_7215_DT_CHILD_EXISTS');
955     fnd_message.set_token('TABLE_NAME', l_table_name);
956     fnd_message.raise_error;
957   When Others Then
958     --
959     -- An unhandled or unexpected error has occurred which
960     -- we must report
961     --
962     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
963     fnd_message.set_token('PROCEDURE', l_proc);
964     fnd_message.set_token('STEP','15');
965     fnd_message.raise_error;
966   --
967 End dt_delete_validate;
968 --
969 -- ----------------------------------------------------------------------------
970 -- |---------------------------< insert_validate >----------------------------|
971 -- ----------------------------------------------------------------------------
972 Procedure insert_validate
976   ,p_validation_start_date in date
973   (p_rec                   in hr_lip_shd.g_rec_type
974   ,p_effective_date        in date
975   ,p_datetrack_mode        in varchar2
977   ,p_validation_end_date   in date
978   ) is
979 --
980   l_proc        varchar2(72) := g_package||'insert_validate';
981 --
982 Begin
983   hr_utility.set_location('Entering:'||l_proc, 5);
984   --
985   hr_lip_bus.set_security_group_id(p_organization_link_id => p_rec.organization_link_id);
986   --
987   chk_overlapping_premiums
988     (p_liability_premiums_id => p_rec.liability_premiums_id
989     ,p_organization_link_id  => p_rec.organization_link_id
990     ,p_validation_start_date => p_validation_start_date
991     ,p_validation_end_date   => p_validation_end_date);
992   --
993   chk_organization_link_id
994     (p_organization_link_id => p_rec.organization_link_id);
995   --
996   chk_calculation_method
997     (p_effective_date        => p_effective_date
998     ,p_liability_premiums_id => p_rec.liability_premiums_id
999     ,p_object_version_number => p_rec.object_version_number
1000     ,p_calculation_method    => p_rec.calculation_method);
1001   --
1002   chk_std_working_hours_per_year
1003     (p_effective_date             => p_effective_date
1004     ,p_liability_premiums_id      => p_rec.liability_premiums_id
1005     ,p_object_version_number      => p_rec.object_version_number
1006     ,p_std_working_hours_per_year => p_rec.std_working_hours_per_year);
1007   --
1008   chk_std_percentage
1009     (p_effective_date        => p_effective_date
1010     ,p_liability_premiums_id => p_rec.liability_premiums_id
1011     ,p_object_version_number => p_rec.object_version_number
1012     ,p_std_percentage        => p_rec.std_percentage);
1013   --
1014  chk_max_remuneration
1015     (p_effective_date        => p_effective_date
1016     ,p_liability_premiums_id => p_rec.liability_premiums_id
1017     ,p_object_version_number => p_rec.object_version_number
1018     ,p_max_remuneration      => p_rec.max_remuneration);
1019   --
1020   hr_lip_bus.chk_df(p_rec);
1021   --
1022   hr_utility.set_location(' Leaving:'||l_proc, 10);
1023 End insert_validate;
1024 --
1025 -- ----------------------------------------------------------------------------
1026 -- |---------------------------< update_validate >----------------------------|
1027 -- ----------------------------------------------------------------------------
1028 Procedure update_validate
1029   (p_rec                     in hr_lip_shd.g_rec_type
1030   ,p_effective_date          in date
1031   ,p_datetrack_mode          in varchar2
1032   ,p_validation_start_date   in date
1033   ,p_validation_end_date     in date
1034   ) is
1035 --
1036   l_proc        varchar2(72) := g_package||'update_validate';
1037 --
1038 Begin
1039   hr_utility.set_location('Entering:'||l_proc, 5);
1040   --
1041   -- Call all supporting business operations
1042   --
1043   hr_lip_bus.set_security_group_id(p_organization_link_id => p_rec.organization_link_id);
1044   --
1045   -- Call the datetrack update integrity operation
1046   --
1047   dt_update_validate
1048     (p_datetrack_mode        => p_datetrack_mode
1049     ,p_validation_start_date => p_validation_start_date
1050     ,p_validation_end_date   => p_validation_end_date
1051     );
1052   --
1053   chk_non_updateable_args
1054     (p_effective_date  => p_effective_date
1055     ,p_rec             => p_rec
1056     );
1057   --
1058   chk_overlapping_premiums
1059     (p_liability_premiums_id => p_rec.liability_premiums_id
1060     ,p_organization_link_id  => p_rec.organization_link_id
1061     ,p_validation_start_date => p_validation_start_date
1062     ,p_validation_end_date   => p_validation_end_date);
1063   --
1064   chk_calculation_method
1065     (p_effective_date        => p_effective_date
1066     ,p_liability_premiums_id => p_rec.liability_premiums_id
1067     ,p_object_version_number => p_rec.object_version_number
1068     ,p_calculation_method    => p_rec.calculation_method);
1069   --
1070   chk_std_working_hours_per_year
1071     (p_effective_date             => p_effective_date
1072     ,p_liability_premiums_id      => p_rec.liability_premiums_id
1073     ,p_object_version_number      => p_rec.object_version_number
1074     ,p_std_working_hours_per_year => p_rec.std_working_hours_per_year);
1075   --
1076   chk_std_percentage
1077     (p_effective_date        => p_effective_date
1078     ,p_liability_premiums_id => p_rec.liability_premiums_id
1079     ,p_object_version_number => p_rec.object_version_number
1080     ,p_std_percentage        => p_rec.std_percentage);
1081   --
1082  chk_max_remuneration
1083     (p_effective_date        => p_effective_date
1084     ,p_liability_premiums_id => p_rec.liability_premiums_id
1085     ,p_object_version_number => p_rec.object_version_number
1086     ,p_max_remuneration      => p_rec.max_remuneration);
1087   --
1088   hr_lip_bus.chk_df(p_rec);
1089   --
1090   hr_utility.set_location(' Leaving:'||l_proc, 10);
1091 End update_validate;
1092 --
1093 -- ----------------------------------------------------------------------------
1094 -- |---------------------------< delete_validate >----------------------------|
1095 -- ----------------------------------------------------------------------------
1096 Procedure delete_validate
1097   (p_rec                    in hr_lip_shd.g_rec_type
1098   ,p_effective_date         in date
1099   ,p_datetrack_mode         in varchar2
1100   ,p_validation_start_date  in date
1101   ,p_validation_end_date    in date
1102   ) is
1103 --
1104   l_proc        varchar2(72) := g_package||'delete_validate';
1105 --
1106 Begin
1107   hr_utility.set_location('Entering:'||l_proc, 5);
1108   --
1109   -- Call all supporting business operations
1110   --
1111   dt_delete_validate
1112     (p_datetrack_mode                   => p_datetrack_mode
1113     ,p_validation_start_date            => p_validation_start_date
1114     ,p_validation_end_date              => p_validation_end_date
1115     ,p_liability_premiums_id            => p_rec.liability_premiums_id
1116     );
1117   --
1118   chk_overlapping_premiums
1119     (p_liability_premiums_id => p_rec.liability_premiums_id
1120     ,p_organization_link_id  => p_rec.organization_link_id
1121     ,p_validation_start_date => p_validation_start_date
1122     ,p_validation_end_date   => p_validation_end_date);
1123   --
1124   hr_utility.set_location(' Leaving:'||l_proc, 10);
1125 End delete_validate;
1126 --
1127 end hr_lip_bus;