DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_REI_FLEX_DDF

Source


1 Package Body ghr_rei_flex_ddf as
2 /* $Header: ghreiddf.pkb 115.2 1999/11/09 22:50:09 pkm ship    $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= 'ghr_rei_flex_ddf.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |-------------------------------< ddf >-------------------------------------|
12 -- ----------------------------------------------------------------------------
13 procedure ddf
14   (p_rec   in ghr_rei_shd.g_rec_type) is
15 --
16   l_proc       varchar2(72) := g_package||'ddf';
17   l_error      exception;
18 --
19 Begin
20   hr_utility.set_location('Entering:'||l_proc, 5);
21   --
22   hr_utility.set_location('Entering:'||l_proc, 5);
23   --
24   --  Call check procedures to validate reason for submission, explanation and
25   --  service only
26   --  when information type is 'GHR_US_PD_GEN_EMP'.
27   --
28   if p_rec.information_type is not null then
29     if p_rec.information_type = 'GHR_US_PD_GEN_EMP' then
30       chk_reason_for_submission
31         (p_pa_request_extra_info_id  => p_rec.pa_request_extra_info_id
32         ,p_reason_for_submission     => p_rec.rei_information3
33         ,p_effective_date            => sysdate
34         ,p_object_version_number     => p_rec.object_version_number
35         );
36       chk_explanation
37         (p_reason_for_submission    => p_rec.rei_information3
38         ,p_pa_request_extra_info_id => p_rec.pa_request_extra_info_id
39         ,p_explanation              => p_rec.rei_information4
40         ,p_object_version_number    => p_rec.object_version_number
41         );
42       chk_service
43         (p_pa_request_extra_info_id => p_rec.pa_request_extra_info_id
44         ,p_service                  => p_rec.rei_information5
45         ,p_effective_date           => sysdate
46         ,p_object_version_number    => p_rec.object_version_number
47         );
48     end if;
49   end if;
50 /*
51   -- Check for value of reference field an then
52   -- call relevant validation procedure.
53   --
54   if <reference field value> is not null then
55     --
56     -- Reference field       => Information type
57     -- Reference field value => 'A'
58     --
59     else
60       --
61       -- Reference field values is not supported
62       --
63       hr_utility.set_message(8301, 'GHR_38117_FLEX_INV_REF_FIELD_V');
64       hr_utility.raise_error;
65     end if;
66   else
67     --
68     -- When the reference field is null, check
69     -- that none of the attribute fields have
70     -- been set
71     --
72   endif;
73 
74     if p_rec.rei_information1 is not null then
75       raise l_error;
76     elsif p_rec.rei_information2 is not null then
77       raise l_error;
78     elsif p_rec.rei_information3 is not null then
79       raise l_error;
80     elsif p_rec.rei_information4 is not null then
81       raise l_error;
82     elsif p_rec.rei_information5 is not null then
83       raise l_error;
84     elsif p_rec.rei_information6 is not null then
85       raise l_error;
86     elsif p_rec.rei_information7 is not null then
87       raise l_error;
88     elsif p_rec.rei_information8 is not null then
89       raise l_error;
90     elsif p_rec.rei_information9 is not null then
91       raise l_error;
92     elsif p_rec.rei_information10 is not null then
93       raise l_error;
94     elsif p_rec.rei_information11 is not null then
95       raise l_error;
96     elsif p_rec.rei_information12 is not null then
97       raise l_error;
98     elsif p_rec.rei_information13 is not null then
99       raise l_error;
100     elsif p_rec.rei_information14 is not null then
101       raise l_error;
102     elsif p_rec.rei_information15 is not null then
103       raise l_error;
104     elsif p_rec.rei_information16 is not null then
105       raise l_error;
106     elsif p_rec.rei_information17 is not null then
107       raise l_error;
108     elsif p_rec.rei_information18 is not null then
109       raise l_error;
110     elsif p_rec.rei_information19 is not null then
111       raise l_error;
112     elsif p_rec.rei_information20 is not null then
113       raise l_error;
114     elsif p_rec.rei_information21 is not null then
115       raise l_error;
116     elsif p_rec.rei_information22 is not null then
117       raise l_error;
118     elsif p_rec.rei_information23 is not null then
119       raise l_error;
120     elsif p_rec.rei_information24 is not null then
121       raise l_error;
122     elsif p_rec.rei_information25 is not null then
123       raise l_error;
124     elsif p_rec.rei_information26 is not null then
125       raise l_error;
126     elsif p_rec.rei_information27 is not null then
127       raise l_error;
128     elsif p_rec.rei_information28 is not null then
129       raise l_error;
130     elsif p_rec.rei_information29 is not null then
131       raise l_error;
132     elsif p_rec.rei_information30 is not null then
133       raise l_error;
134     end if;
135 */
136   --
137 
138   hr_utility.set_location(' Leaving:'||l_proc, 10);
139 exception
140   when l_error then
141     hr_utility.set_message(8301, 'GHR_38118_FLEX_INV_ATTRIBUTE_A');
142     hr_utility.raise_error;
143     hr_utility.set_location(' Leaving:'||l_proc, 10);
144 end ddf;
145 --
146 
147 -- -------------------------------------------------------------------------
148 -- |----------------------------- < chk_reason_for_submission > ------------|
149 -- -------------------------------------------------------------------------
150 --
151 procedure chk_reason_for_submission
152   (p_pa_request_extra_info_id    in  ghr_pa_request_extra_info.pa_request_extra_info_id%TYPE
153   ,p_reason_for_submission       in  ghr_pa_request_extra_info.rei_information3%TYPE
154   ,p_effective_date              in  date
155   ,p_object_version_number       in  number
156   ) is
157 --
158   l_proc          varchar2(72) := 'chk_reason_for_submission';
159   l_api_updating  boolean;
160 --
161 begin
162   hr_utility.set_location('Entering: '|| l_proc, 10);
163   --
164   --  Check mandatory parameters have been set
165   --
166   hr_api.mandatory_arg_error
167     (p_api_name         =>  l_proc
168     ,p_argument         =>  'effective date'
169     ,p_argument_value   =>  p_effective_date
170     );
171   --
172   --  Only proceed with validation if:
173   --  a) The current g_old_rec is current and
174   --  b) The reason_for_submission value has changed
175   --  c) A record is being inserted
176   --
177   l_api_updating := ghr_rei_shd.api_updating
178                       (p_pa_request_extra_info_id  => p_pa_request_extra_info_id
179                       ,p_object_version_number     => p_object_version_number
180                       );
181   if ((l_api_updating and
182        nvl(ghr_rei_shd.g_old_rec.rei_information3,hr_api.g_varchar2)
183        <> nvl(p_reason_for_submission, hr_api.g_varchar2)) or
184        (not l_api_updating))
185   then
186     hr_utility.set_location(l_proc, 20);
187     --
188     --  If reason_for_submission is not null then
189     --  Check if the reason_for_submission value exists in hr_lookups
190     --  where the lookup_type is 'GHR_US_SUBMISSION_REASON'
191     --
192     if p_reason_for_submission is not null
193     then
194       if hr_api.not_exists_in_hr_lookups
195            (p_effective_date  => p_effective_date
196            ,p_lookup_type     => 'GHR_US_SUBMISSION_REASON'
197            ,p_lookup_code     => p_reason_for_submission
198            )
199       then
200         -- Error: Invalid reason_for_submission
201         hr_utility.set_message(8301, 'GHR_REASON_FOR_SUB_INVALID');
202         hr_utility.raise_error;
203       end if;
204       hr_utility.set_location(l_proc, 30);
205     end if;
206   end if;
207   hr_utility.set_location(' Leavig:'|| l_proc, 40);
208 end chk_reason_for_submission;
209 --
210 -- ----------------------------------------------------------------------------------------------------
211 -- |------------------------------- < chk_explanation > ----------------------------------------------|
212 -- ----------------------------------------------------------------------------------------------------
213 --
214 procedure chk_explanation
215   (p_reason_for_submission       in  ghr_pa_request_extra_info.rei_information3%TYPE
216   ,p_pa_request_extra_info_id    in  ghr_pa_request_extra_info.pa_request_extra_info_id%TYPE
217   ,p_explanation                 in  ghr_pa_request_extra_info.rei_information4%TYPE
218   ,p_object_version_number       in  number
219   ) is
220 --
221   l_proc          varchar2(72) := 'chk_explanation';
222   l_api_updating  boolean;
223 --
224 begin
225   hr_utility.set_location('Entering: '|| l_proc, 10);
226   --
227   -- Only proceed with validation if a record is being inserted
228   --
229   l_api_updating := ghr_rei_shd.api_updating
230                       (p_pa_request_extra_info_id  => p_pa_request_extra_info_id
231                       ,p_object_version_number     => p_object_version_number
232                       );
233   if (not l_api_updating)
234   then
235     if (p_reason_for_submission = '4' and (p_explanation is null))
236     then
237       hr_utility.set_message(8301, 'GHR_NO_EXPLANATION');
238       hr_utility.raise_error;
239     end if;
240   end if;
241   hr_utility.set_location('Leaving: '|| l_proc, 20);
242 end chk_explanation;
243 --
244 -- ---------------------------------------------------------------------------------------------------
245 -- |-------------------------------- < chk_service > ------------------------------------------------|
246 -- ---------------------------------------------------------------------------------------------------
247 --
248 procedure chk_service
249   (p_pa_request_extra_info_id   in  ghr_pa_request_extra_info.pa_request_extra_info_id%TYPE
250   ,p_service                    in  ghr_pa_request_extra_info.rei_information5%TYPE
251   ,p_effective_date             in  date
252   ,p_object_version_number      in  number
253   ) is
254 --
255   l_proc          varchar2(72) := 'chk_service';
256   l_api_updating  boolean;
257 --
258 begin
259   hr_utility.set_location('Entering: '|| l_proc, 10);
260   --
261   --  Check mandatory parameters have been set
262   --
263   hr_api.mandatory_arg_error
264     (p_api_name        => l_proc
265     ,p_argument        => 'service'
266     ,p_argument_value  => p_service
267     );
268   --
269   --  Only proceed with validation if:
270   --  a) The current g_old_rec is current and
271   --  b) The service value has changed
272   --  c) A record is being inserted
273   --
274   l_api_updating := ghr_rei_shd.api_updating
275                       (p_pa_request_extra_info_id  => p_pa_request_extra_info_id
276                       ,p_object_version_number     => p_object_version_number
277                       );
278   --
279   if ((l_api_updating and
280        nvl(ghr_rei_shd.g_old_rec.rei_information5,hr_api.g_varchar2)
281        <> nvl(p_service, hr_api.g_varchar2)) or
282        (not l_api_updating))
283   then
284     hr_utility.set_location(l_proc, 20);
285     --
286     --  If service is not null then
287     --  Check if the service value exists in hr_lookups
288     --  where the lookup type is 'GHR_US_SERVICE'
289     --
290     if p_service is not null
291     then
292       if hr_api.not_exists_in_hr_lookups
293            (p_effective_date    => p_effective_date
294            ,P_lookup_type       => 'GHR_US_SERVICE'
295            ,p_lookup_code       => p_service
296            )
297       then
298         -- Error: Invalid Service
299         hr_utility.set_message(8301, 'GHR_SERVICE_INVALID');
300         hr_utility.raise_error;
301       end if;
302       hr_utility.set_location(l_proc, 30);
303     end if;
304   end if;
305   hr_utility.set_location(' Leaving:'|| l_proc, 40);
306 end chk_service;
307 --
308 end ghr_rei_flex_ddf;