DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_FTP_BUS

Source


1 Package Body hr_ftp_bus as
2 /* $Header: hrftprhi.pkb 115.3 2002/12/03 13:05:33 hjonnala noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_ftp_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_tab_page_id            number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_form_tab_page_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_tab_page_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 tab pages
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_ftp_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_ftp_shd.api_updating
104       (p_form_tab_page_id                     => p_rec.form_tab_page_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_canvas_id,hr_api.g_number) <>
114       nvl(hr_ftp_shd.g_old_rec.form_canvas_id,hr_api.g_number)
115      ) THEN
116      l_argument := 'form_canvas_id';
117      RAISE l_error;
118   END IF;
119   --
120   EXCEPTION
121     WHEN l_error THEN
122        hr_api.argument_changed_error
123          (p_api_name => l_proc
124          ,p_argument => l_argument);
125     WHEN OTHERS THEN
126        RAISE;
127 End chk_non_updateable_args;
128 --
129 -- ----------------------------------------------------------------------------
130 -- |--------------------------< chk_form_canvas_id >--------------------------|
131 -- ----------------------------------------------------------------------------
132 Procedure chk_form_canvas_id
133   (p_effective_date               in date
134   ,p_form_tab_page_id             in number
135   ,p_object_version_number        in number
136   ,p_form_canvas_id               in number
137   ) is
138   --
139   cursor csr_form_canvas is
140     select fcn.canvas_type
141       from hr_form_canvases_b fcn
142      where fcn.form_canvas_id = p_form_canvas_id;
143   --
144   l_proc                         varchar2(72) := g_package || 'chk_form_canvas_id';
145   l_api_updating                 boolean;
146   l_canvas_type                  varchar2(30);
147   --
148 Begin
149   hr_utility.set_location('Entering:'||l_proc, 10);
150   --
151   l_api_updating := hr_ftp_shd.api_updating
152     (p_form_tab_page_id             => p_form_tab_page_id
153     ,p_object_version_number        => p_object_version_number
154     );
155   hr_utility.set_location(l_proc,20);
156   --
157   -- Only proceed with SQL validation if absolutely necessary
158   --
159   if (  (   l_api_updating
160         and nvl(hr_ftp_shd.g_old_rec.form_canvas_id,hr_api.g_number) <>
161             nvl(p_form_canvas_id,hr_api.g_number))
162      or (NOT l_api_updating)) then
163     --
164     hr_utility.set_location(l_proc,30);
165     --
166     -- Check value has been passed
167     --
168     hr_api.mandatory_arg_error
169       (p_api_name                     => l_proc
170       ,p_argument                     => 'form_canvas_id'
171       ,p_argument_value               => p_form_canvas_id
172       );
173     --
174     hr_utility.set_location(l_proc,40);
175     --
176     -- Check canvas is of type TAB
177     --
178     open csr_form_canvas;
179     fetch csr_form_canvas into l_canvas_type;
180     if csr_form_canvas%notfound then
181       close csr_form_canvas;
182       fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
183       fnd_message.set_token('PROCEDURE', l_proc);
184       fnd_message.set_token('STEP','10');
185       fnd_message.raise_error;
186     end if;
187     close csr_form_canvas;
188     --
189     hr_utility.set_location(l_proc,50);
190     --
191     if nvl(l_canvas_type,hr_api.g_varchar2) <> 'TAB' then
192       fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
193       fnd_message.set_token('PROCEDURE', l_proc);
194       fnd_message.set_token('STEP','20');
195       fnd_message.raise_error;
196     end if;
197     --
198   end if;
199   --
200   hr_utility.set_location('Leaving:'||l_proc, 100);
201 End chk_form_canvas_id;
202 --
203 -- ----------------------------------------------------------------------------
204 -- |---------------------------< chk_tab_page_name >--------------------------|
205 -- ----------------------------------------------------------------------------
206 Procedure chk_tab_page_name
207   (p_effective_date               in date
208   ,p_form_tab_page_id             in number
209   ,p_object_version_number        in number
210   ,p_tab_page_name                in varchar2
211   ) is
212   --
213   l_proc                         varchar2(72) := g_package || 'chk_tab_page_name';
214   l_api_updating                 boolean;
215   --
216 Begin
217   hr_utility.set_location('Entering:'||l_proc, 10);
218   --
219   -- Check value has been passed
220   --
221   hr_api.mandatory_arg_error
222     (p_api_name                     => l_proc
223     ,p_argument                     => 'tab_page_name'
224     ,p_argument_value               => p_tab_page_name
225     );
226   --
227   -- Check value is in uppercase
228   --
229   if p_tab_page_name <> upper(p_tab_page_name) then
230     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
231     fnd_message.set_token('PROCEDURE', l_proc);
232     fnd_message.set_token('STEP','10');
233     fnd_message.raise_error;
234   end if;
235   --
236   hr_utility.set_location('Leaving:'||l_proc, 100);
237 End chk_tab_page_name;
238 --
239 -- ----------------------------------------------------------------------------
240 -- |---------------------------< chk_display_order >--------------------------|
241 -- ----------------------------------------------------------------------------
242 Procedure chk_display_order
243   (p_effective_date               in date
244   ,p_form_tab_page_id             in number
245   ,p_object_version_number        in number
246   ,p_display_order                in number
247   ) is
248   --
249   l_proc                         varchar2(72) := g_package || 'chk_display_order';
250   l_api_updating                 boolean;
251   --
252 Begin
253   hr_utility.set_location('Entering:'||l_proc, 10);
254   --
255   -- Check value has been passed
256   --
257   hr_api.mandatory_arg_error
258     (p_api_name                     => l_proc
259     ,p_argument                     => 'display_order'
260     ,p_argument_value               => p_display_order
261     );
262   --
263   -- Check value is greater than zero
264   --
265   if not p_display_order > 0 then
266     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
267     fnd_message.set_token('PROCEDURE', l_proc);
268     fnd_message.set_token('STEP','10');
269     fnd_message.raise_error;
270   end if;
271   --
272   hr_utility.set_location('Leaving:'||l_proc, 100);
273 End chk_display_order;
274 --
275 -- ----------------------------------------------------------------------------
276 -- |-------------------------< chk_visible_override >-------------------------|
277 -- ----------------------------------------------------------------------------
278 Procedure chk_visible_override
279   (p_effective_date               in date
280   ,p_form_tab_page_id             in number
281   ,p_object_version_number        in number
282   ,p_visible_override             in number
283   ) is
284   --
285   l_proc                         varchar2(72) := g_package || 'chk_visible_override';
286   l_api_updating                 boolean;
287   --
288 Begin
289   hr_utility.set_location('Entering:'||l_proc, 10);
290   --
291   -- Check mandatory arguments have been set
292   --
293   hr_api.mandatory_arg_error
294     (p_api_name                     => l_proc
295     ,p_argument                     => 'effective_date'
296     ,p_argument_value               => p_effective_date
297     );
298   --
299   l_api_updating := hr_ftp_shd.api_updating
300     (p_form_tab_page_id             => p_form_tab_page_id
301     ,p_object_version_number        => p_object_version_number
302     );
303   hr_utility.set_location(l_proc,20);
304   --
305   -- Only proceed with SQL validation if absolutely necessary
306   --
307   if (  (   l_api_updating
308         and nvl(hr_ftp_shd.g_old_rec.visible_override,hr_api.g_number) <>
309             nvl(p_visible_override,hr_api.g_number))
310      or (NOT l_api_updating)) then
311     --
312     hr_utility.set_location(l_proc,30);
313     --
314     if (p_visible_override is not null) then
315       --
316       hr_utility.set_location(l_proc,40);
317       --
318       -- Must exist in hr_standard_lookups where lookup_type is
319       -- PROPERTY_TRUE_OR_FALSE
320       --
321       if hr_api.not_exists_in_hrstanlookups
322         (p_effective_date               => p_effective_date
323         ,p_lookup_type                  => 'PROPERTY_TRUE_OR_FALSE'
324         ,p_lookup_code                  => p_visible_override
325         ) then
326         fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
327         fnd_message.set_token('PROCEDURE', l_proc);
328         fnd_message.set_token('STEP','10');
329         fnd_message.raise_error;
330       end if;
331       --
332     end if;
333     --
334   end if;
335   --
336   hr_utility.set_location('Leaving:'||l_proc, 100);
337 End chk_visible_override;
338 --
339 -- ----------------------------------------------------------------------------
340 -- |------------------------------< chk_delete >------------------------------|
341 -- ----------------------------------------------------------------------------
342 Procedure chk_delete
343   (p_rec                          in hr_ftp_shd.g_rec_type
344   ) is
345 --
346   l_proc  varchar2(72) := g_package||'chk_delete';
347 --
348 Begin
349   hr_utility.set_location('Entering:'||l_proc, 5);
350   --
351   -- No additional validation required
352   --
353   null;
354   --
355   hr_utility.set_location(' Leaving:'||l_proc, 10);
356 End chk_delete;
357 --
358 -- ----------------------------------------------------------------------------
359 -- |---------------------------< insert_validate >----------------------------|
360 -- ----------------------------------------------------------------------------
361 Procedure insert_validate
362   (p_effective_date               in date
363   ,p_rec                          in hr_ftp_shd.g_rec_type
364   ) is
365 --
366   l_proc  varchar2(72) := g_package||'insert_validate';
367 --
368 Begin
369   hr_utility.set_location('Entering:'||l_proc, 5);
370   --
371   -- Call all supporting business operations
372   -- No business group context.  HR_STANDARD_LOOKUPS used for validation.
373   --
374   chk_form_canvas_id
375     (p_effective_date               => p_effective_date
376     ,p_form_tab_page_id             => p_rec.form_tab_page_id
377     ,p_object_version_number        => p_rec.object_version_number
378     ,p_form_canvas_id               => p_rec.form_canvas_id
379     );
380   --
381   chk_tab_page_name
382     (p_effective_date               => p_effective_date
383     ,p_form_tab_page_id             => p_rec.form_tab_page_id
384     ,p_object_version_number        => p_rec.object_version_number
385     ,p_tab_page_name                => p_rec.tab_page_name
386     );
387   --
388   chk_display_order
389     (p_effective_date               => p_effective_date
390     ,p_form_tab_page_id             => p_rec.form_tab_page_id
391     ,p_object_version_number        => p_rec.object_version_number
392     ,p_display_order                => p_rec.display_order
393     );
394   --
395   chk_visible_override
396     (p_effective_date               => p_effective_date
397     ,p_form_tab_page_id             => p_rec.form_tab_page_id
398     ,p_object_version_number        => p_rec.object_version_number
399     ,p_visible_override             => p_rec.visible_override
400     );
401   --
402   hr_utility.set_location(' Leaving:'||l_proc, 10);
403 End insert_validate;
404 --
405 -- ----------------------------------------------------------------------------
406 -- |---------------------------< update_validate >----------------------------|
407 -- ----------------------------------------------------------------------------
408 Procedure update_validate
409   (p_effective_date               in date
410   ,p_rec                          in hr_ftp_shd.g_rec_type
411   ) is
412 --
413   l_proc  varchar2(72) := g_package||'update_validate';
414 --
415 Begin
416   hr_utility.set_location('Entering:'||l_proc, 5);
417   --
418   -- Call all supporting business operations
419   -- No business group context.  HR_STANDARD_LOOKUPS used for validation.
420   --
421   chk_non_updateable_args
422     (p_effective_date               => p_effective_date
423     ,p_rec                          => p_rec
424     );
425   --
426   chk_form_canvas_id
427     (p_effective_date               => p_effective_date
428     ,p_form_tab_page_id             => p_rec.form_tab_page_id
429     ,p_object_version_number        => p_rec.object_version_number
430     ,p_form_canvas_id               => p_rec.form_canvas_id
431     );
432   --
433   chk_tab_page_name
434     (p_effective_date               => p_effective_date
435     ,p_form_tab_page_id             => p_rec.form_tab_page_id
436     ,p_object_version_number        => p_rec.object_version_number
437     ,p_tab_page_name                => p_rec.tab_page_name
438     );
439   --
440   chk_display_order
441     (p_effective_date               => p_effective_date
442     ,p_form_tab_page_id             => p_rec.form_tab_page_id
443     ,p_object_version_number        => p_rec.object_version_number
444     ,p_display_order                => p_rec.display_order
445     );
446   --
447   chk_visible_override
448     (p_effective_date               => p_effective_date
449     ,p_form_tab_page_id             => p_rec.form_tab_page_id
450     ,p_object_version_number        => p_rec.object_version_number
451     ,p_visible_override             => p_rec.visible_override
452     );
453   --
454   hr_utility.set_location(' Leaving:'||l_proc, 10);
455 End update_validate;
456 --
457 -- ----------------------------------------------------------------------------
458 -- |---------------------------< delete_validate >----------------------------|
459 -- ----------------------------------------------------------------------------
460 Procedure delete_validate
461   (p_rec                          in hr_ftp_shd.g_rec_type
462   ) is
463 --
464   l_proc  varchar2(72) := g_package||'delete_validate';
465 --
466 Begin
467   hr_utility.set_location('Entering:'||l_proc, 5);
468   --
469   -- Call all supporting business operations
470   --
471   chk_delete
472     (p_rec                          => p_rec
473     );
474   --
475   hr_utility.set_location(' Leaving:'||l_proc, 10);
476 End delete_validate;
477 --
478 end hr_ftp_bus;