DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_KR_EXTRA_ASSIGNMENT_RULES

Source


1 package body per_kr_extra_assignment_rules as
2 /* $Header: pekrexas.pkb 120.1 2005/06/05 22:16:12 appldev noship $ */
3 --
4 procedure chk_establishment_id(
5             p_establishment_id   in number,
6             p_assignment_type    in varchar2,
7             p_payroll_id         in number,
8             p_effective_date     in date)
9 is
10   l_exists  varchar2(1);
11   cursor csr_bp is
12     select  'Y'
13     from    hr_kr_establishments_v
14     where   organization_id = p_establishment_id
15     and     p_effective_date
16             between date_from and nvl(date_to, p_effective_date);
17 begin
18 
19   -- 4409795: skip validation if KR legislation is not installed
20   if not hr_utility.chk_product_install('Oracle Human Resources', 'KR') then
21     hr_utility.trace ('KR Legislation not installed. Not performing the validations.');
22     return;
23   end if;
24 
25   --
26   -- Check whether the establishment is valid Business Place.
27   --
28   if p_establishment_id is not null then
29     open csr_bp;
30     fetch csr_bp into l_exists;
31     if csr_bp%NOTFOUND then
32       close csr_bp;
33       fnd_message.set_name('PER', 'PER_52818_INVALID_ESTAB');
34       fnd_message.raise_error;
35     end if;
36     close csr_bp;
37   else
38     --
39     -- When payroll_id is specified, establishment_id is mandatory.
40     -- This validation is done only for Payroll Assignment.
41     -- Applicant and Benefit Assignment are not eligible for this validation.
42     --
43     if p_assignment_type = 'E' and p_payroll_id is not null then
44       fnd_message.set_name('PAY', 'HR_INV_LEG_ENT_KR');
45       fnd_message.raise_error;
46     end if;
47   end if;
48 end chk_establishment_id;
49 --
50 procedure chk_establishment_id_upd(
51             p_establishment_id   in number,
52             p_establishment_id_o in number,
53             p_assignment_type    in varchar2,
54             p_payroll_id         in number,
55             p_effective_date     in date)
56 is
57 begin
58 
59   -- 4409795: skip validation if KR legislation is not installed
60 
61   if not hr_utility.chk_product_install('Oracle Human Resources', 'KR') then
62     hr_utility.trace ('KR Legislation not installed. Not performing the validations.');
63     return;
64   end if;
65 
66   if nvl(p_establishment_id, hr_api.g_number) <> nvl(p_establishment_id_o, hr_api.g_number) then
67     chk_establishment_id(
68       p_establishment_id => p_establishment_id,
69       p_assignment_type  => p_assignment_type,
70       p_payroll_id       => p_payroll_id,
71       p_effective_date   => p_effective_date);
72   else
73     --
74     -- When payroll_id is specified, establishment_id is mandatory.
75     -- This validation is done only for Payroll Assignment.
76     -- Applicant and Benefit Assignment are not eligible for this validation.
77     --
78     if p_assignment_type = 'E' and p_payroll_id is not null and p_establishment_id is null then
79       fnd_message.set_name('PAY', 'HR_INV_LEG_ENT_KR');
80       fnd_message.raise_error;
81     end if;
82   end if;
83 end chk_establishment_id_upd;
84 --
85 end per_kr_extra_assignment_rules;