DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_ERR_BUS

Source


1 Package Body hxc_err_bus as
2 /* $Header: hxcerrrhi.pkb 120.2 2005/09/23 08:08:12 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hxc_err_bus.';  -- Global package name
9 g_debug    boolean	:= hr_utility.debug_enabled;
10 --
11 -- The following two global variables are only to be
12 -- used by the return_legislation_code function.
13 --
14 g_legislation_code            varchar2(150)  default null;
15 g_error_id                    number         default null;
16 --
17 --  ---------------------------------------------------------------------------
18 --  |----------------------< set_security_group_id >--------------------------|
19 --  ---------------------------------------------------------------------------
20 --
21 Procedure set_security_group_id
22   (p_error_id                             in number
23   ,p_associated_column1                   in varchar2 default null
24   ) is
25 
26 /*  cursor csr_sec_grp is
27     select pbg.security_group_id,
28            pbg.legislation_code
29       from per_business_groups_perf pbg
30          , hxc_errors hxc
31      where hxc.error_id = p_error_id;
32      */
33   --
34   -- Declare local variables
35   --
36   l_security_group_id number;
37   l_proc              varchar2(72) ;
38   l_legislation_code  varchar2(150);
39   --
40 begin
41 null;
42 /*
43   --
44   g_debug:=hr_utility.debug_enabled;
45   if g_debug then
46 	l_proc :=  g_package||'set_security_group_id';
47 	hr_utility.set_location('Entering:'|| l_proc, 10);
48   end if;
49   --
50   -- Ensure that all the mandatory parameter are not null
51   --
52   hr_api.mandatory_arg_error
53     (p_api_name           => l_proc
54     ,p_argument           => 'error_id'
55     ,p_argument_value     => p_error_id
56     );
57   --
58   open csr_sec_grp;
59   fetch csr_sec_grp into l_security_group_id
60                        , l_legislation_code;
61   --
62   if csr_sec_grp%notfound then
63      --
64      close csr_sec_grp;
65      --
66      -- The primary key is invalid therefore we must error
67      --
68      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
69      hr_multi_message.add
70        (p_associated_column1
71         => nvl(p_associated_column1,'ERROR_ID')
72        );
73      --
74   else
75     close csr_sec_grp;
76     --
77     -- Set the security_group_id in CLIENT_INFO
78     --
79     hr_api.set_security_group_id
80       (p_security_group_id => l_security_group_id
81       );
82     --
83     -- Set the sessions legislation context in HR_SESSION_DATA
84     --
85     hr_api.set_legislation_context(l_legislation_code);
86   end if;
87   --
88   if g_debug then
89 	hr_utility.set_location(' Leaving:'|| l_proc, 20);
90   end if;
91   --
92   */
93 end set_security_group_id;
94 --
95 --  ---------------------------------------------------------------------------
96 --  |---------------------< return_legislation_code >-------------------------|
97 --  ---------------------------------------------------------------------------
98 --
99 Function return_legislation_code
100   (p_error_id                             in     number
101   )
102   Return Varchar2 Is
103 
104   cursor csr_leg_code is
105     select pbg.legislation_code
106       from per_business_groups_perf     pbg
107          , hxc_errors hxc
108      where hxc.error_id = p_error_id;
109   --
110   -- Declare local variables
111   --
112   l_legislation_code  varchar2(150);
113   l_proc              varchar2(72) ;
114   --
115 Begin
116 null;
117 /*
118   --
119   g_debug:=hr_utility.debug_enabled;
120   if g_debug then
121 	l_proc :=  g_package||'return_legislation_code';
122 	hr_utility.set_location('Entering:'|| l_proc, 10);
123   end if;
124   --
125   -- Ensure that all the mandatory parameter are not null
126   --
127   hr_api.mandatory_arg_error
128     (p_api_name           => l_proc
129     ,p_argument           => 'error_id'
130     ,p_argument_value     => p_error_id
131     );
132   --
133   if ( nvl(hxc_err_bus.g_error_id, hr_api.g_number)
134        = p_error_id) then
135     --
136     -- The legislation code has already been found with a previous
137     -- call to this function. Just return the value in the global
138     -- variable.
139     --
140     l_legislation_code := hxc_err_bus.g_legislation_code;
141     if g_debug then
142 	hr_utility.set_location(l_proc, 20);
143     end if;
144   else
145     --
146     -- The ID is different to the last call to this function
147     -- or this is the first call to this function.
148     --
149     open csr_leg_code;
150     fetch csr_leg_code into l_legislation_code;
151     --
152     if csr_leg_code%notfound then
153       --
154       -- The primary key is invalid therefore we must error
155       --
156       close csr_leg_code;
157       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
158       fnd_message.raise_error;
159     end if;
160     if g_debug then
161 	hr_utility.set_location(l_proc,30);
162     end if;
163     --
164     -- Set the global variables so the values are
165     -- available for the next call to this function.
166     --
167     close csr_leg_code;
168     hxc_err_bus.g_error_id                    := p_error_id;
169     hxc_err_bus.g_legislation_code  := l_legislation_code;
170   end if;
171   if g_debug then
172 	hr_utility.set_location(' Leaving:'|| l_proc, 40);
173   end if;
174   return l_legislation_code;
175 */
176 return null;
177 end return_legislation_code;
178 --
179 -- ----------------------------------------------------------------------------
180 -- |-----------------------< chk_non_updateable_args >------------------------|
181 -- ----------------------------------------------------------------------------
182 -- {Start Of Comments}
183 --
184 -- Description:
185 --   This procedure is used to ensure that non updateable attributes have
186 --   not been updated. If an attribute has been updated an error is generated.
187 --
188 -- Pre Conditions:
189 --   g_old_rec has been populated with details of the values currently in
190 --   the database.
191 --
192 -- In Arguments:
193 --   p_rec has been populated with the updated values the user would like the
194 --   record set to.
195 --
196 -- Post Success:
197 --   Processing continues if all the non updateable attributes have not
198 --   changed.
199 --
200 -- Post Failure:
201 --   An application error is raised if any of the non updatable attributes
202 --   have been altered.
203 --
204 -- {End Of Comments}
205 -- ----------------------------------------------------------------------------
206 Procedure chk_non_updateable_args
207   (p_rec in hxc_err_shd.g_rec_type
208   ) IS
209 --
210   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
211 --
212 Begin
213   --
214   -- Only proceed with the validation if a row exists for the current
215   -- record in the HR Schema.
216   --
217   IF NOT hxc_err_shd.api_updating
218       (p_error_id                          => p_rec.error_id
219       ,p_object_version_number             => p_rec.object_version_number
220       ) THEN
221      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
222      fnd_message.set_token('PROCEDURE ', l_proc);
223      fnd_message.set_token('STEP ', '5');
224      fnd_message.raise_error;
225   END IF;
226   --
227   --
228 End chk_non_updateable_args;
229 --
230 -- ----------------------------------------------------------------------------
231 -- |---------------------------< insert_validate >----------------------------|
232 -- ----------------------------------------------------------------------------
233 Procedure insert_validate
234   (p_rec                          in hxc_err_shd.g_rec_type
235   ) is
236 --
237   l_proc  varchar2(72);
238 --
239 Begin
240   g_debug:=hr_utility.debug_enabled;
241   if g_debug then
242 	l_proc := g_package||'insert_validate';
243 	hr_utility.set_location('Entering:'||l_proc, 5);
244   end if;
245   null;
246   --
247   --
248   if g_debug then
249 	hr_utility.set_location(' Leaving:'||l_proc, 10);
250   end if;
251 End insert_validate;
252 --
253 -- ----------------------------------------------------------------------------
254 -- |---------------------------< update_validate >----------------------------|
255 -- ----------------------------------------------------------------------------
256 Procedure update_validate
257   (p_rec                          in hxc_err_shd.g_rec_type
258   ) is
259 --
260   l_proc  varchar2(72);
261 --
262 Begin
263   g_debug:=hr_utility.debug_enabled;
264   if g_debug then
265 	l_proc := g_package||'update_validate';
266 	hr_utility.set_location('Entering:'||l_proc, 5);
267   end if;
268   --
269   --
270   chk_non_updateable_args
271     (p_rec              => p_rec
272     );
273   --
274   --
275   if g_debug then
276 	hr_utility.set_location(' Leaving:'||l_proc, 10);
277   end if;
278 End update_validate;
279 --
280 -- ----------------------------------------------------------------------------
281 -- |---------------------------< delete_validate >----------------------------|
282 -- ----------------------------------------------------------------------------
283 Procedure delete_validate
284   (p_rec                          in hxc_err_shd.g_rec_type
285   ) is
286 --
287   l_proc  varchar2(72) ;
288 --
289 Begin
290   g_debug:=hr_utility.debug_enabled;
291   if g_debug then
292 	l_proc:= g_package||'delete_validate';
293 	hr_utility.set_location('Entering:'||l_proc, 5);
294   end if;
295   --
296   -- Call all supporting business operations
297   --
298   if g_debug then
299 	hr_utility.set_location(' Leaving:'||l_proc, 10);
300   end if;
301 End delete_validate;
302 --
303 end hxc_err_bus;