DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_FCN_BUS

Source


1 Package Body hr_fcn_bus as
2 /* $Header: hrfcnrhi.pkb 115.3 2002/12/03 10:18:31 hjonnala noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_fcn_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_canvas_id              number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_form_canvas_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_canvas_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_effective_date               in date
91   ,p_rec                          in hr_fcn_shd.g_rec_type
92   ) IS
93 --
94   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
95   l_error    EXCEPTION;
96   l_argument varchar2(30);
97 --
98 Begin
99   --
100   -- Only proceed with the validation if a row exists for the current
101   -- record in the HR Schema.
102   --
103   IF NOT hr_fcn_shd.api_updating
104       (p_form_canvas_id                       => p_rec.form_canvas_id
105       ,p_object_version_number                => p_rec.object_version_number
106       ) THEN
107      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
108      fnd_message.set_token('PROCEDURE ', l_proc);
109      fnd_message.set_token('STEP ', '5');
110      fnd_message.raise_error;
111   END IF;
112   --
113   IF (nvl(p_rec.form_window_id,hr_api.g_number) <>
114       nvl(hr_fcn_shd.g_old_rec.form_window_id,hr_api.g_number)
115      ) THEN
116      l_argument := 'form_window_id';
117      RAISE l_error;
118   END IF;
119   --
120   IF (nvl(p_rec.canvas_type,hr_api.g_varchar2) <>
121       nvl(hr_fcn_shd.g_old_rec.canvas_type,hr_api.g_varchar2)
122      ) THEN
123      l_argument := 'canvas_type';
124      RAISE l_error;
125   END IF;
126   --
127   EXCEPTION
128     WHEN l_error THEN
129        hr_api.argument_changed_error
130          (p_api_name => l_proc
131          ,p_argument => l_argument);
132     WHEN OTHERS THEN
133        RAISE;
134 End chk_non_updateable_args;
135 --
136 -- ----------------------------------------------------------------------------
137 -- |--------------------------< chk_form_window_id >--------------------------|
138 -- ----------------------------------------------------------------------------
139 Procedure chk_form_window_id
140   (p_effective_date               in date
141   ,p_form_canvas_id               in number
142   ,p_object_version_number        in number
143   ,p_form_window_id               in number
144   ) is
145   --
146   l_proc                         varchar2(72) := g_package || 'chk_form_window_id';
147   l_api_updating                 boolean;
148   --
149 Begin
150   hr_utility.set_location('Entering:'||l_proc, 10);
151   --
152   -- Check value has been passed
153   --
154   hr_api.mandatory_arg_error
155     (p_api_name                     => l_proc
156     ,p_argument                     => 'form_window_id'
157     ,p_argument_value               => p_form_window_id
158     );
159   --
160   hr_utility.set_location('Leaving:'||l_proc, 100);
161 End chk_form_window_id;
162 --
163 -- ----------------------------------------------------------------------------
164 -- |----------------------------< chk_canvas_name >---------------------------|
165 -- ----------------------------------------------------------------------------
166 Procedure chk_canvas_name
167   (p_effective_date               in date
168   ,p_form_canvas_id               in number
169   ,p_object_version_number        in number
170   ,p_canvas_name                  in varchar2
171   ) is
172   --
173   l_proc                         varchar2(72) := g_package || 'chk_canvas_name';
174   l_api_updating                 boolean;
175   --
176 Begin
177   hr_utility.set_location('Entering:'||l_proc, 10);
178   --
179   -- Check value has been passed
180   --
181   hr_api.mandatory_arg_error
182     (p_api_name                     => l_proc
183     ,p_argument                     => 'canvas_name'
184     ,p_argument_value               => p_canvas_name
185     );
186   --
187   -- Check value is in uppercase
188   --
189   if p_canvas_name <> upper(p_canvas_name) then
190     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
191     fnd_message.set_token('PROCEDURE', l_proc);
192     fnd_message.set_token('STEP','10');
193     fnd_message.raise_error;
194   end if;
195   --
196   hr_utility.set_location('Leaving:'||l_proc, 100);
197 End chk_canvas_name;
198 --
199 -- ----------------------------------------------------------------------------
200 -- |----------------------------< chk_canvas_type >---------------------------|
201 -- ----------------------------------------------------------------------------
202 Procedure chk_canvas_type
203   (p_effective_date               in date
204   ,p_form_canvas_id               in number
205   ,p_object_version_number        in number
206   ,p_canvas_type                  in varchar2
207   ) is
208   --
209   l_proc                         varchar2(72) := g_package || 'chk_canvas_type';
210   l_api_updating                 boolean;
211   --
212 Begin
213   hr_utility.set_location('Entering:'||l_proc, 10);
214   --
215   -- Check mandatory arguments have been set
216   --
217   hr_api.mandatory_arg_error
218     (p_api_name                     => l_proc
219     ,p_argument                     => 'effective_date'
220     ,p_argument_value               => p_effective_date
221     );
222   --
223   l_api_updating := hr_fcn_shd.api_updating
224     (p_form_canvas_id               => p_form_canvas_id
225     ,p_object_version_number        => p_object_version_number
226     );
227   hr_utility.set_location(l_proc,20);
228   --
229   -- Only proceed with SQL validation if absolutely necessary
230   --
231   if (  (   l_api_updating
232         and nvl(hr_fcn_shd.g_old_rec.canvas_type,hr_api.g_varchar2) <>
233             nvl(p_canvas_type,hr_api.g_varchar2))
234      or (NOT l_api_updating)) then
235     --
236     hr_utility.set_location(l_proc,30);
237     --
238     -- Check value has been passed
239     --
240     hr_api.mandatory_arg_error
241       (p_api_name                     => l_proc
242       ,p_argument                     => 'canvas_type'
243       ,p_argument_value               => p_canvas_type
244       );
245     --
246     hr_utility.set_location(l_proc,40);
247     --
248     -- Must exist in hr_standard_lookups where lookup_type is CANVAS_TYPES
249     --
250     if hr_api.not_exists_in_hrstanlookups
251       (p_effective_date               => p_effective_date
252       ,p_lookup_type                  => 'CANVAS_TYPES'
253       ,p_lookup_code                  => p_canvas_type
254       ) then
255       fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
256       fnd_message.set_token('PROCEDURE', l_proc);
257       fnd_message.set_token('STEP','10');
258       fnd_message.raise_error;
259     end if;
260     --
261   end if;
262   --
263   hr_utility.set_location('Leaving:'||l_proc, 100);
264 End chk_canvas_type;
265 --
266 -- ----------------------------------------------------------------------------
267 -- |------------------------------< chk_delete >------------------------------|
268 -- ----------------------------------------------------------------------------
269 Procedure chk_delete
270   (p_rec                          in hr_fcn_shd.g_rec_type
271   ) is
272 --
273   l_proc  varchar2(72) := g_package||'chk_delete';
274 --
275 Begin
276   hr_utility.set_location('Entering:'||l_proc, 5);
277   --
278   -- No additional validation required
279   --
280   null;
281   --
282   hr_utility.set_location(' Leaving:'||l_proc, 10);
283 End chk_delete;
284 --
285 -- ----------------------------------------------------------------------------
286 -- |---------------------------< insert_validate >----------------------------|
287 -- ----------------------------------------------------------------------------
288 Procedure insert_validate
289   (p_effective_date               in date
290   ,p_rec                          in hr_fcn_shd.g_rec_type
291   ) is
292 --
293   l_proc  varchar2(72) := g_package||'insert_validate';
294 --
295 Begin
296   hr_utility.set_location('Entering:'||l_proc, 5);
297   --
298   -- Check mandatory arguments have been set
299   --
300   hr_api.mandatory_arg_error
301     (p_api_name                     => l_proc
302     ,p_argument                     => 'effective_date'
303     ,p_argument_value               => p_effective_date
304     );
305   --
306   -- Call all supporting business operations
307   -- No business group context.  HR_STANDARD_LOOKUPS used for validation.
308   --
309   chk_form_window_id
310     (p_effective_date               => p_effective_date
311     ,p_form_canvas_id               => p_rec.form_canvas_id
312     ,p_object_version_number        => p_rec.object_version_number
313     ,p_form_window_id               => p_rec.form_window_id
314     );
315   --
316   chk_canvas_name
317     (p_effective_date               => p_effective_date
318     ,p_form_canvas_id               => p_rec.form_canvas_id
319     ,p_object_version_number        => p_rec.object_version_number
320     ,p_canvas_name                  => p_rec.canvas_name
321     );
322   --
323   chk_canvas_type
324     (p_effective_date               => p_effective_date
325     ,p_form_canvas_id               => p_rec.form_canvas_id
326     ,p_object_version_number        => p_rec.object_version_number
327     ,p_canvas_type                  => p_rec.canvas_type
328     );
329   --
330   hr_utility.set_location(' Leaving:'||l_proc, 10);
331 End insert_validate;
332 --
333 -- ----------------------------------------------------------------------------
334 -- |---------------------------< update_validate >----------------------------|
335 -- ----------------------------------------------------------------------------
336 Procedure update_validate
337   (p_effective_date               in date
338   ,p_rec                          in hr_fcn_shd.g_rec_type
339   ) is
340 --
341   l_proc  varchar2(72) := g_package||'update_validate';
342 --
343 Begin
344   hr_utility.set_location('Entering:'||l_proc, 5);
345   --
346   -- Check mandatory arguments have been set
347   --
348   hr_api.mandatory_arg_error
349     (p_api_name                     => l_proc
350     ,p_argument                     => 'effective_date'
351     ,p_argument_value               => p_effective_date
352     );
353   --
354   -- Call all supporting business operations
355   -- No business group context.  HR_STANDARD_LOOKUPS used for validation.
356   --
357   chk_non_updateable_args
358     (p_effective_date              => p_effective_date
359     ,p_rec                         => p_rec
360     );
361   --
362   chk_form_window_id
363     (p_effective_date               => p_effective_date
364     ,p_form_canvas_id               => p_rec.form_canvas_id
365     ,p_object_version_number        => p_rec.object_version_number
366     ,p_form_window_id               => p_rec.form_window_id
367     );
368   --
369   chk_canvas_name
370     (p_effective_date               => p_effective_date
371     ,p_form_canvas_id               => p_rec.form_canvas_id
372     ,p_object_version_number        => p_rec.object_version_number
373     ,p_canvas_name                  => p_rec.canvas_name
374     );
375   --
376   chk_canvas_type
377     (p_effective_date               => p_effective_date
378     ,p_form_canvas_id               => p_rec.form_canvas_id
379     ,p_object_version_number        => p_rec.object_version_number
380     ,p_canvas_type                  => p_rec.canvas_type
381     );
382   --
383   hr_utility.set_location(' Leaving:'||l_proc, 10);
384 End update_validate;
385 --
386 -- ----------------------------------------------------------------------------
387 -- |---------------------------< delete_validate >----------------------------|
388 -- ----------------------------------------------------------------------------
389 Procedure delete_validate
390   (p_rec                          in hr_fcn_shd.g_rec_type
391   ) is
392 --
393   l_proc  varchar2(72) := g_package||'delete_validate';
394 --
395 Begin
396   hr_utility.set_location('Entering:'||l_proc, 5);
397   --
398   -- Call all supporting business operations
399   --
400   chk_delete
401     (p_rec                         => p_rec
402     );
403   --
404   hr_utility.set_location(' Leaving:'||l_proc, 10);
405 End delete_validate;
406 --
407 end hr_fcn_bus;