DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_GB_ORG_INFO

Source


1 PACKAGE BODY PER_GB_ORG_INFO AS
2 /* $Header: pegborgp.pkb 120.6.12010000.2 2008/09/11 13:14:20 emunisek ship $ */
3  PROCEDURE CREATE_GB_ORG_INFO(
4          p_organization_id             NUMBER
5         ,p_org_info_type_code          VARCHAR2
6         ,p_org_information1            VARCHAR2
7         ,p_org_information3            VARCHAR2 --Added for bug 7338614
8         ,p_org_information10           VARCHAR2
9         ) is
10   l_tax_string             varchar2(30) ;
11   l_tax_district_reference varchar2(10);
12   l_tax_reference_number   varchar2(15);
13 
14 --
15 Cursor csr_org_info_exists is
16 select 1
17 from   hr_organization_information
18 where  organization_id   = p_organization_id
19 and    org_information_context = p_org_info_type_code
20 and    org_information1  = p_org_information1;
21 --
22 l_found NUMBER;
23 
24 BEGIN
25   --
26   -- Added for GSI Bug 5472781
27   --
28   IF hr_utility.chk_product_install('Oracle Human Resources', 'GB') THEN
29     --
30     IF (p_org_info_type_code = 'Tax Details References') THEN
31       open csr_org_info_exists;
32       fetch csr_org_info_exists into l_found;
33       if csr_org_info_exists%found then
34          close csr_org_info_exists;
35          hr_utility.set_message (800, 'HR_GB_78132_EMP_PAYE_REF_EXIST');
36          hr_utility.set_message_token('PAYE_REF', p_org_information1);
37          hr_utility.raise_error;
38       end if;
39       close csr_org_info_exists;
40     END IF;
41     --
42     --Added for bug 7338614
43     IF length(p_org_information3)>35 THEN
44        hr_utility.set_message (800, 'HR_GB_78140_EMP_STAT_NAME_MAX');
45        hr_utility.raise_error;
46     END IF;
47     --Bug 7338614 Ends
48     IF p_org_information10 = 'UK' THEN /*Bug 5084055*/
49        IF (p_org_info_type_code = 'Tax Details References') THEN
50           BEGIN
51             l_tax_district_reference := substr( p_org_information1, 1, INSTR(p_org_information1,'/')-1 );
52             l_tax_reference_number   := substr( p_org_information1, INSTR(p_org_information1,'/')+1 , length(p_org_information1) );
53 
54             IF (l_tax_district_reference is NULL OR l_tax_reference_number is NULL
55                OR length(l_tax_district_reference) <> 3
56                OR length(l_tax_reference_number) < 0 OR  length(l_tax_reference_number) > 10
57                OR pay_gb_eoy_magtape.validate_input(l_tax_reference_number, 'PAYE_REF') <> 0) THEN
58                   hr_utility.set_message (800, 'HR_GB_78049_INV_EMP_PAYE_REF');
59                   hr_utility.raise_error;
60             END IF;
61 
62             IF( to_number(l_tax_district_reference) = to_number(l_tax_district_reference) ) THEN
63                IF to_number(l_tax_district_reference) < 1 then
64                   hr_utility.set_message (800, 'HR_GB_78049_INV_EMP_PAYE_REF');
65                   hr_utility.raise_error;
66                ELSE
67                   null;
68                END IF;
69             END IF;
70           EXCEPTION
71           WHEN OTHERS THEN
72             hr_utility.set_message (800, 'HR_GB_78049_INV_EMP_PAYE_REF');
73             hr_utility.raise_error;
74           END;
75        END IF;
76     END IF;
77   END IF;
78 END CREATE_GB_ORG_INFO;
79 
80 
81 
82 PROCEDURE UPDATE_GB_ORG_INFO(
83          p_org_info_type_code     VARCHAR2
84         ,p_org_information1       VARCHAR2
85         ,p_org_information3       VARCHAR2 --Added for bug 7338614
86         ,p_org_information10      VARCHAR2
87         ,p_org_information_id     NUMBER
88         ) is
89 
90   l_tax_district_reference varchar2(10);
91   l_tax_reference_number   varchar2(15);
92 
93 --
94 Cursor csr_org_info_exists is
95 select 1
96 from   hr_organization_information
97 where  organization_id   = (select organization_id
98                             from   hr_organization_information
99                             where  org_information_id = p_org_information_id)
100 and    org_information_context = p_org_info_type_code
101 and    org_information1        = p_org_information1
102 and    org_information_id     <> p_org_information_id;
103 --
104 l_found NUMBER;
105 
106 BEGIN
107   --
108   -- Added for GSI Bug 5472781
109   --
110   IF hr_utility.chk_product_install('Oracle Human Resources', 'HU') THEN
111     --
112     IF (p_org_info_type_code = 'Tax Details References') THEN
113       IF (p_org_information1 <> hr_api.g_varchar2) THEN
114         open csr_org_info_exists;
115         fetch csr_org_info_exists into l_found;
116         if csr_org_info_exists%found then
117            close csr_org_info_exists;
118            hr_utility.set_message (800, 'HR_GB_78132_EMP_PAYE_REF_EXIST');
119            hr_utility.set_message_token('PAYE_REF', p_org_information1);
120            hr_utility.raise_error;
121         end if;
122         close csr_org_info_exists;
123       END IF;
124     END IF;
125     --
126     --Added for bug 7338614
127     IF length(p_org_information3)>35 THEN
128        hr_utility.set_message (800, 'HR_GB_78140_EMP_STAT_NAME_MAX');
129        hr_utility.raise_error;
130     END IF;
131     --Bug 7338614 Ends
132     IF p_org_information10 = 'UK' then /*Bug 5084055*/
133       IF (p_org_info_type_code = 'Tax Details References') THEN
134         IF (p_org_information1 <> hr_api.g_varchar2) THEN
135           BEGIN
136             l_tax_district_reference := substr( p_org_information1, 1, INSTR(p_org_information1,'/')-1 );
137             l_tax_reference_number   := substr( p_org_information1, INSTR(p_org_information1,'/')+1 , length(p_org_information1) );
138             IF (l_tax_district_reference is NULL OR  l_tax_reference_number is NULL
139                OR length(l_tax_district_reference) <> 3
140                OR length(l_tax_reference_number) < 0 OR  length(l_tax_reference_number) > 10
141                OR pay_gb_eoy_magtape.validate_input(l_tax_reference_number, 'PAYE_REF') <> 0 ) THEN
142              hr_utility.set_message (800, 'HR_GB_78049_INV_EMP_PAYE_REF');
143              hr_utility.raise_error;
144             END IF;
145 
146             IF (to_number(l_tax_district_reference) = to_number(l_tax_district_reference) ) THEN
147                IF to_number(l_tax_district_reference) < 1 then
148                   hr_utility.set_message (800, 'HR_GB_78049_INV_EMP_PAYE_REF');
149                   hr_utility.raise_error;
150                ELSE
151                   null;
152                END IF;
153             END IF;
154           EXCEPTION
155           WHEN OTHERS THEN
156              hr_utility.set_message (800, 'HR_GB_78049_INV_EMP_PAYE_REF');
157              hr_utility.raise_error;
158           END;
159         END IF;
160       END IF;
161     END IF;
162   END IF;
163 END UPDATE_GB_ORG_INFO;
164 
165 END PER_GB_ORG_INFO;