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.2 2010/11/19 10:38:39 vaisriva ship $ */
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     -- Bug 10130643
44     -- Suppress checking establishment_id if the person is getting created
45     -- using global deployments (transfer of a person from one BG to another)
46         if    per_per_bus.g_global_transfer_in_process is null
47 	   or per_per_bus.g_global_transfer_in_process = false then
48     		if p_assignment_type = 'E' and p_payroll_id is not null then
49       			fnd_message.set_name('PAY', 'HR_INV_LEG_ENT_KR');
50       			fnd_message.raise_error;
51     		end if;
52   	end if;
53   end if;
54 end chk_establishment_id;
55 --
56 procedure chk_establishment_id_upd(
57             p_establishment_id   in number,
58             p_establishment_id_o in number,
59             p_assignment_type    in varchar2,
60             p_payroll_id         in number,
61             p_effective_date     in date)
62 is
63 begin
64 
65   -- 4409795: skip validation if KR legislation is not installed
66 
67   if not hr_utility.chk_product_install('Oracle Human Resources', 'KR') then
68     hr_utility.trace ('KR Legislation not installed. Not performing the validations.');
69     return;
70   end if;
71 
72   if nvl(p_establishment_id, hr_api.g_number) <> nvl(p_establishment_id_o, hr_api.g_number) then
73     chk_establishment_id(
74       p_establishment_id => p_establishment_id,
75       p_assignment_type  => p_assignment_type,
76       p_payroll_id       => p_payroll_id,
77       p_effective_date   => p_effective_date);
78   else
79     --
80     -- When payroll_id is specified, establishment_id is mandatory.
81     -- This validation is done only for Payroll Assignment.
82     -- Applicant and Benefit Assignment are not eligible for this validation.
83     --
84     -- Bug 10130643
85     -- Suppress checking establishment_id if the person is getting created
86     -- using global deployments (transfer of a person from one BG to another)
87         if    per_per_bus.g_global_transfer_in_process is null
88 	   or per_per_bus.g_global_transfer_in_process = false then
89     		if p_assignment_type = 'E' and p_payroll_id is not null and p_establishment_id is null then
90       			fnd_message.set_name('PAY', 'HR_INV_LEG_ENT_KR');
91       			fnd_message.raise_error;
92     		end if;
93   	end if;
94   end if;
95 end chk_establishment_id_upd;
96 --
97 end per_kr_extra_assignment_rules;