1 PACKAGE BODY BEN_CHECK_ORGANIZATION AS
2 /* $Header: bechkorg.pkb 115.0 2003/04/30 11:44:08 glingapp noship $ */
3
4 cursor chk_org_role_upd(p_organization_id in number, p_date_from in date , p_date_to in date) is
5 select '1' from ben_popl_org_f
6 where organization_id = p_organization_id
7 and ( p_date_from > effective_start_date
8 or nvl(p_date_to, effective_end_date) < effective_end_date);
9
10 cursor chk_org_role_del(p_organization_id in number) is
11 select '1' from ben_popl_org_f
12 where organization_id = p_organization_id;
13
14 cursor chk_org_bnf_upd(p_organization_id in number, p_date_from in date, p_date_to in date) is
15 select '1' from ben_pl_bnf_f
16 where organization_id = p_organization_id
17 and ( p_date_from > effective_start_date
18 or nvl(p_date_to, effective_end_date) < effective_end_date);
19
20 cursor chk_org_bnf_del(p_organization_id in number) is
21 select '1' from ben_pl_bnf_f
22 where organization_id = p_organization_id;
23
24 l_data_exists varchar2(2);
25 l_status varchar2(1);
26 l_industry varchar2(1);
27
28 procedure chk_org_role_bnf_upd
29 (
30 p_organization_id IN hr_all_organization_units.organization_id%TYPE
31 ,p_date_from IN date
32 ,p_date_to IN date
33 )
34 is
35 Begin
36 if (fnd_installation.get(appl_id => 805
37 ,dep_appl_id => 805
38 ,status => l_status
39 ,industry => l_industry)) then
40 if (l_status = 'I') then
41 open chk_org_role_upd(p_organization_id, p_date_from, p_date_to);
42 fetch chk_org_role_upd into l_data_exists;
43 if chk_org_role_upd%found then
44 close chk_org_role_upd;
45 fnd_message.set_name('BEN', 'BEN_93384_ORG_ROLE_EXISTS');
46 fnd_message.raise_error;
47 end if;
48 close chk_org_role_upd;
49
50 open chk_org_bnf_upd(p_organization_id, p_date_from, p_date_to);
51 fetch chk_org_bnf_upd into l_data_exists;
52 if chk_org_bnf_upd%found then
53 close chk_org_bnf_upd;
54 fnd_message.set_name('BEN', 'BEN_93385_ORG_BNF_EXISTS');
55 fnd_message.raise_error;
56 end if;
57 close chk_org_bnf_upd;
58 end if;
59 end if;
60 End;
61
62 procedure chk_org_role_bnf_del
63 (
64 p_organization_id IN hr_all_organization_units.organization_id%TYPE
65 )
66 is
67 Begin
68 if (fnd_installation.get(appl_id => 805
69 ,dep_appl_id => 805
70 ,status => l_status
71 ,industry => l_industry)) then
72 if (l_status = 'I') then
73 open chk_org_role_del(p_organization_id);
74 fetch chk_org_role_del into l_data_exists;
75 if chk_org_role_del%found then
76 close chk_org_role_del;
77 fnd_message.set_name('BEN', 'BEN_93384_ORG_ROLE_EXISTS');
78 fnd_message.raise_error;
79 end if;
80 close chk_org_role_del;
81
82 open chk_org_bnf_del(p_organization_id);
83 fetch chk_org_bnf_del into l_data_exists;
84 if chk_org_bnf_del%found then
85 close chk_org_bnf_del;
86 fnd_message.set_name('BEN', 'BEN_93385_ORG_BNF_EXISTS');
87 fnd_message.raise_error;
88 end if;
89 close chk_org_bnf_del;
90 end if;
91 end if;
92 End;
93
94
95 END BEN_CHECK_ORGANIZATION;
96