DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_FWN_BUS

Source


1 Package Body hr_fwn_bus as
2 /* $Header: hrfwnrhi.pkb 115.4 2002/12/03 13:32:42 hjonnala noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_fwn_bus.';  -- Global package name
9 --
10 -- The following two global variables are only to be
11 -- used by the return_legislation_code function.
12 --
13 g_legislation_code            varchar2(150)  default null;
14 g_form_window_id              number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_form_window_id                       in number
22   ) is
23   --
24   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
25   --
26 begin
27   --
28   hr_utility.set_location('Entering:'|| l_proc, 10);
29   --
30   -- No business group context. Security group is not applicable.
31   --
32   null;
33   --
34   hr_utility.set_location(' Leaving:'|| l_proc, 20);
35   --
36 end set_security_group_id;
37 --
38 --  ---------------------------------------------------------------------------
39 --  |---------------------< return_legislation_code >-------------------------|
40 --  ---------------------------------------------------------------------------
41 --
42 Function return_legislation_code
43   (p_form_window_id                       in     number
44   )
45   Return Varchar2 Is
46   --
47   l_legislation_code  varchar2(150);
48   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
49   --
50 Begin
51   --
52   hr_utility.set_location('Entering:'|| l_proc, 10);
53   --
54   -- Legislation code not available for form canvases
55   --
56   l_legislation_code := null;
57   --
58   hr_utility.set_location(' Leaving:'|| l_proc, 40);
59   return l_legislation_code;
60 end return_legislation_code;
61 --
62 -- ----------------------------------------------------------------------------
63 -- |-----------------------< chk_non_updateable_args >------------------------|
64 -- ----------------------------------------------------------------------------
65 -- {Start Of Comments}
66 --
67 -- Description:
68 --   This procedure is used to ensure that non updateable attributes have
69 --   not been updated. If an attribute has been updated an error is generated.
70 --
71 -- Pre Conditions:
72 --   g_old_rec has been populated with details of the values currently in
73 --   the database.
74 --
75 -- In Arguments:
76 --   p_rec has been populated with the updated values the user would like the
77 --   record set to.
78 --
79 -- Post Success:
80 --   Processing continues if all the non updateable attributes have not
81 --   changed.
82 --
83 -- Post Failure:
84 --   An application error is raised if any of the non updatable attributes
85 --   have been altered.
86 --
87 -- {End Of Comments}
88 -- ----------------------------------------------------------------------------
89 Procedure chk_non_updateable_args
90   (p_rec in hr_fwn_shd.g_rec_type
91   ) IS
92 --
93   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
94   l_error    EXCEPTION;
95   l_argument varchar2(30);
96 --
97 Begin
98   --
99   -- Only proceed with the validation if a row exists for the current
100   -- record in the HR Schema.
101   --
102   IF NOT hr_fwn_shd.api_updating
103       (p_form_window_id                       => p_rec.form_window_id
104       ,p_object_version_number                => p_rec.object_version_number
105       ) THEN
106      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
107      fnd_message.set_token('PROCEDURE ', l_proc);
108      fnd_message.set_token('STEP ', '5');
109      fnd_message.raise_error;
110   END IF;
111   --
112   IF (nvl(p_rec.application_id,hr_api.g_number) <>
113       nvl(hr_fwn_shd.g_old_rec.application_id,hr_api.g_number)
114      ) THEN
115      l_argument := 'form_window_id';
116      RAISE l_error;
117   END IF;
118   --
119   IF (nvl(p_rec.form_id,hr_api.g_number) <>
120       nvl(hr_fwn_shd.g_old_rec.form_id,hr_api.g_number)
121      ) THEN
122      l_argument := 'form_window_id';
123      RAISE l_error;
124   END IF;
125   --
126   EXCEPTION
127     WHEN l_error THEN
128        hr_api.argument_changed_error
129          (p_api_name => l_proc
130          ,p_argument => l_argument);
131     WHEN OTHERS THEN
132        RAISE;
133 End chk_non_updateable_args;
134 --
135 -- ----------------------------------------------------------------------------
136 -- |--------------------------< chk_application_id >--------------------------|
137 -- ----------------------------------------------------------------------------
138 Procedure chk_application_id
139   (p_form_window_id               in number
140   ,p_object_version_number        in number
141   ,p_application_id               in number
142   ) is
143   l_check number;
144   CURSOR cur_chk_app_id
145   IS
146   SELECT 1
147   FROM fnd_application
148   WHERE application_id = p_application_id;
149   --
150   l_proc                         varchar2(72) := g_package || 'chk_application_id';
151   l_api_updating                 boolean;
152   --
153 Begin
154   hr_utility.set_location('Entering:'||l_proc, 10);
155   --
156   -- Check value has been passed
157   --
158   hr_api.mandatory_arg_error
159     (p_api_name                     => l_proc
160     ,p_argument                     => 'application_id'
161     ,p_argument_value               => p_application_id
162     );
163   --
164   OPEN cur_chk_app_id;
165   FETCH cur_chk_app_id INTO l_check;
166   IF cur_chk_app_id%NOTFOUND THEN
167     CLOSE cur_chk_app_id;
168 -- error message
169     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
170     fnd_message.set_token('PROCEDURE', l_proc);
171     fnd_message.set_token('STEP','10');
172     fnd_message.raise_error;
173   END IF;
174   CLOSE cur_chk_app_id;
175 --
176   hr_utility.set_location('Leaving:'||l_proc, 100);
177 End chk_application_id;
178 --
179 -- ----------------------------------------------------------------------------
180 -- |------------------------------< chk_form_id >-----------------------------|
181 -- ----------------------------------------------------------------------------
182 Procedure chk_form_id
183   (p_form_window_id               in number
184   ,p_object_version_number        in number
185   ,p_form_id                      in number
186   ,p_application_id               in number
187   ) is
188   l_check number;
189   CURSOR cur_chk_form_id
190   IS
191   SELECT 1
192   FROM fnd_form
193   WHERE form_id = p_form_id
194   AND application_id = p_application_id;
195   --
196   l_proc                         varchar2(72) := g_package || 'chk_form_id';
197   l_api_updating                 boolean;
198   --
199 Begin
200   hr_utility.set_location('Entering:'||l_proc, 10);
201   --
202   -- Check value has been passed
203   --
204   hr_api.mandatory_arg_error
205     (p_api_name                     => l_proc
206     ,p_argument                     => 'form_id'
207     ,p_argument_value               => p_form_id
208     );
209   OPEN cur_chk_form_id;
210   FETCH cur_chk_form_id INTO l_check;
211   IF cur_chk_form_id%NOTFOUND THEN
212     CLOSE cur_chk_form_id;
213 -- error message
214     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
215     fnd_message.set_token('PROCEDURE', l_proc);
216     fnd_message.set_token('STEP','10');
217     fnd_message.raise_error;
218   END IF;
219   CLOSE cur_chk_form_id;
220   --
221   hr_utility.set_location('Leaving:'||l_proc, 100);
222 End chk_form_id;
223 --
224 -- ----------------------------------------------------------------------------
225 -- |----------------------------< chk_window_name >---------------------------|
226 -- ----------------------------------------------------------------------------
227 Procedure chk_window_name
228   (p_form_window_id               in number
229   ,p_object_version_number        in number
230   ,p_window_name                  in varchar2
231   ) is
232   --
233   l_proc                         varchar2(72) := g_package || 'chk_window_name';
234   l_api_updating                 boolean;
235   --
236 Begin
237   hr_utility.set_location('Entering:'||l_proc, 10);
238   --
239   -- Check value has been passed
240   --
241   hr_api.mandatory_arg_error
242     (p_api_name                     => l_proc
243     ,p_argument                     => 'window_name'
244     ,p_argument_value               => p_window_name
245     );
246   --
247   -- Check value is in uppercase
248   --
249   if p_window_name <> upper(p_window_name) then
250     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
251     fnd_message.set_token('PROCEDURE', l_proc);
252     fnd_message.set_token('STEP','10');
253     fnd_message.raise_error;
254   end if;
255   --
256   hr_utility.set_location('Leaving:'||l_proc, 100);
257 End chk_window_name;
258 --
259 -- ----------------------------------------------------------------------------
260 -- |------------------------------< chk_delete >------------------------------|
261 -- ----------------------------------------------------------------------------
262 Procedure chk_delete
263   (p_rec                          in hr_fwn_shd.g_rec_type
264   ) is
265 --
266   l_proc  varchar2(72) := g_package||'chk_delete';
267 --
268 Begin
269   hr_utility.set_location('Entering:'||l_proc, 5);
270   --
271   -- No additional validation required
272   --
273   null;
274   --
275   hr_utility.set_location(' Leaving:'||l_proc, 10);
276 End chk_delete;
277 --
278 -- ----------------------------------------------------------------------------
279 -- |---------------------------< insert_validate >----------------------------|
280 -- ----------------------------------------------------------------------------
281 Procedure insert_validate
282   (p_rec                          in hr_fwn_shd.g_rec_type
283   ) is
284 --
285   l_proc  varchar2(72) := g_package||'insert_validate';
286 --
287 Begin
288   hr_utility.set_location('Entering:'||l_proc, 5);
289   --
290   -- Call all supporting business operations
291   -- No business group context.  HR_STANDARD_LOOKUPS used for validation.
292   --
293   chk_application_id
294     (p_form_window_id               => p_rec.form_window_id
295     ,p_object_version_number        => p_rec.object_version_number
296     ,p_application_id               => p_rec.application_id
297     );
298   --
299   chk_form_id
300     (p_form_window_id               => p_rec.form_window_id
301     ,p_object_version_number        => p_rec.object_version_number
302     ,p_form_id                      => p_rec.form_id
303     ,p_application_id               => p_rec.application_id
304     );
305   --
306   chk_window_name
307     (p_form_window_id               => p_rec.form_window_id
308     ,p_object_version_number        => p_rec.object_version_number
309     ,p_window_name                  => p_rec.window_name
310     );
311   --
312   hr_utility.set_location(' Leaving:'||l_proc, 10);
313 End insert_validate;
314 --
315 -- ----------------------------------------------------------------------------
316 -- |---------------------------< update_validate >----------------------------|
317 -- ----------------------------------------------------------------------------
318 Procedure update_validate
319   (p_rec                          in hr_fwn_shd.g_rec_type
320   ) is
321 --
322   l_proc  varchar2(72) := g_package||'update_validate';
323 --
324 Begin
325   hr_utility.set_location('Entering:'||l_proc, 5);
326   --
327   -- Call all supporting business operations
328   -- No business group context.  HR_STANDARD_LOOKUPS used for validation.
329   --
330   chk_non_updateable_args
331     (p_rec                          => p_rec
332     );
333   --
334   chk_application_id
335     (p_form_window_id               => p_rec.form_window_id
336     ,p_object_version_number        => p_rec.object_version_number
337     ,p_application_id               => p_rec.application_id
338     );
339   --
340   chk_form_id
341     (p_form_window_id               => p_rec.form_window_id
342     ,p_object_version_number        => p_rec.object_version_number
343     ,p_form_id                      => p_rec.form_id
344     ,p_application_id               => p_rec.application_id
345     );
346   --
347   chk_window_name
348     (p_form_window_id               => p_rec.form_window_id
349     ,p_object_version_number        => p_rec.object_version_number
350     ,p_window_name                  => p_rec.window_name
351     );
352   --
353   hr_utility.set_location(' Leaving:'||l_proc, 10);
354 End update_validate;
355 --
356 -- ----------------------------------------------------------------------------
357 -- |---------------------------< delete_validate >----------------------------|
358 -- ----------------------------------------------------------------------------
359 Procedure delete_validate
360   (p_rec                          in hr_fwn_shd.g_rec_type
361   ) is
362 --
363   l_proc  varchar2(72) := g_package||'delete_validate';
364 --
365 Begin
366   hr_utility.set_location('Entering:'||l_proc, 5);
367   --
368   -- Call all supporting business operations
369   --
370   chk_delete
371     (p_rec                          => p_rec
372     );
373   --
374   hr_utility.set_location(' Leaving:'||l_proc, 10);
375 End delete_validate;
376 --
377 end hr_fwn_bus;